diff --git a/src/components/BootstrapBlazor.EmbedPDF/BootstrapBlazor.EmbedPDF.csproj b/src/components/BootstrapBlazor.EmbedPDF/BootstrapBlazor.EmbedPDF.csproj index d65f7d52..3f138017 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/BootstrapBlazor.EmbedPDF.csproj +++ b/src/components/BootstrapBlazor.EmbedPDF/BootstrapBlazor.EmbedPDF.csproj @@ -1,7 +1,7 @@ - 11.0.4 + 11.0.5 bb-embedpdf diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/annotation-style-BZv7nj7j-BDYrzgLn.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/annotation-style-BZv7nj7j-z_uZITv9.js similarity index 99% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/annotation-style-BZv7nj7j-BDYrzgLn.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/annotation-style-BZv7nj7j-z_uZITv9.js index d39e6786..0a272514 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/annotation-style-BZv7nj7j-BDYrzgLn.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/annotation-style-BZv7nj7j-z_uZITv9.js @@ -1,5 +1,5 @@ -import { u as y, d as G, F as Z, $ as H, a0 as U, e as O, a1 as V, x as B, a2 as _, h as t, j as p, a3 as X, a4 as j, a5 as Y, g as L, r as D, E as J, i as W, a6 as Q, a7 as $, a8 as ee, a9 as te, W as ne, s as le, aa as ae } from "./wasm-url-asset-sqnq1cad.js"; -import { u as x } from "./labels-C6_i87Oj-BpJCC3cf.js"; +import { u as y, d as G, F as Z, $ as H, a0 as U, e as O, a1 as V, x as B, a2 as _, h as t, j as p, a3 as X, a4 as j, a5 as Y, g as L, r as D, E as J, i as W, a6 as Q, a7 as $, a8 as ee, a9 as te, W as ne, s as le, aa as ae } from "./wasm-url-asset-Dc0HnHB_.js"; +import { u as x } from "./labels-C6_i87Oj-xAdFtKWd.js"; const re = [ "#000000", "#5f6368", @@ -765,4 +765,4 @@ function Se() { export { Te as AnnotationStylePanel }; -//# sourceMappingURL=annotation-style-BZv7nj7j-BDYrzgLn.js.map +//# sourceMappingURL=annotation-style-BZv7nj7j-z_uZITv9.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/attachments-panel-CBvOCDpU-DcNUtnoD.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/attachments-panel-CBvOCDpU-B7OO6xRT.js similarity index 97% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/attachments-panel-CBvOCDpU-DcNUtnoD.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/attachments-panel-CBvOCDpU-B7OO6xRT.js index ce0aeef5..0408298f 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/attachments-panel-CBvOCDpU-DcNUtnoD.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/attachments-panel-CBvOCDpU-B7OO6xRT.js @@ -1,4 +1,4 @@ -import { u as k, N as F, at as O, au as j, F as A, P, m as B, av as L, s as N, g as S, n as z, h as n, H as E, aw as I, k as M, j as $, Q as H } from "./wasm-url-asset-sqnq1cad.js"; +import { u as k, N as F, at as O, au as j, F as A, P, m as B, av as L, s as N, g as S, n as z, h as n, H as E, aw as I, k as M, j as $, Q as H } from "./wasm-url-asset-Dc0HnHB_.js"; function R(t, r) { const [s, o] = t < 1e3 ? [t, "byte"] : t < 1e6 ? [t / 1e3, "kilobyte"] : [t / 1e6, "megabyte"]; return new Intl.NumberFormat(r, { @@ -142,4 +142,4 @@ function Q() { export { G as AttachmentsPanel }; -//# sourceMappingURL=attachments-panel-CBvOCDpU-DcNUtnoD.js.map +//# sourceMappingURL=attachments-panel-CBvOCDpU-B7OO6xRT.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/comments-panel-BJ1GRhZ0-BOiDUolf.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/comments-panel-BJ1GRhZ0-MnxRXHtZ.js similarity index 99% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/comments-panel-BJ1GRhZ0-BOiDUolf.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/comments-panel-BJ1GRhZ0-MnxRXHtZ.js index dbda96a6..3199d067 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/comments-panel-BJ1GRhZ0-BOiDUolf.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/comments-panel-BJ1GRhZ0-MnxRXHtZ.js @@ -1,4 +1,4 @@ -import { u as v, x as I, y as w, z as _, B as R, C as W, D as Y, n as D, s as P, E as A, r as H, h as t, F as $, G as j, j as T, H as G, g as q, J, K as Q, W as E, i as K, o as U, L as V, N as X, R as Z, P as ee, Q as te } from "./wasm-url-asset-sqnq1cad.js"; +import { u as v, x as I, y as w, z as _, B as R, C as W, D as Y, n as D, s as P, E as A, r as H, h as t, F as $, G as j, j as T, H as G, g as q, J, K as Q, W as E, i as K, o as U, L as V, N as X, R as Z, P as ee, Q as te } from "./wasm-url-asset-Dc0HnHB_.js"; const ne = { text: { icon: "message", @@ -467,4 +467,4 @@ function fe(e) { export { ge as CommentsPanel }; -//# sourceMappingURL=comments-panel-BJ1GRhZ0-BOiDUolf.js.map +//# sourceMappingURL=comments-panel-BJ1GRhZ0-MnxRXHtZ.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/embedpdf-worker.source-CCHXFWYh-CTEHza5m.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/embedpdf-worker.source-CCHXFWYh-CTEHza5m.js deleted file mode 100644 index 2fa2f9a7..00000000 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/embedpdf-worker.source-CCHXFWYh-CTEHza5m.js +++ /dev/null @@ -1,5 +0,0 @@ -var e = '"use strict";(()=>{let e,t,n,r,i,o,a,s,l,u,d,c,f,m,p;var h,F,g,_,P,D,b,y,w=Object.defineProperty,E=Object.getOwnPropertyNames,A=(e=function(e){if("u">typeof require)return require.apply(this,arguments);throw Error(\'Dynamic require of "\'+e+\'" is not supported\')},"u">typeof require?require:"u">typeof Proxy?new Proxy(e,{get:(e,t)=>("u">typeof require?require:e)[t]}):e),v=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},S=(e,t,n)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?w(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n},k={};v(k,{default:()=>_});var x=(t={"../runtime/npm/wasm32/lib/embedpdf.browser.js"(){var e;e=self.location.href,_=function(t={}){var n,r,i,o,a,s,l,u,d,c,f,m,p,h,F,g,_,P,D,b,y=new Promise((e,t)=>{n=e,r=t});["_EPDF_CheckPasswordPermissions","_EPDF_DigestBuffer","_EPDF_FreeBuffer","_EPDF_GetDecodedImageBytes","_EPDF_GetMetaKeyCount","_EPDF_GetMetaKeyName","_EPDF_GetMetaTrapped","_EPDF_GetPageBoxByIndex","_EPDF_GetPageRotateByIndex","_EPDF_GetPageTabOrderByIndex","_EPDF_GetPageUserUnitByIndex","_EPDF_HasMetaText","_EPDF_InitThread","_EPDF_IsEncrypted","_EPDF_IsOwnerUnlocked","_EPDF_LoadBaseDocument","_EPDF_LoadMemBaseDocument","_EPDF_LoadMemBaseDocument64","_EPDF_LoadPageNormalized","_EPDF_PNG_EncodeRGBA","_EPDF_ReleaseBaseDocument","_EPDF_RemoveEncryption","_EPDF_RenderAnnotBitmap","_EPDF_RenderAnnotBitmapUnrotated","_EPDF_RenderPage_Continue","_EPDF_RenderPageBitmapWithMatrix_Start","_EPDF_SaveAsCopyEx","_EPDF_SaveDocumentToOwnedBuffer","_EPDF_SaveDocumentToOwnedBufferEx","_EPDF_SaveDocumentToOwnedBufferWithVersion","_EPDF_SetBaseDocumentSha256","_EPDF_SetDecodedImageBudget","_EPDF_SetEncryption","_EPDF_SetMetaText","_EPDF_SetMetaTrapped","_EPDF_SetRuntimeOwnerPermissions","_EPDF_ShutdownThread","_EPDF_UnlockOwnerPermissions","_EPDFAction_CloseModel","_EPDFAction_CreateGoTo","_EPDFAction_CreateGoToNamed","_EPDFAction_CreateHide","_EPDFAction_CreateJavaScript","_EPDFAction_CreateLaunch","_EPDFAction_CreateNamed","_EPDFAction_CreateRemoteGoToByName","_EPDFAction_CreateRemoteGoToDest","_EPDFAction_CreateResetForm","_EPDFAction_CreateSubmitForm","_EPDFAction_CreateURI","_EPDFAction_GetNextAt","_EPDFAction_GetNextCount","_EPDFAction_GetNodeCount","_EPDFAction_GetNodeDest","_EPDFAction_GetNodeFilePath","_EPDFAction_GetNodeHideFlag","_EPDFAction_GetNodeJavaScript","_EPDFAction_GetNodeName","_EPDFAction_GetNodeResetForm","_EPDFAction_GetNodeSubmitForm","_EPDFAction_GetNodeSubmitFormCharSet","_EPDFAction_GetNodeSubmitFormURL","_EPDFAction_GetNodeSubtype","_EPDFAction_GetNodeTargetCount","_EPDFAction_GetNodeTargetName","_EPDFAction_GetNodeTargetObjectNumber","_EPDFAction_GetNodeType","_EPDFAction_GetNodeURI","_EPDFAction_GetNodeURIIsMap","_EPDFAction_GetRootNode","_EPDFAction_GetWarningFlags","_EPDFAction_IsComplete","_EPDFAction_LoadModel","_EPDFAction_NodeHasJavaScript","_EPDFAction_SetNext","_EPDFAnnot_AddMeasure","_EPDFAnnot_ClearBorderEffect","_EPDFAnnot_ClearColor","_EPDFAnnot_ClearEmbedMetadata","_EPDFAnnot_ClearEmbedMetadataKey","_EPDFAnnot_ClearMKColor","_EPDFAnnot_ClearMKIcon","_EPDFAnnot_ClearRectangleDifferences","_EPDFAnnot_ExportAppearance","_EPDFAnnot_GenerateAppearance","_EPDFAnnot_GenerateAppearanceWithBlend","_EPDFAnnot_GenerateFormFieldAP","_EPDFAnnot_GetActionModel","_EPDFAnnot_GetAPMatrix","_EPDFAnnot_GetAppearanceState","_EPDFAnnot_GetAppearanceStateCount","_EPDFAnnot_GetAppearanceStateName","_EPDFAnnot_GetAppearanceTransform","_EPDFAnnot_GetAvailableAppearanceModes","_EPDFAnnot_GetBlendMode","_EPDFAnnot_GetBooleanValue","_EPDFAnnot_GetBorderDashPattern","_EPDFAnnot_GetBorderDashPatternCount","_EPDFAnnot_GetBorderEffect","_EPDFAnnot_GetBorderStyle","_EPDFAnnot_GetCalloutLine","_EPDFAnnot_GetCalloutLineCount","_EPDFAnnot_GetColor","_EPDFAnnot_GetDefaultAppearance","_EPDFAnnot_GetDefaultAppearanceFontFace","_EPDFAnnot_GetDefaultAppearanceFontPostScriptName","_EPDFAnnot_GetDrawing","_EPDFAnnot_GetDrawingRect","_EPDFAnnot_GetEmbedMetadataBoolean","_EPDFAnnot_GetEmbedMetadataJSON","_EPDFAnnot_GetEmbedMetadataNumber","_EPDFAnnot_GetEmbedMetadataRect","_EPDFAnnot_GetEmbedMetadataString","_EPDFAnnot_GetFileAttachmentForWrite","_EPDFAnnot_GetIntent","_EPDFAnnot_GetLineCaption","_EPDFAnnot_GetLineEndings","_EPDFAnnot_GetLineLeader","_EPDFAnnot_GetMeasure","_EPDFAnnot_GetMKColor","_EPDFAnnot_GetMKIcon","_EPDFAnnot_GetMKRotation","_EPDFAnnot_GetMKText","_EPDFAnnot_GetMKTextPosition","_EPDFAnnot_GetName","_EPDFAnnot_GetObjectNumber","_EPDFAnnot_GetOpacity","_EPDFAnnot_GetOverlayText","_EPDFAnnot_GetOverlayTextRepeat","_EPDFAnnot_GetRect","_EPDFAnnot_GetRectangleDifferences","_EPDFAnnot_GetReplyType","_EPDFAnnot_GetRichContent","_EPDFAnnot_GetRichTextJSON","_EPDFAnnot_GetRotate","_EPDFAnnot_GetShapeCaption","_EPDFAnnot_GetStructurePosition","_EPDFAnnot_GetTextAlignment","_EPDFAnnot_HasAppearanceStream","_EPDFAnnot_HasEmbedMetadata","_EPDFAnnot_HasMKIcon","_EPDFAnnot_IsValid","_EPDFAnnot_RemoveAction","_EPDFAnnot_RemoveDest","_EPDFAnnot_RemoveKey","_EPDFAnnot_RemoveMeasure","_EPDFAnnot_SetAction","_EPDFAnnot_SetAPMatrix","_EPDFAnnot_SetAppearanceFromPage","_EPDFAnnot_SetBooleanValue","_EPDFAnnot_SetBorderDashPattern","_EPDFAnnot_SetBorderEffect","_EPDFAnnot_SetBorderStyle","_EPDFAnnot_SetCalloutLine","_EPDFAnnot_SetColor","_EPDFAnnot_SetDefaultAppearance","_EPDFAnnot_SetDefaultAppearanceDocumentFont","_EPDFAnnot_SetDefaultAppearanceRegisteredFont","_EPDFAnnot_SetDrawing","_EPDFAnnot_SetEmbedMetadataBoolean","_EPDFAnnot_SetEmbedMetadataJSON","_EPDFAnnot_SetEmbedMetadataNumber","_EPDFAnnot_SetEmbedMetadataRect","_EPDFAnnot_SetEmbedMetadataString","_EPDFAnnot_SetEventAction","_EPDFAnnot_SetIntent","_EPDFAnnot_SetLine","_EPDFAnnot_SetLineCaption","_EPDFAnnot_SetLineEndings","_EPDFAnnot_SetLineLeader","_EPDFAnnot_SetLinkedAnnot","_EPDFAnnot_SetMKColor","_EPDFAnnot_SetMKIcon","_EPDFAnnot_SetMKRotation","_EPDFAnnot_SetMKText","_EPDFAnnot_SetMKTextPosition","_EPDFAnnot_SetName","_EPDFAnnot_SetNoColor","_EPDFAnnot_SetNumberValue","_EPDFAnnot_SetOpacity","_EPDFAnnot_SetOverlayText","_EPDFAnnot_SetOverlayTextRepeat","_EPDFAnnot_SetRect","_EPDFAnnot_SetReplyType","_EPDFAnnot_SetRichTextJSON","_EPDFAnnot_SetRichTextXHTML","_EPDFAnnot_SetRotate","_EPDFAnnot_SetShapeCaption","_EPDFAnnot_SetStampOpacity","_EPDFAnnot_SetSubtype","_EPDFAnnot_SetTextAlignment","_EPDFAnnot_SetVertices","_EPDFAnnot_UpdateAppearanceToRect","_EPDFAttachment_ExportCanonicalToOwnedBuffer","_EPDFAttachment_ExportRawToOwnedBuffer","_EPDFAttachment_ExtractFile","_EPDFAttachment_ExtractFileToOwnedBuffer","_EPDFAttachment_GetDescription","_EPDFAttachment_GetIntegerValue","_EPDFAttachment_ImportRaw","_EPDFAttachment_SetDescription","_EPDFAttachment_SetName","_EPDFAttachment_SetSubtype","_EPDFCatalog_GetLanguage","_EPDFCatalog_GetMetadata","_EPDFCatalog_SetMetadata","_EPDFDest_CreateRemoteView","_EPDFDest_CreateRemoteXYZ","_EPDFDest_CreateView","_EPDFDest_CreateViewByObjectNumber","_EPDFDest_CreateXYZ","_EPDFDest_CreateXYZByObjectNumber","_EPDFDest_GetPageObjectNumber","_EPDFDest_GetViewNullParams","_EPDFDoc_CanonicalDrawing","_EPDFDoc_ClearMissingCharacters","_EPDFDoc_ClearPagePieceInfoEntry","_EPDFDoc_ClearPagePieceInfoKey","_EPDFDoc_ClearPieceInfoEntry","_EPDFDoc_ClearPieceInfoKey","_EPDFDoc_CompareRevisions","_EPDFDoc_CountMissingCharacters","_EPDFDoc_DeletePageByObjectNumber","_EPDFDoc_ExportDictCanonicalToOwnedBuffer","_EPDFDoc_ExportDictRawToOwnedBuffer","_EPDFDoc_ExportDrawing","_EPDFDoc_ExportPagesFlattened","_EPDFDoc_GetAdditionalActionModel","_EPDFDoc_GetAttachmentIndexByKey","_EPDFDoc_GetAttachmentKey","_EPDFDoc_GetBaseBytesSize","_EPDFDoc_GetDrawings","_EPDFDoc_GetFontDisplayProgramCoverage","_EPDFDoc_GetFontDisplayProgramData","_EPDFDoc_GetFontEmbeddingPolicy","_EPDFDoc_GetFontProgramData","_EPDFDoc_GetFontsFingerprint","_EPDFDoc_GetImportFieldRoots","_EPDFDoc_GetLastModified","_EPDFDoc_GetLoadedBytesSize","_EPDFDoc_GetLoadedObjectValue","_EPDFDoc_GetMissingCharacter","_EPDFDoc_GetNamedJavaScriptActionModel","_EPDFDoc_GetNamedPageAt","_EPDFDoc_GetNamedPageCount","_EPDFDoc_GetOpenActionDest","_EPDFDoc_GetOpenActionModel","_EPDFDoc_GetPageActionModel","_EPDFDoc_GetPageLabelSectionAt","_EPDFDoc_GetPageLabelSectionCount","_EPDFDoc_GetPageLastModified","_EPDFDoc_GetPageObjectNumberByIndex","_EPDFDoc_GetPagePieceInfoBoolean","_EPDFDoc_GetPagePieceInfoEntryAt","_EPDFDoc_GetPagePieceInfoEntryCount","_EPDFDoc_GetPagePieceInfoKeyAt","_EPDFDoc_GetPagePieceInfoKeyCount","_EPDFDoc_GetPagePieceInfoLastModified","_EPDFDoc_GetPagePieceInfoName","_EPDFDoc_GetPagePieceInfoNumber","_EPDFDoc_GetPagePieceInfoString","_EPDFDoc_GetPagePieceInfoStringArrayAt","_EPDFDoc_GetPagePieceInfoStringArrayCount","_EPDFDoc_GetPagePieceInfoValueType","_EPDFDoc_GetPieceInfoBoolean","_EPDFDoc_GetPieceInfoEntryAt","_EPDFDoc_GetPieceInfoEntryCount","_EPDFDoc_GetPieceInfoKeyAt","_EPDFDoc_GetPieceInfoKeyCount","_EPDFDoc_GetPieceInfoLastModified","_EPDFDoc_GetPieceInfoName","_EPDFDoc_GetPieceInfoNumber","_EPDFDoc_GetPieceInfoString","_EPDFDoc_GetPieceInfoStringArrayAt","_EPDFDoc_GetPieceInfoStringArrayCount","_EPDFDoc_GetPieceInfoValueType","_EPDFDoc_GetRevision","_EPDFDoc_GetRevisionCount","_EPDFDoc_GetStructureObjectNumbers","_EPDFDoc_GetTypographicFeatures","_EPDFDoc_HasPagePieceInfoEntry","_EPDFDoc_HasPieceInfoEntry","_EPDFDoc_ImportDictRaw","_EPDFDoc_ImportDrawing","_EPDFDoc_ImportPages","_EPDFDoc_LoadPageByObjectNumber","_EPDFDoc_LoadPageByObjectNumberNormalized","_EPDFDoc_OpenBaseOverlay","_EPDFDoc_OpenBaseOverlayFromPath","_EPDFDoc_OpenRevision","_EPDFDoc_ReadLoadedBytes","_EPDFDoc_RemoveNamedPage","_EPDFDoc_RemoveNamedPagesForPage","_EPDFDoc_ResolveFonts","_EPDFDoc_SetFontEmbeddingPolicy","_EPDFDoc_SetNamedPage","_EPDFDoc_SetPageLabelSections","_EPDFDoc_SetPagePieceInfoBoolean","_EPDFDoc_SetPagePieceInfoName","_EPDFDoc_SetPagePieceInfoNumber","_EPDFDoc_SetPagePieceInfoString","_EPDFDoc_SetPagePieceInfoStringArray","_EPDFDoc_SetPageRotationByObjectNumber","_EPDFDoc_SetPieceInfoBoolean","_EPDFDoc_SetPieceInfoName","_EPDFDoc_SetPieceInfoNumber","_EPDFDoc_SetPieceInfoString","_EPDFDoc_SetPieceInfoStringArray","_EPDFDoc_SetTypographicFeatures","_EPDFDoc_StartLoadPageByObjectNumber","_EPDFDocument_ClearEmbedMetadata","_EPDFDss_Add","_EPDFDss_GetCount","_EPDFDss_GetData","_EPDFFont_AddFallbackFont","_EPDFFont_AuthorizeEditing","_EPDFFont_ClearFallbackFonts","_EPDFFont_ClearRegisteredFonts","_EPDFFont_GetCoverage","_EPDFFont_GetEmbeddingPermission","_EPDFFont_GetFallbackOrder","_EPDFFont_GetFamilyName","_EPDFFont_GetLastResortFont","_EPDFFont_GetMetrics","_EPDFFont_GetPostScriptName","_EPDFFont_GetProgramData","_EPDFFont_GetProgramFormat","_EPDFFont_GetProgramHash","_EPDFFont_GetWeight","_EPDFFont_IsEditingAuthorized","_EPDFFont_IsInstanced","_EPDFFont_IsItalic","_EPDFFont_RegisterFont","_EPDFFont_RegisterMemFont","_EPDFFont_RegisterMemFont64","_EPDFFont_SetLastResortFont","_EPDFFontFaces_Close","_EPDFFontFaces_Count","_EPDFFontFaces_CountPrograms","_EPDFFontFaces_GetFamily","_EPDFFontFaces_GetProgramDisplayHash","_EPDFFontFaces_GetProgramEmbedded","_EPDFFontFaces_GetProgramEmbeddingPermission","_EPDFFontFaces_GetProgramFormat","_EPDFFontFaces_GetProgramHash","_EPDFFontFaces_GetProgramMetrics","_EPDFFontFaces_GetProgramObjNum","_EPDFFontFaces_GetProgramPostScriptName","_EPDFFontFaces_GetWeight","_EPDFFontFaces_IsItalic","_EPDFFontFaces_Load","_EPDFFontFaces_ProgramMapsUnicode","_EPDFFontResolution_Close","_EPDFFontResolution_CountMissingCharacters","_EPDFFontResolution_GetBaseFontName","_EPDFFontResolution_GetFallbacks","_EPDFFontResolution_GetFamily","_EPDFFontResolution_GetMissingCharacter","_EPDFFontResolution_GetProgramDisplayHash","_EPDFFontResolution_GetProgramObjNum","_EPDFFontResolution_GetRegisteredFont","_EPDFFontResolution_GetSource","_EPDFFontResolution_GetWeight","_EPDFFontResolution_IsDegraded","_EPDFFontResolution_IsItalic","_EPDFForm_AttachWidget","_EPDFForm_ClearFieldEmbedMetadata","_EPDFForm_ClearFieldEmbedMetadataKey","_EPDFForm_CloseModel","_EPDFForm_CountCalculationOrder","_EPDFForm_CountFieldDefaultValues","_EPDFForm_CountFieldOptions","_EPDFForm_CountFields","_EPDFForm_CountFieldValues","_EPDFForm_CountFieldWidgets","_EPDFForm_CreateField","_EPDFForm_DeleteField","_EPDFForm_DetachWidget","_EPDFForm_ExportFDF","_EPDFForm_ExportFieldRawToOwnedBuffer","_EPDFForm_ExportXFDF","_EPDFForm_GetCalculationOrderFieldIndex","_EPDFForm_GetFieldActionModel","_EPDFForm_GetFieldAlternateName","_EPDFForm_GetFieldDefaultValueAt","_EPDFForm_GetFieldDefaultValueKind","_EPDFForm_GetFieldEmbedMetadataBoolean","_EPDFForm_GetFieldEmbedMetadataJSON","_EPDFForm_GetFieldEmbedMetadataNumber","_EPDFForm_GetFieldEmbedMetadataString","_EPDFForm_GetFieldFamily","_EPDFForm_GetFieldFlags","_EPDFForm_GetFieldIndexByObjNum","_EPDFForm_GetFieldIndexForWidget","_EPDFForm_GetFieldMappingName","_EPDFForm_GetFieldMaxLen","_EPDFForm_GetFieldName","_EPDFForm_GetFieldObjNum","_EPDFForm_GetFieldOptionLabel","_EPDFForm_GetFieldOptionValue","_EPDFForm_GetFieldOrigin","_EPDFForm_GetFieldPartialName","_EPDFForm_GetFieldTopIndex","_EPDFForm_GetFieldValueAt","_EPDFForm_GetFieldValueKind","_EPDFForm_GetFieldWidgetExportValue","_EPDFForm_GetFieldWidgetObjNum","_EPDFForm_GetFieldWidgetOnState","_EPDFForm_GetFieldWidgetPageObjNum","_EPDFForm_GetFieldWidgetRect","_EPDFForm_GetFormKind","_EPDFForm_GetNeedAppearances","_EPDFForm_HasFieldEmbedMetadata","_EPDFForm_HasFieldValuesList","_EPDFForm_ImportFieldRaw","_EPDFForm_IsFieldOptionSelected","_EPDFForm_IsFieldWidgetChecked","_EPDFForm_LoadModel","_EPDFForm_RedrawFieldWidgets","_EPDFForm_Repair","_EPDFForm_SetCalculationOrder","_EPDFForm_SetFieldAlternateName","_EPDFForm_SetFieldAppearanceText","_EPDFForm_SetFieldDefaultValue","_EPDFForm_SetFieldDisplay","_EPDFForm_SetFieldEmbedMetadataBoolean","_EPDFForm_SetFieldEmbedMetadataJSON","_EPDFForm_SetFieldEmbedMetadataNumber","_EPDFForm_SetFieldEmbedMetadataString","_EPDFForm_SetFieldEventAction","_EPDFForm_SetFieldFlags","_EPDFForm_SetFieldMappingName","_EPDFForm_SetFieldMaxLen","_EPDFForm_SetFieldName","_EPDFForm_SetFieldOptions","_EPDFForm_SetFieldSelectedIndices","_EPDFForm_SetFieldValue","_EPDFForm_SetFieldWidgetsChecked","_EPDFImageObj_SetJpeg","_EPDFImageObj_SetPng","_EPDFLayer_AbortTransaction","_EPDFLayer_BeginTransaction","_EPDFLayer_CommitTransaction","_EPDFLayer_GetBaseDocument","_EPDFLayer_GetBaseSha256","_EPDFLayer_GetBirthName","_EPDFLayer_GetBirthObjectNumber","_EPDFLayer_GetLastObjectNumber","_EPDFLayer_GetPromotedObjectCount","_EPDFLayer_IsInTransaction","_EPDFLayer_IsObjectPromoted","_EPDFLayer_IsPagePromoted","_EPDFLayer_OpenLayer","_EPDFLayer_OpenLayerArtifact","_EPDFLayer_OpenLayerArtifactFromPath","_EPDFLayer_RaiseLastObjectNumber","_EPDFLayer_SaveDelta","_EPDFLayer_SaveDeltaEx","_EPDFLayer_SaveDeltaToOwnedBuffer","_EPDFLayer_SaveDeltaToOwnedBufferEx","_EPDFLayer_SaveLayerArtifact","_EPDFLayer_SaveLayerArtifactEx","_EPDFLayer_SaveLayerArtifactToOwnedBuffer","_EPDFLayer_SaveLayerArtifactToOwnedBufferEx","_EPDFMeasure_AddFormat","_EPDFMeasure_CountFormats","_EPDFMeasure_GetCYX","_EPDFMeasure_GetFormat","_EPDFMeasure_GetOrigin","_EPDFMeasure_GetRatio","_EPDFMeasure_GetSubtype","_EPDFMeasure_RemoveFormats","_EPDFMeasure_SetCYX","_EPDFMeasure_SetOrigin","_EPDFMeasure_SetRatio","_EPDFNamedDest_Remove","_EPDFNamedDest_SetDest","_EPDFNumberFormat_GetConversion","_EPDFNumberFormat_GetFixedDenominator","_EPDFNumberFormat_GetFraction","_EPDFNumberFormat_GetLabelPosition","_EPDFNumberFormat_GetPrecision","_EPDFNumberFormat_GetText","_EPDFNumberFormat_GetUnit","_EPDFNumberFormat_SetConversion","_EPDFNumberFormat_SetFixedDenominator","_EPDFNumberFormat_SetFraction","_EPDFNumberFormat_SetLabelPosition","_EPDFNumberFormat_SetPrecision","_EPDFNumberFormat_SetText","_EPDFNumberFormat_SetUnit","_EPDFObjectDiff_Close","_EPDFObjectDiff_GetCount","_EPDFObjectDiff_GetEntry","_EPDFObjectDiff_GetReadStatus","_EPDFObjectDiff_GetReferrer","_EPDFObjectDiff_GetReferrerCount","_EPDFObjectDiff_GetRevisionHealth","_EPDFObjectDiff_GetValue","_EPDFOutline_CreateItem","_EPDFOutline_DeleteItem","_EPDFOutline_ExportItemRawToOwnedBuffer","_EPDFOutline_GetItem","_EPDFOutline_GetObjectNumber","_EPDFOutline_ImportItemRaw","_EPDFOutline_MoveItem","_EPDFOutline_SetAction","_EPDFOutline_SetColor","_EPDFOutline_SetOpen","_EPDFOutline_SetStyle","_EPDFOutline_SetTitle","_EPDFPage_AddViewport","_EPDFPage_AddViewportRaw","_EPDFPage_ApplyRedactions","_EPDFPage_ContinueLoad","_EPDFPage_CountViewports","_EPDFPage_CountViewportsRaw","_EPDFPage_CreateAnnot","_EPDFPage_CreateAnnotRaw","_EPDFPage_ExportAnnotationsAsDocument","_EPDFPage_ExportAnnotsRawToOwnedBuffer","_EPDFPage_ExportRawToOwnedBuffer","_EPDFPage_FindViewport","_EPDFPage_Flatten","_EPDFPage_FlattenAnnotations","_EPDFPage_GetAnnotByName","_EPDFPage_GetAnnotByObjectNumber","_EPDFPage_GetAnnotCountRaw","_EPDFPage_GetAnnotIndexByNameRaw","_EPDFPage_GetAnnotIndexByObjectNumberRaw","_EPDFPage_GetAnnotRaw","_EPDFPage_GetObjectNumber","_EPDFPage_GetParsedSize","_EPDFPage_GetViewport","_EPDFPage_GetViewportRaw","_EPDFPage_ImportAnnotsRaw","_EPDFPage_ImportRaw","_EPDFPage_InsertBlankRaw","_EPDFPage_IsContentCurrent","_EPDFPage_IsValid","_EPDFPage_MoveAnnots","_EPDFPage_MoveAnnotsRaw","_EPDFPage_PromoteInlineAnnotsRaw","_EPDFPage_RemoveAnnot","_EPDFPage_RemoveAnnotByName","_EPDFPage_RemoveAnnotByObjectNumber","_EPDFPage_RemoveAnnotRaw","_EPDFPage_RemoveViewport","_EPDFPage_RemoveViewportRaw","_EPDFPage_ResetRenderCache","_EPDFSig_CloseModel","_EPDFSig_Count","_EPDFSig_DigestByteRange","_EPDFSig_DigestFileRange","_EPDFSig_GetByteRange","_EPDFSig_GetContents","_EPDFSig_GetCoverage","_EPDFSig_GetDocMDPPermission","_EPDFSig_GetFieldMDPAction","_EPDFSig_GetFieldName","_EPDFSig_GetFieldNameAt","_EPDFSig_GetFieldNameCount","_EPDFSig_GetFieldObjNum","_EPDFSig_GetIndexByFieldObjNum","_EPDFSig_GetKind","_EPDFSig_GetLockAction","_EPDFSig_GetLockPermission","_EPDFSig_GetRevisionIndex","_EPDFSig_GetSeedValueFilter","_EPDFSig_GetSeedValueListAt","_EPDFSig_GetSeedValueListCount","_EPDFSig_GetSeedValueMDP","_EPDFSig_GetSeedValuePresentFlags","_EPDFSig_GetSeedValueRequiredFlags","_EPDFSig_GetSeedValueVersion","_EPDFSig_GetString","_EPDFSig_GetValueObjNum","_EPDFSig_GetWidgetObjNum","_EPDFSig_GetWidgetPageObjNum","_EPDFSig_HasSeedValue","_EPDFSig_IsCatalogCertification","_EPDFSig_IsRevisionChainValid","_EPDFSig_IsSigned","_EPDFSig_LoadModel","_EPDFSig_Prepare","_EPDFSig_SaveCandidate","_EPDFSig_SaveCandidateToOwnedBuffer","_EPDFSig_Seal","_EPDFSig_SealSpan","_EPDFSig_SetFieldLock","_EPDFSig_WriteContents","_EPDFText_GetCharGeometry","_EPDFText_GetCharToTextMap","_EPDFText_GetPageGeometry","_EPDFText_GetTextFull","_EPDFText_RedactInQuads","_EPDFText_RedactInRect","_EPDFViewport_AddMeasure","_EPDFViewport_Close","_EPDFViewport_GetBBox","_EPDFViewport_GetMeasure","_EPDFViewport_GetName","_EPDFViewport_RemoveMeasure","_EPDFViewport_SetBBox","_EPDFViewport_SetName","_FORM_CanRedo","_FORM_CanUndo","_FORM_DoDocumentAAction","_FORM_DoDocumentJSAction","_FORM_DoDocumentOpenAction","_FORM_DoPageAAction","_FORM_ForceToKillFocus","_FORM_GetFocusedAnnot","_FORM_GetFocusedText","_FORM_GetSelectedText","_FORM_GetTextDirection","_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_SetTextDirection","_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_GetExpansion","_FPDF_StructElement_GetID","_FPDF_StructElement_GetLang","_FPDF_StructElement_GetMarkedContentID","_FPDF_StructElement_GetMarkedContentIdAtIndex","_FPDF_StructElement_GetMarkedContentIdCount","_FPDF_StructElement_GetObjType","_FPDF_StructElement_GetParent","_FPDF_StructElement_GetRawType","_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_SetFontColor","_FPDFAnnot_SetFormFieldFlags","_FPDFAnnot_SetRect","_FPDFAnnot_SetStringValue","_FPDFAnnot_SetURI","_FPDFAnnot_UpdateObject","_FPDFAttachment_GetAFRelationship","_FPDFAttachment_GetDescription","_FPDFAttachment_GetFile","_FPDFAttachment_GetName","_FPDFAttachment_GetStringValue","_FPDFAttachment_GetSubtype","_FPDFAttachment_GetValueType","_FPDFAttachment_HasKey","_FPDFAttachment_SetDescription","_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_GetColor","_FPDFBookmark_GetCount","_FPDFBookmark_GetDest","_FPDFBookmark_GetFirstChild","_FPDFBookmark_GetNextSibling","_FPDFBookmark_GetStyle","_FPDFBookmark_GetTitle","_FPDFCatalog_GetLanguage","_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","_FPDFFormObj_RemoveObject","_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_InsertObjectAtIndex","_FPDFPage_New","_FPDFPage_RemoveAnnot","_FPDFPage_RemoveObject","_FPDFPage_SetArtBox","_FPDFPage_SetBleedBox","_FPDFPage_SetCropBox","_FPDFPage_SetMediaBox","_FPDFPage_SetRotation","_FPDFPage_SetTrimBox","_FPDFPage_TransformAnnots","_FPDFPage_TransFormWithClip","_FPDFPageObj_AddExistingMark","_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_GetRenderedFillPattern","_FPDFPageObj_GetRenderedStrokePattern","_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_GetParamFloatValue","_FPDFPageObjMark_GetParamIntValue","_FPDFPageObjMark_GetParamKey","_FPDFPageObjMark_GetParamStringValue","_FPDFPageObjMark_GetParamValueType","_FPDFPageObjMark_RemoveParam","_FPDFPageObjMark_SetBlobParam","_FPDFPageObjMark_SetFloatParam","_FPDFPageObjMark_SetIntParam","_FPDFPageObjMark_SetStringParam","_FPDFPath_BezierTo","_FPDFPath_Close","_FPDFPath_CountSegments","_FPDFPath_GetBezierControlPoints","_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_SetPositions","_FPDFText_SetText","_FPDFTextObj_GetFont","_FPDFTextObj_GetFontSize","_FPDFTextObj_GetRenderedBitmap","_FPDFTextObj_GetText","_FPDFTextObj_GetTextRenderMode","_FPDFTextObj_SetFontSize","_FPDFTextObj_SetTextRenderMode","_malloc","_free","_memory","___indirect_function_table","onRuntimeInitialized"].forEach(e=>{Object.getOwnPropertyDescriptor(y,e)||Object.defineProperty(y,e,{get:()=>J("You are getting "+e+" 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"),set:()=>J("You are setting "+e+" 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")})});var w="object"==typeof window,E="u">typeof WorkerGlobalScope,v="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type,k=!w&&!v&&!E,x=Object.assign({},t),G="./this.program",O="";if(k){if("object"==typeof process&&"function"==typeof A||"object"==typeof window||"u">typeof WorkerGlobalScope)throw 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?)")}else if(w||E){if(E?O=self.location.href:"u">typeof document&&document.currentScript&&(O=document.currentScript.src),e&&(O=e),O=O.startsWith("blob:")?"":O.substr(0,O.replace(/[?#].*/,"").lastIndexOf("/")+1),"object"!=typeof window&&"u"{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=e=>(M(!Q(e),"readAsync does not work with file:// URLs"),fetch(e,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+" : "+e.url))))}else throw Error("environment detection error");var I=t.print||console.log.bind(console),N=t.printErr||console.error.bind(console);Object.assign(t,x),x=null,Object.getOwnPropertyDescriptor(t,b="fetchSettings")&&J(`\\`Module.${b}\\` was supplied but \\`${b}\\` not included in INCOMING_MODULE_JS_API`),t.arguments&&t.arguments,er("arguments","arguments_"),t.thisProgram&&(G=t.thisProgram),er("thisProgram","thisProgram"),M(void 0===t.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.read,"Module.read option was removed"),M(void 0===t.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),M(void 0===t.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),M(void 0===t.setWindowTitle,"Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),M(void 0===t.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),er("asm","wasmExports"),er("readAsync","readAsync"),er("readBinary","readBinary"),er("setWindowTitle","setWindowTitle"),M(!v,"node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."),M(!k,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var C=t.wasmBinary;er("wasmBinary","wasmBinary"),"object"!=typeof WebAssembly&&N("no native wasm support detected");var j=!1;function M(e,t){e||J("Assertion failed"+(t?": "+t:""))}function R(){var e=a.buffer;t.HEAP8=s=new Int8Array(e),t.HEAP16=u=new Int16Array(e),t.HEAPU8=l=new Uint8Array(e),t.HEAPU16=d=new Uint16Array(e),t.HEAP32=c=new Int32Array(e),t.HEAPU32=f=new Uint32Array(e),t.HEAPF32=m=new Float32Array(e),t.HEAPF64=p=new Float64Array(e)}function T(){if(!j){var e=e1();0==e&&(e+=4);var t=f[e>>>2>>>0],n=f[e+4>>>2>>>0];(0x2135467!=t||0x89bacdfe!=n)&&J(`Stack overflow! Stack cookie has been overwritten at ${ec(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ec(n)} ${ec(t)}`),0x63736d65!=f[0]&&J("Runtime error: The application has corrupted its heap memory area (address zero)!")}}M(!t.STACK_SIZE,"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),M("u">typeof Int32Array&&"u">typeof Float64Array&&void 0!=Int32Array.prototype.subarray&&void 0!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),M(!t.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),M(!t.INITIAL_MEMORY,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var B=[],L=[],$=[],z=!1;M(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var U=0,V=null,W=null,q={};function H(e){for(var t=e;;){if(!q[e])return e;e=t+Math.random()}}function K(e){U++,t.monitorRunDependencies?.(U),e?(M(!q[e]),q[e]=1,null===V&&"u">typeof setInterval&&(V=setInterval(()=>{if(j){clearInterval(V),V=null;return}var e=!1;for(var t in q)e||(e=!0,N("still waiting on run dependencies:")),N(`dependency: ${t}`);e&&N("(end of list)")},1e4))):N("warning: run dependency added without ID")}function Z(e){if(U--,t.monitorRunDependencies?.(U),e?(M(q[e]),delete q[e]):N("warning: run dependency removed without ID"),0==U&&(null!==V&&(clearInterval(V),V=null),W)){var n=W;W=null,n()}}function J(e){t.onAbort?.(e),N(e="Aborted("+e+")"),j=!0;var n=new WebAssembly.RuntimeError(e);throw r(n),n}var Q=e=>e.startsWith("file://");function X(e,t){return(...n)=>{M(z,`native function \\`${e}\\` called before runtime initialization`);var r=eZ[e];return M(r,`exported native function \\`${e}\\` not found`),M(n.length<=t,`native function \\`${e}\\` called with ${n.length} args but expects ${t}`),r(...n)}}function Y(e){if(e==h&&C)return new Uint8Array(C);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e,t,n){return(!C?i(e).then(e=>new Uint8Array(e),()=>Y(e)):Promise.resolve().then(()=>Y(e))).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{N(`failed to asynchronously prepare wasm: ${e}`),Q(h)&&N(`warning: Loading from a file URI (${h}) 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`),J(e)})}var et=new Int16Array(1),en=new Int8Array(et.buffer);if(et[0]=25459,115!==en[0]||99!==en[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";if(t.ENVIRONMENT)throw Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");function er(e,n,r=!0){Object.getOwnPropertyDescriptor(t,e)||Object.defineProperty(t,e,{configurable:!0,get(){J(`\\`Module.${e}\\` has been replaced by \\`${n}\\``+(r?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":""))}})}function ei(e){return"FS_createPath"===e||"FS_createDataFile"===e||"FS_createPreloadedFile"===e||"FS_unlink"===e||"addRunDependency"===e||"FS_createLazyFile"===e||"FS_createDevice"===e||"removeRunDependency"===e}function eo(e,t){"u">typeof globalThis&&!Object.getOwnPropertyDescriptor(globalThis,e)&&Object.defineProperty(globalThis,e,{configurable:!0,get(){t()}})}function ea(e,t){eo(e,()=>{em(`\\`${e}\\` is not longer defined by emscripten. ${t}`)})}function es(e){Object.getOwnPropertyDescriptor(t,e)||Object.defineProperty(t,e,{configurable:!0,get(){var t=`\'${e}\' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;ei(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),J(t)}})}ea("buffer","Please use HEAP8.buffer or wasmMemory.buffer"),ea("asm","Please use wasmExports instead");class el{constructor(e){S(this,"name","ExitStatus"),this.message=`Program terminated with exit(${e})`,this.status=e}}var eu=e=>{for(;e.length>0;)e.shift()(t)},ed=t.noExitRuntime||!0,ec=e=>(M("number"==typeof e),"0x"+e.toString(16).padStart(8,"0")),ef=()=>e6(),em=e=>{em.shown||(em.shown={}),em.shown[e]||(em.shown[e]=1,N(e))},ep=(e,t)=>(M(e==e>>>0||e==(0|e)),M(t===(0|t)),t+2097152>>>0<4194305-!!e?(e>>>0)+0x100000000*t:0/0),eh="u">typeof TextDecoder?new TextDecoder:void 0,eF=(e,t=0,n=0/0)=>{for(var r=(t>>>=0)+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&eh)return eh.decode(e.subarray(t,i));for(var o="";t>10,56320|1023&u)}}return o},eg=(e,t)=>(M("number"==typeof e,`UTF8ToString expects a number (got ${typeof e})`),(e>>>=0)?eF(l,e,t):""),e_=()=>{M(void 0!=eC.varargs);var e=c[eC.varargs>>>2>>>0];return eC.varargs+=4,e},eP={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},normalize:e=>{var t=eP.isAbs(e),n="/"===e.substr(-1);return(e=eP.normalizeArray(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=eP.splitPath(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=eP.normalize(e)).replace(/\\/$/,"")).lastIndexOf("/");return -1===t?e:e.substr(t+1)},join:(...e)=>eP.normalize(e.join("/")),join2:(e,t)=>eP.normalize(e+"/"+t)},eD=e=>(eD=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);J("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")})())(e),eb={resolve:(...e)=>{for(var t="",n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:eN.cwd();if("string"!=typeof i)throw TypeError("Arguments to path.resolve must be strings");if(!i)return"";t=i+"/"+t,n=eP.isAbs(i)}return t=eP.normalizeArray(t.split("/").filter(e=>!!e),!n).join("/"),(n?"/":"")+t||"."},relative:(e,t)=>{function n(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=eb.resolve(e).substr(1),t=eb.resolve(t).substr(1);for(var r=n(e.split("/")),i=n(t.split("/")),o=Math.min(r.length,i.length),a=o,s=0;s{for(var t=0,n=0;n=55296&&r<=57343?(t+=4,++n):t+=3}return t},eE=(e,t,n,r)=>{if(n>>>=0,M("string"==typeof e,`stringToUTF8Array expects a string (got ${typeof e})`),!(r>0))return 0;for(var i=n,o=n+r-1,a=0;a=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=o)break;t[n++>>>0]=s}else if(s<=2047){if(n+1>=o)break;t[n++>>>0]=192|s>>6,t[n++>>>0]=128|63&s}else if(s<=65535){if(n+2>=o)break;t[n++>>>0]=224|s>>12,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|63&s}else{if(n+3>=o)break;s>1114111&&em("Invalid Unicode code point "+ec(s)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[n++>>>0]=240|s>>18,t[n++>>>0]=128|s>>12&63,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|63&s}}return t[n>>>0]=0,n-i};function eA(e,t,n){var r=Array(n>0?n:ew(e)+1),i=eE(e,r,0,r.length);return t&&(r.length=i),r}var ev={ttys:[],init(){},shutdown(){},register(e,t){ev.ttys[e]={input:[],output:[],ops:t},eN.registerDevice(e,ev.stream_ops)},stream_ops:{open(e){var t=ev.ttys[e.node.rdev];if(!t)throw new eN.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new eN.ErrnoError(60);for(var o,a=0,s=0;s(()=>{if(!ey.length){var e=null;if("u">typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+=`\n`),!e)return null;ey=eA(e,!0)}return ey.shift()})(),put_char(e,t){null===t||10===t?(I(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(I(eF(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,n)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(N(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(N(eF(e.output)),e.output=[])}}},eS=(e,t)=>(M(t,"alignment argument is required"),Math.ceil(e/t)*t),ek=e=>{var t,n=eX(65536,e=eS(e,65536));return n&&(t=e,l.fill(0,n,n+t)),n},ex={ops_table:null,mount:e=>ex.createNode(null,"/",16895,0),createNode(e,t,n,r){if(eN.isBlkdev(n)||eN.isFIFO(n))throw new eN.ErrnoError(63);ex.ops_table||(ex.ops_table={dir:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr,lookup:ex.node_ops.lookup,mknod:ex.node_ops.mknod,rename:ex.node_ops.rename,unlink:ex.node_ops.unlink,rmdir:ex.node_ops.rmdir,readdir:ex.node_ops.readdir,symlink:ex.node_ops.symlink},stream:{llseek:ex.stream_ops.llseek}},file:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr},stream:{llseek:ex.stream_ops.llseek,read:ex.stream_ops.read,write:ex.stream_ops.write,allocate:ex.stream_ops.allocate,mmap:ex.stream_ops.mmap,msync:ex.stream_ops.msync}},link:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr,readlink:ex.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr},stream:eN.chrdev_stream_ops}});var i=eN.createNode(e,t,n,r);return eN.isDir(i.mode)?(i.node_ops=ex.ops_table.dir.node,i.stream_ops=ex.ops_table.dir.stream,i.contents={}):eN.isFile(i.mode)?(i.node_ops=ex.ops_table.file.node,i.stream_ops=ex.ops_table.file.stream,i.usedBytes=0,i.contents=null):eN.isLink(i.mode)?(i.node_ops=ex.ops_table.link.node,i.stream_ops=ex.ops_table.link.stream):eN.isChrdev(i.mode)&&(i.node_ops=ex.ops_table.chrdev.node,i.stream_ops=ex.ops_table.chrdev.stream),i.timestamp=Date.now(),e&&(e.contents[t]=i,e.timestamp=i.timestamp),i},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),0!=n&&(t=Math.max(t,256));var r=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=eN.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,eN.isDir(e.mode)?t.size=4096:eN.isFile(e.mode)?t.size=e.usedBytes:eN.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&ex.resizeFileStorage(e,t.size)},lookup(e,t){throw new eN.ErrnoError(44)},mknod:(e,t,n,r)=>ex.createNode(e,t,n,r),rename(e,t,n){if(eN.isDir(e.mode)){var r;try{r=eN.lookupNode(t,n)}catch{}if(r)for(var i in r.contents)throw new eN.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var n=eN.lookupNode(e,t);for(var r in n.contents)throw new eN.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=ex.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!eN.isLink(e.mode))throw new eN.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var o=e.node.contents;if(i>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-i,r);if(M(a>=0),a>8&&o.subarray)t.set(o.subarray(i,i+a),n);else for(var s=0;s0||n+t>>0))}return{ptr:o,allocated:a}},msync:(e,t,n,r,i)=>(ex.stream_ops.write(e,t,0,r,n,!1),0)}},eG=t.preloadPlugins||[],eO=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},eI={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},eN={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class extends Error{constructor(e){for(var t in super(z?eg(eQ(e)):""),S(this,"name","ErrnoError"),this.errno=e,eI)if(eI[t]===e){this.code=t;break}}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){S(this,"shared",{})}get object(){return this.node}set object(e){this.node=e}get isRead(){return(2097155&this.flags)!=1}get isWrite(){return(2097155&this.flags)!=0}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){S(this,"node_ops",{}),S(this,"stream_ops",{}),S(this,"readMode",365),S(this,"writeMode",146),S(this,"mounted",null),e||(e=this),this.parent=e,this.mount=e.mount,this.id=eN.nextInode++,this.name=t,this.mode=n,this.rdev=r}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return eN.isDir(this.mode)}get isDevice(){return eN.isChrdev(this.mode)}},lookupPath(e,t={}){if(!(e=eb.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new eN.ErrnoError(32);for(var n=e.split("/").filter(e=>!!e),r=eN.root,i="/",o=0;o40)throw new eN.ErrnoError(32)}}return{path:i,node:r}},getPath(e){for(var t;;){if(eN.isRoot(e)){var n=e.mount.mountpoint;if(!t)return n;return"/"!==n[n.length-1]?`${n}/${t}`:n+t}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r>>0)%eN.nameTable.length},hashAddNode(e){var t=eN.hashName(e.parent.id,e.name);e.name_next=eN.nameTable[t],eN.nameTable[t]=e},hashRemoveNode(e){var t=eN.hashName(e.parent.id,e.name);if(eN.nameTable[t]===e)eN.nameTable[t]=e.name_next;else for(var n=eN.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=eN.mayLookup(e);if(n)throw new eN.ErrnoError(n);for(var r=eN.hashName(e.id,t),i=eN.nameTable[r];i;i=i.name_next){var o=i.name;if(i.parent.id===e.id&&o===t)return i}return eN.lookup(e,t)},createNode(e,t,n,r){M("object"==typeof e);var i=new eN.FSNode(e,t,n,r);return eN.hashAddNode(i),i},destroyNode(e){eN.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(61440&e)==32768,isDir:e=>(61440&e)==16384,isLink:e=>(61440&e)==40960,isChrdev:e=>(61440&e)==8192,isBlkdev:e=>(61440&e)==24576,isFIFO:e=>(61440&e)==4096,isSocket:e=>(49152&e)==49152,flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>eN.ignorePermissions?0:t.includes("r")&&!(292&e.mode)||t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0,mayLookup:e=>eN.isDir(e.mode)?eN.nodePermissions(e,"x")||2*!e.node_ops.lookup:54,mayCreate(e,t){try{return eN.lookupNode(e,t),20}catch(e){}return eN.nodePermissions(e,"wx")},mayDelete(e,t,n){try{r=eN.lookupNode(e,t)}catch(e){return e.errno}var r,i=eN.nodePermissions(e,"wx");if(i)return i;if(n){if(!eN.isDir(r.mode))return 54;if(eN.isRoot(r)||eN.getPath(r)===eN.cwd())return 10}else if(eN.isDir(r.mode))return 31;return 0},mayOpen:(e,t)=>e?eN.isLink(e.mode)?32:eN.isDir(e.mode)&&("r"!==eN.flagsToPermissionString(t)||512&t)?31:eN.nodePermissions(e,eN.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=eN.MAX_OPEN_FDS;e++)if(!eN.streams[e])return e;throw new eN.ErrnoError(33)},getStreamChecked(e){var t=eN.getStream(e);if(!t)throw new eN.ErrnoError(8);return t},getStream:e=>eN.streams[e],createStream:(e,t=-1)=>(M(t>=-1),e=Object.assign(new eN.FSStream,e),-1==t&&(t=eN.nextfd()),e.fd=t,eN.streams[t]=e,e),closeStream(e){eN.streams[e]=null},dupStream(e,t=-1){var n=eN.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){var t=eN.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new eN.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){eN.devices[e]={stream_ops:t}},getDevice:e=>eN.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),eN.syncFSRequests++,eN.syncFSRequests>1&&N(`warning: ${eN.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=eN.getMounts(eN.root.mount),r=0;function i(e){return M(eN.syncFSRequests>0),eN.syncFSRequests--,t(e)}function o(e){if(e)return o.errored?void 0:(o.errored=!0,i(e));++r>=n.length&&i(null)}n.forEach(t=>{if(!t.type.syncfs)return o(null);t.type.syncfs(t,e,o)})},mount(e,t,n){if("string"==typeof e)throw e;var r,i="/"===n,o=!n;if(i&&eN.root)throw new eN.ErrnoError(10);if(!i&&!o){var a=eN.lookupPath(n,{follow_mount:!1});if(n=a.path,r=a.node,eN.isMountpoint(r))throw new eN.ErrnoError(10);if(!eN.isDir(r.mode))throw new eN.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},l=e.mount(s);return l.mount=s,s.root=l,i?eN.root=l:r&&(r.mounted=s,r.mount&&r.mount.mounts.push(s)),l},unmount(e){var t=eN.lookupPath(e,{follow_mount:!1});if(!eN.isMountpoint(t.node))throw new eN.ErrnoError(28);var n=t.node,r=n.mounted,i=eN.getMounts(r);Object.keys(eN.nameTable).forEach(e=>{for(var t=eN.nameTable[e];t;){var n=t.name_next;i.includes(t.mount)&&eN.destroyNode(t),t=n}}),n.mounted=null;var o=n.mount.mounts.indexOf(r);M(-1!==o),n.mount.mounts.splice(o,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,n){var r=eN.lookupPath(e,{parent:!0}).node,i=eP.basename(e);if(!i||"."===i||".."===i)throw new eN.ErrnoError(28);var o=eN.mayCreate(r,i);if(o)throw new eN.ErrnoError(o);if(!r.node_ops.mknod)throw new eN.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},create:(e,t)=>(t=(void 0!==t?t:438)&4095|32768,eN.mknod(e,t,0)),mkdir:(e,t)=>(t=(void 0!==t?t:511)&1023|16384,eN.mknod(e,t,0)),mkdirTree(e,t){for(var n=e.split("/"),r="",i=0;i(void 0===n&&(n=t,t=438),t|=8192,eN.mknod(e,t,n)),symlink(e,t){if(!eb.resolve(e))throw new eN.ErrnoError(44);var n=eN.lookupPath(t,{parent:!0}).node;if(!n)throw new eN.ErrnoError(44);var r=eP.basename(t),i=eN.mayCreate(n,r);if(i)throw new eN.ErrnoError(i);if(!n.node_ops.symlink)throw new eN.ErrnoError(63);return n.node_ops.symlink(n,r,e)},rename(e,t){var n,r,i,o=eP.dirname(e),a=eP.dirname(t),s=eP.basename(e),l=eP.basename(t);if(n=eN.lookupPath(e,{parent:!0}).node,r=eN.lookupPath(t,{parent:!0}).node,!n||!r)throw new eN.ErrnoError(44);if(n.mount!==r.mount)throw new eN.ErrnoError(75);var u=eN.lookupNode(n,s),d=eb.relative(e,a);if("."!==d.charAt(0))throw new eN.ErrnoError(28);if("."!==(d=eb.relative(t,o)).charAt(0))throw new eN.ErrnoError(55);try{i=eN.lookupNode(r,l)}catch(e){}if(u!==i){var c=eN.isDir(u.mode),f=eN.mayDelete(n,s,c);if(f||(f=i?eN.mayDelete(r,l,c):eN.mayCreate(r,l)))throw new eN.ErrnoError(f);if(!n.node_ops.rename)throw new eN.ErrnoError(63);if(eN.isMountpoint(u)||i&&eN.isMountpoint(i))throw new eN.ErrnoError(10);if(r!==n&&(f=eN.nodePermissions(n,"w")))throw new eN.ErrnoError(f);eN.hashRemoveNode(u);try{n.node_ops.rename(u,r,l),u.parent=r}catch(e){throw e}finally{eN.hashAddNode(u)}}},rmdir(e){var t=eN.lookupPath(e,{parent:!0}).node,n=eP.basename(e),r=eN.lookupNode(t,n),i=eN.mayDelete(t,n,!0);if(i)throw new eN.ErrnoError(i);if(!t.node_ops.rmdir)throw new eN.ErrnoError(63);if(eN.isMountpoint(r))throw new eN.ErrnoError(10);t.node_ops.rmdir(t,n),eN.destroyNode(r)},readdir(e){var t=eN.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new eN.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=eN.lookupPath(e,{parent:!0}).node;if(!t)throw new eN.ErrnoError(44);var n=eP.basename(e),r=eN.lookupNode(t,n),i=eN.mayDelete(t,n,!1);if(i)throw new eN.ErrnoError(i);if(!t.node_ops.unlink)throw new eN.ErrnoError(63);if(eN.isMountpoint(r))throw new eN.ErrnoError(10);t.node_ops.unlink(t,n),eN.destroyNode(r)},readlink(e){var t=eN.lookupPath(e).node;if(!t)throw new eN.ErrnoError(44);if(!t.node_ops.readlink)throw new eN.ErrnoError(28);return eb.resolve(eN.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var n=eN.lookupPath(e,{follow:!t}).node;if(!n)throw new eN.ErrnoError(44);if(!n.node_ops.getattr)throw new eN.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>eN.stat(e,!0),chmod(e,t,n){var r;if(!(r="string"==typeof e?eN.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new eN.ErrnoError(63);r.node_ops.setattr(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})},lchmod(e,t){eN.chmod(e,t,!0)},fchmod(e,t){var n=eN.getStreamChecked(e);eN.chmod(n.node,t)},chown(e,t,n,r){var i;if(!(i="string"==typeof e?eN.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new eN.ErrnoError(63);i.node_ops.setattr(i,{timestamp:Date.now()})},lchown(e,t,n){eN.chown(e,t,n,!0)},fchown(e,t,n){var r=eN.getStreamChecked(e);eN.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new eN.ErrnoError(28);if("string"==typeof e){var n;n=eN.lookupPath(e,{follow:!0}).node}else n=e;if(!n.node_ops.setattr)throw new eN.ErrnoError(63);if(eN.isDir(n.mode))throw new eN.ErrnoError(31);if(!eN.isFile(n.mode))throw new eN.ErrnoError(28);var r=eN.nodePermissions(n,"w");if(r)throw new eN.ErrnoError(r);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=eN.getStreamChecked(e);if((2097155&n.flags)==0)throw new eN.ErrnoError(28);eN.truncate(n.node,t)},utime(e,t,n){var r=eN.lookupPath(e,{follow:!0}).node;r.node_ops.setattr(r,{timestamp:Math.max(t,n)})},open(e,n,r){if(""===e)throw new eN.ErrnoError(44);if(r=64&(n="string"==typeof n?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw Error(`Unknown file open mode: ${e}`);return t})(n):n)?4095&(r=void 0===r?438:r)|32768:0,"object"==typeof e)i=e;else{e=eP.normalize(e);try{var i;i=eN.lookupPath(e,{follow:!(131072&n)}).node}catch(e){}}var o=!1;if(64&n)if(i){if(128&n)throw new eN.ErrnoError(20)}else i=eN.mknod(e,r,0),o=!0;if(!i)throw new eN.ErrnoError(44);if(eN.isChrdev(i.mode)&&(n&=-513),65536&n&&!eN.isDir(i.mode))throw new eN.ErrnoError(54);if(!o){var a=eN.mayOpen(i,n);if(a)throw new eN.ErrnoError(a)}512&n&&!o&&eN.truncate(i,0),n&=-131713;var s=eN.createStream({node:i,path:eN.getPath(i),flags:n,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!t.logReadFiles||1&n||e in eN.readFiles||(eN.readFiles[e]=1),s},close(e){if(eN.isClosed(e))throw new eN.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{eN.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,n){if(eN.isClosed(e))throw new eN.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new eN.ErrnoError(70);if(0!=n&&1!=n&&2!=n)throw new eN.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(M(n>=0),r<0||i<0)throw new eN.ErrnoError(28);if(eN.isClosed(e)||(2097155&e.flags)==1)throw new eN.ErrnoError(8);if(eN.isDir(e.node.mode))throw new eN.ErrnoError(31);if(!e.stream_ops.read)throw new eN.ErrnoError(28);var o=void 0!==i;if(o){if(!e.seekable)throw new eN.ErrnoError(70)}else i=e.position;var a=e.stream_ops.read(e,t,n,r,i);return o||(e.position+=a),a},write(e,t,n,r,i,o){if(M(n>=0),r<0||i<0)throw new eN.ErrnoError(28);if(eN.isClosed(e)||(2097155&e.flags)==0)throw new eN.ErrnoError(8);if(eN.isDir(e.node.mode))throw new eN.ErrnoError(31);if(!e.stream_ops.write)throw new eN.ErrnoError(28);e.seekable&&1024&e.flags&&eN.llseek(e,0,2);var a=void 0!==i;if(a){if(!e.seekable)throw new eN.ErrnoError(70)}else i=e.position;var s=e.stream_ops.write(e,t,n,r,i,o);return a||(e.position+=s),s},allocate(e,t,n){if(eN.isClosed(e))throw new eN.ErrnoError(8);if(t<0||n<=0)throw new eN.ErrnoError(28);if((2097155&e.flags)==0)throw new eN.ErrnoError(8);if(!eN.isFile(e.node.mode)&&!eN.isDir(e.node.mode))throw new eN.ErrnoError(43);if(!e.stream_ops.allocate)throw new eN.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,i){if((2&r)!=0&&(2&i)==0&&(2097155&e.flags)!=2||(2097155&e.flags)==1)throw new eN.ErrnoError(2);if(!e.stream_ops.mmap)throw new eN.ErrnoError(43);if(!t)throw new eN.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync:(e,t,n,r,i)=>(M(n>=0),e.stream_ops.msync)?e.stream_ops.msync(e,t,n,r,i):0,ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new eN.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw Error(`Invalid encoding type "${t.encoding}"`);var n,r=eN.open(e,t.flags),i=eN.stat(e).size,o=new Uint8Array(i);return eN.read(r,o,0,i,0),"utf8"===t.encoding?n=eF(o):"binary"===t.encoding&&(n=o),eN.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=eN.open(e,n.flags,n.mode);if("string"==typeof t){var i=new Uint8Array(ew(t)+1),o=eE(t,i,0,i.length);eN.write(r,i,0,o,void 0,n.canOwn)}else if(ArrayBuffer.isView(t))eN.write(r,t,0,t.byteLength,void 0,n.canOwn);else throw Error("Unsupported data type");eN.close(r)},cwd:()=>eN.currentPath,chdir(e){var t=eN.lookupPath(e,{follow:!0});if(null===t.node)throw new eN.ErrnoError(44);if(!eN.isDir(t.node.mode))throw new eN.ErrnoError(54);var n=eN.nodePermissions(t.node,"x");if(n)throw new eN.ErrnoError(n);eN.currentPath=t.path},createDefaultDirectories(){eN.mkdir("/tmp"),eN.mkdir("/home"),eN.mkdir("/home/web_user")},createDefaultDevices(){eN.mkdir("/dev"),eN.registerDevice(eN.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r,llseek:()=>0}),eN.mkdev("/dev/null",eN.makedev(1,3)),ev.register(eN.makedev(5,0),ev.default_tty_ops),ev.register(eN.makedev(6,0),ev.default_tty1_ops),eN.mkdev("/dev/tty",eN.makedev(5,0)),eN.mkdev("/dev/tty1",eN.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(0===t&&(t=eD(e).byteLength),e[--t]);eN.createDevice("/dev","random",n),eN.createDevice("/dev","urandom",n),eN.mkdir("/dev/shm"),eN.mkdir("/dev/shm/tmp")},createSpecialDirectories(){eN.mkdir("/proc");var e=eN.mkdir("/proc/self");eN.mkdir("/proc/self/fd"),eN.mount({mount(){var t=eN.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var n=eN.getStreamChecked(+t),r={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return r.parent=r,r}},t}},{},"/proc/self/fd")},createStandardStreams(e,t,n){e?eN.createDevice("/dev","stdin",e):eN.symlink("/dev/tty","/dev/stdin"),t?eN.createDevice("/dev","stdout",null,t):eN.symlink("/dev/tty","/dev/stdout"),n?eN.createDevice("/dev","stderr",null,n):eN.symlink("/dev/tty1","/dev/stderr");var r=eN.open("/dev/stdin",0),i=eN.open("/dev/stdout",1),o=eN.open("/dev/stderr",1);M(0===r.fd,`invalid handle for stdin (${r.fd})`),M(1===i.fd,`invalid handle for stdout (${i.fd})`),M(2===o.fd,`invalid handle for stderr (${o.fd})`)},staticInit(){eN.nameTable=Array(4096),eN.mount(ex,{},"/"),eN.createDefaultDirectories(),eN.createDefaultDevices(),eN.createSpecialDirectories(),eN.filesystems={MEMFS:ex}},init(e,n,r){M(!eN.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),eN.initialized=!0,e??(e=t.stdin),n??(n=t.stdout),r??(r=t.stderr),eN.createStandardStreams(e,n,r)},quit(){eN.initialized=!1,eJ(0);for(var e=0;etypeof XMLHttpRequest)throw Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=o(e.url),e.usedBytes=e.contents.length}catch(e){throw new eN.ErrnoError(29)}},createLazyFile(e,t,n,r,i){if("u">typeof XMLHttpRequest){if(!E)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o={isDevice:!1,contents:new class{constructor(){S(this,"lengthKnown",!1),S(this,"chunks",[])}get(e){if(!(e>this.length-1)&&!(e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e,t=new XMLHttpRequest;if(t.open("HEAD",n,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw Error("Couldn\'t load "+n+". Status: "+t.status);var r=Number(t.getResponseHeader("Content-length")),i=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,o=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,a=1048576;i||(a=r);var s=this;s.setDataGetter(e=>{var t=e*a,i=(e+1)*a-1;if(i=Math.min(i,r-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,t)=>{if(e>t)throw Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>r-1)throw Error("only "+r+" bytes available! programmer error!");var i=new XMLHttpRequest;if(i.open("GET",n,!1),r!==a&&i.setRequestHeader("Range","bytes="+e+"-"+t),i.responseType="arraybuffer",i.overrideMimeType&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.send(null),!(i.status>=200&&i.status<300||304===i.status))throw Error("Couldn\'t load "+n+". Status: "+i.status);return void 0!==i.response?new Uint8Array(i.response||[]):eA(i.responseText||"",!0)})(t,i)),void 0===s.chunks[e])throw Error("doXHR failed!");return s.chunks[e]}),(o||!r)&&(a=r=1,a=r=this.getter(0).length,I("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=r,this._chunkSize=a,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}}}else var o={isDevice:!1,url:n};var a=eN.createFile(e,t,o,r,i);o.contents?a.contents=o.contents:o.url&&(a.contents=null,a.url=o.url),Object.defineProperties(a,{usedBytes:{get:function(){return this.contents.length}}});var l={};function u(e,t,n,r,i){var o=e.node.contents;if(i>=o.length)return 0;var a=Math.min(o.length-i,r);if(M(a>=0),o.slice)for(var s=0;s{var t=a.stream_ops[e];l[e]=(...e)=>(eN.forceLoadFile(a),t(...e))}),l.read=(e,t,n,r,i)=>(eN.forceLoadFile(a),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{eN.forceLoadFile(a);var o=ek(t);if(!o)throw new eN.ErrnoError(48);return u(e,s,o,t,n),{ptr:o,allocated:!0}},a.stream_ops=l,a},absolutePath(){J("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){J("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){J("FS.createLink has been removed; use FS.symlink instead")},joinPath(){J("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){J("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){J("FS.standardizePath has been removed; use PATH.normalize instead")}},eC={DEFAULT_POLLMASK:5,calculateAt(e,t,n){if(eP.isAbs(t))return t;if(-100===e)r=eN.cwd();else{var r;r=eC.getStreamFromFD(e).path}if(0==t.length){if(!n)throw new eN.ErrnoError(44);return r}return eP.join2(r,t)},doStat(e,t,n){var r=e(t);c[n>>>2>>>0]=r.dev,c[n+4>>>2>>>0]=r.mode,f[n+8>>>2>>>0]=r.nlink,c[n+12>>>2>>>0]=r.uid,c[n+16>>>2>>>0]=r.gid,c[n+20>>>2>>>0]=r.rdev,g=[r.size>>>0,+Math.abs(F=r.size)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+24>>>2>>>0]=g[0],c[n+28>>>2>>>0]=g[1],c[n+32>>>2>>>0]=4096,c[n+36>>>2>>>0]=r.blocks;var i=r.atime.getTime(),o=r.mtime.getTime(),a=r.ctime.getTime();return g=[Math.floor(i/1e3)>>>0,+Math.abs(F=Math.floor(i/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+40>>>2>>>0]=g[0],c[n+44>>>2>>>0]=g[1],f[n+48>>>2>>>0]=i%1e3*1e6,g=[Math.floor(o/1e3)>>>0,+Math.abs(F=Math.floor(o/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+56>>>2>>>0]=g[0],c[n+60>>>2>>>0]=g[1],f[n+64>>>2>>>0]=o%1e3*1e6,g=[Math.floor(a/1e3)>>>0,+Math.abs(F=Math.floor(a/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+72>>>2>>>0]=g[0],c[n+76>>>2>>>0]=g[1],f[n+80>>>2>>>0]=a%1e3*1e6,g=[r.ino>>>0,+Math.abs(F=r.ino)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+88>>>2>>>0]=g[0],c[n+92>>>2>>>0]=g[1],0},doMsync(e,t,n,r,i){if(!eN.isFile(t.node.mode))throw new eN.ErrnoError(43);if(2&r)return 0;var o=l.slice(e,e+n);eN.msync(t,o,i,n,r)},getStreamFromFD:e=>eN.getStreamChecked(e),varargs:void 0,getStr:e=>eg(e)},ej=(e,t,n)=>(M("number"==typeof n,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),eE(e,l,t,n)),eM=[0,31,60,91,121,152,182,213,244,274,305,335],eR=[0,31,59,90,120,151,181,212,243,273,304,334],eT=e=>{var t=a.buffer,n=(e-t.byteLength+65535)/65536|0;try{return a.grow(n),R(),1}catch(n){N(`growMemory: Attempted to grow heap from ${t.byteLength} bytes to ${e} bytes, but got error: ${n}`)}},eB={},eL=()=>{if(!eL.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:G||"./this.program"};for(var t in eB)void 0===eB[t]?delete e[t]:e[t]=eB[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);eL.strings=n}return eL.strings},e$=[],ez=e=>{var t=e$[e];return t||(e>=e$.length&&(e$.length=e+1),e$[e]=t=_.get(e)),M(_.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t},eU="u">typeof TextDecoder?new TextDecoder("utf-16le"):void 0,eV=(e,t)=>{M(e<16384),e<128?t.push(e):t.push(e%128|128,e>>7)},eW=[],eq=(e,t)=>{_.set(e,t),e$[e]=_.get(e)},eH=(e,n,r,i,o)=>{var a,l,u={string:e=>{var t,n,r=0;return null!=e&&0!==e&&(t=ew(e)+1,ej(e,n=e2(t),t),r=n),r},array:e=>{let t;var n=(t=e.length,e2(t));return M(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),s.set(e,n>>>0),n}},d=(M(a=t["_"+e],"Cannot call unknown function "+e+", make sure it is exported"),a),c=[],f=0;if(M("array"!==n,\'Return type should not be "array".\'),i)for(var m=0;m{var c,f=t?eb.resolve(eP.join2(e,t)):e,m=H(`cp ${f}`);function p(n){var i,c;function p(n){d?.(),l||eN.createDataFile(e,t,n,r,o,u),a?.(),Z(m)}i=()=>{s?.(),Z(m)},"u">typeof Browser&&Browser.init(),c=!1,eG.forEach(e=>{!c&&e.canHandle(f)&&(e.handle(n,f,p,i),c=!0)}),c||p(n)}(K(m),"string"==typeof n)?(c=H(`al ${n}`),i(n).then(e=>{M(e,`Loading data file "${n}" failed (no arrayBuffer).`),p(new Uint8Array(e)),c&&Z(c)},e=>{if(s)s();else throw`Loading data file "${n}" failed.`}),c&&K(c)):p(n)},eN.staticInit();var eK={__assert_fail:function(e,t,n,r){e>>>=0,t>>>=0,r>>>=0,J(`Assertion failed: ${eg(e)}, at: `+[t?eg(t):"unknown filename",n,r?eg(r):"unknown function"])},__syscall_fcntl64:function(e,t,n){eC.varargs=n>>>=0;try{var r=eC.getStreamFromFD(e);switch(t){case 0:var i=e_();if(i<0)break;for(;eN.streams[i];)i++;return eN.dupStream(r,i).fd;case 1:case 2:case 13:case 14:return 0;case 3:return r.flags;case 4:var i=e_();return r.flags|=i,0;case 12:var i=e_();return u[i+0>>>1>>>0]=2,0}return -28}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_fstat64:function(e,t){t>>>=0;try{var n=eC.getStreamFromFD(e);return eC.doStat(eN.stat,n.path,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ftruncate64:function(e,t,n){var r=ep(t,n);try{if(isNaN(r))return 61;return eN.ftruncate(e,r),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_getdents64:function(e,t,n){t>>>=0,n>>>=0;try{var r=eC.getStreamFromFD(e);r.getdents||(r.getdents=eN.readdir(r.path));for(var i=0,o=eN.llseek(r,0,1),a=Math.floor(o/280);a>>0,(F=l,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[t+i>>>2>>>0]=g[0],c[t+i+4>>>2>>>0]=g[1],g=[(a+1)*280>>>0,(F=(a+1)*280,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[t+i+8>>>2>>>0]=g[0],c[t+i+12>>>2>>>0]=g[1],u[t+i+16>>>1>>>0]=280,s[t+i+18>>>0]=d,ej(f,t+i+19,256),i+=280,a+=1}return eN.llseek(r,280*a,0),i}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ioctl:function(e,t,n){eC.varargs=n>>>=0;try{var r=eC.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:if(!r.tty)return -59;return 0;case 21505:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),o=e_();c[o>>>2>>>0]=i.c_iflag||0,c[o+4>>>2>>>0]=i.c_oflag||0,c[o+8>>>2>>>0]=i.c_cflag||0,c[o+12>>>2>>>0]=i.c_lflag||0;for(var a=0;a<32;a++)s[o+a+17>>>0]=i.c_cc[a]||0}return 0;case 21506:case 21507:case 21508:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcsets){for(var o=e_(),l=c[o>>>2>>>0],d=c[o+4>>>2>>>0],f=c[o+8>>>2>>>0],m=c[o+12>>>2>>>0],p=[],a=0;a<32;a++)p.push(s[o+a+17>>>0]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:l,c_oflag:d,c_cflag:f,c_lflag:m,c_cc:p})}return 0;case 21519:if(!r.tty)return -59;var o=e_();return c[o>>>2>>>0]=0,0;case 21520:if(!r.tty)return -59;return -28;case 21531:var o=e_();return eN.ioctl(r,t,o);case 21523:if(!r.tty)return -59;if(r.tty.ops.ioctl_tiocgwinsz){var h=r.tty.ops.ioctl_tiocgwinsz(r.tty),o=e_();u[o>>>1>>>0]=h[0],u[o+2>>>1>>>0]=h[1]}return 0;default:return -28}}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_lstat64:function(e,t){e>>>=0,t>>>=0;try{return e=eC.getStr(e),eC.doStat(eN.lstat,e,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_newfstatat:function(e,t,n,r){t>>>=0,n>>>=0;try{t=eC.getStr(t);var i=256&r,o=4096&r;return r&=-6401,M(!r,`unknown flags in __syscall_newfstatat: ${r}`),t=eC.calculateAt(e,t,o),eC.doStat(i?eN.lstat:eN.stat,t,n)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_openat:function(e,t,n,r){t>>>=0,eC.varargs=r>>>=0;try{t=eC.getStr(t),t=eC.calculateAt(e,t);var i=r?e_():0;return eN.open(t,n,i).fd}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_rmdir:function(e){e>>>=0;try{return e=eC.getStr(e),eN.rmdir(e),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_stat64:function(e,t){e>>>=0,t>>>=0;try{return e=eC.getStr(e),eC.doStat(eN.stat,e,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_unlinkat:function(e,t,n){t>>>=0;try{return t=eC.getStr(t),t=eC.calculateAt(e,t),0===n?eN.unlink(t):512===n?eN.rmdir(t):J("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_abort_js:()=>{J("native code called abort()")},_emscripten_get_now_is_monotonic:()=>1,_emscripten_memcpy_js:function(e,t,n){return e>>>=0,t>>>=0,n>>>=0,l.copyWithin(e>>>0,t>>>0,t+n>>>0)},_emscripten_throw_longjmp:()=>{throw 1/0},_gmtime_js:function(e,t,n){var r=ep(e,t);n>>>=0;var i=new Date(1e3*r);c[n>>>2>>>0]=i.getUTCSeconds(),c[n+4>>>2>>>0]=i.getUTCMinutes(),c[n+8>>>2>>>0]=i.getUTCHours(),c[n+12>>>2>>>0]=i.getUTCDate(),c[n+16>>>2>>>0]=i.getUTCMonth(),c[n+20>>>2>>>0]=i.getUTCFullYear()-1900,c[n+24>>>2>>>0]=i.getUTCDay();var o=Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0),a=(i.getTime()-o)/864e5|0;c[n+28>>>2>>>0]=a},_localtime_js:function(e,t,n){let r;var i=ep(e,t);n>>>=0;var o=new Date(1e3*i);c[n>>>2>>>0]=o.getSeconds(),c[n+4>>>2>>>0]=o.getMinutes(),c[n+8>>>2>>>0]=o.getHours(),c[n+12>>>2>>>0]=o.getDate(),c[n+16>>>2>>>0]=o.getMonth(),c[n+20>>>2>>>0]=o.getFullYear()-1900,c[n+24>>>2>>>0]=o.getDay();var a=0|((r=o.getFullYear())%4==0&&(r%100!=0||r%400==0)?eM:eR)[o.getMonth()]+o.getDate()-1;c[n+28>>>2>>>0]=a,c[n+36>>>2>>>0]=-(60*o.getTimezoneOffset());var s=new Date(o.getFullYear(),0,1),l=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=s.getTimezoneOffset(),d=0|(l!=u&&o.getTimezoneOffset()==Math.min(u,l));c[n+32>>>2>>>0]=d},_mmap_js:function(e,t,n,r,i,o,a,s){e>>>=0;var l=ep(i,o);a>>>=0,s>>>=0;try{if(isNaN(l))return 61;var u=eC.getStreamFromFD(r),d=eN.mmap(u,e,l,t,n),m=d.ptr;return c[a>>>2>>>0]=d.allocated,f[s>>>2>>>0]=m,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_munmap_js:function(e,t,n,r,i,o,a){e>>>=0,t>>>=0;var s=ep(o,a);try{var l=eC.getStreamFromFD(i);2&n&&eC.doMsync(e,l,t,r,s)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_tzset_js:function(e,t,n,r){e>>>=0,t>>>=0,n>>>=0,r>>>=0;var i=(new Date).getFullYear(),o=new Date(i,0,1),a=new Date(i,6,1),s=o.getTimezoneOffset(),l=a.getTimezoneOffset(),u=Math.max(s,l);f[e>>>2>>>0]=60*u,c[t>>>2>>>0]=Number(s!=l);var d=e=>{var t=Math.abs(e),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");return`UTC${e>=0?"-":"+"}${n}${r}`},m=d(s),p=d(l);M(m),M(p),M(16>=ew(m),`timezone name truncated to fit in TZNAME_MAX (${m})`),M(16>=ew(p),`timezone name truncated to fit in TZNAME_MAX (${p})`),lDate.now(),emscripten_err:function(e){return e>>>=0,N(eg(e))},emscripten_get_now:()=>performance.now(),emscripten_resize_heap:function(e){e>>>=0;var t=l.length;M(e>t);if(e>0xffff0000)return N(`Cannot enlarge memory, requested ${e} bytes, but the limit is 4294901760 bytes!`),!1;for(var n=1;n<=4;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+0x6000000);var i=Math.min(0xffff0000,eS(Math.max(e,r),65536));if(eT(i))return!0}return N(`Failed to grow the heap from ${t} bytes to ${i} bytes, not enough memory!`),!1},environ_get:function(e,t){e>>>=0,t>>>=0;var n=0;return eL().forEach((r,i)=>{var o=t+n;f[e+4*i>>>2>>>0]=o;for(var a=o,l=0;l>>0]=r.charCodeAt(l);s[a>>>0]=0,n+=r.length+1}),0},environ_sizes_get:function(e,t){e>>>=0,t>>>=0;var n=eL();f[e>>>2>>>0]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),f[t>>>2>>>0]=r,0},exit:(e,n)=>{if(function(){var e=I,t=N,n=!1;I=N=e=>{n=!0};try{eJ(0),["stdout","stderr"].forEach(e=>{var t=eN.analyzePath("/dev/"+e);if(t){var r=t.object.rdev,i=ev.ttys[r];i?.output?.length&&(n=!0)}})}catch{}I=e,N=t,n&&em("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}(),(ed||0)&&!n){var i=`program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=0) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;r(i),N(i)}throw ed||(t.onExit?.(e),j=!0),new el(e)},fd_close:function(e){try{var t=eC.getStreamFromFD(e);return eN.close(t),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_read:function(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=eC.getStreamFromFD(e),o=((e,t,n,r)=>{for(var i=0,o=0;o>>2>>>0],l=f[t+4>>>2>>>0];t+=8;var u=eN.read(e,s,a,l,r);if(u<0)return -1;if(i+=u,u>>2>>>0]=o,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_seek:function(e,t,n,r,i){var o=ep(t,n);i>>>=0;try{if(isNaN(o))return 61;var a=eC.getStreamFromFD(e);return eN.llseek(a,o,r),g=[a.position>>>0,(F=a.position,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[i>>>2>>>0]=g[0],c[i+4>>>2>>>0]=g[1],a.getdents&&0===o&&0===r&&(a.getdents=null),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_sync:function(e){try{var t=eC.getStreamFromFD(e);if(t.stream_ops?.fsync)return t.stream_ops.fsync(t);return 0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_write:function(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=eC.getStreamFromFD(e),o=((e,t,n,r)=>{for(var i=0,o=0;o>>2>>>0],l=f[t+4>>>2>>>0];t+=8;var u=eN.write(e,s,a,l,r);if(u<0)return -1;if(i+=u,u>>2>>>0]=o,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},invoke_ii:function(e,t){var n=ef();try{return ez(e)(t)}catch(e){if(e3(n),e!==e+0)throw e;eY(1,0)}},invoke_iii:function(e,t,n){var r=ef();try{return ez(e)(t,n)}catch(e){if(e3(r),e!==e+0)throw e;eY(1,0)}},invoke_iiii:function(e,t,n,r){var i=ef();try{return ez(e)(t,n,r)}catch(e){if(e3(i),e!==e+0)throw e;eY(1,0)}},invoke_iiiii:function(e,t,n,r,i){var o=ef();try{return ez(e)(t,n,r,i)}catch(e){if(e3(o),e!==e+0)throw e;eY(1,0)}},invoke_iiiiii:function(e,t,n,r,i,o){var a=ef();try{return ez(e)(t,n,r,i,o)}catch(e){if(e3(a),e!==e+0)throw e;eY(1,0)}},invoke_iiiiiii:function(e,t,n,r,i,o,a){var s=ef();try{return ez(e)(t,n,r,i,o,a)}catch(e){if(e3(s),e!==e+0)throw e;eY(1,0)}},invoke_v:function(e){var t=ef();try{ez(e)()}catch(e){if(e3(t),e!==e+0)throw e;eY(1,0)}},invoke_vi:function(e,t){var n=ef();try{ez(e)(t)}catch(e){if(e3(n),e!==e+0)throw e;eY(1,0)}},invoke_vii:function(e,t,n){var r=ef();try{ez(e)(t,n)}catch(e){if(e3(r),e!==e+0)throw e;eY(1,0)}},invoke_viii:function(e,t,n,r){var i=ef();try{ez(e)(t,n,r)}catch(e){if(e3(i),e!==e+0)throw e;eY(1,0)}},invoke_viiii:function(e,t,n,r,i){var o=ef();try{ez(e)(t,n,r,i)}catch(e){if(e3(o),e!==e+0)throw e;eY(1,0)}},invoke_viiiiiiiii:function(e,t,n,r,i,o,a,s,l,u){var d=ef();try{ez(e)(t,n,r,i,o,a,s,l,u)}catch(e){if(e3(d),e!==e+0)throw e;eY(1,0)}},random_get:function(e,t){e>>>=0,t>>>=0;try{return eD(l.subarray(e>>>0,e+t>>>0)),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}}},eZ=function(){function e(e,n){var r,i,o,s;let l,u;return i=Object.assign({},i=eZ=e.exports),o=e=>t=>e(t)>>>0,s=e=>()=>e()>>>0,i.strerror=(l=i.strerror,e=>l(e)>>>0),i.emscripten_builtin_memalign=(u=i.emscripten_builtin_memalign,(e,t)=>u(e,t)>>>0),i.malloc=o(i.malloc),i.emscripten_stack_get_base=s(i.emscripten_stack_get_base),i.emscripten_stack_get_end=s(i.emscripten_stack_get_end),i._emscripten_stack_alloc=o(i._emscripten_stack_alloc),i.emscripten_stack_get_current=s(i.emscripten_stack_get_current),t.wasmExports=eZ=i,M(a=eZ.memory,"memory not found in wasm exports"),R(),M(_=eZ.__indirect_function_table,"table not found in wasm exports"),r=eZ.__wasm_call_ctors,L.unshift(r),Z("wasm-instantiate"),eZ}K("wasm-instantiate");var n,i,o=t,s={env:eK,wasi_snapshot_preview1:eK};if(t.instantiateWasm)try{return t.instantiateWasm(s,e)}catch(e){N(`Module.instantiateWasm callback failed with error: ${e}`),r(e)}return h??(h=function(){if(t.locateFile){var e="embedpdf.wasm";return e.startsWith("data:application/octet-stream;base64,")?e:t.locateFile?t.locateFile(e,O):O+e}return new URL("embedpdf.wasm",self.location.href).href}()),(n=h,i=function(n){M(t===o,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),o=null,e(n.instance)},!C&&"function"==typeof WebAssembly.instantiateStreaming&&!n.startsWith("data:application/octet-stream;base64,")&&"function"==typeof fetch?fetch(n,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,s).then(i,function(e){return N(`wasm streaming compile failed: ${e}`),N("falling back to ArrayBuffer instantiation"),ee(n,s,i)})):ee(n,s,i)).catch(r),{}}();X("__wasm_call_ctors",0),t._EPDFAction_CloseModel=X("EPDFAction_CloseModel",1),t._EPDFAction_LoadModel=X("EPDFAction_LoadModel",1),t._EPDFAction_GetRootNode=X("EPDFAction_GetRootNode",1),t._EPDFAction_GetNodeCount=X("EPDFAction_GetNodeCount",1),t._EPDFAction_GetNodeType=X("EPDFAction_GetNodeType",2),t._EPDFAction_GetNodeSubtype=X("EPDFAction_GetNodeSubtype",4),t._EPDFAction_NodeHasJavaScript=X("EPDFAction_NodeHasJavaScript",2),t._EPDFAction_GetNodeJavaScript=X("EPDFAction_GetNodeJavaScript",4),t._EPDFAction_GetNodeDest=X("EPDFAction_GetNodeDest",3),t._EPDFAction_GetNodeURI=X("EPDFAction_GetNodeURI",5),t._EPDFAction_GetNodeFilePath=X("EPDFAction_GetNodeFilePath",4),t._EPDFAction_GetNodeName=X("EPDFAction_GetNodeName",4),t._EPDFAction_GetNodeTargetCount=X("EPDFAction_GetNodeTargetCount",2),t._EPDFAction_GetNodeTargetName=X("EPDFAction_GetNodeTargetName",5),t._EPDFAction_GetNodeTargetObjectNumber=X("EPDFAction_GetNodeTargetObjectNumber",4),t._EPDFAction_GetNodeHideFlag=X("EPDFAction_GetNodeHideFlag",3),t._EPDFAction_GetNodeResetForm=X("EPDFAction_GetNodeResetForm",4),t._EPDFAction_GetNodeSubmitForm=X("EPDFAction_GetNodeSubmitForm",4),t._EPDFAction_GetNodeSubmitFormURL=X("EPDFAction_GetNodeSubmitFormURL",4),t._EPDFAction_GetNodeSubmitFormCharSet=X("EPDFAction_GetNodeSubmitFormCharSet",4),t._EPDFAction_GetNodeURIIsMap=X("EPDFAction_GetNodeURIIsMap",3),t._EPDFAction_GetNextCount=X("EPDFAction_GetNextCount",2),t._EPDFAction_GetNextAt=X("EPDFAction_GetNextAt",3),t._EPDFAction_GetWarningFlags=X("EPDFAction_GetWarningFlags",1),t._EPDFAction_IsComplete=X("EPDFAction_IsComplete",1),t._EPDFDoc_GetOpenActionModel=X("EPDFDoc_GetOpenActionModel",1),t._EPDFDoc_GetOpenActionDest=X("EPDFDoc_GetOpenActionDest",1),t._EPDFDoc_GetAdditionalActionModel=X("EPDFDoc_GetAdditionalActionModel",2),t._EPDFDoc_GetPageActionModel=X("EPDFDoc_GetPageActionModel",3),t._EPDFAnnot_GetActionModel=X("EPDFAnnot_GetActionModel",2),t._EPDFAction_CreateJavaScript=X("EPDFAction_CreateJavaScript",2),t._EPDFAction_CreateHide=X("EPDFAction_CreateHide",4),t._EPDFAction_CreateResetForm=X("EPDFAction_CreateResetForm",4),t._EPDFAction_CreateSubmitForm=X("EPDFAction_CreateSubmitForm",5),t._EPDFAction_SetNext=X("EPDFAction_SetNext",4),t._EPDFAnnot_SetEventAction=X("EPDFAnnot_SetEventAction",3),t._EPDFAnnot_SetNumberValue=X("EPDFAnnot_SetNumberValue",3),t._EPDFAnnot_HasEmbedMetadata=X("EPDFAnnot_HasEmbedMetadata",1),t._EPDFAnnot_ClearEmbedMetadata=X("EPDFAnnot_ClearEmbedMetadata",1),t._EPDFAnnot_ClearEmbedMetadataKey=X("EPDFAnnot_ClearEmbedMetadataKey",2),t._EPDFAnnot_SetEmbedMetadataString=X("EPDFAnnot_SetEmbedMetadataString",3),t._EPDFAnnot_GetEmbedMetadataString=X("EPDFAnnot_GetEmbedMetadataString",4),t._EPDFAnnot_SetEmbedMetadataNumber=X("EPDFAnnot_SetEmbedMetadataNumber",3),t._EPDFAnnot_GetEmbedMetadataNumber=X("EPDFAnnot_GetEmbedMetadataNumber",3),t._EPDFAnnot_SetEmbedMetadataBoolean=X("EPDFAnnot_SetEmbedMetadataBoolean",3),t._EPDFAnnot_GetEmbedMetadataBoolean=X("EPDFAnnot_GetEmbedMetadataBoolean",3),t._EPDFAnnot_SetEmbedMetadataRect=X("EPDFAnnot_SetEmbedMetadataRect",3),t._EPDFAnnot_GetEmbedMetadataRect=X("EPDFAnnot_GetEmbedMetadataRect",3),t._EPDFAnnot_SetEmbedMetadataJSON=X("EPDFAnnot_SetEmbedMetadataJSON",2),t._EPDFAnnot_GetEmbedMetadataJSON=X("EPDFAnnot_GetEmbedMetadataJSON",3),t._EPDFDocument_ClearEmbedMetadata=X("EPDFDocument_ClearEmbedMetadata",1),t._EPDFAnnot_SetAction=X("EPDFAnnot_SetAction",2),t._EPDFAnnot_RemoveAction=X("EPDFAnnot_RemoveAction",1),t._EPDFAnnot_RemoveDest=X("EPDFAnnot_RemoveDest",1),t._EPDFAnnot_RemoveKey=X("EPDFAnnot_RemoveKey",2),t._EPDFAnnot_GetFileAttachmentForWrite=X("EPDFAnnot_GetFileAttachmentForWrite",1),t._EPDFAnnot_SetColor=X("EPDFAnnot_SetColor",5),t._EPDFAnnot_GetColor=X("EPDFAnnot_GetColor",5),t._EPDFAnnot_ClearColor=X("EPDFAnnot_ClearColor",2),t._EPDFAnnot_SetNoColor=X("EPDFAnnot_SetNoColor",2),t._EPDFAnnot_SetOpacity=X("EPDFAnnot_SetOpacity",2),t._EPDFAnnot_GetOpacity=X("EPDFAnnot_GetOpacity",2),t._EPDFAnnot_GetBorderEffect=X("EPDFAnnot_GetBorderEffect",2),t._EPDFAnnot_SetBorderEffect=X("EPDFAnnot_SetBorderEffect",2),t._EPDFAnnot_ClearBorderEffect=X("EPDFAnnot_ClearBorderEffect",1),t._EPDFAnnot_GetRectangleDifferences=X("EPDFAnnot_GetRectangleDifferences",5),t._EPDFAnnot_ClearRectangleDifferences=X("EPDFAnnot_ClearRectangleDifferences",1),t._EPDFAnnot_GetBorderDashPatternCount=X("EPDFAnnot_GetBorderDashPatternCount",1),t._EPDFAnnot_GetBorderDashPattern=X("EPDFAnnot_GetBorderDashPattern",3),t._EPDFAnnot_SetBorderDashPattern=X("EPDFAnnot_SetBorderDashPattern",3),t._EPDFAnnot_GetBorderStyle=X("EPDFAnnot_GetBorderStyle",2),t._EPDFAnnot_SetBorderStyle=X("EPDFAnnot_SetBorderStyle",3),t._EPDFAnnot_GenerateAppearance=X("EPDFAnnot_GenerateAppearance",1),t._EPDFAnnot_GenerateAppearanceWithBlend=X("EPDFAnnot_GenerateAppearanceWithBlend",2),t._EPDFAnnot_GetBlendMode=X("EPDFAnnot_GetBlendMode",1),t._EPDFAnnot_SetIntent=X("EPDFAnnot_SetIntent",2),t._EPDFAnnot_GetIntent=X("EPDFAnnot_GetIntent",3),t._EPDFAnnot_GetRichContent=X("EPDFAnnot_GetRichContent",3),t._EPDFAnnot_GetRichTextJSON=X("EPDFAnnot_GetRichTextJSON",3),t._EPDFAnnot_SetRichTextJSON=X("EPDFAnnot_SetRichTextJSON",2),t._EPDFAnnot_SetRichTextXHTML=X("EPDFAnnot_SetRichTextXHTML",2),t._EPDFDoc_SetTypographicFeatures=X("EPDFDoc_SetTypographicFeatures",2),t._EPDFDoc_GetTypographicFeatures=X("EPDFDoc_GetTypographicFeatures",1),t._EPDFAnnot_SetLineEndings=X("EPDFAnnot_SetLineEndings",3),t._EPDFAnnot_GetLineEndings=X("EPDFAnnot_GetLineEndings",3),t._EPDFAnnot_SetVertices=X("EPDFAnnot_SetVertices",3),t._EPDFAnnot_SetLine=X("EPDFAnnot_SetLine",3),t._EPDFAnnot_SetDefaultAppearance=X("EPDFAnnot_SetDefaultAppearance",6),t._EPDFAnnot_SetDefaultAppearanceRegisteredFont=X("EPDFAnnot_SetDefaultAppearanceRegisteredFont",6),t._EPDFAnnot_GetDefaultAppearance=X("EPDFAnnot_GetDefaultAppearance",6),t._EPDFAnnot_GetDefaultAppearanceFontFace=X("EPDFAnnot_GetDefaultAppearanceFontFace",5),t._EPDFAnnot_GetDefaultAppearanceFontPostScriptName=X("EPDFAnnot_GetDefaultAppearanceFontPostScriptName",3),t._EPDFAnnot_SetDefaultAppearanceDocumentFont=X("EPDFAnnot_SetDefaultAppearanceDocumentFont",6),t._EPDFAnnot_SetTextAlignment=X("EPDFAnnot_SetTextAlignment",2),t._EPDFAnnot_GetTextAlignment=X("EPDFAnnot_GetTextAlignment",1),t._EPDFPage_GetAnnotByName=X("EPDFPage_GetAnnotByName",2),t._EPDFPage_RemoveAnnotByName=X("EPDFPage_RemoveAnnotByName",2),t._EPDFAnnot_SetLinkedAnnot=X("EPDFAnnot_SetLinkedAnnot",3),t._EPDFPage_GetAnnotIndexByNameRaw=X("EPDFPage_GetAnnotIndexByNameRaw",3),t._EPDFPage_GetAnnotIndexByObjectNumberRaw=X("EPDFPage_GetAnnotIndexByObjectNumberRaw",3),t._EPDFPage_GetAnnotCountRaw=X("EPDFPage_GetAnnotCountRaw",2),t._EPDFPage_GetAnnotRaw=X("EPDFPage_GetAnnotRaw",3),t._EPDFPage_CreateAnnotRaw=X("EPDFPage_CreateAnnotRaw",4),t._EPDFPage_RemoveAnnotRaw=X("EPDFPage_RemoveAnnotRaw",3),t._EPDFPage_PromoteInlineAnnotsRaw=X("EPDFPage_PromoteInlineAnnotsRaw",2),t._EPDFAnnot_IsValid=X("EPDFAnnot_IsValid",1),t._EPDFAnnot_SetSubtype=X("EPDFAnnot_SetSubtype",2),t._EPDFAnnot_SetName=X("EPDFAnnot_SetName",2),t._EPDFAnnot_GetName=X("EPDFAnnot_GetName",3),t._EPDFAnnot_UpdateAppearanceToRect=X("EPDFAnnot_UpdateAppearanceToRect",2),t._EPDFAnnot_SetStampOpacity=X("EPDFAnnot_SetStampOpacity",3),t._EPDFPage_CreateAnnot=X("EPDFPage_CreateAnnot",2),t._EPDFAnnot_SetRotate=X("EPDFAnnot_SetRotate",2),t._EPDFAnnot_GetRotate=X("EPDFAnnot_GetRotate",2),t._EPDFAnnot_GetAppearanceTransform=X("EPDFAnnot_GetAppearanceTransform",3),t._EPDFAnnot_GetReplyType=X("EPDFAnnot_GetReplyType",1),t._EPDFAnnot_SetReplyType=X("EPDFAnnot_SetReplyType",2),t._EPDFAnnot_GetBooleanValue=X("EPDFAnnot_GetBooleanValue",3),t._EPDFAnnot_SetBooleanValue=X("EPDFAnnot_SetBooleanValue",3),t._EPDFAnnot_SetOverlayText=X("EPDFAnnot_SetOverlayText",2),t._EPDFAnnot_GetOverlayText=X("EPDFAnnot_GetOverlayText",3),t._EPDFAnnot_SetOverlayTextRepeat=X("EPDFAnnot_SetOverlayTextRepeat",2),t._EPDFAnnot_GetOverlayTextRepeat=X("EPDFAnnot_GetOverlayTextRepeat",1),t._EPDFAnnot_SetAppearanceFromPage=X("EPDFAnnot_SetAppearanceFromPage",3),t._EPDFAnnot_ExportAppearance=X("EPDFAnnot_ExportAppearance",3),t._EPDFDoc_CanonicalDrawing=X("EPDFDoc_CanonicalDrawing",2),t._EPDFDoc_ImportDrawing=X("EPDFDoc_ImportDrawing",2),t._EPDFDoc_ExportDrawing=X("EPDFDoc_ExportDrawing",2),t._EPDFDoc_GetDrawings=X("EPDFDoc_GetDrawings",3),t._EPDFAnnot_SetDrawing=X("EPDFAnnot_SetDrawing",3),t._EPDFAnnot_GetDrawing=X("EPDFAnnot_GetDrawing",1),t._EPDFAnnot_GetRect=X("EPDFAnnot_GetRect",2),t._EPDFAnnot_SetRect=X("EPDFAnnot_SetRect",2),t._EPDFAnnot_SetAPMatrix=X("EPDFAnnot_SetAPMatrix",3),t._EPDFAnnot_GetAPMatrix=X("EPDFAnnot_GetAPMatrix",3),t._EPDFAnnot_GetAvailableAppearanceModes=X("EPDFAnnot_GetAvailableAppearanceModes",1),t._EPDFAnnot_GetAppearanceStateCount=X("EPDFAnnot_GetAppearanceStateCount",2),t._EPDFAnnot_GetAppearanceStateName=X("EPDFAnnot_GetAppearanceStateName",5),t._EPDFAnnot_GetAppearanceState=X("EPDFAnnot_GetAppearanceState",3),t._EPDFAnnot_HasAppearanceStream=X("EPDFAnnot_HasAppearanceStream",2),t._EPDFAnnot_GetDrawingRect=X("EPDFAnnot_GetDrawingRect",3),t._EPDFAnnot_SetMKColor=X("EPDFAnnot_SetMKColor",5),t._EPDFAnnot_GetMKColor=X("EPDFAnnot_GetMKColor",5),t._EPDFAnnot_ClearMKColor=X("EPDFAnnot_ClearMKColor",2),t._EPDFAnnot_SetMKText=X("EPDFAnnot_SetMKText",3),t._EPDFAnnot_GetMKText=X("EPDFAnnot_GetMKText",4),t._EPDFAnnot_SetMKTextPosition=X("EPDFAnnot_SetMKTextPosition",2),t._EPDFAnnot_GetMKTextPosition=X("EPDFAnnot_GetMKTextPosition",1),t._EPDFAnnot_SetMKIcon=X("EPDFAnnot_SetMKIcon",3),t._EPDFAnnot_GetMKIcon=X("EPDFAnnot_GetMKIcon",2),t._EPDFAnnot_ClearMKIcon=X("EPDFAnnot_ClearMKIcon",2),t._EPDFAnnot_HasMKIcon=X("EPDFAnnot_HasMKIcon",2),t._EPDFAnnot_SetMKRotation=X("EPDFAnnot_SetMKRotation",2),t._EPDFAnnot_GetMKRotation=X("EPDFAnnot_GetMKRotation",1),t._EPDFAnnot_GenerateFormFieldAP=X("EPDFAnnot_GenerateFormFieldAP",1),t._EPDFAnnot_GetCalloutLineCount=X("EPDFAnnot_GetCalloutLineCount",1),t._EPDFAnnot_GetCalloutLine=X("EPDFAnnot_GetCalloutLine",3),t._EPDFAnnot_SetCalloutLine=X("EPDFAnnot_SetCalloutLine",3),t._EPDFAnnot_GetObjectNumber=X("EPDFAnnot_GetObjectNumber",1),t._EPDFAnnot_GetStructurePosition=X("EPDFAnnot_GetStructurePosition",3),t._EPDFPage_GetAnnotByObjectNumber=X("EPDFPage_GetAnnotByObjectNumber",2),t._EPDFPage_RemoveAnnot=X("EPDFPage_RemoveAnnot",2),t._EPDFPage_RemoveAnnotByObjectNumber=X("EPDFPage_RemoveAnnotByObjectNumber",2),t._EPDFPage_MoveAnnots=X("EPDFPage_MoveAnnots",4),t._EPDFPage_MoveAnnotsRaw=X("EPDFPage_MoveAnnotsRaw",5),t._EPDF_LoadBaseDocument=X("EPDF_LoadBaseDocument",2),t._EPDF_LoadMemBaseDocument=X("EPDF_LoadMemBaseDocument",3),t._EPDF_LoadMemBaseDocument64=X("EPDF_LoadMemBaseDocument64",3),t._EPDF_ReleaseBaseDocument=X("EPDF_ReleaseBaseDocument",1),t._EPDFPage_ExportAnnotsRawToOwnedBuffer=X("EPDFPage_ExportAnnotsRawToOwnedBuffer",5),t._EPDFPage_ImportAnnotsRaw=X("EPDFPage_ImportAnnotsRaw",4),t._EPDFDoc_ExportDictRawToOwnedBuffer=X("EPDFDoc_ExportDictRawToOwnedBuffer",4),t._EPDFDoc_ExportDictCanonicalToOwnedBuffer=X("EPDFDoc_ExportDictCanonicalToOwnedBuffer",5),t._EPDFDoc_ImportDictRaw=X("EPDFDoc_ImportDictRaw",3),t._EPDFForm_ExportFieldRawToOwnedBuffer=X("EPDFForm_ExportFieldRawToOwnedBuffer",3),t._EPDFForm_ImportFieldRaw=X("EPDFForm_ImportFieldRaw",3),t._EPDFOutline_ExportItemRawToOwnedBuffer=X("EPDFOutline_ExportItemRawToOwnedBuffer",3),t._EPDFOutline_ImportItemRaw=X("EPDFOutline_ImportItemRaw",3),t._EPDFPage_ExportRawToOwnedBuffer=X("EPDFPage_ExportRawToOwnedBuffer",3),t._EPDFPage_ImportRaw=X("EPDFPage_ImportRaw",3),t._EPDFAttachment_ExportRawToOwnedBuffer=X("EPDFAttachment_ExportRawToOwnedBuffer",3),t._EPDFAttachment_ExportCanonicalToOwnedBuffer=X("EPDFAttachment_ExportCanonicalToOwnedBuffer",3),t._EPDFAttachment_ImportRaw=X("EPDFAttachment_ImportRaw",3),t._EPDFCatalog_GetMetadata=X("EPDFCatalog_GetMetadata",3),t._EPDFCatalog_SetMetadata=X("EPDFCatalog_SetMetadata",3),t._EPDFFont_RegisterFont=X("EPDFFont_RegisterFont",4),t._EPDFFont_RegisterMemFont=X("EPDFFont_RegisterMemFont",5),t._EPDFFont_RegisterMemFont64=X("EPDFFont_RegisterMemFont64",5),t._EPDFFont_ClearRegisteredFonts=X("EPDFFont_ClearRegisteredFonts",0),t._EPDFFont_GetEmbeddingPermission=X("EPDFFont_GetEmbeddingPermission",1),t._EPDFFont_IsEditingAuthorized=X("EPDFFont_IsEditingAuthorized",1),t._EPDFFont_AuthorizeEditing=X("EPDFFont_AuthorizeEditing",1),t._EPDFFont_IsInstanced=X("EPDFFont_IsInstanced",1),t._EPDFFont_GetFamilyName=X("EPDFFont_GetFamilyName",3),t._EPDFFont_GetWeight=X("EPDFFont_GetWeight",1),t._EPDFFont_IsItalic=X("EPDFFont_IsItalic",1),t._EPDFDoc_SetFontEmbeddingPolicy=X("EPDFDoc_SetFontEmbeddingPolicy",2),t._EPDFDoc_GetFontEmbeddingPolicy=X("EPDFDoc_GetFontEmbeddingPolicy",1),t._EPDFFont_AddFallbackFont=X("EPDFFont_AddFallbackFont",2),t._EPDFFont_ClearFallbackFonts=X("EPDFFont_ClearFallbackFonts",0),t._EPDFFont_SetLastResortFont=X("EPDFFont_SetLastResortFont",1),t._EPDFFont_GetLastResortFont=X("EPDFFont_GetLastResortFont",0),t._EPDFFont_GetFallbackOrder=X("EPDFFont_GetFallbackOrder",4),t._EPDFFont_GetProgramData=X("EPDFFont_GetProgramData",3),t._EPDFFont_GetProgramFormat=X("EPDFFont_GetProgramFormat",1),t._EPDFFont_GetProgramHash=X("EPDFFont_GetProgramHash",2),t._EPDFFont_GetCoverage=X("EPDFFont_GetCoverage",3),t._EPDFFont_GetMetrics=X("EPDFFont_GetMetrics",3),t._EPDFFont_GetPostScriptName=X("EPDFFont_GetPostScriptName",3),t._EPDFFontFaces_Load=X("EPDFFontFaces_Load",1),t._EPDFFontFaces_Close=X("EPDFFontFaces_Close",1),t._EPDFDoc_GetFontsFingerprint=X("EPDFDoc_GetFontsFingerprint",2),t._EPDFFontFaces_Count=X("EPDFFontFaces_Count",1),t._EPDFFontFaces_GetFamily=X("EPDFFontFaces_GetFamily",4),t._EPDFFontFaces_GetWeight=X("EPDFFontFaces_GetWeight",2),t._EPDFFontFaces_IsItalic=X("EPDFFontFaces_IsItalic",2),t._EPDFFontFaces_CountPrograms=X("EPDFFontFaces_CountPrograms",2),t._EPDFFontFaces_GetProgramObjNum=X("EPDFFontFaces_GetProgramObjNum",3),t._EPDFFontFaces_GetProgramFormat=X("EPDFFontFaces_GetProgramFormat",3),t._EPDFFontFaces_GetProgramEmbedded=X("EPDFFontFaces_GetProgramEmbedded",3),t._EPDFFontFaces_GetProgramPostScriptName=X("EPDFFontFaces_GetProgramPostScriptName",5),t._EPDFFontFaces_GetProgramEmbeddingPermission=X("EPDFFontFaces_GetProgramEmbeddingPermission",3),t._EPDFFontFaces_ProgramMapsUnicode=X("EPDFFontFaces_ProgramMapsUnicode",3),t._EPDFFontFaces_GetProgramHash=X("EPDFFontFaces_GetProgramHash",4),t._EPDFFontFaces_GetProgramDisplayHash=X("EPDFFontFaces_GetProgramDisplayHash",4),t._EPDFFontFaces_GetProgramMetrics=X("EPDFFontFaces_GetProgramMetrics",5),t._EPDFDoc_GetFontProgramData=X("EPDFDoc_GetFontProgramData",4),t._EPDFDoc_GetFontDisplayProgramData=X("EPDFDoc_GetFontDisplayProgramData",4),t._EPDFDoc_GetFontDisplayProgramCoverage=X("EPDFDoc_GetFontDisplayProgramCoverage",4),t._EPDFDoc_ResolveFonts=X("EPDFDoc_ResolveFonts",8),t._EPDFFontResolution_Close=X("EPDFFontResolution_Close",1),t._EPDFFontResolution_GetSource=X("EPDFFontResolution_GetSource",2),t._EPDFFontResolution_GetRegisteredFont=X("EPDFFontResolution_GetRegisteredFont",2),t._EPDFFontResolution_GetProgramObjNum=X("EPDFFontResolution_GetProgramObjNum",2),t._EPDFFontResolution_GetProgramDisplayHash=X("EPDFFontResolution_GetProgramDisplayHash",3),t._EPDFFontResolution_GetBaseFontName=X("EPDFFontResolution_GetBaseFontName",4),t._EPDFFontResolution_GetFamily=X("EPDFFontResolution_GetFamily",4),t._EPDFFontResolution_GetWeight=X("EPDFFontResolution_GetWeight",2),t._EPDFFontResolution_IsItalic=X("EPDFFontResolution_IsItalic",2),t._EPDFFontResolution_IsDegraded=X("EPDFFontResolution_IsDegraded",2),t._EPDFFontResolution_GetFallbacks=X("EPDFFontResolution_GetFallbacks",4),t._EPDFFontResolution_CountMissingCharacters=X("EPDFFontResolution_CountMissingCharacters",1),t._EPDFFontResolution_GetMissingCharacter=X("EPDFFontResolution_GetMissingCharacter",4),t._EPDFDoc_ClearMissingCharacters=X("EPDFDoc_ClearMissingCharacters",1),t._EPDFDoc_CountMissingCharacters=X("EPDFDoc_CountMissingCharacters",1),t._EPDFDoc_GetMissingCharacter=X("EPDFDoc_GetMissingCharacter",4),t._EPDFForm_LoadModel=X("EPDFForm_LoadModel",1),t._EPDFForm_CloseModel=X("EPDFForm_CloseModel",1),t._EPDFForm_GetFormKind=X("EPDFForm_GetFormKind",1),t._EPDFForm_GetNeedAppearances=X("EPDFForm_GetNeedAppearances",1),t._EPDFForm_CountFields=X("EPDFForm_CountFields",1),t._EPDFForm_GetFieldActionModel=X("EPDFForm_GetFieldActionModel",3),t._EPDFForm_CountCalculationOrder=X("EPDFForm_CountCalculationOrder",1),t._EPDFForm_GetCalculationOrderFieldIndex=X("EPDFForm_GetCalculationOrderFieldIndex",2),t._EPDFForm_GetFieldObjNum=X("EPDFForm_GetFieldObjNum",2),t._EPDFForm_GetFieldFamily=X("EPDFForm_GetFieldFamily",2),t._EPDFForm_GetFieldFlags=X("EPDFForm_GetFieldFlags",2),t._EPDFForm_GetFieldOrigin=X("EPDFForm_GetFieldOrigin",2),t._EPDFForm_GetFieldName=X("EPDFForm_GetFieldName",4),t._EPDFForm_GetFieldAlternateName=X("EPDFForm_GetFieldAlternateName",4),t._EPDFForm_GetFieldMappingName=X("EPDFForm_GetFieldMappingName",4),t._EPDFForm_HasFieldEmbedMetadata=X("EPDFForm_HasFieldEmbedMetadata",2),t._EPDFForm_HasFieldValuesList=X("EPDFForm_HasFieldValuesList",2),t._EPDFForm_GetFieldEmbedMetadataString=X("EPDFForm_GetFieldEmbedMetadataString",5),t._EPDFForm_GetFieldEmbedMetadataNumber=X("EPDFForm_GetFieldEmbedMetadataNumber",4),t._EPDFForm_GetFieldEmbedMetadataBoolean=X("EPDFForm_GetFieldEmbedMetadataBoolean",4),t._EPDFForm_GetFieldEmbedMetadataJSON=X("EPDFForm_GetFieldEmbedMetadataJSON",4),t._EPDFForm_GetFieldValueKind=X("EPDFForm_GetFieldValueKind",2),t._EPDFForm_CountFieldValues=X("EPDFForm_CountFieldValues",2),t._EPDFForm_GetFieldValueAt=X("EPDFForm_GetFieldValueAt",5),t._EPDFForm_GetFieldDefaultValueKind=X("EPDFForm_GetFieldDefaultValueKind",2),t._EPDFForm_CountFieldDefaultValues=X("EPDFForm_CountFieldDefaultValues",2),t._EPDFForm_GetFieldDefaultValueAt=X("EPDFForm_GetFieldDefaultValueAt",5),t._EPDFForm_GetFieldMaxLen=X("EPDFForm_GetFieldMaxLen",2),t._EPDFForm_GetFieldTopIndex=X("EPDFForm_GetFieldTopIndex",2),t._EPDFForm_CountFieldOptions=X("EPDFForm_CountFieldOptions",2),t._EPDFForm_GetFieldOptionLabel=X("EPDFForm_GetFieldOptionLabel",5),t._EPDFForm_GetFieldOptionValue=X("EPDFForm_GetFieldOptionValue",5),t._EPDFForm_IsFieldOptionSelected=X("EPDFForm_IsFieldOptionSelected",3),t._EPDFForm_CountFieldWidgets=X("EPDFForm_CountFieldWidgets",2),t._EPDFForm_GetFieldWidgetObjNum=X("EPDFForm_GetFieldWidgetObjNum",3),t._EPDFForm_GetFieldWidgetPageObjNum=X("EPDFForm_GetFieldWidgetPageObjNum",3),t._EPDFForm_GetFieldWidgetRect=X("EPDFForm_GetFieldWidgetRect",4),t._EPDFForm_GetFieldWidgetOnState=X("EPDFForm_GetFieldWidgetOnState",5),t._EPDFForm_GetFieldWidgetExportValue=X("EPDFForm_GetFieldWidgetExportValue",5),t._EPDFForm_IsFieldWidgetChecked=X("EPDFForm_IsFieldWidgetChecked",3),t._EPDFForm_GetFieldIndexByObjNum=X("EPDFForm_GetFieldIndexByObjNum",2),t._EPDFForm_GetFieldIndexForWidget=X("EPDFForm_GetFieldIndexForWidget",2),t._EPDFForm_SetFieldValue=X("EPDFForm_SetFieldValue",5),t._EPDFForm_SetFieldDefaultValue=X("EPDFForm_SetFieldDefaultValue",5),t._EPDFForm_SetFieldSelectedIndices=X("EPDFForm_SetFieldSelectedIndices",4),t._EPDFForm_SetFieldWidgetsChecked=X("EPDFForm_SetFieldWidgetsChecked",7),t._EPDFForm_RedrawFieldWidgets=X("EPDFForm_RedrawFieldWidgets",5),t._EPDFForm_SetFieldDisplay=X("EPDFForm_SetFieldDisplay",6),t._EPDFForm_SetFieldAppearanceText=X("EPDFForm_SetFieldAppearanceText",6),t._EPDFForm_ExportFDF=X("EPDFForm_ExportFDF",5),t._EPDFForm_ExportXFDF=X("EPDFForm_ExportXFDF",5),t._EPDFForm_Repair=X("EPDFForm_Repair",3),t._EPDFForm_CreateField=X("EPDFForm_CreateField",4),t._EPDFForm_AttachWidget=X("EPDFForm_AttachWidget",6),t._EPDFForm_DetachWidget=X("EPDFForm_DetachWidget",3),t._EPDFForm_DeleteField=X("EPDFForm_DeleteField",5),t._EPDFForm_SetFieldName=X("EPDFForm_SetFieldName",3),t._EPDFForm_GetFieldPartialName=X("EPDFForm_GetFieldPartialName",4),t._EPDFForm_SetFieldFlags=X("EPDFForm_SetFieldFlags",4),t._EPDFForm_SetFieldEventAction=X("EPDFForm_SetFieldEventAction",4),t._EPDFForm_SetCalculationOrder=X("EPDFForm_SetCalculationOrder",3),t._EPDFForm_SetFieldMaxLen=X("EPDFForm_SetFieldMaxLen",3),t._EPDFForm_SetFieldAlternateName=X("EPDFForm_SetFieldAlternateName",3),t._EPDFForm_SetFieldMappingName=X("EPDFForm_SetFieldMappingName",3),t._EPDFForm_SetFieldEmbedMetadataString=X("EPDFForm_SetFieldEmbedMetadataString",4),t._EPDFForm_SetFieldEmbedMetadataNumber=X("EPDFForm_SetFieldEmbedMetadataNumber",4),t._EPDFForm_SetFieldEmbedMetadataBoolean=X("EPDFForm_SetFieldEmbedMetadataBoolean",4),t._EPDFForm_SetFieldEmbedMetadataJSON=X("EPDFForm_SetFieldEmbedMetadataJSON",3),t._EPDFForm_ClearFieldEmbedMetadataKey=X("EPDFForm_ClearFieldEmbedMetadataKey",3),t._EPDFForm_ClearFieldEmbedMetadata=X("EPDFForm_ClearFieldEmbedMetadata",2),t._EPDFForm_SetFieldOptions=X("EPDFForm_SetFieldOptions",5),t._EPDFPage_Flatten=X("EPDFPage_Flatten",2),t._EPDFPage_FlattenAnnotations=X("EPDFPage_FlattenAnnotations",5),t._EPDFPage_ExportAnnotationsAsDocument=X("EPDFPage_ExportAnnotationsAsDocument",3),t._EPDFDoc_ExportPagesFlattened=X("EPDFDoc_ExportPagesFlattened",5),t._EPDFLayer_OpenLayer=X("EPDFLayer_OpenLayer",4),t._EPDFLayer_OpenLayerArtifact=X("EPDFLayer_OpenLayerArtifact",4),t._EPDFLayer_OpenLayerArtifactFromPath=X("EPDFLayer_OpenLayerArtifactFromPath",4),t._EPDFLayer_IsObjectPromoted=X("EPDFLayer_IsObjectPromoted",2),t._EPDFPage_IsValid=X("EPDFPage_IsValid",1),t._EPDFLayer_IsPagePromoted=X("EPDFLayer_IsPagePromoted",2),t._EPDFLayer_GetBirthObjectNumber=X("EPDFLayer_GetBirthObjectNumber",3),t._EPDFLayer_GetBirthName=X("EPDFLayer_GetBirthName",4),t._EPDFLayer_BeginTransaction=X("EPDFLayer_BeginTransaction",1),t._EPDFLayer_CommitTransaction=X("EPDFLayer_CommitTransaction",1),t._EPDFLayer_AbortTransaction=X("EPDFLayer_AbortTransaction",1),t._EPDFLayer_IsInTransaction=X("EPDFLayer_IsInTransaction",1),t._EPDFLayer_GetLastObjectNumber=X("EPDFLayer_GetLastObjectNumber",1),t._EPDFLayer_RaiseLastObjectNumber=X("EPDFLayer_RaiseLastObjectNumber",2),t._EPDFLayer_GetPromotedObjectCount=X("EPDFLayer_GetPromotedObjectCount",1),t._EPDFLayer_GetBaseDocument=X("EPDFLayer_GetBaseDocument",1),t._EPDF_SetBaseDocumentSha256=X("EPDF_SetBaseDocumentSha256",2),t._EPDFLayer_GetBaseSha256=X("EPDFLayer_GetBaseSha256",2),t._EPDFLayer_SaveDelta=X("EPDFLayer_SaveDelta",3),t._EPDFLayer_SaveDeltaEx=X("EPDFLayer_SaveDeltaEx",4),t._EPDFLayer_SaveDeltaToOwnedBuffer=X("EPDFLayer_SaveDeltaToOwnedBuffer",3),t._EPDFLayer_SaveDeltaToOwnedBufferEx=X("EPDFLayer_SaveDeltaToOwnedBufferEx",4),t._EPDFLayer_SaveLayerArtifact=X("EPDFLayer_SaveLayerArtifact",3),t._EPDFLayer_SaveLayerArtifactEx=X("EPDFLayer_SaveLayerArtifactEx",4),t._EPDFLayer_SaveLayerArtifactToOwnedBuffer=X("EPDFLayer_SaveLayerArtifactToOwnedBuffer",3),t._EPDFLayer_SaveLayerArtifactToOwnedBufferEx=X("EPDFLayer_SaveLayerArtifactToOwnedBufferEx",4),t._EPDFNamedDest_SetDest=X("EPDFNamedDest_SetDest",3),t._EPDFNamedDest_Remove=X("EPDFNamedDest_Remove",2),t._EPDFDest_CreateView=X("EPDFDest_CreateView",4),t._EPDFDest_CreateXYZ=X("EPDFDest_CreateXYZ",7),t._EPDFDest_CreateRemoteView=X("EPDFDest_CreateRemoteView",5),t._EPDFDest_CreateRemoteXYZ=X("EPDFDest_CreateRemoteXYZ",8),t._EPDFDest_CreateXYZByObjectNumber=X("EPDFDest_CreateXYZByObjectNumber",8),t._EPDFDest_CreateViewByObjectNumber=X("EPDFDest_CreateViewByObjectNumber",5),t._EPDFDest_GetViewNullParams=X("EPDFDest_GetViewNullParams",1),t._EPDFAction_CreateGoTo=X("EPDFAction_CreateGoTo",2),t._EPDFAction_CreateGoToNamed=X("EPDFAction_CreateGoToNamed",2),t._EPDFAction_CreateLaunch=X("EPDFAction_CreateLaunch",2),t._EPDFAction_CreateRemoteGoToByName=X("EPDFAction_CreateRemoteGoToByName",3),t._EPDFAction_CreateRemoteGoToDest=X("EPDFAction_CreateRemoteGoToDest",3),t._EPDFAction_CreateURI=X("EPDFAction_CreateURI",2),t._EPDFAction_CreateNamed=X("EPDFAction_CreateNamed",2),t._EPDFOutline_GetObjectNumber=X("EPDFOutline_GetObjectNumber",1),t._EPDFOutline_GetItem=X("EPDFOutline_GetItem",2),t._EPDFOutline_CreateItem=X("EPDFOutline_CreateItem",5),t._EPDFOutline_MoveItem=X("EPDFOutline_MoveItem",4),t._EPDFOutline_DeleteItem=X("EPDFOutline_DeleteItem",2),t._EPDFOutline_SetTitle=X("EPDFOutline_SetTitle",3),t._EPDFOutline_SetOpen=X("EPDFOutline_SetOpen",3),t._EPDFOutline_SetColor=X("EPDFOutline_SetColor",6),t._EPDFOutline_SetStyle=X("EPDFOutline_SetStyle",3),t._EPDFOutline_SetAction=X("EPDFOutline_SetAction",3),t._EPDFDoc_GetNamedPageCount=X("EPDFDoc_GetNamedPageCount",2),t._EPDFDoc_GetNamedPageAt=X("EPDFDoc_GetNamedPageAt",7),t._EPDFDoc_SetNamedPage=X("EPDFDoc_SetNamedPage",3),t._EPDFDoc_RemoveNamedPage=X("EPDFDoc_RemoveNamedPage",2),t._EPDFDoc_RemoveNamedPagesForPage=X("EPDFDoc_RemoveNamedPagesForPage",2),t._EPDFDoc_GetPageLabelSectionCount=X("EPDFDoc_GetPageLabelSectionCount",1),t._EPDFDoc_GetPageLabelSectionAt=X("EPDFDoc_GetPageLabelSectionAt",7),t._EPDFDoc_SetPageLabelSections=X("EPDFDoc_SetPageLabelSections",6),t._EPDF_DigestBuffer=X("EPDF_DigestBuffer",5),t._EPDFDoc_GetRevisionCount=X("EPDFDoc_GetRevisionCount",1),t._EPDFDoc_GetRevision=X("EPDFDoc_GetRevision",4),t._EPDFDoc_OpenRevision=X("EPDFDoc_OpenRevision",3),t._EPDFDoc_OpenBaseOverlayFromPath=X("EPDFDoc_OpenBaseOverlayFromPath",2),t._EPDFDoc_OpenBaseOverlay=X("EPDFDoc_OpenBaseOverlay",3),t._EPDFSig_LoadModel=X("EPDFSig_LoadModel",1),t._EPDFSig_CloseModel=X("EPDFSig_CloseModel",1),t._EPDFSig_Count=X("EPDFSig_Count",1),t._EPDFSig_IsRevisionChainValid=X("EPDFSig_IsRevisionChainValid",1),t._EPDFSig_GetIndexByFieldObjNum=X("EPDFSig_GetIndexByFieldObjNum",2),t._EPDFSig_GetFieldObjNum=X("EPDFSig_GetFieldObjNum",2),t._EPDFSig_GetWidgetObjNum=X("EPDFSig_GetWidgetObjNum",2),t._EPDFSig_GetWidgetPageObjNum=X("EPDFSig_GetWidgetPageObjNum",2),t._EPDFSig_GetValueObjNum=X("EPDFSig_GetValueObjNum",2),t._EPDFSig_GetFieldName=X("EPDFSig_GetFieldName",4),t._EPDFSig_IsSigned=X("EPDFSig_IsSigned",2),t._EPDFSig_GetKind=X("EPDFSig_GetKind",2),t._EPDFSig_GetByteRange=X("EPDFSig_GetByteRange",3),t._EPDFSig_GetCoverage=X("EPDFSig_GetCoverage",2),t._EPDFSig_GetRevisionIndex=X("EPDFSig_GetRevisionIndex",2),t._EPDFSig_GetContents=X("EPDFSig_GetContents",4),t._EPDFSig_GetString=X("EPDFSig_GetString",5),t._EPDFSig_GetDocMDPPermission=X("EPDFSig_GetDocMDPPermission",2),t._EPDFSig_IsCatalogCertification=X("EPDFSig_IsCatalogCertification",2),t._EPDFSig_GetFieldMDPAction=X("EPDFSig_GetFieldMDPAction",2),t._EPDFSig_GetLockAction=X("EPDFSig_GetLockAction",2),t._EPDFSig_GetLockPermission=X("EPDFSig_GetLockPermission",2),t._EPDFSig_GetFieldNameCount=X("EPDFSig_GetFieldNameCount",3),t._EPDFSig_GetFieldNameAt=X("EPDFSig_GetFieldNameAt",6),t._EPDFSig_HasSeedValue=X("EPDFSig_HasSeedValue",2),t._EPDFSig_GetSeedValueRequiredFlags=X("EPDFSig_GetSeedValueRequiredFlags",2),t._EPDFSig_GetSeedValuePresentFlags=X("EPDFSig_GetSeedValuePresentFlags",2),t._EPDFSig_GetSeedValueMDP=X("EPDFSig_GetSeedValueMDP",2),t._EPDFSig_GetSeedValueVersion=X("EPDFSig_GetSeedValueVersion",2),t._EPDFSig_GetSeedValueFilter=X("EPDFSig_GetSeedValueFilter",4),t._EPDFSig_GetSeedValueListCount=X("EPDFSig_GetSeedValueListCount",3),t._EPDFSig_GetSeedValueListAt=X("EPDFSig_GetSeedValueListAt",6),t._EPDFSig_DigestByteRange=X("EPDFSig_DigestByteRange",5),t._EPDFSig_DigestFileRange=X("EPDFSig_DigestFileRange",5),t._EPDFDoc_GetLoadedBytesSize=X("EPDFDoc_GetLoadedBytesSize",1),t._EPDFDoc_GetBaseBytesSize=X("EPDFDoc_GetBaseBytesSize",1),t._EPDFDoc_GetStructureObjectNumbers=X("EPDFDoc_GetStructureObjectNumbers",4),t._EPDFDoc_ReadLoadedBytes=X("EPDFDoc_ReadLoadedBytes",5),t._EPDFSig_Prepare=X("EPDFSig_Prepare",3),t._EPDFSig_SetFieldLock=X("EPDFSig_SetFieldLock",6),t._EPDFSig_SaveCandidateToOwnedBuffer=X("EPDFSig_SaveCandidateToOwnedBuffer",5),t._EPDFSig_SaveCandidate=X("EPDFSig_SaveCandidate",6),t._EPDFSig_Seal=X("EPDFSig_Seal",13),t._EPDFSig_SealSpan=X("EPDFSig_SealSpan",10),t._EPDFSig_WriteContents=X("EPDFSig_WriteContents",9),t._EPDFDss_GetCount=X("EPDFDss_GetCount",2),t._EPDFDss_GetData=X("EPDFDss_GetData",5),t._EPDFDss_Add=X("EPDFDss_Add",4),t._EPDFDoc_CompareRevisions=X("EPDFDoc_CompareRevisions",2),t._EPDFObjectDiff_Close=X("EPDFObjectDiff_Close",1),t._EPDFObjectDiff_GetCount=X("EPDFObjectDiff_GetCount",1),t._EPDFObjectDiff_GetEntry=X("EPDFObjectDiff_GetEntry",8),t._EPDFObjectDiff_GetValue=X("EPDFObjectDiff_GetValue",6),t._EPDFObjectDiff_GetReadStatus=X("EPDFObjectDiff_GetReadStatus",3),t._EPDFObjectDiff_GetRevisionHealth=X("EPDFObjectDiff_GetRevisionHealth",5),t._EPDFObjectDiff_GetReferrerCount=X("EPDFObjectDiff_GetReferrerCount",3),t._EPDFObjectDiff_GetReferrer=X("EPDFObjectDiff_GetReferrer",7),t._EPDFDoc_GetLoadedObjectValue=X("EPDFDoc_GetLoadedObjectValue",6),t._EPDFDoc_HasPieceInfoEntry=X("EPDFDoc_HasPieceInfoEntry",2),t._EPDFDoc_GetPieceInfoEntryCount=X("EPDFDoc_GetPieceInfoEntryCount",1),t._EPDFDoc_GetPieceInfoEntryAt=X("EPDFDoc_GetPieceInfoEntryAt",4),t._EPDFDoc_GetLastModified=X("EPDFDoc_GetLastModified",3),t._EPDFDoc_GetPieceInfoLastModified=X("EPDFDoc_GetPieceInfoLastModified",4),t._EPDFDoc_GetPieceInfoKeyCount=X("EPDFDoc_GetPieceInfoKeyCount",2),t._EPDFDoc_GetPieceInfoKeyAt=X("EPDFDoc_GetPieceInfoKeyAt",5),t._EPDFDoc_GetPieceInfoValueType=X("EPDFDoc_GetPieceInfoValueType",3),t._EPDFDoc_SetPieceInfoString=X("EPDFDoc_SetPieceInfoString",5),t._EPDFDoc_GetPieceInfoString=X("EPDFDoc_GetPieceInfoString",5),t._EPDFDoc_SetPieceInfoNumber=X("EPDFDoc_SetPieceInfoNumber",5),t._EPDFDoc_GetPieceInfoNumber=X("EPDFDoc_GetPieceInfoNumber",4),t._EPDFDoc_SetPieceInfoBoolean=X("EPDFDoc_SetPieceInfoBoolean",5),t._EPDFDoc_GetPieceInfoBoolean=X("EPDFDoc_GetPieceInfoBoolean",4),t._EPDFDoc_SetPieceInfoName=X("EPDFDoc_SetPieceInfoName",5),t._EPDFDoc_GetPieceInfoName=X("EPDFDoc_GetPieceInfoName",5),t._EPDFDoc_SetPieceInfoStringArray=X("EPDFDoc_SetPieceInfoStringArray",6),t._EPDFDoc_GetPieceInfoStringArrayCount=X("EPDFDoc_GetPieceInfoStringArrayCount",3),t._EPDFDoc_GetPieceInfoStringArrayAt=X("EPDFDoc_GetPieceInfoStringArrayAt",6),t._EPDFDoc_ClearPieceInfoKey=X("EPDFDoc_ClearPieceInfoKey",4),t._EPDFDoc_ClearPieceInfoEntry=X("EPDFDoc_ClearPieceInfoEntry",2),t._EPDFDoc_HasPagePieceInfoEntry=X("EPDFDoc_HasPagePieceInfoEntry",3),t._EPDFDoc_GetPagePieceInfoEntryCount=X("EPDFDoc_GetPagePieceInfoEntryCount",2),t._EPDFDoc_GetPagePieceInfoEntryAt=X("EPDFDoc_GetPagePieceInfoEntryAt",5),t._EPDFDoc_GetPageLastModified=X("EPDFDoc_GetPageLastModified",4),t._EPDFDoc_GetPagePieceInfoLastModified=X("EPDFDoc_GetPagePieceInfoLastModified",5),t._EPDFDoc_GetPagePieceInfoKeyCount=X("EPDFDoc_GetPagePieceInfoKeyCount",3),t._EPDFDoc_GetPagePieceInfoKeyAt=X("EPDFDoc_GetPagePieceInfoKeyAt",6),t._EPDFDoc_GetPagePieceInfoValueType=X("EPDFDoc_GetPagePieceInfoValueType",4),t._EPDFDoc_SetPagePieceInfoString=X("EPDFDoc_SetPagePieceInfoString",6),t._EPDFDoc_GetPagePieceInfoString=X("EPDFDoc_GetPagePieceInfoString",6),t._EPDFDoc_SetPagePieceInfoNumber=X("EPDFDoc_SetPagePieceInfoNumber",6),t._EPDFDoc_GetPagePieceInfoNumber=X("EPDFDoc_GetPagePieceInfoNumber",5),t._EPDFDoc_SetPagePieceInfoBoolean=X("EPDFDoc_SetPagePieceInfoBoolean",6),t._EPDFDoc_GetPagePieceInfoBoolean=X("EPDFDoc_GetPagePieceInfoBoolean",5),t._EPDFDoc_SetPagePieceInfoName=X("EPDFDoc_SetPagePieceInfoName",6),t._EPDFDoc_GetPagePieceInfoName=X("EPDFDoc_GetPagePieceInfoName",6),t._EPDFDoc_SetPagePieceInfoStringArray=X("EPDFDoc_SetPagePieceInfoStringArray",7),t._EPDFDoc_GetPagePieceInfoStringArrayCount=X("EPDFDoc_GetPagePieceInfoStringArrayCount",4),t._EPDFDoc_GetPagePieceInfoStringArrayAt=X("EPDFDoc_GetPagePieceInfoStringArrayAt",7),t._EPDFDoc_ClearPagePieceInfoKey=X("EPDFDoc_ClearPagePieceInfoKey",5),t._EPDFDoc_ClearPagePieceInfoEntry=X("EPDFDoc_ClearPagePieceInfoEntry",3),t._EPDFAnnot_GetMeasure=X("EPDFAnnot_GetMeasure",1),t._EPDFAnnot_AddMeasure=X("EPDFAnnot_AddMeasure",1),t._EPDFAnnot_RemoveMeasure=X("EPDFAnnot_RemoveMeasure",1),t._EPDFPage_CountViewports=X("EPDFPage_CountViewports",1),t._EPDFPage_GetViewport=X("EPDFPage_GetViewport",2),t._EPDFPage_AddViewport=X("EPDFPage_AddViewport",2),t._EPDFPage_RemoveViewport=X("EPDFPage_RemoveViewport",2),t._EPDFPage_CountViewportsRaw=X("EPDFPage_CountViewportsRaw",2),t._EPDFPage_GetViewportRaw=X("EPDFPage_GetViewportRaw",3),t._EPDFPage_AddViewportRaw=X("EPDFPage_AddViewportRaw",3),t._EPDFPage_RemoveViewportRaw=X("EPDFPage_RemoveViewportRaw",3),t._EPDFViewport_Close=X("EPDFViewport_Close",1),t._EPDFPage_FindViewport=X("EPDFPage_FindViewport",2),t._EPDFViewport_GetBBox=X("EPDFViewport_GetBBox",2),t._EPDFViewport_SetBBox=X("EPDFViewport_SetBBox",2),t._EPDFViewport_GetMeasure=X("EPDFViewport_GetMeasure",1),t._EPDFViewport_AddMeasure=X("EPDFViewport_AddMeasure",1),t._EPDFViewport_RemoveMeasure=X("EPDFViewport_RemoveMeasure",1),t._EPDFMeasure_GetSubtype=X("EPDFMeasure_GetSubtype",1),t._EPDFMeasure_GetOrigin=X("EPDFMeasure_GetOrigin",2),t._EPDFMeasure_SetOrigin=X("EPDFMeasure_SetOrigin",2),t._EPDFMeasure_GetCYX=X("EPDFMeasure_GetCYX",2),t._EPDFMeasure_SetCYX=X("EPDFMeasure_SetCYX",2),t._EPDFMeasure_CountFormats=X("EPDFMeasure_CountFormats",2),t._EPDFMeasure_GetFormat=X("EPDFMeasure_GetFormat",3),t._EPDFMeasure_AddFormat=X("EPDFMeasure_AddFormat",4),t._EPDFMeasure_RemoveFormats=X("EPDFMeasure_RemoveFormats",2),t._EPDFViewport_GetName=X("EPDFViewport_GetName",3),t._EPDFViewport_SetName=X("EPDFViewport_SetName",2),t._EPDFMeasure_GetRatio=X("EPDFMeasure_GetRatio",3),t._EPDFMeasure_SetRatio=X("EPDFMeasure_SetRatio",2),t._EPDFNumberFormat_GetUnit=X("EPDFNumberFormat_GetUnit",3),t._EPDFNumberFormat_SetUnit=X("EPDFNumberFormat_SetUnit",2),t._EPDFNumberFormat_GetConversion=X("EPDFNumberFormat_GetConversion",2),t._EPDFNumberFormat_SetConversion=X("EPDFNumberFormat_SetConversion",2),t._EPDFNumberFormat_GetPrecision=X("EPDFNumberFormat_GetPrecision",2),t._EPDFNumberFormat_SetPrecision=X("EPDFNumberFormat_SetPrecision",2),t._EPDFNumberFormat_GetFixedDenominator=X("EPDFNumberFormat_GetFixedDenominator",2),t._EPDFNumberFormat_SetFixedDenominator=X("EPDFNumberFormat_SetFixedDenominator",2),t._EPDFNumberFormat_GetText=X("EPDFNumberFormat_GetText",4),t._EPDFNumberFormat_SetText=X("EPDFNumberFormat_SetText",3),t._EPDFNumberFormat_GetFraction=X("EPDFNumberFormat_GetFraction",2),t._EPDFNumberFormat_SetFraction=X("EPDFNumberFormat_SetFraction",2),t._EPDFNumberFormat_GetLabelPosition=X("EPDFNumberFormat_GetLabelPosition",2),t._EPDFNumberFormat_SetLabelPosition=X("EPDFNumberFormat_SetLabelPosition",2),t._EPDFAnnot_SetLineLeader=X("EPDFAnnot_SetLineLeader",4),t._EPDFAnnot_GetLineLeader=X("EPDFAnnot_GetLineLeader",4),t._EPDFAnnot_SetLineCaption=X("EPDFAnnot_SetLineCaption",4),t._EPDFAnnot_GetLineCaption=X("EPDFAnnot_GetLineCaption",4),t._EPDFAnnot_SetShapeCaption=X("EPDFAnnot_SetShapeCaption",3),t._EPDFAnnot_GetShapeCaption=X("EPDFAnnot_GetShapeCaption",4),t._EPDFPage_GetParsedSize=X("EPDFPage_GetParsedSize",2),t._EPDFPage_IsContentCurrent=X("EPDFPage_IsContentCurrent",1),t._EPDF_PNG_EncodeRGBA=X("EPDF_PNG_EncodeRGBA",6),t._EPDFDoc_ImportPages=X("EPDFDoc_ImportPages",6),t._EPDFDoc_GetImportFieldRoots=X("EPDFDoc_GetImportFieldRoots",5),t._EPDFPage_ApplyRedactions=X("EPDFPage_ApplyRedactions",4),t._EPDF_InitThread=X("EPDF_InitThread",0),t._EPDF_ShutdownThread=X("EPDF_ShutdownThread",0),t._FPDFAnnot_IsSupportedSubtype=X("FPDFAnnot_IsSupportedSubtype",1),t._FPDFPage_CreateAnnot=X("FPDFPage_CreateAnnot",2),t._FPDFPage_GetAnnotCount=X("FPDFPage_GetAnnotCount",1),t._FPDFPage_GetAnnot=X("FPDFPage_GetAnnot",2),t._FPDFPage_GetAnnotIndex=X("FPDFPage_GetAnnotIndex",2),t._FPDFPage_CloseAnnot=X("FPDFPage_CloseAnnot",1),t._FPDFPage_RemoveAnnot=X("FPDFPage_RemoveAnnot",2),t._FPDFAnnot_GetSubtype=X("FPDFAnnot_GetSubtype",1),t._FPDFAnnot_IsObjectSupportedSubtype=X("FPDFAnnot_IsObjectSupportedSubtype",1),t._FPDFAnnot_UpdateObject=X("FPDFAnnot_UpdateObject",2),t._FPDFAnnot_AddInkStroke=X("FPDFAnnot_AddInkStroke",3),t._FPDFAnnot_RemoveInkList=X("FPDFAnnot_RemoveInkList",1),t._FPDFAnnot_AppendObject=X("FPDFAnnot_AppendObject",2),t._FPDFAnnot_GetObjectCount=X("FPDFAnnot_GetObjectCount",1),t._FPDFAnnot_GetObject=X("FPDFAnnot_GetObject",2),t._FPDFAnnot_RemoveObject=X("FPDFAnnot_RemoveObject",2),t._FPDFAnnot_SetColor=X("FPDFAnnot_SetColor",6),t._FPDFAnnot_GetColor=X("FPDFAnnot_GetColor",6),t._FPDFAnnot_HasAttachmentPoints=X("FPDFAnnot_HasAttachmentPoints",1),t._FPDFAnnot_SetAttachmentPoints=X("FPDFAnnot_SetAttachmentPoints",3),t._FPDFAnnot_AppendAttachmentPoints=X("FPDFAnnot_AppendAttachmentPoints",2),t._FPDFAnnot_CountAttachmentPoints=X("FPDFAnnot_CountAttachmentPoints",1),t._FPDFAnnot_GetAttachmentPoints=X("FPDFAnnot_GetAttachmentPoints",3),t._FPDFAnnot_SetRect=X("FPDFAnnot_SetRect",2),t._FPDFAnnot_GetRect=X("FPDFAnnot_GetRect",2),t._FPDFAnnot_GetVertices=X("FPDFAnnot_GetVertices",3),t._FPDFAnnot_GetInkListCount=X("FPDFAnnot_GetInkListCount",1),t._FPDFAnnot_GetInkListPath=X("FPDFAnnot_GetInkListPath",4),t._FPDFAnnot_GetLine=X("FPDFAnnot_GetLine",3),t._FPDFAnnot_SetBorder=X("FPDFAnnot_SetBorder",4),t._FPDFAnnot_GetBorder=X("FPDFAnnot_GetBorder",4),t._FPDFAnnot_HasKey=X("FPDFAnnot_HasKey",2),t._FPDFAnnot_GetValueType=X("FPDFAnnot_GetValueType",2),t._FPDFAnnot_SetStringValue=X("FPDFAnnot_SetStringValue",3),t._FPDFAnnot_GetStringValue=X("FPDFAnnot_GetStringValue",4),t._FPDFAnnot_GetNumberValue=X("FPDFAnnot_GetNumberValue",3),t._FPDFAnnot_SetAP=X("FPDFAnnot_SetAP",3),t._FPDFAnnot_GetAP=X("FPDFAnnot_GetAP",4),t._FPDFAnnot_GetLinkedAnnot=X("FPDFAnnot_GetLinkedAnnot",2),t._FPDFAnnot_GetFlags=X("FPDFAnnot_GetFlags",1),t._FPDFAnnot_SetFlags=X("FPDFAnnot_SetFlags",2),t._FPDFAnnot_GetFormFieldFlags=X("FPDFAnnot_GetFormFieldFlags",2),t._FPDFAnnot_SetFormFieldFlags=X("FPDFAnnot_SetFormFieldFlags",3),t._FPDFAnnot_GetFormFieldAtPoint=X("FPDFAnnot_GetFormFieldAtPoint",3),t._FPDFAnnot_GetFormFieldName=X("FPDFAnnot_GetFormFieldName",4),t._FPDFAnnot_GetFormFieldType=X("FPDFAnnot_GetFormFieldType",2),t._FPDFAnnot_GetFormAdditionalActionJavaScript=X("FPDFAnnot_GetFormAdditionalActionJavaScript",5),t._FPDFAnnot_GetFormFieldAlternateName=X("FPDFAnnot_GetFormFieldAlternateName",4),t._FPDFAnnot_GetFormFieldValue=X("FPDFAnnot_GetFormFieldValue",4),t._FPDFAnnot_GetOptionCount=X("FPDFAnnot_GetOptionCount",2),t._FPDFAnnot_GetOptionLabel=X("FPDFAnnot_GetOptionLabel",5),t._FPDFAnnot_IsOptionSelected=X("FPDFAnnot_IsOptionSelected",3),t._FPDFAnnot_GetFontSize=X("FPDFAnnot_GetFontSize",3),t._FPDFAnnot_SetFontColor=X("FPDFAnnot_SetFontColor",5),t._FPDFAnnot_GetFontColor=X("FPDFAnnot_GetFontColor",5),t._FPDFAnnot_IsChecked=X("FPDFAnnot_IsChecked",2),t._FPDFAnnot_SetFocusableSubtypes=X("FPDFAnnot_SetFocusableSubtypes",3),t._FPDFAnnot_GetFocusableSubtypesCount=X("FPDFAnnot_GetFocusableSubtypesCount",1),t._FPDFAnnot_GetFocusableSubtypes=X("FPDFAnnot_GetFocusableSubtypes",3),t._FPDFAnnot_GetLink=X("FPDFAnnot_GetLink",1),t._FPDFAnnot_GetFormControlCount=X("FPDFAnnot_GetFormControlCount",2),t._FPDFAnnot_GetFormControlIndex=X("FPDFAnnot_GetFormControlIndex",2),t._FPDFAnnot_GetFormFieldExportValue=X("FPDFAnnot_GetFormFieldExportValue",4),t._FPDFAnnot_SetURI=X("FPDFAnnot_SetURI",2),t._FPDFAnnot_GetFileAttachment=X("FPDFAnnot_GetFileAttachment",1),t._FPDFAnnot_AddFileAttachment=X("FPDFAnnot_AddFileAttachment",2),t._FPDFDoc_GetAttachmentCount=X("FPDFDoc_GetAttachmentCount",1),t._FPDFDoc_AddAttachment=X("FPDFDoc_AddAttachment",2),t._FPDFDoc_GetAttachment=X("FPDFDoc_GetAttachment",2),t._EPDFDoc_GetAttachmentKey=X("EPDFDoc_GetAttachmentKey",4),t._EPDFDoc_GetAttachmentIndexByKey=X("EPDFDoc_GetAttachmentIndexByKey",2),t._FPDFDoc_DeleteAttachment=X("FPDFDoc_DeleteAttachment",2),t._FPDFAttachment_GetName=X("FPDFAttachment_GetName",3),t._FPDFAttachment_HasKey=X("FPDFAttachment_HasKey",2),t._FPDFAttachment_GetValueType=X("FPDFAttachment_GetValueType",2),t._FPDFAttachment_SetStringValue=X("FPDFAttachment_SetStringValue",3),t._FPDFAttachment_GetStringValue=X("FPDFAttachment_GetStringValue",4),t._FPDFAttachment_SetDescription=X("FPDFAttachment_SetDescription",2),t._FPDFAttachment_GetDescription=X("FPDFAttachment_GetDescription",3),t._FPDFAttachment_SetFile=X("FPDFAttachment_SetFile",4),t._FPDFAttachment_GetFile=X("FPDFAttachment_GetFile",4),t._FPDFAttachment_GetSubtype=X("FPDFAttachment_GetSubtype",3),t._FPDFAttachment_GetAFRelationship=X("FPDFAttachment_GetAFRelationship",3),t._EPDFAttachment_SetSubtype=X("EPDFAttachment_SetSubtype",2),t._EPDFAttachment_SetDescription=X("EPDFAttachment_SetDescription",2),t._EPDFAttachment_SetName=X("EPDFAttachment_SetName",2),t._EPDFAttachment_GetDescription=X("EPDFAttachment_GetDescription",3),t._EPDFAttachment_GetIntegerValue=X("EPDFAttachment_GetIntegerValue",3),t._EPDFAttachment_ExtractFile=X("EPDFAttachment_ExtractFile",6),t._EPDFAttachment_ExtractFileToOwnedBuffer=X("EPDFAttachment_ExtractFileToOwnedBuffer",6),t._FPDFCatalog_IsTagged=X("FPDFCatalog_IsTagged",1),t._FPDFCatalog_GetLanguage=X("FPDFCatalog_GetLanguage",3),t._FPDFCatalog_SetLanguage=X("FPDFCatalog_SetLanguage",2),t._EPDFCatalog_GetLanguage=X("EPDFCatalog_GetLanguage",3),t._FPDFAvail_Create=X("FPDFAvail_Create",2),t._FPDFAvail_Destroy=X("FPDFAvail_Destroy",1),t._FPDFAvail_IsDocAvail=X("FPDFAvail_IsDocAvail",2),t._FPDFAvail_GetDocument=X("FPDFAvail_GetDocument",2),t._FPDFAvail_GetFirstPageNum=X("FPDFAvail_GetFirstPageNum",1),t._FPDFAvail_IsPageAvail=X("FPDFAvail_IsPageAvail",3),t._FPDFAvail_IsFormAvail=X("FPDFAvail_IsFormAvail",2),t._FPDFAvail_IsLinearized=X("FPDFAvail_IsLinearized",1),t._FPDFBookmark_GetFirstChild=X("FPDFBookmark_GetFirstChild",2),t._FPDFBookmark_GetNextSibling=X("FPDFBookmark_GetNextSibling",2),t._FPDFBookmark_GetTitle=X("FPDFBookmark_GetTitle",3),t._FPDFBookmark_GetCount=X("FPDFBookmark_GetCount",1),t._FPDFBookmark_Find=X("FPDFBookmark_Find",2),t._FPDFBookmark_GetDest=X("FPDFBookmark_GetDest",2),t._FPDFBookmark_GetAction=X("FPDFBookmark_GetAction",1),t._FPDFBookmark_GetColor=X("FPDFBookmark_GetColor",4),t._FPDFBookmark_GetStyle=X("FPDFBookmark_GetStyle",1),t._FPDFAction_GetType=X("FPDFAction_GetType",1),t._FPDFAction_GetDest=X("FPDFAction_GetDest",2),t._FPDFAction_GetFilePath=X("FPDFAction_GetFilePath",3),t._FPDFAction_GetURIPath=X("FPDFAction_GetURIPath",4),t._FPDFDest_GetDestPageIndex=X("FPDFDest_GetDestPageIndex",2),t._EPDFDest_GetPageObjectNumber=X("EPDFDest_GetPageObjectNumber",2),t._FPDFDest_GetView=X("FPDFDest_GetView",3),t._FPDFDest_GetLocationInPage=X("FPDFDest_GetLocationInPage",7),t._FPDFLink_GetLinkAtPoint=X("FPDFLink_GetLinkAtPoint",3),t._FPDFLink_GetLinkZOrderAtPoint=X("FPDFLink_GetLinkZOrderAtPoint",3),t._FPDFLink_GetDest=X("FPDFLink_GetDest",2),t._FPDFLink_GetAction=X("FPDFLink_GetAction",1),t._FPDFLink_Enumerate=X("FPDFLink_Enumerate",3),t._FPDFLink_GetAnnot=X("FPDFLink_GetAnnot",2),t._FPDFLink_GetAnnotRect=X("FPDFLink_GetAnnotRect",2),t._FPDFLink_CountQuadPoints=X("FPDFLink_CountQuadPoints",1),t._FPDFLink_GetQuadPoints=X("FPDFLink_GetQuadPoints",3),t._FPDF_GetPageAAction=X("FPDF_GetPageAAction",2),t._FPDF_GetFileIdentifier=X("FPDF_GetFileIdentifier",4),t._FPDF_GetMetaText=X("FPDF_GetMetaText",4),t._FPDF_GetPageLabel=X("FPDF_GetPageLabel",4),t._EPDF_SetMetaText=X("EPDF_SetMetaText",3),t._EPDF_HasMetaText=X("EPDF_HasMetaText",2),t._EPDF_GetMetaTrapped=X("EPDF_GetMetaTrapped",1),t._EPDF_SetMetaTrapped=X("EPDF_SetMetaTrapped",2),t._EPDF_GetMetaKeyCount=X("EPDF_GetMetaKeyCount",2),t._EPDF_GetMetaKeyName=X("EPDF_GetMetaKeyName",5),t._FPDFPageObj_NewImageObj=X("FPDFPageObj_NewImageObj",1),t._FPDFImageObj_LoadJpegFile=X("FPDFImageObj_LoadJpegFile",4),t._FPDFImageObj_LoadJpegFileInline=X("FPDFImageObj_LoadJpegFileInline",4),t._FPDFImageObj_SetMatrix=X("FPDFImageObj_SetMatrix",7),t._FPDFImageObj_SetBitmap=X("FPDFImageObj_SetBitmap",4),t._FPDFImageObj_GetBitmap=X("FPDFImageObj_GetBitmap",1),t._FPDFImageObj_GetRenderedBitmap=X("FPDFImageObj_GetRenderedBitmap",3),t._FPDFImageObj_GetImageDataDecoded=X("FPDFImageObj_GetImageDataDecoded",3),t._FPDFImageObj_GetImageDataRaw=X("FPDFImageObj_GetImageDataRaw",3),t._FPDFImageObj_GetImageFilterCount=X("FPDFImageObj_GetImageFilterCount",1),t._FPDFImageObj_GetImageFilter=X("FPDFImageObj_GetImageFilter",4),t._FPDFImageObj_GetImageMetadata=X("FPDFImageObj_GetImageMetadata",3),t._FPDFImageObj_GetImagePixelSize=X("FPDFImageObj_GetImagePixelSize",3),t._FPDFImageObj_GetIccProfileDataDecoded=X("FPDFImageObj_GetIccProfileDataDecoded",5),t._EPDFImageObj_SetPng=X("EPDFImageObj_SetPng",5),t._EPDFImageObj_SetJpeg=X("EPDFImageObj_SetJpeg",5),t._FPDF_CreateNewDocument=X("FPDF_CreateNewDocument",0),t._FPDFPage_Delete=X("FPDFPage_Delete",2),t._FPDF_MovePages=X("FPDF_MovePages",4),t._FPDFPage_New=X("FPDFPage_New",4),t._EPDFPage_InsertBlankRaw=X("EPDFPage_InsertBlankRaw",5),t._FPDFPage_GetRotation=X("FPDFPage_GetRotation",1),t._FPDFPage_InsertObject=X("FPDFPage_InsertObject",2),t._FPDFPage_InsertObjectAtIndex=X("FPDFPage_InsertObjectAtIndex",3),t._FPDFPage_RemoveObject=X("FPDFPage_RemoveObject",2),t._FPDFPage_CountObjects=X("FPDFPage_CountObjects",1),t._FPDFPage_GetObject=X("FPDFPage_GetObject",2),t._FPDFPage_HasTransparency=X("FPDFPage_HasTransparency",1),t._FPDFPageObj_Destroy=X("FPDFPageObj_Destroy",1),t._FPDFPageObj_GetMarkedContentID=X("FPDFPageObj_GetMarkedContentID",1),t._FPDFPageObj_CountMarks=X("FPDFPageObj_CountMarks",1),t._FPDFPageObj_GetMark=X("FPDFPageObj_GetMark",2),t._FPDFPageObj_AddExistingMark=X("FPDFPageObj_AddExistingMark",2),t._FPDFPageObj_AddMark=X("FPDFPageObj_AddMark",2),t._FPDFPageObj_RemoveMark=X("FPDFPageObj_RemoveMark",2),t._FPDFPageObjMark_GetName=X("FPDFPageObjMark_GetName",4),t._FPDFPageObjMark_CountParams=X("FPDFPageObjMark_CountParams",1),t._FPDFPageObjMark_GetParamKey=X("FPDFPageObjMark_GetParamKey",5),t._FPDFPageObjMark_GetParamValueType=X("FPDFPageObjMark_GetParamValueType",2),t._FPDFPageObjMark_GetParamIntValue=X("FPDFPageObjMark_GetParamIntValue",3),t._FPDFPageObjMark_GetParamFloatValue=X("FPDFPageObjMark_GetParamFloatValue",3),t._FPDFPageObjMark_GetParamStringValue=X("FPDFPageObjMark_GetParamStringValue",5),t._FPDFPageObjMark_GetParamBlobValue=X("FPDFPageObjMark_GetParamBlobValue",5),t._FPDFPageObj_HasTransparency=X("FPDFPageObj_HasTransparency",1),t._FPDFPageObjMark_SetIntParam=X("FPDFPageObjMark_SetIntParam",5),t._FPDFPageObjMark_SetFloatParam=X("FPDFPageObjMark_SetFloatParam",5),t._FPDFPageObjMark_SetStringParam=X("FPDFPageObjMark_SetStringParam",5),t._FPDFPageObjMark_SetBlobParam=X("FPDFPageObjMark_SetBlobParam",6),t._FPDFPageObjMark_RemoveParam=X("FPDFPageObjMark_RemoveParam",3),t._FPDFPageObj_GetType=X("FPDFPageObj_GetType",1),t._FPDFPageObj_GetIsActive=X("FPDFPageObj_GetIsActive",2),t._FPDFPageObj_SetIsActive=X("FPDFPageObj_SetIsActive",2),t._FPDFPage_GenerateContent=X("FPDFPage_GenerateContent",1),t._FPDFPageObj_Transform=X("FPDFPageObj_Transform",7),t._FPDFPageObj_TransformF=X("FPDFPageObj_TransformF",2),t._FPDFPageObj_GetMatrix=X("FPDFPageObj_GetMatrix",2),t._FPDFPageObj_SetMatrix=X("FPDFPageObj_SetMatrix",2),t._FPDFPageObj_SetBlendMode=X("FPDFPageObj_SetBlendMode",2),t._FPDFPage_TransformAnnots=X("FPDFPage_TransformAnnots",7),t._FPDFPage_SetRotation=X("FPDFPage_SetRotation",2),t._FPDFPageObj_SetFillColor=X("FPDFPageObj_SetFillColor",5),t._FPDFPageObj_GetFillColor=X("FPDFPageObj_GetFillColor",5),t._FPDFPageObj_GetBounds=X("FPDFPageObj_GetBounds",5),t._FPDFPageObj_GetRotatedBounds=X("FPDFPageObj_GetRotatedBounds",2),t._FPDFPageObj_SetStrokeColor=X("FPDFPageObj_SetStrokeColor",5),t._FPDFPageObj_GetStrokeColor=X("FPDFPageObj_GetStrokeColor",5),t._FPDFPageObj_SetStrokeWidth=X("FPDFPageObj_SetStrokeWidth",2),t._FPDFPageObj_GetStrokeWidth=X("FPDFPageObj_GetStrokeWidth",2),t._FPDFPageObj_GetLineJoin=X("FPDFPageObj_GetLineJoin",1),t._FPDFPageObj_SetLineJoin=X("FPDFPageObj_SetLineJoin",2),t._FPDFPageObj_GetLineCap=X("FPDFPageObj_GetLineCap",1),t._FPDFPageObj_SetLineCap=X("FPDFPageObj_SetLineCap",2),t._FPDFPageObj_GetDashPhase=X("FPDFPageObj_GetDashPhase",2),t._FPDFPageObj_SetDashPhase=X("FPDFPageObj_SetDashPhase",2),t._FPDFPageObj_GetDashCount=X("FPDFPageObj_GetDashCount",1),t._FPDFPageObj_GetDashArray=X("FPDFPageObj_GetDashArray",3),t._FPDFPageObj_SetDashArray=X("FPDFPageObj_SetDashArray",4),t._FPDFPageObj_GetRenderedStrokePattern=X("FPDFPageObj_GetRenderedStrokePattern",2),t._FPDFPageObj_GetRenderedFillPattern=X("FPDFPageObj_GetRenderedFillPattern",2),t._FPDFFormObj_CountObjects=X("FPDFFormObj_CountObjects",1),t._FPDFFormObj_GetObject=X("FPDFFormObj_GetObject",2),t._FPDFFormObj_RemoveObject=X("FPDFFormObj_RemoveObject",2),t._FPDFPageObj_CreateNewPath=X("FPDFPageObj_CreateNewPath",2),t._FPDFPageObj_CreateNewRect=X("FPDFPageObj_CreateNewRect",4),t._FPDFPath_CountSegments=X("FPDFPath_CountSegments",1),t._FPDFPath_GetPathSegment=X("FPDFPath_GetPathSegment",2),t._FPDFPath_MoveTo=X("FPDFPath_MoveTo",3),t._FPDFPath_LineTo=X("FPDFPath_LineTo",3),t._FPDFPath_BezierTo=X("FPDFPath_BezierTo",7),t._FPDFPath_GetBezierControlPoints=X("FPDFPath_GetBezierControlPoints",4),t._FPDFPath_Close=X("FPDFPath_Close",1),t._FPDFPath_SetDrawMode=X("FPDFPath_SetDrawMode",3),t._FPDFPath_GetDrawMode=X("FPDFPath_GetDrawMode",3),t._FPDFPathSegment_GetPoint=X("FPDFPathSegment_GetPoint",3),t._FPDFPathSegment_GetType=X("FPDFPathSegment_GetType",1),t._FPDFPathSegment_GetClose=X("FPDFPathSegment_GetClose",1),t._FPDFPageObj_NewTextObj=X("FPDFPageObj_NewTextObj",3),t._FPDFText_SetText=X("FPDFText_SetText",2),t._FPDFText_SetCharcodes=X("FPDFText_SetCharcodes",3),t._FPDFText_SetPositions=X("FPDFText_SetPositions",3),t._FPDFText_LoadFont=X("FPDFText_LoadFont",5),t._FPDFText_LoadStandardFont=X("FPDFText_LoadStandardFont",2),t._FPDFText_LoadCidType2Font=X("FPDFText_LoadCidType2Font",6),t._FPDFTextObj_GetFontSize=X("FPDFTextObj_GetFontSize",2),t._FPDFTextObj_SetFontSize=X("FPDFTextObj_SetFontSize",2),t._FPDFTextObj_GetText=X("FPDFTextObj_GetText",4),t._FPDFTextObj_GetRenderedBitmap=X("FPDFTextObj_GetRenderedBitmap",4),t._FPDFFont_Close=X("FPDFFont_Close",1),t._FPDFPageObj_CreateTextObj=X("FPDFPageObj_CreateTextObj",3),t._FPDFTextObj_GetTextRenderMode=X("FPDFTextObj_GetTextRenderMode",1),t._FPDFTextObj_SetTextRenderMode=X("FPDFTextObj_SetTextRenderMode",2),t._FPDFTextObj_GetFont=X("FPDFTextObj_GetFont",1),t._FPDFFont_GetBaseFontName=X("FPDFFont_GetBaseFontName",3),t._FPDFFont_GetFamilyName=X("FPDFFont_GetFamilyName",3),t._FPDFFont_GetFontData=X("FPDFFont_GetFontData",4),t._FPDFFont_GetIsEmbedded=X("FPDFFont_GetIsEmbedded",1),t._FPDFFont_GetFlags=X("FPDFFont_GetFlags",1),t._FPDFFont_GetWeight=X("FPDFFont_GetWeight",1),t._FPDFFont_GetItalicAngle=X("FPDFFont_GetItalicAngle",2),t._FPDFFont_GetAscent=X("FPDFFont_GetAscent",3),t._FPDFFont_GetDescent=X("FPDFFont_GetDescent",3),t._FPDFFont_GetGlyphWidth=X("FPDFFont_GetGlyphWidth",4),t._FPDFFont_GetGlyphPath=X("FPDFFont_GetGlyphPath",3),t._FPDFGlyphPath_CountGlyphSegments=X("FPDFGlyphPath_CountGlyphSegments",1),t._FPDFGlyphPath_GetGlyphPathSegment=X("FPDFGlyphPath_GetGlyphPathSegment",2),t._EPDFText_RedactInRect=X("EPDFText_RedactInRect",4),t._EPDFText_RedactInQuads=X("EPDFText_RedactInQuads",5),t._FPDFDoc_GetPageMode=X("FPDFDoc_GetPageMode",1),t._FPDFPage_Flatten=X("FPDFPage_Flatten",2),t._FPDFPage_HasFormFieldAtPoint=X("FPDFPage_HasFormFieldAtPoint",4),t._FPDFPage_FormFieldZOrderAtPoint=X("FPDFPage_FormFieldZOrderAtPoint",4),t._FPDFDOC_InitFormFillEnvironment=X("FPDFDOC_InitFormFillEnvironment",2),t._FPDFDOC_ExitFormFillEnvironment=X("FPDFDOC_ExitFormFillEnvironment",1),t._FORM_OnMouseMove=X("FORM_OnMouseMove",5),t._FORM_OnMouseWheel=X("FORM_OnMouseWheel",6),t._FORM_OnFocus=X("FORM_OnFocus",5),t._FORM_OnLButtonDown=X("FORM_OnLButtonDown",5),t._FORM_OnLButtonUp=X("FORM_OnLButtonUp",5),t._FORM_OnLButtonDoubleClick=X("FORM_OnLButtonDoubleClick",5),t._FORM_OnRButtonDown=X("FORM_OnRButtonDown",5),t._FORM_OnRButtonUp=X("FORM_OnRButtonUp",5),t._FORM_OnKeyDown=X("FORM_OnKeyDown",4),t._FORM_OnKeyUp=X("FORM_OnKeyUp",4),t._FORM_OnChar=X("FORM_OnChar",4),t._FORM_GetFocusedText=X("FORM_GetFocusedText",4),t._FORM_GetSelectedText=X("FORM_GetSelectedText",4),t._FORM_ReplaceAndKeepSelection=X("FORM_ReplaceAndKeepSelection",3),t._FORM_ReplaceSelection=X("FORM_ReplaceSelection",3),t._FORM_SelectAllText=X("FORM_SelectAllText",2),t._FORM_CanUndo=X("FORM_CanUndo",2),t._FORM_CanRedo=X("FORM_CanRedo",2),t._FORM_Undo=X("FORM_Undo",2),t._FORM_Redo=X("FORM_Redo",2),t._FORM_ForceToKillFocus=X("FORM_ForceToKillFocus",1),t._FORM_GetFocusedAnnot=X("FORM_GetFocusedAnnot",3),t._FORM_SetFocusedAnnot=X("FORM_SetFocusedAnnot",2),t._FPDF_FFLDraw=X("FPDF_FFLDraw",9),t._FPDF_SetFormFieldHighlightColor=X("FPDF_SetFormFieldHighlightColor",3),t._FPDF_SetFormFieldHighlightAlpha=X("FPDF_SetFormFieldHighlightAlpha",2),t._FPDF_RemoveFormFieldHighlight=X("FPDF_RemoveFormFieldHighlight",1),t._FORM_OnAfterLoadPage=X("FORM_OnAfterLoadPage",2),t._FORM_OnBeforeClosePage=X("FORM_OnBeforeClosePage",2),t._FORM_DoDocumentJSAction=X("FORM_DoDocumentJSAction",1),t._FORM_DoDocumentOpenAction=X("FORM_DoDocumentOpenAction",1),t._FORM_DoDocumentAAction=X("FORM_DoDocumentAAction",2),t._FORM_DoPageAAction=X("FORM_DoPageAAction",3),t._FORM_SetIndexSelected=X("FORM_SetIndexSelected",4),t._FORM_IsIndexSelected=X("FORM_IsIndexSelected",3),t._FORM_GetTextDirection=X("FORM_GetTextDirection",2),t._FORM_SetTextDirection=X("FORM_SetTextDirection",3),t._FPDFDoc_GetJavaScriptActionCount=X("FPDFDoc_GetJavaScriptActionCount",1),t._FPDFDoc_GetJavaScriptAction=X("FPDFDoc_GetJavaScriptAction",2),t._EPDFDoc_GetNamedJavaScriptActionModel=X("EPDFDoc_GetNamedJavaScriptActionModel",2),t._FPDFDoc_CloseJavaScriptAction=X("FPDFDoc_CloseJavaScriptAction",1),t._FPDFJavaScriptAction_GetName=X("FPDFJavaScriptAction_GetName",3),t._FPDFJavaScriptAction_GetScript=X("FPDFJavaScriptAction_GetScript",3),t._FPDF_ImportPagesByIndex=X("FPDF_ImportPagesByIndex",5),t._FPDF_ImportPages=X("FPDF_ImportPages",4),t._FPDF_ImportNPagesToOne=X("FPDF_ImportNPagesToOne",5),t._FPDF_NewXObjectFromPage=X("FPDF_NewXObjectFromPage",3),t._FPDF_CloseXObject=X("FPDF_CloseXObject",1),t._FPDF_NewFormObjectFromXObject=X("FPDF_NewFormObjectFromXObject",1),t._FPDF_CopyViewerPreferences=X("FPDF_CopyViewerPreferences",2),t._FPDF_RenderPageBitmapWithColorScheme_Start=X("FPDF_RenderPageBitmapWithColorScheme_Start",10),t._FPDF_RenderPageBitmap_Start=X("FPDF_RenderPageBitmap_Start",9),t._FPDF_RenderPage_Continue=X("FPDF_RenderPage_Continue",2),t._FPDF_RenderPage_Close=X("FPDF_RenderPage_Close",1),t._EPDF_RenderPageBitmapWithMatrix_Start=X("EPDF_RenderPageBitmapWithMatrix_Start",6),t._EPDF_RenderPage_Continue=X("EPDF_RenderPage_Continue",2),t._EPDF_FreeBuffer=X("EPDF_FreeBuffer",1),t._FPDF_SaveAsCopy=X("FPDF_SaveAsCopy",3),t._FPDF_SaveWithVersion=X("FPDF_SaveWithVersion",4),t._EPDF_SaveDocumentToOwnedBuffer=X("EPDF_SaveDocumentToOwnedBuffer",3),t._EPDF_SaveDocumentToOwnedBufferWithVersion=X("EPDF_SaveDocumentToOwnedBufferWithVersion",4),t._EPDF_SaveDocumentToOwnedBufferEx=X("EPDF_SaveDocumentToOwnedBufferEx",5),t._EPDF_SaveAsCopyEx=X("EPDF_SaveAsCopyEx",4),t._FPDFText_GetCharIndexFromTextIndex=X("FPDFText_GetCharIndexFromTextIndex",2),t._FPDFText_GetTextIndexFromCharIndex=X("FPDFText_GetTextIndexFromCharIndex",2),t._FPDF_GetSignatureCount=X("FPDF_GetSignatureCount",1),t._FPDF_GetSignatureObject=X("FPDF_GetSignatureObject",2),t._FPDFSignatureObj_GetContents=X("FPDFSignatureObj_GetContents",3),t._FPDFSignatureObj_GetByteRange=X("FPDFSignatureObj_GetByteRange",3),t._FPDFSignatureObj_GetSubFilter=X("FPDFSignatureObj_GetSubFilter",3),t._FPDFSignatureObj_GetReason=X("FPDFSignatureObj_GetReason",3),t._FPDFSignatureObj_GetTime=X("FPDFSignatureObj_GetTime",3),t._FPDFSignatureObj_GetDocMDPPermission=X("FPDFSignatureObj_GetDocMDPPermission",1),t._FPDF_StructTree_GetForPage=X("FPDF_StructTree_GetForPage",1),t._FPDF_StructTree_Close=X("FPDF_StructTree_Close",1),t._FPDF_StructTree_CountChildren=X("FPDF_StructTree_CountChildren",1),t._FPDF_StructTree_GetChildAtIndex=X("FPDF_StructTree_GetChildAtIndex",2),t._FPDF_StructElement_GetAltText=X("FPDF_StructElement_GetAltText",3),t._FPDF_StructElement_GetActualText=X("FPDF_StructElement_GetActualText",3),t._FPDF_StructElement_GetExpansion=X("FPDF_StructElement_GetExpansion",3),t._FPDF_StructElement_GetID=X("FPDF_StructElement_GetID",3),t._FPDF_StructElement_GetLang=X("FPDF_StructElement_GetLang",3),t._FPDF_StructElement_GetAttributeCount=X("FPDF_StructElement_GetAttributeCount",1),t._FPDF_StructElement_GetAttributeAtIndex=X("FPDF_StructElement_GetAttributeAtIndex",2),t._FPDF_StructElement_GetStringAttribute=X("FPDF_StructElement_GetStringAttribute",4),t._FPDF_StructElement_GetMarkedContentID=X("FPDF_StructElement_GetMarkedContentID",1),t._FPDF_StructElement_GetRawType=X("FPDF_StructElement_GetRawType",3),t._FPDF_StructElement_GetType=X("FPDF_StructElement_GetType",3),t._FPDF_StructElement_GetObjType=X("FPDF_StructElement_GetObjType",3),t._FPDF_StructElement_GetTitle=X("FPDF_StructElement_GetTitle",3),t._FPDF_StructElement_CountChildren=X("FPDF_StructElement_CountChildren",1),t._FPDF_StructElement_GetChildAtIndex=X("FPDF_StructElement_GetChildAtIndex",2),t._FPDF_StructElement_GetChildMarkedContentID=X("FPDF_StructElement_GetChildMarkedContentID",2),t._FPDF_StructElement_GetParent=X("FPDF_StructElement_GetParent",1),t._FPDF_StructElement_Attr_GetCount=X("FPDF_StructElement_Attr_GetCount",1),t._FPDF_StructElement_Attr_GetName=X("FPDF_StructElement_Attr_GetName",5),t._FPDF_StructElement_Attr_GetValue=X("FPDF_StructElement_Attr_GetValue",2),t._FPDF_StructElement_Attr_GetType=X("FPDF_StructElement_Attr_GetType",1),t._FPDF_StructElement_Attr_GetBooleanValue=X("FPDF_StructElement_Attr_GetBooleanValue",2),t._FPDF_StructElement_Attr_GetNumberValue=X("FPDF_StructElement_Attr_GetNumberValue",2),t._FPDF_StructElement_Attr_GetStringValue=X("FPDF_StructElement_Attr_GetStringValue",4),t._FPDF_StructElement_Attr_GetBlobValue=X("FPDF_StructElement_Attr_GetBlobValue",4),t._FPDF_StructElement_Attr_CountChildren=X("FPDF_StructElement_Attr_CountChildren",1),t._FPDF_StructElement_Attr_GetChildAtIndex=X("FPDF_StructElement_Attr_GetChildAtIndex",2),t._FPDF_StructElement_GetMarkedContentIdCount=X("FPDF_StructElement_GetMarkedContentIdCount",1),t._FPDF_StructElement_GetMarkedContentIdAtIndex=X("FPDF_StructElement_GetMarkedContentIdAtIndex",2),t._FPDF_AddInstalledFont=X("FPDF_AddInstalledFont",3),t._FPDF_SetSystemFontInfo=X("FPDF_SetSystemFontInfo",1),t._FPDF_GetDefaultTTFMap=X("FPDF_GetDefaultTTFMap",0),t._FPDF_GetDefaultTTFMapCount=X("FPDF_GetDefaultTTFMapCount",0),t._FPDF_GetDefaultTTFMapEntry=X("FPDF_GetDefaultTTFMapEntry",1),t._FPDF_GetDefaultSystemFontInfo=X("FPDF_GetDefaultSystemFontInfo",0),t._FPDF_FreeDefaultSystemFontInfo=X("FPDF_FreeDefaultSystemFontInfo",1),t._FPDFText_LoadPage=X("FPDFText_LoadPage",1),t._FPDFText_ClosePage=X("FPDFText_ClosePage",1),t._FPDFText_CountChars=X("FPDFText_CountChars",1),t._FPDFText_GetUnicode=X("FPDFText_GetUnicode",2),t._FPDFText_GetTextObject=X("FPDFText_GetTextObject",2),t._FPDFText_IsGenerated=X("FPDFText_IsGenerated",2),t._FPDFText_IsHyphen=X("FPDFText_IsHyphen",2),t._FPDFText_HasUnicodeMapError=X("FPDFText_HasUnicodeMapError",2),t._FPDFText_GetFontSize=X("FPDFText_GetFontSize",2),t._FPDFText_GetFontInfo=X("FPDFText_GetFontInfo",5),t._FPDFText_GetFontWeight=X("FPDFText_GetFontWeight",2),t._FPDFText_GetFillColor=X("FPDFText_GetFillColor",6),t._FPDFText_GetStrokeColor=X("FPDFText_GetStrokeColor",6),t._FPDFText_GetCharAngle=X("FPDFText_GetCharAngle",2),t._FPDFText_GetCharBox=X("FPDFText_GetCharBox",6),t._FPDFText_GetLooseCharBox=X("FPDFText_GetLooseCharBox",3),t._EPDFText_GetCharGeometry=X("EPDFText_GetCharGeometry",3),t._EPDFText_GetPageGeometry=X("EPDFText_GetPageGeometry",4),t._EPDFText_GetTextFull=X("EPDFText_GetTextFull",3),t._EPDFText_GetCharToTextMap=X("EPDFText_GetCharToTextMap",3),t._FPDFText_GetMatrix=X("FPDFText_GetMatrix",3),t._FPDFText_GetCharOrigin=X("FPDFText_GetCharOrigin",4),t._FPDFText_GetCharIndexAtPos=X("FPDFText_GetCharIndexAtPos",5),t._FPDFText_GetText=X("FPDFText_GetText",4),t._FPDFText_CountRects=X("FPDFText_CountRects",3),t._FPDFText_GetRect=X("FPDFText_GetRect",6),t._FPDFText_GetBoundedText=X("FPDFText_GetBoundedText",7),t._FPDFText_FindStart=X("FPDFText_FindStart",4),t._FPDFText_FindNext=X("FPDFText_FindNext",1),t._FPDFText_FindPrev=X("FPDFText_FindPrev",1),t._FPDFText_GetSchResultIndex=X("FPDFText_GetSchResultIndex",1),t._FPDFText_GetSchCount=X("FPDFText_GetSchCount",1),t._FPDFText_FindClose=X("FPDFText_FindClose",1),t._FPDFLink_LoadWebLinks=X("FPDFLink_LoadWebLinks",1),t._FPDFLink_CountWebLinks=X("FPDFLink_CountWebLinks",1),t._FPDFLink_GetURL=X("FPDFLink_GetURL",4),t._FPDFLink_CountRects=X("FPDFLink_CountRects",2),t._FPDFLink_GetRect=X("FPDFLink_GetRect",7),t._FPDFLink_GetTextRange=X("FPDFLink_GetTextRange",4),t._FPDFLink_CloseWebLinks=X("FPDFLink_CloseWebLinks",1),t._FPDFPage_GetDecodedThumbnailData=X("FPDFPage_GetDecodedThumbnailData",3),t._FPDFPage_GetRawThumbnailData=X("FPDFPage_GetRawThumbnailData",3),t._FPDFPage_GetThumbnailAsBitmap=X("FPDFPage_GetThumbnailAsBitmap",1),t._FPDFPage_SetMediaBox=X("FPDFPage_SetMediaBox",5),t._FPDFPage_SetCropBox=X("FPDFPage_SetCropBox",5),t._FPDFPage_SetBleedBox=X("FPDFPage_SetBleedBox",5),t._FPDFPage_SetTrimBox=X("FPDFPage_SetTrimBox",5),t._FPDFPage_SetArtBox=X("FPDFPage_SetArtBox",5),t._FPDFPage_GetMediaBox=X("FPDFPage_GetMediaBox",5),t._FPDFPage_GetCropBox=X("FPDFPage_GetCropBox",5),t._FPDFPage_GetBleedBox=X("FPDFPage_GetBleedBox",5),t._FPDFPage_GetTrimBox=X("FPDFPage_GetTrimBox",5),t._FPDFPage_GetArtBox=X("FPDFPage_GetArtBox",5),t._FPDFPage_TransFormWithClip=X("FPDFPage_TransFormWithClip",3),t._FPDFPageObj_TransformClipPath=X("FPDFPageObj_TransformClipPath",7),t._FPDFPageObj_GetClipPath=X("FPDFPageObj_GetClipPath",1),t._FPDFClipPath_CountPaths=X("FPDFClipPath_CountPaths",1),t._FPDFClipPath_CountPathSegments=X("FPDFClipPath_CountPathSegments",2),t._FPDFClipPath_GetPathSegment=X("FPDFClipPath_GetPathSegment",3),t._FPDF_CreateClipPath=X("FPDF_CreateClipPath",4),t._FPDF_DestroyClipPath=X("FPDF_DestroyClipPath",1),t._FPDFPage_InsertClipPath=X("FPDFPage_InsertClipPath",2),t._FPDF_InitLibrary=X("FPDF_InitLibrary",0),t._FPDF_InitLibraryWithConfig=X("FPDF_InitLibraryWithConfig",1),t._FPDF_DestroyLibrary=X("FPDF_DestroyLibrary",0),t._FPDF_SetSandBoxPolicy=X("FPDF_SetSandBoxPolicy",2),t._FPDF_LoadDocument=X("FPDF_LoadDocument",2),t._FPDF_GetFormType=X("FPDF_GetFormType",1),t._FPDF_LoadXFA=X("FPDF_LoadXFA",1),t._FPDF_LoadMemDocument=X("FPDF_LoadMemDocument",3),t._FPDF_LoadMemDocument64=X("FPDF_LoadMemDocument64",3),t._FPDF_LoadCustomDocument=X("FPDF_LoadCustomDocument",2),t._FPDF_GetFileVersion=X("FPDF_GetFileVersion",2),t._FPDF_DocumentHasValidCrossReferenceTable=X("FPDF_DocumentHasValidCrossReferenceTable",1),t._FPDF_GetDocPermissions=X("FPDF_GetDocPermissions",1),t._FPDF_GetDocUserPermissions=X("FPDF_GetDocUserPermissions",1),t._FPDF_GetSecurityHandlerRevision=X("FPDF_GetSecurityHandlerRevision",1),t._EPDF_SetEncryption=X("EPDF_SetEncryption",4),t._EPDF_RemoveEncryption=X("EPDF_RemoveEncryption",1),t._EPDF_UnlockOwnerPermissions=X("EPDF_UnlockOwnerPermissions",2),t._EPDF_CheckPasswordPermissions=X("EPDF_CheckPasswordPermissions",6),t._EPDF_SetRuntimeOwnerPermissions=X("EPDF_SetRuntimeOwnerPermissions",2),t._EPDF_IsEncrypted=X("EPDF_IsEncrypted",1),t._EPDF_IsOwnerUnlocked=X("EPDF_IsOwnerUnlocked",1),t._FPDF_GetPageCount=X("FPDF_GetPageCount",1),t._FPDF_LoadPage=X("FPDF_LoadPage",2),t._EPDFDoc_LoadPageByObjectNumber=X("EPDFDoc_LoadPageByObjectNumber",2),t._EPDFDoc_LoadPageByObjectNumberNormalized=X("EPDFDoc_LoadPageByObjectNumberNormalized",2),t._EPDFDoc_GetPageObjectNumberByIndex=X("EPDFDoc_GetPageObjectNumberByIndex",2),t._EPDFDoc_DeletePageByObjectNumber=X("EPDFDoc_DeletePageByObjectNumber",2),t._EPDFDoc_SetPageRotationByObjectNumber=X("EPDFDoc_SetPageRotationByObjectNumber",3),t._EPDFDoc_StartLoadPageByObjectNumber=X("EPDFDoc_StartLoadPageByObjectNumber",3),t._EPDFPage_ContinueLoad=X("EPDFPage_ContinueLoad",2),t._EPDFPage_GetObjectNumber=X("EPDFPage_GetObjectNumber",1),t._FPDF_GetPageWidthF=X("FPDF_GetPageWidthF",1),t._FPDF_GetPageWidth=X("FPDF_GetPageWidth",1),t._FPDF_GetPageHeightF=X("FPDF_GetPageHeightF",1),t._FPDF_GetPageHeight=X("FPDF_GetPageHeight",1),t._FPDF_GetPageBoundingBox=X("FPDF_GetPageBoundingBox",2),t._FPDF_RenderPageBitmap=X("FPDF_RenderPageBitmap",8),t._FPDF_RenderPageBitmapWithMatrix=X("FPDF_RenderPageBitmapWithMatrix",5),t._EPDF_RenderAnnotBitmap=X("EPDF_RenderAnnotBitmap",7),t._EPDF_RenderAnnotBitmapUnrotated=X("EPDF_RenderAnnotBitmapUnrotated",9),t._EPDF_SetDecodedImageBudget=X("EPDF_SetDecodedImageBudget",1),t._EPDF_GetDecodedImageBytes=X("EPDF_GetDecodedImageBytes",0),t._EPDFPage_ResetRenderCache=X("EPDFPage_ResetRenderCache",1),t._FPDF_ClosePage=X("FPDF_ClosePage",1),t._FPDF_CloseDocument=X("FPDF_CloseDocument",1),t._FPDF_GetLastError=X("FPDF_GetLastError",0),t._FPDF_DeviceToPage=X("FPDF_DeviceToPage",10),t._FPDF_PageToDevice=X("FPDF_PageToDevice",10),t._FPDFBitmap_Create=X("FPDFBitmap_Create",3),t._FPDFBitmap_CreateEx=X("FPDFBitmap_CreateEx",5),t._FPDFBitmap_GetFormat=X("FPDFBitmap_GetFormat",1),t._FPDFBitmap_FillRect=X("FPDFBitmap_FillRect",6),t._FPDFBitmap_GetBuffer=X("FPDFBitmap_GetBuffer",1),t._FPDFBitmap_GetWidth=X("FPDFBitmap_GetWidth",1),t._FPDFBitmap_GetHeight=X("FPDFBitmap_GetHeight",1),t._FPDFBitmap_GetStride=X("FPDFBitmap_GetStride",1),t._FPDFBitmap_Destroy=X("FPDFBitmap_Destroy",1),t._FPDF_GetPageSizeByIndexF=X("FPDF_GetPageSizeByIndexF",3),t._EPDF_GetPageRotateByIndex=X("EPDF_GetPageRotateByIndex",3),t._EPDF_GetPageTabOrderByIndex=X("EPDF_GetPageTabOrderByIndex",4),t._EPDF_GetPageBoxByIndex=X("EPDF_GetPageBoxByIndex",4),t._EPDF_GetPageUserUnitByIndex=X("EPDF_GetPageUserUnitByIndex",3),t._EPDF_LoadPageNormalized=X("EPDF_LoadPageNormalized",3),t._FPDF_GetPageSizeByIndex=X("FPDF_GetPageSizeByIndex",4),t._FPDF_VIEWERREF_GetPrintScaling=X("FPDF_VIEWERREF_GetPrintScaling",1),t._FPDF_VIEWERREF_GetNumCopies=X("FPDF_VIEWERREF_GetNumCopies",1),t._FPDF_VIEWERREF_GetPrintPageRange=X("FPDF_VIEWERREF_GetPrintPageRange",1),t._FPDF_VIEWERREF_GetPrintPageRangeCount=X("FPDF_VIEWERREF_GetPrintPageRangeCount",1),t._FPDF_VIEWERREF_GetPrintPageRangeElement=X("FPDF_VIEWERREF_GetPrintPageRangeElement",2),t._FPDF_VIEWERREF_GetDuplex=X("FPDF_VIEWERREF_GetDuplex",1),t._FPDF_VIEWERREF_GetName=X("FPDF_VIEWERREF_GetName",4),t._FPDF_CountNamedDests=X("FPDF_CountNamedDests",1),t._FPDF_GetNamedDestByName=X("FPDF_GetNamedDestByName",2),t._FPDF_GetNamedDest=X("FPDF_GetNamedDest",4),t._FPDF_GetXFAPacketCount=X("FPDF_GetXFAPacketCount",1),t._FPDF_GetXFAPacketName=X("FPDF_GetXFAPacketName",4),t._FPDF_GetXFAPacketContent=X("FPDF_GetXFAPacketContent",5),t._FPDF_GetTrailerEnds=X("FPDF_GetTrailerEnds",3);var eJ=X("fflush",1),eQ=X("strerror",1),eX=X("emscripten_builtin_memalign",2);t._malloc=X("malloc",1),t._free=X("free",1);var eY=X("setThrew",2);X("_emscripten_tempret_set",1);var e0=()=>(e0=eZ.emscripten_stack_init)(),e1=()=>(e1=eZ.emscripten_stack_get_end)(),e3=e=>(e3=eZ._emscripten_stack_restore)(e),e2=e=>(e2=eZ._emscripten_stack_alloc)(e),e6=()=>(e6=eZ.emscripten_stack_get_current)();function e5(){var e,r;if(!(U>0)){if(e0(),M((3&(e=e1()))==0),0==e&&(e+=4),f[e>>>2>>>0]=0x2135467,f[e+4>>>2>>>0]=0x89bacdfe,f[0]=0x63736d65,t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)r=t.preRun.shift(),B.unshift(r);eu(B),U>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>t.setStatus(""),1),i()},1)):i(),T())}function i(){if(!D&&(D=!0,t.calledRun=!0,!j)){if(M(!z),z=!0,T(),t.noFSInit||eN.initialized||eN.init(),eN.ignorePermissions=!1,ev.init(),eu(L),n(t),t.onRuntimeInitialized?.(),M(!t._main,\'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]\'),T(),t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;){var e;e=t.postRun.shift(),$.unshift(e)}eu($)}}}if(t.dynCall_jiji=X("dynCall_jiji",5),t.dynCall_iiiiij=X("dynCall_iiiiij",7),t.dynCall_iiiiijj=X("dynCall_iiiiijj",9),t.dynCall_iiiiiijj=X("dynCall_iiiiiijj",10),t.dynCall_viijii=X("dynCall_viijii",7),t.dynCall_ji=X("dynCall_ji",2),t.dynCall_iiij=X("dynCall_iiij",5),t.dynCall_j=X("dynCall_j",1),t.dynCall_iji=X("dynCall_iji",4),t.dynCall_jji=X("dynCall_jji",4),t.dynCall_iiji=X("dynCall_iiji",5),t.dynCall_viijj=X("dynCall_viijj",7),t.dynCall_jij=X("dynCall_jij",4),t.dynCall_iij=X("dynCall_iij",4),t.dynCall_viji=X("dynCall_viji",5),t.wasmExports=eZ,t.ccall=eH,t.cwrap=(e,t,n,r)=>(...i)=>eH(e,t,n,i,r),t.addFunction=(e,t)=>{M(void 0!==e);var n=(e=>{if(!P){P=new WeakMap;var t=_.length;if(P)for(var n=0;n<0+t;n++){var r=ez(n);r&&P.set(r,n)}}return P.get(e)||0})(e);if(n)return n;var r=(()=>{if(eW.length)return eW.pop();try{_.grow(1)}catch(e){if(!(e instanceof RangeError))throw e;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return _.length-1})();try{eq(r,e)}catch(n){if(!(n instanceof TypeError))throw n;M(void 0!==t,"Missing signature argument to addFunction: "+e),eq(r,((e,t)=>{if(M(!t.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled"),"function"==typeof WebAssembly.Function)return new WebAssembly.Function((e=>{M(!e.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled");for(var t={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},n={parameters:[],results:"v"==e[0]?[]:[t[e[0]]]},r=1;r{P.delete(ez(e)),eq(e,null),eW.push(e)},t.setValue=function(e,t,n="i8"){switch(n.endsWith("*")&&(n="*"),n){case"i1":case"i8":s[e>>>0]=t;break;case"i16":u[e>>>1>>>0]=t;break;case"i32":c[e>>>2>>>0]=t;break;case"i64":J("to do setValue(i64) use WASM_BIGINT");case"float":m[e>>>2>>>0]=t;break;case"double":p[e>>>3>>>0]=t;break;case"*":f[e>>>2>>>0]=t;break;default:J(`invalid type for setValue: ${n}`)}},t.getValue=function(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return s[e>>>0];case"i16":return u[e>>>1>>>0];case"i32":return c[e>>>2>>>0];case"i64":J("to do getValue(i64) use WASM_BIGINT");case"float":return m[e>>>2>>>0];case"double":return p[e>>>3>>>0];case"*":return f[e>>>2>>>0];default:J(`invalid type for getValue: ${t}`)}},t.UTF8ToString=eg,t.stringToUTF8=ej,t.UTF16ToString=(e,t)=>{M(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var n=e,r=n>>1,i=r+t/2;!(r>=i)&&d[r>>>0];)++r;if((n=r<<1)-e>32&&eU)return eU.decode(l.subarray(e>>>0,n>>>0));for(var o="",a=0;!(a>=t/2);++a){var s=u[e+2*a>>>1>>>0];if(0==s)break;o+=String.fromCharCode(s)}return o},t.stringToUTF16=(e,t,n)=>{if(M(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),M("number"==typeof n,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),n??(n=0x7fffffff),n<2)return 0;for(var r=t,i=(n-=2)<2*e.length?n/2:e.length,o=0;o>>1>>>0]=a,t+=2}return u[t>>>1>>>0]=0,t-r},["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertU32PairToI53","getTempRet0","setTempRet0","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","readEmAsmArgs","jstoi_q","listenOnce","autoResumeAudioContext","dynCallLegacy","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","checkWasiClock","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","safeSetTimeout","setImmediateWrapped","safeRequestAnimationFrame","clearImmediateWrapped","polyfillSetImmediate","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","ExceptionInfo","findMatchingCatch","Browser_asyncPrepareDataCounter","arraySum","addDays","getSocketFromFD","getSocketAddress","FS_unlink","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace"].forEach(function(e){eo(e,()=>{var t=`\\`${e}\\` 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=e;n.startsWith("_")||(n="$"+e),t+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\'${n}\')`,ei(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),em(t)}),es(e)}),["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","out","err","callMain","abort","wasmMemory","writeStackCookie","checkStackCookie","convertI32PairToI53Checked","stackSave","stackRestore","stackAlloc","ptrToString","zeroMemory","exitJS","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","jstoi_s","getExecutableName","keepRuntimeAlive","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","freeTableIndexes","functionsInTableMap","getEmptyTableSlot","updateTableMap","getFunctionAddress","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","stringToUTF8Array","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","stringToUTF8OnStack","writeArrayToMemory","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","doReadv","doWritev","initRandomFill","randomFill","promiseMap","uncaughtExceptionCount","exceptionLast","exceptionCaught","Browser","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","ydayFromDate","SYSCALLS","preloadPlugins","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_createPath","FS_createDevice","FS_readFile","FS","FS_createDataFile","FS_createLazyFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack","print","printErr"].forEach(es),W=function e(){D||e5(),D||(W=e)},t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();for(let e of(e5(),Object.keys(t)))e in t||Object.defineProperty(t,e,{configurable:!0,get(){J(`Access to module property (\'${e}\') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return y}}},function(){if(r)throw r[0];try{return t&&(n=(0,t[E(t)[0]])(t=0)),n}catch(e){throw r=[e],e}}),G={Unknown:"Unknown",InvalidArg:"InvalidArg",DocNotOpen:"DocNotOpen",DocOpenFailed:"DocOpenFailed",DocPasswordRequired:"DocPasswordRequired",DocPasswordIncorrect:"DocPasswordIncorrect",GrantPassphraseRequired:"GrantPassphraseRequired",Aborted:"Aborted",Network:"Network",Unauthenticated:"Unauthenticated",Forbidden:"Forbidden",NotFound:"NotFound",WireFormat:"WireFormat",RuntimeUnavailable:"RuntimeUnavailable",LayerVersionConflict:"LayerVersionConflict",NotImplemented:"NotImplemented",MalformedPdf:"MalformedPdf",SigningPending:"SigningPending",SigningExpired:"SigningExpired",SigningVersionMismatch:"SigningVersionMismatch",SignatureRefused:"SignatureRefused",ProtectedDocument:"ProtectedDocument",PayloadTooLarge:"PayloadTooLarge",ObjectNumberUnavailable:"ObjectNumberUnavailable",LayerFull:"LayerFull",ChangeConflict:"ChangeConflict",UndoUnavailable:"UndoUnavailable",IdempotencyKeyReused:"IdempotencyKeyReused",LayerDeleted:"LayerDeleted",VisitorIdentityRequired:"VisitorIdentityRequired",Conflict:"Conflict",EngineBusy:"EngineBusy",EngineRestarting:"EngineRestarting",DocumentQuarantined:"DocumentQuarantined",ThumbnailNotReady:"ThumbnailNotReady",TooManyRequests:"TooManyRequests",GrantExpired:"GrantExpired",OriginRequired:"OriginRequired",OriginNotAllowed:"OriginNotAllowed",FeatureNotEnabled:"FeatureNotEnabled",FeatureStopped:"FeatureStopped",LicenseInvalid:"LicenseInvalid",LicenseUsageLimit:"LicenseUsageLimit",UpstreamError:"UpstreamError"};function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(e,t,n){var r;return(r=function(e,t){if("object"!=O(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=O(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==O(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.values(G);var N=class e extends Error{constructor(e,t,n={}){super(t??e,void 0===n.cause?void 0:{cause:n.cause}),I(this,"name","EngineError"),I(this,"code",void 0),I(this,"details",void 0),this.code=e,this.details=n.details}static is(t,n){return(t instanceof e||t?.name==="EngineError")&&(void 0===n||t.code===n)}toJSON(){return{code:this.code,message:this.message,details:this.details}}};function C(e){return N.is(e)?e.toJSON():e instanceof Error?{code:"AbortError"===e.name?G.Aborted:G.Unknown,message:e.message}:{code:G.Unknown,message:String(e??"unknown error")}}var j=e=>{let t=t=>(e&1<[[1,e.exclude],[2,e.includeNoValueFields],[3,"html"===e.format],[4,"get"===e.method],[5,e.submitCoordinates],[6,"xfdf"===e.format],[7,e.includeAppendSaves],[8,e.includeAnnotations],[9,"pdf"===e.format],[10,e.canonicalFormat],[11,e.exclNonUserAnnots],[12,e.exclFKey],[14,e.embedForm]].reduce((e,[t,n])=>n?e|1<null!=e&&!("root"in e)&&R(e))}function B(e){return e.incomplete||!e.root?null:function e(t){let n=[];for(let r of t.next){let t=e(r);if(!t)return null;n.push(t)}let r=n.length>0?{next:n}:{};switch(t.type){case"javascript":return{type:"javascript",script:t.script,...r};case"goto":return{type:"goto",destination:t.destination,...r};case"uri":return{type:"uri",uri:t.uri,...r};case"named":return{type:"named",name:t.name,...r};case"hide":return{type:"hide",targets:t.targets,hide:t.hide,...r};case"reset-form":return{type:"reset-form",fields:t.fields,exclude:t.exclude,...r};case"submit-form":return t.payload?{...function(e){let{url:t,fields:n,charSet:r,...i}=e;return i}(t.payload),type:"submit-form",url:t.payload.url,fields:t.payload.fields,...r}:null;default:return null}}(e.root)}var L={javascript:"JavaScript",goto:"GoTo",uri:"URI",named:"Named",hide:"Hide","reset-form":"ResetForm","submit-form":"SubmitForm"};function $(e){return{root:function e(t){let n={subtype:L[t.type],next:(t.next??[]).map(e)};switch(t.type){case"javascript":return{type:"javascript",script:t.script,...n};case"goto":return{type:"goto",destination:t.destination,...n};case"uri":return{type:"uri",uri:t.uri,isMap:!1,...n};case"named":return{type:"named",name:t.name,...n};case"hide":return{type:"hide",targets:t.targets,hide:t.hide,...n};case"reset-form":return{type:"reset-form",fields:t.fields,exclude:t.exclude,...n};case"submit-form":return{type:"submit-form",payload:{url:t.url,fields:t.fields,...j(M(t))},...n}}}(e),incomplete:!1,warnings:[]}}var z=["activate","cursorEnter","cursorExit","mouseDown","mouseUp","focus","blur","pageOpen","pageClose","pageVisible","pageInvisible"];function U(e){let t=B(e);return t&&V(t)?t:null}function V(e){return"javascript"===e.type&&(e.next??[]).every(V)}function W(e){return"number"==typeof e&&Number.isInteger(e)&&e>0}function q(e){return{kind:"objectNumber",objectNumber:e}}function H(e){if(!W(e.objectNumber))throw RangeError(`encodePageKey: objectNumber must be a positive integer, got ${e.objectNumber}`);return`obj:${e.objectNumber}`}function K(e){switch(e.kind){case"objectNumber":return`obj:${e.objectNumber}`;case"baseIndex":return`base:${e.page.objectNumber}:${e.baseIndex}`}}var Z=["courier","courier-bold","courier-bold-oblique","courier-oblique","helvetica","helvetica-bold","helvetica-bold-oblique","helvetica-oblique","times-roman","times-bold","times-bold-italic","times-italic","symbol","zapf-dingbats"],J={invisible:!1,hidden:!1,print:!1,noZoom:!1,noRotate:!1,noView:!1,readOnly:!1,locked:!1,toggleNoView:!1,lockedContents:!1};function Q(e){return void 0!==e.layout?e:{...e,layout:"pushbutton"===e.fieldKind?"caption":null}}function X(e){return null===e?{kind:"unassigned"}:{kind:"group",groupId:e}}function Y(e){return"group"===e.kind?e.groupId:null}function ee(e){return eo(er(e)??{kind:"unassigned"},e.kind)}function et(e,t){let n=er(e);return void 0===n?t.assignment:eo(n,t.kind)}function en(e){if(void 0!==e.assignment)return e;let t="string"==typeof e.groupId?e.groupId:null;return{...e,assignment:X(t)}}function er(e){if(void 0!==e.assignment&&void 0!==e.groupId)throw ea("assignment",\'name a field\\\'s assignment or its groupId, not both: { kind: "group", groupId } says both\');return void 0!==e.assignment?function(e){let t=null!==e&&"object"==typeof e?e.kind:void 0;if("anyone"===t||"unassigned"===t)return{kind:t};if("group"===t){let n=e.groupId;return ei(n,"assignment"),{kind:t,groupId:n}}throw ea("assignment","a field\'s assignment is { kind: \'group\', groupId }, { kind: \'anyone\' } or { kind: \'unassigned\' }")}(e.assignment):void 0!==e.groupId?(null!==e.groupId&&ei(e.groupId,"groupId"),X(e.groupId)):void 0}function ei(e,t){if("string"!=typeof e||e.length<1||e.length>256)throw ea(t,`a field\'s groupId is 1 to 256 characters${"groupId"===t?", or null for no group":""}`)}function eo(e,t){if("anyone"===e.kind&&"signature"===t)throw ea("assignment","a signature field is signed by one signer, so it is never for anyone");return e}function ea(e,t){return new N(G.InvalidArg,t,{details:{field:e}})}function es(e){return void 0===e.lockedBy?{...e,lockedBy:null}:e}function el(e){if("pushbutton"!==e.kind)return e;let t=void 0===e.hasImage,n=void 0===e.takesImage;return t||n?{...e,...t?{hasImage:!1}:{},...n?{takesImage:!1}:{}}:e}var eu=Object.freeze(["m/d","m/d/yy","mm/dd/yy","mm/yy","d-mmm","d-mmm-yy","dd-mmm-yy","yy-mm-dd","mmm-yy","mmmm-yy","mmm d, yyyy","mmmm d, yyyy","m/d/yy h:MM tt","m/d/yy HH:MM"]),ed=Object.freeze(["HH:MM","h:MM tt","HH:MM:ss","h:MM:ss tt"]),ec=new Map([["yyyy",{part:"year",written:"digits"}],["yy",{part:"year",written:"digits"}],["mmmm",{part:"month",written:"letters"}],["mmm",{part:"month",written:"letters"}],["mm",{part:"month",written:"digits"}],["m",{part:"month",written:"digits"}],["dd",{part:"day",written:"digits"}],["d",{part:"day",written:"digits"}]]),ef=/(?:HH|H|hh|h):MM(?::ss)?(?: *tt)?/;function em(e){let t={written:[],groups:[]};for(let n of e.match(/([A-Za-z])\\1*|[^A-Za-z]/g)??[]){let e=ec.get(n);if(e)t.written.push(e.written),t.groups.push(e.part);else{if(!" /-.,".includes(n))return null;t.written.push("separator")}}return t}function ep(e){if("string"!=typeof e||e.length<1||e.length>64)return!1;let t=ef.exec(e),n=em(t?e.slice(0,t.index):e),r=em(t?e.slice(t.index+t[0].length):"");if(!n||!r)return!1;let i=[...n.groups,...r.groups];if(0===i.length||new Set(i).size!==i.length)return!1;let o=t?["digits",t[0].endsWith("tt")?"letters":"digits"]:[],a=[...n.written,...o,...r.written];return!a.some((e,t)=>"digits"===e&&"digits"===a[t+1]&&t!==n.written.length)}var eh=RegExp(`^${ef.source}$`);function eF(e){return"string"==typeof e&&e.length<=64&&eh.test(e)}function eg(e){return"text"===e||"combobox"===e}var e_={date:{format:"AFDate_FormatEx",numberedFormat:"AFDate_Format",keystroke:"AFDate_KeystrokeEx",numberedKeystroke:"AFDate_Keystroke",standard:eu,isPattern:ep},time:{format:"AFTime_FormatEx",numberedFormat:"AFTime_Format",keystroke:"AFTime_KeystrokeEx",numberedKeystroke:"AFTime_Keystroke",standard:ed,isPattern:eF}},eP=["date","time"];function eD(e,t,n,r){let i=e.trim();i.endsWith(";")&&(i=i.slice(0,-1).trimEnd());let o=/^([A-Za-z_]+)\\(\\s*(?:(["\'])([^"\'\\\\]*)\\2|(\\d{1,2}))\\s*\\)$/.exec(i);if(!o)return null;let[,a,,s,l]=o,{isPattern:u,standard:d}=e_[t];return a===n&&void 0!==s?u(s)?s:null:a===r&&void 0!==l?d[Number(l)]??null:null}function eb(e){let t=e?.format;if(null==t)return null;if("object"!=typeof t)return{kind:"other"};let n=ew(t);return null===n?{kind:"other"}:function(e){for(let t of eP){let n=e_[t],r=eD(e,t,n.format,n.numberedFormat);if(null!==r)return{kind:t,pattern:r}}return{kind:"other"}}(n)}function ey(e){let t=void 0===e.purpose,n=void 0===e.format&&"string"==typeof e.kind&&eg(e.kind);return t||n?{...e,...t?{purpose:null}:{},...n?{format:eb(e.actions)}:{}}:e}function ew(e){let t=e.root;return!1===e.incomplete&&t&&"javascript"===t.type&&Array.isArray(t.next)&&!(t.next.length>0)&&"string"==typeof t.script?t.script:null}function eE(e){var t;let n=e_[e.kind];return{format:`${n.format}("${e.pattern}");`,keystroke:"date"===e.kind?`${n.keystroke}("${e.pattern}");`:`${n.numberedKeystroke}(${2*!!(t=e.pattern).includes("ss")+ +!!t.includes("tt")});`}}function eA(e){if(null===e)return{keystroke:null,format:null};let t=eE(e),n=e=>({type:"javascript",script:e});return{keystroke:n(t.keystroke),format:n(t.format)}}function ev(e){return null!==e&&"other"!==e.kind}function eS(e,t){return null===e||null===t?e===t:e.kind===t.kind&&("other"===e.kind||e.pattern===t.pattern)}var ek={date:"a date format\'s pattern is 1 to 64 characters: the groups yyyy yy mmmm mmm mm m dd d, at least one of them and the year, the month and the day each once at most, with spaces and / - . , between them, and at most one time (HH, H, hh or h, then :MM, then :ss and tt when it has them); two groups written in digits never touch",time:"a time format\'s pattern is a time and nothing else, at most 64 characters: HH, H, hh or h, then :MM, then :ss when it has seconds, then tt when it has one"};function ex(e,t){if(void 0===e.format)return;if(!eg(t))throw new N(G.InvalidArg,`\'format\' does not apply to a ${t} field`,{details:{field:"format"}});let n=function(e){if(null===e)return null;let t="object"==typeof e?e:{};if("other"===t.kind)throw new N(G.InvalidArg,"a format of kind \'other\' is read, never written: write its scripts in actions",{details:{field:"format"}});if("date"!==t.kind&&"time"!==t.kind)throw new N(G.InvalidArg,"a field\'s format is a date or a time with a pattern, or null for none",{details:{field:"format"}});let{pattern:n}=t;if(!e_[t.kind].isPattern(n))throw new N(G.InvalidArg,ek[t.kind],{details:{field:"format.pattern"}});return{kind:t.kind,pattern:n}}(e.format);for(let t of["format","keystroke"])if(e.actions?.[t]!==void 0)throw new N(G.InvalidArg,`\'format\' writes the field\'s ${t} script: name it or actions.${t}, not both`,{details:{field:`actions.${t}`}});return n}function eG(e){return $({type:"javascript",script:e})}function eO(e){return"string"==typeof e&&e.length>=1&&e.length<=256&&e.trim()===e&&!e.includes("\\0")}function eI(e,t){if(null==e)return null;if(!eO(e))throw new N(G.InvalidArg,`a field\'s ${t} is 1 to 256 characters with no space at its start or end and no NUL character, or null for none`,{details:{field:t}});return e}function eN(e){return eO(e)}function eC(e){return eI(e,"placeholder")}function ej(e){return void 0!==e.placeholder?e:{...e,placeholder:null}}function eM(e){if("objectNumber"===e.kind){if(!Number.isInteger(e.objectNumber)||e.objectNumber<=0)throw RangeError(`encodeFieldRefKey: objectNumber must be a positive integer, got ${e.objectNumber}`);return`obj:${e.objectNumber}`}return`fqn:${e.name}`}function eR(e,t){return{ref:e>0&&t?{kind:"objectNumber",page:t,objectNumber:e}:null,objectNumber:e,page:t}}var eT=(e,t)=>e.replace(/\\B(?=(\\d{3})+(?!\\d))/g,()=>t),eB=(e,t)=>t?eB(t,e%t):e;function eL(e){let t=Math.fround(e.conversion??0/0);if(!Number.isFinite(t)||t<=0)return!1;let n=e.precision??("fraction"===e.fraction?16:100);return!!Number.isInteger(n)&&!(n<1)&&!(n>0x7fffffff)&&((e.fraction??"decimal")!=="decimal"||!!Number.isInteger(Math.log10(n)))}function e$(e,t){if(!Number.isFinite(e)||!t.length||!t.every(eL))throw new N(G.InvalidArg,"Measurement requires a finite value and valid number formats");let n=Math.abs(e),r=[];for(let[e,i]of t.entries()){if(!Number.isFinite(n*=Math.fround(i.conversion)))throw new N(G.InvalidArg,"Measurement overflow");let o=Math.floor(n),a=n-o,s=e===t.length-1,l=s||0===a,u=s?function(e,t){let n=t.fraction??"decimal",r=t.thousands??",";if("round"===n)return eT(String(Math.round(e)),r);if("truncate"===n)return eT(String(Math.trunc(e)),r);if("fraction"===n){let n=t.precision??16,i=Math.floor(e),o=Math.round((e-i)*n);if(o===n&&(i++,o=0),!o)return eT(String(i),r);let a=t.fixed?1:eB(o,n);return`${i?`${eT(String(i),r)} `:""}${o/a}/${n/a}`}let i=Math.log10(t.precision??100),[o,a=""]=e.toFixed(i).split(".");return eT(o,r)+(a?(t.decimal||".")+a:"")}(n,i):eT(String(o),i.thousands??","),d="prefix"===i.labelPosition,c=i.prefixSpacing??(d&&0===e?"":" "),f=i.suffixSpacing??(!d&&l?"":" "),m=c+i.unit+f;if(r.push(d?m+u:u+m),l)break;n=a}return(e<0?"-":"")+r.join("")}var ez={courier:{family:"Courier",weight:400,italic:!1},"courier-bold":{family:"Courier",weight:700,italic:!1},"courier-bold-oblique":{family:"Courier",weight:700,italic:!0},"courier-oblique":{family:"Courier",weight:400,italic:!0},helvetica:{family:"Helvetica",weight:400,italic:!1},"helvetica-bold":{family:"Helvetica",weight:700,italic:!1},"helvetica-bold-oblique":{family:"Helvetica",weight:700,italic:!0},"helvetica-oblique":{family:"Helvetica",weight:400,italic:!0},"times-roman":{family:"Times",weight:400,italic:!1},"times-bold":{family:"Times",weight:700,italic:!1},"times-bold-italic":{family:"Times",weight:700,italic:!0},"times-italic":{family:"Times",weight:400,italic:!0},symbol:{family:"Symbol",weight:400,italic:!1},"zapf-dingbats":{family:"ZapfDingbats",weight:400,italic:!1}};function eU(e,t){if(Z.includes(e)){let t=ez[e];return{family:t.family,weight:t.weight,italic:t.italic}}let n=t?.(e);return n?{family:n.familyName,weight:n.weight,italic:n.italic}:{family:e}}function eV(e){return e.toLowerCase().replace(/[\\s\\-_\'"]/g,"")}var eW={helvetica:"Helvetica",arial:"Helvetica",arialmt:"Helvetica",sansserif:"Helvetica",times:"Times",timesroman:"Times",timesnewroman:"Times",timesnewromanpsmt:"Times",serif:"Times",courier:"Courier",couriernew:"Courier",couriernewpsmt:"Courier",monospace:"Courier",symbol:"Symbol",zapfdingbats:"ZapfDingbats",dingbats:"ZapfDingbats"};function eq(e){if("object"!=typeof e||null===e)return!1;let{left:t,bottom:n,right:r,top:i}=e;return[t,n,r,i].every(e=>"number"==typeof e&&Number.isFinite(e))}function eH(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),bottom:Math.min(e.top,e.bottom),top:Math.max(e.top,e.bottom)}}var eK=e=>Number.isFinite(e.x)&&Number.isFinite(e.y);function eZ([e,t,n,r]){if(![e,t,n,r].every(eK))return!1;let i={x:t.x-e.x,y:t.y-e.y},o={x:r.x-n.x,y:r.y-n.y},a={x:n.x-e.x,y:n.y-e.y},s={x:r.x-t.x,y:r.y-t.y},l=[i,o,a,s].map(e=>Math.hypot(e.x,e.y));if(l.some(e=>e<=1e-6)||i.x*o.x+i.y*o.y<=0||a.x*s.x+a.y*s.y<=0)return!1;let u=i.x*a.y-i.y*a.x,d=o.x*s.y-o.y*s.x;return!(Math.abs(u)<=1e-6*l[0]*l[2]||Math.abs(d)<=1e-6*l[1]*l[3])&&Math.sign(u)===Math.sign(d)}function eJ(e,t){let n=eQ(t);if(null!==n)return eX(e,n);let r=t*Math.PI/180,i=Math.abs(Math.cos(r)),o=Math.abs(Math.sin(r)),a=e.right-e.left,s=e.top-e.bottom,l=(a*i+s*o)/2,u=(a*o+s*i)/2,d=(e.left+e.right)/2,c=(e.bottom+e.top)/2;return{left:d-l,bottom:c-u,right:d+l,top:c+u}}function eQ(e){let t=(e%360+360)%360;return t%90==0?t:null}function eX(e,t){if(0===t||180===t)return e;let n=(e.left+e.right)/2,r=(e.bottom+e.top)/2,i=(e.top-e.bottom)/2,o=(e.right-e.left)/2;return{left:n-i,bottom:r-o,right:n+i,top:r+o}}function eY(e,t){let n=.01+1e-4*Math.max(e.right-e.left,e.top-e.bottom,t.right-t.left,t.top-t.bottom);return Math.abs(e.left-t.left)<=n&&Math.abs(e.bottom-t.bottom)<=n&&Math.abs(e.right-t.right)<=n&&Math.abs(e.top-t.top)<=n}function e0(e){if(0===e.length)return{left:0,bottom:0,right:0,top:0};let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let{x:o,y:a}of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),i=Math.max(i,a);return{left:t,bottom:n,right:r,top:i}}function e1(e,t){let n=t.degrees*Math.PI/180,r=Math.cos(n),i=Math.sin(n),o=e.x-t.center.x,a=e.y-t.center.y;return{x:t.center.x+o*r+a*i,y:t.center.y-o*i+a*r}}function e3(e,t){return e1(e,{degrees:-t.degrees,center:t.center})}function e2(e,t){return e.replace(/\\r\\n|\\r|\\n/g,t)}var e6={family:"Helvetica",weight:400,italic:!1,size:12,color:"#000000",decoration:[],script:"normal",letterSpacing:0,horizontalScale:1,align:"left",dir:"ltr"};function e5(e){return e2(e.paragraphs.map(e=>e.runs.map(e=>e.text).join("")).join(`\n`),`\n`)}function e4(e){return e.split(/\\r\\n|\\r|\\n/).map(e=>({runs:[{text:e}]}))}var e8=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");function e7(e,t,n){return`#${e8(e)}${e8(t)}${e8(n)}`}function e9(e){let t=Number.parseInt(e.slice(1),16);return{r:t>>16&255,g:t>>8&255,b:255&t}}var te={highlight:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},underline:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},squiggly:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},strikeout:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data",intent:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},circle:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",box:"data",rotation:"data",cloudyIntensity:"data"},readBack:["rect","borderStyle"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{}},square:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",box:"data",rotation:"data",cloudyIntensity:"data"},readBack:["rect","borderStyle"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{}},polygon:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",vertices:"data",rotation:"data",captionEnabled:"data",captionCenter:"data",intent:"data",measure:"data",cloudyIntensity:"data"},readBack:["rect","borderStyle","vertices"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",vertices:"points",captionCenter:"point",measure:"measure"},resources:{}},polyline:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",vertices:"data",rotation:"data",captionEnabled:"data",captionCenter:"data",intent:"data",measure:"data",lineEndings:"data"},readBack:["rect","borderStyle","vertices"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",vertices:"points",captionCenter:"point",measure:"measure"},resources:{}},line:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",linePoints:"data",lineEndings:"data",rotation:"data",intent:"data",measure:"data",captionEnabled:"data",captionPosition:"data",captionOffset:"data",leader:"data"},readBack:["rect","borderStyle"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",linePoints:"linePoints",measure:"measure"},resources:{}},link:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",target:"data"},readBack:["target"],colors:[],spaces:{rect:"box",actions:"actions",target:"linkTarget"},resources:{}},ink:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",inkList:"data",intent:"data",rotation:"data"},readBack:["rect","strokeWidth","borderStyle","inkList"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",inkList:"strokes"},resources:{}},"free-text":{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",box:"data",rotation:"data",intent:"data",fontFamily:"data",fontSize:"data",textAlign:"data",verticalAlign:"data",color:"data",fontColor:"data",interiorColor:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",cloudyIntensity:"data",calloutLine:"data",lineEnding:"data"},readBack:["rect","intent","borderStyle"],colors:["color","fontColor","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box",calloutLine:"calloutLine"},resources:{}},caret:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",box:"data",rotation:"data",intent:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{}},text:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",icon:"data",open:"data",state:"data",stateModel:"data"},readBack:[],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length"},resources:{}},stamp:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",box:"data",rotation:"data",name:"data",fit:"data",opacity:"data"},readBack:["rect"],colors:[],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{appearance:"required"}},"file-attachment":{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",icon:"data",file:"data"},readBack:[],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length"},resources:{file:"required"}},widget:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"data",box:"data",rotation:"data",color:"data",interiorColor:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",fontFamily:"data",fontSize:"data",fontColor:"data",textAlign:"data",caption:"data",checkStyle:"data",layout:"data",field:"engine",fieldKind:"engine",hasMark:"engine"},readBack:["rect","actions"],colors:["color","interiorColor","fontColor"],spaces:{rect:"box",actions:"actions",box:"box"},resources:{}},redact:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data",interiorColor:"data",overlayText:"data",repeat:"data",fontFamily:"data",fontSize:"data",fontColor:"data",textAlign:"data"},readBack:[],colors:["color","interiorColor","fontColor"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},popup:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",parent:"data",open:"data"},readBack:["parent"],colors:[],spaces:{rect:"box",actions:"actions"},resources:{}},unsupported:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",rawSubtypeCode:"engine",rawSubtypeName:"engine"},readBack:[],colors:[],spaces:{rect:"box",actions:"actions"},resources:{}}};function tt(e){let t={};for(let n of Object.keys(te))t[n]=e(te[n]);return t}function tn(e){return Object.prototype.hasOwnProperty.call(te,e)?te[e]:null}var tr=tt(e=>Object.keys(e.owners)),ti=tt(e=>e.resources),to=tt(e=>e.spaces),ta=Object.assign({},...Object.values(to)),ts=[["highlight","underline","squiggly","strikeout"],["square","circle"]],tl=/^sha256-[0-9a-f]{64}$/,tu=["page","position","size"];async function td(e){let t=new Uint8Array(await crypto.subtle.digest("SHA-256",e)),n="";for(let e of t)n+=e.toString(16).padStart(2,"0");return`sha256-${n}`}async function tc(e,t){for(let[n,r]of Object.entries(t))await td(r)!==n&&tF(e,`resource ${n} doesn\'t match its id`)}function tf(e,t){let n=new Set,r=new Set;for(let o of t){var i;tg(o)&&t_(o.page)&&tg(i=o.size)&&[i.width,i.height].every(e=>"number"==typeof e&&Number.isFinite(e)&&e>=0)||tF(e,"a page needs a page ref, a position and a size"),th(e,"a page",o,tu);let{position:t}=o;(!Number.isInteger(t)||t<0)&&tF(e,`page position ${JSON.stringify(t)} is not a position`);let a=H(o.page);n.has(a)&&tF(e,`page ${a} is listed twice`),r.has(t)&&tF(e,`position ${t} is listed twice`),n.add(a),r.add(t)}return n}function tm(e,t,n,r,i,o){for(let[a,s]of(tg(n)||tF(e,`${t} has no resources`),Object.entries(n)))r.includes(a)||tF(e,`${t} names an unknown resource role \'${a}\'`),"string"==typeof s&&tl.test(s)||tF(e,`${t} names ${JSON.stringify(s)}, which is not a resource id`),i.has(s)||tF(e,`${t} names ${s}, which the bundle doesn\'t hold`),o.add(s)}function tp(e,t,n,r){for(let i of n.keys())tl.test(i)||tF(e,`${JSON.stringify(i)} is not a resource id`),r.has(i)||tF(e,`resource ${i} is named by no ${t}`)}function th(e,t,n,r){for(let i of Object.keys(n))r.includes(i)||tF(e,`${t} has an unknown field \'${i}\'`)}function tF(e,t){throw new N(G.InvalidArg,`${e} bundle: ${t}`)}function tg(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function t_(e){return tg(e)&&"objectNumber"===e.kind&&Number.isInteger(e.objectNumber)&&e.objectNumber>0}function tP(e){let t=function(e,t,n){let r=new Map(n.map(e=>[H(e.page),e.page])),i=new Map;if("same"===t)for(let t of e){let e=r.get(H(t.page));e&&i.set(H(t.page),e)}else if("by-position"===t){let t=new Map(n.map(e=>[e.position,e.page]));for(let n of e){let e=t.get(n.position);e&&i.set(H(n.page),e)}}else for(let{from:e,to:n}of t){let t=H(e);if(i.has(t))throw new N(G.InvalidArg,`import: page ${t} is mapped twice`);let o=r.get(H(n));if(!o)throw new N(G.NotFound,`import: the document has no page ${H(n)}`);i.set(t,o)}return i}(e.bundlePages,e.pages,e.target),n=new Set;for(let r of e.named)t.has(H(r))||n.add(H(r));if(n.size>0){let e=[...n];throw new N(G.InvalidArg,`import: ${1===e.length?"page":"pages"} ${e.join(", ")} map to no page of this document`,{details:{pages:e}})}return e=>t.get(H(e))}var tD=new Set(["subtype","invisible","hidden","print","noZoom","noRotate","noView","readOnly","locked","toggleNoView","lockedContents","nm","reply","popup","parent","open","groupId","subject","state","stateModel","ref","page","hasAppearance","appearanceState","author","createdAt","modifiedAt","userId","createdBy","modifiedBy","importedBy","actions","file","field","fieldKind"]),tb=new Set(["free-text","redact"]),ty=new Set(["square","circle","free-text","stamp","caret","widget","line","polyline","polygon","ink"]),tw={square:["box"],circle:["box"],"free-text":["box","calloutLine"],line:["linePoints"],polygon:["vertices"],polyline:["vertices"],ink:["inkList"],highlight:["quadPoints"],underline:["quadPoints"],squiggly:["quadPoints"],strikeout:["quadPoints"],redact:["rect","quadPoints"],caret:["box"],text:["rect"],stamp:["box"],"file-attachment":["rect"],link:["rect"],widget:["box"]},tE=(e,t)=>.001>=Math.abs(e-t),tA=e=>"number"==typeof e?(e%360+360)%360:0;function tv(e,t){if(null==e||null==t)return null==e&&null==t;if("number"==typeof e&&"number"==typeof t)return tE(e,t);if(Array.isArray(e)||Array.isArray(t))return!!Array.isArray(e)&&!!Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>tv(e,t[n]));if("object"==typeof e&&"object"==typeof t){for(let n of new Set([...Object.keys(e),...Object.keys(t)]))if(!tv(e[n],t[n]))return!1;return!0}return e===t}function tS(e){return null==e||"object"!=typeof e?void 0:Array.isArray(e)?e.length>0?tS(e[0]):void 0:"number"==typeof e.x&&"number"==typeof e.y?{x:e.x,y:e.y}:"number"==typeof e.left&&"number"==typeof e.bottom?{x:e.left,y:e.bottom}:tS(e.start??e.upperLeft)}var tk={impact:"inert"},tx={impact:"regenerate"};function tG(e,t){let n=new Map(e.map(e=>[K(e.ref),e])),r=n.get(K(t));if(!r)return[];let i=new Map,o=new Map,a=(e,t,n)=>e.set(t,[...e.get(t)??[],n]);for(let t of e){let e=t.reply?n.get(K(t.reply.to)):void 0;e&&e!==t&&a(i,e,t);let r="popup"===t.subtype&&t.parent?n.get(K(t.parent)):void 0;r&&r!==t&&a(o,r,t);let s=t.popup?n.get(K(t.popup)):void 0;s&&s!==t&&"popup"===s.subtype&&a(o,t,s)}let s=[],l=new Set,u=e=>{if(!l.has(e)){for(let t of(l.add(e),i.get(e)??[]))u(t);for(let t of o.get(e)??[])l.has(t)||(l.add(t),s.push(t));s.push(e)}};return u(r),s}var tO=new Set(["accepted","rejected","cancelled","completed","none"]),tI=new Set(["marked","unmarked"]);function tN(e){return tO.has(e)?"review":tI.has(e)?"marked":null}var tC=new Set(["highlight","underline","squiggly","strikeout","square","circle","free-text","stamp","caret","widget","line","polyline","polygon","ink"]),tj=new Set(["box","point","points","strokes","quads","linePoints","calloutLine"]);function tM(e){return[...Object.entries(to[e]).filter(([e,t])=>"rect"!==e&&tj.has(t)).map(([e])=>e),"rotation"]}function tR(e,t){return new N(G.InvalidArg,`${e} field \'rect\': ${t}`,{details:{field:"rect"}})}var tT=e=>Number.isFinite(e)&&e>0,tB=e=>({x:Math.fround(e.x),y:Math.fround(e.y)});function tL(e,t,n){let r=0,i=e.map(tB);for(let e=0;e<(t?i.length:i.length-1);e++){let t=i[e],o=i[(e+1)%i.length];r+=Math.hypot((o.x-t.x)*n.sx,(o.y-t.y)*n.sy)}return r}function t$(e,t){if(e.length<3)return 0;let n=e.map(tB),r=n[0],i=0;for(let e=1;e!Number.isFinite(Math.fround(e.x))||!Number.isFinite(Math.fround(e.y))))return{unavailable:"invalid-geometry"};let i="polygon"===e.subtype;if(i&&!function(e){let t=e.map(tB),n=(e,t)=>e.x===t.x&&e.y===t.y;if(t.length>1&&n(t[0],t[t.length-1])&&t.pop(),t.length<3||0===t$(t,{sx:1,sy:1}))return!1;let r=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),i=(e,t,n)=>0===r(e,t,n)&&n.x>=Math.min(e.x,t.x)&&n.x<=Math.max(e.x,t.x)&&n.y>=Math.min(e.y,t.y)&&n.y<=Math.max(e.y,t.y);for(let e=0;e=Math.fround(e.cyx)))throw new N(G.InvalidArg,"Invalid CYX")}function tW(e){if("number"!=typeof e||!Number.isFinite(Math.fround(e)))throw new N(G.InvalidArg,"Value is outside PDF float range")}var tq=["linePoints","vertices","measure","intent","contents"],tH=["captionEnabled","captionPosition","captionOffset","captionCenter"],tK=e=>tH.some(t=>void 0!==e[t]);function tZ(e,t){try{if(null!=t.measure&&"rectilinear"===t.measure.subtype&&tV(t.measure),"line"===e&&"leader"in t&&null!=t.leader&&("object"!=typeof t.leader||Array.isArray(t.leader)))throw new N(G.InvalidArg,"Invalid line leader");if(null!=t.intent&&!("line"===e?["line-dimension","line-arrow"]:"polygon"===e?["polygon-dimension","polygon-cloud"]:["polyline-dimension"]).includes(t.intent))throw new N(G.InvalidArg,"Invalid measurement intent");if(null!=t.captionEnabled&&"boolean"!=typeof t.captionEnabled)throw new N(G.InvalidArg,"Invalid caption visibility");if("captionPosition"in t&&null!=t.captionPosition&&!["inline","top"].includes(t.captionPosition))throw new N(G.InvalidArg,"Invalid caption position");if("captionOffset"in t&&t.captionOffset&&(tW(t.captionOffset.along),tW(t.captionOffset.perpendicular)),"captionCenter"in t&&t.captionCenter&&(tW(t.captionCenter.x),tW(t.captionCenter.y)),"leader"in t&&t.leader){for(let e of[t.leader.length,t.leader.extension??0,t.leader.offset??0])tW(e);if((t.leader.extension??0)<0||(t.leader.offset??0)<0)throw new N(G.InvalidArg,"Leader extension and offset must be nonnegative")}for(let e of"linePoints"in t?t.linePoints?[t.linePoints.start,t.linePoints.end]:[]:"vertices"in t?t.vertices??[]:[])tW(e.x),tW(e.y)}catch(e){throw new N(G.InvalidArg,e.message)}}function tJ(e){if(void 0!==e.richText&&null!==e.richText&&void 0!==e.contents&&null!==e.contents&&e2(e.contents,`\n`)!==e5(e.richText))throw new N(G.InvalidArg,`${e.subtype??"annotation"}: \\`contents\\` must equal the plain projection of \\`richText\\` when both are given`)}function tQ(e){return void 0!==e&&"free-text"!==e&&(tr[e]?.includes("richText")??!1)}var tX="#ff0000",tY="#000000",t0="#ffff00",t1={invisible:!1,hidden:!1,print:!0,noZoom:!1,noRotate:!1,noView:!1,readOnly:!1,locked:!1,toggleNoView:!1,lockedContents:!1,blendMode:"normal"},t3={...t1,color:tX,opacity:1,strokeWidth:1,borderStyle:"solid"},t2={start:"none",end:"none"},t6={...t1,color:tY,opacity:1},t5={square:t3,circle:t3,line:{...t3,lineEndings:t2,captionEnabled:!1,captionPosition:"inline"},polygon:t3,polyline:{...t3,lineEndings:t2},ink:t3,highlight:{...t1,blendMode:"multiply",color:t0,opacity:1},underline:t6,squiggly:t6,strikeout:t6,caret:{...t1,color:tX,opacity:1},"free-text":{...t1,contents:"",intent:"free-text",fontFamily:"helvetica",fontSize:12,textAlign:"left",verticalAlign:"top",color:tY,fontColor:tY,opacity:1,strokeWidth:1,borderStyle:"solid"},text:{...t1,icon:"note",open:!1,color:t0,opacity:1},"file-attachment":{...t1,icon:"paperclip",color:t0,opacity:1},link:t1,redact:{...t1,quadPoints:[],color:tX,opacity:1,repeat:!1,fontFamily:"helvetica",fontSize:12,fontColor:tY,textAlign:"left"},stamp:{...t1,fit:"contain",opacity:1},widget:{...t1,strokeWidth:1,borderStyle:"solid",textAlign:"left"},popup:{...t1,print:!1,open:!1}};function t4(e){return"unsupported"===e?{}:t5[e]}var t8=[3,3];function t7(e,t){return"dashed"===e&&void 0===t}var t9=e=>tn(e)?.owners.dashArray!==void 0;function ne(e,t,n){let r={...e};if(void 0!==t.fontFamily){let e=eU(t.fontFamily,n);r.family=e.family,void 0!==e.weight&&(r.weight=e.weight),void 0!==e.italic&&(r.italic=e.italic)}return void 0!==t.fontSize&&(r.size=t.fontSize),null!=t.fontColor&&(r.color=t.fontColor),void 0!==t.textAlign&&(r.align=t.textAlign),r}function nt(e,t){if(null!=t&&"free-text-callout"!==e)throw new N(G.InvalidArg,`free-text: a callout line needs intent \'free-text-callout\', not \'${e}\'`,{details:{field:"intent"}})}function nn(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>"subtype"===e||!t(e,n)))}function nr(e){return new N(G.InvalidArg,`text: the custom state \'${e}\' needs a stateModel`,{details:{field:"stateModel"}})}function ni(e,t){let n=tr[e],r=Object.keys(t).filter(e=>"subtype"!==e&&!n.includes(e));if(r.length>0)throw new N(G.InvalidArg,`${e} has no field ${r.map(e=>`\'${e}\'`).join(", ")}`)}var no=class extends N{constructor(e,t){super(G.InvalidArg,`invalid scope "${e}": ${t}`,{details:{scope:e,reason:t}}),this.scope=e,I(this,"name","InvalidScope")}},na=class extends N{constructor(e,t,n,r){super(G.Forbidden,`permission denied${t?` (${t})`:""}: ${n?`one of ${n.join(", ")}`:e}${r?` for ${r.length} annotation${1===r.length?"":"s"}`:""}`,{details:{required:e,...void 0===t?{}:{context:t},...void 0===n?{}:{anyOf:[...n]},...void 0===r?{}:{refs:[...r]}}}),this.required=e,this.context=t,this.anyOf=n,this.refs=r,I(this,"name","PermissionDenied")}},ns=class extends N{constructor(e){super(G.Aborted,function(e){if(null==e)return"aborted";if("string"==typeof e)return e;if(e instanceof Error)return e.message||"aborted";try{return JSON.stringify(e)}catch{return"aborted"}}(e)),I(this,"name","AbortError"),I(this,"reason",void 0),this.reason=e}};function nl(e,t){throw new N(G.InvalidArg,t,{details:{field:e}})}var nu=["normal","rollover","down"],nd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nc=Uint8Array.from(nd,e=>e.charCodeAt(0)),nf=(()=>{let e=(new Int16Array(128)).fill(-1);for(let t=0;t<64;t++)e[nd.charCodeAt(t)]=t;return e})();function nm(e){let t=e.length;for(;t>0&&61===e.charCodeAt(t-1);)t-=1;return t}var np=(e,t,n)=>Math.min(Math.max(Math.floor(e),t),n);function nh(e,t){let n=np(t,0,e.charCount),r=e.charMap;if(!r||0===r.length)return Math.min(n,e.text.length);let[i,o]=function(e,t){let n=0,r=e.length-1,i=null;for(;n<=r;){let o=n+r>>1;e[o][0]<=t?(i=e[o],n=o+1):r=o-1}return i??[0,0]}(r,n);return o+(n-i)}function nF(e,t,n){let r=np(t,0,e.text.length),i=0,o=e.charCount;if("start"===n){for(;i>1;nh(e,t)>=r?o=t:i=t+1}return i}var ng=/[\\r\\p{Noncharacter_Code_Point}]/u;function n_(e){return"start"===e||"end"===e?null:"before"in e?e.before:e.after}function nP(e,t,n){if("start"===t)return 0;if("end"===t)return e.length;let r=n_(t),i=e.findIndex(e=>n(e)===n(r));if(i<0)throw new N(G.NotFound,`no neighbour ${n(r)} in the list`,{details:{field:"position"}});return"before"in t?i:i+1}function nD(e,t,n,r){let i=new Set(t.map(r));if(i.size!==t.length)throw new N(G.InvalidArg,"a row is named twice",{details:{field:"refs"}});let o=new Set(e.map(r)),a=t.find(e=>!o.has(r(e)));if(void 0!==a)throw new N(G.NotFound,`no row ${r(a)} in the list`,{details:{field:"refs"}});let s=n_(n);if(null!==s&&i.has(r(s)))throw new N(G.InvalidArg,`the neighbour ${r(s)} is one of the rows that move`,{details:{field:"position"}});let l=e.filter(e=>!i.has(r(e))),u=nP(l,n,r);return[...l.slice(0,u),...t,...l.slice(u)]}var nb="EmbedPDF";function ny(e,t){return{x:e.x-t.left,y:t.top-e.y}}function nw(e,t){return{x:e.x+t.left,y:t.top-e.y}}function nE(e,t){return{x:e.left-t.left,y:t.top-e.top,width:e.right-e.left,height:e.top-e.bottom}}function nA(e,t){let n=e.x+t.left,r=t.top-e.y;return{left:n,right:n+e.width,bottom:r-e.height,top:r}}function nv(e,t){return{upperLeft:ny(e.upperLeft,t),upperRight:ny(e.upperRight,t),lowerLeft:ny(e.lowerLeft,t),lowerRight:ny(e.lowerRight,t)}}function nS(e){return"rotation"in e}function nk(e){return{kind:"objectNumber",objectNumber:e}}function nx(e){if(e.byteLength<4)return null;let t=new Uint8Array(e);return 137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]?function(e){if(e.byteLength<24)return null;let t=new DataView(e),n=t.getUint32(16),r=t.getUint32(20);return 0===n||0===r?null:{mimeType:"image/png",width:n,height:r}}(e):255===t[0]&&216===t[1]&&255===t[2]?function(e){let t=new Uint8Array(e),n=2;for(;n+4=192&&r<=195){if(n+9>t.byteLength)return null;let r=new DataView(e,n+5),i=r.getUint16(0),o=r.getUint16(2);if(0===o||0===i)return null;return{mimeType:"image/jpeg",width:o,height:i}}if(216===r||217===r)n+=2;else if(255===r)n+=1;else{let e=t[n+2]<<8|t[n+3];n+=2+e}}return null}(e):37===t[0]&&80===t[1]&&68===t[2]&&70===t[3]?{mimeType:"application/pdf"}:null}var nG=["appearance","file"];function nO(e,t,n){let r=ti[e]??{};for(let i of nG){let o=t?.[i]!==void 0;if(o&&void 0===r[i])throw new N(G.InvalidArg,`a ${e} annotation takes no \'${i}\' resource`);if(!o&&"create"===n&&"required"===r[i])throw new N(G.InvalidArg,`creating a ${e} annotation needs its \'${i}\' resource`)}}var nI=Object.freeze({bundleBytes:0x3200000,manifestBytes:0x1000000,items:1e4,pages:2e3,resources:2e3,resourceBytes:0x3200000,imagePixels:4e7});function nN(e){return new TextEncoder().encode(JSON.stringify(e)).length}function nC(e,t,n,r){let i=t[n];if(!(r<=i))throw new N(G.PayloadTooLarge,`the ${e} bundle is past its ${n} limit: ${r} > ${i}`,{details:{limit:n,max:i,value:r}})}var nj={annotation:"an annotation bundle",form:"a form bundle"};function nM(e){let t=t=>new N(G.InvalidArg,`the file is not ${nj[e.kind]}`,void 0===t?void 0:{cause:t});return{stringify(t,n){let r=n?.limits??nI,i=new Map;for(let[e,n]of Object.entries(t.resources))i.set(e,n.length);e.assertManifest(t,i,r);let o={};for(let n of e.keys)o[n]=t[n];let a={};for(let[e,n]of Object.entries(t.resources))a[e]=function(e){let t=new Uint8Array(4*Math.ceil(e.length/3)),n=0,r=0;for(;r+2>18],t[n++]=nc[i>>12&63],t[n++]=nc[i>>6&63],t[n++]=nc[63&i]}let i=e.length-r;if(i>0){let o=e[r]<<16|(2===i?e[r+1]<<8:0);t[n++]=nc[o>>18],t[n++]=nc[o>>12&63],t[n++]=2===i?nc[o>>6&63]:61,t[n++]=61}return new TextDecoder().decode(t)}(n);return o.resources=a,JSON.stringify(o)},async parse(n,r){let i,o=r?.limits??nI,a=Math.ceil(4*o.bundleBytes/3)+81*o.resources+256;if(n.length>a)throw new N(G.PayloadTooLarge,`the file is ${n.length} characters, more than a bundle within ${o.bundleBytes} bytes can be`,{details:{limit:"bundleBytes",max:o.bundleBytes,fileLength:n.length}});try{i=JSON.parse(n)}catch(e){throw t(e)}let s="object"==typeof i&&null!==i?i.resources:null;if("object"!=typeof s||null===s||Array.isArray(s))throw t();let l=new Map;for(let[e,t]of Object.entries(s)){let n="string"==typeof t?function(e){let t=nm(e);return t%4==1?null:Math.floor(3*t/4)}(t):null;if(null===n)throw new N(G.InvalidArg,`resource ${e} is not base64`);l.set(e,n)}e.assertManifest(i,l,o);let u={};for(let[e,t]of Object.entries(s))try{u[e]=function(e){let t=nm(e);if(t%4==1)throw Error("malformed base64");let n=new Uint8Array(Math.floor(3*t/4)),r=0,i=0,o=0;for(let a=0;a=8&&(o-=8,n[r++]=i>>o&255)}return n}(t)}catch(t){throw new N(G.InvalidArg,`resource ${e} is not base64`,{cause:t})}await tc(e.kind,u);let d={};for(let t of e.keys)d[t]=i[t];return d.resources=u,e.complete?e.complete(d):d}}}var nR=["format","version","pages","items"],nT=[...nR,"resources"],nB=["data","resources"];function nL(e,t,n){tg(e)||tF("annotation","not an annotation bundle"),th("annotation","the bundle",e,nT),"embedpdf/annotations"!==e.format&&tF("annotation",`unknown format ${JSON.stringify(e.format)}`),1!==e.version&&tF("annotation",`unknown version ${JSON.stringify(e.version)}`);let{pages:r,items:i}=e;Array.isArray(r)||tF("annotation","pages is not a list"),Array.isArray(i)||tF("annotation","items is not a list"),nC("annotation",n,"items",i.length),nC("annotation",n,"pages",r.length),nC("annotation",n,"resources",t.size);let o=nN({pages:r,items:i});for(let e of(nC("annotation",n,"manifestBytes",o),t.values()))nC("annotation",n,"resourceBytes",e),o+=e;nC("annotation",n,"bundleBytes",o);let a=tf("annotation",r),s=new Set;i.forEach((e,n)=>{tg(e)&&tg(e.data)&&"string"==typeof e.data.subtype||tF("annotation",`item ${n} has no annotation data`),th("annotation",`item ${n}`,e,nB);let r=e.data.ref,i=tg(r)?r.page:void 0;t_(i)&&a.has(H(i))||tF("annotation",`item ${n} is on a page the bundle doesn\'t list`),tm("annotation",`item ${n}`,e.resources,nG,t,s)}),tp("annotation","item",t,s)}function n$(e){return{kind:"key",key:e}}nM({kind:"annotation",keys:nR,assertManifest:nL});var nz=new Set(["square","circle","free-text","stamp","caret"]),nU=(e,t)=>"function"==typeof t?t(e):t,nV=(e,t)=>null===e?null:t(e);function nW(e,t){let{left:n,top:r}=nU(e.page,t),i=e=>nV(e,e=>e-n),o=e=>nV(e,e=>r-e);switch(e.kind){case"xyz":{let{left:t,top:n,...r}=e;return{...r,x:i(t),y:o(n)}}case"fitH":case"fitBH":{let{top:t,...n}=e;return{...n,y:o(t)}}case"fitV":case"fitBV":{let{left:t,...n}=e;return{...n,x:i(t)}}case"fitR":{let{left:t,bottom:i,right:o,top:a,...s}=e,l=Math.min(i,a),u=Math.max(i,a);return{...s,x:Math.min(t,o)-n,y:r-u,width:Math.abs(o-t),height:u-l}}case"fit":case"fitB":return e}}function nq(e,t){let{left:n,top:r}=nU(e.page,t),i=e=>nV(e,e=>e+n),o=e=>nV(e,e=>r-e);switch(e.kind){case"xyz":{let{x:t,y:n,...r}=e;return{...r,left:i(t),top:o(n)}}case"fitH":case"fitBH":{let{y:t,...n}=e;return{...n,top:o(t)}}case"fitV":case"fitBV":{let{x:t,...n}=e;return{...n,left:i(t)}}case"fitR":{let{x:t,y:i,width:o,height:a,...s}=e,l=r-i;return{...s,left:t+n,bottom:l-a,right:t+n+o,top:l}}case"fit":case"fitB":return e}}function nH(e,t){return"goto"===e.kind?{...e,destination:t(e.destination)}:e}function nK(e,t){return{...e,root:e.root?function e(t,n){let r=t.next.map(t=>e(t,n));return"goto"===t.type?{...t,next:r,destination:n(t.destination)}:{...t,next:r}}(e.root,t):null}}function nZ(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>null==n?[e,n]:[e,"root"in n?nK(n,t):function e(t,n){let r=t.next?.map(t=>e(t,n)),i="goto"===t.type?{...t,destination:n(t.destination)}:t;return r?{...i,next:r}:i}(n,t)]))}function nJ(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,n?nK(n,t):n]))}var nQ=(e,t)=>"rectilinear"===e.subtype&&e.origin?{...e,origin:t(e.origin)}:e;function nX(e,t){return nQ(e,e=>ny(e,t))}function nY(e,t){return nQ(e,e=>nw(e,t))}function n0(e,t){return e.map(e=>({...e,bbox:nE(e.bbox,t),measure:e.measure?nX(e.measure,t):null}))}var n1={length:e=>e,point:(e,{visible:t})=>ny(e,t),points:(e,{visible:t})=>e.map(e=>ny(e,t)),strokes:(e,{visible:t})=>e.map(e=>e.map(e=>ny(e,t))),box:(e,{visible:t})=>nE(e,t),quads:(e,{visible:t})=>e.map(e=>nv(e,t)),linePoints:(e,{visible:t})=>({start:ny(e.start,t),end:ny(e.end,t)}),calloutLine:(e,{visible:t})=>e.map(e=>ny(e,t)),measure:(e,{visible:t})=>nX(e,t),linkTarget:(e,{boxOf:t})=>nH(e,e=>nW(e,t)),actions:(e,{boxOf:t})=>nZ(e,e=>nW(e,t))},n3={length:e=>e,point:(e,{visible:t})=>nw(e,t),points:(e,{visible:t})=>e.map(e=>nw(e,t)),strokes:(e,{visible:t})=>e.map(e=>e.map(e=>nw(e,t))),box:(e,{visible:t})=>nA(e,t),quads:(e,{visible:t})=>e.map(e=>({upperLeft:nw(e.upperLeft,t),upperRight:nw(e.upperRight,t),lowerLeft:nw(e.lowerLeft,t),lowerRight:nw(e.lowerRight,t)})),linePoints:(e,{visible:t})=>({start:nw(e.start,t),end:nw(e.end,t)}),calloutLine:(e,{visible:t})=>e.map(e=>nw(e,t)),measure:(e,{visible:t})=>nY(e,t),linkTarget:(e,{boxOf:t})=>nH(e,e=>nq(e,t)),actions:(e,{boxOf:t})=>nZ(e,e=>nq(e,t))};function n2(e,t,n,r){let i=void 0===e?ta:to[e]??to.unsupported;return Object.fromEntries(Object.entries(t).map(([e,t])=>{let o=i[e];if(!o||null==t)return[e,t];let a=r[o](t,n);if(r===n3&&function e(t){return"number"==typeof t?Number.isNaN(t):"object"==typeof t&&null!==t&&Object.values(t).some(e)}(a)){var s,l;throw s=e,l=o,new N(G.InvalidArg,`field \'${s}\': expected page space, ${"box"===l?"{ x, y, width, height }":"points as { x, y }"} from the page\'s top-left`,{details:{field:s}})}return[e,a]}))}function n6(e,t,n){return n2(e.subtype,e,{visible:t,boxOf:n},n1)}function n5(e,t,n){return n2(e.subtype,e,{visible:t,boxOf:n},n3)}function n4(e,t,n){return n2(e.subtype,e,{visible:t,boxOf:n},n3)}var n8=e=>!!(e.space||e.empty),n7=e=>!!e.empty,n9={baseline:{x:1,y:0},ascent:{x:0,y:1}},re=(e,t)=>({x:t.x*e.baseline.x+t.y*e.baseline.y,y:t.x*e.ascent.x+t.y*e.ascent.y}),rt=(e,t)=>({x:e.baseline.x*t.x+e.ascent.x*t.y,y:e.baseline.y*t.x+e.ascent.y*t.y}),rn={left:0,bottom:0,right:0,top:0};function rr(e,t){let n=[t.upperLeft,t.upperRight,t.lowerLeft,t.lowerRight].map(t=>re(e,t)),r=n.map(e=>e.x),i=n.map(e=>e.y);return{left:Math.min(...r),bottom:Math.min(...i),right:Math.max(...r),top:Math.max(...i)}}var ri=(e,t)=>t.x>=e.left&&t.x<=e.right&&t.y>=e.bottom&&t.y<=e.top;function ro(e,t,n=1.5){let r=e.frames.map((e,n)=>0===n?t:re(e,t));for(let t of e.runs){let n=r[t.frame];if(ri(t.rect,n))for(let r=0;rs.right+i)&&!(n.ys.top+i))for(let r=0;rl.right+i||n.yl.top+i)continue;let u=Math.min(Math.abs(n.x-l.left),Math.abs(n.x-l.right)),d=Math.min(Math.abs(n.y-l.bottom),Math.abs(n.y-l.top));u+d=0?o:null}function ra(e,t,n){return 0===t?{upperLeft:{x:n.left,y:n.top},upperRight:{x:n.right,y:n.top},lowerLeft:{x:n.left,y:n.bottom},lowerRight:{x:n.right,y:n.bottom}}:{upperLeft:rt(e,{x:n.left,y:n.top}),upperRight:rt(e,{x:n.right,y:n.top}),lowerLeft:rt(e,{x:n.left,y:n.bottom}),lowerRight:rt(e,{x:n.right,y:n.bottom})}}var rs=e=>e.right===e.left&&e.top===e.bottom;function rl(e,t,n,r){let i=Math.max(t,r)-Math.min(e,n);return 0!==i&&Math.max(0,Math.min(t,r)-Math.max(e,n))/i>=.5}var ru={x:0,y:0,width:0,height:0},rd={upperLeft:{x:0,y:0},upperRight:{x:0,y:0},lowerLeft:{x:0,y:0},lowerRight:{x:0,y:0}},rc=/\\s/,rf=/\\p{M}/gu,rm=/^(?![\\t\\n\\v\\f\\r])[\\p{Cf}\\p{Cc}\\p{Noncharacter_Code_Point}]$/u;function rp(e,t={}){let n=[],r=[],i=!1,o=0;for(let a of e){let e;if(rm.test(a)){o+=a.length;continue}rc.test(a)?e=" ":(e=a.normalize("NFKD"),t.keepMarks||(e=e.replace(rf,"")),t.keepCase||(e=e.toUpperCase().toLowerCase()));for(let a=0;a=55296&&n<=56319&&t+1=56320&&n<=57343)return 2}return 1}(e.original,i)-r}}var rF=["format","version","pages","fields","widgets","calculationOrder"],rg=["image"],r_=[...rF,"resources"],rP=["data"],rD=["data","resources"];function rb(e){let t=ry(e.fields,e=>es(ej(en(el(ey(e)))))),n=e.widgets&&ry(e.widgets,Q);return t===e.fields&&n===e.widgets?e:{...e,fields:t,...n?{widgets:n}:{}}}function ry(e,t){let n=!1,r=e.map(e=>{let r=t(e.data);return r===e.data?e:(n=!0,{...e,data:r})});return n?r:e}function rw(e,t,n){tg(e)||tF("form","not a form bundle"),th("form","the bundle",e,r_),"embedpdf/form"!==e.format&&tF("form",`unknown format ${JSON.stringify(e.format)}`),1!==e.version&&tF("form",`unknown version ${JSON.stringify(e.version)}`);let{pages:r,fields:i,widgets:o,calculationOrder:a}=e;Array.isArray(r)||tF("form","pages is not a list"),Array.isArray(i)||tF("form","fields is not a list"),Array.isArray(o)||tF("form","widgets is not a list"),Array.isArray(a)||tF("form","calculationOrder is not a list"),nC("form",n,"items",i.length+o.length),nC("form",n,"pages",r.length),nC("form",n,"resources",t.size);let s=nN({pages:r,fields:i,widgets:o,calculationOrder:a});for(let e of(nC("form",n,"manifestBytes",s),t.values()))nC("form",n,"resourceBytes",e),s+=e;nC("form",n,"bundleBytes",s);let l=tf("form",r);i.forEach((e,t)=>{tg(e)&&tg(e.data)&&"string"==typeof e.data.kind&&"string"==typeof e.data.name&&tg(e.data.ref)||tF("form",`field ${t} has no field data`),th("form",`field ${t}`,e,rP)});let u=new Set;o.forEach((e,n)=>{tg(e)&&tg(e.data)&&"widget"===e.data.subtype||tF("form",`widget ${n} has no widget data`),th("form",`widget ${n}`,e,rD);let r=e.data.ref,i=tg(r)?r.page:void 0;t_(i)&&l.has(H(i))||tF("form",`widget ${n} is on a page the bundle doesn\'t list`),tm("form",`widget ${n}`,e.resources,rg,t,u)}),a.forEach((e,t)=>{tg(e)||tF("form",`calculation order entry ${t} is not a field ref`)}),tp("form","widget",t,u)}function rE(e){return{keepCase:!!e.matchCase,keepMarks:!!e.matchDiacritics,dropWhitespace:!!e.ignoreWhitespace}}nM({kind:"form",keys:rF,assertManifest:rw,complete:rb});var rA=/[\\p{L}\\p{N}_]/u,rv=/\\p{M}/u;function rS(e,t){if(t<=0)return!1;let n=e.charCodeAt(t-1);return rA.test(String.fromCodePoint(e.codePointAt(n>=56320&&n<=57343&&t>=2?t-2:t-1)))}function rk(e,t){return!(t>=e.length)&&rA.test(String.fromCodePoint(e.codePointAt(t)))}function rx(e,t){let n=rp(t.text,rE(t)).folded;if(0===n.trim().length)return[];let r=[],i=0;for(;i<=e.folded.length-n.length;){let o=e.folded.indexOf(n,i);if(o<0)break;if(t.wholeWord&&!function(e,t,n,r){if(!r.ignoreWhitespace)return!rS(e.folded,t)&&!rk(e.folded,t+n);let{start:i,count:o}=rh(e,t,n);return!rS(e.original,i)&&!rk(e.original,i+o)}(e,o,n.length,t)){i=o+1;continue}if(t.matchDiacritics&&o+n.length512)return{ok:!1,issue:"too-long",message:"Pattern exceeds 512 characters."};let t=!1;for(let n=0;n="1"&&r<="9")return{ok:!1,issue:"backreference",message:`Backreference \\\\${r} is not supported.`};if(!t&&"k"===r&&"<"===e[n+2])return{ok:!1,issue:"backreference",message:"Named backreferences (\\\\k<\\u2026>) are not supported."};n++;continue}if(t){"]"===r&&(t=!1);continue}if("["===r){t=!0;continue}if("("===r&&"?"===e[n+1]){let t=e[n+2]??"";if("="===t||"!"===t)return{ok:!1,issue:"lookaround",message:"Lookahead ((?=\\u2026), (?!\\u2026)) is not supported."};if("<"===t&&("="===e[n+3]||"!"===e[n+3]))return{ok:!1,issue:"lookaround",message:"Lookbehind ((?<=\\u2026), (?{var r;let i;return"link"!==e.subtype||"activate"!==t||o&&(r=n,i=r?.root,!r||!!r.incomplete||!i||!!(i.next.length>0)||!!("uri"===i.type&&i.isMap))})&&n.push({field:"actions",reason:"unsupported-action"}),n}var rT=new Set(["NextPage","PrevPage","FirstPage","LastPage"]);function rB(e){let t=[],n=(e,r)=>{if("object"==typeof e&&null!==e){if(Array.isArray(e))return void e.forEach(e=>n(e));if("page"===r&&r$(e))return void t.push(e);Object.entries(e).forEach(([e,t])=>n(t,e))}};return n(e),t}function rL(e,t){let n=(e,r)=>"object"!=typeof e||null===e?e:Array.isArray(e)?e.map(e=>n(e)):"page"===r&&r$(e)?t(e):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,n(t,e)]));return n(e)}function r$(e){return 2===Object.keys(e).length&&"objectNumber"===e.kind&&"number"==typeof e.objectNumber}var rz=/^\\s*event\\s*\\.\\s*target\\s*\\.\\s*buttonImportIcon\\s*\\(\\s*\\)\\s*(?:;\\s*)?$/,rU=["activate","mouseUp"];function rV(e){let t,n=rU.flatMap(t=>{let n=e?.[t];return null==n?[]:[n]});return 1===n.length&&null!==(t=ew(n[0]))&&rz.test(t)}function rW(e){return e.length>0&&e.every(rV)}function rq(){return{type:"javascript",script:"event.target.buttonImportIcon();"}}function rH(e){return rU.some(t=>e?.[t]!==void 0)?e??{}:{...e,activate:rq()}}function rK(e,t){let{takesImage:n}=e;if(void 0!==n){if("pushbutton"!==t)throw new N(G.InvalidArg,`\'takesImage\' does not apply to a ${t} field`,{details:{field:"takesImage"}});if("boolean"!=typeof n)throw new N(G.InvalidArg,"\'takesImage\' is true or false",{details:{field:"takesImage"}});return n}}function rZ(e,t){if(!t)return rV(e)?{kind:"remove",event:e?.activate!=null?"activate":"mouseUp"}:{kind:"keep"};if(rV(e))return{kind:"keep"};if(rU.some(t=>e?.[t]!=null))throw new N(G.InvalidArg,"\'takesImage\' can\'t be set: a widget\'s press already runs another action, which is never overwritten. Remove it first (updateWidget, actions.activate and actions.mouseUp)",{details:{field:"takesImage"}});return{kind:"write"}}function rJ(e,t=0){if(e.length+t===0)throw rX();if(t>0)throw new N(G.InvalidArg,"\'takesImage\' can\'t be set: a widget of the button is on no page, so its press can\'t be written",{details:{field:"takesImage"}});for(let t of e)rZ(t,!0)}function rQ(e){return"write"===e.kind?{activate:rq()}:"remove"===e.kind?{[e.event]:null}:{}}function rX(){return new N(G.InvalidArg,"\'takesImage\' needs a widget: the script that makes an image field is its widgets\' press",{details:{field:"takesImage"}})}function rY(e,t,n){if(0===e.length||0===n.length)return e;let r=new Set(n),i=[0];for(let e=0;ei[Math.min(Math.max(e,0),t)],a=[];return e.forEach((n,r)=>{if(o(e[r+1]?.firstPage??t)===o(n.firstPage))return;let i=o(n.firstPage);a.push(i===n.firstPage?n:{...n,firstPage:i})}),r1(a,e)?e:a}function r0(e,t,n){if(n<=0)return e;let r=!1,i=e.map(e=>0===e.firstPage||e.firstPage{let r=t[n];return e.firstPage===r.firstPage&&e.style===r.style&&e.firstNumber===r.firstNumber&&e.prefix===r.prefix})}var r3=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function r2(e){let t=e%1e6,n="";for(let[e,r]of r3)for(;t>=e;)n+=r,t-=e;return n}function r6(e){if(e<=0)return"";let t=e-1;return String.fromCharCode(97+t%26).repeat((Math.floor(t/26)+1)%1e3)}var r5={text:"{ value }",checkbox:"{ checked } or { value }",radio:"{ value }",combobox:"{ value }",listbox:"{ selectedValues }"};function r4(e,t){var n;switch(e.kind){case"text":if("value"in t)return{kind:"text",value:t.value??""};break;case"checkbox":if("checked"in t){if(!t.checked)return{kind:"toggle",state:null};let n=e.widgets[0];if(!n)throw it(`\'${e.name}\' has no widget to check`);return{kind:"toggle",state:n.onState}}if("value"in t)return{kind:"toggle",state:r9(e,t.value)};break;case"radio":if("value"in t){let n=r9(e,t.value);if(null===n&&e.noToggleToOff)throw it(`\'${e.name}\' must keep a choice: it can\'t be cleared`);return{kind:"toggle",state:n}}break;case"combobox":if("value"in t)return ie(e,null===t.value?[]:[t.value]);break;case"listbox":if("selectedValues"in t)return ie(e,t.selectedValues);break;default:throw it(`${e.kind} fields hold no value you can set`)}throw it(`a ${e.kind} field takes ${r5[e.kind]}, not ${"checked"in(n=t)?"{ checked }":"selectedValues"in n?"{ selectedValues }":"{ value }"}`)}function r8(e,t){let n=e=>new N(G.InvalidArg,e,{details:{field:"defaultValue"}});if(new Set(t).size!==t.length)throw n("the default values must not repeat");if(t.length>1&&!("listbox"===e.kind&&e.multiSelect))throw n(`a ${"listbox"===e.kind?"list without multiSelect":"dropdown"} has one default`);let r="combobox"===e.kind&&!0===e.edit,i=new Set(e.options.map(e=>e.value)),o=t.find(e=>!i.has(e));if(void 0!==o&&!r)throw n(`\'${o}\' is not an option value of the ${"listbox"===e.kind?"list":"dropdown"}`)}function r7(e,t){return e.kind===t.kind&&("scalar"===e.kind&&"scalar"===t.kind?e.value===t.value:"array"!==e.kind||"array"!==t.kind||e.values.length===t.values.length&&e.values.every((e,n)=>e===t.values[n]))}function r9(e,t){if(null===t||"Off"===t)return null;let n=e.widgets.find(e=>e.exportValue===t);if(!n)throw it(`no widget of \'${e.name}\' has the export value \'${t}\'`);return n.onState}function ie(e,t){if(new Set(t).size!==t.length)throw it("the values must not repeat");if("listbox"===e.kind&&!e.multiSelect&&t.length>1)throw it(`\'${e.name}\' takes one value (it has no multiSelect)`);let n=new Set(e.options.map(e=>e.value)),r="combobox"===e.kind&&e.edit&&1===t.length,i=t.find(e=>!n.has(e));if(!r&&void 0!==i)throw it(`\'${i}\' is not an option value of \'${e.name}\'`);return{kind:"choice",values:t}}function it(e){return new N(G.InvalidArg,e,{details:{field:"value"}})}function ir(e,t){let n="checkbox"===e||"radio"===e,r="pushbutton"===e,i=ii(e,t,"caption",r,"a push button\'s");if(r&&null===t.layout)throw new N(G.InvalidArg,"a push button\'s widget always has a layout: \'caption\' shows its caption alone",{details:{field:"layout"}});return ii(e,ii(e,i,"layout",r,"a push button\'s"),"checkStyle",n,"a checkbox\'s or radio button\'s")}function ii(e,t,n,r,i){if(r||void 0===t[n])return t;if(null!==t[n]){let t="unknown"===e?"this widget":`a ${e} field\'s widget`;throw new N(G.InvalidArg,`\'${n}\' applies to ${i} widgets, not to ${t}`,{details:{field:n}})}let{[n]:o,...a}=t;return a}function io(e){if(("combobox"===e.kind||"listbox"===e.kind)&&void 0!==e.defaultValue){let t=Array.isArray(e.defaultValue)?e.defaultValue:[e.defaultValue];r8({...e,options:e.options??[]},t)}switch(e.kind){case"text":case"combobox":return void 0!==e.defaultValue?ib(e.defaultValue):iy();case"listbox":return ip(ih((e.options??[]).map(iP),e.defaultValue??[]));default:return iy()}}function ia(e,t){var n,r,i;let o,a,s,l,u,d={...e.field};if(void 0!==t.name){let e=d.name.lastIndexOf(".");d.name=e<0?t.name:`${d.name.slice(0,e+1)}${t.name}`}for(let e of is)"boolean"==typeof t[e]&&e in d&&(d[e]=t[e]);if(void 0!==t.alternateName&&(d.alternateName=t.alternateName||null),void 0!==t.mappingName&&(d.mappingName=t.mappingName||null),d.assignment=et(t,d),d.groupId=Y(d.assignment),void 0!==t.purpose&&(d.purpose=rj(t.purpose)),void 0!==t.placeholder&&(d.placeholder=eC(t.placeholder)),"text"===d.kind||"combobox"===d.kind){let e=ex(t,d.kind);if(void 0!==e&&!eS(e,d.format)){let t=function(e,t){let{keystroke:n,format:r,...i}=e??{};if(null===t)return Object.keys(i).length>0?i:void 0;let o=eE(t);return{keystroke:eG(o.keystroke),format:eG(o.format),...i}}(d.actions,e);d.format=e,t?d.actions=t:delete d.actions}}if("text"===d.kind&&("maxLength"in t&&void 0!==t.maxLength&&(d.maxLength=t.maxLength),"defaultValue"in t&&void 0!==t.defaultValue)){let e=t.defaultValue;d.defaultValue=e??"",d.defaultValueEntry=null===e?iy():ib(e)}let c=!1;if(("combobox"===d.kind||"listbox"===d.kind)&&("options"in t&&t.options&&(n=d,o=(r=t.options.map(iP)).map(e=>e.value),a="combobox"===n.kind&&n.edit,s=ig("combobox"===n.kind?""===n.value?[]:[n.value]:n.selectedValues,o,a),l=im("listbox"===n.kind?{...n,options:r,topIndex:iF(n.topIndex,r)}:{...n,options:r},s),u="scalar"===(i=n.defaultValueEntry).kind?[i.value]:"array"===i.kind?[...i.values]:[],d="none"===n.defaultValueEntry.kind?l:i_(l,ig(u,o,a),!0),c=!0),"defaultValue"in t&&void 0!==t.defaultValue)){let e=null===t.defaultValue?[]:Array.isArray(t.defaultValue)?t.defaultValue:[t.defaultValue];r8(d,e),d=i_(d,e)}let f={...e,field:d},m=rK(t,d.kind);return void 0!==m?function(e,t){if("pushbutton"!==e.field.kind)return e;let n=new Set(e.field.widgets.map(e=>e.objectNumber)),r=e=>n.has(iD(e.ref)),i=e.widgets.filter(r);t&&rJ(i.map(e=>e.actions),e.field.widgets.length-i.length);let o=e.widgets.map(e=>{if(!r(e))return e;let n=rQ(rZ(e.actions,t)),i=function(e,t){if(null===t)return null;let n={...e},r=!1;for(let e of z){let i=t[e];void 0!==i&&(null===i?(void 0!==n[e]&&(r=!0),delete n[e]):"root"in i||(n[e]=$(i),r=!0))}let i=r?n:e??{};return Object.keys(i).length>0?i:null}(e.actions,n);return i===(e.actions??null)?e:{...e,actions:i}});return{field:{...e.field,takesImage:t},widgets:o}}(f,m):c?il(f.field,f):f}var is=["readOnly","required","noExport","multiline","password","comb","radiosInUnison","noToggleToOff","edit","multiSelect"];function il(e,t){return{field:e,widgets:t.widgets.map(e=>e.hasAppearance?e:{...e,hasAppearance:!0})}}function iu(e,t){let n=e.field;if("checkbox"!==n.kind&&"radio"!==n.kind)return e;let r="checkbox"===n.kind||n.radiosInUnison,i=t>=0?n.widgets[t]:null,o=n.widgets.map((e,n)=>{let o=null!==i&&(r?e.exportValue===i.exportValue&&e.onState===i.onState:n===t);return e.checked===o?e:{...e,checked:o}}),a=ib(i?i.onState:"Off"),s="checkbox"===n.kind?{...n,widgets:o,valueEntry:a,checked:o.some(e=>e.checked)}:{...n,widgets:o,valueEntry:a,value:o.find(e=>e.checked)?.exportValue??"Off"},l=new Map(o.map(e=>[e.objectNumber,e.checked?e.onState:"Off"]));return{field:s,widgets:e.widgets.map(e=>{let t=l.get(iD(e.ref));return void 0===t||e.appearanceState===t?e:{...e,appearanceState:t}})}}function id(e,t){let n=new Set;for(let r of t){let t=e.findIndex(e=>e.value===r);t>=0&&n.add(t)}return[...n].sort((e,t)=>e-t)}var ic=(e,t)=>t.every(t=>e.options.some(e=>e.value===t));function im(e,t){let n=ic(e,t)?id(e.options,t):[],r=t.length>0&&0===n.length,i=e.options.map((e,t)=>{let r=n.includes(t);return e.selected===r?e:{...e,selected:r}}),o=r?[...t]:n.map(t=>e.options[t].value),a=ip(o);return"combobox"===e.kind?{...e,options:i,valueEntry:a,value:o[0]??""}:{...e,options:i,valueEntry:a,selectedValues:o}}function ip(e){return 0===e.length?iy():1===e.length?ib(e[0]):{kind:"array",values:[...e]}}function ih(e,t){return id(e,t).map(t=>e[t].value)}function iF(e,t){return Math.max(0,Math.min(e,t.length-1))}function ig(e,t,n){let r=e.filter(e=>t.includes(e));return 0===r.length&&n&&e.length>0?[...e]:r}function i_(e,t,n=!1){if(0===t.length){let t=n?"listbox"===e.kind&&e.multiSelect?{kind:"array",values:[]}:ib(""):iy();return"combobox"===e.kind?{...e,defaultValueEntry:t,defaultValue:""}:{...e,defaultValueEntry:t,defaultValue:[]}}let r=ic(e,t),i=r?ih(e.options,t):[...t],o=r?ip(i):ib(t[0]);return"combobox"===e.kind?{...e,defaultValueEntry:o,defaultValue:i[0]??""}:{...e,defaultValueEntry:o,defaultValue:i}}var iP=e=>({label:e.label,value:e.value,selected:!1}),iD=e=>"objectNumber"===e.kind?e.objectNumber:0,ib=e=>({kind:"scalar",value:e}),iy=()=>({kind:"none"});function iw(e){return new N(G.Unknown,`\'${e.name}\' could not be reset`)}function iE(e){var t,n;if(null===e)return null;let r=!ArrayBuffer.isView(t=e)&&(n=t,!("u">typeof Blob&&n instanceof Blob)),i=r?e.pdf:e;if(ArrayBuffer.isView(i))return{bytes:i,declaredPdf:r};throw new N(G.InvalidArg,"a signature appearance reaches a write as bytes, never as a Blob")}function iA(e){return"skipped"===e.type}function iv(e){switch(e.type){case"skipped":return!1;case"annotations.import":case"annotations.copy":return e.annotations.length>0;case"forms.import":case"forms.importValues":case"forms.copy":return e.fields.length>0;case"forms.repeat":return e.meta.changedFields.length>0;default:return!0}}function iS(e){return"undoOf"in e}function ik(e,t){return{all:()=>`${e}:${t}:all`,self:()=>`${e}:${t}:self`,createdBy:n=>`${e}:${t}:createdBy=${n}`,group:n=>`${e}:${t}:group=${n}`}}function ix(e,t){return{all:()=>`${e}:${t}:all`,group:n=>`${e}:${t}:group=${n}`}}Object.assign(()=>"doc.render",{thumbnail:()=>"doc.render.thumbnail"}),Object.assign(()=>"doc.download",{flattened:()=>"doc.download.flattened"}),Object.assign(()=>"doc.print",{high:()=>"doc.print.high"}),Object.assign(()=>"doc.sign",{certify:()=>"doc.sign.certify"}),ik("annotations","create"),ik("annotations","update"),ik("annotations","delete"),ix("annotations","set-group"),ik("annotations","*"),ix("fields","fill"),ix("fields","sign"),ix("fields","set-group"),ix("fields","*");var iG={none:0,lta:1,fill:2,annotate:3};function iO(e){return 1===e?"lta":2===e?"fill":"annotate"}function iI(e,t){return iG[e]<=iG[t]?e:t}function iN(e,t){return null===e||iG[e]>=iG[t]}function iC(e,t){return t===e||t.startsWith(`${e}.`)}function ij(e,t){switch(e.action){case"all":return!0;case"include":return e.fields.some(e=>iC(e,t));case"exclude":return!e.fields.some(e=>iC(e,t))}}function iM(e){let t=!1,n=null,r=null,i=[];for(let o of e)o.signed&&(t=!0,o.catalogCertification&&null!==o.docMdp&&null===r&&(r={signatureIndex:o.index,permission:o.docMdp},n=iI(n??"annotate",iO(o.docMdp))),o.fieldMdp&&i.push({signatureIndex:o.index,source:"fieldmdp",spec:o.fieldMdp}),o.lock&&(i.push({signatureIndex:o.index,source:"lock",spec:o.lock}),void 0!==o.lock.permission&&(n=iI(n??"annotate",iO(o.lock.permission)))));return{enforced:n,judged:t?n??"annotate":null,certification:r,fieldLocks:i,policyVersion:6}}function iR(e){let t=new Set;return e&&null!==e.judged&&(t.add("doc.download.flattened"),null===e.enforced||(t.add("doc.pages.modify"),t.add("doc.pages.assemble"),t.add("doc.redact"),t.add("doc.attachments.modify"),t.add("doc.outline.modify"),t.add("doc.forms.modify"),t.add("doc.forms.script"),iN(e.enforced,"annotate")||(t.add("doc.annotate.modify"),t.add("doc.annotate.import")),iN(e.enforced,"fill")||(t.add("doc.forms.fill"),t.add("doc.forms.import"),t.add("doc.metadata.modify"),t.add("doc.sign")))),t}var iT=new Set(["doc.open","doc.render","doc.render.thumbnail","doc.text.select","doc.text.copy","doc.text.search","doc.content.copy","doc.download","doc.download.flattened","doc.print","doc.print.high","doc.pages.modify","doc.pages.assemble","doc.forms.read","doc.forms.fill","doc.forms.modify","doc.forms.import","doc.forms.script","doc.forms.submit","doc.annotate.read","doc.annotate.modify","doc.annotate.import","doc.metadata.modify","doc.attachments.modify","doc.outline.modify","doc.redact","doc.sign","doc.sign.certify"]);function iB(e){if("*"===e)return{kind:"wildcard"};if("pdf.permissions"===e)return{kind:"virtual",name:"pdf.permissions"};if(e.includes(":"))return function(e){let t=e.indexOf(":"),n=e.indexOf(":",t+1);if(-1===t||-1===n)throw new no(e,"collab scope requires entity:action:filter");let r=e.slice(0,t),i=e.slice(t+1,n),o=e.slice(n+1);if("fields"===r){var a=e,s=i,l=o;if("fill"!==s&&"sign"!==s&&"set-group"!==s&&"*"!==s)throw new no(a,`unknown fields action: ${s}`);let t=i$(l,a);if("all"!==t.kind&&"group"!==t.kind)throw new no(a,`fields only support :all or :group= filters (got :${t.kind})`);return{kind:"collab",entity:"fields",action:s,filter:t}}if("annotations"!==r)throw new no(e,`unknown collab entity: ${r}`);if("create"!==i&&"update"!==i&&"delete"!==i&&"set-group"!==i&&"*"!==i)throw new no(e,`unknown collab action: ${i}`);let u=i$(o,e);if("set-group"===i&&("self"===u.kind||"createdBy"===u.kind))throw new no(e,`set-group only supports :all or :group= filters (got :${u.kind})`);return{kind:"collab",entity:r,action:i,filter:u}}(e);let t=function(e){if(e.includes(":"))return null;let t=e.indexOf(".");if(t<=0)return null;let n=e.slice(0,t);return iL.has(n)?null:n}(e);return null!==t?function(e,t){if(!iU.test(e))throw new no(e,"invalid plugin permission shape (expected .)");return{kind:"plugin",name:e,plugin:t}}(e,t):function(e){if(!iz.test(e))throw new no(e,"invalid capability name shape");if(!iT.has(e))throw new no(e,`unknown capability: ${e}`);return{kind:"capability",name:e}}(e)}var iL=new Set(["doc","docs","pdf","annotations","fields","tokens","grants","shares","tenants","layer","visitor","document","submission","signature"]);function i$(e,t){if("all"===e)return{kind:"all"};if("self"===e)return{kind:"self"};if(e.startsWith("createdBy=")){let n=e.slice(10);if(!n)throw new no(t,"createdBy= requires a value");return{kind:"createdBy",userId:n}}if(e.startsWith("group=")){let n=e.slice(6);if(!n)throw new no(t,"group= requires a value");return{kind:"group",groupId:n}}throw new no(t,`unknown filter: ${e}`)}var iz=/^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$/,iU=/^[a-z][a-z0-9]*(-[a-z0-9]+)*(\\.[a-z][a-z0-9]*(-[a-z0-9]+)*)+$/;function iV(e){return{...e.userId?{userId:e.userId}:{},...e.groupId?{groupId:e.groupId}:{}}}function iW(e,t,n,r=null){if(iR(r).has(e))return!1;let i=t.map(iB);return!!i.some(e=>"wildcard"===e.kind)||iH(i,n,r).has(e)}function iq(e,t,n,r,i){let o=n.map(iB);if(o.some(e=>"wildcard"===e.kind))return!0;let a=o.filter(t=>"collab"===t.kind&&"annotations"===t.entity&&(t.action===e||"*"===t.action));return a.length>0?a.some(e=>(function(e,t,n){switch(e.kind){case"all":return!0;case"self":return!!n.userId&&t.userId===n.userId;case"createdBy":return t.userId===e.userId;case"group":return t.groupId===e.groupId}})(e.filter,t,r)):iH(o,i).has("doc.annotate.modify")}function iH(e,t,n=null){let r=new Set,i=!1,o=!1;for(let n of e)"capability"===n.kind?r.add(n.name):"virtual"===n.kind&&"pdf.permissions"===n.name?function(e,t){let n;for(let r of((n=new Set).add("doc.open"),n.add("doc.render"),n.add("doc.annotate.read"),n.add("doc.forms.read"),n.add("doc.text.search"),n.add("doc.text.select"),t.copy&&(n.add("doc.text.copy"),n.add("doc.content.copy")),t.print&&n.add("doc.print"),t.printHighQuality&&t.print&&n.add("doc.print.high"),t.modifyContents&&(n.add("doc.pages.modify"),n.add("doc.redact"),n.add("doc.metadata.modify"),n.add("doc.attachments.modify")),(t.modifyContents||t.assemble)&&(n.add("doc.pages.assemble"),n.add("doc.outline.modify")),t.modifyAnnotations&&n.add("doc.annotate.modify"),(t.modifyContents||t.modifyAnnotations||t.fillForms)&&(n.add("doc.forms.fill"),n.add("doc.sign")),t.modifyAnnotations&&t.modifyContents&&n.add("doc.forms.modify"),[...n]))e.add(r)}(r,t):"collab"===n.kind&&"annotations"===n.entity?i=!0:"collab"===n.kind&&"fields"===n.entity&&(o=!0);for(let e of(r.has("doc.render")&&r.add("doc.render.thumbnail"),r.has("doc.annotate.modify")&&r.add("doc.annotate.read"),r.has("doc.forms.modify")&&(r.add("doc.forms.fill"),r.add("doc.forms.read")),r.has("doc.forms.fill")&&r.add("doc.forms.read"),i&&r.add("doc.annotate.read"),o&&r.add("doc.forms.read"),iR(n)))r.delete(e);return r}function iK(e,t,n,r){if(t===n)return!0;let i=r.map(iB);if(i.some(e=>"wildcard"===e.kind))return!0;for(let n of i)if("collab"===n.kind&&n.entity===e&&("set-group"===n.action||"*"===n.action)&&("all"===n.filter.kind||"group"===n.filter.kind&&n.filter.groupId===t))return!0;return!1}function iZ(e,t,n,r=null){let i="fill"===e?"doc.forms.fill":"doc.sign";if(iR(r).has(i))return!1;let o=t.map(iB);return!!(o.some(e=>"wildcard"===e.kind)||o.some(t=>"collab"===t.kind&&"fields"===t.entity&&(t.action===e||"*"===t.action)))||iH(o,n,r).has(i)}var iJ={left:0,bottom:0,right:612,top:792},iQ={left:0,right:0,bottom:0,top:0};function iX(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));return e[6]=15&e[6]|64,e[8]=63&e[8]|128,i0(e)}function iY(e=Date.now()){let t=globalThis.crypto.getRandomValues(new Uint8Array(16)),n=Math.max(0,Math.floor(e));for(let e=5;e>=0;e--)t[e]=n%256,n=Math.floor(n/256);return t[6]=15&t[6]|112,t[8]=63&t[8]|128,i0(t)}function i0(e){let t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function i1(e){let t,n=(t=new Map(e.pages.map(e=>[e.ref.objectNumber,e.boxes.crop])),e=>{let n=t.get(e.objectNumber);if(!n)throw new N(G.InvalidArg,`No page ${e.objectNumber} in this document`);return n});return{...e,pages:e.pages.map(e=>(function(e,t){var n;let r,{actions:i,viewports:o,...a}=e;return{...a,boxes:(r=(n=e.boxes).crop,{media:nE(n.media,r),crop:nE(n.crop,r),bleed:nE(n.bleed,r),trim:nE(n.trim,r),art:nE(n.art,r)}),...i?{actions:nJ(i,e=>nW(e,t))}:{},...o?{viewports:n0(o,e.boxes.crop)}:{}}})(e,n))}}function i3(e,t){return e.map(e=>({...e,rect:nE(e.rect,t)}))}function i2(e,t){let{actions:n,...r}=e,i=t(e.page);return{...r,...e.rect?{rect:nA(e.rect,i)}:{},...e.box?{box:nA(e.box,i)}:{},...n?{actions:nZ(n,e=>nq(e,t))}:{}}}function i6(e,t){return e.widgets?{...e,widgets:e.widgets.map(e=>i2(e,t))}:e}function i5(e,t){var n,r;return e.actions?{...e,actions:(n=e.actions,r=t,nJ(n,e=>nW(e,r)))}:e}function i4(e,t){return n6(e,t(e.page),t)}function i8(e,t){return{...e,fields:e.fields.map(e=>i5(e,t)),widgets:e.widgets.map(e=>i4(e,t))}}function i7(e,t){let{target:n,...r}=e;return void 0===n?r:{...r,target:n&&"goto"===n.kind?{...n,destination:t(n.destination)}:n}}function i9(e,t){var n;return n=e=>nW(e,t),{...e,target:e.target&&nH(e.target,n),action:e.action&&nK(e.action,n)}}function oe(e,t){return i7(e,e=>nq(e,t))}function ot(e){let{box:t,rect:n,rotation:r,...i}=e;if(void 0!==r&&![0,90,180,270].includes(r))throw new N(G.InvalidArg,`a widget turns by a quarter turn (0, 90, 180 or 270), not ${r}`,{details:{field:"rotation"}});let o=t?eJ(eH(t),r??0):n;if(!o)throw new N(G.InvalidArg,"a widget\'s placement needs its `rect` or its `box`",{details:{field:"rect"}});return{...i,rect:o,...void 0!==r?{rotation:r}:{},...t7(i.borderStyle,i.dashArray)?{dashArray:[...t8]}:{}}}var on=["certificates","ocspResponses","crls"];function or(e,t,n){let r=t;if(r>=n)return null;let i=e[r++];if((31&i)==31)for(;;){if(r>=n)return null;if((128&e[r++])==0)break}if(r>=n)return null;let o=e[r++],a=o;if(128&o){let t=127&o;if(0===t||t>4||r+t>n)return null;a=0;for(let n=0;nn?null:{constructed:(32&i)!=0,contents:r,end:s}}function oi(e){let t=new oo(e),n=t.value();if(t.skipSpaces(),!t.atEnd())throw Error(`trailing input at ${t.pos}: ${e.slice(t.pos,t.pos+20)}`);return n}var oo=class{constructor(e){this.text=e,I(this,"pos",0)}atEnd(){return this.pos>=this.text.length}skipSpaces(){for(;this.pos>",this.pos))return this.pos+=2,e;if("/"!==this.text[this.pos])throw Error(`expected a key at ${this.pos}`);let t=this.name();this.skipSpaces(),e[t]=this.value()}}stream(){let e=/^stream\\((\\d+),([0-9a-fA-F]*)\\)/.exec(this.text.slice(this.pos));if(!e)throw Error(`malformed stream signature at ${this.pos}`);this.pos+=e[0].length;let t=this.dictEntries();return{t:"stream",length:Number(e[1]),sha256:e[2].toLowerCase(),dict:t}}array(){this.expect("[");let e=[];for(;;){if(this.skipSpaces(),"]"===this.text[this.pos])return this.pos++,{t:"array",items:e};e.push(this.value())}}name(){this.expect("/");let e="";for(;this.pos"===t||"("===t||")"===t)break;if("#"===t&&/^[0-9A-Fa-f]{2}/.test(this.text.slice(this.pos+1,this.pos+3))){e+=String.fromCharCode(parseInt(this.text.slice(this.pos+1,this.pos+3),16)),this.pos+=3;continue}e+=t,this.pos++}return e}literalString(){this.expect("(");let e=1,t="";for(;this.pos",this.pos);if(e<0)throw Error("unterminated hex string");let t=this.text.slice(this.pos,e).replace(/\\s+/g,"");this.pos=e+1;let n="";for(let e=0;e`/${t} ${os(e.entries[t])}`).join("")}>>`;case"stream":return`stream(${e.length},${e.sha256})${os({t:"dict",entries:e.dict})}`;case"array":return`[${e.items.map(os).join(" ")}]`;case"ref":return`${e.num} 0 R`;case"name":return`/${function(e){let t="";for(let n of e){let e=n.charCodeAt(0);e<33||e>126||"#/[]<>(){}%".includes(n)?t+=`#${e.toString(16).toUpperCase().padStart(2,"0")}`:t+=n}return t}(e.v)}`;case"string":return`(${e.v.replace(/[\\\\()]/g,e=>`\\\\${e}`)})`;case"number":return String(e.v);case"bool":return e.v?"true":"false";case"null":return"null"}}function ol(e){return e?"dict"===e.t?e.entries:"stream"===e.t?e.dict:null:null}function ou(e,t){let n=ol(e)??{},r=ol(t)??{},i=new Set;for(let e of new Set([...Object.keys(n),...Object.keys(r)]))oa(n[e]??null,r[e]??null)||i.add(e);return i}function od(e){return e?"ref"===e.t?[e.num]:"array"===e.t?e.items.flatMap(od):[]:[]}function oc(e,t){return e.some(e=>"forbidden"===e.verdict)?"forbidden":e.some(e=>"incomplete"===e.verdict)?"indeterminate":t?"permitted":"unchanged"}function of(e){return e.find(e=>"forbidden"===e.verdict)??e.find(e=>"incomplete"===e.verdict)??e.find(e=>"permitted"===e.verdict)}var om=["old","new"],op=new Set(["Size","Prev","XRefStm","Info","ID","Root","Type","W","Index","Filter","DecodeParms","Length","Encrypt"]),oh=new Set(["Metadata","Extensions","Version","DSS","AcroForm","Perms"]),oF=new Set(["DR","DA","Q","SigFlags","NeedAppearances","Fields"]),og={annotate:new Set(["V","AS","AP","I","DA","Ff","RV","MK","Q","TU","F","Rect","BS","Opt","DV","MaxLen"]),fill:new Set(["V","AS","AP","I","RV","DA","Ff"])},o_={annotate:new Set(["AS","AP","DA","MK","Q","TU","F","Rect","BS"]),fill:new Set(["AS","AP","DA"])},oP={annotate:new Set(["V","AP","AS","Ff","TU","Lock"]),fill:new Set(["V","AP","AS","Ff"])},oD=new Set(["AP","AS"]);function ob(e){return"annotate"===e?oP.annotate:oP.fill}var oy=new Set(["identical-rewrite","orphan","xref-container","trailer"]);function ow(e){let t,n=e.changes.map(e=>{if(e.value.truncated||"xref"===e.kind||"objstm"===e.kind)return e;let t=e.present.old&&(null===e.value.old||e.read?.old==="failed"),n=e.present.new&&(null===e.value.new||e.read?.new==="failed");return t||n?{...e,value:{...e.value,truncated:!0}}:e}),{level:r,locks:i}=e.restrictions??{level:(t=iM(e.before.signatures)).judged??"annotate",locks:t.fieldLocks},o=e.levelOverride??r,a=new oS({...e,changes:n},o,i);(function(e){let t=e.input.health;if(!t)return;let n=t.old;if(n.sparseXref||n.bareReferences>0){let t=[n.sparseXref?"its cross-reference table has no entry for some object numbers below /Size":null,n.bareReferences>0?`${n.bareReferences} reachable indirect object(s) consist of a bare reference`:null].filter(e=>null!==e).join("; ");e.findings.push({rule:"base-unverifiable",verdict:"incomplete",objectNumber:0,detail:`the signed revision cannot be verified against later changes by Acrobat (${t}); no verdict is given rather than one Acrobat would contradict`})}for(let n of om)t[n].referrersComplete||e.findings.push({rule:"unexplained",verdict:"incomplete",objectNumber:0,detail:`the ${"old"===n?"older":"newer"} revision\'s reachability walk hit its budget; not every use of a changed object is known`})})(a),function(e){for(let t of e.changes)("xref"===t.kind||"objstm"===t.kind)&&(e.claimAll(t,"xref-container"),e.permitted(t,"xref-container","cross-reference container; members are judged on their own"))}(a),function(e){for(let t of e.changes)e.isIdentical(t)&&(e.allows("fill")?(e.claimAll(t,"identical-rewrite"),e.permitted(t,"identical-rewrite","written again with the sealed value")):(e.claimAll(t,"identical-rewrite",!1),e.forbidden(t,"identical-rewrite",`written again with the sealed value under level \'${e.level}\' (not established for this level)`)))}(a),a.allows("fill")?(function(e){if(0===e.locks.length)return;let t=e.input.before.fields.filter(t=>e.locks.some(e=>ij(e.spec,t.name))),n=new Set;for(let e of t)for(let t of(n.add(e.objectNumber),e.widgets))n.add(t);let r=new Set(n),i=!0;for(;i;)for(let t of(i=!1,e.changes))!r.has(t.objectNumber)&&t.usage.old.length>0&&t.usage.old.every(e=>r.has(e.parent))&&(r.add(t.objectNumber),i=!0);for(let n of e.changes){if(!r.has(n.objectNumber)||e.isIdentical(n))continue;let i=t.find(e=>e.objectNumber===n.objectNumber||e.widgets.includes(n.objectNumber));if(i&&i.objectNumber===n.objectNumber){let t=ou(n.value.old,n.value.new);if(1===t.size&&t.has("Ff")&&oj(n,e.before.fieldByObj.get(n.objectNumber)?.flags)){e.claimStable(n,"field-lock"),e.permitted(n,"field-lock",`ReadOnly set on locked field "${i.name}"`);continue}}e.locked.add(n.objectNumber),e.forbidden(n,"field-lock",i?`field "${i.name}" is locked by the signature`:"part of a locked field changed")}}(a),ok(a),function(e){for(let t of e.changes)!e.isIdentical(t)&&0!==t.objectNumber&&ox(t,e=>0===e.parent&&"Info"===e.label)&&(e.claimAll(t,"info"),e.permitted(t,"info","document information dictionary"))}(a),function(e){let t=new Set([e.input.before.root,e.input.after.root]);for(let n of e.changes)!e.isIdentical(n)&&ox(n,e=>t.has(e.parent)&&"Metadata"===e.label)&&(e.claimAll(n,"metadata"),e.permitted(n,"metadata","XMP metadata stream"))}(a),function(e){let t=e.input.after.root,n=e.byNum.get(t);if(!n||e.isIdentical(n))return;let r=ou(n.value.old,n.value.new),i=[...r].filter(e=>!oh.has(e));if(i.length>0)return e.forbidden(n,"catalog-housekeeping",`catalog keys changed: ${i.join(", ")}`);if(r.has("AcroForm")&&!e.input.after.acroForm&&!e.input.before.acroForm){let r=oG(e,ol(n.value.old)?.AcroForm??null,ol(n.value.new)?.AcroForm??null);if(r)return e.forbidden(n,"acroform-housekeeping",r);for(let n of om)e.claimSubtree(n,new Set([t]),e=>e.startsWith("AcroForm/DR/"),"acroform-housekeeping")}if(r.has("Perms")){let t=iM(e.input.after.signatures),r=iM(e.input.before.signatures);if(!t.certification||null!==r.judged)return e.forbidden(n,"catalog-housekeeping","/Perms may only appear with the certification signature, in the first signed revision")}e.claimAll(n,"catalog-housekeeping"),e.permitted(n,"catalog-housekeeping")}(a),function(e){let t=e.input.after.acroForm||e.input.before.acroForm;if(!t)return;let n=e.byNum.get(t);if(!n||e.isIdentical(n))return;let r=oG(e,n.value.old,n.value.new);if(r)return e.forbidden(n,"acroform-housekeeping",r);for(let r of(e.claimAll(n,"acroform-housekeeping"),e.permitted(n,"acroform-housekeeping"),om))e.claimSubtree(r,new Set([t]),e=>e.startsWith("DR/"),"acroform-housekeeping")}(a),function(e){let t=new Set([e.input.before.root,e.input.after.root]);for(let n of om)e.claimSubtree(n,t,e=>"DSS"===e||e.startsWith("DSS/"),"dss");for(let n of e.changes)n.usage.new.some(e=>t.has(e.parent)&&"DSS"===e.label)&&!e.findings.some(e=>e.objectNumber===n.objectNumber)&&e.permitted(n,"dss","document security store")}(a),function(e){let t=oC(e);if(0===t.size)return;let n="signature-field-added";if(!e.allows("fill")){for(let r of t){let t=e.byNum.get(r);t&&e.forbidden(t,n,`a signature field was added under level \'${e.level}\'`)}return}let r=new Set;for(let i of t){let t=e.after.fieldByObj.get(i),o=e.byNum.get(i);for(let a of(o&&(e.claimAll(o,n),e.permitted(o,n,`new signature field "${t.name}"`)),t.widgets)){if(r.add(a),a===i)continue;let o=e.byNum.get(a);o&&(e.claimAll(o,n),e.permitted(o,n,`widget of new signature field "${t.name}"`))}}let i=oO(e);for(let t of e.after.pages){let o=e.byNum.get(t);if(!o||e.isIdentical(o))continue;let a=ou(o.value.old,o.value.new);if(1!==a.size||!a.has("Annots"))continue;let s=oI(e,i,o,"old"),l=oI(e,i,o,"new");if(!s||!l)continue;let u=oN(s.refs,l.refs);if(!u||!u.every(e=>r.has(e))||s.object!==l.object&&0===u.length)continue;e.claimAll(o,n),e.permitted(o,n,"page /Annots gained the new signature widget");let d=0!==s.object&&0!==l.object;for(let t of new Set([s.holder,l.holder]))t&&(e.claimAll(t,n),e.permitted(t,n,d?"page /Annots moved to another list object, with the new signature widget":"page /Annots moved into an object of its own, with the new signature widget"))}for(let t of i.keys()){let i=e.byNum.get(t);if("modified"!==i.change||e.isIdentical(i))continue;let o=oN(od(i.value.old),od(i.value.new));o&&o.length>0&&o.every(e=>r.has(e))&&(e.claimAll(i,n),e.permitted(i,n,"page /Annots, an object of its own, gained the new signature widget"))}for(let i of e.changes){if("dictionary"!==i.kind||e.isIdentical(i))continue;let o=ou(i.value.old,i.value.new);if(1!==o.size||!o.has("Kids"))continue;let a=function(e,t){let n=ol(e.value.old)?.[t],r=ol(e.value.new)?.[t],i=od(n),o=od(r);if(n&&"array"!==n.t||!r||"array"!==r.t||i.length>o.length)return null;for(let e=0;e0&&a.every(e=>t.has(e)||r.has(e))&&(e.claimAll(i,n),e.permitted(i,n,"field /Kids gained the new signature field"))}}(a),function(e){let t="signature-added",n=e.newlySigned();if(0===n.length)return;let r=oC(e),i=iM(e.input.before.signatures),o=iM(e.input.after.signatures),a=new Set,s=new Set;for(let{fieldObjectNumber:o,sig:l}of n){let n="timestamp"===l.kind?"lta":"fill";if(!e.allows(n)){let n=e.byNum.get(o);n&&e.forbidden(n,t,`a ${l.kind} was added under level \'${e.level}\'`);continue}if(l.catalogCertification&&null!==i.judged){let n=e.byNum.get(o);n&&e.forbidden(n,t,"a certification signature after another signature");continue}let u=e.after.fieldByObj.get(o);for(let e of(a.add(o),u?.widgets??[]))a.add(e);let d=r.has(o),c=null===i.judged?new Set([...ob(e.level),"Lock"]):ob(e.level),f=e.byNum.get(o);if(f&&d)e.permitted(f,t,`new field "${l.fieldName}" signed`);else if(f&&!e.isIdentical(f)){let n=ou(f.value.old,f.value.new),r=[...n].filter(e=>!c.has(e));r.length>0?(e.forbidden(f,t,`signature field keys changed: ${r.join(", ")}`),e.claimStable(f,t,!1)):n.has("Ff")&&!oj(f,e.before.fieldByObj.get(o)?.flags)?(e.forbidden(f,t,"signature field flags changed beyond ReadOnly"),e.claimStable(f,t,!1)):(e.claimStable(f,t),e.permitted(f,t,`field "${l.fieldName}" signed`))}for(let n of u?.widgets??[]){if(n===o||d)continue;let r=e.byNum.get(n);if(!r||e.isIdentical(r))continue;let i=[...ou(r.value.old,r.value.new)].filter(e=>!oD.has(e));if(i.length>0){e.forbidden(r,t,`signature widget keys changed: ${i.join(", ")}`),e.claimStable(r,t,!1);continue}e.claimStable(r,t),e.permitted(r,t,"signature widget appearance")}for(let n of e.changes){if("added"!==n.change)continue;let r=n.usage.new.filter(e=>e.parent===o&&"V"===e.label),i=n.usage.new.filter(e=>e.parent===o&&"Lock"===e.label),a=ol(n.value.new)?.Type;if(r.length>0){if((a?.t!=="name"||"Sig"!==a.v&&"DocTimeStamp"!==a.v)&&void 0!==a)continue;for(let r of n.usage.new)(r.parent===o&&"V"===r.label||"DocMDP"===r.label)&&e.claimEdge(n,"new",r,t);e.permitted(n,t,"signature value"),s.add(n.objectNumber)}else if(i.length>0){if(void 0!==a&&("name"!==a.t||"SigFieldLock"!==a.v))continue;for(let r of i)e.claimEdge(n,"new",r,t);e.permitted(n,t,"field lock installed with the signature")}}}if(o.certification&&null===i.judged){let n=e.input.after.root;for(let r of e.changes)"added"===r.change&&ox(r,e=>e.parent===n&&"Perms"===e.label)&&(e.claimAll(r,t),e.permitted(r,t,"certification permissions"))}for(let n of om)e.claimSubtree(n,a,e=>"AP"===e||e.startsWith("AP/"),t);s.size>0&&e.claimSubtree("new",s,()=>!0,t)}(a),function(e){let t="signature-appearance",n=e=>"AP"===e||e.startsWith("AP/"),r=new Set;for(let[n,i]of e.before.fieldByObj){let o=e.after.fieldByObj.get(n);if("signature"!==i.kind||o?.kind!=="signature"||e.before.signedFields.has(n)||e.after.signedFields.has(n))continue;let a=new Set([n,...i.widgets]);if(o.widgets.length!==i.widgets.length||o.widgets.some(e=>!a.has(e)))continue;let s=[...a].map(t=>e.byNum.get(t)).filter(t=>void 0!==t&&!e.isIdentical(t));if(0===s.length||s.some(t=>e.locked.has(t.objectNumber)))continue;let l=e=>[...ou(e.value.old,e.value.new)].filter(e=>"AP"!==e);if(s.some(e=>l(e).length>0)){for(let n of s){let r=l(n);0!==r.length&&(e.forbidden(n,t,`signature field "${i.name}", not signed, keys changed: ${r.join(", ")}`),e.claimStable(n,t,!1))}continue}for(let n of s)e.claimStable(n,t),e.permitted(n,t,`new appearance on signature field "${i.name}", not signed`);for(let e of a)r.add(e)}0!==r.size&&(e.claimSubtree("new",r,n,t,e=>"added"===e.change),e.claimSubtree("old",r,n,t,e=>"freed"===e.change))}(a),function(e){let t="form-fill",n="annotate"===e.level?og.annotate:og.fill,r="annotate"===e.level?o_.annotate:o_.fill,i=new Set,o=new Set;for(let[a,s]of new Map([...e.before.fieldByObj,...e.after.fieldByObj])){if("signature"===s.kind)continue;let l="pushbutton"===s.kind,u=e=>l&&function(e){let t=ol(e.value.old)?.MK??null,n=ol(e.value.new)?.MK??null;if(t&&"dict"!==t.t||n&&"dict"!==n.t)return!1;let r=ou(t,n);return r.size>0&&[...r].every(e=>"I"===e)}(e),d=e.byNum.get(a),c=s.widgets.filter(e=>e!==a).map(t=>e.byNum.get(t)).filter(Boolean),f=new Set([a,...s.widgets]),m=d||0!==c.length?[]:e.changes.filter(e=>om.some(t=>e.usage[t].some(e=>f.has(e.parent)&&oR(e.label)))&&om.every(t=>e.usage[t].every(e=>!oR(e.label)||f.has(e.parent))));if(!d&&0===c.length&&0===m.length)continue;if(!e.allows("fill")){for(let n of[d,...c,...m])n&&!e.isIdentical(n)&&e.forbidden(n,t,`form fill under level \'${e.level}\'`);continue}if(m.length>0){for(let n of m)e.permitted(n,t,`appearance of field "${s.name}" regenerated`);for(let e of(i.add(a),s.widgets))i.add(e);continue}let p=!0;if(d&&!e.isIdentical(d)){let r=ou(d.value.old,d.value.new),i=r.has("MK")&&u(d),o=[...r].filter(e=>!n.has(e)&&!("MK"===e&&i));if(o.length>0)e.forbidden(d,t,`field "${s.name}" keys changed: ${o.join(", ")}`),e.claimStable(d,t,!1),p=!1;else if(r.has("Ff")&&!oj(d,e.before.fieldByObj.get(a)?.flags))e.forbidden(d,t,`field "${s.name}" flags changed beyond adding ReadOnly`),e.claimStable(d,t,!1),p=!1;else{e.claimStable(d,t);let n=[...r].filter(e=>"V"!==e&&"AP"!==e&&"AS"!==e&&"I"!==e&&"RV"!==e&&!("MK"===e&&i));e.permitted(d,t,n.length>0?`field "${s.name}" ${r.has("V")||r.has("AS")?"filled, ":""}properties changed: ${n.join(", ")}`:i?`push button "${s.name}" image changed`:`field "${s.name}" filled`)}}for(let n of c){if(e.isIdentical(n))continue;let i=ou(n.value.old,n.value.new),o=i.has("MK")&&u(n),a=[...i].filter(e=>!r.has(e)&&!("MK"===e&&o));if(a.length>0){e.forbidden(n,t,`widget of "${s.name}" keys changed: ${a.join(", ")}`),e.claimStable(n,t,!1),p=!1;continue}e.claimStable(n,t),e.permitted(n,t,`widget of "${s.name}" ${o?"image":"appearance"}`)}if(p){for(let e of(i.add(a),s.widgets))i.add(e);if(l)for(let e of(o.add(a),s.widgets))o.add(e)}}for(let n of om)e.claimSubtree(n,i,(e,t)=>oR(e)||o.has(t)&&oM(e),t)}(a),function(e){let t="annotation",n=new Set([...e.before.pages,...e.after.pages]),r=new Set([...e.before.widgetToField.keys(),...e.after.widgetToField.keys()]),i=e=>{if(r.has(e.objectNumber))return!0;let t=ol(e.value.new??e.value.old)?.Subtype;return t?.t==="name"&&"Widget"===t.v},o=oO(e),a=[];for(let t of e.changes)"dictionary"!==t.kind||e.isIdentical(t)||[...t.usage.old,...t.usage.new].some(e=>n.has(e.parent)&&e.label.startsWith("Annots/")||o.has(e.parent)&&/^\\[\\d+\\]$/.test(e.label))&&!i(t)&&a.push(t);if(a.length,!e.allows("annotate")){for(let n of a)e.forbidden(n,t,`annotation change under level \'${e.level}\'`);return}let s=new Set;for(let n of a)e.claimAll(n,t),e.permitted(n,t,`${n.change} annotation`),s.add(n.objectNumber);for(let i of n){let n=e.byNum.get(i);if(!n||e.isIdentical(n)||e.findings.some(e=>e.objectNumber===i&&"signature-field-added"===e.rule&&"permitted"===e.verdict))continue;let a=ou(n.value.old,n.value.new);if(1===a.size&&a.has("Annots")){let i=oI(e,o,n,"old"),a=oI(e,o,n,"new"),s=[i?.holder,a?.holder].filter(e=>null!=e);if(!i||!a){for(let r of(e.claimAll(n,t,!1),s))e.claimAll(r,t,!1);e.forbidden(n,t,"page /Annots points at a list object this revision did not write, and that list could not be read: what it held cannot be compared");continue}if("widget"===oT(e,r,i.refs,a.refs)){e.forbidden(n,t,"page /Annots added or removed a form widget");continue}for(let r of(e.claimAll(n,t),e.permitted(n,t,"page /Annots changed"),s))e.claimAll(r,t),e.permitted(r,t,"page /Annots, an object of its own, changed")}}for(let n of o.keys()){let i=e.byNum.get(n);if(!("modified"!==i.change||e.isIdentical(i))&&!e.findings.some(e=>e.objectNumber===n&&"permitted"===e.verdict)){if("widget"===oT(e,r,od(i.value.old),od(i.value.new))){e.forbidden(i,t,"page /Annots added or removed a form widget");continue}e.claimAll(i,t),e.permitted(i,t,"page /Annots, an object of its own, changed")}}for(let n of om)e.claimSubtree(n,s,e=>"AP"===e||e.startsWith("AP/")||"Popup"===e||"IRT"===e,t)}(a)):(ok(a),function(e){let t="no-changes-certification";for(let n of e.changes)0!==n.objectNumber&&"xref"!==n.kind&&"objstm"!==n.kind&&(e.isIdentical(n)||(e.claimAll(n,t,!1),e.forbidden(n,t,`${n.change} after a certification that allows no changes: Acrobat reports the certification as altered (ISO 32000-2 allows validation data and document timestamps here, Acrobat does not)`)))}(a)),function(e){for(let t of e.changes){if(t.value.truncated){e.findings.push({rule:"unexplained",verdict:"incomplete",objectNumber:t.objectNumber,detail:"value too large to inspect"});continue}if(t.usageIncomplete){e.findings.push({rule:"unexplained",verdict:"incomplete",objectNumber:t.objectNumber,detail:"references could not be resolved within budget (depth, fan-out or total reads)"});continue}if(!e.locked.has(t.objectNumber)){for(let n of om)for(let r of t.usage[n])e.isClaimed(t,n,r)||e.forbidden(t,"unexplained",`${"old"===n?"was":"is"} referenced from object ${r.parent} at ${r.label} and no rule explains it`,r);0!==t.usage.old.length||0!==t.usage.new.length||e.findings.some(e=>e.objectNumber===t.objectNumber)||e.permitted(t,"orphan","referenced from nowhere reachable")}}}(a);let s=oc(a.findings,a.findings.some(e=>"permitted"===e.verdict&&!oy.has(e.rule)));return{older:e.older,newer:e.newer,levelInForce:o,locks:i,verdict:s,findings:a.findings,changes:n}}function oE(e){return"modified"===e.change&&!e.value.truncated&&e.read?.old!=="failed"&&e.read?.new!=="failed"&&null!==e.raw.old&&null!==e.raw.new&&e.raw.old===e.raw.new&&!e.streamDataChanged}function oA(e){let t=new Map,n=new Map,r=new Set;for(let i of e.fields)for(let e of(t.set(i.objectNumber,i),"signature"===i.kind&&r.add(i.objectNumber),i.widgets))n.set(e,i.objectNumber);let i=new Set;for(let t of e.signatures)t.signed&&"objectNumber"===t.field.kind&&i.add(t.field.objectNumber);return{fieldByObj:t,widgetToField:n,pages:new Set(e.pages),signedFields:i,sigFields:r}}function ov(e){return`${e.parent}:${e.label}`}var oS=class{constructor(e,t,n){for(let r of(this.input=e,this.level=t,this.locks=n,I(this,"findings",[]),I(this,"byNum",new Map),I(this,"unwritten",new Map),I(this,"before",void 0),I(this,"after",void 0),I(this,"claims",new Map),I(this,"locked",new Set),e.changes))this.byNum.set(r.objectNumber,r);for(let t of e.unwritten??[])this.byNum.has(t.objectNumber)||this.unwritten.set(t.objectNumber,t);this.before=oA(e.before),this.after=oA(e.after)}get changes(){return this.input.changes}allows(e){return iN(this.level,e)}claimEdge(e,t,n,r,i=!0){if(this.locked.has(e.objectNumber))return;let o=`${e.objectNumber}:${t}:${ov(n)}`;this.claims.has(o)||this.claims.set(o,{rule:r,allow:i})}claimAll(e,t,n=!0){for(let r of om)for(let i of e.usage[r])this.claimEdge(e,r,i,t,n)}claimStable(e,t,n=!0){let r=new Set(e.usage.old.map(ov)),i=new Set(e.usage.new.map(ov));for(let r of e.usage.old)i.has(ov(r))&&this.claimEdge(e,"old",r,t,n);for(let i of e.usage.new)r.has(ov(i))&&this.claimEdge(e,"new",i,t,n)}isClaimed(e,t,n){return this.claims.has(`${e.objectNumber}:${t}:${ov(n)}`)}isAllowed(e,t,n){return this.claims.get(`${e.objectNumber}:${t}:${ov(n)}`)?.allow===!0}permitted(e,t,n){this.locked.has(e.objectNumber)||this.findings.push({rule:t,verdict:"permitted",objectNumber:e.objectNumber,detail:n})}forbidden(e,t,n,r){this.findings.push({rule:t,verdict:e.value.truncated?"incomplete":"forbidden",objectNumber:e.objectNumber,edge:r?ov(r):void 0,detail:e.value.truncated?`${n} (judged on missing evidence: not proven)`:n})}claimSubtree(e,t,n,r,i=()=>!0){let o=new Set,a=!0;for(;a;)for(let s of(a=!1,this.changes)){if(t.has(s.objectNumber)||o.has(s.objectNumber)||this.locked.has(s.objectNumber)||!i(s))continue;let l=s.usage[e];if(0===l.length)continue;let u=l.filter(e=>t.has(e.parent)&&n(e.label,e.parent)||o.has(e.parent));if(0!==u.length){for(let t of u)this.claimEdge(s,e,t,r);l.every(t=>u.includes(t)||this.isAllowed(s,e,t))&&(o.add(s.objectNumber),a=!0)}}}isIdentical(e){return oE(e)}newlySigned(){let e=[];for(let t of this.input.after.signatures)t.signed&&"objectNumber"===t.field.kind&&(this.before.signedFields.has(t.field.objectNumber)||e.push({fieldObjectNumber:t.field.objectNumber,sig:t}));return e}};function ok(e){let t=e.byNum.get(0);if(!t)return;let n=ou(t.value.old,t.value.new),r=[...n].filter(e=>!op.has(e)),i=ol(t.value.old)?.Root,o=ol(t.value.new)?.Root;r.length>0?e.forbidden(t,"trailer",`trailer keys changed: ${r.join(", ")}`):n.has("Root")&&!oa(i??null,o??null)?e.forbidden(t,"trailer","the trailer points at a different catalog"):n.has("Encrypt")&&!oa(ol(t.value.old)?.Encrypt??null,ol(t.value.new)?.Encrypt??null)?e.forbidden(t,"trailer","the trailer points at a different encryption dictionary"):(e.claimAll(t,"trailer"),e.permitted(t,"trailer"))}function ox(e,t){let n=[...e.usage.old,...e.usage.new];return n.length>0&&n.every(t)}function oG(e,t,n){let r=ou(t,n),i=[...r].filter(e=>!oF.has(e));if(i.length>0)return`AcroForm keys changed: ${i.join(", ")}`;if(r.has("Fields")){let r=od(ol(t)?.Fields),i=od(ol(n)?.Fields);if(r.length>i.length||r.some((e,t)=>i[t]!==e))return"/AcroForm /Fields is not append-only";let o=oC(e),a=i.slice(r.length).filter(e=>!o.has(e));if(a.length>0)return`/AcroForm /Fields gained non-signature fields: ${a.join(", ")}`}return null}function oO(e){let t=new Set([...e.before.pages,...e.after.pages]),n=new Map;for(let r of e.changes){if("array"!==r.kind||r.value.truncated)continue;let e=[...r.usage.old,...r.usage.new];0!==e.length&&e.every(e=>t.has(e.parent)&&"Annots"===e.label)&&1===new Set(e.map(e=>e.parent)).size&&[r.value.old,r.value.new].every(e=>null===e||"array"===e.t&&od(e).length===e.items.length)&&n.set(r.objectNumber,e[0].parent)}return n}function oI(e,t,n,r){let i=ol(n.value[r])?.Annots;if(!i)return{refs:[],object:0,holder:null};if("array"===i.t)return{refs:od(i),object:0,holder:null};if("ref"!==i.t)return null;let o=e.byNum.get(i.num);if(!o){let t=e.unwritten.get(i.num);if(!t||"ok"!==t.read||t.value?.t!=="array")return null;let n=od(t.value);return n.length!==t.value.items.length?null:{refs:n,object:i.num,holder:null}}if(t.get(o.objectNumber)!==n.objectNumber)return null;let a=o.value[r];return a?{refs:od(a),object:o.objectNumber,holder:o}:null}function oN(e,t){if(e.length>t.length)return null;for(let n=0;n"MK/I"===e||e.startsWith("MK/I/"),oR=e=>"AP"===e||e.startsWith("AP/");function oT(e,t,n,r){return[...n.filter(e=>!r.includes(e)),...r.filter(e=>!n.includes(e))].some(n=>t.has(n)&&!e.findings.some(e=>e.objectNumber===n&&"permitted"===e.verdict))?"widget":"annotations"}var oB={maxDepth:16,maxEdgesPerObject:256,maxReads:2e4},oL="incomplete",o$=class{constructor(e,t,n=oB){this.read=e,this.anchors=t,this.budget=n,I(this,"referrers",new Map),I(this,"resolved",new Map),I(this,"reads",0),I(this,"exhausted",!1)}resolve(e){if(!this.resolved.has(e)){for(let t of this.componentsAbove(e)??[])if(!this.resolveComponent(t))break}return this.resolved.get(e)??"incomplete"}readReferrers(e){let t=this.referrers.get(e);if(t)return t;if(this.exhausted||this.reads>=this.budget.maxReads)return this.exhausted=!0,null;this.reads+=1;let n=this.read(e);return this.referrers.set(e,n),n}pendingParents(e){let t=new Set;for(let n of e)this.anchors.has(n.parent)||this.resolved.has(n.parent)||t.add(n.parent);return[...t]}componentsAbove(e){let t=new Map,n=new Map,r=[],i=new Set,o=[],a=[],s=e=>{let a=this.readReferrers(e);return!!a&&(t.set(e,t.size),n.set(e,t.get(e)),r.push(e),i.add(e),o.push({node:e,parents:this.pendingParents(a),next:0}),!0)};if(!s(e))return null;for(;o.length>0;){let e=o[o.length-1];if(e.next0){let e=o[o.length-1].node;n.set(e,Math.min(n.get(e),n.get(l)))}if(n.get(l)===t.get(l)){let e,t=[];do e=r.pop(),i.delete(e),t.push(e);while(e!==l)a.push(t)}}return a}resolveComponent(e){let t=new Set(e),n=1===e.length?this.edgesOfSingle(e[0]):this.edgesOfLoop(e,t);if(!n){for(let t of e)this.resolved.set(t,null);return!1}for(let t of e)this.resolved.set(t,n.get(t));return!0}edgesOfSingle(e){let t=[];for(let n of this.referrers.get(e)){if(n.parent===e)continue;let r=this.through(n);if(!r)return null;t.push(...r)}let n=oV(t);return n.length>this.budget.maxEdgesPerObject?null:new Map([[e,n]])}edgesOfLoop(e,t){let n=new Map,r=new Map;for(let i of e){let e=[];for(let n of this.referrers.get(i)){if(t.has(n.parent))continue;let o=this.through(n);if(!o)return null;for(let t of o){e.push(t);let n=[...t.via??[],i];if(n.length>=this.budget.maxDepth)return null;let o={parent:t.parent,label:`${t.label}/\\u2026`,via:n},a=r.get(oz(o));a?1===a.length&&oU(a[0])!==i&&a.push(o):r.set(oz(o),[o])}if(e.length>this.budget.maxEdgesPerObject)return null}e.length>0&&n.set(i,oV(e))}if(r.size>this.budget.maxEdgesPerObject)return null;let i=new Map,o=[...r.values()].map(e=>e[0]);for(let t of e){let e=n.get(t);if(!e){i.set(t,o);continue}let a=[];for(let e of r.values()){let n=e.find(e=>oU(e)!==t);n&&a.push(n)}let s=[...e,...a];if(s.length>this.budget.maxEdgesPerObject)return null;i.set(t,s)}return i}through(e){if(this.anchors.has(e.parent))return[e];let t=this.resolved.get(e.parent);if(!t)return null;let n=[];for(let r of t){let t=[...r.via??[],e.parent];if(t.length>=this.budget.maxDepth)return null;n.push({parent:r.parent,label:`${r.label}/${e.label}`,via:t})}return n}};function oz(e){return`${e.parent}:${e.label}`}function oU(e){return e.via[e.via.length-1]}function oV(e){let t=new Set;return e.filter(e=>{if(!e.label.includes("\\u2026"))return!0;let n=oz(e);return!t.has(n)&&(t.add(n),!0)})}var oW=/\\s/,oq=/\\s/g,oH=(e,t)=>{let n=e.charCodeAt(t);return n>=56320&&n<=57343},oK=new Set([G.InvalidArg,G.NotFound,G.Forbidden,G.ProtectedDocument,G.MalformedPdf,G.PayloadTooLarge,G.ObjectNumberUnavailable,G.LayerFull,G.ChangeConflict,G.UndoUnavailable]);function oZ(e){let t=function e(t){if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){let e=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return JSON.stringify({$bytes:`${e.byteLength.toString(36)}-${function(e){let t=0xdeadbeef,n=0x41c6ce57;for(let r of e)t=Math.imul(t^r,0x9e3779b1),n=Math.imul(n^r,0x5f356495);return oJ(t,n)}(e)}`})}return Array.isArray(t)?`[${t.map(e).join(",")}]`:null!==t&&"object"==typeof t?`{${Object.entries(t).filter(([,e])=>void 0!==e).sort(([e],[t])=>et)).map(([t,n])=>`${JSON.stringify(t)}:${e(n)}`).join(",")}}`:JSON.stringify(t)??"null"}(e);return`${t.length.toString(36)}-${function(e){let t=0xdeadbeef,n=0x41c6ce57;for(let r=0;r>>16,0x85ebca6b)^Math.imul(t^t>>>13,0xc2b2ae35),(0x100000000*(2097151&(t=Math.imul(t^t>>>16,0x85ebca6b)^Math.imul(e^e>>>13,0xc2b2ae35)))+(e>>>0)).toString(36)}function oQ(e,t){oY(e,t);let{grants:n,protection:r}=e;if(n&&!iW(t,n.scope,n.permissionFlags,r))throw new na(t,"target")}function oX(e,t){let{grants:n,protection:r}=e;return!(r&&iR(r).has(t))&&(!n||iW(t,n.scope,n.permissionFlags,r))}function oY(e,t){let{protection:n}=e;if(n&&iR(n).has(t))throw new N(G.ProtectedDocument,`the document is signed: ${n.certification?`certification signature ${n.certification.signatureIndex} (permission ${n.certification.permission})`:`an existing signature (declared level \'${n.enforced??"none declared"}\')`} forbids \'${t}\'`)}function o0(e){return"widget"===e?"doc.forms.modify":"doc.annotate.modify"}function o1(e){return[...new Set(e.map(e=>o0(e.subtype)))]}function o3(e,t){let{identity:n,grants:r}=e;if(r&&!iW("doc.forms.modify",r.scope,r.permissionFlags))throw new na("doc.forms.modify","target");if("string"==typeof t)throw new N(G.InvalidArg,"a widget has no group of its own: a form field\'s group is the field\'s");let i={...void 0!==n.userId?{userId:n.userId}:{},...void 0!==n.displayName?{displayName:n.displayName}:{}};return i.userId||i.displayName?i:void 0}function o2(e,t,n){if("widget"===t)return o3(e,n);let{identity:r,grants:i}=e;if(null===n&&void 0!==r.groupId)throw new N(G.InvalidArg,"your annotations have a group: leave groupId out for your own, or name another",{details:{field:"groupId"}});let o=void 0===n?r.groupId:n??void 0;if(i){if(void 0!==o&&!iK("annotations",o,r.groupId,i.scope))throw new na(`annotations:set-group:group=${o}`,"target");if(!iq("create",iV({userId:r.userId,groupId:o}),i.scope,r,i.permissionFlags))throw new na("annotations:create","target")}let a={...void 0!==r.userId?{userId:r.userId}:{},...void 0!==o?{groupId:o}:{},...void 0!==r.displayName?{displayName:r.displayName}:{}};return a.userId||a.groupId||a.displayName?a:void 0}function o6(e,t,n){if("widget"===t.subtype)return o3(e,n);let{identity:r,grants:i}=e,o=iV(t);if(i&&!iq("update",o,i.scope,r,i.permissionFlags))throw new na("annotations:update","target");if(null===n&&void 0!==o.groupId)throw new N(G.InvalidArg,"an annotation\'s group can\'t be removed");let a="string"==typeof n&&n!==o.groupId;if(a&&i&&!iK("annotations",n,r.groupId,i.scope))throw new na(`annotations:set-group:group=${n}`,"target");let s={...void 0!==r.userId?{userId:r.userId}:{},...void 0!==r.displayName?{displayName:r.displayName}:{},...a?{groupId:n}:{}};return s.userId||s.groupId||s.displayName?s:void 0}function o5(e,t){let{identity:n,grants:r}=e;if(!r)return;let i=iW("doc.forms.modify",r.scope,r.permissionFlags),o=t.filter(e=>"widget"===e.subtype?!i:!iq("delete",iV(e),r.scope,n,r.permissionFlags));if(o.length>0)throw new na("annotations:delete","target",void 0,o.map(e=>e.ref))}function o4(e,t,n){if(oY(e,o9(n)),!o8(e,t,n)){let e="string"==typeof t||null===t?t:Y(t);throw new na(null===e?o9(n):`fields:${n}:group=${e}`,"target")}}function o8(e,t,n){let{grants:r,protection:i}=e;return!(i&&iR(i).has(o9(n)))&&(!r||function(e,t,n,r,i=null){let o=null!==t&&"object"==typeof t?t:X(t);if("anyone"===o.kind)return iZ(e,n,r,i);let a="group"===o.kind?o.groupId:null,s="fill"===e?"doc.forms.fill":"doc.sign";if(iR(i).has(s))return!1;let l=n.map(iB);if(l.some(e=>"wildcard"===e.kind))return!0;let u=l.filter(t=>"collab"===t.kind&&"fields"===t.entity&&(t.action===e||"*"===t.action));return u.length>0?u.some(e=>"all"===e.filter.kind||null!==a&&e.filter.groupId===a):iH(l,r,i).has(s)}(n,t,r.scope,r.permissionFlags,i))}function o7(e,t){if("group"===t.kind)return function(e,t){if(null===t)return;let{identity:n,grants:r}=e;if(r&&!iK("fields",t,n.groupId,r.scope))throw new na(`fields:set-group:group=${t}`,"target")}(e,t.groupId);if("unassigned"===t.kind)return;let{grants:n}=e;if(n&&!n.scope.map(iB).some(e=>"wildcard"===e.kind||"collab"===e.kind&&"fields"===e.entity&&("set-group"===e.action||"*"===e.action)&&"all"===e.filter.kind))throw new na("fields:set-group:all","target")}function o9(e){return"fill"===e?"doc.forms.fill":"doc.sign"}function ae(e,t){return"fqn"===t.kind?e.name===t.name:"objectNumber"===e.ref.kind&&e.ref.objectNumber===t.objectNumber}function at(e){if("signature"===e.kind)return{...e,valueEntry:{kind:"none"}};if(!e.noExport)return e;let t={...e,valueEntry:{kind:"none"},filledBy:null,filledByName:null,filledAt:null};switch(e.kind){case"text":case"combobox":return{...t,kind:e.kind,value:""};case"checkbox":return{...t,kind:"checkbox",checked:!1,widgets:e.widgets.map(e=>({...e,checked:!1}))};case"radio":return{...t,kind:"radio",value:"Off",widgets:e.widgets.map(e=>({...e,checked:!1}))};case"listbox":return{...t,kind:"listbox",selectedValues:[],options:e.options.map(e=>({...e,selected:!1}))};case"pushbutton":return{...t,kind:"pushbutton",hasImage:!1};default:return t}}Array.from({length:128},(e,t)=>({print:(1&t)!=0,modifyContents:(2&t)!=0,copy:(4&t)!=0,modifyAnnotations:(8&t)!=0,fillForms:(16&t)!=0,copyForAccessibility:!1,assemble:(32&t)!=0,printHighQuality:(64&t)!=0}));var an=["invisible","hidden","print","noZoom","noRotate","noView","readOnly","locked","toggleNoView","lockedContents"];function ar(e){return"scalar"===e.valueEntry.kind||"array"===e.valueEntry.kind}function ai(e){if(!eg(e.kind))return null;let t=eb(e.actions);return ev(t)?t:null}function ao(e,t,n){let r={},i=t?null:ai(e);for(let[o,a]of Object.entries(e.actions??{})){if(!a)continue;let s=U(a),l=`actions.${o}`;if(s)if(t)r[o]=s;else{if(i&&"format"===o||i&&"keystroke"===o&&function(e,t){let n=t?ew(t):null;if(null===n)return!1;let r=e_[e.kind];return"time"===e.kind?null!==eD(n,"time","",r.numberedKeystroke)||eD(n,"time",r.keystroke,"")===e.pattern:eD(n,"date",r.keystroke,r.numberedKeystroke)===e.pattern}(i,a))continue;n.push({ref:e.ref,field:l,reason:"script-not-allowed"})}else n.push({ref:e.ref,field:l,reason:"unsupported-action"})}return r}function aa(e,t){if("pushbutton"!==e.kind)return e;let n=rW(t.map(e=>e.actions));return e.takesImage===n?e:{...e,takesImage:n}}function as(e,t,n,r,i){let o={},a=!r&&"pushbutton"===e.kind&&e.takesImage&&rV(t.actions);for(let s of z){let l=t.actions?.[s];if(!l||a&&rU.includes(s))continue;let u=B(l),d=n=>i.push({ref:e.ref,widget:t.ref,field:`actions.${s}`,reason:n});u?!r&&R(u)?d("script-not-allowed"):o[s]=rL(u,n):d("unsupported-action")}let s="checkbox"===e.kind||"radio"===e.kind?e.widgets.find(e=>e.ref&&K(e.ref)===K(t.ref)):void 0,l={color:t.color,interiorColor:t.interiorColor,dashArray:t.dashArray,checkStyle:t.checkStyle,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,caption:"pushbutton"===e.kind?t.caption:null,layout:"pushbutton"===e.kind&&"caption"!==t.layout?t.layout:null};return{page:n(t.page),rect:t.rect,...t.rotation?{rotation:t.rotation}:{},strokeWidth:t.strokeWidth,borderStyle:t.borderStyle,textAlign:t.textAlign,...Object.fromEntries(Object.entries(l).filter(([,e])=>null!=e)),...s&&"exportValue"in s?{exportValue:s.exportValue}:{},...Object.keys(o).length>0?{actions:o}:{}}}function al(e){return Object.fromEntries(an.map(t=>[t,e[t]]))}function au(e,t,n,r,i){let o={name:t,readOnly:e.readOnly,required:e.required,noExport:e.noExport,...null!==e.alternateName?{alternateName:e.alternateName}:{},...null!==e.mappingName?{mappingName:e.mappingName}:{},assignment:e.assignment,...rC(e.purpose)?{purpose:e.purpose}:{},...eN(e.placeholder)?{placeholder:e.placeholder}:{},...Object.keys(n).length>0?{actions:n}:{},widgets:r},a=void 0===n.format?ai(e):null,s=a?{format:a}:{},l="none"!==e.defaultValueEntry.kind,u=e=>e.map(({label:e,value:t})=>({label:e,value:t}));switch(e.kind){case"text":return{...o,...s,kind:"text",...l?{defaultValue:e.defaultValue}:{},...null!==e.maxLength?{maxLength:e.maxLength}:{},multiline:e.multiline,password:e.password,comb:e.comb};case"radio":return{...o,kind:"radio",radiosInUnison:e.radiosInUnison,noToggleToOff:e.noToggleToOff};case"combobox":return{...o,...s,kind:"combobox",edit:e.edit,options:u(e.options),...l?{defaultValue:e.defaultValue}:{}};case"listbox":return{...o,kind:"listbox",multiSelect:e.multiSelect,options:u(e.options),...l?{defaultValue:e.defaultValue}:{}};case"pushbutton":{let t=r.every(e=>rU.every(t=>e.actions?.[t]===void 0)),n=e.takesImage&&r.length>0&&t;return{...o,kind:"pushbutton",...n?{takesImage:!0}:{}}}case"checkbox":case"signature":return{...o,kind:e.kind};default:throw new N(G.InvalidArg,`${i} has no family`)}}function ad(e){switch(e.kind){case"checkbox":return{checked:e.checked};case"listbox":return{selectedValues:e.selectedValues};case"radio":return{value:"Off"===e.value?null:e.value};case"text":case"combobox":return{value:e.value};default:return null}}function ac(e,t){if(e.has(t))return!0;for(let n of e)if(n.startsWith(`${t}.`)||t.startsWith(`${n}.`))return!0;return!1}function af(e,t){let n=e.lastIndexOf("."),r=e.slice(0,n+1),i=e.slice(n+1),o=/^(.*)_(\\d+)$/.exec(i),a=o?o[1]:i,s=o?Number(o[2])+1:2;for(;t(`${r}${a}_${s}`);)s+=1;return`${r}${a}_${s}`}function am(e,t){let n=new Set(t.widgets.flatMap(e=>e.ref?K(e.ref):[])),r=new Map;for(let t of e.widgets){let e=K(t.ref);n.has(e)&&r.set(e,t)}let i=t.widgets.flatMap(e=>{let t=e.ref?r.get(K(e.ref)):void 0;return t?[t]:[]}),o=i[0];return o?i.filter(e=>e.page.objectNumber===o.page.objectNumber):[]}var ap=e=>"pushbutton"===e.kind&&e.takesImage?"fields":"boxes",ah=e=>(e%360+360)%360;function aF(e,t,n){let r=e?.[t];if(void 0!==r&&!(n<=r))throw new N(G.PayloadTooLarge,`repeat: past the ${t} limit: ${n} > ${r}`,{details:{limit:t,max:r,value:n}})}var ag=e=>"truetype"===e||"opentype"===e,a_=e=>"installable"===e||"editable"===e;function aP(e){return"whole"===e.embedded&&ag(e.format)&&e.mapsUnicode&&a_(e.permission)}function aD(e){return null!==e.displaySha256&&(null===e.permission||a_(e.permission))}function ab(e){let t=[];return"none"===e.embedded?t.push("type3"===e.format?"unsupported-format":"not-embedded"):("subset"===e.embedded&&t.push("subset"),ag(e.format)?e.mapsUnicode||t.push("no-unicode-map"):t.push("unsupported-format"),null===e.permission||a_(e.permission)||t.push("preview-and-print")),t}function ay(e){let t=aD(e);return{displaySha256:t?e.displaySha256:null,sourceSha256:"none"===e.embedded?null:e.sha256,embedded:e.embedded,format:"none"===e.embedded?null:e.format,embeddingPermission:"restricted"===e.permission||"bitmap-only"===e.permission?"preview-and-print":e.permission,canDownload:t}}var aw=e=>aP(e)?0:aD(e)?1:"none"!==e.embedded?2:3,aE={100:"Thin",200:"ExtraLight",300:"Light",400:"",500:"Medium",600:"SemiBold",700:"Bold",800:"ExtraBold",900:"Black"};function aA(e,t){if(t)return t;let n=`${aE[e.weight]??String(e.weight)}${e.italic?"Italic":""}`;return n?`${e.familyName},${n}`:e.familyName}function av(e){let t=new Map;for(let n of e)for(let e of n.programs){if(!e.postScriptName&&""===n.familyName)continue;let r=aA(n,e.postScriptName),i=t.get(r)??[];i.some(({program:t})=>e.objectNumber>0?t.objectNumber===e.objectNumber&&t.displaySha256===e.displaySha256:0===t.objectNumber&&t.embedded===e.embedded&&t.format===e.format&&t.sha256===e.sha256)||i.push({face:n,program:e}),t.set(r,i)}return[...t].map(([e,t])=>{let n=[...t].sort((e,t)=>aw(e.program)-aw(t.program)),{familyName:r,weight:i,italic:o}=n[0].face;return{name:e,face:{familyName:r,weight:i,italic:o},programs:n.map(({program:e})=>e)}})}function aS(e){return void 0!==eW[eV(e.face.familyName)]&&e.programs.every(e=>"none"===e.embedded)}function ak(e){let t=e.programs[0];return{name:e.name,source:"document",builtIn:!1,familyName:e.face.familyName,weight:e.face.weight,italic:e.face.italic,postScriptName:t?.postScriptName??null,canChoose:!!t&&aP(t),restrictions:t?ab(t):["not-embedded"],programs:e.programs.map(ay)}}function ax(e){let{identity:t}=e,n=[];return t.editingAuthorized||n.push("preview-and-print"),e.served||n.push("not-served"),{name:e.key,source:"engine",builtIn:e.builtIn,familyName:t.familyName,weight:t.weight,italic:t.italic,postScriptName:e.postScriptName,canChoose:t.editingAuthorized,restrictions:n,programs:[{displaySha256:e.sha256,sourceSha256:e.sha256,embedded:"none",format:e.format,embeddingPermission:t.embeddingPermission,canDownload:e.served}]}}function aG(e,t){let n=av(e.faces).find(e=>e.name===t&&!aS(e));if(!n)return;let r=n.programs[0];return r?{objectNumber:r.objectNumber,choosable:aP(r)&&r.objectNumber>0,restrictions:ab(r)}:{objectNumber:0,choosable:!1,restrictions:["not-embedded"]}}var aO={elsewhere:0,near:1,visible:2};function aI(e,t){let n=aO[e.place]-aO[t.place];return 0!==n?n>0:e.pixels>t.pixels}var aN=Object.freeze([]);function aC(e,t=aN){return{payload:e,transfer:t}}var aj=[{ts:"boolean",wasm:{kind:"bool",cwrap:"boolean"},native:{kind:"bool",cwrap:"boolean"}},{ts:"Ptr",wasm:{kind:"pointer",cwrap:"number"},native:{kind:"pointer",cwrap:"bigint"}},{ts:"string",wasm:{kind:"cstring",cwrap:"string"},native:{kind:"cstring",cwrap:"string"}},{ts:"number",wasm:{kind:"i32",cwrap:"number"},native:{kind:"i32",cwrap:"number"}},{ts:"Ptr",wasm:{kind:"cstring",cwrap:"number"},native:{kind:"cstring",cwrap:"bigint"}},{ts:"number",wasm:{kind:"f32",cwrap:"number"},native:{kind:"f32",cwrap:"number"}},{ts:"Ptr",wasm:{kind:"utf16ptr",cwrap:"number"},native:{kind:"utf16ptr",cwrap:"bigint"}},{ts:"bigint",wasm:{kind:"i64",cwrap:"bigint"},native:{kind:"i64",cwrap:"bigint"}},{ts:"number",wasm:{kind:"f64",cwrap:"number"},native:{kind:"f64",cwrap:"number"}}],aM=function(e){let t={};for(let n of e.split(`\n`)){if(!n)continue;let[e,r,...i]=n.split(" ");t[e]={params:i.map(e=>aj[Number(e)]),result:"-"===r?null:aj[Number(r)]}}return t}(`\nEPDF_CheckPasswordPermissions 0 1 2 1 1 1 1\nEPDF_DigestBuffer 0 1 3 3 4 1\nEPDF_FreeBuffer - 1\nEPDF_GetDecodedImageBytes 3\nEPDF_GetMetaKeyCount 3 1 0\nEPDF_GetMetaKeyName 3 1 3 0 1 3\nEPDF_GetMetaTrapped 3 1\nEPDF_GetPageBoxByIndex 0 1 3 3 1\nEPDF_GetPageRotateByIndex 0 1 3 1\nEPDF_GetPageTabOrderByIndex 3 1 3 1 3\nEPDF_GetPageUserUnitByIndex 0 1 3 1\nEPDF_HasMetaText 0 1 2\nEPDF_InitThread -\nEPDF_IsEncrypted 0 1\nEPDF_IsOwnerUnlocked 0 1\nEPDF_LoadBaseDocument 1 1 2\nEPDF_LoadMemBaseDocument 1 1 3 2\nEPDF_LoadMemBaseDocument64 1 1 3 2\nEPDF_LoadPageNormalized 1 1 3 1\nEPDF_PNG_EncodeRGBA 3 4 3 3 3 3 4\nEPDF_ReleaseBaseDocument - 1\nEPDF_RemoveEncryption 0 1\nEPDF_RenderAnnotBitmap 0 1 1 1 3 2 1 3\nEPDF_RenderAnnotBitmapUnrotated 0 1 1 1 3 2 5 1 1 3\nEPDF_RenderPage_Continue 3 1 3\nEPDF_RenderPageBitmapWithMatrix_Start 3 1 1 1 1 3 3\nEPDF_SaveAsCopyEx 0 1 1 3 1\nEPDF_SaveDocumentToOwnedBuffer 1 1 3 1\nEPDF_SaveDocumentToOwnedBufferEx 1 1 3 3 1 1\nEPDF_SaveDocumentToOwnedBufferWithVersion 1 1 3 1 3\nEPDF_SetBaseDocumentSha256 - 1 4\nEPDF_SetDecodedImageBudget - 3\nEPDF_SetEncryption 0 1 2 2 3\nEPDF_SetMetaText 0 1 2 1\nEPDF_SetMetaTrapped 0 1 3\nEPDF_SetRuntimeOwnerPermissions 0 1 0\nEPDF_ShutdownThread -\nEPDF_UnlockOwnerPermissions 0 1 2\nEPDFAction_CloseModel - 1\nEPDFAction_CreateGoTo 1 1 1\nEPDFAction_CreateGoToNamed 1 1 2\nEPDFAction_CreateHide 1 1 1 3 0\nEPDFAction_CreateJavaScript 1 1 1\nEPDFAction_CreateLaunch 1 1 1\nEPDFAction_CreateNamed 1 1 2\nEPDFAction_CreateRemoteGoToByName 1 1 1 1\nEPDFAction_CreateRemoteGoToDest 1 1 1 1\nEPDFAction_CreateResetForm 1 1 1 3 0\nEPDFAction_CreateSubmitForm 1 1 1 1 3 3\nEPDFAction_CreateURI 1 1 2\nEPDFAction_GetNextAt 3 1 3 3\nEPDFAction_GetNextCount 3 1 3\nEPDFAction_GetNodeCount 3 1\nEPDFAction_GetNodeDest 1 1 1 3\nEPDFAction_GetNodeFilePath 3 1 3 1 3\nEPDFAction_GetNodeHideFlag 0 1 3 1\nEPDFAction_GetNodeJavaScript 3 1 3 6 3\nEPDFAction_GetNodeName 3 1 3 1 3\nEPDFAction_GetNodeResetForm 0 1 3 1 1\nEPDFAction_GetNodeSubmitForm 0 1 3 1 1\nEPDFAction_GetNodeSubmitFormCharSet 3 1 3 1 3\nEPDFAction_GetNodeSubmitFormURL 3 1 3 1 3\nEPDFAction_GetNodeSubtype 3 1 3 4 3\nEPDFAction_GetNodeTargetCount 3 1 3\nEPDFAction_GetNodeTargetName 3 1 3 3 1 3\nEPDFAction_GetNodeTargetObjectNumber 0 1 3 3 1\nEPDFAction_GetNodeType 3 1 3\nEPDFAction_GetNodeURI 3 1 1 3 1 3\nEPDFAction_GetNodeURIIsMap 0 1 3 1\nEPDFAction_GetRootNode 3 1\nEPDFAction_GetWarningFlags 3 1\nEPDFAction_IsComplete 0 1\nEPDFAction_LoadModel 1 1\nEPDFAction_NodeHasJavaScript 0 1 3\nEPDFAction_SetNext 0 1 1 1 3\nEPDFAnnot_AddMeasure 1 1\nEPDFAnnot_ClearBorderEffect 0 1\nEPDFAnnot_ClearColor 0 1 3\nEPDFAnnot_ClearEmbedMetadata 0 1\nEPDFAnnot_ClearEmbedMetadataKey 0 1 2\nEPDFAnnot_ClearMKColor 0 1 3\nEPDFAnnot_ClearMKIcon 0 1 3\nEPDFAnnot_ClearRectangleDifferences 0 1\nEPDFAnnot_ExportAppearance 1 1 5 1\nEPDFAnnot_GenerateAppearance 0 1\nEPDFAnnot_GenerateAppearanceWithBlend 0 1 3\nEPDFAnnot_GenerateFormFieldAP 0 1\nEPDFAnnot_GetActionModel 1 1 3\nEPDFAnnot_GetAPMatrix 0 1 3 1\nEPDFAnnot_GetAppearanceState 3 1 1 3\nEPDFAnnot_GetAppearanceStateCount 3 1 3\nEPDFAnnot_GetAppearanceStateName 3 1 3 3 1 3\nEPDFAnnot_GetAppearanceTransform 0 1 1 1\nEPDFAnnot_GetAvailableAppearanceModes 3 1\nEPDFAnnot_GetBlendMode 3 1\nEPDFAnnot_GetBooleanValue 0 1 2 1\nEPDFAnnot_GetBorderDashPattern 0 1 1 3\nEPDFAnnot_GetBorderDashPatternCount 3 1\nEPDFAnnot_GetBorderEffect 0 1 1\nEPDFAnnot_GetBorderStyle 3 1 1\nEPDFAnnot_GetCalloutLine 3 1 1 3\nEPDFAnnot_GetCalloutLineCount 3 1\nEPDFAnnot_GetColor 0 1 3 1 1 1\nEPDFAnnot_GetDefaultAppearance 0 1 1 1 1 1 1\nEPDFAnnot_GetDefaultAppearanceFontFace 3 1 6 3 1 1\nEPDFAnnot_GetDefaultAppearanceFontPostScriptName 3 1 4 3\nEPDFAnnot_GetDrawing 3 1\nEPDFAnnot_GetDrawingRect 0 1 3 1\nEPDFAnnot_GetEmbedMetadataBoolean 0 1 2 1\nEPDFAnnot_GetEmbedMetadataJSON 3 1 6 3\nEPDFAnnot_GetEmbedMetadataNumber 0 1 2 1\nEPDFAnnot_GetEmbedMetadataRect 0 1 2 1\nEPDFAnnot_GetEmbedMetadataString 3 1 2 6 3\nEPDFAnnot_GetFileAttachmentForWrite 1 1\nEPDFAnnot_GetIntent 3 1 6 3\nEPDFAnnot_GetLineCaption 0 1 1 1 1\nEPDFAnnot_GetLineEndings 0 1 1 1\nEPDFAnnot_GetLineLeader 0 1 1 1 1\nEPDFAnnot_GetMeasure 1 1\nEPDFAnnot_GetMKColor 0 1 3 1 1 1\nEPDFAnnot_GetMKIcon 3 1 3\nEPDFAnnot_GetMKRotation 3 1\nEPDFAnnot_GetMKText 3 1 3 6 3\nEPDFAnnot_GetMKTextPosition 3 1\nEPDFAnnot_GetName 3 1 4 3\nEPDFAnnot_GetObjectNumber 3 1\nEPDFAnnot_GetOpacity 0 1 1\nEPDFAnnot_GetOverlayText 3 1 6 3\nEPDFAnnot_GetOverlayTextRepeat 0 1\nEPDFAnnot_GetRect 0 1 1\nEPDFAnnot_GetRectangleDifferences 0 1 1 1 1 1\nEPDFAnnot_GetReplyType 3 1\nEPDFAnnot_GetRichContent 3 1 6 3\nEPDFAnnot_GetRichTextJSON 3 1 4 3\nEPDFAnnot_GetRotate 0 1 1\nEPDFAnnot_GetShapeCaption 0 1 1 1 1\nEPDFAnnot_GetStructurePosition 3 1 1 3\nEPDFAnnot_GetTextAlignment 3 1\nEPDFAnnot_HasAppearanceStream 0 1 3\nEPDFAnnot_HasEmbedMetadata 0 1\nEPDFAnnot_HasMKIcon 0 1 3\nEPDFAnnot_IsValid 0 1\nEPDFAnnot_RemoveAction 0 1\nEPDFAnnot_RemoveDest 0 1\nEPDFAnnot_RemoveKey 0 1 2\nEPDFAnnot_RemoveMeasure 0 1\nEPDFAnnot_SetAction 0 1 1\nEPDFAnnot_SetAPMatrix 0 1 3 1\nEPDFAnnot_SetAppearanceFromPage 0 1 1 3\nEPDFAnnot_SetBooleanValue 0 1 2 0\nEPDFAnnot_SetBorderDashPattern 0 1 1 3\nEPDFAnnot_SetBorderEffect 0 1 5\nEPDFAnnot_SetBorderStyle 0 1 3 5\nEPDFAnnot_SetCalloutLine 0 1 1 3\nEPDFAnnot_SetColor 0 1 3 3 3 3\nEPDFAnnot_SetDefaultAppearance 0 1 3 5 3 3 3\nEPDFAnnot_SetDefaultAppearanceDocumentFont 0 1 3 5 3 3 3\nEPDFAnnot_SetDefaultAppearanceRegisteredFont 0 1 3 5 3 3 3\nEPDFAnnot_SetDrawing 0 1 3 3\nEPDFAnnot_SetEmbedMetadataBoolean 0 1 2 0\nEPDFAnnot_SetEmbedMetadataJSON 0 1 1\nEPDFAnnot_SetEmbedMetadataNumber 0 1 2 5\nEPDFAnnot_SetEmbedMetadataRect 0 1 2 1\nEPDFAnnot_SetEmbedMetadataString 0 1 2 1\nEPDFAnnot_SetEventAction 0 1 3 1\nEPDFAnnot_SetIntent 0 1 2\nEPDFAnnot_SetLine 0 1 1 1\nEPDFAnnot_SetLineCaption 0 1 0 3 1\nEPDFAnnot_SetLineEndings 0 1 3 3\nEPDFAnnot_SetLineLeader 0 1 5 5 5\nEPDFAnnot_SetLinkedAnnot 0 1 2 1\nEPDFAnnot_SetMKColor 0 1 3 3 3 3\nEPDFAnnot_SetMKIcon 0 1 3 3\nEPDFAnnot_SetMKRotation 0 1 3\nEPDFAnnot_SetMKText 0 1 3 1\nEPDFAnnot_SetMKTextPosition 0 1 3\nEPDFAnnot_SetName 0 1 2\nEPDFAnnot_SetNoColor 0 1 3\nEPDFAnnot_SetNumberValue 0 1 2 5\nEPDFAnnot_SetOpacity 0 1 5\nEPDFAnnot_SetOverlayText 0 1 1\nEPDFAnnot_SetOverlayTextRepeat 0 1 0\nEPDFAnnot_SetRect 0 1 1\nEPDFAnnot_SetReplyType 0 1 3\nEPDFAnnot_SetRichTextJSON 0 1 2\nEPDFAnnot_SetRichTextXHTML 0 1 1\nEPDFAnnot_SetRotate 0 1 5\nEPDFAnnot_SetShapeCaption 0 1 0 1\nEPDFAnnot_SetStampOpacity 0 1 3 5\nEPDFAnnot_SetSubtype 0 1 3\nEPDFAnnot_SetTextAlignment 0 1 3\nEPDFAnnot_SetVertices 0 1 1 3\nEPDFAnnot_UpdateAppearanceToRect 0 1 3\nEPDFAttachment_ExportCanonicalToOwnedBuffer 1 1 1 1\nEPDFAttachment_ExportRawToOwnedBuffer 1 1 1 1\nEPDFAttachment_ExtractFile 0 1 1 7 1 1\nEPDFAttachment_ExtractFileToOwnedBuffer 0 1 7 1 1 1\nEPDFAttachment_GetDescription 3 1 6 3\nEPDFAttachment_GetIntegerValue 0 1 2 1\nEPDFAttachment_ImportRaw 0 1 1 3\nEPDFAttachment_SetDescription 0 1 1\nEPDFAttachment_SetName 0 1 1\nEPDFAttachment_SetSubtype 0 1 2\nEPDFCatalog_GetLanguage 3 1 1 3\nEPDFCatalog_GetMetadata 3 1 1 3\nEPDFCatalog_SetMetadata 0 1 1 3\nEPDFDest_CreateRemoteView 1 1 3 3 1 3\nEPDFDest_CreateRemoteXYZ 1 1 3 0 5 0 5 0 5\nEPDFDest_CreateView 1 1 3 1 3\nEPDFDest_CreateViewByObjectNumber 1 1 3 3 1 3\nEPDFDest_CreateXYZ 1 1 0 5 0 5 0 5\nEPDFDest_CreateXYZByObjectNumber 1 1 3 0 5 0 5 0 5\nEPDFDest_GetPageObjectNumber 3 1 1\nEPDFDest_GetViewNullParams 3 1\nEPDFDoc_CanonicalDrawing 1 1 3\nEPDFDoc_ClearMissingCharacters - 1\nEPDFDoc_ClearPagePieceInfoEntry 0 1 3 2\nEPDFDoc_ClearPagePieceInfoKey 0 1 3 2 2 1\nEPDFDoc_ClearPieceInfoEntry 0 1 2\nEPDFDoc_ClearPieceInfoKey 0 1 2 2 1\nEPDFDoc_CompareRevisions 1 1 1\nEPDFDoc_CountMissingCharacters 3 1\nEPDFDoc_DeletePageByObjectNumber 0 1 3\nEPDFDoc_ExportDictCanonicalToOwnedBuffer 1 1 3 2 2 1\nEPDFDoc_ExportDictRawToOwnedBuffer 1 1 3 2 1\nEPDFDoc_ExportDrawing 1 1 3\nEPDFDoc_ExportPagesFlattened 1 1 1 3 3 3\nEPDFDoc_GetAdditionalActionModel 1 1 3\nEPDFDoc_GetAttachmentIndexByKey 3 1 1\nEPDFDoc_GetAttachmentKey 3 1 3 6 3\nEPDFDoc_GetBaseBytesSize 7 1\nEPDFDoc_GetDrawings 3 1 1 3\nEPDFDoc_GetFontDisplayProgramCoverage 3 1 4 1 3\nEPDFDoc_GetFontDisplayProgramData 3 1 4 1 3\nEPDFDoc_GetFontEmbeddingPolicy 3 1\nEPDFDoc_GetFontProgramData 3 1 3 1 3\nEPDFDoc_GetFontsFingerprint 0 1 4\nEPDFDoc_GetImportFieldRoots 3 1 1 3 1 3\nEPDFDoc_GetLastModified 3 1 6 3\nEPDFDoc_GetLoadedBytesSize 7 1\nEPDFDoc_GetLoadedObjectValue 3 1 3 4 3 1 1\nEPDFDoc_GetMissingCharacter 3 1 3 6 3\nEPDFDoc_GetNamedJavaScriptActionModel 1 1 3\nEPDFDoc_GetNamedPageAt 3 1 3 3 6 3 1 1\nEPDFDoc_GetNamedPageCount 3 1 3\nEPDFDoc_GetOpenActionDest 1 1\nEPDFDoc_GetOpenActionModel 1 1\nEPDFDoc_GetPageActionModel 1 1 3 3\nEPDFDoc_GetPageLabelSectionAt 3 1 3 6 3 1 1 1\nEPDFDoc_GetPageLabelSectionCount 3 1\nEPDFDoc_GetPageLastModified 3 1 3 6 3\nEPDFDoc_GetPageObjectNumberByIndex 3 1 3\nEPDFDoc_GetPagePieceInfoBoolean 0 1 3 2 2 1\nEPDFDoc_GetPagePieceInfoEntryAt 3 1 3 3 4 3\nEPDFDoc_GetPagePieceInfoEntryCount 3 1 3\nEPDFDoc_GetPagePieceInfoKeyAt 3 1 3 2 3 4 3\nEPDFDoc_GetPagePieceInfoKeyCount 3 1 3 2\nEPDFDoc_GetPagePieceInfoLastModified 3 1 3 2 6 3\nEPDFDoc_GetPagePieceInfoName 3 1 3 2 2 4 3\nEPDFDoc_GetPagePieceInfoNumber 0 1 3 2 2 1\nEPDFDoc_GetPagePieceInfoString 3 1 3 2 2 6 3\nEPDFDoc_GetPagePieceInfoStringArrayAt 3 1 3 2 2 3 6 3\nEPDFDoc_GetPagePieceInfoStringArrayCount 3 1 3 2 2\nEPDFDoc_GetPagePieceInfoValueType 3 1 3 2 2\nEPDFDoc_GetPieceInfoBoolean 0 1 2 2 1\nEPDFDoc_GetPieceInfoEntryAt 3 1 3 4 3\nEPDFDoc_GetPieceInfoEntryCount 3 1\nEPDFDoc_GetPieceInfoKeyAt 3 1 2 3 4 3\nEPDFDoc_GetPieceInfoKeyCount 3 1 2\nEPDFDoc_GetPieceInfoLastModified 3 1 2 6 3\nEPDFDoc_GetPieceInfoName 3 1 2 2 4 3\nEPDFDoc_GetPieceInfoNumber 0 1 2 2 1\nEPDFDoc_GetPieceInfoString 3 1 2 2 6 3\nEPDFDoc_GetPieceInfoStringArrayAt 3 1 2 2 3 6 3\nEPDFDoc_GetPieceInfoStringArrayCount 3 1 2 2\nEPDFDoc_GetPieceInfoValueType 3 1 2 2\nEPDFDoc_GetRevision 0 1 3 1 1\nEPDFDoc_GetRevisionCount 3 1\nEPDFDoc_GetStructureObjectNumbers 0 1 1 1 1\nEPDFDoc_GetTypographicFeatures 0 1\nEPDFDoc_HasPagePieceInfoEntry 0 1 3 2\nEPDFDoc_HasPieceInfoEntry 0 1 2\nEPDFDoc_ImportDictRaw 0 1 1 3\nEPDFDoc_ImportDrawing 3 1 1\nEPDFDoc_ImportPages 0 1 1 1 3 3 1\nEPDFDoc_LoadPageByObjectNumber 1 1 3\nEPDFDoc_LoadPageByObjectNumberNormalized 1 1 3\nEPDFDoc_OpenBaseOverlay 1 1 1 3\nEPDFDoc_OpenBaseOverlayFromPath 1 1 4\nEPDFDoc_OpenRevision 1 1 7\nEPDFDoc_ReadLoadedBytes 3 1 7 1 3\nEPDFDoc_RemoveNamedPage 0 1 1\nEPDFDoc_RemoveNamedPagesForPage 3 1 3\nEPDFDoc_ResolveFonts 1 1 1 3 6 6 1 1 1\nEPDFDoc_SetFontEmbeddingPolicy 0 1 3\nEPDFDoc_SetNamedPage 0 1 1 3\nEPDFDoc_SetPageLabelSections 0 1 1 1 1 6 3\nEPDFDoc_SetPagePieceInfoBoolean 0 1 3 2 2 0 1\nEPDFDoc_SetPagePieceInfoName 0 1 3 2 2 2 1\nEPDFDoc_SetPagePieceInfoNumber 0 1 3 2 2 5 1\nEPDFDoc_SetPagePieceInfoString 0 1 3 2 2 1 1\nEPDFDoc_SetPagePieceInfoStringArray 0 1 3 2 2 6 3 1\nEPDFDoc_SetPageRotationByObjectNumber 0 1 3 3\nEPDFDoc_SetPieceInfoBoolean 0 1 2 2 0 1\nEPDFDoc_SetPieceInfoName 0 1 2 2 2 1\nEPDFDoc_SetPieceInfoNumber 0 1 2 2 5 1\nEPDFDoc_SetPieceInfoString 0 1 2 2 1 1\nEPDFDoc_SetPieceInfoStringArray 0 1 2 2 6 3 1\nEPDFDoc_SetTypographicFeatures 0 1 0\nEPDFDoc_StartLoadPageByObjectNumber 1 1 3 0\nEPDFDocument_ClearEmbedMetadata 0 1\nEPDFDss_Add 3 1 3 1 3\nEPDFDss_GetCount 3 1 3\nEPDFDss_GetData 3 1 3 3 1 3\nEPDFFont_AddFallbackFont 0 3 3\nEPDFFont_AuthorizeEditing 0 3\nEPDFFont_ClearFallbackFonts -\nEPDFFont_ClearRegisteredFonts -\nEPDFFont_GetCoverage 3 3 1 3\nEPDFFont_GetEmbeddingPermission 3 3\nEPDFFont_GetFallbackOrder 3 3 0 1 3\nEPDFFont_GetFamilyName 3 3 4 3\nEPDFFont_GetLastResortFont 3\nEPDFFont_GetMetrics 0 3 1 1\nEPDFFont_GetPostScriptName 3 3 4 3\nEPDFFont_GetProgramData 3 3 1 3\nEPDFFont_GetProgramFormat 3 3\nEPDFFont_GetProgramHash 0 3 4\nEPDFFont_GetWeight 3 3\nEPDFFont_IsEditingAuthorized 0 3\nEPDFFont_IsInstanced 0 3\nEPDFFont_IsItalic 0 3\nEPDFFont_RegisterFont 3 2 3 3 1\nEPDFFont_RegisterMemFont 3 2 3 3 1 3\nEPDFFont_RegisterMemFont64 3 2 3 3 1 3\nEPDFFont_SetLastResortFont 0 3\nEPDFFontFaces_Close - 1\nEPDFFontFaces_Count 3 1\nEPDFFontFaces_CountPrograms 3 1 3\nEPDFFontFaces_GetFamily 3 1 3 6 3\nEPDFFontFaces_GetProgramDisplayHash 0 1 3 3 4\nEPDFFontFaces_GetProgramEmbedded 3 1 3 3\nEPDFFontFaces_GetProgramEmbeddingPermission 3 1 3 3\nEPDFFontFaces_GetProgramFormat 3 1 3 3\nEPDFFontFaces_GetProgramHash 0 1 3 3 4\nEPDFFontFaces_GetProgramMetrics 0 1 3 3 1 1\nEPDFFontFaces_GetProgramObjNum 3 1 3 3\nEPDFFontFaces_GetProgramPostScriptName 3 1 3 3 4 3\nEPDFFontFaces_GetWeight 3 1 3\nEPDFFontFaces_IsItalic 0 1 3\nEPDFFontFaces_Load 1 1\nEPDFFontFaces_ProgramMapsUnicode 0 1 3 3\nEPDFFontResolution_Close - 1\nEPDFFontResolution_CountMissingCharacters 3 1\nEPDFFontResolution_GetBaseFontName 3 1 3 4 3\nEPDFFontResolution_GetFallbacks 3 1 3 1 3\nEPDFFontResolution_GetFamily 3 1 3 6 3\nEPDFFontResolution_GetMissingCharacter 3 1 3 6 3\nEPDFFontResolution_GetProgramDisplayHash 0 1 3 4\nEPDFFontResolution_GetProgramObjNum 3 1 3\nEPDFFontResolution_GetRegisteredFont 3 1 3\nEPDFFontResolution_GetSource 3 1 3\nEPDFFontResolution_GetWeight 3 1 3\nEPDFFontResolution_IsDegraded 0 1 3\nEPDFFontResolution_IsItalic 0 1 3\nEPDFForm_AttachWidget 0 1 3 3 2 1 3\nEPDFForm_ClearFieldEmbedMetadata 0 1 3\nEPDFForm_ClearFieldEmbedMetadataKey 0 1 3 2\nEPDFForm_CloseModel - 1\nEPDFForm_CountCalculationOrder 3 1\nEPDFForm_CountFieldDefaultValues 3 1 3\nEPDFForm_CountFieldOptions 3 1 3\nEPDFForm_CountFields 3 1\nEPDFForm_CountFieldValues 3 1 3\nEPDFForm_CountFieldWidgets 3 1 3\nEPDFForm_CreateField 3 1 3 1 3\nEPDFForm_DeleteField 0 1 3 1 3 1\nEPDFForm_DetachWidget 0 1 3 3\nEPDFForm_ExportFDF 3 1 1 3 1 3\nEPDFForm_ExportFieldRawToOwnedBuffer 1 1 3 1\nEPDFForm_ExportXFDF 3 1 1 3 1 3\nEPDFForm_GetCalculationOrderFieldIndex 3 1 3\nEPDFForm_GetFieldActionModel 1 1 3 3\nEPDFForm_GetFieldAlternateName 3 1 3 6 3\nEPDFForm_GetFieldDefaultValueAt 3 1 3 3 6 3\nEPDFForm_GetFieldDefaultValueKind 3 1 3\nEPDFForm_GetFieldEmbedMetadataBoolean 0 1 3 2 1\nEPDFForm_GetFieldEmbedMetadataJSON 3 1 3 6 3\nEPDFForm_GetFieldEmbedMetadataNumber 0 1 3 2 1\nEPDFForm_GetFieldEmbedMetadataString 3 1 3 2 6 3\nEPDFForm_GetFieldFamily 3 1 3\nEPDFForm_GetFieldFlags 3 1 3\nEPDFForm_GetFieldIndexByObjNum 3 1 3\nEPDFForm_GetFieldIndexForWidget 3 1 3\nEPDFForm_GetFieldMappingName 3 1 3 6 3\nEPDFForm_GetFieldMaxLen 3 1 3\nEPDFForm_GetFieldName 3 1 3 6 3\nEPDFForm_GetFieldObjNum 3 1 3\nEPDFForm_GetFieldOptionLabel 3 1 3 3 6 3\nEPDFForm_GetFieldOptionValue 3 1 3 3 6 3\nEPDFForm_GetFieldOrigin 3 1 3\nEPDFForm_GetFieldPartialName 3 1 3 6 3\nEPDFForm_GetFieldTopIndex 3 1 3\nEPDFForm_GetFieldValueAt 3 1 3 3 6 3\nEPDFForm_GetFieldValueKind 3 1 3\nEPDFForm_GetFieldWidgetExportValue 3 1 3 3 6 3\nEPDFForm_GetFieldWidgetObjNum 3 1 3 3\nEPDFForm_GetFieldWidgetOnState 3 1 3 3 1 3\nEPDFForm_GetFieldWidgetPageObjNum 3 1 3 3\nEPDFForm_GetFieldWidgetRect 0 1 3 3 1\nEPDFForm_GetFormKind 3 1\nEPDFForm_GetNeedAppearances 0 1\nEPDFForm_HasFieldEmbedMetadata 0 1 3\nEPDFForm_HasFieldValuesList 0 1 3\nEPDFForm_ImportFieldRaw 0 1 1 3\nEPDFForm_IsFieldOptionSelected 0 1 3 3\nEPDFForm_IsFieldWidgetChecked 0 1 3 3\nEPDFForm_LoadModel 1 1\nEPDFForm_RedrawFieldWidgets 0 1 3 1 3 1\nEPDFForm_Repair 0 1 3 1\nEPDFForm_SetCalculationOrder 0 1 1 3\nEPDFForm_SetFieldAlternateName 0 1 3 1\nEPDFForm_SetFieldAppearanceText 0 1 3 1 1 3 1\nEPDFForm_SetFieldDefaultValue 0 1 3 3 6 3\nEPDFForm_SetFieldDisplay 0 1 3 3 1 3 1\nEPDFForm_SetFieldEmbedMetadataBoolean 0 1 3 2 0\nEPDFForm_SetFieldEmbedMetadataJSON 0 1 3 1\nEPDFForm_SetFieldEmbedMetadataNumber 0 1 3 2 5\nEPDFForm_SetFieldEmbedMetadataString 0 1 3 2 1\nEPDFForm_SetFieldEventAction 0 1 3 3 1\nEPDFForm_SetFieldFlags 0 1 3 3 3\nEPDFForm_SetFieldMappingName 0 1 3 1\nEPDFForm_SetFieldMaxLen 0 1 3 3\nEPDFForm_SetFieldName 0 1 3 1\nEPDFForm_SetFieldOptions 0 1 3 6 6 3\nEPDFForm_SetFieldSelectedIndices 0 1 3 1 3\nEPDFForm_SetFieldValue 0 1 3 3 6 3\nEPDFForm_SetFieldWidgetsChecked 0 1 3 1 3 1 3 1\nEPDFImageObj_SetJpeg 0 1 3 1 4 3\nEPDFImageObj_SetPng 0 1 3 1 4 3\nEPDFLayer_AbortTransaction 0 1\nEPDFLayer_BeginTransaction 0 1\nEPDFLayer_CommitTransaction 0 1\nEPDFLayer_GetBaseDocument 1 1\nEPDFLayer_GetBaseSha256 0 1 4\nEPDFLayer_GetBirthName 0 1 3 1 1\nEPDFLayer_GetBirthObjectNumber 3 1 3 3\nEPDFLayer_GetLastObjectNumber 3 1\nEPDFLayer_GetPromotedObjectCount 3 1\nEPDFLayer_IsInTransaction 0 1\nEPDFLayer_IsObjectPromoted 0 1 3\nEPDFLayer_IsPagePromoted 0 1 3\nEPDFLayer_OpenLayer 1 1 1 2 1\nEPDFLayer_OpenLayerArtifact 1 1 1 2 1\nEPDFLayer_OpenLayerArtifactFromPath 1 1 4 2 1\nEPDFLayer_RaiseLastObjectNumber 0 1 3\nEPDFLayer_SaveDelta 0 1 1 1\nEPDFLayer_SaveDeltaEx 0 1 1 1 1\nEPDFLayer_SaveDeltaToOwnedBuffer 1 1 1 1\nEPDFLayer_SaveDeltaToOwnedBufferEx 1 1 1 1 1\nEPDFLayer_SaveLayerArtifact 0 1 1 1\nEPDFLayer_SaveLayerArtifactEx 0 1 1 1 1\nEPDFLayer_SaveLayerArtifactToOwnedBuffer 1 1 1 1\nEPDFLayer_SaveLayerArtifactToOwnedBufferEx 1 1 1 1 1\nEPDFMeasure_AddFormat 1 1 3 1 5\nEPDFMeasure_CountFormats 3 1 3\nEPDFMeasure_GetCYX 0 1 1\nEPDFMeasure_GetFormat 1 1 3 3\nEPDFMeasure_GetOrigin 0 1 1\nEPDFMeasure_GetRatio 3 1 6 3\nEPDFMeasure_GetSubtype 3 1\nEPDFMeasure_RemoveFormats 0 1 3\nEPDFMeasure_SetCYX 0 1 1\nEPDFMeasure_SetOrigin 0 1 1\nEPDFMeasure_SetRatio 0 1 1\nEPDFNamedDest_Remove 0 1 2\nEPDFNamedDest_SetDest 0 1 2 1\nEPDFNumberFormat_GetConversion 0 1 1\nEPDFNumberFormat_GetFixedDenominator 0 1 1\nEPDFNumberFormat_GetFraction 0 1 1\nEPDFNumberFormat_GetLabelPosition 0 1 1\nEPDFNumberFormat_GetPrecision 0 1 1\nEPDFNumberFormat_GetText 3 1 3 6 3\nEPDFNumberFormat_GetUnit 3 1 6 3\nEPDFNumberFormat_SetConversion 0 1 5\nEPDFNumberFormat_SetFixedDenominator 0 1 0\nEPDFNumberFormat_SetFraction 0 1 3\nEPDFNumberFormat_SetLabelPosition 0 1 3\nEPDFNumberFormat_SetPrecision 0 1 3\nEPDFNumberFormat_SetText 0 1 3 1\nEPDFNumberFormat_SetUnit 0 1 1\nEPDFObjectDiff_Close - 1\nEPDFObjectDiff_GetCount 3 1\nEPDFObjectDiff_GetEntry 0 1 3 1 1 1 1 1 1\nEPDFObjectDiff_GetReadStatus 3 1 3 3\nEPDFObjectDiff_GetReferrer 3 1 3 3 3 1 4 3\nEPDFObjectDiff_GetReferrerCount 3 1 3 3\nEPDFObjectDiff_GetRevisionHealth 0 1 3 1 1 1\nEPDFObjectDiff_GetValue 3 1 3 3 4 3 1\nEPDFOutline_CreateItem 3 1 3 3 3 1\nEPDFOutline_DeleteItem 0 1 3\nEPDFOutline_ExportItemRawToOwnedBuffer 1 1 3 1\nEPDFOutline_GetItem 1 1 3\nEPDFOutline_GetObjectNumber 3 1\nEPDFOutline_ImportItemRaw 0 1 1 3\nEPDFOutline_MoveItem 0 1 3 3 3\nEPDFOutline_SetAction 0 1 3 1\nEPDFOutline_SetColor 0 1 3 0 5 5 5\nEPDFOutline_SetOpen 0 1 3 0\nEPDFOutline_SetStyle 0 1 3 3\nEPDFOutline_SetTitle 0 1 3 1\nEPDFPage_AddViewport 1 1 1\nEPDFPage_AddViewportRaw 1 1 3 1\nEPDFPage_ApplyRedactions 0 1 1 3 1\nEPDFPage_ContinueLoad 3 1 3\nEPDFPage_CountViewports 3 1\nEPDFPage_CountViewportsRaw 3 1 3\nEPDFPage_CreateAnnot 1 1 3\nEPDFPage_CreateAnnotRaw 1 1 3 3 3\nEPDFPage_ExportAnnotationsAsDocument 1 1 1 3\nEPDFPage_ExportAnnotsRawToOwnedBuffer 1 1 3 1 3 1\nEPDFPage_ExportRawToOwnedBuffer 1 1 3 1\nEPDFPage_FindViewport 3 1 1\nEPDFPage_Flatten 3 1 3\nEPDFPage_FlattenAnnotations 3 1 1 3 3 1\nEPDFPage_GetAnnotByName 1 1 1\nEPDFPage_GetAnnotByObjectNumber 1 1 3\nEPDFPage_GetAnnotCountRaw 3 1 3\nEPDFPage_GetAnnotIndexByNameRaw 3 1 3 1\nEPDFPage_GetAnnotIndexByObjectNumberRaw 3 1 3 3\nEPDFPage_GetAnnotRaw 1 1 3 3\nEPDFPage_GetObjectNumber 3 1\nEPDFPage_GetParsedSize 0 1 1\nEPDFPage_GetViewport 1 1 3\nEPDFPage_GetViewportRaw 1 1 3 3\nEPDFPage_ImportAnnotsRaw 0 1 3 1 3\nEPDFPage_ImportRaw 0 1 1 3\nEPDFPage_InsertBlankRaw 0 1 3 8 8 3\nEPDFPage_IsContentCurrent 0 1\nEPDFPage_IsValid 0 1\nEPDFPage_MoveAnnots 0 1 1 3 3\nEPDFPage_MoveAnnotsRaw 0 1 3 1 3 3\nEPDFPage_PromoteInlineAnnotsRaw 3 1 3\nEPDFPage_RemoveAnnot 0 1 3\nEPDFPage_RemoveAnnotByName 0 1 1\nEPDFPage_RemoveAnnotByObjectNumber 0 1 3\nEPDFPage_RemoveAnnotRaw 0 1 3 3\nEPDFPage_RemoveViewport 0 1 3\nEPDFPage_RemoveViewportRaw 0 1 3 3\nEPDFPage_ResetRenderCache 0 1\nEPDFSig_CloseModel - 1\nEPDFSig_Count 3 1\nEPDFSig_DigestByteRange 0 1 1 3 4 1\nEPDFSig_DigestFileRange 0 1 1 3 4 1\nEPDFSig_GetByteRange 0 1 3 1\nEPDFSig_GetContents 3 1 3 1 3\nEPDFSig_GetCoverage 3 1 3\nEPDFSig_GetDocMDPPermission 3 1 3\nEPDFSig_GetFieldMDPAction 3 1 3\nEPDFSig_GetFieldName 3 1 3 6 3\nEPDFSig_GetFieldNameAt 3 1 3 3 3 6 3\nEPDFSig_GetFieldNameCount 3 1 3 3\nEPDFSig_GetFieldObjNum 3 1 3\nEPDFSig_GetIndexByFieldObjNum 3 1 3\nEPDFSig_GetKind 3 1 3\nEPDFSig_GetLockAction 3 1 3\nEPDFSig_GetLockPermission 3 1 3\nEPDFSig_GetRevisionIndex 3 1 3\nEPDFSig_GetSeedValueFilter 3 1 3 6 3\nEPDFSig_GetSeedValueListAt 3 1 3 3 3 6 3\nEPDFSig_GetSeedValueListCount 3 1 3 3\nEPDFSig_GetSeedValueMDP 3 1 3\nEPDFSig_GetSeedValuePresentFlags 3 1 3\nEPDFSig_GetSeedValueRequiredFlags 3 1 3\nEPDFSig_GetSeedValueVersion 3 1 3\nEPDFSig_GetString 3 1 3 3 6 3\nEPDFSig_GetValueObjNum 3 1 3\nEPDFSig_GetWidgetObjNum 3 1 3\nEPDFSig_GetWidgetPageObjNum 3 1 3\nEPDFSig_HasSeedValue 0 1 3\nEPDFSig_IsCatalogCertification 0 1 3\nEPDFSig_IsRevisionChainValid 0 1\nEPDFSig_IsSigned 0 1 3\nEPDFSig_LoadModel 1 1\nEPDFSig_Prepare 3 1 3 1\nEPDFSig_SaveCandidate 0 1 3 1 1 1 1\nEPDFSig_SaveCandidateToOwnedBuffer 1 1 3 1 1 1\nEPDFSig_Seal 0 4 7 7 7 3 1 1 1 4 1\nEPDFSig_SealSpan 0 4 7 7 7 1 1 1\nEPDFSig_SetFieldLock 0 1 3 3 6 3 3\nEPDFSig_WriteContents 0 4 7 7 7 4 3\nEPDFText_GetCharGeometry 0 1 3 1\nEPDFText_GetCharToTextMap 3 1 1 3\nEPDFText_GetPageGeometry 3 1 3 3 1\nEPDFText_GetTextFull 3 1 1 3\nEPDFText_RedactInQuads 0 1 1 3 0 0\nEPDFText_RedactInRect 0 1 1 0 0\nEPDFViewport_AddMeasure 1 1\nEPDFViewport_Close - 1\nEPDFViewport_GetBBox 0 1 1\nEPDFViewport_GetMeasure 1 1\nEPDFViewport_GetName 3 1 6 3\nEPDFViewport_RemoveMeasure 0 1\nEPDFViewport_SetBBox 0 1 1\nEPDFViewport_SetName 0 1 1\nFORM_CanRedo 0 1 1\nFORM_CanUndo 0 1 1\nFORM_DoDocumentAAction - 1 3\nFORM_DoDocumentJSAction - 1\nFORM_DoDocumentOpenAction - 1\nFORM_DoPageAAction - 1 1 3\nFORM_ForceToKillFocus 0 1\nFORM_GetFocusedAnnot 0 1 1 1\nFORM_GetFocusedText 3 1 1 1 3\nFORM_GetSelectedText 3 1 1 1 3\nFORM_GetTextDirection 3 1 1\nFORM_IsIndexSelected 0 1 1 3\nFORM_OnAfterLoadPage - 1 1\nFORM_OnBeforeClosePage - 1 1\nFORM_OnChar 0 1 1 3 3\nFORM_OnFocus 0 1 1 3 8 8\nFORM_OnKeyDown 0 1 1 3 3\nFORM_OnKeyUp 0 1 1 3 3\nFORM_OnLButtonDoubleClick 0 1 1 3 8 8\nFORM_OnLButtonDown 0 1 1 3 8 8\nFORM_OnLButtonUp 0 1 1 3 8 8\nFORM_OnMouseMove 0 1 1 3 8 8\nFORM_OnMouseWheel 0 1 1 3 1 3 3\nFORM_OnRButtonDown 0 1 1 3 8 8\nFORM_OnRButtonUp 0 1 1 3 8 8\nFORM_Redo 0 1 1\nFORM_ReplaceAndKeepSelection - 1 1 1\nFORM_ReplaceSelection - 1 1 1\nFORM_SelectAllText 0 1 1\nFORM_SetFocusedAnnot 0 1 1\nFORM_SetIndexSelected 0 1 1 3 0\nFORM_SetTextDirection 0 1 1 3\nFORM_Undo 0 1 1\nFPDF_AddInstalledFont - 1 4 3\nFPDF_CloseDocument - 1\nFPDF_ClosePage - 1\nFPDF_CloseXObject - 1\nFPDF_CopyViewerPreferences 0 1 1\nFPDF_CountNamedDests 3 1\nFPDF_CreateClipPath 1 5 5 5 5\nFPDF_CreateNewDocument 1\nFPDF_DestroyClipPath - 1\nFPDF_DestroyLibrary -\nFPDF_DeviceToPage 0 1 3 3 3 3 3 3 3 1 1\nFPDF_DocumentHasValidCrossReferenceTable 0 1\nFPDF_FFLDraw - 1 1 1 3 3 3 3 3 3\nFPDF_FreeDefaultSystemFontInfo - 1\nFPDF_GetDefaultSystemFontInfo 1\nFPDF_GetDefaultTTFMap 1\nFPDF_GetDefaultTTFMapCount 3\nFPDF_GetDefaultTTFMapEntry 1 3\nFPDF_GetDocPermissions 3 1\nFPDF_GetDocUserPermissions 3 1\nFPDF_GetFileIdentifier 3 1 3 1 3\nFPDF_GetFileVersion 0 1 1\nFPDF_GetFormType 3 1\nFPDF_GetLastError 3\nFPDF_GetMetaText 3 1 2 1 3\nFPDF_GetNamedDest 1 1 3 1 1\nFPDF_GetNamedDestByName 1 1 2\nFPDF_GetPageAAction 1 1 3\nFPDF_GetPageBoundingBox 0 1 1\nFPDF_GetPageCount 3 1\nFPDF_GetPageHeight 8 1\nFPDF_GetPageHeightF 5 1\nFPDF_GetPageLabel 3 1 3 1 3\nFPDF_GetPageSizeByIndex 3 1 3 1 1\nFPDF_GetPageSizeByIndexF 0 1 3 1\nFPDF_GetPageWidth 8 1\nFPDF_GetPageWidthF 5 1\nFPDF_GetSecurityHandlerRevision 3 1\nFPDF_GetSignatureCount 3 1\nFPDF_GetSignatureObject 1 1 3\nFPDF_GetTrailerEnds 3 1 1 3\nFPDF_GetXFAPacketContent 0 1 3 1 3 1\nFPDF_GetXFAPacketCount 3 1\nFPDF_GetXFAPacketName 3 1 3 1 3\nFPDF_ImportNPagesToOne 1 1 5 5 3 3\nFPDF_ImportPages 0 1 1 2 3\nFPDF_ImportPagesByIndex 0 1 1 1 3 3\nFPDF_InitLibrary -\nFPDF_InitLibraryWithConfig - 1\nFPDF_LoadCustomDocument 1 1 2\nFPDF_LoadDocument 1 4 2\nFPDF_LoadMemDocument 1 1 3 2\nFPDF_LoadMemDocument64 1 1 3 2\nFPDF_LoadPage 1 1 3\nFPDF_LoadXFA 0 1\nFPDF_MovePages 0 1 1 3 3\nFPDF_NewFormObjectFromXObject 1 1\nFPDF_NewXObjectFromPage 1 1 1 3\nFPDF_PageToDevice 0 1 3 3 3 3 3 8 8 1 1\nFPDF_RemoveFormFieldHighlight - 1\nFPDF_RenderPage_Close - 1\nFPDF_RenderPage_Continue 3 1 1\nFPDF_RenderPageBitmap - 1 1 3 3 3 3 3 3\nFPDF_RenderPageBitmap_Start 3 1 1 3 3 3 3 3 3 1\nFPDF_RenderPageBitmapWithColorScheme_Start 3 1 1 3 3 3 3 3 3 1 1\nFPDF_RenderPageBitmapWithMatrix - 1 1 1 1 3\nFPDF_SaveAsCopy 0 1 1 3\nFPDF_SaveWithVersion 0 1 1 3 3\nFPDF_SetFormFieldHighlightAlpha - 1 3\nFPDF_SetFormFieldHighlightColor - 1 3 3\nFPDF_SetSandBoxPolicy - 3 0\nFPDF_SetSystemFontInfo - 1\nFPDF_StructElement_Attr_CountChildren 3 1\nFPDF_StructElement_Attr_GetBlobValue 0 1 1 3 1\nFPDF_StructElement_Attr_GetBooleanValue 0 1 1\nFPDF_StructElement_Attr_GetChildAtIndex 1 1 3\nFPDF_StructElement_Attr_GetCount 3 1\nFPDF_StructElement_Attr_GetName 0 1 3 1 3 1\nFPDF_StructElement_Attr_GetNumberValue 0 1 1\nFPDF_StructElement_Attr_GetStringValue 0 1 1 3 1\nFPDF_StructElement_Attr_GetType 3 1\nFPDF_StructElement_Attr_GetValue 1 1 2\nFPDF_StructElement_CountChildren 3 1\nFPDF_StructElement_GetActualText 3 1 1 3\nFPDF_StructElement_GetAltText 3 1 1 3\nFPDF_StructElement_GetAttributeAtIndex 1 1 3\nFPDF_StructElement_GetAttributeCount 3 1\nFPDF_StructElement_GetChildAtIndex 1 1 3\nFPDF_StructElement_GetChildMarkedContentID 3 1 3\nFPDF_StructElement_GetExpansion 3 1 1 3\nFPDF_StructElement_GetID 3 1 1 3\nFPDF_StructElement_GetLang 3 1 1 3\nFPDF_StructElement_GetMarkedContentID 3 1\nFPDF_StructElement_GetMarkedContentIdAtIndex 3 1 3\nFPDF_StructElement_GetMarkedContentIdCount 3 1\nFPDF_StructElement_GetObjType 3 1 1 3\nFPDF_StructElement_GetParent 1 1\nFPDF_StructElement_GetRawType 3 1 6 3\nFPDF_StructElement_GetStringAttribute 3 1 2 1 3\nFPDF_StructElement_GetTitle 3 1 1 3\nFPDF_StructElement_GetType 3 1 1 3\nFPDF_StructTree_Close - 1\nFPDF_StructTree_CountChildren 3 1\nFPDF_StructTree_GetChildAtIndex 1 1 3\nFPDF_StructTree_GetForPage 1 1\nFPDF_VIEWERREF_GetDuplex 3 1\nFPDF_VIEWERREF_GetName 3 1 2 4 3\nFPDF_VIEWERREF_GetNumCopies 3 1\nFPDF_VIEWERREF_GetPrintPageRange 1 1\nFPDF_VIEWERREF_GetPrintPageRangeCount 3 1\nFPDF_VIEWERREF_GetPrintPageRangeElement 3 1 3\nFPDF_VIEWERREF_GetPrintScaling 0 1\nFPDFAction_GetDest 1 1 1\nFPDFAction_GetFilePath 3 1 1 3\nFPDFAction_GetType 3 1\nFPDFAction_GetURIPath 3 1 1 1 3\nFPDFAnnot_AddFileAttachment 1 1 1\nFPDFAnnot_AddInkStroke 3 1 1 3\nFPDFAnnot_AppendAttachmentPoints 0 1 1\nFPDFAnnot_AppendObject 0 1 1\nFPDFAnnot_CountAttachmentPoints 3 1\nFPDFAnnot_GetAP 3 1 3 6 3\nFPDFAnnot_GetAttachmentPoints 0 1 3 1\nFPDFAnnot_GetBorder 0 1 1 1 1\nFPDFAnnot_GetColor 0 1 3 1 1 1 1\nFPDFAnnot_GetFileAttachment 1 1\nFPDFAnnot_GetFlags 3 1\nFPDFAnnot_GetFocusableSubtypes 0 1 1 3\nFPDFAnnot_GetFocusableSubtypesCount 3 1\nFPDFAnnot_GetFontColor 0 1 1 1 1 1\nFPDFAnnot_GetFontSize 0 1 1 1\nFPDFAnnot_GetFormAdditionalActionJavaScript 3 1 1 3 6 3\nFPDFAnnot_GetFormControlCount 3 1 1\nFPDFAnnot_GetFormControlIndex 3 1 1\nFPDFAnnot_GetFormFieldAlternateName 3 1 1 6 3\nFPDFAnnot_GetFormFieldAtPoint 1 1 1 1\nFPDFAnnot_GetFormFieldExportValue 3 1 1 6 3\nFPDFAnnot_GetFormFieldFlags 3 1 1\nFPDFAnnot_GetFormFieldName 3 1 1 6 3\nFPDFAnnot_GetFormFieldType 3 1 1\nFPDFAnnot_GetFormFieldValue 3 1 1 6 3\nFPDFAnnot_GetInkListCount 3 1\nFPDFAnnot_GetInkListPath 3 1 3 1 3\nFPDFAnnot_GetLine 0 1 1 1\nFPDFAnnot_GetLink 1 1\nFPDFAnnot_GetLinkedAnnot 1 1 2\nFPDFAnnot_GetNumberValue 0 1 2 1\nFPDFAnnot_GetObject 1 1 3\nFPDFAnnot_GetObjectCount 3 1\nFPDFAnnot_GetOptionCount 3 1 1\nFPDFAnnot_GetOptionLabel 3 1 1 3 6 3\nFPDFAnnot_GetRect 0 1 1\nFPDFAnnot_GetStringValue 3 1 2 6 3\nFPDFAnnot_GetSubtype 3 1\nFPDFAnnot_GetValueType 3 1 2\nFPDFAnnot_GetVertices 3 1 1 3\nFPDFAnnot_HasAttachmentPoints 0 1\nFPDFAnnot_HasKey 0 1 2\nFPDFAnnot_IsChecked 0 1 1\nFPDFAnnot_IsObjectSupportedSubtype 0 3\nFPDFAnnot_IsOptionSelected 0 1 1 3\nFPDFAnnot_IsSupportedSubtype 0 3\nFPDFAnnot_RemoveInkList 0 1\nFPDFAnnot_RemoveObject 0 1 3\nFPDFAnnot_SetAP 0 1 3 1\nFPDFAnnot_SetAttachmentPoints 0 1 3 1\nFPDFAnnot_SetBorder 0 1 5 5 5\nFPDFAnnot_SetColor 0 1 3 3 3 3 3\nFPDFAnnot_SetFlags 0 1 3\nFPDFAnnot_SetFocusableSubtypes 0 1 1 3\nFPDFAnnot_SetFontColor 0 1 1 3 3 3\nFPDFAnnot_SetFormFieldFlags 0 1 1 3\nFPDFAnnot_SetRect 0 1 1\nFPDFAnnot_SetStringValue 0 1 2 1\nFPDFAnnot_SetURI 0 1 4\nFPDFAnnot_UpdateObject 0 1 1\nFPDFAttachment_GetAFRelationship 3 1 6 3\nFPDFAttachment_GetDescription 3 1 6 3\nFPDFAttachment_GetFile 0 1 1 3 1\nFPDFAttachment_GetName 3 1 6 3\nFPDFAttachment_GetStringValue 3 1 2 6 3\nFPDFAttachment_GetSubtype 3 1 6 3\nFPDFAttachment_GetValueType 3 1 2\nFPDFAttachment_HasKey 0 1 2\nFPDFAttachment_SetDescription 0 1 1\nFPDFAttachment_SetFile 0 1 1 1 3\nFPDFAttachment_SetStringValue 0 1 2 1\nFPDFAvail_Create 1 1 1\nFPDFAvail_Destroy - 1\nFPDFAvail_GetDocument 1 1 2\nFPDFAvail_GetFirstPageNum 3 1\nFPDFAvail_IsDocAvail 3 1 1\nFPDFAvail_IsFormAvail 3 1 1\nFPDFAvail_IsLinearized 3 1\nFPDFAvail_IsPageAvail 3 1 3 1\nFPDFBitmap_Create 1 3 3 3\nFPDFBitmap_CreateEx 1 3 3 3 1 3\nFPDFBitmap_Destroy - 1\nFPDFBitmap_FillRect 0 1 3 3 3 3 3\nFPDFBitmap_GetBuffer 1 1\nFPDFBitmap_GetFormat 3 1\nFPDFBitmap_GetHeight 3 1\nFPDFBitmap_GetStride 3 1\nFPDFBitmap_GetWidth 3 1\nFPDFBookmark_Find 1 1 1\nFPDFBookmark_GetAction 1 1\nFPDFBookmark_GetColor 0 1 1 1 1\nFPDFBookmark_GetCount 3 1\nFPDFBookmark_GetDest 1 1 1\nFPDFBookmark_GetFirstChild 1 1 1\nFPDFBookmark_GetNextSibling 1 1 1\nFPDFBookmark_GetStyle 3 1\nFPDFBookmark_GetTitle 3 1 1 3\nFPDFCatalog_GetLanguage 3 1 6 3\nFPDFCatalog_IsTagged 0 1\nFPDFCatalog_SetLanguage 0 1 1\nFPDFClipPath_CountPaths 3 1\nFPDFClipPath_CountPathSegments 3 1 3\nFPDFClipPath_GetPathSegment 1 1 3 3\nFPDFDest_GetDestPageIndex 3 1 1\nFPDFDest_GetLocationInPage 0 1 1 1 1 1 1 1\nFPDFDest_GetView 3 1 1 1\nFPDFDoc_AddAttachment 1 1 1\nFPDFDoc_CloseJavaScriptAction - 1\nFPDFDoc_DeleteAttachment 0 1 3\nFPDFDOC_ExitFormFillEnvironment - 1\nFPDFDoc_GetAttachment 1 1 3\nFPDFDoc_GetAttachmentCount 3 1\nFPDFDoc_GetJavaScriptAction 1 1 3\nFPDFDoc_GetJavaScriptActionCount 3 1\nFPDFDoc_GetPageMode 3 1\nFPDFDOC_InitFormFillEnvironment 1 1 1\nFPDFFont_Close - 1\nFPDFFont_GetAscent 0 1 5 1\nFPDFFont_GetBaseFontName 3 1 4 3\nFPDFFont_GetDescent 0 1 5 1\nFPDFFont_GetFamilyName 3 1 4 3\nFPDFFont_GetFlags 3 1\nFPDFFont_GetFontData 0 1 4 3 1\nFPDFFont_GetGlyphPath 1 1 3 5\nFPDFFont_GetGlyphWidth 0 1 3 5 1\nFPDFFont_GetIsEmbedded 3 1\nFPDFFont_GetItalicAngle 0 1 1\nFPDFFont_GetWeight 3 1\nFPDFFormObj_CountObjects 3 1\nFPDFFormObj_GetObject 1 1 3\nFPDFFormObj_RemoveObject 0 1 1\nFPDFGlyphPath_CountGlyphSegments 3 1\nFPDFGlyphPath_GetGlyphPathSegment 1 1 3\nFPDFImageObj_GetBitmap 1 1\nFPDFImageObj_GetIccProfileDataDecoded 0 1 1 4 3 1\nFPDFImageObj_GetImageDataDecoded 3 1 1 3\nFPDFImageObj_GetImageDataRaw 3 1 1 3\nFPDFImageObj_GetImageFilter 3 1 3 1 3\nFPDFImageObj_GetImageFilterCount 3 1\nFPDFImageObj_GetImageMetadata 0 1 1 1\nFPDFImageObj_GetImagePixelSize 0 1 1 1\nFPDFImageObj_GetRenderedBitmap 1 1 1 1\nFPDFImageObj_LoadJpegFile 0 1 3 1 1\nFPDFImageObj_LoadJpegFileInline 0 1 3 1 1\nFPDFImageObj_SetBitmap 0 1 3 1 1\nFPDFImageObj_SetMatrix 0 1 8 8 8 8 8 8\nFPDFJavaScriptAction_GetName 3 1 6 3\nFPDFJavaScriptAction_GetScript 3 1 6 3\nFPDFLink_CloseWebLinks - 1\nFPDFLink_CountQuadPoints 3 1\nFPDFLink_CountRects 3 1 3\nFPDFLink_CountWebLinks 3 1\nFPDFLink_Enumerate 0 1 1 1\nFPDFLink_GetAction 1 1\nFPDFLink_GetAnnot 1 1 1\nFPDFLink_GetAnnotRect 0 1 1\nFPDFLink_GetDest 1 1 1\nFPDFLink_GetLinkAtPoint 1 1 8 8\nFPDFLink_GetLinkZOrderAtPoint 3 1 8 8\nFPDFLink_GetQuadPoints 0 1 3 1\nFPDFLink_GetRect 0 1 3 3 1 1 1 1\nFPDFLink_GetTextRange 0 1 3 1 1\nFPDFLink_GetURL 3 1 3 1 3\nFPDFLink_LoadWebLinks 1 1\nFPDFPage_CloseAnnot - 1\nFPDFPage_CountObjects 3 1\nFPDFPage_CreateAnnot 1 1 3\nFPDFPage_Delete - 1 3\nFPDFPage_Flatten 3 1 3\nFPDFPage_FormFieldZOrderAtPoint 3 1 1 8 8\nFPDFPage_GenerateContent 0 1\nFPDFPage_GetAnnot 1 1 3\nFPDFPage_GetAnnotCount 3 1\nFPDFPage_GetAnnotIndex 3 1 1\nFPDFPage_GetArtBox 0 1 1 1 1 1\nFPDFPage_GetBleedBox 0 1 1 1 1 1\nFPDFPage_GetCropBox 0 1 1 1 1 1\nFPDFPage_GetDecodedThumbnailData 3 1 1 3\nFPDFPage_GetMediaBox 0 1 1 1 1 1\nFPDFPage_GetObject 1 1 3\nFPDFPage_GetRawThumbnailData 3 1 1 3\nFPDFPage_GetRotation 3 1\nFPDFPage_GetThumbnailAsBitmap 1 1\nFPDFPage_GetTrimBox 0 1 1 1 1 1\nFPDFPage_HasFormFieldAtPoint 3 1 1 8 8\nFPDFPage_HasTransparency 0 1\nFPDFPage_InsertClipPath - 1 1\nFPDFPage_InsertObject 0 1 1\nFPDFPage_InsertObjectAtIndex 0 1 1 3\nFPDFPage_New 1 1 3 8 8\nFPDFPage_RemoveAnnot 0 1 3\nFPDFPage_RemoveObject 0 1 1\nFPDFPage_SetArtBox - 1 5 5 5 5\nFPDFPage_SetBleedBox - 1 5 5 5 5\nFPDFPage_SetCropBox - 1 5 5 5 5\nFPDFPage_SetMediaBox - 1 5 5 5 5\nFPDFPage_SetRotation - 1 3\nFPDFPage_SetTrimBox - 1 5 5 5 5\nFPDFPage_TransformAnnots - 1 8 8 8 8 8 8\nFPDFPage_TransFormWithClip 0 1 1 1\nFPDFPageObj_AddExistingMark 0 1 1\nFPDFPageObj_AddMark 1 1 2\nFPDFPageObj_CountMarks 3 1\nFPDFPageObj_CreateNewPath 1 5 5\nFPDFPageObj_CreateNewRect 1 5 5 5 5\nFPDFPageObj_CreateTextObj 1 1 1 5\nFPDFPageObj_Destroy - 1\nFPDFPageObj_GetBounds 0 1 1 1 1 1\nFPDFPageObj_GetClipPath 1 1\nFPDFPageObj_GetDashArray 0 1 1 3\nFPDFPageObj_GetDashCount 3 1\nFPDFPageObj_GetDashPhase 0 1 1\nFPDFPageObj_GetFillColor 0 1 1 1 1 1\nFPDFPageObj_GetIsActive 0 1 1\nFPDFPageObj_GetLineCap 3 1\nFPDFPageObj_GetLineJoin 3 1\nFPDFPageObj_GetMark 1 1 3\nFPDFPageObj_GetMarkedContentID 3 1\nFPDFPageObj_GetMatrix 0 1 1\nFPDFPageObj_GetRenderedFillPattern 1 1 1\nFPDFPageObj_GetRenderedStrokePattern 1 1 1\nFPDFPageObj_GetRotatedBounds 0 1 1\nFPDFPageObj_GetStrokeColor 0 1 1 1 1 1\nFPDFPageObj_GetStrokeWidth 0 1 1\nFPDFPageObj_GetType 3 1\nFPDFPageObj_HasTransparency 0 1\nFPDFPageObj_NewImageObj 1 1\nFPDFPageObj_NewTextObj 1 1 2 5\nFPDFPageObj_RemoveMark 0 1 1\nFPDFPageObj_SetBlendMode - 1 2\nFPDFPageObj_SetDashArray 0 1 1 3 5\nFPDFPageObj_SetDashPhase 0 1 5\nFPDFPageObj_SetFillColor 0 1 3 3 3 3\nFPDFPageObj_SetIsActive 0 1 0\nFPDFPageObj_SetLineCap 0 1 3\nFPDFPageObj_SetLineJoin 0 1 3\nFPDFPageObj_SetMatrix 0 1 1\nFPDFPageObj_SetStrokeColor 0 1 3 3 3 3\nFPDFPageObj_SetStrokeWidth 0 1 5\nFPDFPageObj_Transform - 1 8 8 8 8 8 8\nFPDFPageObj_TransformClipPath - 1 8 8 8 8 8 8\nFPDFPageObj_TransformF 0 1 1\nFPDFPageObjMark_CountParams 3 1\nFPDFPageObjMark_GetName 0 1 6 3 1\nFPDFPageObjMark_GetParamBlobValue 0 1 2 4 3 1\nFPDFPageObjMark_GetParamFloatValue 0 1 2 1\nFPDFPageObjMark_GetParamIntValue 0 1 2 1\nFPDFPageObjMark_GetParamKey 0 1 3 6 3 1\nFPDFPageObjMark_GetParamStringValue 0 1 2 6 3 1\nFPDFPageObjMark_GetParamValueType 3 1 2\nFPDFPageObjMark_RemoveParam 0 1 1 2\nFPDFPageObjMark_SetBlobParam 0 1 1 1 2 4 3\nFPDFPageObjMark_SetFloatParam 0 1 1 1 2 5\nFPDFPageObjMark_SetIntParam 0 1 1 1 2 3\nFPDFPageObjMark_SetStringParam 0 1 1 1 2 2\nFPDFPath_BezierTo 0 1 5 5 5 5 5 5\nFPDFPath_Close 0 1\nFPDFPath_CountSegments 3 1\nFPDFPath_GetBezierControlPoints 0 1 3 1 1\nFPDFPath_GetDrawMode 0 1 1 1\nFPDFPath_GetPathSegment 1 1 3\nFPDFPath_LineTo 0 1 5 5\nFPDFPath_MoveTo 0 1 5 5\nFPDFPath_SetDrawMode 0 1 3 0\nFPDFPathSegment_GetClose 0 1\nFPDFPathSegment_GetPoint 0 1 1 1\nFPDFPathSegment_GetType 3 1\nFPDFSignatureObj_GetByteRange 3 1 1 3\nFPDFSignatureObj_GetContents 3 1 1 3\nFPDFSignatureObj_GetDocMDPPermission 3 1\nFPDFSignatureObj_GetReason 3 1 1 3\nFPDFSignatureObj_GetSubFilter 3 1 4 3\nFPDFSignatureObj_GetTime 3 1 4 3\nFPDFText_ClosePage - 1\nFPDFText_CountChars 3 1\nFPDFText_CountRects 3 1 3 3\nFPDFText_FindClose - 1\nFPDFText_FindNext 0 1\nFPDFText_FindPrev 0 1\nFPDFText_FindStart 1 1 1 3 3\nFPDFText_GetBoundedText 3 1 8 8 8 8 1 3\nFPDFText_GetCharAngle 5 1 3\nFPDFText_GetCharBox 0 1 3 1 1 1 1\nFPDFText_GetCharIndexAtPos 3 1 8 8 8 8\nFPDFText_GetCharIndexFromTextIndex 3 1 3\nFPDFText_GetCharOrigin 0 1 3 1 1\nFPDFText_GetFillColor 0 1 3 1 1 1 1\nFPDFText_GetFontInfo 3 1 3 1 3 1\nFPDFText_GetFontSize 8 1 3\nFPDFText_GetFontWeight 3 1 3\nFPDFText_GetLooseCharBox 0 1 3 1\nFPDFText_GetMatrix 0 1 3 1\nFPDFText_GetRect 0 1 3 1 1 1 1\nFPDFText_GetSchCount 3 1\nFPDFText_GetSchResultIndex 3 1\nFPDFText_GetStrokeColor 0 1 3 1 1 1 1\nFPDFText_GetText 3 1 3 3 1\nFPDFText_GetTextIndexFromCharIndex 3 1 3\nFPDFText_GetTextObject 1 1 3\nFPDFText_GetUnicode 3 1 3\nFPDFText_HasUnicodeMapError 3 1 3\nFPDFText_IsGenerated 3 1 3\nFPDFText_IsHyphen 3 1 3\nFPDFText_LoadCidType2Font 1 1 4 3 2 4 3\nFPDFText_LoadFont 1 1 4 3 3 0\nFPDFText_LoadPage 1 1\nFPDFText_LoadStandardFont 1 1 2\nFPDFText_SetCharcodes 0 1 1 3\nFPDFText_SetPositions 0 1 1 3\nFPDFText_SetText 0 1 1\nFPDFTextObj_GetFont 1 1\nFPDFTextObj_GetFontSize 0 1 1\nFPDFTextObj_GetRenderedBitmap 1 1 1 1 5\nFPDFTextObj_GetText 3 1 1 6 3\nFPDFTextObj_GetTextRenderMode 3 1\nFPDFTextObj_SetFontSize 0 1 5\nFPDFTextObj_SetTextRenderMode 0 1 3\n`);function aR(e){return BigInt("number"==typeof e?e>>>0:e)}function aT(e){return Number(e)}function aB(e){switch(e){case"i8":return"i8";case"i16":return"i16";case"i32":return"i32";case"i64":return"i64";case"f32":return"float";case"f64":return"double";case"ptr":return"*"}}async function aL(e={}){let t,n,r=await Promise.resolve().then(()=>(x(),k)),i=r.default??r,o=await i((t={...e.wasm??{}},void 0!==e.wasmBinary&&void 0===t.wasmBinary&&(t.wasmBinary=e.wasmBinary instanceof Uint8Array?e.wasmBinary:new Uint8Array(e.wasmBinary)),void 0!==(n=e.wasmUrl)&&void 0===t.locateFile&&(t.locateFile=(e,t)=>e.endsWith(".wasm")?n:t+e),void 0!==t.wasmBinary&&void 0===t.locateFile&&(t.locateFile=(e,t)=>e.endsWith(".wasm")?e:t+e),t)),a=function(e){let t=e._malloc??e.wasmExports?.malloc,n=e._free??e.wasmExports?.free;if(!t||!n)throw Error("WASM runtime does not expose malloc/free");return{alloc:e=>aR(t(e)),free(e){n(aT(e))},readBytes:(t,n)=>e.HEAPU8.slice(aT(t),aT(t)+n),writeBytes(t,n){e.HEAPU8.set(n,aT(t))},readU8String:t=>e.UTF8ToString?.(aT(t))??"",writeU8String(n){let r=new TextEncoder().encode(`${n}\\0`),i=aR(t(r.length));return e.HEAPU8.set(r,aT(i)),i},readU16String:t=>e.UTF16ToString?.(aT(t))??"",writeU16String(n){let r=(n.length+1)*2,i=aR(t(r));return e.stringToUTF16?.(n,aT(i),r),i},peek(t,n,r=0){let i=e.getValue?.(aT(t)+r,aB(n))??0;return"ptr"===n?aR(i):i},poke(t,n,r,i=0){let o="ptr"===n&&"bigint"==typeof r?Number(r):r;e.setValue?.(aT(t)+i,o,aB(n))}}}(o),s={register(e,t){if(!o.addFunction)throw Error("WASM runtime does not expose addFunction");return BigInt(o.addFunction(t,e))},dispose(e){o.removeFunction?.(aT(e))}};return{kind:"wasm",platform:"wasm32",mem:a,cb:s,fileAccess:{fromMemory(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t.byteLength>0xffffffff)throw RangeError("FPDF_FILEACCESS on wasm supports files up to 4 GiB");let n=a.alloc(12),r=null,i=!1;try{return r=s.register("iiiii",(e,n,r,i)=>{let o=Number(n),s=Number(i);return!Number.isSafeInteger(o)||!Number.isSafeInteger(s)||o<0||s<0||o+s>t.byteLength?0:(a.writeBytes(aR(r),t.subarray(o,o+s)),1)}),a.poke(n,"i32",t.byteLength,0),a.poke(n,"i32",aT(r),4),a.poke(n,"i32",0,8),{ptr:n,close(){i||(i=!0,s.dispose(r),a.free(n))}}}catch(e){throw r&&s.dispose(r),a.free(n),e}},fromNodeFile(){throw Error("fromNodeFile() is only available on the native Node runtime")},readRange(){throw Error("readRange() is only available on the native Node runtime")},sizeOf(){throw Error("sizeOf() is only available on the native Node runtime")}},fileWrite:{toNodeFile(){throw Error("toNodeFile() is only available on the native Node runtime")},writeRange(){throw Error("writeRange() is only available on the native Node runtime")},appendBytes(){throw Error("appendBytes() is only available on the native Node runtime")},removeFile(){throw Error("removeFile() is only available on the native Node runtime")}},fn:function(e){let t={};for(let[n,r]of Object.entries(aM)){let i=r.params.some(e=>"i64"===e.wasm.kind),o=e=>(...t)=>{let n=t.map((e,t)=>{var n;return n=r.params[t],n&&"Ptr"===n.ts&&"bigint"==typeof e?Number(e):e});var o=r.result,a=e(...i?function(e,t){let n=[];return e.params.forEach((e,r)=>{if("i64"===e.wasm.kind){let e=BigInt(t[r]??0);n.push(Number(4294967295n&e),Number(e>>32n&4294967295n))}else n.push(t[r])}),n}(r,n):n);if(o)return"Ptr"===o.ts&&"number"==typeof a?aR(a):"bigint"===o.ts&&"number"==typeof a?BigInt(a):a};if(e.cwrap){let i=r.params.flatMap(e=>"i64"===e.wasm.kind?["number","number"]:[e.wasm.cwrap]);t[n]=o(e.cwrap(n,r.result?r.result.wasm.cwrap:null,i))}else"function"==typeof e[`_${n}`]&&(t[n]=o(e[`_${n}`].bind(e)))}return t}(o),async destroy(){o._free=o._free}}}async function a$(e={}){return aL(e)}var az={};function aU(e){return e}function aV(e){return e}function aW(){return e=>e}function aq(e){}function aH(e){throw Error("Unexpected value in exhaustive check")}function aK(e){}function aZ(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function aJ(e,t="|"){return e.map(e=>sy(e)).join(t)}function aQ(e,t){return"bigint"==typeof t?t.toString():t}v(az,{BIGINT_FORMAT_RANGES:()=>sA,CONSTANT_CATCH:()=>le,Class:()=>s1,NUMBER_FORMAT_RANGES:()=>sE,aborted:()=>sj,allowsEval:()=>sc,assert:()=>aK,assertEqual:()=>aU,assertIs:()=>aq,assertNever:()=>aH,assertNotEqual:()=>aV,assignProp:()=>a4,attachSchema:()=>sL,base64ToUint8Array:()=>sZ,base64urlToUint8Array:()=>sQ,cached:()=>aY,captureStackTrace:()=>su,cleanEnum:()=>sK,cleanRegex:()=>a1,clone:()=>sP,cloneDef:()=>sr,codePointLength:()=>sV,constantCatch:()=>lt,createTransparentProxy:()=>sb,defineLazy:()=>a6,defineLazyInternal:()=>s7,derived:()=>s5,esc:()=>ss,escapeRegex:()=>s_,explicitlyAborted:()=>sM,extend:()=>sx,finalizeIssue:()=>s$,floatSafeRemainder:()=>a3,getElementAtPath:()=>si,getEnumValues:()=>aZ,getLengthableOrigin:()=>sW,getParsedType:()=>sh,getSizableOrigin:()=>sz,hexToUint8Array:()=>sY,hide:()=>s6,installLazyProp:()=>s9,isObject:()=>sd,isPlainObject:()=>sf,issue:()=>sH,joinValues:()=>aJ,jsonStringifyReplacer:()=>aQ,members:()=>s3,merge:()=>sI,mergeDefs:()=>sn,normalizeParams:()=>sD,nullish:()=>a0,numKeys:()=>sp,objectClone:()=>a5,omit:()=>sk,optionalKeys:()=>sw,own:()=>s2,parsedType:()=>sq,partial:()=>sN,pick:()=>sv,prefixIssues:()=>sR,primitiveTypes:()=>sg,promiseAllObject:()=>so,propertyKeyTypes:()=>sF,randomString:()=>sa,rawShape:()=>a8,required:()=>sC,safeExtend:()=>sO,shallowClone:()=>sm,sizeCaps:()=>sB,slugify:()=>sl,stringifyPrimitive:()=>sy,toZod:()=>aW,uint8ArrayToBase64:()=>sJ,uint8ArrayToBase64url:()=>sX,uint8ArrayToHex:()=>s0,unwrapMessage:()=>sT});var aX=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}};function aY(e){return new aX(e)}function a0(e){return null==e}function a1(e){let t=+!!e.startsWith("^"),n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function a3(e,t){let n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){let e=t._zod.def.shape[o];return r?r(e,o):e}):se(e,o,r?r(n.value,o):n.value))}}function sn(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function sr(e){return sn(e._zod.def)}function si(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function so(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let n={};for(let r=0;r{};function sd(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var sc=aY(()=>{if(ls.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch{return!1}});function sf(e){if(!1===sd(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let n=t.prototype;return!1!==sd(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function sm(e){return sf(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function sp(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var sh=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("u">typeof Map&&e instanceof Map)return"map";if("u">typeof Set&&e instanceof Set)return"set";if("u">typeof Date&&e instanceof Date)return"date";if("u">typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},sF=new Set(["string","number","symbol"]),sg=new Set(["string","number","bigint","boolean","symbol","undefined"]);function s_(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function sP(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function sD(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function sb(e){let t;return new Proxy({},{get:(n,r,i)=>(t??(t=e()),Reflect.get(t,r,i)),set:(n,r,i,o)=>(t??(t=e()),Reflect.set(t,r,i,o)),has:(n,r)=>(t??(t=e()),Reflect.has(t,r)),deleteProperty:(n,r)=>(t??(t=e()),Reflect.deleteProperty(t,r)),ownKeys:n=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(n,r)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)),defineProperty:(n,r,i)=>(t??(t=e()),Reflect.defineProperty(t,r,i))})}function sy(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function sw(e){return Object.keys(e).filter(t=>void 0!==e[t]._zod.optin&&"optional"===e[t]._zod.optout)}var sE={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},sA={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function sv(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return st(i,e,sS(e,t)),sP(e,sn(n,{shape:i,checks:[]}))}function sS(e,t){let n=a7(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function sk(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(sS(e,t)),o={};return st(o,e,Reflect.ownKeys(a7(e)).filter(e=>!i.has(e))),sP(e,sn(n,{shape:o,checks:[]}))}function sx(e,t){if(!sf(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let n=a7(e);for(let e of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return sP(e,sn(e._zod.def,{shape:sG(e,t)}))}function sG(e,t){let n={};st(n,e,Reflect.ownKeys(a7(e)));for(let e of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,e);r.enumerable&&(r.get?a9(n,e,()=>t[e]):se(n,e,r.value))}return n}function sO(e,t){if(!sf(t))throw Error("Invalid input to safeExtend: expected a plain object");return sP(e,sn(e._zod.def,{shape:sG(e,t)}))}function sI(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};st(n,e,Reflect.ownKeys(a7(e))),st(n,t,Reflect.ownKeys(a7(t)));let r=sn(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return sP(e,r)}function sN(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let o=n?new Set(sS(t,n)):void 0,a={};return st(a,t,Reflect.ownKeys(a7(t)),e&&((t,n)=>o&&!o.has(n)?t:new e({type:"optional",innerType:t}))),sP(t,sn(t._zod.def,{shape:a,checks:[]}))}function sC(e,t,n){let r=n?new Set(sS(t,n)):void 0,i={};return st(i,t,Reflect.ownKeys(a7(t)),(t,n)=>r&&!r.has(n)?t:new e({type:"nonoptional",innerType:t})),sP(t,sn(t._zod.def,{shape:i}))}function sj(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n(t.path??(t.path=[]),t.path.unshift(e),t))}function sT(e){return"string"==typeof e?e:e?.message}function sB(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function sL(e,t,n){var r;for(let i=t;iNumber.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function sZ(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;ee.toString(16).padStart(2,"0")).join("")}var s1=class{constructor(...e){}};function s3(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):function(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:s2(this,t,n.bind(this))},set(e){s2(this,t,e)}})}(e,n,r.value)}}function s2(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function s6(e,t,n){return s2(e,t,n,!1)}function s5(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return s2(this,n,r(this))},set(e){s2(this,n,e)}})}return t}var s4=!1,s8={configurable:!0,get(){s4=!0}};function s7(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&P!==e._zod){P=void 0;return}P=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,s8);let e=s4;s4=!1;try{let r=n(this);return s4?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),s4=s4||e,r}catch(n){throw delete this[t],s4=s4||e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function s9(e,t,n,r){let i,o=t in(i=Object.getPrototypeOf(e))?void 0:i;o&&Object.defineProperty(o,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var le="~constantCatch";function lt(e){let t=()=>e;return t[le]=!0,t}var ln={value:void 0,enumerable:!1},lr="captureStackTrace"in Error?Error:null;function li(e,t,n,r){function i(e){this.def=e,this.constr=u,this.traits=new Set}i.prototype={};let o=n&&new WeakSet;function a(r,a){if(r._zod){if(r._zod.traits.has(e))return}else{ln.value=new i(a);try{Object.defineProperty(r,"_zod",ln)}finally{ln.value=void 0}}if(r._zod.traits.add(e),t(r,a),o){let e=Object.getPrototypeOf(r),t=r._zod.constr.prototype,i=e;for(;i&&i!==t;)i=Object.getPrototypeOf(i);let a=i??e;o.has(a)||(o.add(a),s3(a,n))}let s=u.prototype;for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&(e in r||(r[e]=s[e].bind(r)))}let s=r?.Parent??Object;class l extends s{}function u(e){let t=r?.Parent?function(e){let t=lr;if(t){let n=t.stackTraceLimit;if("number"==typeof n){try{t.stackTraceLimit=0}catch{return lr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}(l):this;a(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(l,"name",{value:e}),Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}var lo=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},la=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(D=globalThis).__zod_globalConfig??(D.__zod_globalConfig={});var ls=globalThis.__zod_globalConfig;function ll(e){return e&&Object.assign(ls,e),ls}var lu={get:function(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,aQ,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},ld={value:void 0,enumerable:!1},lc=new WeakSet([Object.prototype,Error.prototype]),lf=(e,t)=>{e.name="$ZodError",ld.value=t,Object.defineProperty(e,"issues",ld),ld.value=void 0,Object.defineProperty(e,"message",lu);let n=Object.getPrototypeOf(e);lc.has(n)||(lc.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},lm=li("$ZodError",lf);function lp(e,t){return{callee:t?.callee??e,Err:t?.Err}}li("$ZodError",lf,void 0,{Parent:Error});var lh=e=>{let t=(n,r,i,o)=>{let a=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new lo;if(s.issues.length){let n=new(o?.Err??e)(s.issues.map(e=>s$(e,a,ll())));throw su(n,o?.callee??t),n}return s.value};return t},lF=e=>{let t=async(n,r,i,o)=>{let a=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new(o?.Err??e)(s.issues.map(e=>s$(e,a,ll())));throw su(n,o?.callee??t),n}return s.value};return t},lg=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new lo;return o.issues.length?l_(e,o.issues,i):{success:!0,data:o.value}};function l_(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>s$(e,n,ll()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var lP=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?l_(e,o.issues,i):{success:!0,data:o.value}},lD=Symbol.for("zod.compile.invalid"),lb=Symbol.for("zod.compile.fallback"),ly=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),0===i.issues.length},lw=/^[cC][0-9a-z]{6,}$/,lE=/^[0-9a-z]+$/,lA=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,lv=/^[0-9a-vA-V]{20}$/,lS=/^[A-Za-z0-9]{27}$/,lk=/^[a-zA-Z0-9_-]{21}$/,lx=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,lG=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lO=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,lI=/^(?:[A-Za-z0-9_\'+\\-]+\\.)*[A-Za-z0-9_\'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,lN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lC=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,lj=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$/,lM=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lR=/^https?$/,lT=/^\\+[1-9]\\d{6,14}$/,lB="(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))",lL=RegExp(`^${lB}$`);function l$(e){let t="(?:[01]\\\\d|2[0-3]):[0-5]\\\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\\\d`:`${t}:[0-5]\\\\d\\\\.\\\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\\\d(?:\\\\.\\\\d+)?`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}var lz=/^[\\s\\S]{0,}$/,lU=/^-?\\d+(?:\\.\\d+)?$/,lV=/^(?:true|false)$/i,lW=/^[^A-Z]*$/,lq=/^[^a-z]*$/,lH=li("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),lK=e=>{let t=e.value;return!a0(t)&&void 0!==t.length},lZ={number:"number",bigint:"bigint",object:"date"},lJ=li("$ZodCheckLessThan",(e,t)=>{lH.init(e,t);let n=lZ[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{lH.init(e,t);let n=lZ[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:lZ[typeof r.value]??n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lX=li("$ZodCheckMultipleOf",(e,t)=>{lH.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):0===a3(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),lY=li("$ZodCheckNumberFormat",(e,t)=>{lH.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[i,o]=sE[t.format];e._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s))return void a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}so&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),l0=li("$ZodCheckMaxLength",(e,t)=>{var n;lH.init(e,t),(n=e._zod.def).when??(n.when=lK),e._zod.check=n=>{let r=n.value,i=r.length;if(("string"==typeof r&&i>t.maximum?sV(r):i)<=t.maximum)return;let o=sW(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),l1=li("$ZodCheckMinLength",(e,t)=>{var n;lH.init(e,t),(n=e._zod.def).when??(n.when=lK),e._zod.check=n=>{let r=n.value,i=r.length;if(("string"==typeof r&&i>=t.minimum&&i<2*t.minimum?sV(r):i)>=t.minimum)return;let o=sW(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),l3=li("$ZodCheckLengthEquals",(e,t)=>{var n;lH.init(e,t),(n=e._zod.def).when??(n.when=lK),e._zod.check=n=>{let r=n.value,i=r.length,o="string"==typeof r&&i>=t.length&&i<=2*t.length?sV(r):i;if(o===t.length)return;let a=sW(r),s=o>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),l2=li("$ZodCheckStringFormat",(e,t)=>{var n,r;lH.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),l6=li("$ZodCheckRegex",(e,t)=>{l2.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),l5=li("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lW),l2.init(e,t)}),l4=li("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=lq),l2.init(e,t)}),l8=li("$ZodCheckIncludes",(e,t)=>{lH.init(e,t);let n=s_(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),l7=li("$ZodCheckStartsWith",(e,t)=>{lH.init(e,t);let n=RegExp(`^${s_(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),l9=li("$ZodCheckEndsWith",(e,t)=>{lH.init(e,t);let n=RegExp(`.*${s_(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ue=li("$ZodCheckOverwrite",(e,t)=>{lH.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),ut=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split(`\n`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${t.join(`\n`)}\n};`)(...Object.values(this.closed))}},un={major:4,minor:6,patch:7},ur=li("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=un;let r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{let i;if(t.memo)return t;let o=sj(t);for(let a of n){if(a._zod.def.when){if(sM(t)||!a._zod.def.when(t))continue}else if(o)continue;let n=t.issues.length,s=a._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new lo;if(i||s instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(sL(t.issues,n,e),o||(o=sj(t,n)))});else{if(t.issues.length===n)continue;sL(t.issues,n,e),o||(o=sj(t,n))}}return i?i.then(()=>t):t},n=(n,r,o)=>{if(sj(n))return n.aborted=!0,n;let a=t(r,i,o);if(a instanceof Promise){if(!1===o.async)throw new lo;return a.then(t=>e._zod.parse(t,o))}return e._zod.parse(a,o)};e._zod.run=(r,o)=>{if(o.skipChecks)return e._zod.parse(r,o);if("backward"===o.direction){let t=e._zod.parse({value:r.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,o)):n(t,r,o)}let a=e._zod.parse(r,o);if(a instanceof Promise){if(!1===o.async)throw new lo;return a.then(e=>t(e,i,o))}return t(a,i,o)}}},{get"~standard"(){return s6(this,"~standard",ua(this))},set"~standard"(e){s2(this,"~standard",e)}}),ui=(e,t)=>e.issues.length?{issues:e.issues.map(e=>s$(e,t,ll()))}:{value:e.value};async function uo(e,t){let n={async:!0};return ui(await e._zod.run({value:t,issues:[]},n),n)}function ua(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return ui(r,n)}catch{}return uo(e,t)},vendor:"zod",version:1}}var us=li("$ZodString",(e,t)=>{ur.init(e,t),e._zod.pattern=t.pattern??lz,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ul=li("$ZodStringFormat",(e,t)=>{l2.init(e,t),us.init(e,t)}),uu=li("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=lG),ul.init(e,t)}),ud=li("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lO(e))}else t.pattern??(t.pattern=lO());ul.init(e,t)}),uc=li("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lI),ul.init(e,t)});function uf(e){try{if("u">typeof URL&&"function"==typeof URL.canParse)return URL.canParse(e);return new URL(e),!0}catch{return!1}}var um=/[\\t\\n\\r]/g;function up(e){return e.replace(um,"")}var uh=li("$ZodURL",(e,t)=>{ul.init(e,t),e._zod.check=n=>{try{var r,i;let o=n.value.trim(),a="normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===lR.source&&!/^https?:\\/\\//i.test(e))return 1;try{if("u">typeof URL){let t=URL;if("function"==typeof t.parse)return t.parse(e)??2}return new URL(e)}catch{return 2}}(o,t):uf(o)||2;if(1===a)return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});if(2===a)return void n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});if(!0===a){n.value=up(o);return}t.hostname&&((r=t.hostname).lastIndex=0,!r.test(a.hostname))&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&((i=t.protocol).lastIndex=0,!i.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol))&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?a.href:up(o);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),uF=li("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$","u")),ul.init(e,t)}),ug=li("$ZodNanoID",(e,t)=>{var n;if(void 0!==t.length&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=void 0===t.length?lk:(n=t.length,RegExp(`^[a-zA-Z0-9_-]{${n}}$`))),ul.init(e,t)}),u_=li("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=lw),ul.init(e,t)}),uP=li("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=lE),ul.init(e,t)}),uD=li("$ZodULID",(e,t)=>{t.pattern??(t.pattern=lA),ul.init(e,t)}),ub=li("$ZodXID",(e,t)=>{t.pattern??(t.pattern=lv),ul.init(e,t)}),uy=li("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=lS),ul.init(e,t)}),uw=li("$ZodISODateTime",(e,t)=>{let n,r,i;t.pattern??(n=["Z"],t.offset&&n.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)"),r=`${l$({precision:t.precision,seconds:!0})}(?:${n.join("|")})`,i=t.local?`${r}|${l$({precision:t.precision})}`:r,t.pattern=RegExp(`^${lB}T(?:${i})$`)),ul.init(e,t)}),uE=li("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=lL),ul.init(e,t)}),uA=li("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${l$(t)}$`)),ul.init(e,t)}),uv=li("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=lx),ul.init(e,t)}),uS=li("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=lN),ul.init(e,t)}),uk=/^[0-9a-fA-F:.]+$/;function ux(e){return!!uk.test(e)&&uf(`http://[${e}]`)}var uG=li("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=lC),ul.init(e,t),e._zod.check=n=>{ux(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),uO=li("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=lj),ul.init(e,t)}),uI=li("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=lM),ul.init(e,t),e._zod.check=n=>{!function(e){let t=e.split("/");if(2!==t.length)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`===r&&!(i<0)&&!(i>128)&&ux(n)}(n.value)&&n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function uN(e){if(""===e)return!0;if(/\\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var uC=/^[0-9a-zA-Z+/]*={0,2}$/,uj=li("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=uC),ul.init(e,t),e._zod.check=n=>{uN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),uM=/^[A-Za-z0-9_-]*$/,uR=li("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=uM),ul.init(e,t),e._zod.check=n=>{!function(e){if(!uM.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return uN(t.padEnd(4*Math.ceil(t.length/4),"="))}(n.value)&&n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),uT=li("$ZodE164",(e,t)=>{t.pattern??(t.pattern=lT),ul.init(e,t)}),uB=li("$ZodJWT",(e,t)=>{ul.init(e,t),e._zod.check=n=>{!function(e,t=null){try{let n=e.split(".");if(3!==n.length)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(n.value,t.alg)&&n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),uL=li("$ZodNumber",(e,t)=>{ur.init(e,t),e._zod.pattern=lU,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;let o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),u$=li("$ZodNumberFormat",(e,t)=>{lY.init(e,t),uL.init(e,t)}),uz=li("$ZodBoolean",(e,t)=>{ur.init(e,t),e._zod.pattern=lV,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),uU=li("$ZodUnknown",(e,t)=>{ur.init(e,t),e._zod.parse=e=>e}),uV=li("$ZodNever",(e,t)=>{ur.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),uW=li("$ZodDate",(e,t)=>{ur.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),n}}),uq=e=>Array.isArray(e)?e.length:-1;function uH(e,t,n){e.issues.length&&t.issues.push(...sR(n,e.issues)),t.value[n]=e.value}var uK=li("$ZodArray",(e,t)=>{ur.init(e,t);let n=ls.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=n?n.alloc(e,r,Array(o.length),i):Array(o.length);let a=[],s=i?.abortEarly;for(let e=0;euH(t,r,e)));else if(uH(l,r,e),s&&0!==l.issues.length&&sj(l))break}return a.length?Promise.all(a).then(()=>r):r},function(e,t){let n=sB(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,o)=>{let a=t(n.value);if(a>r&&!o?.skipChecks&&o?.direction!=="backward"){for(let[t,r]of sB(e._zod.def.checks))if(a>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,sL(n.issues,t,e),n}}return i(n,o)}}(e,uq)});function uZ(e,t,n,r,i,o){let a=n in r,s="optional"===o;if(a||!s||"optional"!==i){if(e.issues.length){if(void 0!==i&&s&&!a)return;t.issues.push(...sR(n,e.issues))}if(!a&&void 0===i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}void 0===e.value?(a||"defaulted"===i&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var uJ=[];function uQ(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:uJ,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let o=sw(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function uX(e,t,n,r,i,o,a){let s=[],l=i.keySet,u=i.catchall._zod,d=u.def.type,c=u.optin,f=u.optout,m=0;for(let i in t){if(a&&n.issues.length!==m){if(sj(n,m))break;m=n.issues.length}if(l.has(i))continue;if("__proto__"===i){"never"===d&&s.push(i);continue}if("never"===d){s.push(i);continue}let o=u.run({value:t[i],issues:[]},r);o instanceof Promise?e.push(o.then(e=>uZ(e,n,i,t,c,f))):uZ(o,n,i,t,c,f)}return(s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o,continue:!0}),e.length)?Promise.all(e).then(()=>n):n}var uY=li("$ZodObject",(e,t)=>{let n;ur.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),i=r?.get?r.get.raw:t.shape??{};if(i){let e=()=>{let n={...i};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=i,Object.defineProperty(t,"shape",{get:e})}let o=aY(()=>uQ(t));s7(e,"propValues",e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){for(let t of(Object.prototype.hasOwnProperty.call(n,e)||a4(n,e,new Set),r.values))n[e].add(t);void 0!==r.optin&&n[e].add(void 0)}}return n});let a=t.catchall,s=ls.memoizer;s?.attach(e),e._zod.parse=(t,r)=>{n??(n=o.value);let i=t.value;if(!sd(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value=s?s.alloc(e,t,{},r):{};let l=[],u=n.shape,d=r?.abortEarly,c=t.issues.length;for(let e of n.allKeys){if(d&&t.issues.length!==c){if(sj(t,c))break;c=t.issues.length}if("__proto__"===e)continue;let n=u[e],o=n._zod.optin,a=n._zod.optout,s=n._zod.run({value:i[e],issues:[]},r);s instanceof Promise?l.push(s.then(n=>uZ(n,t,e,i,o,a))):uZ(s,t,e,i,o,a)}return a?uX(l,i,t,r,o.value,e,!0===d):l.length?Promise.all(l).then(()=>t):t}}),u0=li("$ZodObjectJIT",(e,t)=>{let n,r;uY.init(e,t);let i=e._zod.parse,o=aY(()=>uQ(t)),a=ls.memoizer,s=!ls.jitless,l=s&&sc.value,u=t.catchall;e._zod.parse=(d,c)=>{r??(r=o.value);let f=d.value;return sd(f)?s&&l&&c?.async===!1&&!0!==c.jitless?(n||(n=(t=>{let n=o.value,r=n.symbolKeys,i=new ut(["payload","ctx"],{shape:t,inst:e,memo:a,syms:r}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,l=(e,t)=>`\n let ${e}_ab = false;\n for (let i = 0; i < ${e}.issues.length; i++) {\n const iss = ${e}.issues[i];\n iss.path = iss.path ? [${t}, ...iss.path] : [${t}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${e}_ab = true;\n }\n if (${e}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;i.write("const input = payload.value;");let u=Object.create(null),d=0;for(let e of n.allKeys)u[e]=`key_${d++}`;for(let e of(i.write(a?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};"),n.allKeys)){if("__proto__"===e)continue;let n=u[e],o="symbol"==typeof e?`syms[${r.indexOf(e)}]`:ss(e),a=`${o} in input`,d=t[e],c=d?._zod?.optin,f=void 0!==c,m=d?._zod?.optout==="optional";if(i.write(`const ${n} = ${s(o)};`),f&&m){let e="optional"===c?`${n}_present`:`${n}.value !== undefined || ${n}_present`;i.write(`\n const ${n}_present = ${a};\n if (!${n}.issues.length || ${n}_present) {\n if (${n}.issues.length) {${l(n,o)}\n }\n\n if (${e}) {\n newResult[${o}] = ${n}.value;\n }\n }\n\n `)}else f?(i.write(`\n if (${n}.issues.length) {${l(n,o)}\n }\n `),"defaulted"===c?i.write(`newResult[${o}] = ${n}.value;`):i.write(`\n if (${n}.value !== undefined || ${a}) {\n newResult[${o}] = ${n}.value;\n }\n `)):i.write(`\n const ${n}_present = ${a};\n if (${n}.issues.length) {${l(n,o)}\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${o}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${n}_present) {\n newResult[${o}] = ${n}.value;\n }\n\n `)}return i.write("payload.value = newResult;"),i.write("return payload;"),i.compile()})(t.shape)),d=n(d,c),u)?uX([],f,d,c,r,e,c?.abortEarly===!0):d:i(d,c):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function u1(e,t,n,r){for(let n of e)if(0===n.issues.length)return t.value=n.value,t;let i=e.filter(e=>!sj(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>s$(e,r,ll())))}),t)}var u3=li("$ZodUnion",(e,t)=>{ur.init(e,t),s7(e,"optin",e=>e.def.options.some(e=>"defaulted"===e._zod.optin)?"defaulted":e.def.options.some(e=>void 0!==e._zod.optin)?"optional":void 0),s7(e,"optout",e=>e.def.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),s7(e,"values",e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),s7(e,"pattern",e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>a1(e.source)).join("|")})$`)}});let n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1,a=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)a.push(t),o=!0;else{if(0===t.issues.length)return t;a.push(t)}}return o?Promise.all(a).then(t=>u1(t,r,e,i)):u1(a,r,e,i)}});function u2(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||0===r.size)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(void 0!==e)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var u6=li("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,u3.init(e,t);let n=e._zod.parse;s7(e,"propValues",e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||0===Object.keys(i).length)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);for(let[r,o]of(i[e.def.discriminator]?.has(void 0)&&n++,Object.entries(i)))for(let e of(Object.prototype.hasOwnProperty.call(t,r)||a4(t,r,new Set),o))t[r].add(e)}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=a8(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=aY(()=>u2(t));e._zod.parse=(i,o)=>{let a=i.value;if(!sd(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let s=a?.[t.discriminator],l=r.value.get(s);return l&&(void 0!==s||"backward"!==o.direction)?l._zod.run(i,o):t.unionFallback||"backward"===o.direction?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>null!==r.value.get(e)),input:a,path:[t.discriminator],inst:e}),i)}}),u5=li("$ZodIntersection",(e,t)=>{ur.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>u4(e,t,n)):u4(e,i,o)}});function u4(e,t,n){let r,i=new Map,o=new Map,a=(e,t)=>{let n;if("unrecognized_keys"!==e.code||e.path?.length)if("invalid_key"!==e.code||"record"!==e.origin||e.path?.length!==1)return!1;else{let t=String(e.path[0]);o.has(t)||o.set(t,e),n=[t]}else r??(r=e),n=e.keys;for(let e of n)i.has(e)||i.set(e,{}),i.get(e)[t]=!0;return!0};for(let n of t.issues)a(n,"l")||e.issues.push(n);for(let t of n.issues)a(t,"r")||e.issues.push(t);let s=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=r?s.filter(e=>r.keys.includes(e)):[];for(let n of(t.length&&e.issues.push({...r,keys:t}),s))!t.includes(n)&&o.has(n)&&e.issues.push(o.get(n))}let l=function e(t,n){if(t===n||t instanceof Date&&n instanceof Date&&+t==+n)return{valid:!0,data:t};if(sf(t)&&sf(n)){let r=Object.keys(n),i=Object.keys(t).filter(e=>-1!==r.indexOf(e)),o={...t,...n};for(let r of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,i)){if("__proto__"===r)continue;let i=e(t[r],n[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};o[r]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let i=0;i{ur.init(e,t);let n=t.items,r=ls.memoizer;r?.attach(e),e._zod.parse=(i,o)=>{let a=i.value;if(!Array.isArray(a))return i.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=r?r.alloc(e,i,[],o):[];let s=[],l=u7(n,"optin"),u=u7(n,"optout");if(!t.rest){if(a.lengthn.length&&i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:a,inst:e,origin:"array"})}let d=Array(n.length),c=t.rest?o?.abortEarly:void 0,f=!1;for(let e=0;e{d[e]=t})):(d[e]=t,c&&!f&&t.issues.length&&(f=sj(t)))}if(t.rest&&!f){let e=n.length-1,r=a.slice(n.length),l=i.issues.length;for(let n of r){if(c&&i.issues.length!==l){if(sj(i,l))break;l=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},o);r instanceof Promise?s.push(r.then(t=>u9(t,i,e))):u9(r,i,e)}}return s.length?Promise.all(s).then(()=>de(d,i,n,a,u)):de(d,i,n,a,u)}});function u7(e,t){for(let n=e.length-1;n>=0;n--)if(!("optin"===t?void 0!==e[n]._zod.optin:"optional"===e[n]._zod.optout))return n+1;return 0}function u9(e,t,n){e.issues.length&&t.issues.push(...sR(n,e.issues)),t.value[n]=e.value}function de(e,t,n,r,i){for(let o=0;o=i&&"optional"===n[o]._zod.optin){t.value.length=o;break}if(a.issues.length){if(!s&&o>=i){t.value.length=o;break}t.issues.push(...sR(o,a.issues))}t.value[o]=a.value}for(let e=t.value.length-1;e>=r.length;e--)if("optional"===n[e]._zod.optout&&void 0===t.value[e])t.value.length=e;else break;return t}var dt=li("$ZodEnum",(e,t)=>{ur.init(e,t);let n=aZ(t.entries),r=new Set(n);e._zod.values=r,s7(e,"pattern",e=>{let t=aZ(e.def.entries).filter(e=>sF.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>s_(e.toString())).join("|")})$`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(t,i)=>{let o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),dn=li("$ZodLiteral",(e,t)=>{ur.init(e,t);let n=new Set(t.values);e._zod.values=n,s7(e,"pattern",e=>{let t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?s_(e):e?s_(e.toString()):String(e)).join("|")})$`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(r,i)=>{let o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),dr=li("$ZodTransform",(e,t)=>{ur.init(e,t),e._zod.optin="optional",ls.memoizer?.guard(e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new la(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new lo;return n.value=i,n}});function di(e,t){return e.value=t.issues.length?void 0:t.value,e}var da=li("$ZodOptional",(e,t)=>{ur.init(e,t),s7(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",s7(e,"values",e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),s7(e,"pattern",e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${a1(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>di(e,t)):di(e,r)}return t.innerType._zod.run(e,n)}}),ds=li("$ZodExactOptional",(e,t)=>{da.init(e,t),s7(e,"values",e=>e.def.innerType._zod.values),s7(e,"pattern",e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),dl=li("$ZodNullable",(e,t)=>{ur.init(e,t),s7(e,"optin",e=>e.def.innerType._zod.optin),s7(e,"optout",e=>e.def.innerType._zod.optout),s7(e,"pattern",e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${a1(t.source)}|null)$`):void 0}),s7(e,"values",e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),du=li("$ZodDefault",(e,t)=>{ur.init(e,t),e._zod.optin="defaulted",s7(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>dd(e,t)):dd(r,t)}});function dd(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var dc=li("$ZodPrefault",(e,t)=>{ur.init(e,t),e._zod.optin="defaulted",s7(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),df=li("$ZodNonOptional",(e,t)=>{ur.init(e,t),s7(e,"values",e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>dm(t,e)):dm(i,e)}});function dm(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function dp(e,t,n,r){return t.issues.length?e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>s$(e,r,ll()))},input:e.value}):(e.value=t.value,t.memo&&(e.memo=!0)),e}var dh=li("$ZodCatch",(e,t)=>{ur.init(e,t),s7(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),s7(e,"optout",e=>e.def.innerType._zod.optout),s7(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>dp(e,r,t,n)):dp(e,r,t,n)}}),dF=li("$ZodPipe",(e,t)=>{ur.init(e,t),s7(e,"values",e=>e.def.in._zod.values),s7(e,"optin",e=>e.def.in._zod.optin),s7(e,"optout",e=>e.def.out._zod.optout),s7(e,"propValues",e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>dg(e,t.in,n)):dg(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>dg(e,t.out,n)):dg(r,t.out,n)}});function dg(e,t,n){return e.issues.some(e=>"unrecognized_keys"!==e.code)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var d_=li("$ZodPreprocess",(e,t)=>{dF.init(e,t)}),dP=li("$ZodReadonly",(e,t)=>{ur.init(e,t),s7(e,"propValues",e=>e.def.innerType._zod.propValues),s7(e,"values",e=>e.def.innerType._zod.values),s7(e,"optin",e=>e.def.innerType?._zod?.optin),s7(e,"optout",e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(dD):dD(r)}});function dD(e){return e.memo||(e.value=Object.freeze(e.value)),e}var db=li("$ZodLazy",(e,t)=>{ur.init(e,t),a6(e._zod,"innerType",()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner)),s7(e,"pattern",e=>e.innerType?._zod?.pattern),s7(e,"propValues",e=>e.innerType?._zod?.propValues),s7(e,"optin",e=>e.innerType?._zod?.optin??void 0),s7(e,"optout",e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),dy=li("$ZodCustom",(e,t)=>{lH.init(e,t),ur.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>dw(t,n,r,e));dw(i,n,r,e)}});function dw(e,t,n,r){if(!e){let e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(sH(e))}}var dE=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},dA="~memo",dv=[];function dS(e){return null!==e&&"object"==typeof e}function dk(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var dx=new WeakMap,dG=[],dO={alloc(e,t,n){let r=b;if(!r)return n;b=void 0;let i={value:n,issues:null};return r.set(t.value,i),dG.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{var r,i;let o;if("backward"!==n.direction&&(r=n,i=e.value,void 0!==(o=r[dA]?.backEdges)&&dS(i)&&o.has(i)))throw new dE;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i,o=!1;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(s,l)=>{let u;if(void 0===n){let r=function e(t,n,r){var i,o;let a=dx.get(t);if(void 0!==a)return 2*!!a;if(n.has(t))return 2;n.add(t);let s=0,l=t=>{if(2!==s&&t?._zod){let i=e(t,n,r);i>s&&(s=i)}},u=e=>{e>s&&(s=e)},d=t._zod.def;switch(d.type){case"object":{let t=a8(d);u(t?((t,i)=>{let o=0;for(let a of Reflect.ownKeys(t)){let s=Object.getOwnPropertyDescriptor(t,a);if(i&&!s.enumerable)continue;let l=s.get?1:s.value?._zod?e(s.value,n,r):0;l>o&&(o=l)}return o})(t,!0):1),l(d.catchall);break}case"array":l(d.element);break;case"tuple":for(let e of d.items)l(e);l(d.rest);break;case"record":case"map":l(d.keyType),l(d.valueType);break;case"set":l(d.valueType);break;case"union":for(let e of d.options)l(e);break;case"intersection":l(d.left),l(d.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":l(d.innerType);break;case"pipe":l(d.in),l(d.out);break;case"function":l(d.input),l(d.output);break;case"lazy":{let i=d._cachedInner??(r?t._zod.innerType:void 0);u(i?e(i,n,!1):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let e in d){let t=Object.getOwnPropertyDescriptor(d,e);if(!t||t.get)continue;let n=t.value;if(n&&"object"==typeof n){if(n._zod)l(n);else if(Array.isArray(n))for(let e of n)l(e)}}}return n.delete(t),i=t,1!==(o=s)&&dx.set(i,2===o),o}(e,new Set,!1);if(0===r)return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(s,l);2===r||o?n=!0:o=!0}let d=s.value;if(!dS(d))return t(s,l);let c=l[dA];if(c||(c={buckets:new WeakMap,backEdges:void 0},l[dA]=c),r===l)u=i;else{var f;let t;(t=(f=c).buckets.get(e))||(t=new WeakMap,f.buckets.set(e,t)),u=t,r=l,i=u}let m=u.get(d);if(m)return s.value=m.value,m.issues?m.issues.length&&s.issues.push(...dk(m.issues)):(s.memo=!0,c.backEdges??(c.backEdges=new WeakSet),c.backEdges.add(m.value)),s;b=u;let p=dG.length,h=t(s,l);b=void 0;let F=dG.length>p?dG.pop():void 0;return h instanceof Promise?h.then(e=>(F&&(F.issues=e.issues.length?dk(e.issues):dv),e)):(F&&(F.issues=h.issues.length?dk(h.issues):dv),h)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}},dI=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};(y=globalThis).__zod_globalRegistry??(y.__zod_globalRegistry=new dI);var dN=globalThis.__zod_globalRegistry;function dC(e){return e.checks&&(e.checks=[...e.checks]),e}function dj(e,t){return new lJ({check:"less_than",...sD(t),value:e,inclusive:!1})}function dM(e,t){return new lJ({check:"less_than",...sD(t),value:e,inclusive:!0})}function dR(e,t){return new lQ({check:"greater_than",...sD(t),value:e,inclusive:!1})}function dT(e,t){return new lQ({check:"greater_than",...sD(t),value:e,inclusive:!0})}function dB(e,t){return new lX({check:"multiple_of",...sD(t),value:e})}function dL(e,t){return new l0({check:"max_length",...sD(t),maximum:e})}function d$(e,t){return new l1({check:"min_length",...sD(t),minimum:e})}function dz(e,t){return new l3({check:"length_equals",...sD(t),length:e})}function dU(e){return new ue({check:"overwrite",tx:e})}function dV(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&a4(e,t,n[t]);return e}function dW(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??dN,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function dq(e,t,n,r,i){let o="function"==typeof t.unrepresentable?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw Error(i);return Object.assign(n,o),!0}function dH(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,r);else{let n=a.schema,o=t.processors[i.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}let o=e._zod.parent;o&&(a.ref||(a.ref=o),dH(o,t,r),t.seen.get(o).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&dV(a.schema,l),"input"===t.io&&function e(t,n){let r=n??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,r);if("set"===i.type)return e(i.valueType,r);if("lazy"===i.type)return e(i.getter(),r);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type||"catch"===i.type)return e(i.innerType,r);if("intersection"===i.type)return e(i.left,r)||e(i.right,r);if("record"===i.type||"map"===i.type)return e(i.keyType,r)||e(i.valueType,r);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,r)||e(i.out,r);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],r))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,r))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,r))return!0;if(i.rest&&e(i.rest,r))return!0}return!1}(e)&&(delete a.schema.examples,delete a.schema.default),"input"===t.io&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function dK(e){return e.replace(/~/g,"~0").replace(/\\//g,"~1")}function dZ(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let r=t[1],{ref:i,defId:o}=(t=>{let r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let o=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${dK(o)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:"#"};let o=t[1].schema.id??`__schema${e.counter++}`;return{defId:o,ref:i+dK(o)}})(t);r.def={...r.schema},o&&(r.defId=o);let a=r.schema;for(let e in a)delete a[e];a.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){i(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}if(e.metadataRegistry.get(n[0])?.id||r.cycle){i(n);continue}r.count>1&&"ref"===e.reused&&i(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}var dJ=new Set(["type","properties","required","additionalProperties"]),dQ=["oneOf","anyOf"];function dX(e){let t=e.additionalProperties;return void 0===t||!1===t||"object"!=typeof t||null===t?null:Object.keys(t).length?t:null}function dY(e){let t=[];for(let n of e){if("object"!=typeof n||"object"!==n.type)return null;for(let e in n)if(!dJ.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??dX(n);null!=t&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}a4(n,r,1===e.length?e[0]:dY(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(e=>!1===e.additionalProperties))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=dX(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}1===e.length?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function d0(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=t=>{let n=e.seen.get(t);if(null===n.ref)return;let i=n.def??n.schema,o={...i},a=n.ref;if(n.ref=null,a){r(a);let n=e.seen.get(a),s=n.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):dV(i,s),dV(i,o),t._zod.parent===a)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(s.$ref&&n.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==a){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if("openapi-3.0"!==e.target)for(let t of e.seen.entries())!function e(t){let n=t.anyOf;if(!Array.isArray(n)||0===n.length||void 0!==t.type)return;let r=[];for(let t of n){if(!t||"object"!=typeof t)return;e(t);let n=Object.keys(t);if(1!==n.length||"type"!==n[0])return;let i=t.type;for(let e of Array.isArray(i)?i:[i]){if("string"!=typeof e)return;r.includes(e)||r.push(e)}}delete t.anyOf,t.type=1===r.length?r[0]:r}(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])!function(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of dJ)if(t in e)return;let n=t.filter(e=>dQ.some(t=>Array.isArray(e[t]))),r=null;if(n.length){let e=n[0],i=dQ.find(t=>Array.isArray(e[t]));if(1!==Object.keys(e).length)return;let o=t.filter(t=>t!==e),a=e[i].map(e=>dY([...o,e]));if(a.some(e=>!e))return;r={[i]:a}}else r=dY(t);r&&(delete e.allOf,dV(e,r))}(e)}}let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}dV(i,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,a4(a,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&("draft-2020-12"===e.target?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:d1(t,"input",e.processors),output:d1(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error("Error converting schema to JSON.")}}var d1=(e,t,n={})=>r=>{let{libraryOptions:i,target:o}=r??{},a=dW({...i??{},target:o,io:t,processors:n});return dH(e,a),dZ(a,e),d0(a,e)},d3=(e,t,n)=>{(void 0===e[t]||n>e[t])&&(e[t]=n)},d2=(e,t,n)=>{(void 0===e[t]||n{d3(e,"minimum",t),d2(e,"maximum",t)},d5=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},d4=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},d8=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},d7=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},d9=(e,t)=>d3(e,"minimum",t.minimum),ce=(e,t)=>d2(e,"maximum",t.maximum),ct=e=>(t,n)=>{d7(t,n.format);let[r,i]=e[n.format];d3(t,"minimum",r),d2(t,"maximum",i)},cn={greater_than:(e,t)=>d3(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>d2(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>d5(e,t.value),number_format:ct(sE),bigint_format:ct(sA),min_length:d9,max_length:ce,length_equals:(e,t)=>d6(e,t.length),min_size:d9,max_size:ce,size_equals:(e,t)=>d6(e,t.size),string_format:(e,t)=>{d7(e,t.format),t.pattern&&d4(e,t.pattern),("base64"===t.format||"base64url"===t.format)&&(e.contentEncoding=t.format),(t.local||-1===t.precision)&&(e.laxFormat=!0)},mime_type:(e,t)=>d8(e,t.mime)};function cr(e){let t={},n=e._zod.def;for(let r of e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[])cn[r._zod.def.check]?.(t,r._zod.def);let r=e._zod.bag;for(let e of(void 0!==r.minimum&&d3(t,"minimum",r.minimum),void 0!==r.exclusiveMinimum&&d3(t,"exclusiveMinimum",r.exclusiveMinimum),void 0!==r.maximum&&d2(t,"maximum",r.maximum),void 0!==r.exclusiveMaximum&&d2(t,"exclusiveMaximum",r.exclusiveMaximum),void 0!==r.multipleOf&&d5(t,r.multipleOf),void 0!==r.format&&(t.format??(t.format=r.format),r.format.includes("int")&&(t.isInt=!0)),r.mime&&d8(t,r.mime),r.patterns??[]))d4(t,e);return t}var ci={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},co=new Map([[uC,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[uM,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),ca=e=>co.get(e)??e;function cs(e){let t=e._zod.def;return"pipe"===t.type&&t.in._zod.traits.has("$ZodTransform")?cs(t.out):"catch"===t.type?cs(t.innerType):e._zod.optin}var cl=Symbol();function cu(e,t,n,r,i){let o=!1,a=JSON.stringify(e,(e,t)=>"bigint"!=typeof t?t:(o=!0,null));return o?(dq(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),cl):JSON.parse(a)}var cd=(e,t,n,r)=>{let i=e._zod.def;dH(i.innerType,t,r),t.seen.get(e).ref=i.innerType},cc=new WeakSet([Object.prototype,Error.prototype]);function cf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var cm=li("ZodError",(e,t)=>{lm.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);cc.has(n)||(cc.add(n),cf(n,"format",e=>t=>(function(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{let e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;it=>(function(e,t=e=>e.message){let n={},r=[];for(let a of e.issues)if(a.path.length>0){var i,o;(i=a.path[0],o=()=>[],!Object.prototype.hasOwnProperty.call(n,i)&&("__proto__"===i?Object.defineProperty(n,i,{value:o(),writable:!0,enumerable:!0,configurable:!0}):n[i]=o()),n[i]).push(t(a))}else r.push(t(a));return{formErrors:r,fieldErrors:n}})(e,t)),cf(n,"addIssue",e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,aQ,2)}),cf(n,"addIssues",e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,aQ,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),cp=lh(cm),ch=lF(cm),cF=lg(cm),cg=lP(cm),c_=(i=lh(cm),o=(e,t,n,r)=>i(e,t,n?{...n,direction:"backward"}:{direction:"backward"},lp(o,r))),cP=(a=lh(cm),s=(e,t,n,r)=>a(e,t,n,lp(s,r))),cD=(l=lF(cm),u=async(e,t,n,r)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return await l(e,t,i,lp(u,r))}),cb=(d=lF(cm),c=async(e,t,n,r)=>await d(e,t,n,lp(c,r))),cy=(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return lg(cm)(e,t,r)},cw=(e,t,n)=>lg(cm)(e,t,n),cE=async(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return lP(cm)(e,t,r)},cA=async(e,t,n)=>lP(cm)(e,t,n);function cv(){ls.memoizer||ll({memoizer:dO})}var cS=li("ZodType",(e,t)=>(ls.localeError||ll({localeError:(()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function r(e,t){return"number"!==e||"number"!=typeof t||Number.isFinite(t)?n[e]??e:String(t)}return n=>{switch(n.code){case"invalid_type":{let e=r(n.expected),t=r(sq(n.input),n.input);return`Invalid input: expected ${e}, received ${t}`}case"invalid_value":if(1===n.values.length)return`Invalid input: expected ${sy(n.values[0])}`;return`Invalid option: expected one of ${aJ(n.values,"|")}`;case"too_big":{let t=n.exact?"exactly ":n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Too big: expected ${n.origin??"value"} to have ${t}${n.maximum.toString()} ${r.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${t}${n.maximum.toString()}`}case"too_small":{let t=n.exact?"exactly ":n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Too small: expected ${n.origin} to have ${t}${n.minimum.toString()} ${r.unit}`;return`Too small: expected ${n.origin} to be ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Invalid string: must start with "${n.prefix}"`;if("ends_with"===n.format)return`Invalid string: must end with "${n.suffix}"`;if("includes"===n.format)return`Invalid string: must include "${n.includes}"`;if("regex"===n.format)return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${t[n.format]??n.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${aJ(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0){let e=n.options.map(e=>`\'${e}\'`).join(" | ");return`Invalid discriminator value. Expected ${e}`}if(!1===n.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}})()}),ur.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(az.mergeDefs(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return sP(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new fC({type:"custom",check:"custom",fn:e,...sD(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var n;let r,i;return n=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(sH(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),"input"in e||(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(sH(e)))},e(t.value,t)),(i=new lH({check:"custom",...sD(t)}))._zod.check=n,r=i}(e,t))},overwrite(e){return this.check(dU(e))},optional(){return fD(this)},exactOptional(){var e;return e=this,new fb({type:"optional",innerType:e})},nullable(){return fw(this)},nullish(){return fD(fw(this))},nonoptional(e){var t,n;return t=this,n=e,new fv({type:"nonoptional",innerType:t,...az.normalizeParams(n)})},array(){return fr(this)},or(e){return fs([this,e])},and(e){var t;return t=this,new fd({type:"intersection",left:t,right:e})},transform(e){return fx(this,f_(e))},default(e){var t,n;return t=this,n=e,new fE({type:"default",innerType:t,get defaultValue(){return"function"==typeof n?n():az.shallowClone(n)}})},prefault(e){var t,n;return t=this,n=e,new fA({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof n?n():az.shallowClone(n)}})},catch(e){var t,n;return t=this,new fS({type:"catch",innerType:t,catchValue:"function"==typeof(n=e)?n:az.constantCatch(n)})},pipe(e){return fx(this,e)},readonly(){var e;return e=this,new fO({type:"readonly",innerType:e})},describe(e){let t=this.clone();return dN.add(t,{description:e}),t},meta(...e){if(0===e.length)return dN.get(this);let t=this.clone();return dN.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return 0===t.length?e(this):e(this,...t)},get"~standard"(){return az.hide(this,"~standard",{...ua(this),jsonSchema:{input:d1(this,"input"),output:d1(this,"output")}})},set"~standard"(e){az.own(this,"~standard",e)},parse:function e(t,n){return cp(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ch(this,t,n,{callee:e})},safeParse(e,t){return cF(this,e,t)},async safeParseAsync(e,t){return cg(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){az.own(this,"spa",e)},validate(e,t){let n=this._zod.bag.validator;if(void 0!==n){if(n(e)!==lD)return!0;if(!0===n.definite&&void 0===t)return!1}return function(e,t,n){let r,i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun;if(o?(i[lb]=!0,r=o({value:t,issues:[]},i)):r=e._zod.run({value:t,issues:[]},i),r instanceof Promise)throw new lo;return 0===r.issues.length}(this,e,t)},validateAsync(e,t){return ly(this,e,t)},encode:function e(t,n){return c_(this,t,n,{callee:e})},decode:function e(t,n){return cP(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await cD(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await cb(this,t,n,{callee:e})},safeEncode(e,t){return cy(this,e,t)},safeDecode(e,t){return cw(this,e,t)},async safeEncodeAsync(e,t){return cE(this,e,t)},async safeDecodeAsync(e,t){return cA(this,e,t)},toJSONSchema(e){return((e,t={})=>n=>{let r=dW({...n,processors:t});return dH(e,r),dZ(r,e),d0(r,e)})(this,{})(e)},get description(){return dN.get(this)?.description},get _def(){return this._zod.def}}),ck=li("_ZodString",(e,t)=>{us.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{n.type="string";let{minimum:r,maximum:i,format:o,patterns:a,contentEncoding:s,laxFormat:l}=cr(e);if("number"==typeof r&&(n.minLength=r),"number"==typeof i&&(n.maxLength=i),o&&(n.format=ci[o]??o,""===n.format&&delete n.format,("time"===o||l)&&delete n.format),s&&(n.contentEncoding=s),a&&a.size>0){let e=[...a].map(ca);1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n)},az.derived({format:e=>cr(e).format??null,minLength:e=>cr(e).minimum??null,maxLength:e=>cr(e).maximum??null},{regex(...e){return this.check(function(e,t){return new l6({check:"string_format",format:"regex",...sD(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new l8({check:"string_format",format:"includes",...sD(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new l7({check:"string_format",format:"starts_with",...sD(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new l9({check:"string_format",format:"ends_with",...sD(t),suffix:e})}(...e))},min(...e){return this.check(d$(...e))},max(...e){return this.check(dL(...e))},length(...e){return this.check(dz(...e))},nonempty(...e){return this.check(d$(1,...e))},lowercase(e){return this.check(new l5({check:"string_format",format:"lowercase",...sD(e)}))},uppercase(e){return this.check(new l4({check:"string_format",format:"uppercase",...sD(e)}))},trim(){return this.check(dU(e=>e.trim()))},normalize(...e){return this.check(function(e){return dU(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(dU(e=>e.toLowerCase()))},toUpperCase(){return this.check(dU(e=>e.toUpperCase()))},slugify(){return this.check(dU(e=>sl(e)))}})),cx=li("ZodString",(e,t)=>{us.init(e,t),ck.init(e,t)},{email(e){return this.check(new cM({type:"string",format:"email",check:"string_format",abort:!1,...sD(e)}))},url(e){return this.check(new cB({type:"string",format:"url",check:"string_format",abort:!1,...sD(e)}))},jwt(e){return this.check(new c0({type:"string",format:"jwt",check:"string_format",abort:!1,...sD(e)}))},emoji(e){return this.check(new cL({type:"string",format:"emoji",check:"string_format",abort:!1,...sD(e)}))},guid(e){return this.check(new cR({type:"string",format:"guid",check:"string_format",abort:!1,...sD(e)}))},uuid(e){return this.check(new cT({type:"string",format:"uuid",check:"string_format",abort:!1,...sD(e)}))},uuidv4(e){return this.check(new cT({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...sD(e)}))},uuidv6(e){return this.check(new cT({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...sD(e)}))},uuidv7(e){return this.check(new cT({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...sD(e)}))},nanoid(e){return this.check(new c$({type:"string",format:"nanoid",check:"string_format",abort:!1,...sD(e)}))},cuid(e){return this.check(new cz({type:"string",format:"cuid",check:"string_format",abort:!1,...sD(e)}))},cuid2(e){return this.check(new cU({type:"string",format:"cuid2",check:"string_format",abort:!1,...sD(e)}))},ulid(e){return this.check(new cV({type:"string",format:"ulid",check:"string_format",abort:!1,...sD(e)}))},base64(e){return this.check(new cQ({type:"string",format:"base64",check:"string_format",abort:!1,...sD(e)}))},base64url(e){return this.check(new cX({type:"string",format:"base64url",check:"string_format",abort:!1,...sD(e)}))},xid(e){return this.check(new cW({type:"string",format:"xid",check:"string_format",abort:!1,...sD(e)}))},ksuid(e){return this.check(new cq({type:"string",format:"ksuid",check:"string_format",abort:!1,...sD(e)}))},ipv4(e){return this.check(new cH({type:"string",format:"ipv4",check:"string_format",abort:!1,...sD(e)}))},ipv6(e){return this.check(new cK({type:"string",format:"ipv6",check:"string_format",abort:!1,...sD(e)}))},cidrv4(e){return this.check(new cZ({type:"string",format:"cidrv4",check:"string_format",abort:!1,...sD(e)}))},cidrv6(e){return this.check(new cJ({type:"string",format:"cidrv6",check:"string_format",abort:!1,...sD(e)}))},e164(e){return this.check(new cY({type:"string",format:"e164",check:"string_format",abort:!1,...sD(e)}))},datetime(e){return this.check(new cI({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...sD(e)}))},date(e){return this.check(new cN({type:"string",format:"date",check:"string_format",...sD(e)}))},time(e){return this.check(new cC({type:"string",format:"time",check:"string_format",precision:null,...sD(e)}))},duration(e){return this.check(new cj({type:"string",format:"duration",check:"string_format",...sD(e)}))}});function cG(e){return new cx(dC({type:"string",...sD(e)}))}var cO=li("ZodStringFormat",(e,t)=>{ul.init(e,t),ck.init(e,t)}),cI=li("ZodISODateTime",(e,t)=>{uw.init(e,t),cO.init(e,t)}),cN=li("ZodISODate",(e,t)=>{uE.init(e,t),cO.init(e,t)}),cC=li("ZodISOTime",(e,t)=>{uA.init(e,t),cO.init(e,t)}),cj=li("ZodISODuration",(e,t)=>{uv.init(e,t),cO.init(e,t)}),cM=li("ZodEmail",(e,t)=>{uc.init(e,t),cO.init(e,t)}),cR=li("ZodGUID",(e,t)=>{uu.init(e,t),cO.init(e,t)}),cT=li("ZodUUID",(e,t)=>{ud.init(e,t),cO.init(e,t)}),cB=li("ZodURL",(e,t)=>{uh.init(e,t),cO.init(e,t)}),cL=li("ZodEmoji",(e,t)=>{uF.init(e,t),cO.init(e,t)}),c$=li("ZodNanoID",(e,t)=>{ug.init(e,t),cO.init(e,t)}),cz=li("ZodCUID",(e,t)=>{u_.init(e,t),cO.init(e,t)}),cU=li("ZodCUID2",(e,t)=>{uP.init(e,t),cO.init(e,t)}),cV=li("ZodULID",(e,t)=>{uD.init(e,t),cO.init(e,t)}),cW=li("ZodXID",(e,t)=>{ub.init(e,t),cO.init(e,t)}),cq=li("ZodKSUID",(e,t)=>{uy.init(e,t),cO.init(e,t)}),cH=li("ZodIPv4",(e,t)=>{uS.init(e,t),cO.init(e,t)}),cK=li("ZodIPv6",(e,t)=>{uG.init(e,t),cO.init(e,t)}),cZ=li("ZodCIDRv4",(e,t)=>{uO.init(e,t),cO.init(e,t)}),cJ=li("ZodCIDRv6",(e,t)=>{uI.init(e,t),cO.init(e,t)}),cQ=li("ZodBase64",(e,t)=>{uj.init(e,t),cO.init(e,t)}),cX=li("ZodBase64URL",(e,t)=>{uR.init(e,t),cO.init(e,t)}),cY=li("ZodE164",(e,t)=>{uT.init(e,t),cO.init(e,t)}),c0=li("ZodJWT",(e,t)=>{uB.init(e,t),cO.init(e,t)}),c1=li("ZodNumber",(e,t)=>{uL.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let{minimum:i,maximum:o,multipleOf:a,exclusiveMaximum:s,exclusiveMinimum:l,isInt:u}=cr(e);n.type=u?"integer":"number";let d="number"==typeof l&&l>=(i??-1/0),c="number"==typeof s&&s<=(o??1/0),f="draft-04"===t.target||"openapi-3.0"===t.target;if(d?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:"number"==typeof i&&(n.minimum=i),c?f?(n.maximum=s,n.exclusiveMaximum=!0):n.exclusiveMaximum=s:"number"==typeof o&&(n.maximum=o),a){let i=new Set;for(let o of a)Number.isFinite(o)&&0!==o?i.add(Math.abs(o)):dq(e,t,n,r,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);let[o,...s]=i;void 0!==o&&(n.multipleOf=o),s.length&&(n.allOf=[...n.allOf??[],...s.map(e=>({multipleOf:e}))])}})(e,t,n,r),e.isFinite=!0},az.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=cr(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=cr(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=cr(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>cr(e).format??null},{gt(e,t){return this.check(dR(e,t))},gte(e,t){return this.check(dT(e,t))},min(e,t){return this.check(dT(e,t))},lt(e,t){return this.check(dj(e,t))},lte(e,t){return this.check(dM(e,t))},max(e,t){return this.check(dM(e,t))},int(e){return this.check(c6(e))},safe(e){return this.check(c6(e))},positive(e){return this.check(dR(0,e))},nonnegative(e){return this.check(dT(0,e))},negative(e){return this.check(dj(0,e))},nonpositive(e){return this.check(dM(0,e))},multipleOf(e,t){return this.check(dB(e,t))},step(e,t){return this.check(dB(e,t))},finite(){return this}}));function c3(e){return new c1(dC({type:"number",checks:[],...sD(e)}))}var c2=li("ZodNumberFormat",(e,t)=>{u$.init(e,t),c1.init(e,t)});function c6(e){return new c2({type:"number",check:"number_format",abort:!1,format:"safeint",...sD(e)})}var c5=li("ZodBoolean",(e,t)=>{uz.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.type="boolean"}});function c4(e){return new c5({type:"boolean",...sD(e)})}var c8=li("ZodUnknown",(e,t)=>{uU.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function c7(){return new c8({type:"unknown"})}var c9=li("ZodNever",(e,t)=>{uV.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.not={}}});function fe(e){return new c9({type:"never",...sD(e)})}var ft=li("ZodDate",(e,t)=>{uW.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{dq(e,t,n,r,"Date cannot be represented in JSON Schema")},e.min=(t,n)=>e.check(dT(t,n)),e.max=(t,n)=>e.check(dM(t,n))},az.derived({minDate:e=>{let{minimum:t}=cr(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=cr(e);return t?new Date(t):null}},{})),fn=li("ZodArray",(e,t)=>{cv(),uK.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def,{minimum:o,maximum:a}=cr(e);"number"==typeof o&&(n.minItems=o),"number"==typeof a&&(n.maxItems=a),n.type="array",n.items=dH(i.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element},{min(e,t){return this.check(d$(e,t))},nonempty(e){return this.check(d$(1,e))},max(e,t){return this.check(dL(e,t))},length(e,t){return this.check(dz(e,t))},unwrap(){return this.element}});function fr(e,t){return new fn({type:"array",element:e,...sD(t)})}var fi=li("ZodObject",(e,t)=>{cv(),u0.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def,o=i.shape;if(Object.getOwnPropertySymbols(o).length&&dq(e,t,n,r,"Symbol keys cannot be represented in JSON Schema"))return;for(let e in n.type="object",n.properties={},o)a4(n.properties,e,dH(o[e],t,{...r,path:[...r.path,"properties",e]}));let a=[];for(let e of Object.keys(o)){let n=i.shape[e];("input"===t.io?void 0===cs(n):void 0===n._zod.optout)&&a.push(e)}a.length>0&&(n.required=a),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=dH(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(n.additionalProperties=!1)})(e,t,n,r),az.installLazyProp(e,"shape",e=>e._zod.def.shape,!1)},{keyof(){return fp(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(az.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(az.mergeDefs(this._zod.def,{catchall:c7()}))},loose(){return this.clone(az.mergeDefs(this._zod.def,{catchall:c7()}))},strict(){return this.clone(az.mergeDefs(this._zod.def,{catchall:fe()}))},strip(){return this.clone(az.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return az.extend(this,e)},safeExtend(e){return az.safeExtend(this,e)},merge(e){return az.merge(this,e)},pick(e){return az.pick(this,e)},omit(e){return az.omit(this,e)},partial(...e){return az.partial(fP,this,e[0])},exactPartial(...e){return az.partial(fb,this,e[0],"exactPartial")},required(...e){return az.required(fv,this,e[0])}});function fo(e,t){return new fi({type:"object",shape:e??{},...az.normalizeParams(t)})}var fa=li("ZodUnion",(e,t)=>{u3.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a;return o=!1===(i=e._zod.def).inclusive,a=i.options.map((e,n)=>dH(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]})),void(o?n.oneOf=a:n.anyOf=a)},e.options=t.options});function fs(e,t){return new fa({type:"union",options:e,...az.normalizeParams(t)})}var fl=li("ZodDiscriminatedUnion",(e,t)=>{fa.init(e,t),u6.init(e,t)});function fu(e,t,n){return new fl({type:"union",options:t,discriminator:e,...az.normalizeParams(n)})}var fd=li("ZodIntersection",(e,t)=>{u5.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a,s,l;return o=dH((i=e._zod.def).left,t,{...r,path:[...r.path,"allOf",0]}),a=dH(i.right,t,{...r,path:[...r.path,"allOf",1]}),void(n.allOf=l=[...(s=e=>"allOf"in e&&1===Object.keys(e).length)(o)?o.allOf:[o],...s(a)?a.allOf:[a]],t.intersections.push(l))}}),fc=li("ZodTuple",(e,t)=>{cv(),u8.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def;n.type="array";let o="draft-2020-12"===t.target?"prefixItems":"items",a="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=i.items.map((e,n)=>dH(e,t,{...r,path:[...r.path,o,n]})),l=i.rest?dH(i.rest,t,{...r,path:[...r.path,a,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let e=i.items[u-1];if(!("input"===t.io?void 0!==cs(e):"optional"===e._zod.optout))break;u--}let d=i.items.length,c=!i.rest;"draft-2020-12"===t.target?(n.prefixItems=s,c?n.items=!1:l&&(n.items=l)):"openapi-3.0"===t.target?(n.items={anyOf:s},l&&n.items.anyOf.push(l)):(n.items=s,c?n.additionalItems=!1:l&&(n.additionalItems=l)),u>0&&(n.minItems=u),c&&(n.maxItems=d);let{minimum:f,maximum:m}=cr(e);"number"==typeof f&&(n.minItems=f),"number"==typeof m&&(n.maxItems=m)})(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(e=>new fP({type:"optional",innerType:e}))})}});function ff(e,t,n){let r=t instanceof ur,i=r?n:t;return new fc({type:"tuple",items:e,rest:r?t:null,...az.normalizeParams(i)})}var fm=li("ZodEnum",(e,t)=>{dt.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t)=>{let n=aZ(e._zod.def.entries);if(0===n.length){t.not={};return}n.every(e=>"number"==typeof e)&&(t.type="number"),n.every(e=>"string"==typeof e)&&(t.type="string"),t.enum=n})(e,n),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new fm({...t,checks:[],...az.normalizeParams(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new fm({...t,checks:[],...az.normalizeParams(r),entries:i})}});function fp(e,t){return new fm({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...az.normalizeParams(t)})}var fh=li("ZodLiteral",(e,t)=>{dn.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def;if(0===i.values.length){n.not={};return}let o=[];for(let a of i.values)if(void 0===a){if(dq(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof a){if(dq(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(a))}else o.push(a);if(0===o.length);else if(1===o.length){let e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function fF(e,t){return new fh({type:"literal",values:Array.isArray(e)?e:[e],...az.normalizeParams(t)})}var fg=li("ZodTransform",(e,t)=>{cv(),dr.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{dq(e,t,n,r,"Transforms cannot be represented in JSON Schema")},e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new la(e.constructor.name);n.addIssue=r=>{"string"==typeof r?n.issues.push(az.issue(r,n.value,t)):(r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=n.value),r.inst??(r.inst=e),n.issues.push(az.issue(r)))};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function f_(e){return new fg({type:"transform",transform:e})}var fP=li("ZodOptional",(e,t)=>{da.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cd(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fD(e){return new fP({type:"optional",innerType:e})}var fb=li("ZodExactOptional",(e,t)=>{ds.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cd(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),fy=li("ZodNullable",(e,t)=>{dl.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a;return o=dH((i=e._zod.def).innerType,t,r),a=t.seen.get(e),void("openapi-3.0"===t.target?(a.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function fw(e){return new fy({type:"nullable",innerType:e})}var fE=li("ZodDefault",(e,t)=>{du.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o;return dH((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType,void((o=cu(i.defaultValue,e,t,n,r))!==cl&&(n.default=o))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),fA=li("ZodPrefault",(e,t)=>{dc.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def;if(dH(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"!==t.io)return;let o=cu(i.defaultValue,e,t,n,r);o!==cl&&(n._prefault=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),fv=li("ZodNonOptional",(e,t)=>{df.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;dH((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType},e.unwrap=()=>e._zod.def.innerType}),fS=li("ZodCatch",(e,t)=>{dh.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i,o=e._zod.def;dH(o.innerType,t,r),t.seen.get(e).ref=o.innerType;try{i=o.catchValue(void 0)}catch{dq(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=i})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),fk=li("ZodPipe",(e,t)=>{dF.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a;return o=(i=e._zod.def).in._zod.traits.has("$ZodTransform"),void(dH(a="input"===t.io?o?i.out:i.in:i.out,t,r),t.seen.get(e).ref=a)},e.in=t.in,e.out=t.out});function fx(e,t){return new fk({type:"pipe",in:e,out:t})}var fG=li("ZodPreprocess",(e,t)=>{fk.init(e,t),d_.init(e,t)}),fO=li("ZodReadonly",(e,t)=>{dP.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;dH((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),fI=li("ZodLazy",(e,t)=>{db.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;dH(i=e._zod.innerType,t,r),t.seen.get(e).ref=i},e.unwrap=()=>e._zod.def.getter()});function fN(e){return new fI({type:"lazy",getter:e})}var fC=li("ZodCustom",(e,t)=>{dy.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{dq(e,t,n,r,"Custom types cannot be represented in JSON Schema")}});function fj(e,t){return new fG({type:"pipe",in:f_(e),out:t})}var fM=(("document"in globalThis||"WorkerGlobalScope"in globalThis)&&ll({jitless:!0}),fo),fR=Symbol.for("@embedpdf/engine-core/reading");function fT(e,t){e._zod.def[fR]=t}function fB(e){return fT(e,{closed:!0}),e}function fL(e,t,n=e=>e,r=e=>e){let{discriminator:i}=e.def,o=fj(o=>{if("object"!=typeof o||null===o||Array.isArray(o))return o;let a=r(o),s=a[i];return"string"!=typeof s||function(e,t){let n=e._zod,r=n.bag.optionsMap;r||(r=u2(n.def),n.bag.optionsMap=r);let i=r.get(t);if(null===i)throw Error(`Ambiguous discriminator value "${String(t)}"`);return i}(e,s)?a:n({...a,[i]:t})},e);return fT(o,{unknownAs:t}),o}var f$=fM({kind:fB(fF("objectNumber")),objectNumber:c3().int().positive()}),fz=cG().regex(/^#[0-9a-fA-F]{6}$/,"expected a color as \'#rrggbb\'"),fU=fB(fp(["solid","dashed","beveled","inset"])),fV=fB(fp(["solid","dashed","beveled","inset","underline"])),fW=fB(fp(["check","cross","star","circle","square","diamond"])),fq=fB(fp(["caption","image","caption-below","caption-above","caption-right","caption-left","caption-over"])),fH=fp(["solid","dashed"]),fK=fr(c3().nonnegative()).min(1),fZ=fB(fp(["none","square","circle","diamond","open-arrow","closed-arrow","butt","r-open-arrow","r-closed-arrow","slash"])),fJ=fM({start:fZ,end:fZ});fp(Z);var fQ=fB(fp(["left","center","right"])),fX=fB(fp(["free-text","free-text-callout","free-text-typewriter"])),fY=fp(["free-text","free-text-callout"]),f0=fB(fp(["top","middle","bottom"])),f1=fB(fF("replace")),f3=fB(fF("strikeout-text-edit")),f2=fB(fF("ink-highlight")),f6=fB(fp(["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"])),f5=fB(fu("kind",[fM({kind:fF("objectNumber"),page:f$,objectNumber:c3().int().positive()}),fM({kind:fF("baseIndex"),page:f$,baseIndex:c3().int().nonnegative()})])),f4=c3().nullable(),f8=fB(fu("kind",[fM({kind:fF("xyz"),page:f$,left:f4,top:f4,zoom:f4}),fM({kind:fF("fit"),page:f$}),fM({kind:fF("fitH"),page:f$,top:f4}),fM({kind:fF("fitV"),page:f$,left:f4}),fM({kind:fF("fitR"),page:f$,left:c3(),bottom:c3(),right:c3(),top:c3()}),fM({kind:fF("fitB"),page:f$}),fM({kind:fF("fitBH"),page:f$,top:f4}),fM({kind:fF("fitBV"),page:f$,left:f4})])),f7=fB(fu("kind",[fM({kind:fF("xyz"),page:f$,x:f4,y:f4,zoom:f4}),fM({kind:fF("fit"),page:f$}),fM({kind:fF("fitH"),page:f$,y:f4}),fM({kind:fF("fitV"),page:f$,x:f4}),fM({kind:fF("fitR"),page:f$,x:c3(),y:c3(),width:c3().nonnegative(),height:c3().nonnegative()}),fM({kind:fF("fitB"),page:f$}),fM({kind:fF("fitBH"),page:f$,y:f4}),fM({kind:fF("fitBV"),page:f$,x:f4})]));function f9(e){let t=fM({kind:fF("goto"),destination:e}),n=fM({kind:fF("uri"),uri:cG()});return{read:fL(fu("kind",[t,n,fM({kind:fF("goto-remote"),file:cG()}),fM({kind:fF("launch"),path:cG()}),fM({kind:fF("javascript")}),fM({kind:fF("named"),name:cG()}),fM({kind:fF("unsupported")})]),"unsupported").describe("Where a link goes, by its `kind`. A newer server can add kinds: read one your client doesn\'t know as `unsupported`."),write:fu("kind",[t,n,fM({kind:fF("named"),name:fp(["NextPage","PrevPage","FirstPage","LastPage"])})])}}var me=f9(f7),mt=f9(f8),mn=me.read,mr=me.write,mi=mt.read,mo=mt.write,ma=fB(fu("kind",[fM({kind:fF("name"),name:cG()}),fM({kind:fF("objectNumber"),objectNumber:c3().int().positive()})])),ms={exclude:c4(),includeNoValueFields:c4(),format:fB(fp(["fdf","html","xfdf","pdf"])),method:fB(fp(["post","get"])),submitCoordinates:c4(),includeAppendSaves:c4(),includeAnnotations:c4(),canonicalFormat:c4(),exclNonUserAnnots:c4(),exclFKey:c4(),embedForm:c4()},ml=Object.fromEntries(Object.entries(ms).map(([e,t])=>[e,t.optional()]));function mu(e){let t={subtype:cG(),next:fr(fN(()=>i))},n=(e,n={})=>fM({type:fF(e),...t,...n}),r=[n("javascript",{script:cG()}),n("goto",{destination:e}),n("uri",{uri:cG(),isMap:c4()}),n("named",{name:cG()}),n("hide",{targets:fr(ma),hide:c4()}),n("reset-form",{fields:fr(ma).nullable(),exclude:c4()}),n("goto-remote",{filePath:cG()}),n("goto-embedded",{filePath:cG()}),n("launch",{filePath:cG()}),n("rendition",{script:cG().optional()}),n("submit-form",{payload:fM({url:cG(),fields:fr(ma).nullable(),...ms,charSet:cG().optional()}).optional()}),n("thread"),n("sound"),n("movie"),n("import-data"),n("set-ocg-state"),n("transition"),n("goto-3d-view"),n("unknown")],i=fN(()=>fL(fu("type",[...r]),"unknown").describe("An action, by its `type`. A newer server can add types: read one your client doesn\'t know as `unknown`, keeping its `subtype` and `next`.")),o=fM({root:i.nullable(),incomplete:c4(),warnings:fr(fB(fp(["cycle-dropped","malformed-next","incomplete","payload-dropped"])))});return{arms:r,node:i,tree:o,fieldActions:fM({keystroke:o.optional(),format:o.optional(),validate:o.optional(),calculate:o.optional()}),pageActions:fM({open:o.optional(),close:o.optional()}),annotationActions:fM({activate:o.optional(),cursorEnter:o.optional(),cursorExit:o.optional(),mouseDown:o.optional(),mouseUp:o.optional(),focus:o.optional(),blur:o.optional(),pageOpen:o.optional(),pageClose:o.optional(),pageVisible:o.optional(),pageInvisible:o.optional()}),documentActions:fM({nameTreeScripts:fr(fM({name:cG(),action:o})),openAction:o.nullable(),openDestination:e.nullable(),willClose:o.optional(),willSave:o.optional(),didSave:o.optional(),willPrint:o.optional(),didPrint:o.optional()}).superRefine((e,t)=>{null!==e.openAction&&null!==e.openDestination&&t.addIssue({code:"custom",message:"openAction and openDestination are mutually exclusive",path:["openDestination"]})})}}var md=mu(f7),mc=mu(f8);function mf(e){let t=()=>({next:fr(fN(()=>r)).optional()}),n=[fM({type:fF("javascript"),script:cG(),...t()}),fM({type:fF("goto"),destination:e,...t()}),fM({type:fF("uri"),uri:cG().min(1),...t()}),fM({type:fF("named"),name:cG().min(1),...t()}),fM({type:fF("hide"),targets:fr(ma).min(1),hide:c4(),...t()}),fM({type:fF("reset-form"),fields:fr(ma).nullable(),exclude:c4(),...t()}),fM({type:fF("submit-form"),url:cG().min(1),fields:fr(ma).nullable(),...ml,...t()})],r=fN(()=>fu("type",[...n])),i=()=>r.nullable().optional();return{node:r,widgetActions:fM({activate:i(),cursorEnter:i(),cursorExit:i(),mouseDown:i(),mouseUp:i(),focus:i(),blur:i(),pageOpen:i(),pageClose:i(),pageVisible:i(),pageInvisible:i()}).strict()}}var mm=mf(f7),mp=mf(f8);mm.node;var mh=mm.widgetActions,mF=mp.widgetActions;md.node,fp(md.arms.map(e=>e.shape.type.value)),md.tree;var mg=md.fieldActions;md.pageActions,md.documentActions;var m_=md.annotationActions,mP=mc.annotationActions,mD=fN(()=>fM({type:fF("javascript"),script:cG(),next:fr(mD).optional()})),mb=fM({keystroke:mD.nullable().optional(),format:mD.nullable().optional(),validate:mD.nullable().optional(),calculate:mD.nullable().optional()}),my=fM({x:c3(),y:c3()}),mw=fM({start:my,end:my}),mE=fs([ff([my,my]),ff([my,my,my])]),mA=fr(fr(my)),mv=fM({left:c3().finite(),bottom:c3().finite(),right:c3().finite(),top:c3().finite()});fM({width:c3().nonnegative(),height:c3().nonnegative()});var mS=fM({upperLeft:my,upperRight:my,lowerLeft:my,lowerRight:my}),mk=fB(fs([fF(0),fF(90),fF(180),fF(270)])),mx=fM({x:c3(),y:c3()}),mG=fM({x:c3().finite(),y:c3().finite(),width:c3().finite().nonnegative(),height:c3().finite().nonnegative()});function mO(e,t,n){let r=r=>mO(e,t,{...n,...r});return{read:e,write:t,traits:n,nullable:()=>r({readNullable:!0,writeNullable:!0}),nullableOnRead:()=>r({readNullable:!0}),optional:()=>r({required:!1}),readBack:()=>r({readBack:!0}),space:e=>r({space:e}),writes:t=>mO(e,t,n)}}fM({upperLeft:mx,upperRight:mx,lowerLeft:mx,lowerRight:mx});var mI=(e,t)=>({owner:e,readNullable:!1,writeNullable:!1,required:t,readBack:!1,space:"none"}),mN=e=>mO(e,e,mI("data",!0)),mC=e=>mO(e,e,mI("attribution",!1)),mj=e=>mO(e,e,mI("engine",!1)),mM={box:{read:mG,write:mG},linkTarget:{read:mn,write:mr},actions:{read:m_,write:mh}};function mR(e,t,n){let r={subtype:fB(fF(e))},i={subtype:fF(e)},o={subtype:fF(e).optional()},a={};for(let[e,s]of Object.entries(t)){let{owner:t,readNullable:l,writeNullable:u,required:d,readBack:c}=s.traits,f=n(s);if(r[e]=l?f.read.nullable():f.read,"data"===t){let t=u?f.write.nullable():f.write;i[e]=d?t:t.optional();let n=f.read===f.write?l||u?f.write.nullable():f.write:fs([t,r[e]]);o[e]=(c?n:t).optional(),c&&(a[e]=t)}else i[e]=c?r[e].optional():c7().optional(),o[e]=c?r[e].optional():c7().optional(),c&&(a[e]=null)}return{read:r,create:i,update:o,readBackWrites:a}}function mT(e,t,n={}){let r=mR(e,t,e=>e),i=mR(e,t,e=>mM[e.traits.space]??e);return{subtype:e,fields:t,resources:n,readSchema:fM(i.read),createSchema:fM(i.create).strict(),updateSchema:fM(i.update).strict(),fileSchemas:{read:fM(r.read),create:fM(r.create).strict(),update:fM(r.update).strict()},readBackWrites:r.readBackWrites,shapes:{read:i.read,create:i.create,update:i.update}}}var mB=cG().datetime({offset:!0,local:!0}),mL=fs([mB,new ft({type:"date",...sD(void 0)})]),m$=c3().finite().refine(e=>Number.isFinite(Math.fround(e)),"Outside PDF float range"),mz=fM({x:m$,y:m$}),mU=mz.strict(),mV=m$.refine(e=>Math.fround(e)>0,"Must be positive in PDF float precision"),mW=fM({unit:cG(),conversion:m$.optional(),fraction:fB(fp(["decimal","fraction","round","truncate"])).optional(),precision:c3().int().optional(),fixed:c4().optional(),thousands:cG().optional(),decimal:cG().optional(),prefixSpacing:cG().optional(),suffixSpacing:cG().optional(),labelPosition:fB(fp(["suffix","prefix"])).optional()}),mq=fM({subtype:fF("rectilinear"),ratio:cG().optional(),x:fr(mW),y:fr(mW).optional(),distance:fr(mW),area:fr(mW),angle:fr(mW).optional(),slope:fr(mW).optional(),origin:mz.optional(),cyx:m$.optional()}),mH=mW.extend({conversion:mV,precision:c3().int().min(1).max(0x7fffffff).optional()}).refine(eL,"Invalid number format precision"),mK=mq.extend({x:fr(mH),y:fr(mH).optional(),distance:fr(mH),area:fr(mH),angle:fr(mH).optional(),slope:fr(mH).optional(),cyx:mV.optional(),origin:mU.optional()}),mZ=fM({subtype:fF("geospatial")}),mJ=fM({subtype:fF("unknown")}),mQ=fs([mZ,mJ]);fM({measure:mK.nullable()});var mX=fL(fu("subtype",[mq,mZ,mJ]),"unknown").describe("A measure, by its `subtype`. A newer server can add subtypes: read one your client doesn\'t know as `unknown`."),mY=fM({bbox:mG,name:cG().nullable(),measure:mX.nullable(),owned:c4()});fM({viewports:fr(mY)});var m0=fB(fp(["line-arrow","line-dimension"])),m1=fB(fp(["polygon-cloud","polygon-dimension"])),m3=fB(fF("polyline-dimension")),m2=fM({along:m$,perpendicular:m$}).strict();fM({enabled:c4(),position:fp(["inline","top"]).optional(),offset:m2.optional()}).strict(),fM({enabled:c4(),center:mU.optional()}).strict();var m6=fM({length:m$,extension:m$.refine(e=>e>=0).optional(),offset:m$.refine(e=>e>=0).optional()}),m5=m6.strict(),m4=fB(fp(["left","center","right","justify"])),m8={family:cG().min(1),weight:c3().int().min(100).max(900),italic:c4(),size:c3().nonnegative(),color:fz,decoration:fr(fB(fp(["underline","line-through","word"]))),script:fB(fp(["normal","sub","super"])),letterSpacing:c3(),horizontalScale:c3().positive(),unknown:cG().optional()},m7={align:m4,dir:fB(fp(["ltr","rtl"])),lineHeight:c3().positive().optional(),margins:fM({top:c3(),bottom:c3(),left:c3(),right:c3()}).optional(),textIndent:c3().optional(),unknown:cG().optional()},m9=fM(m8).partial(),pe=fM({...m7,runs:fr(fM({text:cG(),style:m9.optional()}))}).partial({align:!0,dir:!0}),pt=fM({body:fM({...m8,...m7}),paragraphs:fr(pe)}),pn=fM({body:fM({...m8,...m7}).partial().optional(),paragraphs:fr(pe)}),pr=fM({to:f5,type:fB(fp(["reply","group"]))}),pi=fM({to:f5,type:fp(["reply","group"]).optional()}),po=cG().min(1),pa=()=>mN(c4()).optional(),ps={ref:mj(f5),page:mj(f$),hasAppearance:mj(c4()),appearanceState:mj(cG()).nullable(),structurePosition:mj(fr(c3().int().nonnegative())).nullable(),nm:mN(cG()).nullable().optional(),rect:mN(mv).space("box"),contents:mN(cG()).nullable().optional(),subject:mN(cG()).nullable().optional(),blendMode:mN(f6).optional(),invisible:pa(),hidden:pa(),print:pa(),noZoom:pa(),noRotate:pa(),noView:pa(),readOnly:pa(),locked:pa(),toggleNoView:pa(),lockedContents:pa(),reply:mN(pr).writes(pi).nullable().optional(),popup:mj(f5).nullable(),groupId:mN(cG().min(1)).nullable().optional(),author:mC(cG()).nullable(),createdAt:mC(mB).writes(mL).nullable(),modifiedAt:mC(mB).writes(mL).nullable(),userId:mC(cG()).nullable(),createdBy:mC(cG()).nullable(),modifiedBy:mC(cG()).nullable(),importedBy:mj(cG()).nullable(),actions:mO(p=mP,p,mI("preserved",!1)).nullable().space("actions")},pl={...ps,richText:mN(pt).writes(pn).nullable().optional().space("length")},pu={color:mN(fz).optional(),opacity:mN(c3().min(0).max(1)).optional()},pd={...pu,color:mN(fz).nullable().optional(),strokeWidth:mN(c3().nonnegative()).optional(),borderStyle:mN(fU).writes(fH).readBack().optional(),dashArray:mN(fr(c3().nonnegative())).writes(fK).nullable().optional()},pc={...pd,interiorColor:mN(fz).nullable().optional()},pf={rect:mj(mv).readBack().space("box")},pm={rotation:mN(c3()).nullable().optional()},pp={...pf,box:mN(mv).space("box").optional(),rotation:mN(c3()).nullable().optional()},ph={...pf,box:mN(mv).space("box").optional(),rotation:mN(mk).nullable().optional()},pF={...pl,...pu,...pf,quadPoints:mN(fr(mS).min(1)).space("quads")},pg={...pl,...pc,...pp,cloudyIntensity:mN(c3().positive()).nullable().optional()},p_={...pl,...pc,...pf,vertices:mN(fr(my)).space("points"),...pm},pP=mN(mX).writes(fs([mK,mQ])).nullable().optional().space("measure"),pD={captionEnabled:mN(c4()).nullable().optional(),captionCenter:mN(my).nullable().optional().space("point")},pb=mT("caret",{...pl,...pu,...pp,intent:mN(f1).nullable().optional()}),py={subtype:"caret",pdfSubtypeCode:14,dtoSchema:pb.readSchema,draftSchema:pb.createSchema,patchSchema:pb.updateSchema,readBackWrites:pb.readBackWrites},pw=mT("circle",pg),pE={subtype:"circle",pdfSubtypeCode:6,dtoSchema:pw.readSchema,draftSchema:pw.createSchema,patchSchema:pw.updateSchema,readBackWrites:pw.readBackWrites},pA=cG().min(1);fM({appearance:pA.optional(),file:pA.optional()}).strict(),fM({appearance:pA}).strict(),fM({appearance:pA.nullable()}).strict(),fM({image:pA.nullable()}).strict();var pv=fM({file:pA}).strict();fM({source:pA}).strict(),fM({image:pA}),fM({resources:pv,name:cG().min(1),mimeType:cG().optional(),description:cG().optional()}),fM({name:cG().min(1),mimeType:cG().optional(),description:cG().optional()});var pS=fM({name:cG(),mimeType:cG().nullable(),description:cG().nullable(),sizeBytes:c3().int().nonnegative().nullable(),md5:cG().nullable(),createdAt:mB.nullable(),modifiedAt:mB.nullable()});fM({kind:fB(fF("key")),key:cG().min(1)}),fM({ref:fM({kind:fB(fF("key")),key:cG()}),name:cG(),mimeType:cG().nullable(),description:cG().nullable(),sizeBytes:c3().int().nonnegative().nullable(),md5:cG().nullable(),createdAt:mB.nullable(),modifiedAt:mB.nullable(),index:c3().int().nonnegative()});var pk=fB(fp(["push-pin","paperclip","graph","tag"])),px=fM({name:cG().min(1),mimeType:cG().nullable().optional(),description:cG().nullable().optional()}),pG=mT("file-attachment",{...pl,...pu,icon:mN(pk).optional(),file:mN(pS).writes(px).nullable().optional()},{file:"required"}),pO=mT("free-text",{...pl,...pp,intent:mN(fX).writes(fY).readBack().optional(),fontFamily:mN(po).optional(),fontSize:mN(c3().positive()).optional(),textAlign:mN(m4).optional(),verticalAlign:mN(f0).optional(),richText:mN(pt).writes(pn).optional().space("length"),color:mN(fz).optional(),fontColor:mN(fz).optional(),interiorColor:mN(fz).nullable().optional(),opacity:mN(c3().min(0).max(1)).optional(),strokeWidth:mN(c3().nonnegative()).optional(),borderStyle:mN(fU).writes(fH).readBack().optional(),dashArray:mN(fr(c3().nonnegative())).writes(fK).nullable().optional(),cloudyIntensity:mN(c3().positive()).nullable().optional(),calloutLine:mN(mE).nullable().optional().space("calloutLine"),lineEnding:mN(fZ).nullable().optional()}),pI=mT("highlight",pF),pN=mT("ink",{...pl,...pd,strokeWidth:mN(c3().nonnegative()).writes(c3().positive()).readBack().optional(),...pf,inkList:mN(mA).writes(fr(fr(my).min(1)).min(1)).readBack().space("strokes"),intent:mN(f2).nullable().optional(),...pm}),pC=mT("line",{...pl,...pc,...pf,linePoints:mN(mw).space("linePoints"),lineEndings:mN(fJ).optional(),...pm,intent:mN(m0).nullable().optional(),measure:pP,captionEnabled:mN(c4()).optional(),captionPosition:mN(fB(fp(["inline","top"]))).optional(),captionOffset:mN(fM({along:c3(),perpendicular:c3()})).nullable().optional(),leader:mN(m6).writes(m5).nullable().optional()}),pj=mT("link",{...ps,target:mN(mi).writes(mo).nullable().readBack().space("linkTarget")}),pM=mT("polygon",{...p_,vertices:mN(fr(my)).writes(fr(my).min(3)).readBack().space("points"),...pD,intent:mN(m1).nullable().optional(),measure:pP,cloudyIntensity:mN(c3().positive()).nullable().optional()}),pR=mT("polyline",{...p_,vertices:mN(fr(my)).writes(fr(my).min(2)).readBack().space("points"),...pD,intent:mN(m3).nullable().optional(),measure:pP,lineEndings:mN(fJ).optional()}),pT=mT("popup",{...ps,parent:mN(f5).nullableOnRead().readBack(),open:mN(c4()).optional()}),pB=mT("redact",{...pl,...pu,rect:mN(mv).optional().space("box"),quadPoints:mN(fr(mS)).optional().space("quads"),interiorColor:mN(fz).nullable().optional(),overlayText:mN(cG()).nullable().optional(),repeat:mN(c4()).optional(),fontFamily:mN(po).optional(),fontSize:mN(c3().nonnegative()).optional(),fontColor:mN(fz).optional(),textAlign:mN(fQ).optional()}),pL=mT("square",pg),p$=mT("squiggly",pF),pz=fB(fp(["contain","cover","fill"])),pU=mT("stamp",{...pl,...pp,name:mN(cG()).nullable().optional(),fit:mN(pz).nullable().optional(),opacity:mN(c3().min(0).max(1)).optional()},{appearance:"required"}),pV=mT("strikeout",{...pF,intent:mN(f3).nullable().optional()}),pW=fB(fp(["comment","key","note","help","new-paragraph","paragraph","insert"])),pq=mT("text",{...pl,...pu,icon:mN(pW).optional(),open:mN(c4()).optional(),state:mN(cG().min(1)).nullable().optional(),stateModel:mN(cG().min(1)).nullable().optional()}),pH=mT("underline",pF),pK=mT("unsupported",{...ps,rawSubtypeCode:mj(c3().int()),rawSubtypeName:mj(cG()).nullable()}),pZ=fB(fu("kind",[fM({kind:fF("objectNumber"),objectNumber:c3().int().positive()}),fM({kind:fF("fqn"),name:cG().min(1)})])),pJ=mT("widget",{...ps,...ph,color:mN(fz).nullable().optional(),interiorColor:mN(fz).nullable().optional(),strokeWidth:mN(c3().nonnegative()).optional(),borderStyle:mN(fV).optional(),dashArray:mN(fr(c3().nonnegative())).writes(fK).nullable().optional(),fontFamily:mN(po).nullable().optional(),fontSize:mN(c3().nonnegative()).nullable().optional(),fontColor:mN(fz).nullable().optional(),textAlign:mN(fQ).optional(),caption:mN(cG()).nullable().optional(),checkStyle:mN(fW).nullable().optional(),layout:mN(fq).nullable().optional(),actions:mN(mP).writes(mF).readBack().nullable().optional().space("actions"),field:mj(pZ).nullable(),fieldKind:mj((h=fp(["text","checkbox","radio","combobox","listbox","pushbutton","signature","unknown"]),F="unknown",f=new Set(h.options),fT(m=fj(e=>"string"!=typeof e||f.has(e)?e:F,h),{unknownAs:F}),m).describe("Its field\'s family. A newer server can add families: read one your client doesn\'t know as `unknown`.")),hasMark:mj(c4())}),pQ=[pI,pH,p$,pV,pw,pL,pM,pR,pC,pj,pN,pO,pb,pq,pU,pG,pJ,pB,pT,pK];function pX(e){return pQ.find(t=>t.subtype===e)??null}var pY={subtype:"file-attachment",pdfSubtypeCode:17,dtoSchema:pG.readSchema,draftSchema:pG.createSchema,patchSchema:pG.updateSchema,readBackWrites:pG.readBackWrites},p0={subtype:"free-text",pdfSubtypeCode:3,dtoSchema:pO.readSchema,draftSchema:pO.createSchema,patchSchema:pO.updateSchema,readBackWrites:pO.readBackWrites},p1={subtype:"highlight",pdfSubtypeCode:9,dtoSchema:pI.readSchema,draftSchema:pI.createSchema,patchSchema:pI.updateSchema,readBackWrites:pI.readBackWrites},p3={subtype:"ink",pdfSubtypeCode:15,dtoSchema:pN.readSchema,draftSchema:pN.createSchema,patchSchema:pN.updateSchema,readBackWrites:pN.readBackWrites},p2={subtype:"line",pdfSubtypeCode:4,dtoSchema:pC.readSchema,draftSchema:pC.createSchema,patchSchema:pC.updateSchema,readBackWrites:pC.readBackWrites},p6={subtype:"link",pdfSubtypeCode:2,dtoSchema:pj.readSchema,draftSchema:pj.createSchema,patchSchema:pj.updateSchema,readBackWrites:pj.readBackWrites},p5={subtype:"polygon",pdfSubtypeCode:7,dtoSchema:pM.readSchema,draftSchema:pM.createSchema,patchSchema:pM.updateSchema,readBackWrites:pM.readBackWrites},p4={subtype:"polyline",pdfSubtypeCode:8,dtoSchema:pR.readSchema,draftSchema:pR.createSchema,patchSchema:pR.updateSchema,readBackWrites:pR.readBackWrites},p8={subtype:"popup",pdfSubtypeCode:16,dtoSchema:pT.readSchema,draftSchema:pT.createSchema,patchSchema:pT.updateSchema,readBackWrites:pT.readBackWrites},p7={subtype:"redact",pdfSubtypeCode:28,dtoSchema:pB.readSchema,draftSchema:pB.createSchema,patchSchema:pB.updateSchema,readBackWrites:pB.readBackWrites},p9={subtype:"square",pdfSubtypeCode:5,dtoSchema:pL.readSchema,draftSchema:pL.createSchema,patchSchema:pL.updateSchema,readBackWrites:pL.readBackWrites},he={subtype:"squiggly",pdfSubtypeCode:11,dtoSchema:p$.readSchema,draftSchema:p$.createSchema,patchSchema:p$.updateSchema,readBackWrites:p$.readBackWrites},ht={subtype:"stamp",pdfSubtypeCode:13,dtoSchema:pU.readSchema,draftSchema:pU.createSchema,patchSchema:pU.updateSchema,readBackWrites:pU.readBackWrites},hn={subtype:"strikeout",pdfSubtypeCode:12,dtoSchema:pV.readSchema,draftSchema:pV.createSchema,patchSchema:pV.updateSchema,readBackWrites:pV.readBackWrites},hr={subtype:"text",pdfSubtypeCode:1,dtoSchema:pq.readSchema,draftSchema:pq.createSchema,patchSchema:pq.updateSchema,readBackWrites:pq.readBackWrites},hi={subtype:"underline",pdfSubtypeCode:10,dtoSchema:pH.readSchema,draftSchema:pH.createSchema,patchSchema:pH.updateSchema,readBackWrites:pH.readBackWrites},ho={subtype:"unsupported",pdfSubtypeCode:0,dtoSchema:pK.readSchema,draftSchema:fe(),patchSchema:fe(),readBackWrites:pK.readBackWrites},ha=fj(e=>"object"!=typeof e||null===e||Array.isArray(e)?e:Q(e),pJ.readSchema),hs=pJ.createSchema,hl=pJ.updateSchema,hu={subtype:"widget",pdfSubtypeCode:20,dtoSchema:pJ.readSchema,draftSchema:hs,patchSchema:hl,readBackWrites:pJ.readBackWrites},hd=Object.fromEntries(rM.map(e=>[e,pJ.shapes.update[e]]));fM(hd).strict();var hc=[p1,hi,he,hn,pE,p9,p5,p4,p2,p6,p3,p0,py,hr,ht,pY,hu,p7,p8,ho],hf=Object.freeze(Object.fromEntries(hc.map(e=>[e.subtype,e])));fL(fu("subtype",[p1.dtoSchema,hi.dtoSchema,he.dtoSchema,hn.dtoSchema,pE.dtoSchema,p9.dtoSchema,p5.dtoSchema,p4.dtoSchema,p2.dtoSchema,p6.dtoSchema,p3.dtoSchema,p0.dtoSchema,py.dtoSchema,hr.dtoSchema,ht.dtoSchema,pY.dtoSchema,hu.dtoSchema,p7.dtoSchema,p8.dtoSchema,ho.dtoSchema]),"unsupported",e=>({...e,rawSubtypeCode:Number.isInteger(e.rawSubtypeCode)?e.rawSubtypeCode:0,rawSubtypeName:"string"==typeof e.rawSubtypeName?e.rawSubtypeName:null}),e=>"widget"===e.subtype?Q(e):e).describe("An annotation, by its `subtype`. A newer server can add subtypes: read one your client doesn\'t know as `unsupported`, keeping the fields every annotation has, with `rawSubtypeCode` 0 and `rawSubtypeName` null when the body has neither.");var hm=fu("subtype",[p1.draftSchema,hi.draftSchema,he.draftSchema,hn.draftSchema,pE.draftSchema,p9.draftSchema,p5.draftSchema,p4.draftSchema,p2.draftSchema,p6.draftSchema,p3.draftSchema,p0.draftSchema,py.draftSchema,hr.draftSchema,ht.draftSchema,pY.draftSchema,hu.draftSchema,p7.draftSchema,p8.draftSchema]);fs(hc.filter(e=>"unsupported"!==e.subtype).map(e=>e.patchSchema));var hp=fu("subtype",pQ.filter(e=>"unsupported"!==e.subtype).map(e=>e.fileSchemas.create)),hh={ref:f5.nullable(),objectNumber:c3().int().nonnegative(),page:f$.nullable()},hF=fM(hh),hg=fM({...hh,onState:cG(),exportValue:cG(),checked:c4()}),h_=fM({label:cG(),value:cG(),selected:c4()}),hP=fL(fu("kind",[fM({kind:fF("none")}),fM({kind:fF("scalar"),value:cG()}),fM({kind:fF("array"),values:fr(cG())}),fM({kind:fF("unsupported")})]),"unsupported").describe("A field\'s stored value, by its `kind`. A newer server can add kinds: read one your client doesn\'t know as `unsupported`."),hD=fL(fu("kind",[fM({kind:fF("date"),pattern:cG()}),fM({kind:fF("time"),pattern:cG()}),fM({kind:fF("other")})]),"other").describe("The shape a text field\'s or a dropdown\'s value has, by its `kind`: a date or a time with the pattern it is shown in, or `other` for a format script the engine does not recognise. A newer server can add kinds: read one your client doesn\'t know as `other`."),hb=cG().min(1).max(64).refine(ep,{message:"a date pattern is made of the groups yyyy yy mmmm mmm mm m dd d, at least one of them and the year, the month and the day each once at most, with spaces and / - . , between them, and at most one time such as HH:MM or h:MM:ss tt"}),hy=cG().min(1).max(64).refine(eF,{message:"a time pattern is a time and nothing else: HH, H, hh or h, then :MM, then :ss when it has seconds, then tt when it has one"}),hw=fu("kind",[fM({kind:fF("date"),pattern:hb}).strict(),fM({kind:fF("time"),pattern:hy}).strict()]),hE=cG().min(1).max(256).refine(rC,{message:"a purpose has no space at its start or its end, and no NUL character"}),hA=cG().min(1).max(256).refine(eN,{message:"a placeholder has no space at its start or its end, and no NUL character"}),hv=fB(fu("kind",[fM({kind:fF("group"),groupId:cG()}),fM({kind:fF("anyone")}),fM({kind:fF("unassigned")})])),hS=fM({signatureIndex:c3().int().nonnegative(),source:fB(fp(["fieldmdp","lock"]))}),hk={ref:pZ,name:cG(),origin:fB(fp(["acroform","recovered"])),readOnly:c4(),required:c4(),noExport:c4(),alternateName:cG().nullable(),mappingName:cG().nullable(),valueEntry:hP,defaultValueEntry:hP,actions:mg.optional(),groupId:cG().nullable(),assignment:hv,lockedBy:hS.nullable(),purpose:cG().nullable(),placeholder:cG().nullable(),createdBy:cG().nullable(),createdAt:mB.nullable(),filledBy:cG().nullable(),filledByName:cG().nullable(),filledAt:mB.nullable(),importedBy:cG().nullable(),widgets:fr(hF)},hx=fL(fu("kind",[fM({...hk,kind:fF("text"),value:cG(),defaultValue:cG(),maxLength:c3().int().positive().nullable(),multiline:c4(),password:c4(),comb:c4(),format:hD.nullable()}),fM({...hk,kind:fF("checkbox"),checked:c4(),exportValue:cG(),hasValuesList:c4().describe("Whether the field names its widgets\' values in a list (`/Opt`), as Acrobat does for values that repeat or aren\'t plain names: each widget\'s `exportValue` is then the list\'s entry at its place, and its `onState` only a key."),widgets:fr(hg)}),fM({...hk,kind:fF("radio"),value:cG(),radiosInUnison:c4(),noToggleToOff:c4(),hasValuesList:c4().describe("Whether the field names its widgets\' values in a list (`/Opt`), as Acrobat does for values that repeat or aren\'t plain names: each widget\'s `exportValue` is then the list\'s entry at its place, and its `onState` only a key."),widgets:fr(hg)}),fM({...hk,kind:fF("combobox"),value:cG(),defaultValue:cG(),edit:c4(),options:fr(h_),format:hD.nullable()}),fM({...hk,kind:fF("listbox"),selectedValues:fr(cG()),defaultValue:fr(cG()),multiSelect:c4(),options:fr(h_),topIndex:c3().int().nonnegative()}),fM({...hk,kind:fF("pushbutton"),hasImage:c4(),takesImage:c4().describe("Whether the push button is an image field, which a person fills with a picture: it has a widget, and every widget\'s press runs Acrobat\'s import-icon script (`event.target.buttonImportIcon()`) and nothing else.")}),fM({...hk,kind:fF("signature")}),fM({...hk,kind:fF("unknown"),rawValue:cG()})]),"unknown",e=>({...e,rawValue:"string"==typeof e.rawValue?e.rawValue:""}),e=>{var t;return"checkbox"!==(t=es(ej(en(el(ey(e)))))).kind&&"radio"!==t.kind||void 0!==t.hasValuesList?t:{...t,hasValuesList:!1}}).describe("A form field, by its `family`. A newer server can add families: read one your client doesn\'t know as `unknown`, keeping the fields every field has, with `rawValue` an empty string when the body has none.");fM({formKind:fB(fp(["none","acroform","xfa"])),needsAppearances:c4(),fields:fr(hx),widgets:fr(ha),calculationOrder:fr(pZ.nullable())}),fM({value:cG().nullable().optional(),checked:c4().optional(),selectedValues:fr(cG()).optional()}).strict().refine(e=>1===[e.value,e.checked,e.selectedValues].filter(e=>void 0!==e).length,{message:"exactly one of value, checked or selectedValues"});var hG=fM({page:f$,rect:mG.optional(),box:mG.optional(),rotation:mk.optional(),exportValue:cG().min(1).optional(),actions:mh.optional(),...hd}).strict(),hO=fM({label:cG(),value:cG()}),hI={name:cG().min(1),readOnly:c4().optional(),required:c4().optional(),noExport:c4().optional(),alternateName:cG().optional(),mappingName:cG().optional(),groupId:cG().min(1).max(256).nullable().optional(),assignment:hv.optional(),purpose:hE.nullable().optional(),placeholder:hA.nullable().optional(),actions:mb.optional(),widgets:fr(hG).optional()},hN=fu("kind",[fM({...hI,kind:fF("text"),defaultValue:cG().optional(),maxLength:c3().int().positive().optional(),multiline:c4().optional(),password:c4().optional(),comb:c4().optional(),format:hw.nullable().optional()}).strict(),fM({...hI,kind:fF("checkbox")}).strict(),fM({...hI,kind:fF("radio"),radiosInUnison:c4().optional(),noToggleToOff:c4().optional()}).strict(),fM({...hI,kind:fF("combobox"),edit:c4().optional(),options:fr(hO).optional(),defaultValue:cG().optional(),format:hw.nullable().optional()}).strict(),fM({...hI,kind:fF("listbox"),multiSelect:c4().optional(),options:fr(hO).optional(),defaultValue:fr(cG()).optional()}).strict(),fM({...hI,kind:fF("pushbutton"),takesImage:c4().optional().describe("Make the push button an image field: the engine writes Acrobat\'s import-icon script as each widget\'s activation action. It needs a widget, and can\'t go beside a widget\'s `actions.activate` or `actions.mouseUp`.")}).strict(),fM({...hI,kind:fF("signature")}).strict()]);function hC(e,t){let n=e.issues[0],r=n.path.join(".");return new N(G.InvalidArg,`${t}${r?` field \'${r}\'`:""}: ${n.message}`,{details:r?{field:r}:{}})}function hj(e){let{ref:t,reply:n,popup:r,...i}=e,o={...i};return"popup"===e.subtype&&delete o.parent,[t.page,...rB(o)]}function hM(e){let t=[],n=pX(e.subtype);for(let[r,i]of Object.entries(n?.fields??{})){let{owner:n,readBack:o,required:a}=i.traits;if("data"!==n||!o||"target"===r)continue;let s=e[r];if(null!=s&&!i.write.safeParse(s).success){if(a)return"item";t.push({field:r,reason:"unsupported-value"})}}return t}function hR(e,t,n,r){let i={...e};delete i.reply;let o=pX(e.subtype)?.fields??{};for(let{field:e}of t)o[e]?.traits.writeNullable?i[e]=null:delete i[e];let a=hm.safeParse(i);if("popup"===e.subtype&&delete i.parent,!a.success){let e=a.error.issues[0],t=e.path.join(".");throw new N(G.InvalidArg,`${r.label}${t?` field \'${t}\'`:""}: ${e.message}`,{details:{...r.details,...t?{field:t}:{}}})}return rL(i,n)}function hT(e,t,n){let r=hN.safeParse(e);if(!r.success){let e=r.error.issues[0],i=e.path.join(".");throw new N(G.InvalidArg,`${t}${i?` member \'${i}\'`:""}: ${e.message}`,{details:{...n,...i?{field:i}:{}}})}return e}fM({name:cG().min(1).optional(),readOnly:c4().optional(),required:c4().optional(),noExport:c4().optional(),alternateName:cG().nullable().optional(),mappingName:cG().nullable().optional(),groupId:cG().min(1).max(256).nullable().optional(),assignment:hv.optional(),purpose:hE.nullable().optional(),placeholder:hA.nullable().optional(),actions:mb.optional(),kind:fp(["text","checkbox","radio","combobox","listbox","pushbutton","signature"]).optional(),defaultValue:fs([cG(),fr(cG())]).nullable().optional(),maxLength:c3().int().positive().nullable().optional(),multiline:c4().optional(),password:c4().optional(),comb:c4().optional(),radiosInUnison:c4().optional(),noToggleToOff:c4().optional(),edit:c4().optional(),multiSelect:c4().optional(),options:fr(hO).optional(),format:hw.nullable().optional(),takesImage:c4().optional().describe("A push button\'s: `true` makes it an image field, writing Acrobat\'s import-icon script as the activation action of each widget whose press does nothing, and is refused while a widget\'s press runs another action. `false` takes the script off each widget whose press is exactly it.")}).strict();var hB=[32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,8226,8364,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,381,8216,8217,8220,8221,8211,8212,732,8482,353,8250,339,382,376,161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],hL={courier:{ascent:803,descent:-248,programHash:"955500bf0048e07e3046477b3874ef9e7653010a2bc780bbf27f837d7ca34d19",codePoints:hB,advances:[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600]},"courier-bold":{ascent:811,descent:-248,programHash:"386d8684b075c7ff4911235ae9691d5e9e924fff13fa1f17841c6d4d4f3762e6",codePoints:hB,advances:[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600]},"courier-bold-oblique":{ascent:811,descent:-248,programHash:"d1dae62980ea92bfa86f9e3961a3064e164e41a5064211f2a3a8833643a322a5",codePoints:hB,advances:[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600]},"courier-oblique":{ascent:803,descent:-248,programHash:"d790f273acf84a1afada2cf96a6eb646728a1a6e7afe961a2cc846bb3a501b0b",codePoints:hB,advances:[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600]},helvetica:{ascent:945,descent:-224,programHash:"93fe419ed14bac240018cf4506dbb64643eeeee379c0b51d3c52d239f4adbc58",codePoints:hB,advances:[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,350,667,222,556,333,1e3,556,556,333,1e3,667,333,1e3,611,222,222,333,333,556,1e3,333,1e3,500,366,944,500,667,333,556,556,556,556,260,556,333,737,370,612,584,737,333,400,584,333,333,333,556,537,278,333,333,365,612,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,584,611,556,556,556,556,500,556,500]},"helvetica-bold":{ascent:962,descent:-227,programHash:"f11bf41cf5d115966ee4d954d9d3eab4a7d1b63d371e5d655fc82d15350bc929",codePoints:hB,advances:[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,1072,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,350,722,278,556,500,1e3,556,556,333,1e3,667,333,1e3,611,278,278,500,500,556,1e3,333,1e3,556,333,944,500,667,333,556,556,556,556,280,556,333,737,370,556,584,737,333,400,584,333,333,333,611,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,584,611,611,611,611,611,556,611,556]},"helvetica-bold-oblique":{ascent:962,descent:-227,programHash:"9cd559e9d134dd6bb8bb75186d4302079e78ebee53a7c9b38dea1fba52a534d8",codePoints:hB,advances:[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,528,556,556,556,556,333,333,584,584,584,611,1072,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,350,722,278,556,500,1e3,556,556,333,1e3,667,333,1e3,611,278,278,500,500,556,1e3,333,1e3,556,333,944,500,667,333,556,556,556,556,280,556,333,737,370,556,584,737,333,400,584,333,333,333,611,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,584,519,611,611,611,611,556,611,556]},"helvetica-oblique":{ascent:951,descent:-224,programHash:"872e4efa9cc73daff4a3fffa952663f32144db19ec91a8407afc359486eae30b",codePoints:hB,advances:[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1116,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,350,667,222,556,333,1e3,556,556,333,1e3,667,350,1e3,611,222,222,333,333,556,1e3,333,1e3,500,333,944,500,667,333,556,556,556,556,260,556,333,737,370,556,584,737,333,400,584,333,333,333,556,537,278,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,584,611,556,556,556,556,500,556,500]},"times-roman":{ascent:878,descent:-249,programHash:"7be927a55309ca34d67972ccf041ff3d156d774017022b18131fa365e6dd922e",codePoints:hB,advances:[250,333,408,500,500,833,778,180,333,333,500,564,250,333,250,278,500,500,500,500,500,500,500,500,500,500,278,278,564,564,564,444,921,722,667,667,722,611,556,722,722,333,389,722,611,889,722,722,556,722,667,556,611,722,722,944,722,722,611,333,278,333,469,500,333,444,500,444,500,444,333,500,500,278,278,500,278,778,500,500,500,500,333,389,278,500,500,722,500,500,444,480,200,480,541,350,722,333,500,444,1e3,500,500,333,1e3,556,333,889,611,333,333,444,444,500,1e3,333,980,389,333,722,444,722,333,500,500,500,500,200,500,333,760,276,500,564,760,333,400,564,300,300,333,500,453,250,333,300,310,500,750,750,750,444,722,722,722,722,722,722,889,667,611,611,611,611,333,333,333,333,722,722,722,722,722,722,722,564,722,722,722,722,722,722,556,500,444,444,444,444,444,444,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,564,500,500,500,500,500,500,500,500]},"times-bold":{ascent:889,descent:-249,programHash:"f23f2efbfa079f9083d967acf695b10db7c78e39862dbeb4788a4fd0533ff29c",codePoints:hB,advances:[250,333,555,500,500,1e3,833,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,930,722,667,722,722,667,611,778,778,389,500,778,667,944,722,778,611,778,722,556,667,722,722,1e3,722,722,667,333,278,333,581,500,333,500,556,444,556,444,333,500,556,278,333,556,278,833,556,500,556,556,444,389,333,556,500,722,500,500,444,394,220,394,520,350,722,333,500,500,1e3,500,500,333,1e3,556,333,1e3,667,333,333,500,500,500,1e3,333,1e3,389,333,722,444,722,333,500,500,500,500,220,500,333,747,300,500,570,747,333,400,570,300,300,333,556,540,250,333,300,330,500,750,750,750,500,722,722,722,722,722,722,1e3,722,667,667,667,667,389,389,389,389,722,722,778,778,778,778,778,570,778,722,722,722,722,722,611,556,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,500,556,500]},"times-bold-italic":{ascent:869,descent:-249,programHash:"cf51fab68d7d965f5755218a7f99b0376bc440e1bb4e90498aef0964aac94490",codePoints:hB,advances:[250,389,555,500,500,833,778,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,832,667,667,667,722,667,667,722,778,389,500,667,611,889,722,722,611,722,667,556,611,722,667,889,667,611,611,333,278,333,570,500,333,500,500,444,500,444,333,500,556,278,278,500,278,778,556,500,500,500,389,389,278,556,444,667,500,444,389,348,220,348,570,350,667,333,500,500,1e3,500,500,333,1e3,556,333,944,611,333,333,500,500,500,1e3,333,1e3,389,333,722,389,611,389,500,500,500,500,220,500,333,747,266,500,606,747,333,400,570,300,300,333,576,500,250,333,300,300,500,750,750,750,500,667,667,667,667,667,667,944,667,667,667,667,667,389,389,389,389,722,722,722,722,722,722,722,570,722,722,722,722,722,611,611,500,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,444,500,444]},"times-italic":{ascent:868,descent:-249,programHash:"f405670768d71ff8d8a4e493cbcb9c6deff9565419bf63a38abb544789aa87b4",codePoints:hB,advances:[250,333,420,500,500,833,778,214,333,333,500,675,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,675,675,675,500,920,611,611,667,722,611,611,722,722,333,444,667,556,833,667,722,611,722,611,500,556,722,611,833,611,556,556,389,278,389,422,500,333,500,500,444,500,444,278,500,500,278,278,444,278,722,500,500,500,500,389,389,278,500,444,667,444,444,389,400,275,400,541,350,500,333,500,556,889,500,500,333,1e3,500,333,944,556,333,333,556,556,500,889,333,980,389,333,667,389,556,389,500,500,500,500,275,500,333,760,276,500,675,760,333,400,675,300,300,333,500,523,250,333,300,310,500,750,750,750,500,611,611,611,611,611,611,889,667,611,611,611,611,333,333,333,333,722,667,722,722,722,722,722,675,722,722,722,722,722,556,611,500,500,500,500,500,500,500,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,675,500,500,500,500,500,444,500,444]},symbol:{ascent:1010,descent:-293,programHash:"1f027bd5b336f563724a2cba62295329edbb3df7ca9efbe8f296d7a1e86849a1",codePoints:[32,33,8704,35,8707,37,38,8715,40,41,8727,43,44,8722,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,8773,913,914,935,916,917,934,915,919,921,977,922,923,924,925,927,928,920,929,931,932,933,962,937,926,936,918,91,8756,93,8869,95,63717,945,946,967,948,949,966,947,951,953,981,954,955,956,957,959,960,952,961,963,964,965,982,969,958,968,950,123,124,125,8764,8364,978,8242,8804,8260,8734,402,9827,9830,9829,9824,8596,8592,8593,8594,8595,176,177,8243,8805,215,8733,8706,8226,247,8800,8801,8776,8230,63718,63719,8629,8501,8465,8476,8472,8855,8853,8709,8745,8746,8835,8839,8836,8834,8838,8712,8713,8736,8711,63194,63193,63195,8719,8730,8901,172,8743,8744,8660,8656,8657,8658,8659,9674,9001,63720,63721,63722,8721,63723,63724,63725,63726,63727,63728,63729,63730,63731,63732,9002,8747,8992,63733,8993,63734,63735,63736,63737,63738,63739,63740,63741,63742],advances:[250,333,713,500,549,833,778,439,333,333,500,549,250,549,250,278,500,500,500,500,500,500,500,500,500,500,278,278,549,549,549,444,549,722,667,722,612,611,763,603,722,333,631,722,686,889,722,722,768,741,556,592,611,690,439,768,645,795,611,333,863,333,658,500,500,631,549,549,494,439,521,411,603,329,603,549,549,576,521,549,549,521,549,603,439,576,713,686,493,686,494,480,200,480,549,750,620,247,549,167,713,500,753,753,753,753,1042,987,603,987,603,400,549,411,549,549,713,494,460,549,549,549,549,1e3,603,1e3,658,823,686,795,987,768,768,823,768,768,713,713,713,713,713,713,713,768,713,790,790,890,823,549,250,713,603,603,1042,987,603,987,603,494,329,790,790,786,713,384,384,384,384,384,384,494,494,494,494,329,274,686,686,686,384,384,384,384,384,384,494,494,494]},"zapf-dingbats":{ascent:826,descent:-163,programHash:"0439c04b1c3ba23c2fd8c2f4a5f2c65b2b0f817588c45afd5c06a41eab70bfbd",codePoints:[32,9985,9986,9987,9988,9742,9990,9991,9992,9993,9755,9758,9996,9997,9998,9999,1e4,10001,10002,10003,10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10017,10018,10019,10020,10021,10022,10023,9733,10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10037,10038,10039,10040,10041,10042,10043,10044,10045,10046,10047,10048,10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,9679,10061,9632,10063,10064,10065,10066,9650,9660,9670,10070,9687,10072,10073,10074,10075,10076,10077,10078,10081,10082,10083,10084,10085,10086,10087,9827,9830,9829,9824,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,10102,10103,10104,10105,10106,10107,10108,10109,10110,10111,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,10123,10124,10125,10126,10127,10128,10129,10130,10131,10132,8594,8596,8597,10136,10137,10138,10139,10140,10141,10142,10143,10144,10145,10146,10147,10148,10149,10150,10151,10152,10153,10154,10155,10156,10157,10158,10159,10161,10162,10163,10164,10165,10166,10167,10168,10169,10170,10171,10172,10173,10174],advances:[278,974,961,974,980,719,789,790,791,690,960,939,549,855,911,933,911,945,974,755,846,762,761,571,677,763,760,759,754,494,552,537,577,692,786,788,788,790,793,794,816,823,789,841,823,833,816,831,923,744,723,749,790,792,695,776,768,792,759,707,708,682,701,826,815,789,789,707,687,696,689,786,787,713,791,785,791,873,761,762,762,759,759,892,892,788,784,438,138,277,415,392,392,668,668,732,544,544,910,667,760,760,776,595,694,626,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,894,838,1016,458,748,924,748,918,927,928,928,834,873,828,924,924,917,930,931,463,883,836,836,867,867,696,696,874,874,760,946,771,865,771,888,967,888,831,873,927,970,918]}},h$=new Uint8Array(128);for(let e=0;e<64;e+=1)h$["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(e)]=e;var hz={standardDisplayHash:e=>hL[e].programHash,lastResortDisplayHash:"e9d14973462069b4906f8d22a9aaec2d6ec9eb02ac31d697631783316d8b8768"},hU=new WeakSet;function hV(e){hU.has(e)||(e.fn.EPDF_InitThread(),hU.add(e))}function hW(e){if(e.aborted){let t=e.reason;if(t instanceof Error)throw t;throw new ns(t)}}function hq(e){let t=/^(?:D:)?(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(?:([Zz])(?:00\'?00\'?)?|([+-])(\\d{2})(?:\'?(\\d{2})\'?)?)?$/.exec(e.trim());if(!t)return null;let[,n,r="01",i="01",o="00",a="00",s="00"]=t,[,,,,,,,l,u,d,c="00"]=t;if(!hK({year:n,month:r,day:i,hour:o,minute:a,second:s}))return null;let f="";if(l)f="Z";else if(u){if(Number(d)>23||Number(c)>59)return null;f=0===Number(d)&&0===Number(c)?"Z":`${u}${d}:${c}`}return`${n}-${r}-${i}T${o}:${a}:${s}${f}`}function hH(e=new Date){if(e instanceof Date){if(Number.isNaN(e.getTime()))throw RangeError("Cannot format an invalid Date");return hH(`${e.toISOString().slice(0,19)}Z`)}let t=/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?(?:([Zz])|([+-])(\\d{2}):(\\d{2}))?$/.exec(e),n=t&&{year:t[1],month:t[2],day:t[3],hour:t[4],minute:t[5],second:t[6]??"00"};if(!t||!n||!hK(n))throw new N(G.InvalidArg,`not an ISO 8601 date and time: \'${e}\'`);let[,,,,,,,r,i,o,a]=t,s=r?"+00\'00\'":i?`${i}${o}\'${a}\'`:"",{year:l,month:u,day:d,hour:c,minute:f,second:m}=n;return`D:${l}${u}${d}${c}${f}${m}${s}`}function hK({year:e,month:t,day:n,hour:r,minute:i,second:o}){let a=Number(e),s=Number(t),l=Number(n);if(s<1||s>12||l<1)return!1;let u=new Date(Date.UTC(2e3,s,0)).getUTCDate();return!(l>(2!==s||a%4==0&&(a%100!=0||a%400==0)?u:28))&&23>=Number(r)&&59>=Number(i)&&59>=Number(o)}function hZ(e){return(hZ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function hJ(e,t,n){var r;return(r=function(e,t){if("object"!=hZ(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=hZ(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==hZ(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hQ=class{constructor(){hJ(this,"byContent",null),hJ(this,"bySource",new Map),hJ(this,"hashes",new WeakMap)}forget(){this.byContent=null,this.bySource.clear()}};function hX(e,t,n){return 4!==e.FPDF_GetLastError()?n:t?new N(G.DocPasswordIncorrect,"incorrect document password"):new N(G.DocPasswordRequired,"document requires a password")}function hY(e,t,n){let r=e.alloc(t);try{return n(r)}finally{e.free(r)}}function h0(e,t,n){let r=t.map(t=>e.alloc(t));try{return n(r)}finally{for(let t=r.length-1;t>=0;t--)e.free(r[t])}}function h1(e,t,n){return hY(e,4*Math.max(1,t.length),r=>(t.forEach((t,n)=>e.poke(r,"i32",t,4*n)),n(r,t.length)))}function h3(e,t,n=""){let r=t(0n,0);return r<=0?null:2===r?n:hY(e,r,n=>0>=t(n,r)?null:e.readU16String(n))}function h2(e,t){let n=t(0n,0);return n<=0?null:hY(e,n,r=>0>=t(r,n)?null:e.readU8String(r))}function h6(e,t,n){let r=e.writeU16String(t);try{return n(r)}finally{e.free(r)}}function h5(e,t,n){let r=e.writeU16String(t);try{return n(r)}finally{e.free(r)}}function h4(e,t,n){let r=new TextEncoder().encode(t),i=new Uint8Array(r.byteLength+1);i.set(r);let o=e.alloc(i.byteLength);try{return e.writeBytes(o,i),n(o)}finally{e.free(o)}}var h8=class{constructor(){hJ(this,"actions",[]),hJ(this,"closed",!1)}push(e){this.closed?e():this.actions.push(e)}close(){if(this.closed)return;this.closed=!0;let e=null;for(let t=this.actions.length-1;t>=0;t--)try{this.actions[t]?.()}catch(t){e??(e=t)}if(this.actions.length=0,e)throw e}};function h7(e,t,n=null){let{mem:r,fn:i}=e,o=new h8,a=r.alloc(t.byteLength);o.push(()=>r.free(a));try{r.writeBytes(a,t);let s=i.FPDF_LoadMemDocument64(a,t.byteLength,n??"");if(!s)throw hX(i,n,new N(G.DocOpenFailed,"failed to open document"));return Fe(e,s),o.push(()=>i.FPDF_CloseDocument(s)),{kind:"fat-memory",docPtr:s,source:{base:null,layer:null,password:n},close:()=>o.close()}}catch(e){throw o.close(),e}}function h9(e,t,n={kind:"fresh"},r=null){let{mem:i,fn:o}=e,a=new h8;a.push(()=>t.release());let s=null,l=i.alloc(4);try{let u;i.poke(l,"i32",-1),"fresh"===n.kind?u=o.EPDFLayer_OpenLayer(t.basePtr,0n,r??"",l):"artifact-file"===n.kind&&"native"===e.kind?u=h4(i,n.path,e=>o.EPDFLayer_OpenLayerArtifactFromPath(t.basePtr,e,r??"",l)):(s="artifact-file"===n.kind?e.fileAccess.fromNodeFile(n.path):e.fileAccess.fromMemory(n.bytes),a.push(()=>s?.close()),u="artifact"===n.kind||"artifact-file"===n.kind?o.EPDFLayer_OpenLayerArtifact(t.basePtr,s.ptr,r??"",l):o.EPDFLayer_OpenLayer(t.basePtr,s.ptr,r??"",l));let d=Number(i.peek(l,"i32"));if(!u||0!==d)throw function(e){switch(e){case 1:return new N(G.DocPasswordRequired,"layer requires a password");case 2:return new N(G.MalformedPdf,"layer delta is malformed");case 3:return new N(G.MalformedPdf,"layer artifact does not match the supplied base document");default:return new N(G.DocOpenFailed,"failed to open layer document")}}(d);Fe(e,u),a.push(()=>o.FPDF_CloseDocument(u));let c="file"===t.kind&&void 0!==t.path?{kind:"file",key:t.key,path:t.path}:{kind:"memory",key:t.key};return{kind:"layer",docPtr:u,source:{base:c,layer:n,password:r},close:()=>a.close()}}catch(e){throw a.close(),e}finally{i.free(l)}}function Fe(e,t){let{fn:n}=e;n.EPDF_IsEncrypted&&n.EPDF_SetRuntimeOwnerPermissions&&n.EPDF_IsEncrypted(t)&&n.EPDF_SetRuntimeOwnerPermissions(t,!0)}function Ft(e,t,n,r=0){let i=BigInt(n);e.poke(t,"i32",0|Number(4294967295n&i),r),e.poke(t,"i32",0|Number(i>>32n&4294967295n),r+4)}function Fn(e,t,n=0){let r=Number(e.peek(t,"i32",n))>>>0;return(Number(e.peek(t,"i32",n+4))>>>0)*0x100000000+r}var Fr={budgetBytes:0x18000000,idleMs:3e4},Fi={place:"elsewhere",pixels:0},Fo=class{constructor(e,t=Fr,n=()=>!1){this.runtime=e,this.policy=t,this.busy=n,hJ(this,"pages",new Map),hJ(this,"closedSizes",new Map),hJ(this,"workingSets",new Map),hJ(this,"totalBytes",0),hJ(this,"clock",0),hJ(this,"timer",null)}acquire(e,t,n){let r=this.take(e,n);if(!r){this.makeRoom(this.expectedBytes(e,n));let i=this.runtime.fn.EPDFDoc_LoadPageByObjectNumberNormalized(t,n);if(!i)throw Fa(n);r=this.add(e,n,i,!0)}if(r.refs++,!r.loaded){if(1!==this.runtime.fn.EPDFPage_ContinueLoad(r.ptr,0x3fffffff))throw this.drop(r),Fs(n);r.loaded=!0}return this.measure(r),this.makeRoom(0),r.ptr}async acquireInSlices(e,t,n,r,i){hW(r);let{fn:o}=this.runtime,a=this.take(e,n);if(!a){this.makeRoom(this.expectedBytes(e,n));let r=o.EPDFDoc_StartLoadPageByObjectNumber(t,n,!0);if(!r)throw Fa(n);a=this.add(e,n,r,!1)}for(a.refs++;!a.loaded;){let t=o.EPDFPage_ContinueLoad(a.ptr,i.budgetMs);if(t<0)throw this.drop(a),Fs(n);if(a.loaded=1===t,this.measure(a),this.makeRoom(0),a.loaded)break;try{await i.between(),hW(r)}catch(t){throw this.release(e,n),t}}return a.ptr}release(e,t){let n=this.pages.get(e)?.get(t);if(n&&!(n.refs<=0)&&(n.refs--,!(n.refs>0))){if(n.lastUsed=++this.clock,n.loaded&&!this.runtime.fn.EPDFPage_ResetRenderCache(n.ptr))return void this.close(n);this.armTimer(),this.makeRoom(0)}}setWorkingSet(e,t,n){let r=new Map;for(let{pageObjectNumber:e,role:t,pixels:i}of n){let n={place:t,pixels:i},o=r.get(e);(!o||aI(n,o))&&r.set(e,n)}let i=this.workingSets.get(e);r.size>0?(i||(i=new Map,this.workingSets.set(e,i)),i.set(t,r)):(i?.delete(t),i?.size===0&&this.workingSets.delete(e)),this.totalBytes>0&&this.armTimer()}isHeld(e,t){return(this.pages.get(e)?.get(t)?.refs??0)>0}isKept(e,t){return this.pages.get(e)?.has(t)??!1}closeOwner(e){for(let t of[...this.pages.get(e)?.values()??[]])this.close(t);this.pages.delete(e),this.closedSizes.delete(e),this.workingSets.delete(e)}closeIdleOf(e){for(let t of[...this.pages.get(e)?.values()??[]])0===t.refs&&this.close(t)}closeIdle(){for(let e of[...this.pages.values()])for(let t of[...e.values()])0===t.refs&&this.close(t)}closeUnshown(){for(let e of[...this.pages.values()])for(let t of[...e.values()])0===t.refs&&"visible"!==this.placeOf(t).place&&this.close(t)}get size(){let e=0;for(let t of this.pages.values())e+=t.size;return e}get bytes(){return this.totalBytes}take(e,t){let n=this.pages.get(e)?.get(t);return n?0!==n.refs||this.runtime.fn.EPDFPage_IsContentCurrent(n.ptr)?(n.lastUsed=++this.clock,n):(this.close(n),null):null}add(e,t,n,r){let i={owner:e,pageObjectNumber:t,ptr:n,refs:0,loaded:r,bytes:65536,lastUsed:++this.clock},o=this.pages.get(e);return o||(o=new Map,this.pages.set(e,o)),o.set(t,i),this.totalBytes+=i.bytes,i}measure(e){let{fn:t,mem:n}=this.runtime,r=65536+hY(n,40,r=>t.EPDFPage_GetParsedSize(e.ptr,r)?Fn(n,r,24):0);this.totalBytes+=r-e.bytes,e.bytes=r}expectedBytes(e,t){return this.closedSizes.get(e)?.get(t)??65536}makeRoom(e){let t=this.policy.budgetBytes>0?this.lastToCloseOverBudget():null;for(;this.totalBytes-(t?.bytes??0)+e>this.policy.budgetBytes;){let e=this.firstToClose(t);if(e)this.close(e);else{if(!t||0!==t.refs)return;this.close(t),t=null}}}firstToClose(e){let t=null,n=Fi;for(let r of this.pages.values())for(let i of r.values()){if(i.refs>0||i===e)continue;let r=this.placeOf(i);(!t||aI(n,r)||!aI(r,n)&&i.lastUsede.lastUsed)&&(e=r,t=n)}return e}placeOf(e){let t=Fi;for(let n of this.workingSets.get(e.owner)?.values()??[]){let r=n.get(e.pageObjectNumber);r&&aI(r,t)&&(t=r)}return t}close(e){if(e.loaded){let t=this.closedSizes.get(e.owner);t||(t=new Map,this.closedSizes.set(e.owner,t)),t.set(e.pageObjectNumber,e.bytes)}this.drop(e)}drop(e){this.runtime.fn.FPDF_ClosePage(e.ptr);let t=this.pages.get(e.owner);t?.delete(e.pageObjectNumber),t?.size===0&&this.pages.delete(e.owner),this.totalBytes-=e.bytes,this.totalBytes<=0&&this.disarmTimer()}armTimer(){this.policy.idleMs<=0||(this.disarmTimer(),this.timer=setTimeout(()=>{this.timer=null,this.busy()?this.armTimer():this.closeUnshown()},this.policy.idleMs),this.timer.unref?.())}disarmTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}};function Fa(e){return new N(G.NotFound,`no page with object number ${e}`)}function Fs(e){return new N(G.RuntimeUnavailable,`failed to load page object ${e}`)}var Fl=class{constructor(e,t,n=null){this.docPtr=t,hJ(this,"residency",void 0),this.residency=n??new Fo(e,{budgetBytes:0,idleMs:0})}acquire(e){return this.residency.acquire(this,this.docPtr,e)}acquireInSlices(e,t,n){return this.residency.acquireInSlices(this,this.docPtr,e,t,n)}isHeld(e){return this.residency.isHeld(this,e)}isKept(e){return this.residency.isKept(this,e)}release(e){this.residency.release(this,e)}setWorkingSet(e,t){this.residency.setWorkingSet(this,e,t)}closeIdle(){this.residency.closeIdleOf(this)}closeAll(){this.residency.closeOwner(this)}},Fu=class{constructor(e,t){this.runtime=e,hJ(this,"docPtr",null),hJ(this,"closeDocument",null),hJ(this,"_kind",null),hJ(this,"_source",null),hJ(this,"_sessionId",void 0),hJ(this,"recordsByObjectNumber",new Map),hJ(this,"recordsByIndex",new Map),hJ(this,"fullyEnumerated",!1),hJ(this,"cacheSeqCounter",0),hJ(this,"editsSeqCounter",0),hJ(this,"transaction",null),hJ(this,"unusableReason",null),hJ(this,"pages",null),hJ(this,"residency",null),hJ(this,"signedDocumentPolicy","protect"),hJ(this,"password",null),hJ(this,"persistLayerArtifact",!0),hJ(this,"loadedSeq",0),hJ(this,"plainSha256",null),hJ(this,"pendingSigning",null),hJ(this,"lastCompletion",null),hJ(this,"drawings",null),hJ(this,"parkedLoad",null),hJ(this,"objectNumberAuthority","session"),hJ(this,"heldObjectNumbers",new Set),hJ(this,"objectNumbersInUse",[]),hJ(this,"retained",[]),this._sessionId=t??`sess_${(++Fc).toString(36)}_${Date.now().toString(36)}`}get sessionId(){return this._sessionId}get kind(){return this._kind}get source(){if(!this._source)throw new N(G.DocNotOpen,"document is not open");return this._source}isOpen(){return null!==this.docPtr}open(e,t=null){this.openFromHandle(h7(this.runtime,e,t))}openFromHandle(e){if(this.docPtr)throw e.close(),new N(G.InvalidArg,"document already open");this.docPtr=e.docPtr,this.closeDocument=()=>e.close(),this._kind=e.kind,this._source=e.source,this.pages=new Fl(this.runtime,e.docPtr,this.residency),this.parkedLoad=null,this.drawings=null,this.loadedSeq=this.editsSeqCounter}hasUnsavedEdits(){return this.editsSeqCounter!==this.loadedSeq}cachedPlainSha256(){return this.plainSha256&&this.plainSha256.loadedSeq===this.loadedSeq?this.plainSha256.sha256:null}rememberPlainSha256(e){this.plainSha256={loadedSeq:this.loadedSeq,sha256:e}}install(e){if(!this.docPtr)throw e.close(),new N(G.DocNotOpen,"no document to replace");let t=null;try{this.pages?.closeAll()}catch(e){t=e}try{this.closeDocument?.()}catch(e){t??(t=e)}if(this.docPtr=e.docPtr,this.closeDocument=()=>e.close(),this._kind=e.kind,this._source=e.source,this.pages=new Fl(this.runtime,e.docPtr,this.residency),this.recordsByIndex.clear(),this.recordsByObjectNumber.clear(),this.fullyEnumerated=!1,this.cacheSeqCounter++,this.editsSeqCounter++,this.loadedSeq=this.editsSeqCounter,this.pendingSigning=null,this.drawings=null,this.heldObjectNumbers.clear(),this.objectNumbersInUse=[],t)throw t}versionRef(e){return{baseSha256:e,editsVersion:this.editsSeqCounter}}parkLocked(e){if(this.docPtr)throw new N(G.InvalidArg,"document already open");this.parkedLoad=e}isLocked(){return null===this.docPtr&&null!==this.parkedLoad}unlockWith(e){if(!this.parkedLoad)throw new N(G.DocNotOpen,"document session is not locked");this.parkedLoad(e),this.parkedLoad=null}pageCount(){return this.runtime.fn.FPDF_GetPageCount(this.requireDocPtr())}ensureFullPageRegistry(){if(this.fullyEnumerated)return;let{fn:e}=this.runtime,t=this.requireDocPtr(),n=e.FPDF_GetPageCount(t);for(let r=0;rthis.resolvePageRef(e).pageObjectNumber)}allRecords(){return this.ensureFullPageRegistry(),Array.from(this.recordsByIndex.entries()).sort(([e],[t])=>e-t).map(([,e])=>e)}refreshPageRegistry(){this.recordsByIndex.clear(),this.recordsByObjectNumber.clear(),this.fullyEnumerated=!1,this.ensureFullPageRegistry()}cacheSeq(){return this.cacheSeqCounter}invalidateDerived(){this.cacheSeqCounter++}editsSeq(){return this.editsSeqCounter}noteEdit(){this.editsSeqCounter++}clearMissingCharacters(){this.docPtr&&this.runtime.fn.EPDFDoc_ClearMissingCharacters(this.docPtr)}missingCharacters(){if(!this.docPtr)return[];let{fn:e,mem:t}=this.runtime,n=this.docPtr,r=[],i=e.EPDFDoc_CountMissingCharacters(n);for(let o=0;oe.EPDFDoc_GetMissingCharacter(n,o,t,r));i&&r.push(i)}return r}inTransaction(){return null!==this.transaction}beginTransaction(e){let t=this.requireDocPtr();if(this.transaction)throw new N(G.Unknown,"a transaction is already open");if(!this.runtime.fn.EPDFLayer_BeginTransaction(t))throw new N(G.Unknown,"EPDFLayer_BeginTransaction refused");this.transaction={docPtr:t,opId:e,undoable:!1}}writeStamp(){let{opId:e,undoable:t}=this.requireTransaction();return{opId:e,undoable:t}}markUndoable(){this.requireTransaction().undoable=!0}commitTransaction(){let{docPtr:e}=this.requireTransaction();if(!this.runtime.fn.EPDFLayer_IsInTransaction(e))throw new N(G.Unknown,"the layer transaction is no longer open");let t=this.runtime.fn.EPDFLayer_GetLastObjectNumber(e);if(t>8388607)throw new N(G.LayerFull,"the document would pass object number 8388607",{details:{lastObjectNumber:t}});this.transaction=null;let n=!1;try{n=this.runtime.fn.EPDFLayer_CommitTransaction(e)}finally{n||(this.unusableReason=Fd)}if(!n)throw new N(G.DocNotOpen,Fd);for(let e of this.objectNumbersInUse)this.heldObjectNumbers.delete(e);this.objectNumbersInUse=[]}abortTransaction(){let{docPtr:e}=this.requireTransaction();this.transaction=null,this.objectNumbersInUse=[];let t=!1;try{t=this.runtime.fn.EPDFLayer_AbortTransaction(e)}catch{}this.drawings?.forget(),this.recordsByIndex.clear(),this.recordsByObjectNumber.clear(),this.fullyEnumerated=!1,this.invalidateDerived(),t||(this.unusableReason="a layer transaction failed to abort")}lastObjectNumber(){return this.runtime.fn.EPDFLayer_GetLastObjectNumber(this.requireDocPtr())}raiseLastObjectNumber(e){if(!this.runtime.fn.EPDFLayer_RaiseLastObjectNumber(this.requireDocPtr(),e))throw new N(G.LayerFull,`the document would pass object number ${e}`,{details:{lastObjectNumber:this.lastObjectNumber()}})}reserveObjectNumbers(e){if("session"!==this.objectNumberAuthority)throw new N(G.InvalidArg,"object numbers are handed out by the caller, not this session");if(!Number.isInteger(e)||e<1)throw new N(G.InvalidArg,`cannot reserve ${e} object numbers`,{details:{field:"count"}});let{fn:t}=this.runtime,n=this.requireDocPtr(),r=t.EPDFLayer_GetLastObjectNumber(n);if(r+e>8e6)throw new N(G.LayerFull,"no more object numbers to hand out",{details:{lastObjectNumber:r}});if(!t.EPDFLayer_RaiseLastObjectNumber(n,r+e))throw new N(G.Unknown,"EPDFLayer_RaiseLastObjectNumber refused");let i={first:r+1,count:e};for(let t=0;t=0;t--)try{this.retained[t]()}catch(t){e??(e=t)}if(this.retained.length=0,e)throw e}},Fd="a layer transaction failed to commit",Fc=0;function Ff(e,t){return new N(G.ObjectNumberUnavailable,"not-held"===t?`object number ${e} isn\'t one this session holds`:`an object already has object number ${e}`,{details:{objectNumber:e,reason:t}})}function Fm(e,t){return hX(e.fn,t,new N(G.DocOpenFailed,"failed to open base document"))}var Fp=class{constructor(e){this.runtime=e,hJ(this,"entries",new Map)}acquireMemoryBase(e){let t=this.retain(e.key);if(t)return t;let{mem:n,fn:r}=this.runtime,i=new h8,o=n.alloc(e.bytes.byteLength);i.push(()=>n.free(o));try{n.writeBytes(o,e.bytes);let t=r.EPDF_LoadMemBaseDocument64(o,e.bytes.byteLength,e.password??"");if(!t)throw Fm(this.runtime,e.password);return Fe(this.runtime,t),i.push(()=>r.EPDF_ReleaseBaseDocument(t)),this.supplyKnownSha(t,e.knownSha256),this.insert({key:e.key,kind:"memory",basePtr:t,refs:1,close:()=>i.close()})}catch(e){throw i.close(),e}}acquireFileBase(e){let t=this.retain(e.key);if(t)return t;let{fn:n}=this.runtime,r=new h8,i=null;try{i=this.runtime.fileAccess.fromNodeFile(e.path),r.push(()=>i?.close());let t=n.EPDF_LoadBaseDocument(i.ptr,e.password??"");if(!t)throw Fm(this.runtime,e.password);return Fe(this.runtime,t),r.push(()=>n.EPDF_ReleaseBaseDocument(t)),this.supplyKnownSha(t,e.knownSha256),this.insert({key:e.key,kind:"file",path:e.path,basePtr:t,refs:1,close:()=>r.close()})}catch(e){throw r.close(),e}}retainByKey(e){return this.retain(e)}supplyKnownSha(e,t){if(!t||!/^[0-9a-fA-F]{64}$/.test(t))return;let{mem:n,fn:r}=this.runtime,i=new Uint8Array(32);for(let e=0;e<32;e++)i[e]=parseInt(t.slice(2*e,2*e+2),16);let o=n.alloc(32);try{n.writeBytes(o,i),r.EPDF_SetBaseDocumentSha256(e,o)}finally{n.free(o)}}releaseAll(){let e=Array.from(this.entries.values());this.entries.clear();let t=null;for(let n of e)try{n.close()}catch(e){t??(t=e)}if(t)throw t}getRefCountForTesting(e){return this.entries.get(e)?.refs??0}retain(e){let t=this.entries.get(e);return t?(t.refs++,this.handleFor(t)):null}insert(e){return this.entries.set(e.key,e),this.handleFor(e)}handleFor(e){let t=!1;return{key:e.key,kind:e.kind,...void 0!==e.path?{path:e.path}:{},basePtr:e.basePtr,release:()=>{if(t)return;t=!0;let n=this.entries.get(e.key);!n||(n.refs--,n.refs>0||(this.entries.delete(e.key),n.close()))}}}};function Fh(e,t,n,r){return e.EPDF_HasMetaText(n,r)?h3(t,(t,i)=>e.FPDF_GetMetaText(n,r,t,i),""):null}var FF=class{constructor(e,t){this.runtime=e,this.session=t}read(e){let t;hW(e);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=Fh(n,r,i,"Title");hW(e);let a=Fh(n,r,i,"Author");hW(e);let s=Fh(n,r,i,"Subject");hW(e);let l=Fh(n,r,i,"Keywords");hW(e);let u=Fh(n,r,i,"Producer");hW(e);let d=Fh(n,r,i,"Creator");hW(e);let c=Fh(n,r,i,"CreationDate");hW(e);let f=Fh(n,r,i,"ModDate");hW(e);let m=1===(t=Number(n.EPDF_GetMetaTrapped(i)))?"true":2===t?"false":"unknown";return{title:o,author:a,subject:s,keywords:l,producer:u,creator:d,createdAt:c?hq(c):null,modifiedAt:f?hq(f):null,trapped:m}}readCustom(e){hW(e);let{fn:t,mem:n}=this.runtime;return function(e,t,n){let r=0|Number(e.EPDF_GetMetaKeyCount(n,!0)),i={};for(let o=0;oe.EPDF_GetMetaKeyName(n,r,i,t,o))}(e,t,n,o,!0);if(!r)continue;let a=Fh(e,t,n,r);null!=a&&(i[r]=a)}return i}(t,n,this.session.requireDocPtr())}};function Fg(e,t,n,r,i){return null===i?e.EPDF_SetMetaText(n,r,0n):h6(t,i,t=>e.EPDF_SetMetaText(n,r,t))}var F_=new Set(["Title","Author","Subject","Keywords","Producer","Creator","CreationDate","ModDate","Trapped"]),FP=[["title","Title"],["author","Author"],["subject","Subject"],["keywords","Keywords"],["producer","Producer"],["creator","Creator"]],FD="http://www.w3.org/2000/xmlns/";function Fb(e){return(function(e){let t="";for(let n of e){let e=n.codePointAt(0);e<32&&9!==e&&10!==e&&13!==e||e>=55296&&e<=57343||65534===e||65535===e||(t+=n)}return t})(e).replace(/&/g,"&").replace(//g,">").replace(/\\r/g," ")}function Fy(e){return Fb(e).replace(/"/g,""").replace(/\'/g,"'").replace(/\\t/g," ").replace(/\\n/g," ")}function Fw(e,t){return e?`${e}:${t}`:t}var FE=class extends Error{},FA=/&(?:#x([0-9a-fA-F]+)|#([0-9]+)|(lt|gt|amp|quot|apos));/g,Fv={lt:"<",gt:">",amp:"&",quot:\'"\',apos:"\'"},FS=/[ \\t\\r\\n]/,Fk=/[ \\t\\r\\n/>=<"\']/;function Fx(e){if(!e.includes("&"))return e;if(e.replace(FA,"").includes("&"))throw new FE;return e.replace(FA,(e,t,n,r)=>{if(r)return Fv[r];let i=t?parseInt(t,16):Number(n);if(i>1114111)throw new FE;return String.fromCodePoint(i)})}function FG(e){let t=e.indexOf(":");return t<0?{prefix:"",local:e}:{prefix:e.slice(0,t),local:e.slice(t+1)}}var FO=class{constructor(e){this.text=e,hJ(this,"at",0),hJ(this,"open",[]),hJ(this,"root",null)}read(){let{text:e}=this;for(;this.atthis.at&&this.addText(e.slice(this.at,n)),t<0)break;e.startsWith("\\x3c!--",t)?this.at=this.after("--\\x3e",t+4):e.startsWith("",t+2):e.startsWith("0||!this.root)throw new FE;return this.root}after(e,t){let n=this.text.indexOf(e,t);if(n<0)throw new FE;return n+e.length}skipSpace(e){let t=e;for(;t",e+9);if(t<0)throw new FE;this.addText(this.text.slice(e+9,t),!0),this.at=t+3}skipDeclaration(e){let t=0;for(let n=e+2;n"===e&&t<=0){this.at=n+1;return}}throw new FE}readStartTag(e){let t,{text:n}=this,r=this.readName(e+1),i=[],o=e+1+r.length,a=!1;for(;;){let e=this.skipSpace(o);if(n.startsWith("/>",e)){t=e,a=!0;break}if(">"===n[e]){t=e;break}if(e===o||e>=n.length)throw new FE;let r=this.readName(e),s=this.skipSpace(e+r.length);if("="!==n[s])throw new FE;let l=n[s=this.skipSpace(s+1)];if(\'"\'!==l&&"\'"!==l)throw new FE;let u=n.indexOf(l,s+1);if(u<0)throw new FE;let d=n.slice(s+1,u);if(d.includes("<"))throw new FE;i.push({qname:r,...FG(r),ns:null,value:Fx(d.replace(/[\\t\\r\\n]/g," ")),start:e,end:u+1,valueStart:s+1,valueEnd:u}),o=u+1}let s=this.open[this.open.length-1]??null;if(!s&&this.root)throw new FE;let l=new Map(s?.scope??[]);for(let e of i)"xmlns"===e.qname?l.set("",e.value):"xmlns"===e.prefix&&l.set(e.local,e.value);let u=e=>"xml"===e?"http://www.w3.org/XML/1998/namespace":l.get(e)||null;for(let e of i)e.ns="xmlns"===e.qname||"xmlns"===e.prefix?FD:e.prefix?u(e.prefix):null;let d=t+(a?2:1),{prefix:c,local:f}=FG(r),m={qname:r,prefix:c,local:f,ns:u(c),attributes:i,scope:l,parent:s,children:[],text:"",start:e,startTagClose:t,startTagEnd:d,selfClosing:a,endTagStart:d,end:d};s?s.children.push(m):this.root=m,a||this.open.push(m),this.at=d}readEndTag(e){let t=this.readName(e+2),n=this.skipSpace(e+2+t.length),r=this.open.pop();if(">"!==this.text[n]||!r||r.qname!==t)throw new FE;r.endTagStart=e,r.end=n+1,this.at=n+1}};function FI(e,t){return"http://www.w3.org/1999/02/22-rdf-syntax-ns#"===e.ns&&e.local===t}function FN(e,t){return e.ns===t.ns&&e.local===t.name}var FC=class{constructor(e,t){this.packet=e,this.rdf=t,hJ(this,"splices",[]),hJ(this,"additions",new Map)}removeElement(e){this.splices.push({start:this.spaceBefore(e.start),end:e.end,text:""})}removeAttribute(e){this.splices.push({start:this.spaceBefore(e.start),end:e.end,text:""})}replaceAttributeValue(e,t){this.splices.push({start:e.valueStart,end:e.valueEnd,text:Fy(t)})}replaceElement(e,t){let n=e.attributes.filter(e=>e.ns===FD).map(e=>` ${this.packet.slice(e.start,e.end)}`).join(""),r=Fj(e.scope,"http://www.w3.org/1999/02/22-rdf-syntax-ns#")??"rdf";this.splices.push({start:e.start,end:e.end,text:FM(e.qname,n,r,t)})}addProperty(e,t,n){let r=this.additionsFor(e),i=e?.scope??this.rdf.scope,o=Fj(i,t.ns,!1)??this.declare(r,i,t),a=Fj(i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#")??"rdf";r.children.push(FM(Fw(o,t.name),"",a,n))}result(){for(let[e,t]of this.additions)this.writeAdditions(e,t);let e=this.splices.map((e,t)=>({splice:e,index:t})).sort((e,t)=>e.splice.start-t.splice.start||e.splice.end-e.splice.start-(t.splice.end-t.splice.start)||e.index-t.index),t="",n=0;for(let{splice:r}of e){if(r.start` xmlns:${e}="${Fy(t)}"`).join("");if(!e){let e=this.rdf.prefix,r=Fw(e,"Description"),i=`<${r} ${Fw(e,"about")}=""${n}>${t.children.join("")}`;this.insertInto(this.rdf,i);return}n&&this.splices.push({start:e.startTagClose,end:e.startTagClose,text:n});let r=this.childIndent(e);this.insertInto(e,t.children.map(e=>r+e).join(""))}insertInto(e,t){if(e.selfClosing)return void this.splices.push({start:e.startTagClose,end:e.startTagEnd,text:`>${t}`});let n=e.children[e.children.length-1],r=n?n.end:e.startTagEnd;this.splices.push({start:r,end:r,text:t})}childIndent(e){let[t]=e.children,n=t?this.packet.slice(e.startTagEnd,t.start):this.packet.slice(e.startTagEnd,e.endTagStart);return/^\\s*$/.test(n)?t?n:n&&`${n} `:""}spaceBefore(e){let t=e;for(;t>0&&/\\s/.test(this.packet[t-1]);)t--;return t}};function Fj(e,t,n=!0){let r;for(let[i,o]of e)if(o===t){if(i)return i;n&&(r=i)}return r}function FM(e,t,n,r){let i,o=(e,t="")=>`<${Fw(n,"li")}${t}>${Fb(e)}`,a=(e,t)=>`<${Fw(n,e)}>${t}`;switch(r.kind){case"text":i=Fb(r.text);break;case"alt":i=a("Alt",o(r.text,\' xml:lang="x-default"\'));break;case"seq":i=a("Seq",r.items.map(e=>o(e)).join(""));break;case"bag":i=a("Bag",r.items.map(e=>o(e)).join(""))}return`<${e}${t}>${i}`}function FR(e,t,n,r){if(0===r.length)return;let i=function(e,t,n){let r=e.EPDFCatalog_GetMetadata(n,0n,0);if(r<=0)return null;let i=hY(t,r,i=>e.EPDFCatalog_GetMetadata(n,i,r)===r?t.readBytes(i,r):null),o=i&&function(e){let[t=1,n=1,r=1,i=1]=e;return 254===t&&255===n?"utf-16be":255===t&&254===n?0===r&&0===i?null:"utf-16le":0===t&&0===n?null:0===t?"utf-16be":0===n?0===r?null:"utf-16le":"utf-8"}(i);if(!i||!o)return null;try{return{text:new TextDecoder(o,{fatal:!0,ignoreBOM:!0}).decode(i),encoding:o}}catch{return null}}(e,t,n);if(!i)return;let o=function(e,t){let n=function(e){try{return new FO(e).read()}catch(e){if(e instanceof FE)return null;throw e}}(e),r=n&&[...function* e(t){for(let n of(yield t,t.children))yield*e(n)}(n)].find(e=>FI(e,"RDF"));if(!r)return null;let i=r.children.filter(e=>FI(e,"Description")),o=new FC(e,r);for(let{property:e,value:n,add:r}of t){let t=i.flatMap(t=>t.children.filter(t=>FN(t,e))),a=i.flatMap(t=>t.attributes.filter(t=>FN(t,e)).map(e=>({attribute:e,description:t})));if(null===n){t.forEach(e=>o.removeElement(e)),a.forEach(({attribute:e})=>o.removeAttribute(e));continue}let[s,...l]=t,[u,...d]=a;if(s)(l.length>0||a.length>0||!function(e,t){if(e.attributes.some(e=>"http://www.w3.org/1999/02/22-rdf-syntax-ns#"===e.ns))return!1;if("text"===t.kind)return 0===e.children.length&&e.text===t.text;let[n,...r]=e.children,i={alt:"Alt",seq:"Seq",bag:"Bag"}[t.kind];if(!n||r.length>0||!FI(n,i))return!1;let o=n.children;if(!o.every(e=>FI(e,"li")&&0===e.children.length))return!1;if("alt"===t.kind){let[e]=o,n=e?.attributes.find(e=>"http://www.w3.org/XML/1998/namespace"===e.ns&&"lang"===e.local);return 1===o.length&&n?.value==="x-default"&&e.text===t.text}return o.length===t.items.length&&o.every((e,n)=>e.text===t.items[n])}(s,n))&&(o.replaceElement(s,n),l.forEach(e=>o.removeElement(e)),a.forEach(({attribute:e})=>o.removeAttribute(e)));else if(u&&"text"===n.kind)(d.length>0||u.attribute.value!==n.text)&&(o.replaceAttributeValue(u.attribute,n.text),d.forEach(({attribute:e})=>o.removeAttribute(e)));else if(u)a.forEach(({attribute:e})=>o.removeAttribute(e)),o.addProperty(u.description,e,n);else if(r){let t=i.find(t=>(function(e,t){return e.attributes.some(e=>"http://www.w3.org/2000/xmlns/"===e.ns&&e.value===t)})(t,e.ns))??i[0];o.addProperty(t??null,e,n)}}return o.result()}(i.text,r);if(null!==o&&o!==i.text){let r;if(!hY(t,Math.max((r=function({text:e,encoding:t}){if("utf-8"===t)return new TextEncoder().encode(e);let n=new Uint8Array(2*e.length),r=new DataView(n.buffer);for(let n=0;n(t.writeBytes(i,r),e.EPDFCatalog_SetMetadata(n,i,r.length))))throw new N(G.Unknown,"failed to write the XMP metadata")}}var FT="http://purl.org/dc/elements/1.1/",FB="http://ns.adobe.com/xap/1.0/",FL="http://ns.adobe.com/pdf/1.3/",F$=(e,t,n)=>({ns:e,prefix:t,name:n}),Fz={title:{property:F$(FT,"dc","title"),kind:"alt"},author:{property:F$(FT,"dc","creator"),kind:"seq"},subject:{property:F$(FT,"dc","description"),kind:"alt"},keywords:{property:F$(FL,"pdf","Keywords"),kind:"text"},creator:{property:F$(FB,"xmp","CreatorTool"),kind:"text"},producer:{property:F$(FL,"pdf","Producer"),kind:"text"}},FU=F$(FB,"xmp","CreateDate"),FV=F$(FB,"xmp","ModifyDate"),FW=F$(FL,"pdf","Trapped"),Fq=F$(FT,"dc","subject"),FH={true:"True",false:"False",unknown:"Unknown"};function FK(e){if(null===e)return null;let t=hH(e);return{kind:"text",text:hq(t)??t}}var FZ=class{constructor(e,t){this.runtime=e,this.session=t}update(e,t){hW(t);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr();return!function(e,t,n,r){var i;let o=e=>{throw new N(G.Unknown,`failed to write metadata ${e}`)};for(let[i,a]of FP){let s=r[i];void 0!==s&&(Fg(e,t,n,a,s)||o(a))}void 0===r.createdAt||Fg(e,t,n,"CreationDate",null===r.createdAt?null:hH(r.createdAt))||o("CreationDate"),void 0===r.modifiedAt||Fg(e,t,n,"ModDate",null===r.modifiedAt?null:hH(r.modifiedAt))||o("ModDate"),void 0===r.trapped||(i=r.trapped,e.EPDF_SetMetaTrapped(n,"true"===i?1:"false"===i?2:3))||o("Trapped")}(n,r,i,e),FR(n,r,i,function(e){let t=[],n=(e,n,r=!0)=>t.push({property:e,value:n,add:r});for(let[t,{property:r,kind:i}]of Object.entries(Fz)){let o=e[t];void 0!==o&&n(r,null===o?null:"seq"===i?{kind:i,items:[o]}:{kind:i,text:o})}if(void 0!==e.keywords){let t=null===e.keywords?null:e.keywords.split(/[,;]/).map(e=>e.trim()).filter(e=>""!==e);n(Fq,t&&{kind:"bag",items:t},!1)}return void 0!==e.createdAt&&n(FU,FK(e.createdAt)),void 0!==e.modifiedAt&&n(FV,FK(e.modifiedAt)),void 0!==e.trapped&&n(FW,{kind:"text",text:FH[e.trapped]}),t}(e)),hW(t),{metadata:new FF(this.runtime,this.session).read(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}updateCustom(e,t){hW(t);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=Object.entries(e);for(let[e]of o){let t=function(e){if(F_.has(e))return`\'${e}\' is a standard key; set it with metadata.update`;if(!e||e.length>127||"/"===e[0])return`\'${e}\' can\'t be a custom key: 1 to 127 characters, no leading slash`;for(let t=0;t126)return`\'${e}\' can\'t be a custom key: printable ASCII only`}return null}(e);if(t)throw new N(G.InvalidArg,t,{details:{field:e}})}for(let[e,t]of o)if(!Fg(n,r,i,e,t))throw new N(G.Unknown,`failed to write metadata ${e}`);return FR(n,r,i,Object.entries(e).filter(([e])=>/^[A-Za-z_][A-Za-z0-9._-]*$/.test(e)).map(([e,t])=>({property:F$("http://ns.adobe.com/pdfx/1.3/","pdfx",e),value:null===t?null:{kind:"text",text:t},add:!1}))),hW(t),{custom:new FF(this.runtime,this.session).readCustom(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}},FJ={bytes:124,offsets:{looseBox:0,tightBox:16,looseQuad:32,tightQuad:64,matrix:96,flags:120},flags:{hasTightBox:1,hasLooseQuad:2,hasTightQuad:4,upright:8,space:16,empty:32,synthesized:64}},FQ={bytes:132,offsets:{geometry:0,objectRun:124,fontSize:128}};function FX(e,t,n=0){return{left:F0(e,t,n),top:F0(e,t,n+4),right:F0(e,t,n+8),bottom:F0(e,t,n+12)}}function FY(e,t,n){e.poke(t,"f32",n.left,0),e.poke(t,"f32",n.top,4),e.poke(t,"f32",n.right,8),e.poke(t,"f32",n.bottom,12)}function F0(e,t,n=0){return Number(e.peek(t,"f32",n))}function F1(e,t,n=0){return Number(e.peek(t,"i32",n))}var F3={fit:2,fitH:3,fitV:4,fitR:5,fitB:6,fitBH:7,fitBV:8};function F2(e,t,n,r){let i=e.EPDFDest_GetPageObjectNumber(n,r);if(0===i)return null;let o=q(i),a=h0(t,[8,16],([n,i])=>{let o=e.FPDFDest_GetView(r,n,i),a=Math.min(F1(t,n),4),s=[];for(let e=0;eethis.limits.maxModels||this.nodes>this.limits.maxNodes||this.scriptCodeUnits>this.limits.maxScriptCodeUnits||this.targetEntries>this.limits.maxTargetEntries||this.payloadCodeUnits>this.limits.maxPayloadCodeUnits)throw new N(G.MalformedPdf,"aggregate PDF action read budget exceeded",{details:{models:this.models,nodes:this.nodes,scriptCodeUnits:this.scriptCodeUnits,targetEntries:this.targetEntries,payloadCodeUnits:this.payloadCodeUnits,limits:this.limits}})}};function F8(e,t,n,r,i){if(0n===r)return null;try{var o,a,s,l;let u,d=e.EPDFAction_GetNodeCount(r);if(!Number.isInteger(d)||d<0)throw F9("invalid node count",{nodeCount:d});i.addModel(d);let c=e.EPDFAction_GetWarningFlags(r)>>>0,f=!e.EPDFAction_IsComplete(r),m=(o=e.EPDFAction_GetRootNode(r),a=d,-1===o||0xffffffff===o||o>>>0==0xffffffff?null:F7(o,a)),p=new Set,h=!1,F=e=>{let n=e(0n,0);return n<=0?null:(i.reservePayloadBytes(n),h2(t,e))},g=e=>h0(t,[4],([n])=>e(n)?0!==F1(t,n):null),_=(n,i)=>h0(t,[4],([o])=>{if(!e.EPDFAction_GetNodeTargetObjectNumber(r,n,i,o))return null;let a=F1(t,o)>>>0;return 0===a?null:a}),P=(t,n)=>{let i=[];for(let o=0;oe.EPDFAction_GetNodeTargetName(r,t,o,n,i));if(null!==n){i.push({kind:"name",name:n});continue}let a=_(t,o);if(null===a)return null;i.push({kind:"objectNumber",objectNumber:a})}return i},D=o=>{if(p.has(o))throw F9("native action model contains a cycle",{nodeId:o});p.add(o);try{let a=F5[e.EPDFAction_GetNodeType(r,o)]??"unknown",s=h2(t,(t,n)=>e.EPDFAction_GetNodeSubtype(r,o,t,n))??"",l=e.EPDFAction_GetNextCount(r,o);if(!Number.isInteger(l)||l<0)throw F9("invalid action child count",{nodeId:o,nextCount:l});let u=[];for(let t=0;t(h=!0,{type:"unknown",subtype:s,next:u});switch(a){case"javascript":{if(!e.EPDFAction_NodeHasJavaScript(r,o))return c();let n=h3(t,(t,n)=>e.EPDFAction_GetNodeJavaScript(r,o,t,n))??"";return i.addScript(n),{type:a,subtype:s,script:n,next:u}}case"rendition":{if(!e.EPDFAction_NodeHasJavaScript(r,o))return{type:a,subtype:s,next:u};let n=h3(t,(t,n)=>e.EPDFAction_GetNodeJavaScript(r,o,t,n))??"";return i.addScript(n),{type:a,subtype:s,script:n,next:u}}case"goto":{let i=e.EPDFAction_GetNodeDest(n,r,o),l=0n!==i?F2(e,t,n,i):null;return l?{type:a,subtype:s,destination:l,next:u}:c()}case"uri":{let t=F((t,i)=>e.EPDFAction_GetNodeURI(n,r,o,t,i));if(null===t)return c();return{type:a,subtype:s,uri:t,isMap:g(t=>e.EPDFAction_GetNodeURIIsMap(r,o,t))??!1,next:u}}case"named":{let t=F((t,n)=>e.EPDFAction_GetNodeName(r,o,t,n));return null===t?c():{type:a,subtype:s,name:t,next:u}}case"hide":{let t=e.EPDFAction_GetNodeTargetCount(r,o);if(!Number.isInteger(t)||t<0)return c();i.reserveTargets(t);let n=P(o,t);if(null===n)return c();return{type:a,subtype:s,targets:n,hide:g(t=>e.EPDFAction_GetNodeHideFlag(r,o,t))??!0,next:u}}case"reset-form":{let n=h0(t,[4,4],([n,i])=>e.EPDFAction_GetNodeResetForm(r,o,n,i)?{hasFields:0!==F1(t,n),exclude:0!==F1(t,i)}:null),l=e.EPDFAction_GetNodeTargetCount(r,o);if(null===n||!Number.isInteger(l)||l<0)return c();i.reserveTargets(l);let d=n.hasFields?P(o,l):null;if(n.hasFields&&null===d)return c();return{type:a,subtype:s,fields:d,exclude:n.exclude,next:u}}case"submit-form":{if("function"!=typeof e.EPDFAction_GetNodeSubmitForm)return{type:a,subtype:s,next:u};let n=h0(t,[4,4],([n,i])=>e.EPDFAction_GetNodeSubmitForm(r,o,n,i)?{hasFields:0!==F1(t,n),flags:F1(t,i)>>>0}:null);if(null===n)return c();let l=F((t,n)=>e.EPDFAction_GetNodeSubmitFormURL(r,o,t,n));if(null===l)return c();let d=e.EPDFAction_GetNodeTargetCount(r,o);if(!Number.isInteger(d)||d<0)return c();i.reserveTargets(d);let f=n.hasFields?P(o,d):null;if(n.hasFields&&null===f)return c();let m=F((t,n)=>e.EPDFAction_GetNodeSubmitFormCharSet(r,o,t,n));return{type:a,subtype:s,payload:{url:l,fields:f,...j(n.flags),...null===m?{}:{charSet:m}},next:u}}case"goto-remote":case"goto-embedded":case"launch":{let t=F((t,n)=>e.EPDFAction_GetNodeFilePath(r,o,t,n));return null===t?c():{type:a,subtype:s,filePath:t,next:u}}default:return{type:a,subtype:s,next:u}}}finally{p.delete(o)}},b=null===m?null:D(m),y=(s=c,l=f,u=[],(1&s)!=0&&u.push("cycle-dropped"),(2&s)!=0&&u.push("malformed-next"),((4&s)!=0||l)&&u.push("incomplete"),u);return h&&y.push("payload-dropped"),{root:b,incomplete:f,warnings:y}}finally{e.EPDFAction_CloseModel(r)}}function F7(e,t){if(!Number.isInteger(e)||e<0||e>=t)throw F9("native action model returned an invalid node id",{raw:e,nodeCount:t});return e}function F9(e,t){return new N(G.MalformedPdf,e,{details:t})}var ge={x:0,y:1,distance:2,area:3,angle:4,slope:5},gt=["decimal","fraction","round","truncate"],gn=["thousands","decimal","prefixSpacing","suffixSpacing"];function gr(e){if(!e)throw new N(G.Unknown,"Measurement native write failed after preflight")}function gi(e,t,n="f32"){return hY(e,4,r=>t(r)?Number(e.peek(r,n)):void 0)}function go(e,t,n){return t?hY(e,8,r=>(e.poke(r,"f32",t.x),e.poke(r,"f32",t.y,4),n(r))):n(0n)}function ga(e,t,n){if(!n)return;let r=e.EPDFMeasure_GetSubtype(n);if(1!==r)return{subtype:2===r?"geospatial":"unknown"};let i=r=>Array.from({length:e.EPDFMeasure_CountFormats(n,r)},(i,o)=>{let a=e.EPDFMeasure_GetFormat(n,r,o),s={unit:h3(t,(t,n)=>e.EPDFNumberFormat_GetUnit(a,t,n))??""},l=gi(t,t=>e.EPDFNumberFormat_GetConversion(a,t));void 0!==l&&(s.conversion=l);let u=gi(t,t=>e.EPDFNumberFormat_GetFraction(a,t),"i32");void 0!==u&>[u]&&(s.fraction=gt[u]);let d=gi(t,t=>e.EPDFNumberFormat_GetPrecision(a,t),"i32");void 0!==d&&(s.precision=d);let c=gi(t,t=>e.EPDFNumberFormat_GetFixedDenominator(a,t),"i32");void 0!==c&&(s.fixed=!!c);let f=gi(t,t=>e.EPDFNumberFormat_GetLabelPosition(a,t),"i32");for(let[n,r]of(void 0!==f&&(s.labelPosition=1===f?"prefix":"suffix"),gn.entries())){let i=h3(t,(t,r)=>e.EPDFNumberFormat_GetText(a,n,t,r));null!==i&&(s[r]=i)}return s}),o=h3(t,(t,r)=>e.EPDFMeasure_GetRatio(n,t,r)),a=hY(t,8,r=>e.EPDFMeasure_GetOrigin(n,r)?{x:Number(t.peek(r,"f32")),y:Number(t.peek(r,"f32",4))}:void 0),s=gi(t,t=>e.EPDFMeasure_GetCYX(n,t)),l={subtype:"rectilinear",x:i(0),distance:i(2),area:i(3),...null!==o?{ratio:o}:{},...a?{origin:a}:{},...void 0!==s?{cyx:s}:{}};for(let e of["y","angle","slope"]){let t=i(ge[e]);t.length&&(l[e]=t)}return l}function gs(e,t,n,r){for(let[i,o]of(gr(n),void 0!==r.ratio&&gr(h6(t,r.ratio,t=>e.EPDFMeasure_SetRatio(n,t))),r.origin&&gr(go(t,r.origin,t=>e.EPDFMeasure_SetOrigin(n,t))),void 0!==r.cyx&&hY(t,4,i=>{t.poke(i,"f32",r.cyx),gr(e.EPDFMeasure_SetCYX(n,i))}),Object.entries(ge)))for(let a of r[i]??[]){let r,i=t.writeU16String(a.unit);try{r=e.EPDFMeasure_AddFormat(n,o,i,a.conversion)}finally{t.free(i)}for(let[n,i]of(gr(r),void 0!==a.fraction&&gr(e.EPDFNumberFormat_SetFraction(r,gt.indexOf(a.fraction))),void 0!==a.precision&&gr(e.EPDFNumberFormat_SetPrecision(r,a.precision)),void 0!==a.fixed&&gr(e.EPDFNumberFormat_SetFixedDenominator(r,a.fixed)),void 0!==a.labelPosition&&gr(e.EPDFNumberFormat_SetLabelPosition(r,+("prefix"===a.labelPosition))),gn.entries()))void 0!==a[i]&&gr(h6(t,a[i],t=>e.EPDFNumberFormat_SetText(r,n,t)))}}function gl(e,t,n,r){let i=[],o=e.EPDFPage_CountViewportsRaw(n,r);for(let a=0;ae.EPDFViewport_GetBBox(o,n)?eH(FX(t,n)):void 0);if(!n)continue;let r=h3(t,(t,n)=>e.EPDFViewport_GetName(o,t,n)),a=ga(e,t,e.EPDFViewport_GetMeasure(o));i.push({bbox:n,owned:r===nb&&(!a||"rectilinear"===a.subtype),name:r,measure:a??null})}finally{e.EPDFViewport_Close(o)}}return i}function gu(e){return"wasm"===e.kind?4:8}function gd(e,t,n,r){"wasm"===e.kind?e.mem.poke(t,"i32",Number(r),n):e.mem.poke(t,"i64",BigInt(r),n)}function gc(e,t,n){let r=gu(e);return hY(e.mem,Math.max(1,t.length*r),i=>(t.forEach((t,n)=>gd(e,i,n*r,t)),n(i,t.length)))}function gf(e,t,n){let{mem:r}=e,i=t.map(e=>r.writeU16String(e));try{return gc(e,i,n)}finally{for(let e=i.length-1;e>=0;e--)r.free(i[e])}}var gm=[null,"decimal","upperRoman","lowerRoman","upperLetters","lowerLetters"];function gp(e,t){let{fn:n,mem:r}=e,i=n.EPDFDoc_GetPageLabelSectionCount(t),o=[];return h0(r,[4,4,4],([e,a,s])=>{for(let l=0;ln.EPDFDoc_GetPageLabelSectionAt(t,l,r,i,e,a,s));o.push({firstPage:F1(r,e),style:gm[F1(r,a)]??null,firstNumber:F1(r,s),prefix:i??""})}}),o}var gh=class{constructor(e,t){this.runtime=e,this.session=t}read(e){hW(e);let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr(),i=this.session.allRecords(),o=new F4,a=gp(this.runtime,r);return h0(n,[16,4,4],([s,l,u])=>{var d,c,f;let m,p=i.map(i=>{var d,c,f,m,p,h,F,g,_,P;let D,b,y,w;hW(e);let E=i.pageIndex,A=(c=t,f=n,m=r,p=i.pageObjectNumber,h=o,D={},b=F8(c,f,m,c.EPDFDoc_GetPageActionModel(m,p,0),h),y=F8(c,f,m,c.EPDFDoc_GetPageActionModel(m,p,1),h),b&&(D.open=b),y&&(D.close=y),b||y?D:void 0),v=gl(t,n,r,E),S=gg(t,n,r,E,s);return{index:E,ref:q(i.pageObjectNumber),label:function(e,t){let n;for(let r of e){if(r.firstPage>t)break;n=r}if(!n)return null;let r=n.prefix+function(e,t){switch(e){case null:return"";case"decimal":return String(t);case"upperRoman":return r2(t).toUpperCase();case"lowerRoman":return r2(t);case"upperLetters":return r6(t).toUpperCase();case"lowerLetters":return r6(t)}}(n.style,n.firstNumber+t-n.firstPage);return""===r?null:r}(a,E),size:{width:(d=S.crop).right-d.left,height:d.top-d.bottom},rotation:gP(t,n,r,E,u),userUnit:function(e,t,n,r,i){if(!e.EPDF_GetPageUserUnitByIndex(n,r,i))return 1;let o=F0(t,i,0);return Number.isFinite(o)&&o>0?o:1}(t,n,r,E,l),tabOrder:(F=t,g=n,_=r,P=E,(w=h2(g,(e,t)=>F.EPDF_GetPageTabOrderByIndex(_,P,e,t)))?gD[w]??null:null),boxes:S,pdfCropBox:S.crop,...A?{actions:A}:{},...v.length?{viewports:v}:{}}});return{pageCount:p.length,pages:p,labels:a,namedPages:(d=t,c=n,f=r,m=[],h0(c,[4,4],([e,t])=>{for(let n of gb){let r=d.EPDFDoc_GetNamedPageCount(f,n);for(let i=0;id.EPDFDoc_GetNamedPageAt(f,n,i,r,o,e,t),"");if(null===r)continue;let o=Number(c.peek(e,"i32"))>>>0,a=Number(c.peek(t,"i32"));m.push({name:r,target:0===a?{kind:"page",page:q(o)}:1===a?{kind:"template",objectNumber:o}:{kind:"dangling"}})}}}),m)}})}};function gF(e,t){let n=new Map,r=null;return i=>{let o=n.get(i.objectNumber);if(o)return o;r??(r=new Map(t.allRecords().map(e=>[e.pageObjectNumber,e.pageIndex])));let a=r.get(i.objectNumber);if(void 0===a)throw new N(G.NotFound,`no page with object number ${i.objectNumber}`);let{fn:s,mem:l}=e,u=t.requireDocPtr(),d=hY(l,16,e=>gg(s,l,u,a,e).crop);return n.set(i.objectNumber,d),d}}function gg(e,t,n,r,i){var o;let a,s,l,u=o=>(function(e,t,n,r,i,o){if(e.EPDF_GetPageBoxByIndex(n,r,i,o))return eH(FX(t,o))})(e,t,n,r,o,i);return a=(o={media:u(0),crop:u(1),bleed:u(2),trim:u(3),art:u(4)}).media??iJ,l=(s=e=>{let t,n,r,i;return t=Math.max(e.left,a.left),n=Math.min(e.right,a.right),r=Math.max(e.bottom,a.bottom),i=Math.min(e.top,a.top),(tgP(e.fn,e.mem,t,n,r))}function gP(e,t,n,r,i){var o;return e.EPDF_GetPageRotateByIndex(n,r,i)?Number.isInteger(o=F1(t,i))&&o%90==0?(o%360+360)%360:0:0}var gD={R:"rows",C:"columns",S:"structure",A:"annotations",W:"widgets"},gb=[0,1];function gy(e,t,n){if("start"===t)return 0;if("end"===t)return n;let{pageIndex:r}=e.resolvePageRef(n_(t));return"before"in t?r:r+1}var gw=class{constructor(e,t){this.runtime=e,this.session=t}reorder(e,t,n){let r,i=this.session.resolvePageRefs(e);hW(n),this.requireUniquePageObjectNumbers("pages.reorder",i);let o=n_(t);if(o&&i.includes(o.objectNumber))throw new N(G.InvalidArg,`pages.reorder: the neighbour page ${o.objectNumber} is one of the pages that move`,{details:{field:"position"}});let{fn:a,mem:s}=this.runtime,l=this.session.requireDocPtr(),u=i.map(e=>(hW(n),this.session.recordByObjectNumber(e).pageIndex)),d=gy(this.session,t,a.FPDF_GetPageCount(l)),c=d-u.filter(e=>e=o)throw new N(G.InvalidArg,`pages.delete would remove every page (${n.length} of ${o}); a document must keep at least one`);let a=this.session.pagePool();for(let e of n)if(this.session.recordByObjectNumber(e),a.isHeld(e))throw new N(G.Unknown,`internal invariant violation: pagePtr for page ${e} is still held during pages.delete`);for(let e of n)if(!r.EPDFDoc_DeletePageByObjectNumber(i,e))throw new N(G.Unknown,`EPDFDoc_DeletePageByObjectNumber rejected page ${e} after validation`);return this.session.refreshPageRegistry(),{layout:new gh(this.runtime,this.session).read(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}setName(e,t){if(hW(t),0===e.name.length)throw new N(G.InvalidArg,"pages.setName requires a non-empty name");let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=this.session.resolvePageRef(e.page).pageObjectNumber;if(void 0!==e.replace&&e.replace!==e.name&&e.replace.length>0&&h6(r,e.replace,e=>n.EPDFDoc_RemoveNamedPage(i,e)),!h6(r,e.name,e=>n.EPDFDoc_SetNamedPage(i,e,o)))throw new N(G.Unknown,`EPDFDoc_SetNamedPage rejected \'${e.name}\' for page ${o}`);return{layout:new gh(this.runtime,this.session).read(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}removeName(e,t){if(hW(t),0===e.name.length)throw new N(G.InvalidArg,"pages.removeName requires a non-empty name");let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr();if(!h6(r,e.name,e=>n.EPDFDoc_RemoveNamedPage(i,e)))throw new N(G.NotFound,`pages.removeName: no /Names /Pages registration \'${e.name}\'`);return{layout:new gh(this.runtime,this.session).read(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}requireUniquePageObjectNumbers(e,t){if(0===t.length)throw new N(G.InvalidArg,`${e} requires at least one page`);let n=new Set;for(let r of t){if(n.has(r))throw new N(G.InvalidArg,`${e} was given duplicate page object number ${r}`);n.add(r)}}},gE=class{constructor(e,t){this.runtime=e,this.session=t}extract(e,t,n){let r;if(hW(n),0===e.length)throw new N(G.InvalidArg,"pages.extract requires at least one page");let i=this.session.resolvePageRefs(e),o=new Set;for(let e of i){if(o.has(e))throw new N(G.InvalidArg,`pages.extract was given duplicate page object number ${e}`);o.add(e)}let a=i.map(e=>this.session.recordByObjectNumber(e).pageIndex),{fn:s,mem:l}=this.runtime,u=this.session.requireDocPtr(),d=l.alloc(4*a.length);for(let e=0;e(n.EPDFDoc_GetImportFieldRoots(t,0n,0,e,i),Array.from({length:i},(t,n)=>Number(r.peek(e,"i32",4*n)))))}(e,n);if(0===o.length)return;let a=o.map(e=>h3(i,(t,i)=>r.EPDFForm_GetFieldPartialName(n,e,t,i))??""),s=function(e,t){let{fn:n,mem:r}=e,i=gv(e,t),o=new Set;for(let e=0;en.EPDFForm_GetFieldName(i,e,t,r));t&&o.add(t.split(".")[0])}return o}(e,t),l=new Set([...s,...a]);o.forEach((e,t)=>{let o=a[t];if(!s.has(o))return;let u=o;for(let e=2;l.has(u);e++)u=`${o}_${e}`;if(l.add(u),!h5(i,u,t=>r.EPDFForm_SetFieldName(n,e,t)))throw new N(G.Unknown,`pages.insert could not rename the inserted field "${o}" to "${u}"`)})}function gx(e,t,n){let{pageIndex:r}=t.resolvePageRef(q(n)),i=e.fn.EPDFPage_PromoteInlineAnnotsRaw(t.requireDocPtr(),r);if(i<0)throw new N(G.Unknown,`the inline annotations of page ${n} could not be promoted`);return 0!==i&&(t.pagePool().closeIdle(),!0)}var gG=class{constructor(e,t){this.runtime=e,this.session=t}insert(e,t,n,r){if(hW(n),0===e.byteLength)throw new N(G.InvalidArg,"pages.insert requires non-empty bytes");let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s=gy(this.session,t,i.FPDF_GetPageCount(a)),l=o.alloc(e.byteLength),u=null;try{if(o.writeBytes(l,new Uint8Array(e)),!(u=i.FPDF_LoadMemDocument(l,e.byteLength,"")))throw hX(i,null,new N(G.MalformedPdf,"pages.insert source PDF could not be opened"));let t=i.FPDF_GetPageCount(u);if(t<=0)throw new N(G.InvalidArg,"pages.insert source PDF has no pages");gk(this.runtime,this.session,u);let a=this.importInto(u,s,t,r,"pages.insert",n),d=u;return this.session.retainUntilClose(()=>{i.FPDF_CloseDocument(d),o.free(l)}),a}catch(e){throw u&&i.FPDF_CloseDocument(u),o.free(l),e}}copy(e,t,n,r){if(hW(n),0===e.length)throw new N(G.InvalidArg,"pages.copy requires at least one page");let i=this.session.resolvePageRefs([...e]).map(e=>this.session.recordByObjectNumber(e).pageIndex),{fn:o}=this.runtime,a=this.session.requireDocPtr(),s=gy(this.session,t,o.FPDF_GetPageCount(a)),l=o.FPDF_CreateNewDocument();if(!l)throw new N(G.Unknown,"FPDF_CreateNewDocument failed");try{if(!h1(this.runtime.mem,i,(e,t)=>o.EPDFDoc_ImportPages(l,a,e,t,0,0n)))throw new N(G.Unknown,`EPDFDoc_ImportPages rejected copying pages [${i.join(",")}] out`);gk(this.runtime,this.session,l);let e=this.importInto(l,s,i.length,r,"pages.copy",n);return this.session.retainUntilClose(()=>o.FPDF_CloseDocument(l)),e}catch(e){throw o.FPDF_CloseDocument(l),e}}importInto(e,t,n,r,i,o){let{fn:a,mem:s}=this.runtime,l=this.session.requireDocPtr();if(r&&r.length!==n)throw new N(G.InvalidArg,`${i} needs one object number per page: ${r.length} for ${n}`,{details:{field:"objectNumbers"}});for(let e of r??[])this.session.claimObjectNumber(e);if(!(r?h1(s,r,n=>a.EPDFDoc_ImportPages(l,e,0n,0,t,n)):a.EPDFDoc_ImportPages(l,e,0n,0,t,0n)))throw new N(G.Unknown,`EPDFDoc_ImportPages rejected the ${i} at index ${t}`);this.session.refreshPageRegistry();let u=new gh(this.runtime,this.session).read(o),d=u.pages.slice(t,t+n).map(e=>e.ref);for(let e of d)gx(this.runtime,this.session,e.objectNumber);return{insertedPages:d,layout:u,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}insertBlank(e,t,n,r){hW(n);let{size:i}=e,o=e.count??1;if(!Number.isFinite(i?.width)||!Number.isFinite(i?.height)||i.width<=0||i.height<=0)throw new N(G.InvalidArg,`pages.insertBlank size must have positive finite dimensions, got ${i?.width}x${i?.height}`);if(!Number.isInteger(o)||o<1||o>100)throw new N(G.InvalidArg,`pages.insertBlank count ${o} out of range [1, 100]`);let{fn:a}=this.runtime,s=this.session.requireDocPtr(),l=gy(this.session,t,a.FPDF_GetPageCount(s));if(r&&r.length!==o)throw new N(G.InvalidArg,`pages.insertBlank needs one object number per page: ${r.length} for ${o}`,{details:{field:"objectNumbers"}});for(let e of r??[])this.session.claimObjectNumber(e);for(let e=0;ee.ref),layout:u,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}},gO=class{constructor(e,t){this.runtime=e,this.session=t}flatten(e,t,n){hW(n);let r=this.session.resolvePageRefs(e);var i=r;if(0===i.length)throw new N(G.InvalidArg,"pages.flatten requires at least one page");let o=new Set;for(let e of i){if(o.has(e))throw new N(G.InvalidArg,`pages.flatten was given duplicate page object number ${e}`);o.add(e)}let a=[],s=new Set;for(let e of r){let r;hW(n),gx(this.runtime,this.session,e)&&s.add(e);let i=this.session.pagePool(),o=i.acquire(e);try{r=this.runtime.fn.EPDFPage_Flatten(o,+("print"===t))}finally{i.release(e)}if(2===r){a.push({page:q(e),status:"unchanged"});continue}if(1!==r)throw new N(G.Unknown,0===r?"native page flatten failed after preflight":`native page flatten returned unexpected code ${r}`);s.add(e),a.push({page:q(e),status:"applied"})}return 0===s.size?{pages:e,usage:t,results:a,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}:(this.session.invalidateDerived(),{pages:e,usage:t,results:a,meta:{affectedPages:[...s].map(e=>q(e)),cacheDelta:null,...this.session.writeStamp()}})}};function gI(e,t,n,r,i,o){let a=e.EPDFAnnot_GetObjectNumber(i);return a<=0?{kind:"baseIndex",page:r,baseIndex:o}:gN(e,t,n,r,a)}function gN(e,t,n,r,i){var o,a,s,l;let u=(o=e,a=t,s=n,l=i,h0(a,[8,8],([e,t])=>(Ft(a,e,0),Ft(a,t,0),o.EPDFLayer_GetBirthName(s,l,e,t))?Fn(a,t):null));return null===u?{kind:"objectNumber",page:r,objectNumber:i}:{kind:"baseIndex",page:r,baseIndex:u}}function gC(e,t,n){let{fn:r}=e,i=t.requireDocPtr(),{pageIndex:o}=t.resolvePageRef(n.page),a=n.page.objectNumber;switch(n.kind){case"objectNumber":{let e=r.EPDFPage_GetAnnotIndexByObjectNumberRaw(i,o,n.objectNumber);if(e<0)throw new N(G.NotFound,`no annotation with object number ${n.objectNumber} on page ${a}`);return{pageIndex:o,index:e}}case"baseIndex":{let t=function(e,t,n,r,i){let{fn:o}=e;if(o.EPDFLayer_IsPagePromoted(t,n)){let e=o.EPDFLayer_GetBirthObjectNumber(t,n,i);return e<=0?-1:o.EPDFPage_GetAnnotIndexByObjectNumberRaw(t,r,e)}if(i<0||i>=o.EPDFPage_GetAnnotCountRaw(t,r))return -1;let a=o.EPDFPage_GetAnnotRaw(t,r,i);if(!a)return -1;try{return o.EPDFAnnot_GetObjectNumber(a)>0?-1:i}finally{o.FPDFPage_CloseAnnot(a)}}(e,i,a,o,n.baseIndex);if(t<0)throw new N(G.NotFound,`no annotation born at position ${n.baseIndex} of page ${a}`);return{pageIndex:o,index:t}}}}function gj(e,t,n){let{pageIndex:r,index:i}=gC(e,t,n);return gM(e,t,r,i)}function gM(e,t,n,r){let i=e.fn.EPDFPage_GetAnnotRaw(t.requireDocPtr(),n,r);if(!i)throw new N(G.Unknown,`annotation ${r} of page index ${n} could not be opened`);return i}function gR(e,t,n){let{pageIndex:r,index:i}=gC(e,t,n),o=gM(e,t,r,i),{fn:a,mem:s}=e;return{annotPtr:o,name:gI(a,s,t.requireDocPtr(),n.page,o,i)}}function gT(e,t,n,r){let{index:i}=gC(e,t,r),o=e.fn.FPDFPage_GetAnnot(n,i);if(!o)throw new N(G.Unknown,`annotation ${i} of page ${r.page.objectNumber} could not be opened`);return o}var gB=class{constructor(e,t){this.runtime=e,this.session=t}apply(e,t){hW(t);let n=this.buildPlan(e);for(let e of n.keys())this.session.recordByObjectNumber(e);this.preflight(n,t);let{fn:r}=this.runtime,i=[],o=new Set,a=0;for(let[e,s]of n){hW(t),gx(this.runtime,this.session,e)&&o.add(e);let n=this.session.pagePool(),l=n.acquire(e);try{let t=null===s?this.applyAllOnPage(l):this.applyRefsOnPage(l,s);"applied"===t.status&&(r.FPDFPage_GenerateContent(l),o.add(e),a+=t.removed),i.push({page:q(e),status:t.status,removedAnnotationCount:t.removed})}finally{n.release(e)}}return 0===o.size?{scope:e,results:i,removedAnnotationCount:a,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}:(this.session.invalidateDerived(),{scope:e,results:i,removedAnnotationCount:a,meta:{affectedPages:[...o].map(e=>q(e)),cacheDelta:null,...this.session.writeStamp()}})}buildPlan(e){let t=new Map;if("pages"in e){if(0===this.session.resolvePageRefs(e.pages).length)throw new N(G.InvalidArg,"redaction.apply requires at least one page");for(let n of this.session.resolvePageRefs(e.pages)){if(t.has(n))throw new N(G.InvalidArg,`redaction.apply was given duplicate page object number ${n}`);t.set(n,null)}return t}if(0===e.annotations.length)throw new N(G.InvalidArg,"redaction.apply requires at least one annotation ref");for(let n of e.annotations){let e=t.get(n.page.objectNumber);if(null===e)throw new N(G.InvalidArg,"mixed redaction scopes on one page");e?e.push(n):t.set(n.page.objectNumber,[n])}return t}preflight(e,t){let{fn:n}=this.runtime;for(let[r,i]of e){if(null===i)continue;hW(t);let e=this.session.pagePool(),o=e.acquire(r);try{for(let e of i){let t=gT(this.runtime,this.session,o,e);try{let e=rN(n.FPDFAnnot_GetSubtype(t));if("redact"!==e)throw new N(G.InvalidArg,`redaction.apply ref on page ${r} resolves to a \'${e}\' annotation, not a redact annotation`)}finally{n.FPDFPage_CloseAnnot(t)}}}finally{e.release(r)}}}applyAllOnPage(e){let{fn:t,mem:n}=this.runtime,r=this.pageHasRedactAnnotations(e);return hY(n,4,i=>{if(!t.EPDFPage_ApplyRedactions(e,0n,0,i)){if(r)throw new N(G.Unknown,"native page redaction apply failed");return{status:"unchanged",removed:0}}return{status:"applied",removed:F1(n,i)>>>0}})}pageHasRedactAnnotations(e){let{fn:t}=this.runtime,n=t.FPDFPage_GetAnnotCount(e);for(let r=0;rhY(r,4,a=>{let s=n.EPDFPage_ApplyRedactions(e,t,i,a);return s&&(o=F1(r,a)>>>0),s})))throw new N(G.Unknown,"native redaction apply failed after preflight")}finally{for(let e of i)n.FPDFPage_CloseAnnot(e)}return{status:"applied",removed:o}}},gL=class{constructor(e,t){this.runtime=e,this.session=t}async read(e,t,n){hW(t);let{fn:r}=this.runtime,i=this.session.pagePool(),o=await i.acquireInSlices(e,t,n);try{hW(t);let n=r.FPDFText_LoadPage(o);if(!n)throw new N(G.RuntimeUnavailable,`FPDFText_LoadPage returned null for page object ${e}`);try{hW(t);let i=Math.max(r.FPDFText_CountChars(n),0),o=function(e,t,n){if(n<=0)return"";let{fn:r,mem:i}=e,o=2*n+1;return hY(i,2*o,e=>{let n=r.EPDFText_GetTextFull(t,e,o);return n<=1?"":function(e){let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength>>1),n="";for(let e=0;e{r.EPDFText_GetCharToTextMap(t,e,o);let n=i.readBytes(e,8*o),a=new Int32Array(n.buffer,n.byteOffset,2*o),s=Array(o);for(let e=0;ee)return`anchor ${t} char ${o} outside [1, ${e}]`;let s=a-(i+(o-r-1));if(0!==s&&2!==s)return`anchor ${t} implies a character contributing ${s} text units (expected 0 or 2)`;r=o,i=a}let o=i+(e-r);return o!==t?`map projects charCount to ${o}, but text length is ${t}`:null}(i,o.length,a);if(null!==s)throw new N(G.RuntimeUnavailable,`char map invariant violated for page object ${e}: ${s}`);return function(e){let{text:t,charCount:n}=e;if(!ng.test(t))return e;let r=e.charMap??[],i=[],o=[],a=0,s=0,l=0;for(let e=0;e=64976&&n<=65007||(65534&n)==65534)?"":e}(t.slice(s,n),t[n]);i.push(u),l+=u.length,1!==u.length&&o.push([e+1,l]),s=n}let u=i.join("");return o.length>0?{text:u,charCount:n,charMap:o}:{text:u,charCount:n}}(a.length>0?{text:o,charCount:i,charMap:a}:{text:o,charCount:i})}finally{r.FPDFText_ClosePage(n)}}finally{i.release(e)}}},g$=class{constructor(e,t){this.slices=e,this.signal=t,hJ(this,"started",performance.now())}get due(){return performance.now()-this.started>=this.slices.budgetMs}async pause(){await this.slices.between(),hW(this.signal),this.started=performance.now()}},gz=class{constructor(e,t){this.runtime=e,this.session=t}async read(e,t,n){hW(t);let{fn:r,mem:i}=this.runtime,o=this.session.pagePool(),a=await o.acquireInSlices(e,t,n);try{hW(t);let o=r.FPDFText_LoadPage(a);if(!o)throw new N(G.RuntimeUnavailable,`FPDFText_LoadPage returned null for page object ${e}`);try{hW(t);let a=Math.max(r.FPDFText_CountChars(o),0);if(0===a)return{runs:[]};let s=[],l=Math.min(a,4096),u=i.alloc(l*FQ.bytes);try{let d=new g$(n,t);for(let t=0;ta.getFloat32(e,!0),l=e=>eH({left:s(e),top:s(e+4),right:s(e+8),bottom:s(e+12)}),u=e=>({upperLeft:{x:s(e),y:s(e+4)},upperRight:{x:s(e+8),y:s(e+12)},lowerLeft:{x:s(e+16),y:s(e+20)},lowerRight:{x:s(e+24),y:s(e+28)}}),d=e.length>0?e[e.length-1].objectKey:null;for(let c=0;c+n<=t.byteLength;c+=n){let t=c+r.geometry,n=a.getUint32(c+r.objectRun,!0),f={objectKey:n,...function(e){let t=a.getUint32(e+i.flags,!0);if(t&o.empty)return{flags:2,looseBox:{left:0,bottom:0,right:0,top:0},upright:!0,baselineAngle:0,ascentFlip:!1};let n=!!(t&o.upright),r={flags:t&o.space?1:0,looseBox:l(e+i.looseBox),upright:n,baselineAngle:0,ascentFlip:!1};if(t&o.hasTightBox&&(r.tightBox=l(e+i.tightBox)),t&o.hasLooseQuad&&!n){r.looseQuad=u(e+i.looseQuad),t&o.hasTightQuad&&(r.tightQuad=u(e+i.tightQuad));let n=s(e+i.matrix),a=s(e+i.matrix+4),l=s(e+i.matrix+8),d=s(e+i.matrix+12);r.baselineAngle=Math.atan2(a,n),r.ascentFlip=n*d-a*l<0}return r}(t)};n!==d&&(f.fontSize=s(c+r.fontSize),d=n),e.push(f)}}(s,i.readBytes(u,c*FQ.bytes))}}finally{i.free(u)}return{runs:function(e){let t,n,r=[],i=[],o=0,a=null,s=e=>{i.length>0&&(r.push(function(e,t,n,r){if(r&&!r.upright){let i=e.map(e=>e.looseQuad?{loose:e.looseQuad,...e.tightQuad?{tight:e.tightQuad}:{},...gU(e.flags)}:{loose:{upperLeft:{x:0,y:0},upperRight:{x:0,y:0},lowerLeft:{x:0,y:0},lowerRight:{x:0,y:0}},...gU(e.flags)});return{rect:gV(e,e=>{var t;let n,r;return e.looseQuad?(n=[(t=e.looseQuad).upperLeft.x,t.upperRight.x,t.lowerLeft.x,t.lowerRight.x],r=[t.upperLeft.y,t.upperRight.y,t.lowerLeft.y,t.lowerRight.y],{left:Math.min(...n),right:Math.max(...n),bottom:Math.min(...r),top:Math.max(...r)}):gW}),start:t,glyphs:i,rotation:(-(180*r.baselineAngle)/Math.PI%360+360)%360,ascentFlip:r.ascentFlip,...void 0!==n?{fontSize:n}:{}}}let i=e.map(e=>({loose:e.looseBox,...e.tightBox?{tight:e.tightBox}:{},...gU(e.flags)}));return{rect:gV(e,e=>e.looseBox),start:t,glyphs:i,...void 0!==n?{fontSize:n}:{}}}(i,o,t,n)),i=[],n=void 0),o=e};for(let r=0;r=Math.abs(Math.atan2(Math.sin(n),Math.cos(n)))}(n,l)&&s(r),n||(n=l)),i.push(o)}return s(e.length),r}(s)}}finally{r.FPDFText_ClosePage(o)}}finally{o.release(e)}}};function gU(e){return{...1&e?{space:!0}:{},...2&e?{empty:!0}:{}}}function gV(e,t){let n=null;for(let r of e){if(2&r.flags)continue;let e=t(r);if(!n){n={left:e.left,bottom:e.bottom,right:e.right,top:e.top};continue}n.left=Math.min(n.left,e.left),n.bottom=Math.min(n.bottom,e.bottom),n.right=Math.max(n.right,e.right),n.top=Math.max(n.top,e.top)}return n??{...gW}}var gW={left:0,bottom:0,right:0,top:0};async function gq(e,t){let n=gH(e,t);if(!n)return null;try{return await t.draw(n.bitmapPtr,n.matrixPtr,n.clipPtr)?n.read():null}finally{n.free()}}function gH(e,t){var n,r,i;let{fn:o,mem:a}=e,{rect:s,page:l,rotation:u,viewport:d,background:c}=t;if(s.right<=s.left||s.top<=s.bottom)return null;let f=(n=s,r=l,{left:n.left-r.left,right:n.right-r.left,bottom:r.top-n.top,top:r.top-n.bottom}),{width:m,height:p}=function(e,t,n){var r;let i,o=90===t||270===t,a=o?e.height:e.width,s=o?e.width:e.height;if("width"===n.kind){if(!Number.isFinite(n.width)||n.width<=0)throw new N(G.InvalidArg,"render viewport width must be positive");let e=Math.max(1,Math.round(n.width));return{width:e,height:Math.max(1,Math.round(e*s/a))}}let l="dpi"===n.kind?(r=n.dpi,i=Math.max(e.width,e.height),r/72*Math.min(1,842/i,612/Math.min(e.width,e.height))):"thumbnail"===n.kind?512/Math.max(e.width,e.height):n.scale??1;if(!Number.isFinite(l)||l<=0)throw new N(G.InvalidArg,"render viewport scale must be positive");return{width:Math.max(1,Math.round(a*l)),height:Math.max(1,Math.round(s*l))}}({width:f.right-f.left,height:f.top-f.bottom},u,d);if(void 0!==t.maxOutputPixels&&m*p>t.maxOutputPixels)throw new N(G.InvalidArg,`render output ${m}x${p} exceeds the ${t.maxOutputPixels}-pixel budget \\u2014 request a smaller width (or tiles, once available)`);let h=4*m,F=h*p,g=null,_=null,P=null,D=null,b=()=>{_&&o.FPDFBitmap_Destroy(_),D&&a.free(D),P&&a.free(P),g&&a.free(g)};try{if(g=a.alloc(F),!(_=o.FPDFBitmap_CreateEx(m,p,4,g,h)))return b(),null;o.FPDFBitmap_FillRect(_,0,0,m,p,0xffffffff*("transparent"!==c)),P=a.alloc(24),function(e,t,n){for(let r=0;r<6;r++)e.poke(t,"f32",n[r],4*r)}(a,P,function(e,t,n,r){let{x:i,y:o}=e,a=e.width,s=e.height;switch(t){case 0:return[n/a,0,0,r/s,-n/a*i,-r/s*o];case 90:return[0,r/a,-n/s,0,n/s*(o+s),-r/a*i];case 180:return[-n/a,0,0,-r/s,n/a*(i+a),r/s*(o+s)];case 270:return[0,-r/a,n/s,0,-n/s*o,r/a*(i+a)]}}({x:(i=f).left,y:i.bottom,width:i.right-i.left,height:i.top-i.bottom},u,m,p)),D=a.alloc(16),a.poke(D,"f32",0,0),a.poke(D,"f32",0,4),a.poke(D,"f32",m,8),a.poke(D,"f32",p,12)}catch(e){throw b(),e}let y=g;return{bitmapPtr:_,matrixPtr:P,clipPtr:D,read:()=>{var e;let t;return{width:m,height:p,stride:h,color:"rgba8",premultipliedAlpha:!1,data:((t=new Uint8Array((e=a.readBytes(y,F)).byteLength)).set(e),t.buffer)}},free:b}}function gK(e,t){let{fn:n,mem:r}=e,i=hY(r,16,e=>n.FPDF_GetPageBoundingBox(t,e)?FX(r,e):null);return i?eH(i):{left:0,bottom:0,right:n.FPDF_GetPageWidthF(t),top:n.FPDF_GetPageHeightF(t)}}var gZ=class{constructor(e,t){this.runtime=e,this.session=t}async render(e,t,n,r){hW(n);let{fn:i}=this.runtime,o=this.session.pagePool(),a=await o.acquireInSlices(e,n,r);try{hW(n),function(e){let{usage:t,viewport:n}=e??{};if(void 0===t||"display"===t){if(n?.kind==="dpi"&&nl("viewport",\'a dpi viewport is only for a print picture (usage: "print")\'),n?.kind==="thumbnail"){e?.target!==void 0&&"page"!==e.target.kind&&nl("target","a thumbnail is the whole page: it takes no target");}return}for(let r of("print"!==t&&nl("usage",\'usage must be "display" or "print"\'),(n?.kind!=="dpi"||150!==n.dpi&&300!==n.dpi)&&nl("viewport","a print picture needs viewport: { kind: \'dpi\', dpi: 150 or 300 }"),["target","rotation","background"]))e?.[r]!==void 0&&nl(r,`a print picture takes no ${r}: it is the whole page, upright, on white`)}(t);let o="print"===t.usage,s=gK(this.runtime,a),l=function(e,t){if(!e||"page"===e.kind)return t;let n=eH(e.rect);if(!(n.right>n.left&&n.top>n.bottom))throw new N(G.InvalidArg,"render rect must have positive area");return n}(t.target,s),u=t.rotation??0,d=t.viewport??{kind:"scale",scale:1},c=function(e,t){let{includeAnnotations:n,includeFormFields:r}=e??{};if(!0===n&&!t.annotations)throw new na("doc.annotate.read","includeAnnotations");if(!0===r&&!t.formFields)throw new na("doc.forms.read","includeFormFields");return{includeAnnotations:n??t.annotations,includeFormFields:r??(!1!==n&&t.formFields)}}(t,{annotations:!0,formFields:!0}),f=16;c.includeAnnotations&&(f|=1),c.includeFormFields&&(f|=32768),o&&(f|=2048);let m=await gq(this.runtime,{rect:l,page:s,rotation:u,viewport:d,...void 0!==t.maxOutputPixels?{maxOutputPixels:t.maxOutputPixels}:{},background:"transparent"===t.background?"transparent":"white",draw:async(e,t,o)=>{hW(n);let s=i.EPDF_RenderPageBitmapWithMatrix_Start(e,a,t,o,f,r.budgetMs);try{for(;1===s;)await r.between(),hW(n),s=i.EPDF_RenderPage_Continue(a,r.budgetMs)}finally{i.FPDF_RenderPage_Close(a)}return 2===s}});if(!m)throw new N(G.RuntimeUnavailable,`failed to render page object ${e}`);return{raster:m,area:l}}finally{o.release(e)}}};function gJ(e,t){return{docPtr:e.requireDocPtr(),...t?{fonts:t}:{}}}function gQ(e,t){if(void 0===e.family)return e;let n=t.programOf?.(e.family),r=eU(e.family,t.describe),i={...e,family:r.family};return void 0!==r.weight&&void 0===e.weight&&(i.weight=r.weight),void 0!==r.italic&&void 0===e.italic&&(i.italic=r.italic),void 0!==n&&(i.program=n),i}function gX(e,t={}){let n=e.body?gQ(e.body,t):void 0;n&&void 0!==t.bodyProgram&&(n.program=t.bodyProgram);let r=e.paragraphs.map(e=>({...e,runs:e.runs.map(e=>({...e,text:e2(e.text,`\\r`),...e.style?{style:gQ(e.style,t)}:{}}))}));return JSON.stringify(n?{body:n,paragraphs:r}:{paragraphs:r})}function gY(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||"object"!=typeof t||!t.body||!Array.isArray(t.paragraphs))return null;let{source:n,...r}=t.body,i=g0(r),o=t.paragraphs.map(e=>{let{runs:t,...n}=e;return{...n,runs:(t??[]).map(e=>{let t="string"==typeof e.text?e2(e.text,`\n`):e.text;return e.style?{...e,text:t,style:g0(e.style)}:{...e,text:t}})}});return{source:t.source,document:{body:i,paragraphs:o}}}function g0(e){return"string"==typeof e.color?{...e,color:e.color.toLowerCase()}:e}function g1(e,t,n){let r=h2(t,(t,r)=>e.EPDFAnnot_GetRichTextJSON(n,t,r)),i=r?gY(r):null;if(i?.source!=="rc")return null;let{body:o,paragraphs:a}=i.document;return{body:{...o,family:o.family||e6.family},paragraphs:a}}function g3(e){let t=Math.fround(e);if(!Number.isFinite(t))return t;for(let e=1;e<9;e++){let n=Number(t.toPrecision(e));if(Math.fround(n)===t)return n}return t}var g2={invisible:1,hidden:2,print:4,noZoom:8,noRotate:16,noView:32,readOnly:64,locked:128,toggleNoView:256,lockedContents:512},g6=Object.keys(g2);function g5(e){let t={};for(let n of g6)void 0!==e[n]&&(t[n]=e[n]);return Object.keys(t).length>0?t:null}function g4(e){switch(e){case"square":return 1;case"circle":return 2;case"diamond":return 3;case"open-arrow":return 4;case"closed-arrow":return 5;case"butt":return 6;case"r-open-arrow":return 7;case"r-closed-arrow":return 8;case"slash":return 9;default:return 0}}function g8(e){switch(e){case 1:return"square";case 2:return"circle";case 3:return"diamond";case 4:return"open-arrow";case 5:return"closed-arrow";case 6:return"butt";case 7:return"r-open-arrow";case 8:return"r-closed-arrow";case 9:return"slash";default:return"none"}}function g7(e,t,n,r){return e.FPDFAnnot_HasKey(n,r)?h3(t,(t,i)=>e.FPDFAnnot_GetStringValue(n,r,t,i),""):null}function g9(e,t,n){return hY(t,16,r=>e.FPDFAnnot_GetRect(n,r)?FX(t,r):{left:0,bottom:0,right:0,top:0})}function _e(e,t,n,r=0){return h0(t,[4,4,4],([i,o,a])=>e.EPDFAnnot_GetColor(n,r,i,o,a)?e7(255&F1(t,i),255&F1(t,o),255&F1(t,a)):null)}function _t(e,t,n,r){return hY(t,4,i=>e.EPDFAnnot_GetBooleanValue(n,r,i)?0!==F1(t,i):null)}function _n(e,t,n){return hY(t,4,r=>e.EPDFAnnot_GetOpacity(n,r)?g3(F0(t,r)):null)}function _r(e,t,n){return hY(t,4,r=>({styleCode:e.EPDFAnnot_GetBorderStyle(n,r),width:F0(t,r)}))}function _i(e,t,n){return hY(t,4,r=>{if(!e.EPDFAnnot_GetBorderEffect(n,r))return null;let i=F0(t,r);return i>0?i:null})}function _o(e,t,n){let r=e.FPDFAnnot_GetVertices(n,0n,0);return r<=0?[]:hY(t,8*r,i=>{let o=e.FPDFAnnot_GetVertices(n,i,r);if(o<=0)return[];let a=[];for(let e=0;e{let a=e.FPDFAnnot_GetInkListPath(n,o,i,r);if(a<=0)return[];let s=[];for(let e=0;e0&&i.push(a)}return i}function _s(e,t,n){return h0(t,[8,8],([r,i])=>e.FPDFAnnot_GetLine(n,r,i)?{start:{x:F0(t,r,0),y:F0(t,r,4)},end:{x:F0(t,i,0),y:F0(t,i,4)}}:null)}function _l(e,t,n){return h0(t,[4,4],([r,i])=>e.EPDFAnnot_GetLineEndings(n,r,i)?{start:g8(F1(t,r)),end:g8(F1(t,i))}:{start:"none",end:"none"})}function _u(e,t,n){return h0(t,[4,4,4,4,4],([r,i,o,a,s])=>e.EPDFAnnot_GetDefaultAppearance(n,r,i,o,a,s)?{fontCode:F1(t,r),fontSize:F0(t,i),color:e7(255&F1(t,o),255&F1(t,a),255&F1(t,s))}:null)}function _d(e,t,n){return h0(t,[4,4],([r,i])=>{let o=h3(t,(t,o)=>e.EPDFAnnot_GetDefaultAppearanceFontFace(n,t,o,r,i),null);return o?{family:o,weight:F1(t,r),italic:0!==F1(t,i)}:null})}function _c(e,t){return e.EPDFAnnot_GetTextAlignment(t)}function _f(e,t,n){let r=e.EPDFAnnot_GetIntent(n,0n,0);if(r<=0)return null;let i=(r+1)*2;return hY(t,i,r=>(e.EPDFAnnot_GetIntent(n,r,i),t.readU16String(r)))}function _m(e,t,n){let r=e.FPDFAnnot_CountAttachmentPoints(n);return r<=0?[]:hY(t,32,i=>{let o=[];for(let a=0;aF0(t,i,e);o.push(function(e){let[t,n,r,i]=e;if(eZ(e))return{upperLeft:t,upperRight:n,lowerLeft:r,lowerRight:i};if(eZ([t,n,i,r]))return{upperLeft:t,upperRight:n,lowerLeft:i,lowerRight:r};let o=e.map(e=>eK(e)?e:{x:0,y:0}),a=o.reduce((e,t)=>e+t.x,0)/4,s=o.reduce((e,t)=>e+t.y,0)/4,l=[...o].sort((e,t)=>Math.atan2(e.y-s,e.x-a)-Math.atan2(t.y-s,t.x-a)),u=0;for(let e=1;e<4;e++)l[e].y+l[(e+1)%4].y>l[u].y+l[(u+1)%4].y&&(u=e);let d=[l[u],l[(u+1)%4]],c=[l[(u+3)%4],l[(u+2)%4]];return d[0].x<=d[1].x?{upperLeft:d[0],upperRight:d[1],lowerLeft:c[0],lowerRight:c[1]}:{upperLeft:d[1],upperRight:d[0],lowerLeft:c[1],lowerRight:c[0]}}([{x:r(0),y:r(4)},{x:r(8),y:r(12)},{x:r(16),y:r(20)},{x:r(24),y:r(28)}]))}return o})}function _p(e,t,n){return h2(t,(t,r)=>e.EPDFAnnot_GetName(n,t,r))}function _h(e,t,n){return h2(t,(t,r)=>e.EPDFAnnot_GetAppearanceState(n,t,r))}function _F(e){let t=g3((-g3(e)%360+360)%360+0);return 0===t||360===t?void 0:t}function _g(e){let t=(-e%360+360)%360+0;return t>180?t-360:t}var __=new Set([5,6,3,13,14]),_P=[90,180,270],_D=e=>(e%360+360)%360;function _b(e,t){let n=Math.abs(_D(e)-_D(t));return Math.min(n,360-n)}function _y(e,t,n){if(!e.EPDFAnnot_HasEmbedMetadata(n))return;let r=hY(t,4,r=>e.EPDFAnnot_GetEmbedMetadataNumber(n,"Rotation",r)?_D(F0(t,r)):void 0);if(void 0===r||.01>_b(r,0))return;let i=hY(t,16,r=>e.EPDFAnnot_GetEmbedMetadataRect(n,"UnrotatedRect",r)?eH(FX(t,r)):void 0);if(i&&!(i.right<=i.left)&&!(i.top<=i.bottom))return{degrees:r,box:i}}function _w(e,t,n){let r=eH(g9(e,t,n)),i=h0(t,[4,4,4,4],([r,i,o,a])=>e.EPDFAnnot_GetRectangleDifferences(n,r,i,o,a)?{left:F0(t,r),bottom:F0(t,i),right:F0(t,o),top:F0(t,a)}:null);if(!i)return r;let o={left:r.left+i.left,bottom:r.bottom+i.bottom,right:r.right-i.right,top:r.top-i.top};return o.left<=o.right&&o.bottom<=o.top?o:r}function _E(e,t,n){let r=function(e,t,n){let r=e.FPDFAnnot_GetSubtype(n);if(!__.has(r))return;let i=function(e,t,n){if(e.FPDFAnnot_HasKey(n,"Rotate"))return hY(t,4,r=>e.EPDFAnnot_GetRotate(n,r)?F0(t,r):void 0)}(e,t,n),o=hY(t,16,r=>hY(t,24,o=>{if(!e.EPDFAnnot_GetAppearanceTransform(n,r,o))return;let a={a:F0(t,o,0),b:F0(t,o,4),c:F0(t,o,8),d:F0(t,o,12),e:F0(t,o,16),f:F0(t,o,20)},s=function(e){let t=Math.hypot(e.a,e.b);if(!(t>0))return;let n=.002*t;if(Math.abs(e.a-e.d)>n||Math.abs(e.b+e.c)>n)return;let r=_D(180*Math.atan2(e.b,e.a)/Math.PI);return _b(r,0)>.05?r:void 0}(a);if(void 0===s)return;let l=eH(FX(t,r)),u=Math.hypot(a.a,a.b),d=(l.left+l.right)/2,c=(l.bottom+l.top)/2,f=a.a*d+a.c*c+a.e,m=a.b*d+a.d*c+a.f,p=(l.right-l.left)*u/2,h=(l.top-l.bottom)*u/2;return{degrees:void 0!==i&&.05>=_b(i,s)?_D(i):Math.round(100*s)/100,box:{left:f-p,bottom:m-h,right:f+p,top:m+h}}})),a=_w(e,t,n),s=3===r,l=s&&void 0!==i?_P.find(e=>.05>=_b(i,e)):void 0,u=_y(e,t,n);if(u&&eY(eJ(u.box,u.degrees),a)&&(o?.05>=_b(o.degrees,u.degrees):!e.EPDFAnnot_HasAppearanceStream(n,0)||s&&(e.FPDFAnnot_HasKey(n,"CL")||void 0!==l&&.05>=_b(l,u.degrees))))return u;if(o)return o;if(void 0===l)return;if(180===l)return{degrees:l,box:a};let d=(a.left+a.right)/2,c=(a.bottom+a.top)/2,f=(a.top-a.bottom)/2,m=(a.right-a.left)/2;return{degrees:l,box:{left:d-f,bottom:c-m,right:d+f,top:c+m}}}(e,t,n);if(!r)return;let i=_F(r.degrees);return void 0===i?void 0:{rotation:i,box:r.box}}function _A(e,t,n){let r=_E(e,t,n);return r?{box:r.box,rotation:r.rotation}:{box:_w(e,t,n),rotation:null}}var _v="Replace",_S="StrikeOutTextEdit";function _k(e){if("replace"===e)return _v}function _x(e){if("strikeout-text-edit"===e)return _S}function _G(e,t,n,r){let i=t.writeU16String(r.key);try{return e.EPDFDoc_GetAttachmentIndexByKey(n,i)}finally{t.free(i)}}function _O(e,t,n,r,i,o){let a=o.bytes.byteLength;if(0===a){if(!e.FPDFAttachment_SetFile(n,r,0n,0))throw new N(G.Unknown,"FPDFAttachment_SetFile returned false")}else{let i=t.alloc(a);try{if(t.writeBytes(i,new Uint8Array(o.bytes)),!e.FPDFAttachment_SetFile(n,r,i,a))throw new N(G.Unknown,"FPDFAttachment_SetFile returned false")}finally{t.free(i)}}if(h6(t,hH(new Date),t=>e.FPDFAttachment_SetStringValue(n,"CreationDate",t)),i.mimeType&&!e.EPDFAttachment_SetSubtype(n,i.mimeType))throw new N(G.Unknown,"EPDFAttachment_SetSubtype returned false");if(void 0!==i.description&&!h6(t,i.description,t=>e.EPDFAttachment_SetDescription(n,t)))throw new N(G.Unknown,"EPDFAttachment_SetDescription returned false")}function _I(e,t,n){let r=h3(t,(t,r)=>e.FPDFAttachment_GetName(n,t,r))??"",i=h3(t,(t,r)=>e.FPDFAttachment_GetSubtype(n,t,r)),o=h3(t,(t,r)=>e.EPDFAttachment_GetDescription(n,t,r)),a=_M(e,t,n,"CreationDate"),s=_M(e,t,n,"ModDate"),l=function(e){if(!e)return null;let t=e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e;return/^[0-9a-fA-F]+$/.test(t)?t.toLowerCase():e}(_j(e,t,n,"CheckSum"));return{name:r,mimeType:i||null,description:o||null,sizeBytes:function(e,t,n){let r=t.alloc(4);try{if(!e.EPDFAttachment_GetIntegerValue(n,"Size",r))return null;let i=Number(t.peek(r,"i32"));return i>=0?i:null}finally{t.free(r)}}(e,t,n),md5:l||null,createdAt:a||null,modifiedAt:s||null}}function _N(e,t,n){let{fn:r,mem:i}=e,o=i.alloc(8),a=i.alloc(4),s=i.alloc(4),l=null;try{if(i.poke(o,"ptr",0),i.poke(a,"i32",0),i.poke(s,"i32",-1),!r.EPDFAttachment_ExtractFileToOwnedBuffer(t,BigInt(n??0),o,a,s))throw _C(Number(i.peek(s,"i32")),n);let e=Number(i.peek(a,"i32"))>>>0;if(l=i.peek(o,"ptr"),0===e||!l)return{bytes:new ArrayBuffer(0),size:0};let u=i.readBytes(l,e),d=new ArrayBuffer(u.byteLength);return new Uint8Array(d).set(u),{bytes:d,size:e}}finally{l&&r.EPDF_FreeBuffer(l),i.free(s),i.free(a),i.free(o)}}function _C(e,t){switch(e){case 1:return new N(G.InvalidArg,"attachment has no embedded file stream (missing /EF)");case 2:return new N(G.MalformedPdf,"embedded file stream failed to decode");case 3:return new N(G.PayloadTooLarge,`the embedded file decodes to more than ${t} bytes, the limit`,{details:{limit:t}});case 4:return new N(G.Unknown,"writing the extracted attachment failed");default:return new N(G.Unknown,`attachment extraction failed (status ${e})`)}}function _j(e,t,n,r){return e.FPDFAttachment_HasKey(n,r)?h3(t,(t,i)=>e.FPDFAttachment_GetStringValue(n,r,t,i),null):null}function _M(e,t,n,r){let i=_j(e,t,n,r);return i?hq(i):null}var _R=Object.freeze({comment:"Comment",key:"Key",note:"Note",help:"Help","new-paragraph":"NewParagraph",paragraph:"Paragraph",insert:"Insert"}),_T=Object.freeze(Object.fromEntries(Object.entries(_R).map(([e,t])=>[t,e]))),_B=Object.freeze({graph:"Graph","push-pin":"PushPin",paperclip:"Paperclip",tag:"Tag"}),_L=Object.freeze(Object.fromEntries(Object.entries(_B).map(([e,t])=>[t,e]))),_$={"free-text":"FreeText","free-text-callout":"FreeTextCallout","free-text-typewriter":"FreeTextTypeWriter"};function _z(e){return Object.entries(_$).find(([,t])=>t===e)?.[0]??"free-text"}var _U={courier:0,"courier-bold":1,"courier-bold-oblique":2,"courier-oblique":3,helvetica:4,"helvetica-bold":5,"helvetica-bold-oblique":6,"helvetica-oblique":7,"times-roman":8,"times-bold":9,"times-bold-italic":10,"times-italic":11,symbol:12,"zapf-dingbats":13},_V=Object.fromEntries(Object.entries(_U).map(([e,t])=>[t,e])),_W="helvetica";function _q(e){return _V[e]??"helvetica"}function _H(e){switch(e){case"center":return 1;case"right":return 2;default:return 0}}function _K(e){switch(e){case 1:return"center";case 2:return"right";default:return"left"}}var _Z=["top","middle","bottom"];function _J(e,t,n,r,i){let o=i?.keyForFace(r.family,r.weight,r.italic);if(void 0!==o)return o;let a=function(e){let t;if(void 0!==t)return t;let n=eW[eV(e.family)];if(n){let t=Object.entries(ez),r=e.weight>=600,i=t.find(([,t])=>t.family===n&&t.weight>=600===r&&t.italic===e.italic)??t.find(([,e])=>e.family===n);if(i)return i[0]}return e.family}(r);if(Z.includes(a))return a;let s=_d(e,t,n);if(s&&eV(s.family)===eV(r.family)&&s.weight===r.weight&&s.italic===r.italic){let r=h2(t,(t,r)=>e.EPDFAnnot_GetDefaultAppearanceFontPostScriptName(n,t,r));if(r)return r}return aA({familyName:r.family,weight:r.weight,italic:r.italic},null)}function _Q(e,t,n,r){let i=e.EPDFAnnot_GetEmbedMetadataString(n,r,0n,0);if(i<=2)return;let o=t.alloc(i);try{if(0>=e.EPDFAnnot_GetEmbedMetadataString(n,r,o,i))return;return t.readU16String(o)}finally{t.free(o)}}function _X(e,t,n,r){let i=t.alloc(4);try{if(!e.EPDFAnnot_GetEmbedMetadataNumber(n,r,i))return;return Number(t.peek(i,"f32"))}finally{t.free(i)}}function _Y(e){switch(e){case"dashed":return 2;case"beveled":return 3;case"inset":return 4;default:return 1}}function _0(e){switch(e){case 2:return"dashed";case 3:return"beveled";case 4:return"inset";default:return"solid"}}function _1(e){return 5===e?"underline":_0(e)}function _3(e,t,n){let r,{styleCode:i,width:o}=_r(e,t,n),a=(r=e.EPDFAnnot_GetBorderDashPatternCount(n))<=0?[]:hY(t,4*r,i=>{if(!e.EPDFAnnot_GetBorderDashPattern(n,i,r))return[];let o=[];for(let e=0;e0?a:null}}function _2(e,t,n){let r=_e(e,t,n,0),i=_n(e,t,n);return{color:r,opacity:null==i?1:Math.max(0,Math.min(1,i)),..._3(e,t,n)}}function _6(e,t,n){let r=_e(e,t,n,1);return{..._2(e,t,n),interiorColor:r??null}}function _5(e,t,n,r){let i=r.flat();if(0===i.length)return;let o=function(e,t,n){let r=function(e,t,n){if(e.EPDFAnnot_HasEmbedMetadata(n))return hY(t,4,r=>{if(e.EPDFAnnot_GetEmbedMetadataNumber(n,"Rotation",r))return _F(F0(t,r))})}(e,t,n);if(void 0===r)return;let i=hY(t,16,r=>e.EPDFAnnot_GetEmbedMetadataRect(n,"UnrotatedRect",r)?eH(FX(t,r)):void 0);return i?{rotation:r,box:i}:void 0}(e,t,n);if(!o)return;let{box:a}=o,s={degrees:o.rotation,center:{x:(a.left+a.right)/2,y:(a.bottom+a.top)/2}};return eY(e0(i.map(e=>e3(e,s))),a)?s:void 0}var _4=(e,t)=>t?e3(e,t):e;function _8(e){if("ink-highlight"===e)return"InkHighlight"}var _7={"line-arrow":"LineArrow","line-dimension":"LineDimension","polygon-cloud":"PolygonCloud","polygon-dimension":"PolygonDimension","polyline-dimension":"PolyLineDimension"};function _9(e,t,n){return{measure:ga(e,t,e.EPDFAnnot_GetMeasure(n))??null}}function Pe(e,t,n){return h0(t,[4,4,8],([r,i,o])=>{if(!e.EPDFAnnot_GetShapeCaption(n,r,i,o))return;let a=!!t.peek(r,"i32"),s=!!t.peek(i,"i32");if(e.EPDFAnnot_GetEmbedMetadataBoolean(n,"MeasurementCaption",r)||s)return{enabled:a,...s?{center:{x:Number(t.peek(o,"f32")),y:Number(t.peek(o,"f32",4))}}:{}}})}var Pt={start:{x:0,y:0},end:{x:0,y:0}};function Pn(e,t,n,r){var i,o,a,s,l;let u,d,c=r.page.objectNumber,f="xyz"===r.kind?e.EPDFDest_CreateXYZByObjectNumber(n,c,null!=r.left,r.left??0,null!=r.top,r.top??0,null!=r.zoom,r.zoom??0):(i=e,o=t,a=n,s=c,l=r,u=(()=>{switch(l.kind){case"fitH":case"fitBH":return null!=l.top?[l.top]:[];case"fitV":case"fitBV":return null!=l.left?[l.left]:[];case"fitR":return[l.left,l.bottom,l.right,l.top];default:return[]}})(),d=F3[l.kind],u.length?hY(o,4*u.length,e=>{for(let t=0;t[t,e]))}function PS(e,t,n,r="#000000"){let i=_e(e,t,n)??r,o=_n(e,t,n);return{color:i,opacity:null==o?1:Math.max(0,Math.min(1,o)),quadPoints:_m(e,t,n),richText:g1(e,t,n)}}function Pk(e,t,n){let r=_o(e,t,n),i=_5(e,t,n,[r]),o=Pe(e,t,n);return{vertices:r.map(e=>_4(e,i)),rotation:i?.degrees??null,captionEnabled:o?.enabled??null,captionCenter:o?.center?_4(o.center,i):null}}var Px=["caption","image","caption-below","caption-above","caption-right","caption-left","caption-over"];function PG(e,t,n,r){return h0(t,[4,4,4],([i,o,a])=>e.EPDFAnnot_GetMKColor(n,r,i,o,a)?e7(255&F1(t,i),255&F1(t,o),255&F1(t,a)):null)}function PO(e,t){return eQ(-e.EPDFAnnot_GetMKRotation(t))||null}var PI={highlight:function(e,t,n,r){let i=PS(e,t,n,"#ffff00");return{...r,subtype:"highlight",...i}},underline:function(e,t,n,r){let i=PS(e,t,n);return{...r,subtype:"underline",...i}},squiggly:function(e,t,n,r){let i=PS(e,t,n);return{...r,subtype:"squiggly",...i}},strikeout:function(e,t,n,r){let i=PS(e,t,n),o=_f(e,t,n)===_S?"strikeout-text-edit":null;return{...r,subtype:"strikeout",intent:o,...i}},circle:function(e,t,n,r){return{...r,subtype:"circle",...Pu(e,t,n)}},square:function(e,t,n,r){return{...r,subtype:"square",...Pu(e,t,n)}},polygon:function(e,t,n,r){let{captionEnabled:i,captionCenter:o,...a}=Pk(e,t,n),s=_f(e,t,n);return{...r,richText:g1(e,t,n),..._9(e,t,n),captionEnabled:i,captionCenter:o,intent:"PolygonCloud"===s?"polygon-cloud":"PolygonDimension"===s?"polygon-dimension":null,subtype:"polygon",..._6(e,t,n),...a,cloudyIntensity:_i(e,t,n)}},polyline:function(e,t,n,r){let{captionEnabled:i,captionCenter:o,...a}=Pk(e,t,n),s=_f(e,t,n);return{...r,richText:g1(e,t,n),..._9(e,t,n),captionEnabled:i,captionCenter:o,intent:"PolyLineDimension"===s?"polyline-dimension":null,subtype:"polyline",..._6(e,t,n),...a,lineEndings:_l(e,t,n)}},line:function(e,t,n,r){let i=_s(e,t,n)??Pt,o=_5(e,t,n,[[i.start,i.end]]),a=_f(e,t,n),s=function(e,t,n){if(["Cap","CP","CO"].some(t=>e.FPDFAnnot_HasKey(n,t)))return h0(t,[4,4,8],([r,i,o])=>{if(e.EPDFAnnot_GetLineCaption(n,r,i,o))return{enabled:!!t.peek(r,"i32"),position:1===t.peek(i,"i32")?"top":"inline",...e.FPDFAnnot_HasKey(n,"CO")?{offset:{along:Number(t.peek(o,"f32")),perpendicular:Number(t.peek(o,"f32",4))}}:{}}})}(e,t,n),l=function(e,t,n){if(["LL","LLE","LLO"].some(t=>e.FPDFAnnot_HasKey(n,t)))return h0(t,[4,4,4],([r,i,o])=>{if(e.EPDFAnnot_GetLineLeader(n,r,i,o))return{length:Number(t.peek(r,"f32")),extension:Number(t.peek(i,"f32")),offset:Number(t.peek(o,"f32"))}})}(e,t,n);return{...r,richText:g1(e,t,n),..._9(e,t,n),intent:"LineArrow"===a?"line-arrow":"LineDimension"===a?"line-dimension":null,captionEnabled:s?.enabled??!1,captionPosition:s?.position??"inline",captionOffset:s?.offset??null,leader:l??null,subtype:"line",..._6(e,t,n),linePoints:{start:_4(i.start,o),end:_4(i.end,o)},lineEndings:_l(e,t,n),rotation:o?.degrees??null}},link:function(e,t,n,r,i,o){return{...r,subtype:"link",target:function(e,t,n,r,i){let o=r.actions?.activate;if(o)return Pr(o);let a=e.FPDFAnnot_GetLink(n);if(!a)return null;let s=e.FPDFLink_GetDest(i.docPtr,a);if(!s)return null;let l=F2(e,t,i.docPtr,s);return l?{kind:"goto",destination:l}:{kind:"unsupported"}}(e,t,n,r,o)}},ink:function(e,t,n,r){let i=_a(e,t,n),o=_5(e,t,n,i),a="InkHighlight"===_f(e,t,n)?"ink-highlight":null;return{...r,richText:g1(e,t,n),subtype:"ink",..._2(e,t,n),intent:a,inkList:i.map(e=>e.map(e=>_4(e,o))),rotation:o?.degrees??null}},"free-text":function(e,t,n,r,i,o){var a;let s,l,u=_u(e,t,n),d=u?.color??"#000000",c=(s=h2(t,(t,r)=>e.EPDFAnnot_GetRichTextJSON(n,t,r)))?gY(s)?.document??null:null,f=o?.fonts,m=c?_J(e,t,n,c.body,f):u?_q(u.fontCode):_W,p=c&&c.body.size>0?c.body.size:u&&u.fontSize>0?u.fontSize:12,h=c??{body:{family:"Helvetica",weight:400,italic:!1,size:p,color:d,decoration:[],script:"normal",letterSpacing:0,horizontalScale:1,align:"left",dir:"ltr"},paragraphs:[{runs:[{text:r.contents??""}]}]},F=h.body.color.toLowerCase(),g=_e(e,t,n,0),_=_n(e,t,n),P=null==_?1:Math.max(0,Math.min(1,_)),D=c?c.body.align:_K(_c(e,n)),b=void 0!==(a=_X(e,t,n,"VerticalAlignment"))&&_Z[a]||"top",y=_z(_f(e,t,n)),w=(l=e.EPDFAnnot_GetCalloutLineCount(n))<=0?[]:hY(t,8*l,r=>{let i=e.EPDFAnnot_GetCalloutLine(n,r,l);if(i<=0)return[];let o=[];for(let e=0;ee.EPDFAnnot_GetMKText(n,0,t,r)),checkStyle:null,layout:Px[e.EPDFAnnot_GetMKTextPosition(n)]??"caption",field:null,fieldKind:"unknown",hasMark:0!==e.EPDFAnnot_GetDrawing(n)}},redact:function(e,t,n,r,i,o){let a=_e(e,t,n,0)??"#ff0000",s=_n(e,t,n),l=null==s?1:Math.max(0,Math.min(1,s)),u=_e(e,t,n,1)??null,d=_u(e,t,n),c=d?_d(e,t,n):null,f=o?.fonts,m=c?.family?_J(e,t,n,c,f):d?_q(d.fontCode):_W,p=d?d.fontSize:12,h=d?.color??"#000000";return{...r,richText:g1(e,t,n),subtype:"redact",quadPoints:_m(e,t,n),color:a,opacity:l,interiorColor:u,overlayText:e.FPDFAnnot_HasKey(n,"OverlayText")?h3(t,(t,r)=>e.EPDFAnnot_GetOverlayText(n,t,r),""):null,repeat:e.EPDFAnnot_GetOverlayTextRepeat(n),fontFamily:m,fontSize:p,fontColor:h,textAlign:_K(_c(e,n))}},popup:function(e,t,n,r,i,o){return{...r,subtype:"popup",parent:Ps(e,t,o.docPtr,n,"Parent",r.page.objectNumber),open:_t(e,t,n,"Open")??!1}},unsupported:function(e,t,n,r,i){let o=g7(e,t,n,"Subtype");return{...r,subtype:"unsupported",rawSubtypeCode:i,rawSubtypeName:o}}};function PN(e){let t=rN(e),n=PI[t];return n?{reader:n,subtype:t}:{reader:PI.unsupported,subtype:"unsupported"}}function PC(e,t,n){let r=(n.next??[]).map(n=>PC(e,t,n)),i=function(e,t,n){let{fn:r,mem:i}=e,o=(()=>{switch(n.type){case"javascript":return h5(i,n.script,e=>r.EPDFAction_CreateJavaScript(t,e));case"goto":return r.EPDFAction_CreateGoTo(t,Pn(r,i,t,n.destination));case"uri":return r.EPDFAction_CreateURI(t,n.uri);case"named":return r.EPDFAction_CreateNamed(t,n.name);case"hide":return Pj(e,n.targets,(e,i)=>r.EPDFAction_CreateHide(t,e,i,n.hide));case"reset-form":return Pj(e,n.fields??[],(e,i)=>r.EPDFAction_CreateResetForm(t,e,n.fields?i:-1,n.exclude));case"submit-form":return h5(i,n.url,i=>Pj(e,n.fields??[],(e,o)=>r.EPDFAction_CreateSubmitForm(t,i,e,n.fields?o:-1,M(n))))}})();if(!o)throw new N(G.InvalidArg,`the ${n.type} action could not be written`);return o}(e,t,n);if(r.length>0&&!gc(e,r,(n,r)=>e.fn.EPDFAction_SetNext(t,i,n,r)))throw new N(G.Unknown,`the ${n.type} action\'s next ones could not be set`);return i}function Pj(e,t,n){let{mem:r}=e,i=8+gu(e),o=t.map(e=>"name"===e.kind?r.writeU16String(e.name):null);try{return hY(r,Math.max(1,t.length*i),a=>(t.forEach((t,n)=>{let s=n*i,l=o[n];r.poke(a,"i32",+!l,s),r.poke(a,"i32","objectNumber"===t.kind?t.objectNumber:0,s+4),gd(e,a,s+8,l??0n)}),n(a,t.length)))}finally{for(let e of o)e&&r.free(e)}}function PM(e,t,n,r){z.forEach((i,o)=>{let a=null===r?null:r[i];if(void 0===a)return;let s=null===a?0n:PC(e,t,a);if(!e.fn.EPDFAnnot_SetEventAction(n,o,s))throw new N(G.Unknown,`the widget\'s ${i} action could not be written`)})}var PR=class{constructor(e,t){this.runtime=e,this.docPtr=t,hJ(this,"indexes",null)}indexOf(e){if(!this.indexes){let{fn:e}=this.runtime,t=new Map,n=e.FPDF_GetPageCount(this.docPtr);for(let r=0;r0&&!t.has(n)&&t.set(n,r)}this.indexes=t}return this.indexes.get(e)??-1}};function PT(e,t,n,r){let{fn:i}=e;return n.some(n=>PB(e,t,n,r,e=>0!==i.EPDFAnnot_GetMKIcon(e,0))??!1)}function PB(e,t,n,r,i){let{fn:o}=e;if(!n.page||n.objectNumber<=0)return null;let a=r.indexOf(n.page.objectNumber);if(a<0)return null;let s=o.EPDFPage_GetAnnotIndexByObjectNumberRaw(t,a,n.objectNumber);if(s<0)return null;let l=o.EPDFPage_GetAnnotRaw(t,a,s);if(!l)return null;try{return i(l)}finally{o.FPDFPage_CloseAnnot(l)}}var PL=e=>z.indexOf(e),P$={root:null,incomplete:!0,warnings:["incomplete"]};function Pz(e,t,n,r){let{fn:i,mem:o}=e;return n.map(n=>PB(e,t,n,r,e=>{let n=new F4,r={};for(let a of["activate","mouseUp"]){let s=i.EPDFAnnot_GetActionModel(e,PL(a));try{let e=F8(i,o,t,s,n);e&&(r[a]=e)}catch(e){if(!N.is(e)||e.code!==G.MalformedPdf)throw e;r[a]=P$}}return r}))}function PU(e,t,n,r){let{fn:i}=e,o=gj(e,t,n);try{if(i.EPDFAnnot_GetMKIcon(o,0)===r)return;if(!(0===r?i.EPDFAnnot_ClearMKIcon(o,0):i.EPDFAnnot_SetMKIcon(o,0,r)))throw new N(G.Unknown,"the push button\'s icon (/MK /I) could not be written");if(!i.EPDFAnnot_GenerateFormFieldAP(o))throw new N(G.Unknown,"the push button\'s look could not be drawn")}finally{i.FPDFPage_CloseAnnot(o)}}function PV(e,t,n){let r=gj(e,t,n);try{return e.fn.EPDFAnnot_GetMKIcon(r,0)}finally{e.fn.FPDFPage_CloseAnnot(r)}}var PW="GroupID",Pq="ForAnyone",PH="Purpose",PK="Placeholder",PZ="CreatedBy",PJ="CreatedAt",PQ="ImportedBy",PX={createdBy:null,createdAt:null,importedBy:null};function PY(e,t,n){let{fn:r,mem:i}=e;return r.EPDFForm_HasFieldEmbedMetadata(t,n)?h3(i,(e,i)=>r.EPDFForm_GetFieldEmbedMetadataString(t,n,PW,e,i),null):null}function P0(e,t,n){let r=PY(e,t,n);return null!==r?{kind:"group",groupId:r}:7!==e.fn.EPDFForm_GetFieldFamily(t,n)&&P1(e,t,n)?{kind:"anyone"}:{kind:"unassigned"}}function P1(e,t,n){let{fn:r,mem:i}=e;return!!r.EPDFForm_HasFieldEmbedMetadata(t,n)&&hY(i,4,e=>r.EPDFForm_GetFieldEmbedMetadataBoolean(t,n,Pq,e)&&0!==i.peek(e,"i32"))}function P3(e,t,n,r){if(P2(e,t,n,[]),!r)return void P6(e,t,n,Pq);if(!e.fn.EPDFForm_SetFieldEmbedMetadataBoolean(t,n,Pq,!0))throw P5(n)}function P2(e,t,n,r){let{fn:i,mem:o}=e;if(!i.EPDFForm_SetFieldEmbedMetadataNumber(t,n,"SchemaVersion",1))throw P5(n);for(let[a,s]of r){if(null===s){P6(e,t,n,a);continue}let r=o.writeU16String(s);try{if(!i.EPDFForm_SetFieldEmbedMetadataString(t,n,a,r))throw P5(n)}finally{o.free(r)}}}function P6(e,t,n,r){if(!e.fn.EPDFForm_ClearFieldEmbedMetadataKey(t,n,r))throw P5(n)}function P5(e){return new N(G.Unknown,`the metadata of field ${e} could not be written`)}var P4={0:"unknown",1:"pushbutton",2:"checkbox",3:"radio",4:"text",5:"combobox",6:"listbox",7:"signature"},P8={0:"none",1:"acroform",2:"xfa"};function P7(e,t){return h3(e.mem,t)??""}function P9(e,t){return h3(e.mem,t,null)}function De(e,t,n,r){let{fn:i}=e;return eR(i.EPDFForm_GetFieldWidgetObjNum(t,n,r),Dl(i.EPDFForm_GetFieldWidgetPageObjNum(t,n,r)))}function Dt(e,t,n){let{fn:r}=e,i=r.EPDFForm_CountFieldWidgets(t,n),o=[];for(let a=0;ar.EPDFForm_GetFieldWidgetOnState(t,n,a,e,i))??"",exportValue:P7(e,(e,i)=>r.EPDFForm_GetFieldWidgetExportValue(t,n,a,e,i)),checked:r.EPDFForm_IsFieldWidgetChecked(t,n,a)});return o}function Dn(e,t,n){let r=e.fn.EPDFForm_CountFieldWidgets(t,n),i=[];for(let o=0;or.EPDFForm_GetFieldOptionLabel(t,n,a,e,i)),value:P7(e,(e,i)=>r.EPDFForm_GetFieldOptionValue(t,n,a,e,i)),selected:r.EPDFForm_IsFieldOptionSelected(t,n,a)});return o}function Di(e,t,n,r,i,o=new F4,a=new PR(e,r)){var s,l;let{fn:u}=e,d=u.EPDFForm_GetFieldObjNum(t,n),c=P7(e,(e,r)=>u.EPDFForm_GetFieldName(t,n,e,r)),f=u.EPDFForm_GetFieldFlags(t,n),m=P4[u.EPDFForm_GetFieldFamily(t,n)]??"unknown",p=Da(e,t,n,!1),h=Da(e,t,n,!0),F=function(e,t,n,r,i){let{fn:o,mem:a}=e,s={};for(let[e,l]of[["keystroke",0],["format",1],["validate",2],["calculate",3]]){let u=F8(o,a,r,o.EPDFForm_GetFieldActionModel(t,n,l),i);u&&(s[e]=u)}return Object.keys(s).length>0?s:void 0}(e,t,n,r,o),g=P0(e,t,n),_={ref:d>0?{kind:"objectNumber",objectNumber:d}:{kind:"fqn",name:c},name:c,kind:m,origin:1===u.EPDFForm_GetFieldOrigin(t,n)?"recovered":"acroform",readOnly:(1&f)!=0,required:(2&f)!=0,noExport:(4&f)!=0,alternateName:P9(e,(e,r)=>u.EPDFForm_GetFieldAlternateName(t,n,e,r)),mappingName:P9(e,(e,r)=>u.EPDFForm_GetFieldMappingName(t,n,e,r)),valueEntry:p,defaultValueEntry:h,...F?{actions:F}:{},groupId:Y(g),assignment:g,lockedBy:null===(s=i?.(c)??null)?null:{signatureIndex:s.signatureIndex,source:s.source},purpose:function(e,t,n){let{fn:r,mem:i}=e;if(!r.EPDFForm_HasFieldEmbedMetadata(t,n))return null;let o=h3(i,(e,i)=>r.EPDFForm_GetFieldEmbedMetadataString(t,n,PH,e,i),null);return rC(o)?o:null}(e,t,n),placeholder:function(e,t,n){let{fn:r,mem:i}=e;if(!r.EPDFForm_HasFieldEmbedMetadata(t,n))return null;let o=h3(i,(e,i)=>r.EPDFForm_GetFieldEmbedMetadataString(t,n,PK,e,i),null);return eN(o)?o:null}(e,t,n),...function(e,t,n){let r,{fn:i,mem:o}=e;if(!i.EPDFForm_HasFieldEmbedMetadata(t,n))return PX;let a=e=>h3(o,(r,o)=>i.EPDFForm_GetFieldEmbedMetadataString(t,n,e,r,o),null);return{createdBy:a(PZ),createdAt:null===(r=a(PJ))?null:hq(r),importedBy:a(PQ)}}(e,t,n),filledBy:null,filledByName:null,filledAt:null,widgets:[]},P=Ds(p),D=Ds(h);switch(m){case"text":{let r=u.EPDFForm_GetFieldMaxLen(t,n);return{..._,kind:m,value:P,defaultValue:D,maxLength:r>0?r:null,multiline:(4096&f)!=0,password:(8192&f)!=0,comb:(0x1000000&f)!=0,format:eb(F),widgets:Dn(e,t,n)}}case"checkbox":{let r=Dt(e,t,n);return{..._,kind:m,checked:r.some(e=>e.checked),exportValue:r[0]?.exportValue??"Yes",hasValuesList:e.fn.EPDFForm_HasFieldValuesList(t,n),widgets:r}}case"radio":{let r=Dt(e,t,n);return{..._,kind:m,value:r.find(e=>e.checked)?.exportValue??"Off",radiosInUnison:(0x2000000&f)!=0,noToggleToOff:(16384&f)!=0,hasValuesList:e.fn.EPDFForm_HasFieldValuesList(t,n),widgets:r}}case"combobox":return{..._,kind:m,value:P,defaultValue:D,edit:(262144&f)!=0,options:Dr(e,t,n),format:eb(F),widgets:Dn(e,t,n)};case"listbox":{let r=Dr(e,t,n);return{..._,kind:m,selectedValues:r.filter(e=>e.selected).map(e=>e.value),defaultValue:"scalar"===(l=h).kind?[l.value]:"array"===l.kind?[...l.values]:[],multiSelect:(2097152&f)!=0,options:r,topIndex:iF(u.EPDFForm_GetFieldTopIndex(t,n),r),widgets:Dn(e,t,n)}}case"pushbutton":{let i=Dn(e,t,n);return{..._,kind:"pushbutton",hasImage:PT(e,r,i,a),takesImage:rW(Pz(e,r,i,a)),widgets:i}}case"signature":return{..._,kind:m,widgets:Dn(e,t,n)};default:return{..._,kind:"unknown",rawValue:"array"===p.kind?p.values.join(","):Ds(p),widgets:Dn(e,t,n)}}}function Do(e,t,n,r){let{fn:i}=e,o=i.EPDFForm_CountFields(t),a=[],s=new F4,l=new PR(e,n);for(let i=0;i=0&&nr?i.EPDFForm_GetFieldDefaultValueAt(t,n,o,e,a):i.EPDFForm_GetFieldValueAt(t,n,o,e,a)));return 1===o?{kind:"scalar",value:s[0]??""}:{kind:"array",values:s}}function Ds(e){return"scalar"===e.kind?e.value:"array"===e.kind?e.values[0]??"":""}function Dl(e){return e>0?q(e):null}var Du={check:"4",cross:"8",star:"H",circle:"l",square:"n",diamond:"u"};function Dd(e,t,n){for(let r of n){if("widget"!==r.subtype)continue;if("objectNumber"!==r.ref.kind){r.caption=null,r.layout=null,r.hasMark=!1;continue}let n=gv(e,t),i=e.fn.EPDFForm_GetFieldIndexForWidget(n,r.ref.objectNumber),o=i<0?0:e.fn.EPDFForm_GetFieldObjNum(n,i);if(o<=0){r.field=null,r.fieldKind="unknown",r.caption=null,r.layout=null,r.hasMark=!1;continue}r.field={kind:"objectNumber",objectNumber:o},r.fieldKind=P4[e.fn.EPDFForm_GetFieldFamily(n,i)]??"unknown",("checkbox"===r.fieldKind||"radio"===r.fieldKind)&&(r.checkStyle=function(e){return Object.keys(Du).find(t=>e?.[0]===Du[t])??null}(r.caption??null)),"pushbutton"!==r.fieldKind&&(r.caption=null,r.layout=null),r.hasMark="signature"===r.fieldKind&&(r.hasMark||0!==e.fn.EPDFForm_GetFieldValueKind(n,i))}}function Dc(e){return 20===e?"widgets":"annotations"}function Df(e){switch(e){case 1:return"multiply";case 2:return"screen";case 3:return"overlay";case 4:return"darken";case 5:return"lighten";case 6:return"color-dodge";case 7:return"color-burn";case 8:return"hard-light";case 9:return"soft-light";case 10:return"difference";case 11:return"exclusion";case 12:return"hue";case 13:return"saturation";case 14:return"color";case 15:return"luminosity";default:return"normal"}}function Dm(e,t,n,r,i,o,a=new F4){let s,l=q(i),u=g9(e,t,r),d=function(e,t){var n=e.FPDFAnnot_GetFlags(t);if(0===n)return{...J};let r={...J};for(let e of g6)r[e]=(n&g2[e])!=0;return r}(e,r),c=g7(e,t,r,"Contents"),f=null===c?null:e2(c,`\n`),m=g7(e,t,r,"Subj"),p=g7(e,t,r,"T"),h=g7(e,t,r,"CreationDate"),F=g7(e,t,r,"M"),g=Df(e.EPDFAnnot_GetBlendMode(r)),_=function(e,t,n){if(!e.EPDFAnnot_HasEmbedMetadata(n))return null;let r=_X(e,t,n,"SchemaVersion"),i=_Q(e,t,n,"UserID"),o=_Q(e,t,n,"GroupID"),a=_Q(e,t,n,"CreatedBy"),s=_Q(e,t,n,"UpdatedBy"),l=_Q(e,t,n,"ImportedBy"),u={};return void 0!==r&&(u.schemaVersion=r),void 0!==i&&(u.userId=i),void 0!==o&&(u.groupId=o),void 0!==a&&(u.createdBy=a),void 0!==s&&(u.modifiedBy=s),void 0!==l&&(u.importedBy=l),u}(e,t,r),P=function(e,t,n,r,i){let o=e.FPDFAnnot_GetLinkedAnnot(r,"IRT");if(!o)return Pa;try{var a;let s=Pl(e,t,n,o,i);if(!s)return Pa;return{inReplyTo:s,replyType:(a=e.EPDFAnnot_GetReplyType(r),2===a?"group":"reply")}}finally{e.FPDFPage_CloseAnnot(o)}}(e,t,n,r,i),D=Ps(e,t,n,r,"Popup",i),b=function(e,t,n,r,i){let o={};for(let[a,s]of[["activate",0],["cursorEnter",1],["cursorExit",2],["mouseDown",3],["mouseUp",4],["focus",5],["blur",6],["pageOpen",7],["pageClose",8],["pageVisible",9],["pageInvisible",10]]){let l=F8(e,t,n,e.EPDFAnnot_GetActionModel(r,s),i);l&&(o[a]=l)}return Object.keys(o).length>0?o:void 0}(e,t,n,r,a);return{ref:gI(e,t,n,l,r,o),page:l,hasAppearance:e.EPDFAnnot_HasAppearanceStream(r,0),appearanceState:_h(e,t,r),structurePosition:(s=e.EPDFAnnot_GetStructurePosition(r,0n,0))<=0?null:hY(t,4*s,n=>(e.EPDFAnnot_GetStructurePosition(r,n,s),Array.from({length:s},(e,r)=>Number(t.peek(n,"i32",4*r))>>>0))),nm:g7(e,t,r,"NM"),...d,rect:u,contents:f,subject:m,author:p,createdAt:h?hq(h):null,modifiedAt:F?hq(F):null,blendMode:g,reply:P.inReplyTo?{to:P.inReplyTo,type:P.replyType??"reply"}:null,popup:D,groupId:_?.groupId??null,userId:_?.userId??null,createdBy:_?.createdBy??null,modifiedBy:_?.modifiedBy??null,importedBy:_?.importedBy??null,actions:b??null}}function Dp(e){let{runtime:t,session:n,pageObjectNumber:r,count:i,getAnnotPtrAt:o,signal:a,fonts:s,family:l}=e,{fn:u,mem:d}=t,c=[],f=new F4,m=gJ(n,s);for(let e=0;ee.includes(t));return t.length===nu.length?void 0:t}(n.modes))?Dh.filter(e=>o.includes(e.name)):Dh,f=this.session.requireDocPtr(),m=q(e),p=[];try{let e=gK(this.runtime,u),o=function(e,t,n){if(void 0===e||"scale"===e.kind){var r;return r=e?.scale,void 0===r||!Number.isFinite(r)||r<=0?1:r}let i=90===n||270===n?t.height:t.width;if(!Number.isFinite(e.width)||e.width<=0||!(i>0))throw new N(G.InvalidArg,"render viewport width must be positive");return e.width/i}(n.viewport,{width:e.right-e.left,height:e.top-e.bottom},d),l=a.FPDFPage_GetAnnotCount(u),h=new g$(i,r);for(let i=0;ie.EPDFAnnot_GetDrawingRect(n,Dg.modeInt,r)?eH(FX(t,r)):null)}(a,s,l);if(!h&&!F)continue;let g=gI(a,s,f,m,l,i),_=eH(g9(a,s,l)),P=_E(a,s,l),D=P&&null!==function(e){let{subtype:t,rect:n,box:r,rotation:i,intent:o}=e;return nz.has(t)&&r&&i&&("free-text"!==t||"free-text-callout"!==o)&&eY(eJ(r,i),n)?i:null}({subtype:rN(r),rect:_,box:P.box,rotation:P.rotation,intent:3===r?_z(_f(a,s,l)):null})?P:void 0,b=D?eH(D.box):_;for(let t of c){let r=!!(h&t.bit),i=r?b:t===Dg?F:null;if(i)for(let c of r?function(e,t,n,r){let i=function(e,t,n,r){let i=[],o=e.EPDFAnnot_GetAppearanceStateCount(n,r);for(let a=0;ae.EPDFAnnot_GetAppearanceStateName(n,r,a,t,i));null!==o&&i.push(o)}return i}(e,t,n,r);return 0===i.length?D_:i.length>8?[{draw:"",label:_h(e,t,n)}]:i.map(e=>({draw:e,label:e}))}(a,s,l,t.modeInt):D_){let a=this.renderOne(u,l,t.modeInt,c.draw,i,e,d,o,r?D:void 0,n.maxOutputPixels);a&&p.push({ref:g,mode:t.name,state:c.label,rect:i,raster:a})}}}finally{a.FPDFPage_CloseAnnot(l)}}return{page:m,appearances:p}}finally{l.release(e)}}renderOne(e,t,n,r,i,o,a,s,l,u){let{fn:d}=this.runtime,c=Math.min(s,Math.sqrt(16e6/Math.max(1,(i.right-i.left)*(i.top-i.bottom))));return function(e,t){let n=gH(e,t);if(!n)return null;try{return t.draw(n.bitmapPtr,n.matrixPtr,n.clipPtr)?n.read():null}finally{n.free()}}(this.runtime,{rect:i,page:o,rotation:a,viewport:{kind:"scale",scale:c},...void 0!==u?{maxOutputPixels:u}:{},background:"transparent",draw:(i,o)=>l?hY(this.runtime.mem,16,a=>(FY(this.runtime.mem,a,l.box),d.EPDF_RenderAnnotBitmapUnrotated(i,e,t,n,r,_g(l.rotation),a,o,16))):d.EPDF_RenderAnnotBitmap(i,e,t,n,r,o,16)})}},Dg=Dh[0],D_=[{draw:"",label:null}],DP=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}list(e,t,n){hW(t),void 0===e&&(this.session.ensureFullPageRegistry(),e=this.session.allRecords().map(e=>e.pageObjectNumber));let r=[];for(let i of e)hW(t),r.push(this.listOne(i,t,n));return{annotations:r.flatMap(e=>e.annotations),pages:r.flatMap(e=>e.pages)}}listOne(e,t,n){hW(t);let{fn:r}=this.runtime,i=this.session.requireDocPtr(),o=this.session.recordByObjectNumber(e),a=r.EPDFPage_GetAnnotCountRaw(i,o.pageIndex);if(a<0)throw new N(G.Unknown,`EPDFPage_GetAnnotCountRaw returned ${a} for page ${e}`);return Dp({runtime:this.runtime,session:this.session,pageObjectNumber:e,count:a,getAnnotPtrAt:e=>r.EPDFPage_GetAnnotRaw(i,o.pageIndex,e),signal:t,...this.fonts?{fonts:this.fonts}:{},...n?{family:n}:{}})}};function DD(e,t,n,r){return h0(t,[32,8],([i,o])=>{if(t.poke(o,"i32",32,0),t.poke(o,"i32",0,4),!e.EPDF_DigestBuffer(n,r,1,i,o))throw new N(G.Unknown,"EPDF_DigestBuffer returned false");let a="";for(let e of t.readBytes(i,32))a+=e.toString(16).padStart(2,"0");return a})}function Db(e,t,n){let r=t.alloc(Math.max(1,n.byteLength));try{return t.writeBytes(r,n),DD(e,t,r,n.byteLength)}finally{t.free(r)}}function Dy(e,t,n,r,i,o){let a=r.hashes.get(i),s=void 0===a?void 0:r.bySource.get(a);if(void 0!==s)return s;let l=t.alloc(i.byteLength);try{t.writeBytes(l,new Uint8Array(i));let s=a??DD(e,t,l,i.byteLength);r.hashes.set(i,s);let u=r.bySource.get(s);if(void 0!==u)return u;let d=function(e,t,n,r,i,o){if("application/pdf"===i.mimeType){let t=e.FPDF_LoadMemDocument(n,r,"");if(!t)throw new N(G.MalformedPdf,"the appearance PDF could not be opened");try{return o(t)}finally{e.FPDF_CloseDocument(t)}}return function(e,t,n,r,i,o){if(!("width"in i))throw new N(G.InvalidArg,"the appearance image has no size");let a=Math.min(1,14400/Math.max(i.width,i.height)),s=i.width*a,l=i.height*a,u=e.FPDF_CreateNewDocument();if(!u)throw new N(G.Unknown,"FPDF_CreateNewDocument returned NULL");try{let a=e.FPDFPage_New(u,0,s,l);if(!a)throw new N(G.Unknown,"FPDFPage_New returned NULL");try{let o=e.FPDFPageObj_NewImageObj(u);if(!o)throw new N(G.Unknown,"FPDFPageObj_NewImageObj returned NULL");let h=!1;try{var d,c,f,m,p;if(!("image/png"===i.mimeType?e.EPDFImageObj_SetPng(0n,0,o,n,r):e.EPDFImageObj_SetJpeg(0n,0,o,n,r)))throw new N(G.InvalidArg,`${"image/png"===i.mimeType?"EPDFImageObj_SetPng":"EPDFImageObj_SetJpeg"} rejected the image data`);d=e,c=t,f=o,m=s,p=l,hY(c,24,e=>{if(c.poke(e,"f32",m,0),c.poke(e,"f32",0,4),c.poke(e,"f32",0,8),c.poke(e,"f32",p,12),c.poke(e,"f32",0,16),c.poke(e,"f32",0,20),!d.FPDFPageObj_SetMatrix(f,e))throw new N(G.Unknown,"FPDFPageObj_SetMatrix returned false")}),e.FPDFPage_InsertObject(a,o),h=!0}finally{h||e.FPDFPageObj_Destroy(o)}if(!e.FPDFPage_GenerateContent(a))throw new N(G.Unknown,"FPDFPage_GenerateContent returned false")}finally{e.FPDF_ClosePage(a)}return o(u)}finally{e.FPDF_CloseDocument(u)}}(e,t,n,r,i,o)}(e,t,l,i.byteLength,o,t=>e.EPDFDoc_CanonicalDrawing(t,0));if(!d)throw new N(G.Unknown,"EPDFDoc_CanonicalDrawing returned NULL");try{let i=Dw(e,t,d),o=function(e,t,n,r){if(r.byContent)return r.byContent;let i=new Map,o=e.EPDFDoc_GetDrawings(n,0n,0);for(let r of o>0?hY(t,4*o,r=>(e.EPDFDoc_GetDrawings(n,r,o),Array.from({length:o},(e,n)=>Number(t.peek(r,"i32",4*n))>>>0))):[]){let o=e.EPDFDoc_ExportDrawing(n,r);if(o)try{let n=Dw(e,t,o);i.has(n)||i.set(n,r)}finally{e.FPDF_CloseDocument(o)}}return r.byContent=i,i}(e,t,n,r),a=o.get(i);if(void 0===a){if(!(a=e.EPDFDoc_ImportDrawing(n,d)))throw new N(G.Unknown,"EPDFDoc_ImportDrawing returned 0");o.set(i,a)}return r.bySource.set(s,a),a}finally{e.FPDF_CloseDocument(d)}}finally{t.free(l)}}function Dw(e,t,n){return hY(t,8,r=>{t.poke(r,"i32",0,0),t.poke(r,"i32",0,4);let i=e.EPDF_SaveDocumentToOwnedBuffer(n,2,r),o=Number(t.peek(r,"i32",0));if(!i||o<=0)throw i&&e.EPDF_FreeBuffer(i),new N(G.Unknown,"failed to save a stamp drawing");try{return DD(e,t,i,o)}finally{e.EPDF_FreeBuffer(i)}})}function DE(e,t,n){let r=t.alloc(n.byteLength);try{t.writeBytes(r,new Uint8Array(n));let i=e.FPDF_LoadMemDocument(r,n.byteLength,"");if(!i)return null;try{return e.FPDF_GetPageCount(i)}finally{e.FPDF_CloseDocument(i)}}finally{t.free(r)}}function DA(e,t,n,r=0){let{r:i,g:o,b:a}=e9(n);if(!e.EPDFAnnot_SetColor(t,r,i,o,a))throw new N(G.Unknown,"EPDFAnnot_SetColor returned false")}function Dv(e,t,n){e.EPDFAnnot_ClearColor(t,n)}function DS(e,t,n){if(!e.EPDFAnnot_SetOpacity(t,n))throw new N(G.Unknown,"EPDFAnnot_SetOpacity returned false")}function Dk(e,t,n){let r=function(e,t){let n=e;for(let e of g6){let r=t[e];void 0!==r&&(r?n|=g2[e]:n&=~g2[e])}return n}(e.FPDFAnnot_GetFlags(t),n);if(!e.FPDFAnnot_SetFlags(t,r))throw new N(G.Unknown,"FPDFAnnot_SetFlags returned false")}function Dx(e,t,n,r){let i=t.alloc(16);try{if(t.poke(i,"f32",r.left,0),t.poke(i,"f32",r.top,4),t.poke(i,"f32",r.right,8),t.poke(i,"f32",r.bottom,12),!e.EPDFAnnot_SetRect(n,i))throw new N(G.Unknown,"EPDFAnnot_SetRect returned false")}finally{t.free(i)}}function DG(e,t,n,r,i){let o=t.writeU16String(i);try{e.FPDFAnnot_SetStringValue(n,r,o)}finally{t.free(o)}}function DO(e,t,n,r,i){null===i?e.EPDFAnnot_RemoveKey(n,r):DG(e,t,n,r,i)}function DI(e,t,n,r){if(!e.EPDFAnnot_SetBorderStyle(t,n,r))throw new N(G.Unknown,"EPDFAnnot_SetBorderStyle returned false")}function DN(e,t,n,r){let i=t.alloc(4*r.length);try{for(let e=0;ee.FPDFAnnot_AddInkStroke(n,r,i.length))throw new N(G.Unknown,"FPDFAnnot_AddInkStroke returned < 0")}finally{t.free(r)}}}function DL(e,t,n){if(!e.EPDFAnnot_SetLineEndings(t,g4(n.start),g4(n.end)))throw new N(G.Unknown,"EPDFAnnot_SetLineEndings returned false")}function D$(e,t,n,r,i){let{r:o,g:a,b:s}=e9(i);if(!e.EPDFAnnot_SetDefaultAppearance(t,n,r,o,a,s))throw new N(G.Unknown,"EPDFAnnot_SetDefaultAppearance returned false")}function Dz(e,t,n){if(!e.EPDFAnnot_SetTextAlignment(t,n))throw new N(G.Unknown,"EPDFAnnot_SetTextAlignment returned false")}function DU(e,t,n){if(!e.EPDFAnnot_SetIntent(t,n))throw new N(G.Unknown,"EPDFAnnot_SetIntent returned false")}function DV(e,t,n){null===n?e.EPDFAnnot_RemoveKey(t,"IT"):DU(e,t,n)}function DW(e,t,n,r){let i=t.writeU16String(r);try{if(!e.EPDFAnnot_SetOverlayText(n,i))throw new N(G.Unknown,"EPDFAnnot_SetOverlayText returned false")}finally{t.free(i)}}function Dq(e,t,n){if(!e.EPDFAnnot_SetOverlayTextRepeat(t,n))throw new N(G.Unknown,"EPDFAnnot_SetOverlayTextRepeat returned false")}function DH(e,t,n,r){let i=t.alloc(8*r.length);try{for(let e=0;etv({x:e.x+n,y:e.y+r},{x:t[i].x,y:t[i].y}))?{dx:n,dy:r}:void 0}function D1(e,t,n,{dx:r,dy:i}){let o=eH(g9(e,t,n));Dx(e,t,n,{left:o.left+r,bottom:o.bottom+i,right:o.right+r,top:o.top+i})}var D3="Rotation",D2="UnrotatedRect";function D6(e,t){e.EPDFAnnot_HasEmbedMetadata(t)||e.EPDFAnnot_SetEmbedMetadataNumber(t,"SchemaVersion",1)}function D5(e,t,n){D6(e,t),e.EPDFAnnot_SetEmbedMetadataNumber(t,D3,_g(n))}var D4=new Set([90,180,270]);function D8(e,t,n,r){D6(e,n);let i=t.alloc(16);try{t.poke(i,"f32",r.left,0),t.poke(i,"f32",r.top,4),t.poke(i,"f32",r.right,8),t.poke(i,"f32",r.bottom,12),e.EPDFAnnot_SetEmbedMetadataRect(n,D2,i)}finally{t.free(i)}}function D7(e,t,n,r){var i;let o;r?(D5(e,n,r.rotation),D8(e,t,n,r.box)):(e.EPDFAnnot_ClearEmbedMetadataKey(n,D3),e.EPDFAnnot_ClearEmbedMetadataKey(n,D2)),i=r?.rotation??null,o=e.FPDFAnnot_GetSubtype(n),null!==i&&(13===o||3===o&&D4.has(i))?e.EPDFAnnot_SetRotate(n,_g(i)):(13===o||3===o)&&e.EPDFAnnot_SetRotate(n,0)}var D9=e=>(e%360+360)%360;function be(e,t,n,r){let i=eH(r.box),o=r.rotation||null;D7(e,t,n,null===o?null:{rotation:o,box:i}),Dx(e,t,n,null===o?i:eJ(i,o)),e.EPDFAnnot_ClearRectangleDifferences(n)}function bt(e,t,n,r){var i;if(void 0===r.box&&void 0===r.rotation)return!1;let o=_A(e,t,n),a=eH(r.box??o.box),s=void 0===r.rotation?o.rotation:r.rotation||null,l=(i=o.rotation,null===s||null===i?s===i:tv(D9(s),D9(i)));if(l&&tv(a,o.box))return!1;let u=a.right-a.left,d=a.top-a.bottom;return l&&tv(u,o.box.right-o.box.left)&&tv(d,o.box.top-o.box.bottom)?(D1(e,t,n,{dx:a.left-o.box.left,dy:a.bottom-o.box.bottom}),null!==s&&D7(e,t,n,{rotation:s,box:a})):be(e,t,n,{box:a,rotation:s}),!0}var bn=t5.caret,br=t5["file-attachment"];function bi(e){return"file-attachment"===e}function bo(e,t,n){if(!e.EPDFAnnot_SetName(t,_B[n]))throw new N(G.Unknown,"EPDFAnnot_SetName returned false")}function ba(e,t,n,r){let i,o=t.writeU16String(r);try{i=e.FPDFAnnot_AddFileAttachment(n,o)}finally{t.free(o)}if(!i)throw new N(G.Unknown,"FPDFAnnot_AddFileAttachment returned NULL");return i}function bs(e){let t=e?.resources?.file;if(void 0===t)throw new N(G.InvalidArg,"creating a file-attachment annotation needs its \'file\' resource");return t}function bl(e){if(e?.docPtr===void 0)throw new N(G.Unknown,"file-attachment writer requires docPtr on the write context");return e.docPtr}function bu(e,t,n,r,i,o){if(Object.prototype.hasOwnProperty.call(_U,n))return void D$(e,t,_U[n]??_U.helvetica,r,i);if(o?.resolveRegisteredFontId&&o.describeRegisteredFont?.(n))return void function(e,t,n,r,i){let{r:o,g:a,b:s}=e9(i);if(!e.EPDFAnnot_SetDefaultAppearanceRegisteredFont(t,n,r,o,a,s))throw new N(G.Unknown,"EPDFAnnot_SetDefaultAppearanceRegisteredFont returned false")}(e,t,o.resolveRegisteredFontId(n),r,i);let a=o?.resolveDocumentFont?.(n);if(a){if(!a.choosable)throw new N(G.InvalidArg,`\'${n}\' can\'t be chosen for new text (${a.restrictions.join(", ")})`,{details:{field:"fontFamily",restrictions:a.restrictions}});!function(e,t,n,r,i){let{r:o,g:a,b:s}=e9(i);if(!e.EPDFAnnot_SetDefaultAppearanceDocumentFont(t,n,r,o,a,s))throw new N(G.InvalidArg,"EPDFAnnot_SetDefaultAppearanceDocumentFont refused the program")}(e,t,a.objectNumber,r,i);return}throw new N(G.InvalidArg,`fontFamily \'${n}\' is not a standard font, one of the engine\'s fonts or one of the document\'s`,{details:{field:"fontFamily"}})}function bd(e,t,n,r){let i=t5[r.subtype];bc(e,n,void 0===r.color?i.color:r.color),DS(e,n,r.opacity??i.opacity),bf(e,t,n,r)}function bc(e,t,n){null===n?function(e,t,n=0){if(!e.EPDFAnnot_SetNoColor(t,n))throw new N(G.Unknown,"EPDFAnnot_SetNoColor returned false")}(e,t):DA(e,t,n)}function bf(e,t,n,r){let i=t5[r.subtype];DI(e,n,_Y(r.borderStyle??i.borderStyle),r.strokeWidth??i.strokeWidth),null!=r.dashArray&&r.dashArray.length>0&&DN(e,t,n,r.dashArray)}function bm(e,t,n,r){void 0!==r.color&&bc(e,n,r.color),void 0!==r.opacity&&DS(e,n,r.opacity),bp(e,t,n,r)}function bp(e,t,n,r){if(void 0!==r.borderStyle||void 0!==r.strokeWidth){let i=_r(e,t,n),o=r.borderStyle??_0(i.styleCode),a=r.strokeWidth??i.width;DI(e,n,_Y(o),a)}null===r.dashArray||r.dashArray?.length===0?DC(e,n):void 0!==r.dashArray&&DN(e,t,n,r.dashArray)}function bh(e,t,n,r){let i=r.interiorColor??null;null===i?Dv(e,n,1):DA(e,n,i,1),bd(e,t,n,r)}function bF(e,t,n,r){void 0!==r.interiorColor&&(null===r.interiorColor?Dv(e,n,1):DA(e,n,r.interiorColor,1)),bm(e,t,n,r)}var bg=t5["free-text"];function b_(e,t,n,r,i){let o=gX(n,{describe:r?.describeFont,programOf:r?.documentProgramOf,bodyProgram:void 0===i?void 0:r?.documentProgramOf?.(i)});if(!e.EPDFAnnot_SetRichTextJSON(t,o))throw new N(G.InvalidArg,"rich text could not be written (empty rect, or a font resource could not be built)")}function bP(e,t,n){if(!e.EPDFAnnot_SetEmbedMetadataNumber(t,"VerticalAlignment",_Z.indexOf(n)))throw new N(G.Unknown,"EPDFAnnot_SetEmbedMetadataNumber returned false")}function bD(e){return"free-text"===e}var bb=e=>(e%360+360)%360;function by(e,t,n,r,i){let o,a=r.flat(),s=null===i||0===a.length?null:{degrees:i,center:{x:((o=e0(a)).left+o.right)/2,y:(o.bottom+o.top)/2}};return D7(e,t,n,s?{rotation:s.degrees,box:e0(a)}:null),{drawn:r.map(e=>e.map(e=>s?e1(e,s):e)),turn:s}}function bw(e,t,n,r,i){let o=by(e,t,n,r,i||null);return Dx(e,t,n,e0(o.drawn.flat())),o}function bE(e,t,n){let r=function(e,t,n){switch(e.FPDFAnnot_GetSubtype(n)){case 4:{let r=_s(e,t,n);return r?[[r.start,r.end]]:[]}case 7:case 8:return[_o(e,t,n)];case 15:return _a(e,t,n).map(e=>[...e]);default:return[]}}(e,t,n),i=_5(e,t,n,r);return{drawn:r,turn:i,upright:r.map(e=>e.map(e=>_4(e,i)))}}function bA(e,t,n,r,i,o){if(void 0===i&&void 0===o)return;let a=r.turn?.degrees??null,s=void 0===o?a:o||null,l=tv(bb(s??0),bb(a??0));if(void 0===i&&l)return;let u=by(e,t,n,i??r.upright,s),d=D0(r.drawn.flat(),u.drawn.flat());return d&&D1(e,t,n,d),u}function bv(e,t,n,r){if(void 0!==r.intent&&(null===r.intent?e.EPDFAnnot_RemoveKey(n,"IT"):gr(e.EPDFAnnot_SetIntent(n,_7[r.intent]))),void 0!==r.measure)if(null===r.measure)gr(e.EPDFAnnot_RemoveMeasure(n));else{let i=e.EPDFAnnot_GetMeasure(n);i&&1!==e.EPDFMeasure_GetSubtype(i)&&gr(e.EPDFAnnot_RemoveMeasure(n)),gs(e,t,e.EPDFAnnot_AddMeasure(n),r.measure)}if("line"===r.subtype){if(void 0!==r.leader&&gr(e.EPDFAnnot_SetLineLeader(n,r.leader?.length??0,r.leader?.extension??0,r.leader?.offset??0)),void 0!==r.captionEnabled){let i=r.captionOffset??null;gr(go(t,i?{x:i.along,y:i.perpendicular}:void 0,t=>e.EPDFAnnot_SetLineCaption(n,r.captionEnabled??!1,+("top"===r.captionPosition),t)))}}else if(void 0!==r.captionEnabled)if(null===r.captionEnabled)e.EPDFAnnot_ClearEmbedMetadataKey(n,"MeasurementCaption"),e.EPDFAnnot_ClearEmbedMetadataKey(n,"MeasurementCaptionCenter");else{let i=r.captionEnabled;gr(go(t,("captionCenter"in r?r.captionCenter:null)??void 0,t=>e.EPDFAnnot_SetShapeCaption(n,i,t)))}}function bS(e,t,n,r,i){let o=i?.docPtr;if(!o)throw new N(G.InvalidArg,"writing a link target requires a document pointer on the write context");let a=Pi(e,t,o,r);if(!e.EPDFAnnot_SetAction(n,a))throw new N(G.Unknown,"EPDFAnnot_SetAction failed for link")}function bk(e,t,n){if(!e.EPDFAnnot_SetBooleanValue(t,"Open",n))throw new N(G.Unknown,"EPDFAnnot_SetBooleanValue returned false")}var bx=e=>[e.upperLeft,e.upperRight,e.lowerLeft,e.lowerRight];function bG(e){return"highlight"===e||"underline"===e||"squiggly"===e||"strikeout"===e}function bO(e,t,n,r){let i=t.alloc(32);try{for(let l of r){var o,a,s;if(o=t,a=i,s=l,o.poke(a,"f32",s.upperLeft.x,0),o.poke(a,"f32",s.upperLeft.y,4),o.poke(a,"f32",s.upperRight.x,8),o.poke(a,"f32",s.upperRight.y,12),o.poke(a,"f32",s.lowerLeft.x,16),o.poke(a,"f32",s.lowerLeft.y,20),o.poke(a,"f32",s.lowerRight.x,24),o.poke(a,"f32",s.lowerRight.y,28),!e.FPDFAnnot_AppendAttachmentPoints(n,i))throw new N(G.Unknown,"FPDFAnnot_AppendAttachmentPoints returned false")}}finally{t.free(i)}}function bI(e,t,n,r){e.EPDFAnnot_RemoveKey(n,"QuadPoints"),bO(e,t,n,r)}function bN(e,t,n,r){let i=1/0,o=1/0,a=-1/0,s=-1/0;for(let e of r)for(let t of[e.upperLeft,e.upperRight,e.lowerLeft,e.lowerRight])t.xa&&(a=t.x),t.ys&&(s=t.y);Dx(e,t,n,{left:i,top:s,right:a,bottom:o})}var bC=t5.redact;function bj(e){return void 0!==e.overlayText&&null!==e.overlayText||void 0!==e.fontFamily||void 0!==e.fontSize||void 0!==e.fontColor}function bM(e){return"redact"===e}function bR(e){return"circle"===e||"square"===e}function bT(e){return"stamp"===e}function bB(e,t,n){if(!e.EPDFAnnot_SetName(t,n))throw new N(G.Unknown,"EPDFAnnot_SetName returned false")}function bL(e){if(0===e.length)throw new N(G.InvalidArg,"stamp name must be non-empty")}function b$(e){if(void 0===Pg[e])throw new N(G.InvalidArg,`unknown stamp fit \'${String(e)}\'; expected contain, cover, or fill`)}function bz(e){let t=e?.resources?.appearance;if(!t)throw new N(G.InvalidArg,"creating a stamp annotation needs its \'appearance\' resource");return t}function bU(e,t){e||bz(t);let n=e instanceof ArrayBuffer?nx(e):null;if(!n)throw new N(G.InvalidArg,"the appearance resource must be PNG, JPEG or one-page PDF bytes");if("application/pdf"===n.mimeType){let n=t?.pdfPageCount?.(e);if(null===n)throw new N(G.MalformedPdf,"the stamp\'s appearance PDF could not be opened");if(void 0!==n&&1!==n)throw new N(G.InvalidArg,`the appearance PDF has ${n} pages; a stamp takes a one-page PDF`)}bV(t)}function bV(e){if(e?.docPtr===void 0||!e.drawings)throw new N(G.Unknown,"stamp writer requires docPtr/drawings on the write context");return{docPtr:e.docPtr,drawings:e.drawings}}function bW(e,t,n,r,i,o,a){be(e,t,n,{box:a.box,rotation:null}),function(e,t,n,r,i,o){let a=nx(r);if(!a)throw new N(G.Unknown,"stamp content preflight invariant broken");let s=Dy(e,t,i.docPtr,i.drawings,r,a);if(!e.EPDFAnnot_SetDrawing(n,s,Pg[o]))throw new N(G.Unknown,"EPDFAnnot_SetDrawing returned false")}(e,t,n,r,i,o),a.rotation&&(be(e,t,n,a),Pb(e,n,o))}var bq=t5.text;function bH(e,t,n){if(!e.EPDFAnnot_SetBooleanValue(t,"Open",n))throw new N(G.Unknown,"EPDFAnnot_SetBooleanValue returned false")}function bK(e,t,n){if(!e.EPDFAnnot_SetName(t,_R[n]))throw new N(G.Unknown,"EPDFAnnot_SetName returned false")}var bZ=(e,t)=>t?e1(e,t):e;function bJ(e,t){return e.captionCenter?{...e,captionCenter:bZ(e.captionCenter,t.turn)}:e}function bQ(e,t,n,r){let i=bE(e,t,n),o=bA(e,t,n,i,r.vertices&&[r.vertices],r.rotation);bv(e,t,n,function(e,t,n,r,i,o){let a=o?o.turn:i.turn;if(r.captionCenter)return{...r,captionCenter:bZ(r.captionCenter,a)};if(!o||void 0!==r.captionEnabled)return r;let s=Pe(e,t,n);return s?.center?{...r,captionEnabled:s.enabled,captionCenter:bZ(_4(s.center,i.turn),a)}:r}(e,t,n,r,i,o)),o&&DR(e,t,n,o.drawn[0])}function bX(e){return"polygon"===e||"polyline"===e}function bY(e){return"widget"===e}function b0(e,t,n,r,i){var o,a;if(null===r.color)e.EPDFAnnot_ClearMKColor(n,0);else if(r.color){let{r:t,g:i,b:o}=e9(r.color);e.EPDFAnnot_SetMKColor(n,0,t,i,o)}if(null===r.interiorColor)e.EPDFAnnot_ClearMKColor(n,1);else if(r.interiorColor){let{r:t,g:i,b:o}=e9(r.interiorColor);e.EPDFAnnot_SetMKColor(n,1,t,i,o)}if(void 0!==r.strokeWidth||void 0!==r.borderStyle){let i=_r(e,t,n);e.EPDFAnnot_SetBorderStyle(n,"underline"===(o=r.borderStyle??_1(i.styleCode))?5:_Y(o),r.strokeWidth??i.width)}null===r.dashArray?DC(e,n):void 0!==r.dashArray&&DN(e,t,n,r.dashArray),(void 0!==r.fontFamily||void 0!==r.fontSize||void 0!==r.fontColor)&&function(e,t,n,r,i){let o=_u(e,t,n);if([r.fontFamily,r.fontSize,r.fontColor].includes(null)&&null!==o)throw new N(G.InvalidArg,"a widget\'s font can\'t be removed: send a font, or leave the font fields out",{details:{field:"fontFamily"}});let a=r.fontFamily??void 0,s=r.fontSize??void 0,l=r.fontColor??void 0;if(void 0===a&&void 0===s&&void 0===l)return;let u=s??o?.fontSize??12,d=l??o?.color??"#000000";null!==o&&(void 0===a||function(e,t,n,r,i){let o=_d(e,t,n);if(!o)return!1;if(_J(e,t,n,o)===r)return!0;let a=eU(r,i?.describeFont);return eV(a.family)===eV(o.family)&&(void 0===a.weight||a.weight===o.weight)&&(void 0===a.italic||a.italic===o.italic)}(e,t,n,a,i))?D$(e,n,-1,u,d):bu(e,n,a??"helvetica",u,d,i)}(e,t,n,r,i),void 0!==r.textAlign&&e.EPDFAnnot_SetTextAlignment(n,_H(r.textAlign));let s=void 0!==r.checkStyle?r.checkStyle&&Du[r.checkStyle]:r.caption;if(null===s?e.EPDFAnnot_SetMKText(n,0,0n):void 0!==s&&h5(t,s,t=>e.EPDFAnnot_SetMKText(n,0,t)),r.layout&&!e.EPDFAnnot_SetMKTextPosition(n,(a=r.layout,Px.indexOf(a))))throw new N(G.Unknown,"the widget\'s layout (/MK /TP) could not be written")}function b1(e,t,n){if(!e.EPDFAnnot_SetMKRotation(t,(360-(n??0))%360))throw new N(G.Unknown,"the widget\'s turn (/MK /R) could not be written")}function b3(e,t,n,r,i){let o=eH(r.box),a=r.rotation?eJ(o,r.rotation):o;i&&r.rotation===i.rotation||b1(e,n,r.rotation),i&&tv(a,i.rect)||Dx(e,t,n,a)}function b2(e,t,n,r){if("free-text"===n.subtype||void 0===n.richText)return;if(null===n.richText)return void e.EPDFAnnot_RemoveKey(t,"RC");let i=gX(function(e){if(e.body?.family!==e6.family)return e;let{family:t,...n}=e.body;return{...e,body:n}}(n.richText),{describe:r?.describeFont});if(!e.EPDFAnnot_SetRichTextJSON(t,i))throw new N(G.InvalidArg,`${n.subtype}: the comment\'s rich text could not be written`)}function b6(e){if(void 0===e.subtype)throw new N(G.InvalidArg,"a patch reached the writer without its subtype");return e.subtype}function b5(e,t,n,r){let{fn:i,mem:o}=e,a=o.writeU16String(r);try{return i.EPDFPage_GetAnnotIndexByNameRaw(t,n,a)}finally{o.free(a)}}function b4(e,t){return new N(G.InvalidArg,`nm \'${e}\' is already used on page ${t}`,{details:{field:"nm"}})}function b8(e,t,n,r,i,o){let a=Dm(e,t,o.docPtr,n,r,i),s=e.FPDFAnnot_GetSubtype(n),{reader:l}=PN(s);return l(e,t,n,a,s,o)}function b7(e,t,n){return void 0===n?e.EPDFAnnot_GenerateAppearance(t):e.EPDFAnnot_GenerateAppearanceWithBlend(t,function(e){switch(e){case"normal":return 0;case"multiply":return 1;case"screen":return 2;case"overlay":return 3;case"darken":return 4;case"lighten":return 5;case"color-dodge":return 6;case"color-burn":return 7;case"hard-light":return 8;case"soft-light":return 9;case"difference":return 10;case"exclusion":return 11;case"hue":return 12;case"saturation":return 13;case"color":return 14;case"luminosity":return 15}}(n))}function b9(e,t,n,r){let{fn:i}=e;if(!i.EPDFAnnot_SetLinkedAnnot(t,"IRT",n))throw new N(G.Unknown,"failed to set /IRT linked annotation");i.EPDFAnnot_SetReplyType(t,Po(r))}function ye(e,t,n){let{fn:r}=e;if(function(e,t,n){let{fn:r}=e,i=r.FPDFAnnot_GetLinkedAnnot(n,"Popup");if(!i)return;let o=r.EPDFAnnot_GetObjectNumber(i);if(r.FPDFPage_CloseAnnot(i),o!==r.EPDFAnnot_GetObjectNumber(t))throw new N(G.InvalidArg,`the annotation already has a popup (object ${o}); delete it first`,{details:{field:"parent",popupObjectNumber:o}})}(e,t,n),!r.EPDFAnnot_SetLinkedAnnot(t,"Parent",n)||!r.EPDFAnnot_SetLinkedAnnot(n,"Popup",t))throw new N(G.Unknown,"failed to link a popup to its parent");!function(e,t,n){let{fn:r,mem:i}=e;if(1!==r.FPDFAnnot_GetSubtype(n))return;let o=_t(r,i,t,"Open");if(null!==o)return yt(e,n,o);let a=_t(r,i,n,"Open");null!==a&&yt(e,t,a)}(e,t,n)}function yt(e,t,n){if(!e.fn.EPDFAnnot_SetBooleanValue(t,"Open",n))throw new N(G.Unknown,"EPDFAnnot_SetBooleanValue returned false")}function yn(e,t){let{mem:n}=e,r=t(0n,0);return r<=0?[]:hY(n,8*r,e=>(t(e,r),Array.from({length:r},(t,r)=>({start:Number(n.peek(e,"i32",8*r))>>>0,count:Number(n.peek(e,"i32",8*r+4))>>>0}))))}var yr={0:null,1:"truetype",2:"opentype",3:"cff",4:"type1",5:"type3"},yi={0:"none",1:"whole",2:"subset"},yo={0:"installable",1:"editable",2:"preview-and-print",3:"restricted",4:"bitmap-only"},ya={0:"standard",1:"engine",2:"document-program",3:"document-font"},ys=e=>Array.from(e,e=>e.toString(16).padStart(2,"0")).join(""),yl=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}facts(){return{faces:this.faces(),engineFonts:this.fonts.engineFontFacts(),fallbacks:this.fonts.fallbackKeys()}}faces(){return yu(this.runtime,this.session)}resolve(e,t,n){let{fn:r,mem:i}=this.runtime,o=t.map(e=>this.faceOfRun(e,n)),a=t.map(e=>i.writeU16String(e.text)),s=o.map(e=>i.writeU16String(e.family)),l=e?this.openAnnotation(e):0n;try{let e=gc(this.runtime,a,e=>gc(this.runtime,s,n=>h1(i,o.map(e=>e.weight),a=>h1(i,o.map(e=>+!!e.italic),s=>h1(i,o.map(e=>e.program),i=>r.EPDFDoc_ResolveFonts(this.session.requireDocPtr(),l,t.length,e,n,a,s,i))))));if(!e)throw new N(G.Unknown,"EPDFDoc_ResolveFonts failed");try{return this.readResolution(e,t.length)}finally{r.EPDFFontResolution_Close(e)}}finally{for(let e of(l&&r.FPDFPage_CloseAnnot(l),[...a,...s]))i.free(e)}}readResolution(e,t){let{fn:n,mem:r}=this.runtime,i=[];for(let o=0;o(n.EPDFFontResolution_GetFallbacks(e,o,t,a),Array.from({length:a},(e,n)=>Number(r.peek(t,"i32",4*n))>>>0)));i.push({source:ya[n.EPDFFontResolution_GetSource(e,o)]??"standard",engineFont:t?this.fonts.keyForId(t)??null:null,objectNumber:n.EPDFFontResolution_GetProgramObjNum(e,o),displaySha256:hY(r,32,t=>n.EPDFFontResolution_GetProgramDisplayHash(e,o,t)?ys(r.readBytes(t,32)):null),baseFontName:h2(r,(t,r)=>n.EPDFFontResolution_GetBaseFontName(e,o,t,r))||null,familyName:h3(r,(t,r)=>n.EPDFFontResolution_GetFamily(e,o,t,r))??"",weight:n.EPDFFontResolution_GetWeight(e,o),italic:n.EPDFFontResolution_IsItalic(e,o),degraded:n.EPDFFontResolution_IsDegraded(e,o),fallbacks:s.flatMap(e=>{let t=this.fonts.keyForId(e);return t?[t]:[]})})}let o=[],a=n.EPDFFontResolution_CountMissingCharacters(e);for(let t=0;tn.EPDFFontResolution_GetMissingCharacter(e,t,r,i));i&&o.push(i)}return{runs:i,missingCharacters:o}}faceOfRun(e,t){if(!("fontFamily"in e))return{family:e.family,weight:e.weight,italic:e.italic,program:0};let n=e.fontFamily;if(Z.includes(n)){let e=ez[n];return{family:e.family,weight:e.weight,italic:e.italic,program:0}}let r=this.fonts.describeOrUndefined(n);if(r){let{familyName:e,weight:t,italic:n}=r;return{family:e,weight:t,italic:n,program:0}}let i=av(t.faces).find(e=>e.name===n);if(i){let{familyName:e,weight:r,italic:o}=i.face,a=aG(t,n);return{family:e,weight:r,italic:o,program:a?.choosable?a.objectNumber:0}}let o=eU(n);return{family:o.family,weight:o.weight??400,italic:o.italic??!1,program:0}}openAnnotation(e){let{pageIndex:t,index:n}=gC(this.runtime,this.session,e),r=this.runtime.fn.EPDFPage_GetAnnotRaw(this.session.requireDocPtr(),t,n);if(!r)throw new N(G.NotFound,"annotation not found");return r}program(e,t){let n=this.fonts.programFor(e);if(n)return{...n.info(),bytes:t?n.bytes():null};let r=this.faces().flatMap(e=>e.programs).find(t=>t.displaySha256===e&&t.objectNumber>0);if(!r)throw new N(G.NotFound,`no font program ${e}`);let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr();return hY(o,32,n=>{var s;o.writeBytes(n,(s=e,Uint8Array.from({length:s.length/2},(e,t)=>parseInt(s.slice(2*t,2*t+2),16))));let l=yn(this.runtime,(e,t)=>i.EPDFDoc_GetFontDisplayProgramCoverage(a,n,e,t)),u=null;if(t){let e=i.EPDFDoc_GetFontDisplayProgramData(a,n,0n,0);u=hY(o,Math.max(1,e),t=>(i.EPDFDoc_GetFontDisplayProgramData(a,n,t,e),o.readBytes(t,e)))}return{covers:l,ascent:r.ascent,descent:r.descent,bytes:u}})}};function yu(e,t){let{fn:n,mem:r}=e,i=n.EPDFFontFaces_Load(t.requireDocPtr());if(!i)throw new N(G.Unknown,"EPDFFontFaces_Load failed");try{let t=[],o=n.EPDFFontFaces_Count(i);for(let a=0;ahY(o,32,t=>e(t)?ys(o.readBytes(t,32)):null),s=a(e=>i.EPDFFontFaces_GetProgramHash(t,n,r,e)),l=a(e=>i.EPDFFontFaces_GetProgramDisplayHash(t,n,r,e)),u=h0(o,[4,4],([e,a])=>i.EPDFFontFaces_GetProgramMetrics(t,n,r,e,a)?{ascent:Number(o.peek(e,"f32")),descent:Number(o.peek(a,"f32"))}:{ascent:0,descent:0});return{objectNumber:i.EPDFFontFaces_GetProgramObjNum(t,n,r),format:yr[i.EPDFFontFaces_GetProgramFormat(t,n,r)]??null,embedded:yi[i.EPDFFontFaces_GetProgramEmbedded(t,n,r)]??"none",postScriptName:h2(o,(e,o)=>i.EPDFFontFaces_GetProgramPostScriptName(t,n,r,e,o))||null,permission:yo[i.EPDFFontFaces_GetProgramEmbeddingPermission(t,n,r)]??null,mapsUnicode:i.EPDFFontFaces_ProgramMapsUnicode(t,n,r),sha256:s,displaySha256:l,ascent:Math.round(1e3*u.ascent),descent:-Math.round(1e3*u.descent)}}(e,i,a,t));t.push({familyName:h3(r,(e,t)=>n.EPDFFontFaces_GetFamily(i,a,e,t))??"",weight:n.EPDFFontFaces_GetWeight(i,a),italic:n.EPDFFontFaces_IsItalic(i,a),programs:o})}return t}finally{n.EPDFFontFaces_Close(i)}}var yd=new WeakMap;function yc(e,t){let{fn:n,mem:r}=e;return hY(r,32,e=>{if(!n.EPDFDoc_GetFontsFingerprint(t.requireDocPtr(),e))throw new N(G.Unknown,"EPDFDoc_GetFontsFingerprint failed");return ys(r.readBytes(e,32))})}function yf(e,t){var n;let r;return JSON.stringify((n={faces:yu(e,t),engineFonts:[],fallbacks:[]},r=av(n.faces).filter(e=>!aS(e)&&!e.programs.some(e=>e.sha256===hz.lastResortDisplayHash)).map(ak),{fonts:[...Z.map(e=>{let t;return t=ez[e],{name:e,source:"standard",builtIn:!0,familyName:t.family,weight:t.weight,italic:t.italic,postScriptName:null,canChoose:!0,restrictions:[],programs:[{displaySha256:hz.standardDisplayHash(e),sourceSha256:null,embedded:"none",format:null,embeddingPermission:null,canDownload:!0}]}}),...n.engineFonts.map(ax),...r],fallbacks:[...n.fallbacks],lastResort:{displaySha256:hz.lastResortDisplayHash,sourceSha256:null,embedded:"none",format:"truetype",embeddingPermission:"installable",canDownload:!0}}).fonts.filter(e=>"document"===e.source))}function ym(e,t){yd.has(t)||yd.set(t,{fingerprint:yc(e,t),documentFonts:yf(e,t)})}function yp(e,t,n){let r,i=n=>(r??(r=av(yu(e,t)))).find(e=>e.name===n);return{...n?{resolveRegisteredFontId:e=>n.idFor(e),describeRegisteredFont:e=>n.describeOrUndefined(e)}:{},describeFont:e=>{let t=n?.describeOrUndefined(e);if(t)return t;let r=i(e)?.face;return r&&{familyName:r.familyName,weight:r.weight,italic:r.italic}},documentProgramOf:e=>{if(Z.includes(e)||n?.describeOrUndefined(e))return;let t=i(e)?.programs[0];return t&&aP(t)&&t.objectNumber>0?t.objectNumber:void 0},resolveDocumentFont:n=>aG({faces:yu(e,t),engineFonts:[],fallbacks:[]},n)}}var yh=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}create(e,t){hW(t);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=new Set,a=e.map(t=>{let n=this.session.resolvePageRef(t.page),r=this.writeContext(t.resources),i=yg(t.label,()=>{var e,n;let i;return e=t.draft,n=t.resources,nO((i=function(e,t={}){let n=(ni(e.subtype,e),function(e){if(to[e.subtype]?.box!=="box"||void 0!==e.box)return e;if(void 0===e.rect)throw new N(G.InvalidArg,`${e.subtype} create: give its \\`box\\`, or its \\`rect\\` with a quarter turn`,{details:{field:"box"}});if(!eq(e.rect))throw new N(G.InvalidArg,`${e.subtype} create field \'rect\': not a rect of finite numbers`,{details:{field:"rect"}});let t=e.rotation??0,n=eQ(t);if(null===n)throw new N(G.InvalidArg,`${e.subtype} create field \'rect\': a rect places a box at a quarter turn; at ${t}\\xb0 give its \\`box\\``,{details:{field:"rect"}});let{rect:r,...i}=e;return{...i,box:eX(eH(e.rect),n)}}(e));return!function(e,t={}){var n;let r,i=pX(String(e.subtype)),o=t.linked??[],a=(i&&o.length>0?(n=i.fileSchemas.create,r=o.filter(e=>e in n.shape),n.omit(Object.fromEntries(r.map(e=>[e,!0])))):hp).safeParse(e);if(!a.success)throw hC(a.error,`${String(e.subtype)} create`)}(n,{linked:t.linked??[]}),function(e,t={}){var n;return tJ(e),function(e){let t;if("line"!==(t=e.subtype)&&"polygon"!==t&&"polyline"!==t)return e;if(tZ(e.subtype,e),null!=e.measure&&"rectilinear"!==e.measure.subtype)throw new N(G.InvalidArg,`A ${"geospatial"===e.measure.subtype?"geospatial":"foreign"} measure can\'t be written; leave measure out`);let n=e;tK(e)&&("line"===e.subtype?n={...e,captionEnabled:e.captionEnabled??!1,captionPosition:e.captionPosition??"inline",captionOffset:e.captionOffset??null}:("polygon"===e.subtype||"polyline"===e.subtype)&&(n={...e,captionEnabled:e.captionEnabled??(null==e.captionCenter&&null),captionCenter:e.captionCenter??null}));var r=n;let i=tU(r);return"unavailable"in i||r.contents===i.label?r:{...r,contents:i.label}}(function(e){if("redact"!==e.subtype||null!=e.rect)return e;let t=e.quadPoints??[];if(0===t.length)return e;let n=e0(t.flatMap(e=>[e.upperLeft,e.upperRight,e.lowerLeft,e.lowerRight]));return{...e,rect:n}}(function(e){if(!tQ(e.subtype))return e;let{richText:t}=e;return t?{...e,contents:e5(t)}:e}(function(e,t){if("free-text"!==e.subtype)return e;let n=e.intent??(null!=e.calloutLine?"free-text-callout":"free-text");nt(n,e.calloutLine);let r={body:ne(e.richText?.body??{},e,t),paragraphs:e.richText?.paragraphs??e4(e.contents??"")};return{...e,intent:n,richText:r,contents:e5(r)}}(t9((n=function(e){if("text"!==e.subtype||null==e.state||null!=e.stateModel)return e;let t=tN(e.state);if(!t)throw nr(e.state);return{...e,stateModel:t}}(e)).subtype)&&t7(n.borderStyle??t4(n.subtype).borderStyle,n.dashArray)?{...n,dashArray:[...t8]}:n,t.describeFont))))}(n,t)}(e,{linked:["reply","parent"],describeFont:r.describeFont})).subtype,n,"create"),bT(i.subtype)&&(null!=i.name&&bL(i.name),null!=i.fit&&b$(i.fit),bU(r?.resources?.appearance,r)),bi(i.subtype)&&function(e,t){if(bs(t),bl(t),!e.file?.name)throw new N(G.InvalidArg,"a file attachment needs the file\'s name: give file.name, or the bytes as a File",{details:{field:"file.name"}})}(i,r),bM(i.subtype)&&function(e){if(void 0===e.rect&&0===(e.quadPoints??[]).length)throw new N(G.InvalidArg,"redact create needs a rect or at least one of quadPoints",{details:{field:"rect"}})}(i),i});yg(t.label,()=>this.claimName(i.nm,n,o));let a=void 0!==i.nm||"stamp"!==t.attribution.kind?i:{...i,nm:iY()};void 0!==t.objectNumber&&yg(t.label,()=>this.session.claimObjectNumber(t.objectNumber));let s=t.replyTo&&{type:t.replyTo.type,to:yg(t.label,()=>this.linkTarget(t.replyTo.to,t.page,e.length,"reply"))};if("popup"===a.subtype&&!t.parent)throw new N(G.InvalidArg,`${t.label??"create"}: a popup needs the annotation it shows (parent)`,{details:{field:"parent"}});return{create:t,record:n,ctx:r,draft:a,replyTo:s,parent:t.parent&&yg(t.label,()=>this.linkTarget(t.parent,t.page,e.length,"popup"))}});if(hW(t),0===a.length)return{created:[],meta:yF(this.session.writeStamp(),[],[])};let s=a.map(({create:e,record:o,ctx:a,draft:s})=>{let l;hW(t);let u=n.EPDFPage_CreateAnnotRaw(i,o.pageIndex,rI[s.subtype],e.objectNumber??0);if(!u&&void 0!==e.objectNumber)throw Ff(e.objectNumber,"taken");if(!u)throw new N(G.Unknown,`${e.label??"create"}: EPDFPage_CreateAnnotRaw returned NULL`);try{if(yg(e.label,()=>{(function(e,t,n,r,i){if(bG(r.subtype)){let i,o;return DZ(e,t,n,r),i=r.quadPoints,bO(e,t,n,i),bN(e,t,n,i),o=t5[r.subtype],DA(e,n,r.color??o.color),DS(e,n,r.opacity??o.opacity),"strikeout"===r.subtype&&null!=r.intent&&DU(e,n,_x(r.intent))}if(bR(r.subtype))return DZ(e,t,n,r),be(e,t,n,{box:r.box,rotation:r.rotation??null}),bh(e,t,n,r),null!=r.cloudyIntensity&&r.cloudyIntensity>0&&Dj(e,n,r.cloudyIntensity);if(bX(r.subtype)){if("polygon"===r.subtype){let i;DZ(e,t,n,r),i=bw(e,t,n,[r.vertices],r.rotation),bv(e,t,n,bJ(r,i)),bh(e,t,n,r),DR(e,t,n,i.drawn[0]),null!=r.cloudyIntensity&&r.cloudyIntensity>0&&Dj(e,n,r.cloudyIntensity)}else{let i;DZ(e,t,n,r),i=bw(e,t,n,[r.vertices],r.rotation),bv(e,t,n,bJ(r,i)),bh(e,t,n,r),DR(e,t,n,i.drawn[0]),DL(e,n,r.lineEndings??t5.polyline.lineEndings)}return}if("line"===r.subtype)return function(e,t,n,r){DZ(e,t,n,r),bv(e,t,n,r),bh(e,t,n,r);let{start:i,end:o}=r.linePoints,[a]=bw(e,t,n,[[i,o]],r.rotation).drawn;DT(e,t,n,{start:a[0],end:a[1]}),DL(e,n,r.lineEndings??t5.line.lineEndings)}(e,t,n,r);if("link"===r.subtype){var o,a,s,l,u,d,c,f,m=e,p=t,h=n,F=r,g=i;if(DZ(m,p,h,F),Dx(m,p,h,F.rect),!m.FPDFAnnot_SetBorder(h,0,0,0))throw new N(G.Unknown,"FPDFAnnot_SetBorder returned false");F.target&&bS(m,p,h,F.target,g);return}if("ink"===r.subtype)return DZ(e,t,n,r),null!=r.intent&&DU(e,n,_8(r.intent)),bd(e,t,n,r),DB(e,t,n,bw(e,t,n,r.inkList,r.rotation).drawn);if(bD(r.subtype)){let o,a;return s=e,l=t,u=n,d=r,c=i,DZ(s,l,u,d),be(s,l,u,{box:d.box,rotation:d.rotation??null}),o=d.interiorColor??null,null===o?Dv(s,u,0):DA(s,u,o,0),DS(s,u,d.opacity??bg.opacity),bf(s,l,u,d),null!=d.cloudyIntensity&&Dj(s,u,d.cloudyIntensity),bu(s,u,d.fontFamily??bg.fontFamily,d.fontSize??bg.fontSize,d.color??bg.color,c),a=d.richText,Dz(s,u,_H(a.body?.align??bg.textAlign)),DU(s,u,_$[d.intent??bg.intent]),void 0!==d.verticalAlign&&d.verticalAlign!==bg.verticalAlign&&bP(s,u,d.verticalAlign),null!=d.calloutLine&&DH(s,l,u,d.calloutLine),null!=d.lineEnding&&DL(s,u,{start:"none",end:d.lineEnding}),b_(s,u,a,c,d.fontFamily??bg.fontFamily)}if("caret"===r.subtype)return DZ(e,t,n,r),be(e,t,n,{box:r.box,rotation:r.rotation??null}),DA(e,n,r.color??bn.color),DS(e,n,r.opacity??bn.opacity),null!=r.intent&&DU(e,n,_k(r.intent));if("text"===r.subtype)return DZ(e,t,n,r),Dx(e,t,n,r.rect),DA(e,n,r.color??bq.color),DS(e,n,r.opacity??bq.opacity),bK(e,n,r.icon??bq.icon),void 0!==r.open&&bH(e,n,r.open),null!=r.stateModel&&DG(e,t,n,"StateModel",Py[o=r.stateModel]??o),null!=r.state&&DG(e,t,n,"State",Pw[a=r.state]??a);if(bT(r.subtype)){let o;return DZ(e,t,n,r),null!=r.name&&bB(e,n,r.name),void 0!==r.opacity&&DS(e,n,r.opacity),o=null===r.fit?"fill":r.fit??t5.stamp.fit,bW(e,t,n,bz(i),bV(i),o,{box:r.box,rotation:r.rotation??null}),null!==r.fit&&PD(e,t,n,o)}if(bi(r.subtype)){let o;return DZ(e,t,n,r),Dx(e,t,n,r.rect),DA(e,n,r.color??br.color),DS(e,n,r.opacity??br.opacity),bo(e,n,r.icon??br.icon),o=r.file,_O(e,t,ba(e,t,n,o.name),bl(i),(f=o,{...null!=f.mimeType?{mimeType:f.mimeType}:{},...null!=f.description?{description:f.description}:{}}),{bytes:bs(i)})}if(bY(r.subtype))return function(e,t,n,r,i){let{actions:o,...a}=r;DZ(e,t,n,a),b3(e,t,n,{box:r.box,rotation:r.rotation??null},null),b0(e,t,n,r,i)}(e,t,n,r,i);if("popup"===r.subtype)return DZ(e,t,n,r),Dx(e,t,n,r.rect),void 0!==r.open&&bk(e,n,r.open);if(bM(r.subtype)){let o,a;return DZ(e,t,n,r),(o=r.quadPoints??[]).length>0&&bO(e,t,n,o),r.rect?Dx(e,t,n,r.rect):bN(e,t,n,o),DA(e,n,r.color??bC.color,0),DS(e,n,r.opacity??bC.opacity),a=r.interiorColor??null,null!==a&&DA(e,n,a,1),null!=r.overlayText&&r.overlayText.length>0&&DW(e,t,n,r.overlayText),r.repeat&&Dq(e,n,!0),bj(r)&&bu(e,n,r.fontFamily??bC.fontFamily,r.fontSize??bC.fontSize,r.fontColor??bC.fontColor,i),void 0!==r.textAlign&&Dz(e,n,_H(r.textAlign))}throw new N(G.NotImplemented,`no writer registered for draft.subtype=\'${r.subtype}\'`)})(n,r,u,s,a),b2(n,u,s,a)}),b7(n,u,s.blendMode),(l=n.EPDFAnnot_GetObjectNumber(u))<=0)throw new N(G.Unknown,`${e.label??"create"}: EPDFPage_CreateAnnotRaw made a direct object`)}finally{n.FPDFPage_CloseAnnot(u)}return{pageIndex:o.pageIndex,pageObjectNumber:o.pageObjectNumber,index:n.EPDFPage_GetAnnotCountRaw(i,o.pageIndex)-1,objectNumber:l}}),l=[],u=(e,t)=>"number"==typeof e?this.withOpen(s[e],t):this.withOpenExisting(e,t);a.forEach(({replyTo:e,parent:t},o)=>{e&&this.withOpen(s[o],t=>u(e.to,n=>b9(this.runtime,t,n,e.type))),void 0!==t&&this.withOpen(s[o],e=>u(t,o=>{ye(this.runtime,e,o),"number"!=typeof t&&l.push(gI(n,r,i,t.page,o,t.index))}))});let d=new Date;a.forEach(({create:{attribution:e,fileDates:t,label:i}},o)=>{this.withOpen(s[o],o=>yg(i,()=>{if("stamp"===e.kind){var i;i=e.actor,i?.displayName&&DQ(n,r,o,i.displayName),DX(n,r,o,d),DY(n,r,o,d),i&&(i.userId||i.groupId)&&(n.EPDFAnnot_SetEmbedMetadataNumber(o,Pd,1),i.userId&&(Ph(n,r,o,Pc,i.userId),Ph(n,r,o,Pm,i.userId),Ph(n,r,o,Pp,i.userId)),i.groupId&&Ph(n,r,o,Pf,i.groupId))}else!function(e,t,n,r,i){null===r.author?e.EPDFAnnot_RemoveKey(n,"T"):DQ(e,t,n,r.author),null===r.createdAt?e.EPDFAnnot_RemoveKey(n,"CreationDate"):DX(e,t,n,r.createdAt),null===r.modifiedAt?e.EPDFAnnot_RemoveKey(n,"M"):DY(e,t,n,r.modifiedAt);let o=[[Pc,r.userId],[Pm,r.createdBy],[Pp,r.modifiedBy],[Pf,r.groupId],["ImportedBy",i]];if(!o.every(([,e])=>!e))for(let[r,i]of(e.EPDFAnnot_SetEmbedMetadataNumber(n,Pd,1),o))i&&Ph(e,t,n,r,i)}(n,r,o,e.from,e.importedBy);t&&function(e,t,n,r){let i=e.EPDFAnnot_GetFileAttachmentForWrite(n);if(i)for(let[n,o]of[["CreationDate",r.createdAt],["ModDate",r.modifiedAt]]){if(!o)continue;let r=t.writeU16String(hH(o));try{e.FPDFAttachment_SetStringValue(i,n,r)}finally{t.free(r)}}}(n,r,o,t)}))});let c=gJ(this.session,this.fonts),f=s.map(e=>this.withOpen(e,t=>b8(n,r,t,e.pageObjectNumber,e.index,c)));return Dd(this.runtime,this.session,f),{created:f,meta:yF(this.session.writeStamp(),s,l)}}claimName(e,t,n){if(!e)return;let r=`${t.pageIndex}\\0${e}`,i=this.session.requireDocPtr();if(n.has(r)||b5(this.runtime,i,t.pageIndex,e)>=0)throw b4(e,t.pageObjectNumber);n.add(r)}linkTarget(e,t,n,r){if("planned"in e){if(e.planned<0||e.planned>=n)throw new N(G.InvalidArg,`no create ${e.planned} to link to`);return e.planned}let{existing:i}=e;if(i.page.objectNumber!==t.objectNumber)throw new N(G.InvalidArg,"reply"===r?`/IRT parent must be on the same page as the reply (parent page ${i.page.objectNumber}, reply page ${t.objectNumber})`:`a popup\'s parent must be on the same page (parent page ${i.page.objectNumber}, popup page ${t.objectNumber})`);return{page:i.page,...gC(this.runtime,this.session,i)}}writeContext(e){return{...yp(this.runtime,this.session,this.fonts),docPtr:this.session.requireDocPtr(),drawings:this.session.drawingIndex(),pdfPageCount:e=>DE(this.runtime.fn,this.runtime.mem,e),...e?{resources:e}:{}}}withOpen(e,t){let{fn:n}=this.runtime,r=n.EPDFPage_GetAnnotRaw(this.session.requireDocPtr(),e.pageIndex,e.index);if(!r)throw new N(G.Unknown,"a created annotation is not where it was");try{if(n.EPDFAnnot_GetObjectNumber(r)!==e.objectNumber)throw new N(G.Unknown,"a created annotation is not where it was");return t(r)}finally{n.FPDFPage_CloseAnnot(r)}}withOpenExisting(e,t){let{fn:n}=this.runtime,r=n.EPDFPage_GetAnnotRaw(this.session.requireDocPtr(),e.pageIndex,e.index);if(!r)throw new N(G.Unknown,"an annotation to link to is not where it was");try{return t(r)}finally{n.FPDFPage_CloseAnnot(r)}}};function yF(e,t,n){return{affectedPages:[...new Set(t.map(e=>e.pageObjectNumber))].map(e=>q(e)),cacheDelta:null,...e,changedRefs:[...t.map(e=>({kind:"objectNumber",page:q(e.pageObjectNumber),objectNumber:e.objectNumber})),...n]}}function yg(e,t){try{return t()}catch(t){if(!e||!N.is(t))throw t;throw new N(t.code,`${e}: ${t.message}`,{...t.details?{details:t.details}:{},cause:t})}}var y_=class{constructor(e,t){this.runtime=e,this.ids=t,hJ(this,"fileHandles",[]),hJ(this,"identities",new Map),hJ(this,"programs",new Map),hJ(this,"fallbacks",[]),hJ(this,"builtIn",new Set),this.registerLastResort()}registerLastResort(){let e=function(e){let t=e.endsWith("==")?2:+!!e.endsWith("="),n=new Uint8Array(e.length/4*3-t),r=0;for(let t=0;t>16),r>8&255),r{try{return e()}catch{return t}};return{familyName:i(()=>h2(r,(t,r)=>n.EPDFFont_GetFamilyName(e,t,r))??t.familyName,t.familyName),weight:i(()=>n.EPDFFont_GetWeight(e),t.weight||400),italic:i(()=>n.EPDFFont_IsItalic(e),1===t.italic),embeddingPermission:i(()=>(function(e){switch(e){case 1:return"editable";case 2:return"preview-and-print";default:return"installable"}})(n.EPDFFont_GetEmbeddingPermission(e)),"installable"),editingAuthorized:i(()=>n.EPDFFont_IsEditingAuthorized(e),!0),instanced:i(()=>n.EPDFFont_IsInstanced(e),!1)}}registerStartup(e){for(let t of e){let e=void 0===t.italic?-1:+!!t.italic;this.registerFromNodeFile(t.key,t.familyName??"",t.weight??0,e,t.path,t.serve??!1,t.builtIn??!1),t.fallback&&this.addFallback(t.key,t.tier)}}addFallback(e,t=0){let n=this.requireId(e);if(!this.runtime.fn.EPDFFont_AddFallbackFont(n,t))throw new N(G.InvalidArg,`addFallback failed: ${e}`);let r=this.fallbacks.find(t=>t.key===e);r?r.tier=t:this.fallbacks.push({key:e,tier:t})}clearFallbacks(){this.runtime.fn.EPDFFont_ClearFallbackFonts(),this.fallbacks=[]}fallbackKeys(){return[...this.fallbacks].sort((e,t)=>e.tier-t.tier).map(e=>e.key)}engineFontFacts(){let e=[];for(let[t,n]of this.identities){let r=this.programs.get(t);r&&e.push({key:t,identity:n,postScriptName:r.postScriptName,format:r.format,sha256:r.sha256,served:r.served,builtIn:this.builtIn.has(t)})}return e}keyForId(e){for(let[t,n]of this.ids)if(n===e)return t}programFor(e){let t=[...this.programs].find(([,t])=>t.sha256===e)?.[0];if(void 0===t)return;let n=this.requireId(t),{fn:r,mem:i}=this.runtime;return{info:()=>{let e=yn(this.runtime,(e,t)=>r.EPDFFont_GetCoverage(n,e,t)),t=h0(i,[4,4],([e,t])=>r.EPDFFont_GetMetrics(n,e,t)?{ascent:Number(i.peek(e,"f32")),descent:Number(i.peek(t,"f32"))}:{ascent:0,descent:0});return{covers:e,ascent:Math.round(1e3*t.ascent),descent:-Math.round(1e3*t.descent)}},bytes:()=>{let e=r.EPDFFont_GetProgramData(n,0n,0);return hY(i,Math.max(1,e),t=>(r.EPDFFont_GetProgramData(n,t,e),i.readBytes(t,e)))}}}readProgram(e){let{fn:t,mem:n}=this.runtime;return{sha256:hY(n,32,r=>t.EPDFFont_GetProgramHash(e,r)?Array.from(n.readBytes(r,32),e=>e.toString(16).padStart(2,"0")).join(""):""),format:2===t.EPDFFont_GetProgramFormat(e)?"opentype":"truetype",postScriptName:h2(n,(n,r)=>t.EPDFFont_GetPostScriptName(e,n,r))||null}}clear(){for(let e of(this.runtime.fn.EPDFFont_ClearRegisteredFonts(),this.registerLastResort(),this.ids.clear(),this.identities.clear(),this.programs.clear(),this.fallbacks=[],this.builtIn.clear(),this.fileHandles))e.close();this.fileHandles.length=0}idFor(e){return this.requireId(e)}requireId(e){let t=this.ids.get(e);if(void 0===t)throw new N(G.InvalidArg,`font not registered on this thread: ${e}`);return t}};function yP(e,t,n){return{affectedPages:[q(t)],cacheDelta:null,...e,changedRefs:[...n]}}var yD=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}writeContext(e){return{...yp(this.runtime,this.session,this.fonts),runtime:this.runtime,docPtr:this.session.requireDocPtr(),drawings:this.session.drawingIndex(),pdfPageCount:e=>DE(this.runtime.fn,this.runtime.mem,e),...e?{resources:e}:{}}}create(e,t,n,r={}){let{actor:i,resources:o,objectNumber:a}=r,{reply:s,...l}=t,u="popup"===t.subtype?t.parent:null;"popup"===t.subtype&&delete l.parent;let{created:d,meta:c}=new yh(this.runtime,this.session,this.fonts).create([{page:q(e),draft:l,...s?{replyTo:{to:{existing:s.to},type:s.type??"reply"}}:{},...u?{parent:{existing:u}}:{},...o?{resources:o}:{},...void 0!==a?{objectNumber:a}:{},attribution:{kind:"stamp",...i?{actor:i}:{}}}],n);return{annotation:d[0],meta:c}}update(e,t,n,r,i){hW(r);let{fn:o,mem:a}=this.runtime,{pageIndex:s,index:l}=gC(this.runtime,this.session,e),u=gM(this.runtime,this.session,s,l);try{let b,y,w;hW(r);let E=this.writeContext(i),A=Df(o.EPDFAnnot_GetBlendMode(u)),v=b8(o,a,u,e.page.objectNumber,l,gJ(this.session,this.fonts));Dd(this.runtime,this.session,[v]);let S=o6(n,v,t.groupId);var d,c,f,m,p,h,F,g,_,P=u,D=t;if(("polygon"===v.subtype||"polyline"===v.subtype)&&tK(D)&&o.FPDFAnnot_HasKey(P,"EMBD_Metadata")&&6!==o.FPDFAnnot_GetValueType(P,"EMBD_Metadata"))throw new N(G.InvalidArg,"Malformed annotation metadata cannot store a caption");t=function(e,t,n={}){var r,i;let o,a=(r=function(e,t){let{rect:n,...r}=t;if(void 0===n||!tC.has(e.subtype))return t;if(!eq(n))throw new N(G.InvalidArg,`${e.subtype} update field \'rect\': not a rect of finite numbers`,{details:{field:"rect"}});if(tv(eH(n),e.rect))return r;let i=tM(e.subtype).find(n=>{let r=t[n];return void 0!==r&&!tv(r,e[n])});if(i)throw new N(G.InvalidArg,`${e.subtype} update field \'rect\': a new rect moves the shape, so it can\'t come with a new \'${i}\'`,{details:{field:"rect"}});let{left:o,bottom:a,right:s,top:l}=n;return{...r,...function(e,t){let n=e.subtype;if(!tC.has(n))return{rect:t};let r=eH(t),i=eH(e.rect),o=r.right-r.left,a=r.top-r.bottom,s=i.right-i.left,l=i.top-i.bottom,u=tv(o,s),d=tv(a,l);if(!u&&o<=0||!d&&a<=0)throw tR(n,"a rect needs a width and a height");let c=e.rotation??0,f=to[n],m="box"===f.box?eQ(c):null;if(!tv((c%360+360)%360,0)&&null===m&&(!u||!d))throw tR(n,"a turned drawing\'s rect can only move; resize its shape instead");if(!u&&s<=0||!d&&l<=0)throw tR(n,"its rect has no width or height to stretch; it can only move");let p=u?1:o/s,h=d?1:a/l,F=e=>({x:r.left+(e.x-i.left)*p,y:r.bottom+(e.y-i.bottom)*h}),g=e=>{let t=F({x:e.left,y:e.bottom}),n=F({x:e.right,y:e.top});return eH({left:t.x,bottom:t.y,right:n.x,top:n.y})},_={box:e=>null===m||0===m||180===m?g(e):eX(g(eJ(e,m)),m),point:F,points:e=>e.map(F),strokes:e=>e.map(e=>e.map(F)),quads:e=>e.map(e=>({upperLeft:F(e.upperLeft),upperRight:F(e.upperRight),lowerLeft:F(e.lowerLeft),lowerRight:F(e.lowerRight)})),linePoints:e=>({start:F(e.start),end:F(e.end)}),calloutLine:e=>e.map(F)},P={};for(let t of tM(n)){let n=e[t],r=f[t];null!=n&&r&&(P[t]=_[r](n))}return P}(e,{left:o,bottom:a,right:s,top:l})}}(e,function(e,t){let n=function(e,t){var n;let r;if(void 0===t||t===e.subtype)return e.subtype;let i=(n=e.subtype,(r=ts.find(e=>e.includes(n)))?r.filter(e=>e!==n):[]);if(!i.includes(t))throw new N(G.InvalidArg,0===i.length?`${e.subtype} has no other kind it can become`:`${e.subtype} can become ${i.length<2?i.join(""):`${i.slice(0,-1).join(", ")} or ${i.at(-1)}`}, not ${t}`,{details:{field:"subtype"}});let o=function(e,t){let n=tn(t)?.owners??{};for(let t of Object.keys(tn(e.subtype)?.owners??{})){let r=e[t];if(!(t in n)&&null!=r)return t}return null}(e,t);if(null!==o){let n=e[o];throw new N(G.InvalidArg,`${e.subtype} field \'${o}\' holds ${"string"==typeof n?`\'${n}\'`:JSON.stringify(n)}, and ${t} has no such field: clear it first, in the same change`,{details:{field:o}})}return t}(e,t.subtype);if("unsupported"===e.subtype)throw new N(G.InvalidArg,"an annotation of a type the engine doesn\'t model can\'t be updated");return ni(n,t),{...t,subtype:n}}(e,t)),o=tn(e.subtype)?.colors??[],i=nn(r,(t,n)=>{let r=e[t];return o.includes(t)&&"string"==typeof n&&"string"==typeof r&&n.toLowerCase()===r.toLowerCase()}),nn(i,(t,n)=>void 0!==n&&tv(n,e[t])));return!function(e,t){let n=t.subtype??e.subtype;if("unsupported"===n)return;for(let[e,r]of Object.entries(hf[n].readBackWrites)){let i=t[e];if(!(void 0===i||r?.safeParse(i).success))throw new N(G.InvalidArg,r?`${n} update field \'${e}\': this value can be read but not written; send it back unchanged or replace it`:`${n} update field \'${e}\': the engine works this out; send it back unchanged or leave it out`,{details:{field:e}})}let r=pX(n).fileSchemas.update.safeParse(t);if(!r.success)throw hC(r.error,`${n} update`)}(e,a),function(e,t,n={}){var r;let i=(r=function(e,t){if("text"!==e.subtype||"text"!==t.subtype||null==t.state||void 0!==t.stateModel)return t;let n=tN(t.state);if(n)return{...t,stateModel:n};if(!e.stateModel)throw nr(t.state);return t}(e,t),t9(e.subtype)&&t7(r.borderStyle,r.dashArray)&&null==e.dashArray?{...r,dashArray:[...t8]}:r);return tJ(i),function(e,t){if("line"!==e.subtype&&"polygon"!==e.subtype&&"polyline"!==e.subtype)return t;let n=e.subtype,r={...t,subtype:n};if(tZ(n,r),null!=r.measure&&"rectilinear"!==r.measure.subtype){if(e.measure?.subtype!==r.measure.subtype)throw new N(G.InvalidArg,`A ${"geospatial"===r.measure.subtype?"geospatial":"foreign"} measure can\'t be written; leave measure out`);r={...r,measure:void 0}}if("line"===e.subtype&&"line"===r.subtype)tK(r)&&(r={...r,captionEnabled:void 0===r.captionEnabled?e.captionEnabled:r.captionEnabled,captionPosition:r.captionPosition??e.captionPosition,captionOffset:void 0===r.captionOffset?e.captionOffset:r.captionOffset});else if("line"!==e.subtype&&"line"!==r.subtype){if(r.vertices&&null!==r.captionEnabled&&void 0===r.captionCenter&&e.captionCenter){let t=function(e,t,n){if(e.length!==t.length||e.length<2)return;let r=e[0],i=t[0],o=e.findIndex(e=>Math.hypot(e.x-r.x,e.y-r.y)>1e-6);if(o<0)return;let a={x:e[o].x-r.x,y:e[o].y-r.y},s={x:t[o].x-i.x,y:t[o].y-i.y},l=a.x*a.x+a.y*a.y,u=(a.x*s.x+a.y*s.y)/l,d=(a.x*s.y-a.y*s.x)/l;if(Math.abs(u*u+d*d-1)>1e-5)return;let c=e=>({x:i.x+u*(e.x-r.x)-d*(e.y-r.y),y:i.y+d*(e.x-r.x)+u*(e.y-r.y)});if(e.every((e,n)=>{let r=c(e);return .001>=Math.hypot(r.x-t[n].x,r.y-t[n].y)}))return c(n)}(e.vertices,r.vertices,e.captionCenter);t&&(r={...r,captionCenter:t})}tK(r)&&(r=null===r.captionEnabled?{...r,captionEnabled:null,captionCenter:null}:{...r,captionEnabled:r.captionEnabled??e.captionEnabled??!1,captionCenter:void 0===r.captionCenter?e.captionCenter:r.captionCenter})}if(tq.some(e=>void 0!==r[e])){let t=tU({...e,...r});"unavailable"in t||(r={...r,contents:t.label})}return tZ(n,r),r}(e,function(e,t){var n;let r,i,o,a,s,l;if("free-text"!==e.subtype||"free-text"!==t.subtype)return t;let u=e.calloutLine;if(!u||void 0!==t.calloutLine||void 0===t.box&&void 0===t.rotation)return t;let d=t.box??e.box,c=(void 0===t.rotation?e.rotation:t.rotation)??0,f=3===u.length?u[1]:void 0,m=(n=f??u[0],r={x:(d.left+d.right)/2,y:(d.bottom+d.top)/2},i={degrees:c,center:r},a=(o=c?e3(n,i):n).x-r.x,s=o.y-r.y,l=Math.abs(a)>=Math.abs(s)?{x:a>=0?d.right:d.left,y:r.y}:{x:r.x,y:s>0?d.top:d.bottom},c?e1(l,i):l);return{...t,calloutLine:f?[u[0],f,m]:[u[0],m]}}(e,function(e,t){if(!tQ(t.subtype??e.subtype))return t;let{richText:n}=t;if(n)return{...t,contents:e5(n)};if(null===n||void 0===t.contents||!e.richText)return t;if(null===t.contents)return{...t,richText:null};let r={paragraphs:e4(t.contents)};return{...t,richText:r,contents:e5(r)}}(e,function(e,t,n){let r;if("free-text"!==e.subtype||"free-text"!==t.subtype)return t;(void 0!==t.intent||void 0!==t.calloutLine)&&nt(t.intent??e.intent,void 0!==t.calloutLine?t.calloutLine:e.calloutLine);let i=ne({},t,n),o=void 0!==t.richText||void 0!==t.contents;if(!o&&0===Object.keys(i).length)return t;let a={...t.richText?.body?{...e6,...t.richText.body}:e.richText.body,...i},s={body:a,paragraphs:t.richText?.paragraphs??(void 0!==t.contents?e4(t.contents??""):e.richText.paragraphs)};return{...t,...(r={},void 0===t.fontSize&&void 0!==a.size&&a.size!==e.fontSize&&(r.fontSize=a.size),void 0===t.fontColor&&void 0!==a.color&&a.color.toLowerCase()!==e.fontColor?.toLowerCase()&&(r.fontColor=a.color.toLowerCase()),void 0===t.textAlign&&void 0!==a.align&&a.align!==e.textAlign&&(r.textAlign=a.align),r),richText:s,...o?{contents:e5(s)}:{}}}(e,i,n.describeFont))))}(e,a,n)}(v,t,{describeFont:E.describeFont}),function(e,t){if("widget"!==e.subtype||!e.hasMark)return;let n=rM.filter(n=>void 0!==t[n]&&!tv(t[n],e[n]));if(n.length>0)throw new N(G.InvalidArg,`the widget has a mark in it, which its style doesn\'t draw: ${n.join(", ")} can\'t change`)}(v,t),nO(v.subtype,i,"update"),m=t,bT(b6(m))&&(void 0!==m.name&&null!==m.name&&bL(m.name),null!=m.fit&&b$(m.fit),y=E?.resources?.appearance,void 0!==y&&bU(y,E)),hW(r);let k=i?.appearance?"regenerate":(p=t,function(e,t){if(void 0!==t.subtype&&t.subtype!==e.subtype)return tx;let n=e.subtype,r=void 0===t.captionEnabled?e.captionEnabled:t.captionEnabled,i=tb.has(n)||["line","polygon","polyline"].includes(n)&&!0===r,o=[];for(let[n,r]of Object.entries(t))!(void 0===r||tD.has(n))&&("contents"!==n||i)&&(tv(r,e[n])||o.push(n));if(0===o.length)return tk;let a=tw[n],s=a&&("polygon"===n||"polyline"===n)&&e.captionCenter?[...a,"captionCenter"]:a;if(!s||!o.every(e=>s.includes(e)))return tx;let l=function(e,t,n,r){let[i]=r,o=tS(e[i]),a=tS(t[i]);if(!o||!a)return null;let s=a.x-o.x,l=a.y-o.y;if(ty.has(n)){let n=void 0===t.rotation?e.rotation:t.rotation;if(!tE(tA(e.rotation),tA(n)))return null}for(let n of r){let r=e[n],i=t[n];if((null!=r||null!=i)&&(null==r||null==i||!function e(t,n,r,i){if(null==t||null==n)return null==t&&null==n;if(Array.isArray(t)||Array.isArray(n))return!!Array.isArray(t)&&!!Array.isArray(n)&&t.length===n.length&&t.every((t,o)=>e(t,n[o],r,i));if("object"==typeof t&&"object"==typeof n){for(let o of new Set([...Object.keys(t),...Object.keys(n)])){let a=t[o],s=n[o];if("number"==typeof a&&"number"==typeof s){if(!tE(a+("left"===o||"right"===o||"x"===o?r:"bottom"===o||"top"===o||"y"===o?i:0),s))return!1}else if(!e(a,s,r,i))return!1}return!0}return t===n}(r,i,s,l)))return null}return{x:s,y:l}}(e,t,n,s);return l?{impact:"translation",by:l}:tx}(v,p).impact);if("inert"!==k&&function(e,t,n){var r,i;let o;if(!__.has(e.FPDFAnnot_GetSubtype(n)))return;let a=_E(e,t,n);r=a,i=function(e,t,n){let r=_y(e,t,n);if(!r)return;let i=_F(r.degrees);return void 0===i?void 0:{rotation:i,box:r.box}}(e,t,n),(r&&i?(o=r.rotation,.05>=_b(o,i.rotation)&&eY(r.box,i.box)):!r&&!i)||(a?(D5(e,n,a.rotation),D8(e,t,n,a.box)):(e.EPDFAnnot_ClearEmbedMetadataKey(n,D3),e.EPDFAnnot_ClearEmbedMetadataKey(n,D2)))}(o,a,u),void 0!==t.subtype&&t.subtype!==v.subtype&&!o.EPDFAnnot_SetSubtype(u,rI[t.subtype]))throw new N(G.Unknown,"EPDFAnnot_SetSubtype returned false");h=u,F=t,function(e,t,n,r,i){var o,a;let s=b6(r);if(bG(s)){var l=e,u=t,d=n,c=r;if(DJ(l,u,d,c),void 0!==c.color&&DA(l,d,c.color),void 0!==c.opacity&&DS(l,d,c.opacity),"strikeout"===c.subtype&&void 0!==c.intent&&DV(l,d,null===c.intent?null:_x(c.intent)),void 0!==c.quadPoints){let e=D0(_m(l,u,d).flatMap(bx),c.quadPoints.flatMap(bx));bI(l,u,d,c.quadPoints),e?D1(l,u,d,e):bN(l,u,d,c.quadPoints)}return}if(bR(s))return DJ(e,t,n,r),bt(e,t,n,r),bF(e,t,n,r),void 0!==r.cloudyIntensity&&(null!==r.cloudyIntensity&&r.cloudyIntensity>0?Dj(e,n,r.cloudyIntensity):DM(e,n));if(bX(s))return"polygon"===s?(DJ(e,t,n,r),bQ(e,t,n,r),bF(e,t,n,r),void 0!==r.cloudyIntensity&&(null!==r.cloudyIntensity&&r.cloudyIntensity>0?Dj(e,n,r.cloudyIntensity):DM(e,n))):(DJ(e,t,n,r),bQ(e,t,n,r),bF(e,t,n,r),void 0!==r.lineEndings&&DL(e,n,r.lineEndings));if("line"===s)return function(e,t,n,r){DJ(e,t,n,r),bv(e,t,n,r),bF(e,t,n,r);let i=r.linePoints&&[[r.linePoints.start,r.linePoints.end]],o=bA(e,t,n,bE(e,t,n),i,r.rotation);if(o){let[r]=o.drawn;DT(e,t,n,{start:r[0],end:r[1]})}void 0!==r.lineEndings&&DL(e,n,r.lineEndings)}(e,t,n,r);if("link"===s){var f=e,m=t,p=n,h=r,F=i;if(DJ(f,m,p,h),void 0!==h.rect&&Dx(f,m,p,h.rect),null===h.target){var g=f,_=p;if(!g.EPDFAnnot_RemoveAction(_)||!g.EPDFAnnot_RemoveDest(_))throw new N(G.Unknown,"failed to clear link target")}else if(void 0!==h.target){if("goto"!==h.target.kind&&"uri"!==h.target.kind&&"named"!==h.target.kind)throw new N(G.InvalidArg,`a \'${h.target.kind}\' link target can\'t be written`,{details:{field:"target"}});bS(f,m,p,h.target,F)}return}if("ink"===s){let i;return DJ(e,t,n,r),void 0!==r.intent&&DV(e,n,null===r.intent?null:_8(r.intent)),bm(e,t,n,r),(i=bA(e,t,n,bE(e,t,n),r.inkList,r.rotation))&&DB(e,t,n,i.drawn)}if(bD(s)){var P=e,D=t,b=n,y=r,w=i;if(DJ(P,D,b,y),bt(P,D,b,y),void 0!==y.interiorColor&&(null===y.interiorColor?Dv(P,b,0):DA(P,b,y.interiorColor,0)),void 0!==y.opacity&&DS(P,b,y.opacity),bp(P,D,b,y),void 0!==y.cloudyIntensity&&(null===y.cloudyIntensity?DM(P,b):Dj(P,b,y.cloudyIntensity)),void 0!==y.color){let e=_u(P,D,b);e?D$(P,b,-1,e.fontSize>0?e.fontSize:bg.fontSize,y.color):bu(P,b,bg.fontFamily,bg.fontSize,y.color,w)}void 0!==y.richText&&b_(P,b,y.richText,w,y.fontFamily),void 0!==y.textAlign&&Dz(P,b,_H(y.textAlign)),void 0!==y.intent&&DU(P,b,_$[y.intent]),void 0!==y.verticalAlign&&bP(P,b,y.verticalAlign),null===y.calloutLine?P.EPDFAnnot_RemoveKey(b,"CL"):void 0!==y.calloutLine&&DH(P,D,b,y.calloutLine),null===y.lineEnding?P.EPDFAnnot_RemoveKey(b,"LE"):void 0!==y.lineEnding&&DL(P,b,{start:"none",end:y.lineEnding});return}if("caret"===s)return DJ(e,t,n,r),bt(e,t,n,r),void 0!==r.color&&DA(e,n,r.color),void 0!==r.opacity&&DS(e,n,r.opacity),void 0!==r.intent&&DV(e,n,null===r.intent?null:_k(r.intent));if("text"===s)return DJ(e,t,n,r),void 0!==r.rect&&Dx(e,t,n,r.rect),void 0!==r.color&&DA(e,n,r.color),void 0!==r.opacity&&DS(e,n,r.opacity),void 0!==r.icon&&bK(e,n,r.icon),void 0!==r.open&&bH(e,n,r.open),void 0!==r.stateModel&&DO(e,t,n,"StateModel",null===r.stateModel?null:Py[o=r.stateModel]??o),void 0!==r.state&&DO(e,t,n,"State",null===r.state?null:Pw[a=r.state]??a);if(bT(s))return function(e,t,n,r,i){DJ(e,t,n,r),null===r.name?e.EPDFAnnot_RemoveKey(n,"Name"):void 0!==r.name&&bB(e,n,r.name);let o=PP(e,t,n)??"fill",a=void 0!==r.fit?r.fit??"fill":o;void 0!==r.fit&&PD(e,t,n,r.fit);let s=i?.resources?.appearance;if(void 0!==s){void 0!==r.opacity&&DS(e,n,r.opacity);let o=_A(e,t,n);bW(e,t,n,s,bV(i),a,{box:r.box??o.box,rotation:void 0===r.rotation?o.rotation:r.rotation});return}let l=bt(e,t,n,r);void 0!==r.opacity?function(e,t,n,r){if(!e.EPDFAnnot_SetStampOpacity(t,Pg[n],r))throw new N(G.Unknown,"EPDFAnnot_SetStampOpacity returned false")}(e,n,a,r.opacity):(l||void 0!==r.fit)&&Pb(e,n,a)}(e,t,n,r,i);if(bi(s))return DJ(e,t,n,r),void 0!==r.rect&&Dx(e,t,n,r.rect),void 0!==r.color&&DA(e,n,r.color),void 0!==r.opacity&&DS(e,n,r.opacity),void 0!==r.icon&&bo(e,n,r.icon),function(e,t,n,r,i){let o=i?.resources?.file;if(void 0===r&&void 0===o)return;let a=e.EPDFAnnot_GetFileAttachmentForWrite(n);if(null===r){if(a)throw new N(G.InvalidArg,"a file attachment\'s file can\'t be removed");if(void 0===o)return}let s=a?_I(e,t,a):null;if(!a){if(!r||void 0===o)throw new N(G.InvalidArg,"the file attachment has no file: send the file\'s name as `file` and its bytes as the `file` resource");a=ba(e,t,n,r.name)}let l=r?r.mimeType??null:s?.mimeType??null;if(void 0!==o?_O(e,t,a,bl(i),{mimeType:l},{bytes:o}):l!==(s?.mimeType??null)&&function(e,t,n){if(!e.EPDFAttachment_SetSubtype(t,n??""))throw new N(G.InvalidArg,"the file attachment\'s file has no embedded data to give a MIME type")}(e,a,l),r){if(null!==s&&r.name!==s.name&&!h6(t,r.name,t=>e.EPDFAttachment_SetName(a,t)))throw new N(G.Unknown,"EPDFAttachment_SetName returned false");if((r.description??null)!==(s?.description??null)&&!h6(t,r.description??"",t=>e.EPDFAttachment_SetDescription(a,t)))throw new N(G.Unknown,"EPDFAttachment_SetDescription returned false")}}(e,t,n,r.file,i);if(bY(s))return function(e,t,n,r,i){let{actions:o,...a}=r;if(DJ(e,t,n,a),!function(e,t,n,r){if(void 0===r.box&&void 0===r.rotation)return;let i=eH(g9(e,t,n)),o=PO(e,n);b3(e,t,n,{box:r.box??eX(i,o??0),rotation:void 0===r.rotation?o:r.rotation||null},{rect:i,rotation:o})}(e,t,n,r),b0(e,t,n,r,i),void 0!==r.actions){if(!i?.runtime||!i.docPtr)throw new N(G.InvalidArg,"writing a widget\'s actions requires the runtime and the document on the write context");PM(i.runtime,i.docPtr,n,r.actions)}}(e,t,n,r,i);if("popup"===s)return DJ(e,t,n,r),void 0!==r.rect&&Dx(e,t,n,r.rect),void 0!==r.open&&bk(e,n,r.open);if(bM(s)){var E=e,A=t,v=n,S=r,k=i;if(DJ(E,A,v,S),void 0!==S.rect&&Dx(E,A,v,S.rect),void 0!==S.quadPoints&&(bI(E,A,v,S.quadPoints),void 0===S.rect&&bN(E,A,v,S.quadPoints)),void 0!==S.color&&DA(E,v,S.color,0),void 0!==S.opacity&&DS(E,v,S.opacity),void 0!==S.interiorColor&&(null===S.interiorColor?Dv(E,v,1):DA(E,v,S.interiorColor,1)),void 0!==S.overlayText&&DW(E,A,v,S.overlayText??""),void 0!==S.repeat&&Dq(E,v,S.repeat),bj(S)){let e=_u(E,A,v);bu(E,v,S.fontFamily??(e?_q(e.fontCode):bC.fontFamily),S.fontSize??e?.fontSize??bC.fontSize,S.fontColor??e?.color??bC.fontColor,k)}void 0!==S.textAlign&&Dz(E,v,_H(S.textAlign));return}throw new N(G.NotImplemented,`no writer registered for subtype=\'${s}\'`)}(o,a,h,F,E),b2(o,h,{...F,subtype:b6(F)},E),void 0!==t.contents&&t.contents!==v.contents&&tz({...v,...t})&&o.EPDFAnnot_RemoveKey(u,"RC");let x=null;void 0===t.reply||(d=t.reply,c=v.reply,null===d||null===c?d===c:yb(d.to,c.to)&&(d.type??"reply")===c.type)||function(e,t,n,r,i){let{fn:o}=e;if(null===i.inReplyTo){o.EPDFAnnot_SetLinkedAnnot(n,"IRT",0n),o.EPDFAnnot_SetReplyType(n,0);return}if(i.inReplyTo){if(i.inReplyTo.page.objectNumber!==r)throw new N(G.InvalidArg,`/IRT parent must be on the same page as the reply (parent page ${i.inReplyTo.page.objectNumber}, reply page ${r})`);let a=gj(e,t,i.inReplyTo);try{b9(e,n,a,i.replyType??"reply")}finally{o.FPDFPage_CloseAnnot(a)}return}if(void 0!==i.replyType){let e=o.FPDFAnnot_GetLinkedAnnot(n,"IRT");if(e)try{o.EPDFAnnot_SetReplyType(n,Po(i.replyType))}finally{o.FPDFPage_CloseAnnot(e)}}}(this.runtime,this.session,u,e.page.objectNumber,null===t.reply?{inReplyTo:null}:{inReplyTo:t.reply.to,replyType:t.reply.type??"reply"});let O=!1;"popup"!==t.subtype||"popup"!==v.subtype||void 0===t.parent||yb(t.parent,v.parent)||(O=!0,x=function(e,t,n,r,i,o){let{fn:a}=e;if(o){let r=gj(e,t,o);try{let e=a.FPDFAnnot_GetLinkedAnnot(r,"Popup");if(e){let t=a.EPDFAnnot_GetObjectNumber(e)===a.EPDFAnnot_GetObjectNumber(n);a.FPDFPage_CloseAnnot(e),t&&a.EPDFAnnot_SetLinkedAnnot(r,"Popup",0n)}}finally{a.FPDFPage_CloseAnnot(r)}}if(null===i)return a.EPDFAnnot_SetLinkedAnnot(n,"Parent",0n),null;if(i.page.objectNumber!==r)throw new N(G.InvalidArg,`a popup\'s parent must be on the same page (parent page ${i.page.objectNumber}, popup page ${r})`);let{annotPtr:s,name:l}=gR(e,t,i);try{return ye(e,n,s),l}finally{a.FPDFPage_CloseAnnot(s)}}(this.runtime,this.session,u,e.page.objectNumber,t.parent,v.parent));let I=null,C=t.open;if(void 0!==C&&!O){let e="text"===v.subtype?v.popup:"popup"===v.subtype?v.parent:null;e&&(I=function(e,t,n,r,i){let{fn:o}=e,{annotPtr:a,name:s}=gR(e,t,n);try{if(i&&1!==o.FPDFAnnot_GetSubtype(a))return null;return yt(e,a,r),s}finally{o.FPDFPage_CloseAnnot(a)}}(this.runtime,this.session,e,C,"popup"===v.subtype))}if(DY(o,a,u),g=u,S&&(S.userId||S.groupId)&&(o.EPDFAnnot_HasEmbedMetadata(g)||o.EPDFAnnot_SetEmbedMetadataNumber(g,Pd,1),S.userId&&Ph(o,a,g,Pp,S.userId),S.groupId&&Ph(o,a,g,Pf,S.groupId)),"inert"===k||"translation"===k)b={action:"preserved",changed:!1};else{let e;"widget"!==v.subtype?e=b7(o,u,t.blendMode??A):v.hasMark?(_=u,Pb(o,_,"contain"),e=!1):e=o.EPDFAnnot_GenerateFormFieldAP(u),b=e?{action:"regenerated",changed:!0}:{action:"generation-unavailable",changed:"regenerate"===k}}o.FPDFPage_CloseAnnot(u),u=null,u=gM(this.runtime,this.session,s,l);let j=b8(o,a,u,e.page.objectNumber,l,gJ(this.session,this.fonts));Dd(this.runtime,this.session,[j]);let M=yP(this.session.writeStamp(),e.page.objectNumber,(f=[j.ref,x,I],w=new Set,f.filter(e=>!(null===e||w.has(K(e)))&&(w.add(K(e)),!0))));return{annotation:j,appearance:b,meta:M}}finally{null!==u&&o.FPDFPage_CloseAnnot(u)}}assertNotAttachedWidget(e,t){let{fn:n}=this.runtime;if(20!==n.FPDFAnnot_GetSubtype(e))return;let r=n.EPDFAnnot_GetObjectNumber(e);if(t>0&&r===t)return;let i=function(e,t,n){if(n<=0)return 0;let r=gv(e,t),i=e.fn.EPDFForm_GetFieldIndexForWidget(r,n);return i<0?0:e.fn.EPDFForm_GetFieldObjNum(r,i)}(this.runtime,this.session,r);if(0!==i)throw new N(G.InvalidArg,i===r?"widget is its form field\'s own dictionary (a merged field/widget) - delete the field with doc.forms.delete":"widget is attached to a form field - use doc.forms.removeWidget or doc.forms.delete")}delete(e,t,n){hW(n);let{fn:r}=this.runtime,i=this.session.requireDocPtr(),o=e.page.objectNumber,{pageIndex:a}=this.session.resolvePageRef(e.page),{annotations:s}=new DP(this.runtime,this.session,this.fonts).listOne(o,n),l=tG(s,e);if(0===l.length){var u;throw u=e,new N(G.NotFound,`no annotation ${K(u)} on page ${u.page.objectNumber}`)}o5(t,l);let d=e=>gC(this.runtime,this.session,e).index,c=l.map(e=>d(e.ref));for(let e of c)this.withAnnotAt(a,e,e=>this.assertNotAttachedWidget(e,0));let f=new Set(l.map(e=>K(e.ref))),m=l.flatMap(e=>{if("popup"!==e.subtype||!e.parent)return[];let t=K(e.parent),n=s.find(e=>K(e.ref)===t);return n&&!f.has(t)?[d(n.ref)]:[]});for(let e of(hW(n),gx(this.runtime,this.session,o),[...c].sort((e,t)=>t-e)))if(!r.EPDFPage_RemoveAnnotRaw(i,a,e))throw new N(G.Unknown,`failed to remove annotation ${e} on page ${o}`);for(let e of m){let t=c.filter(t=>tr.EPDFAnnot_RemoveKey(e,"Popup"))}let p=[...l].reverse().map(e=>e.ref);return{meta:yP(this.session.writeStamp(),o,p)}}deleteReleasedWidget(e,t){let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=e.page.objectNumber,{pageIndex:a,index:s}=gC(this.runtime,this.session,e),l=this.withAnnotAt(a,s,o=>(this.assertNotAttachedWidget(o,t),gI(n,r,i,e.page,o,s)));if(gx(this.runtime,this.session,o),!n.EPDFPage_RemoveAnnotRaw(i,a,s))throw new N(G.Unknown,`failed to remove annotation: ${e.kind}`);return{meta:yP(this.session.writeStamp(),o,[l])}}withAnnotAt(e,t,n){let r=gM(this.runtime,this.session,e,t);try{return n(r)}finally{this.runtime.fn.FPDFPage_CloseAnnot(r)}}},yb=(e,t)=>null===e||null===t?e===t:K(e)===K(t);function yy(e,t,n){let r=_E(e,t,n);return r?hY(t,16,i=>(FY(t,i,r.box),e.EPDFAnnot_ExportAppearance(n,_g(r.rotation),i))):e.EPDFAnnot_ExportAppearance(n,0,0n)}function yw(e,t,n,r){let i=null;try{return hY(t,8,o=>{Ft(t,o,0),i=e.EPDF_SaveDocumentToOwnedBuffer(n,2,o);let a=Number(t.peek(o,"i32"));if(!i||a<=0)throw new N(G.DocOpenFailed,`failed to save ${r}`);let s=t.readBytes(i,a),l=new ArrayBuffer(s.byteLength);return new Uint8Array(l).set(s),{bytes:l,size:a}})}finally{i&&e.EPDF_FreeBuffer(i)}}var yE=class{constructor(e,t){this.runtime=e,this.session=t}flatten(e,t,n,r){hW(r),this.requireRefs("annotations.flatten",e,t);let{fn:i,mem:o}=this.runtime,a=gx(this.runtime,this.session,e),s=this.session.pagePool(),l=s.acquire(e);try{let r,s,u=this.resolveAll(l,t);try{[r,s]=this.withHandleArray(u,e=>hY(o,4*t.length,r=>{let a=i.EPDFPage_FlattenAnnotations(l,e,t.length,+("print"===n),r),s=[];for(let e=0;e2===e);throw new N(t>=0?G.InvalidArg:G.Unknown,t>=0?`annotations.flatten: ref ${t} is not an annotation of page ${e}`:"native annotation flatten failed after preflight")}let d=t.map((e,t)=>({ref:e,status:0===s[t]?"applied":"unchanged"}));if(1!==r&&!a){let t={affectedPages:[],cacheDelta:null,...this.session.writeStamp()};return{page:q(e),usage:n,results:d,meta:t}}this.session.invalidateDerived();let c={affectedPages:[q(e)],cacheDelta:null,...this.session.writeStamp()};return{page:q(e),usage:n,results:d,meta:c}}finally{s.release(e)}}exportAppearance(e,t,n){hW(n),this.requireRefs("annotations.exportAppearance",e,t);let{fn:r}=this.runtime,i=this.session.pagePool(),o=i.acquire(e),a=null;try{let e=this.resolveAll(o,t);try{a=this.withHandleArray(e,e=>r.EPDFPage_ExportAnnotationsAsDocument(o,e,t.length))}finally{for(let t of e)r.FPDFPage_CloseAnnot(t)}if(!a)throw new N(G.InvalidArg,"annotations.exportAppearance: every ref must be a visible annotation of this page with a normal appearance");return yw(this.runtime.fn,this.runtime.mem,a,"exported appearances")}finally{a&&r.FPDF_CloseDocument(a),i.release(e)}}readAppearance(e,t,n){hW(n);let{fn:r}=this.runtime,i=this.session.pagePool(),o=i.acquire(e),a=null;try{let e=gT(this.runtime,this.session,o,t);try{let t=rN(r.FPDFAnnot_GetSubtype(e));if(ti[t]?.appearance===void 0)throw new N(G.InvalidArg,`a ${t} annotation has no \'appearance\' resource`);a=yy(r,this.runtime.mem,e)}finally{r.FPDFPage_CloseAnnot(e)}if(!a)throw new N(G.InvalidArg,"the annotation has no normal appearance to read");return yw(this.runtime.fn,this.runtime.mem,a,"the appearance")}finally{a&&r.FPDF_CloseDocument(a),i.release(e)}}resolveAll(e,t){let{fn:n}=this.runtime,r=[];try{for(let n of t)r.push(gT(this.runtime,this.session,e,n));return r}catch(e){for(let e of r)n.FPDFPage_CloseAnnot(e);throw e}}withHandleArray(e,t){let{mem:n}=this.runtime,r="wasm"===this.runtime.kind;return hY(n,Math.max(1,e.length*(r?4:8)),i=>(e.forEach((e,t)=>r?n.poke(i,"i32",Number(e),4*t):n.poke(i,"i64",e,8*t)),t(i)))}requireRefs(e,t,n){if(0===n.length)throw new N(G.InvalidArg,`${e} requires at least one ref`);for(let r of n)if(r.page.objectNumber!==t)throw new N(G.InvalidArg,`${e} refs must all target page ${t}; got ref on page ${r.page.objectNumber}`)}};function yA(e,t,n,r){let{fn:i,mem:o}=e,a=r?i.EPDFDoc_ExportDrawing(t,r):yy(i,o,n);if(!a)return null;try{return yw(i,o,a,"a drawing").bytes}finally{i.FPDF_CloseDocument(a)}}function yv(e,t,n){let r=e.fn.FPDFAnnot_GetFileAttachment(t);return r?_N(e,r,n).bytes:null}function yS(e){return N.is(e,G.PayloadTooLarge)}function yk(e,t,n){let{fn:r,mem:i}=e,o=new Set(n.flatMap(e=>rB(e).map(H))),a=t.requireDocPtr();return hY(i,16,e=>t.allRecords().filter(e=>o.has(H(q(e.pageObjectNumber)))).map(t=>{let n=gg(r,i,a,t.pageIndex,e).crop;return{page:q(t.pageObjectNumber),position:t.pageIndex,size:{width:n.right-n.left,height:n.top-n.bottom}}}))}var yx=class{constructor(e,t,n){this.runtime=e,this.kind=t,this.limits=n,hJ(this,"byId",{}),hJ(this,"totalBytes",0)}keep(e){nC(this.kind,this.limits,"resourceBytes",e.byteLength);let{fn:t,mem:n}=this.runtime,r=`sha256-${Db(t,n,new Uint8Array(e))}`;return r in this.byId||(this.byId[r]=e,this.totalBytes+=e.byteLength,nC(this.kind,this.limits,"resources",Object.keys(this.byId).length),nC(this.kind,this.limits,"bundleBytes",this.totalBytes)),r}},yG=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}export(e,t,n){hW(n);let r=this.session.allRecords(),i=new DP(this.runtime,this.session,this.fonts),o=function(e,t,n){let r=new Set(t.map(H)),i=new Map,o=new Map,a=e=>{let t=H(e);if(i.has(t)||!r.has(t))return;let a=n(e);for(let e of(i.set(t,a),a))o.set(K(e.ref),e)},s=e=>(a(e.page),o.get(K(e)));for(let t of e.pages??[])if(!r.has(H(t)))throw new N(G.NotFound,`export: the document has no page ${H(t)}`);let l=!e.refs&&!e.pages,u=(e.include??"threads")==="threads";for(let n of l?t:e.pages??[])a(n);let d=new Set,c=[],f=e=>{if(!e)return;let t=K(e.ref);d.has(t)||(d.add(t),c.push(e))};if(l)for(let e of i.values())e.forEach(f);else{for(let t of e.pages??[])i.get(H(t))?.forEach(f);for(let t of e.refs??[]){let e=s(t);if(!e)throw new N(G.NotFound,`export: the document has no annotation ${K(t)}`);f(e)}}if(u){for(let e of[...c])"popup"===e.subtype&&e.parent&&f(s(e.parent));let e=new Map;for(let t of i.values())for(let n of t){let t=n.reply?s(n.reply.to):void 0;if(!t)continue;let r=K(t.ref);e.set(r,[...e.get(r)??[],n])}for(let t=0;tq(e.pageObjectNumber)),e=>i.listOne(e.objectNumber,n,"annotations").annotations);nC("annotation",t,"items",o.length);let a=new yO(this.runtime,this.session,t),s=gF(this.runtime,this.session),l=o.map(e=>(hW(n),{data:n6(e,s(e.ref.page),s),resources:a.of(e)})),u=yk(this.runtime,this.session,l.map(e=>e.data));nC("annotation",t,"pages",u.length);let d=nN({pages:u,items:l});return nC("annotation",t,"manifestBytes",d),nC("annotation",t,"bundleBytes",d+a.totalBytes),{format:"embedpdf/annotations",version:1,pages:u,items:l,resources:a.byId}}},yO=class extends yx{constructor(e,t,n){super(e,"annotation",n),this.session=t,hJ(this,"drawings",new Map)}of(e){let t=ti[e.subtype];if(!t)return{};let{fn:n}=this.runtime,r=this.rawHandleOf(e);try{let e={};if(t.appearance){let t=this.appearanceOf(r);t&&(e.appearance=t)}if(t.file){let t=this.fileOf(r);t&&(e.file=t)}return e}finally{n.FPDFPage_CloseAnnot(r)}}rawHandleOf(e){return gj(this.runtime,this.session,e.ref)}appearanceOf(e){let t=this.runtime.fn.EPDFAnnot_GetDrawing(e),n=t?this.drawings.get(t):void 0;if(n)return n;let r=yA(this.runtime,this.session.requireDocPtr(),e,t);if(!r)return null;let i=this.keep(r);return t&&this.drawings.set(t,i),i}fileOf(e){let t;try{t=yv(this.runtime,e,this.limits.resourceBytes)}catch(e){if(!yS(e))throw e;throw new N(G.PayloadTooLarge,`the annotation bundle is past its resourceBytes limit: an attached file is larger than ${this.limits.resourceBytes}`,{details:{limit:"resourceBytes",max:this.limits.resourceBytes}})}return t?this.keep(t):null}};function yI(e,t,n,r,i){let o=new Map;for(let[e,r]of Object.entries(n.resources??{})){if(!(r instanceof ArrayBuffer))throw new N(G.InvalidArg,`${t} bundle: resource ${e} is not bytes`);o.set(e,r.byteLength)}i(n,o,r);let{fn:a,mem:s}=e,l=new Map;for(let[e,r]of Object.entries(n.resources??{})){let n=Db(a,s,new Uint8Array(r));if(`sha256-${n}`!==e)throw new N(G.InvalidArg,`${t} bundle: resource ${e} doesn\'t match its id`);l.set(r,n)}return l}var yN=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}import(e,t){var n;hW(t);let{bundle:r,limits:i}=e;this.assertBundle(r,i);let o=function(e){let{bundle:t,target:n,nameTaken:r}=e,i=t.items.map(e=>e.data),o=tP({bundlePages:t.pages,pages:e.pages??"same",target:n,named:i.flatMap(hj)}),a=new Map,s=new Map,l=new Map;i.forEach((e,t)=>{if("unsupported"===e.subtype)return void a.set(t,"unsupported-kind");if("widget"===e.subtype)return void a.set(t,"widget");if("popup"===e.subtype&&null===e.parent)return void a.set(t,"parent-missing");let n=hM(e);if("item"===n)return void a.set(t,"unsupported-value");let r=[...rR(e),...n];r.length>0&&s.set(t,r),l.set(t,hR(e,r,o,{label:`import: item ${t}`,details:{item:t}}))});let u=new Map;i.forEach((e,t)=>{let n=K(e.ref);u.has(n)||u.set(n,t)});let d=e=>H(o(i[e].ref.page)),c=(e,t)=>{let n=u.get(K(e));return void 0!==n&&d(n)===d(t)?n:void 0},f=e=>[e.reply?.to,"popup"===e.subtype?e.parent:null].filter(e=>null!=e);i.forEach((e,t)=>{!a.has(t)&&f(e).some(e=>void 0===c(e,t))&&a.set(t,"parent-missing")});let m=new Map;i.forEach((e,t)=>{if(a.has(t)||"popup"!==e.subtype||!e.parent)return;let n=c(e.parent,t);m.has(n)?a.set(t,"popup-taken"):m.set(n,t)});let p=new Set;i.forEach((e,t)=>{if(a.has(t)||!e.nm)return;let n=o(e.ref.page),i=`${H(n)}\\0${e.nm}`;p.has(i)||r(n,e.nm)?a.set(t,"name-conflict"):p.add(i)});for(let e=!0;e;)e=!1,i.forEach((t,n)=>{!a.has(n)&&f(t).some(e=>a.has(c(e,n)))&&(a.set(n,"parent-dropped"),e=!0)});let h=new Map;i.forEach((e,t)=>{a.has(t)||h.set(t,h.size)});let F=[...h.keys()].map(e=>{let t=i[e],n=t.reply?h.get(c(t.reply.to,e)):void 0,r="popup"===t.subtype&&t.parent?h.get(c(t.parent,e)):void 0;return{item:e,page:o(t.ref.page),draft:l.get(e),...void 0!==n?{replyTo:{planned:n,type:t.reply.type}}:{},...void 0!==r?{parent:r}:{}}}),g=[];return i.forEach((e,t)=>{let n=a.get(t);if(n)g.push({ref:e.ref,reason:n});else for(let n of s.get(t)??[])g.push({ref:e.ref,...n})}),{creates:F,dropped:g}}({bundle:"stamp"===e.attribution?{...n=r,items:n.items.map(({data:{nm:e,...t},...n})=>({...n,data:t}))}:r,...void 0!==e.pages?{pages:e.pages}:{},target:this.session.allRecords().map(e=>({page:q(e.pageObjectNumber),position:e.pageIndex})),nameTaken:(e,t)=>b5(this.runtime,this.session.requireDocPtr(),this.session.resolvePageRef(e).pageIndex,t)>=0}),a=gF(this.runtime,this.session),s=o.creates.map(t=>{let n=r.items[t.item],i={};for(let[e,t]of Object.entries(n.resources))i[e]=r.resources[t];return{page:t.page,draft:n5(t.draft,a(t.page),a),...t.replyTo?{replyTo:{to:{planned:t.replyTo.planned},type:t.replyTo.type}}:{},...void 0!==t.parent?{parent:{planned:t.parent}}:{},resources:i,attribution:function(e,t,n){let{actor:r}=e;if("stamp"===e.attribution){let{groupId:e}=t,n="string"==typeof e?{...r,groupId:e}:r;return{kind:"stamp",...n?{actor:n}:{}}}return{kind:"restore",from:{author:n.author,createdAt:n.createdAt,modifiedAt:n.modifiedAt,userId:n.userId,createdBy:n.createdBy,modifiedBy:n.modifiedBy,groupId:n.groupId??null},...r?.userId?{importedBy:r.userId}:{}}}(e,t.draft,n.data),..."file-attachment"===n.data.subtype&&n.data.file?{fileDates:{createdAt:n.data.file.createdAt,modifiedAt:n.data.file.modifiedAt}}:{},label:`import: item ${t.item}`}});for(let t of s)e.authorizeCreate?.(t.draft);let{created:l,meta:u}=new yh(this.runtime,this.session,this.fonts).create(s,t);return{annotations:l,refMap:o.creates.map((e,t)=>({from:r.items[e.item].data.ref,to:l[t].ref})),dropped:[...o.dropped],meta:u}}assertBundle(e,t){let n=yI(this.runtime,"annotation",e,t,nL),r=this.session.drawingIndex();for(let[e,t]of n)r.hashes.set(e,t);for(let n of e.items){let r=n.resources.appearance;r&&function(e,t,n){let r=nx(n);r&&"width"in r&&nC(e,t,"imagePixels",r.width*r.height)}("annotation",t,e.resources[r])}}};function yC(e,t,n,r){let{fn:i,mem:o}=e;return hY(o,Math.max(4,4*r.length),a=>(r.forEach((e,t)=>o.poke(a,"i32",e,4*t)),yz(e,"annotations",e=>i.EPDFPage_ExportAnnotsRawToOwnedBuffer(t,n,a,r.length,e))))}function yj(e,t,n,r){yU(e,r,i=>{if(!e.fn.EPDFPage_ImportAnnotsRaw(t,n,i,r.byteLength))throw new N(G.Unknown,"EPDFPage_ImportAnnotsRaw refused a capture")})}function yM(e,t,n,r){return yz(e,`object ${n}`,i=>e.fn.EPDFDoc_ExportDictRawToOwnedBuffer(t,n,r.join(" "),i))}function yR(e,t,n,r,i=[]){return yz(e,`object ${n}`,o=>e.fn.EPDFDoc_ExportDictCanonicalToOwnedBuffer(t,n,r.join(" "),i.join(" "),o))}function yT(e,t,n){yU(e,n,r=>{if(!e.fn.EPDFDoc_ImportDictRaw(t,r,n.byteLength))throw new N(G.Unknown,"EPDFDoc_ImportDictRaw refused a capture")})}function yB(e,t,n){return yz(e,`field ${n}`,r=>e.fn.EPDFForm_ExportFieldRawToOwnedBuffer(t,n,r))}function yL(e,t,n){yU(e,n,r=>{if(!e.fn.EPDFForm_ImportFieldRaw(t,r,n.byteLength))throw new N(G.Unknown,"EPDFForm_ImportFieldRaw refused a capture")})}function y$(e,t,n){try{return yz(e,`attachment \'${n}\'`,r=>h5(e.mem,n,n=>e.fn.EPDFAttachment_ExportCanonicalToOwnedBuffer(t,n,r)))}catch(e){if(N.is(e))return null;throw e}}function yz(e,t,n){let{fn:r,mem:i}=e;return hY(i,8,e=>{Ft(i,e,0);let o=n(e);if(!o)throw new N(G.Unknown,`the capture of ${t} failed`);try{return i.readBytes(o,Number(i.peek(e,"i32"))).slice()}finally{r.EPDF_FreeBuffer(o)}})}function yU(e,t,n){let{mem:r}=e;return hY(r,Math.max(1,t.byteLength),e=>(r.writeBytes(e,t),n(e)))}function yV(e,t,n=yW){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)||Array.isArray(t))return!!Array.isArray(e)&&!!Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>yV(e,t[n]));let r=yq(e,n),i=yq(t,n);return r.length===i.length&&r.every(n=>i.includes(n)&&yV(e[n],t[n]))}var yW=new Set;function yq(e,t){return Object.entries(e).filter(([e,n])=>void 0!==n&&!t.has(e)).map(([e])=>e)}function yH(e,t){return{item:{type:"skipped",op:t,meta:{affectedPages:[],cacheDelta:null,...e.session.writeStamp()}},reverse:[]}}function yK(e,t,n){if(!n)return;let r=Object.entries(n).filter(([e,n])=>void 0!==n&&!yV(t[e],n)).map(([e])=>e);if(r.length>0)throw new N(G.ChangeConflict,`op ${e} expected other values in ${r.join(", ")}`,{details:{opIndex:e,fields:r}})}function yZ(e,t){if(e.byteLength!==t.byteLength)return!1;for(let n=0;n({...n,after:yR(e,t.requireDocPtr(),n.objectNumber,[])}))}function yX(e,t,n){return n.every(n=>{let r=function(e,t,n){try{return yR(e,t.requireDocPtr(),n,[])}catch(e){if(N.is(e))return null;throw e}}(e,t,n.objectNumber);return null!==r&&yZ(r,n.after)})}function yY(e,t,n){let r=yJ(e,t,n),i=t.requireDocPtr();for(let t of n)t.before&&yT(e,i,t.before);return t.invalidateDerived(),yQ(e,t,r)}function y0(e,t,n){let r=e[t];if(!(n<=r))throw new N(G.PayloadTooLarge,`copy: past the ${t} limit: ${n} > ${r}`,{details:{limit:t,max:r,value:n}})}var y1=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}copy(e,t){var n,r;let i,o,a,s,l,u,d;hW(t);let{refs:c,objectNumbers:f,limits:m}=e;if(f&&f.length!==c.length)throw new N(G.InvalidArg,`copy: objectNumbers names ${f.length} copies of ${c.length}`,{details:{field:"objectNumbers"}});y0(m,"items",c.length),e.page&&this.session.resolvePageRef(e.page);let p=c.map(t=>e.read(t)),h=gF(this.runtime,this.session),F=(n=p.map(e=>n6(e,h(e.ref.page),h)),r={...e.page?{page:e.page}:{},...e.offset?{offset:e.offset}:{}},i=new Map,n.forEach((e,t)=>{if("unsupported"===e.subtype||"widget"===e.subtype)return;let n=hM(e);i.set(t,"item"===n?"item":[...rR(e),...n])}),o=e=>{let t=i.get(e);return void 0===t||"item"===t?[]:t},l=new Set((s=(a=function(e,t,n=()=>!1){let r=new Map;e.forEach((e,t)=>{"unsupported"===e.subtype?r.set(t,"unsupported-kind"):"widget"===e.subtype?r.set(t,"widget"):n(t)&&r.set(t,"unsupported-value")});let i=new Map;e.forEach((e,t)=>{let n=K(e.ref);i.has(n)||i.set(n,t)});let o=n=>t.page??e[n].ref.page,a=(e,t)=>{let n=i.get(K(e));if(!(void 0===n||r.has(n)))return H(o(n))===H(o(t))?n:void 0},s=new Set;e.forEach((e,t)=>{if(r.has(t)||"popup"!==e.subtype)return;let n=e.parent?i.get(K(e.parent)):void 0,o=e.parent?a(e.parent,t):void 0;void 0===o?r.set(t,void 0!==n&&r.has(n)?"parent-dropped":"parent-missing"):s.has(o)?r.set(t,"popup-taken"):s.add(o)});let l=new Map;e.forEach((e,t)=>{r.has(t)||l.set(t,l.size)});let u=t.offset??{x:0,y:0},d=[...l.keys()].map(t=>{let n=e[t],r=n.reply?a(n.reply.to,t):void 0,i="popup"===n.subtype&&n.parent?a(n.parent,t):void 0,{nm:s,groupId:d,reply:c,popup:f,...m}=n;for(let{field:e}of rR(n))delete m[e];return{source:t,page:o(t),data:function(e,t){if(0===t.x&&0===t.y)return e;let n=new Set(["rect","captionCenter",...tw[e.subtype]??[]]),r={...e};for(let i of n)null!=e[i]&&(r[i]=function e(t,n,r){return Array.isArray(t)?t.map(t=>e(t,n,r)):null===t||"object"!=typeof t?t:Object.fromEntries(Object.entries(t).map(([t,i])=>"number"!=typeof i?[t,e(i,n,r)]:[t,i+("left"===t||"right"===t||"x"===t?n:"bottom"===t||"top"===t||"y"===t?r:0)]))}(e[i],t.x,t.y));return r}(m,u),...void 0!==r?{replyTo:{copy:l.get(r),type:n.reply.type}}:{},...void 0!==i?{parent:l.get(i)}:{}}}),c=[];return e.forEach((e,t)=>{let n=r.get(t);n&&c.push({ref:e.ref,reason:n})}),{copies:d,dropped:c}}(n,r,e=>"item"===i.get(e))).copies.map(({data:e,...t})=>({...t,draft:hR(e,o(t.source),e=>e,{label:`copy: annotation ${t.source}`,details:{annotation:t.source}})}))).map(e=>e.source)),u=a.dropped[Symbol.iterator](),d=[],n.forEach((e,t)=>{if(l.has(t))for(let n of o(t))d.push({ref:e.ref,...n});else d.push(u.next().value)}),{creates:s,dropped:d}),g=this.resourceReader(m),_=F.creates.map(n=>{hW(t);let r=p[n.source],i=n5(n.draft,h(n.page),h),o=e.authorizeCreate(i);return{page:n.page,draft:i,...n.replyTo?{replyTo:{to:{planned:n.replyTo.copy},type:n.replyTo.type}}:{},...void 0!==n.parent?{parent:{planned:n.parent}}:{},resources:g(r),...f?{objectNumber:f[n.source]}:{},attribution:{kind:"stamp",...o?{actor:o}:{}},..."file-attachment"===r.subtype&&r.file?{fileDates:{createdAt:r.file.createdAt,modifiedAt:r.file.modifiedAt}}:{},label:`copy: annotation ${n.source}`}}),{created:P,meta:D}=new yh(this.runtime,this.session,this.fonts).create(_,t);return{annotations:P,refMap:F.creates.map((e,t)=>({from:p[e.source].ref,to:P[t].ref})),dropped:[...F.dropped],meta:D}}resourceReader(e){let{fn:t}=this.runtime,n=new Map,r=0,i=0,o=t=>(y0(e,"resourceBytes",t.byteLength),y0(e,"resources",r+=1),y0(e,"bundleBytes",i+=t.byteLength),t);return r=>{let i=ti[r.subtype];if(!i)return{};let a=gj(this.runtime,this.session,r.ref);try{let r={};if(i.appearance){let e=t.EPDFAnnot_GetDrawing(a),i=n.get(e),s=i??yA(this.runtime,this.session.requireDocPtr(),a,e);s&&(r.appearance=i??o(s)),s&&e&&n.set(e,s)}if(i.file){let t=this.fileOf(a,e.resourceBytes);t&&(r.file=o(t))}return r}finally{t.FPDFPage_CloseAnnot(a)}}}fileOf(e,t){try{return yv(this.runtime,e,t)}catch(e){if(!yS(e))throw e;throw new N(G.PayloadTooLarge,`copy: an attached file is larger than ${t} bytes`,{details:{limit:"resourceBytes",max:t}})}}};function y3(e,t,n){let{fn:r,mem:i}=e,o=t.requireDocPtr(),{pageIndex:a}=t.resolvePageRef(n),s=r.EPDFPage_GetAnnotCountRaw(o,a),l=[];for(let e=0;ee?.family===t?[e.ref]:[])}function y6(e,t,n,r){let i;if(0===n.length)throw new N(G.InvalidArg,"a reorder names at least one row",{details:{field:"refs"}});let o=new Map;e.entries.forEach((e,t)=>{e&&o.set(K(e.ref),t)});let a=n_(r);(a?[...n,a]:n).forEach((r,i)=>{let s=a&&i===n.length?"position":"refs";if(r.page.objectNumber!==e.page.objectNumber)throw new N(G.InvalidArg,`${K(r)} is on page ${r.page.objectNumber}; a reorder stays on page ${e.page.objectNumber}`,{details:{field:s}});let l=o.get(K(r)),u=void 0===l?null:e.entries[l];if(u&&u.family!==t)throw new N(G.InvalidArg,"widgets"===u.family?"widgets paint above every annotation and have an order of their own: reorder them with doc.forms.reorderWidgets":"annotations paint below every widget and have an order of their own: reorder them with page.annotations.reorder",{details:{field:s}})});let s=y2(e,t),l=nD(s,n,r,K),u=n.map(e=>o.get(K(e))),d=new Set(u),c=e=>e-u.filter(t=>to.get(K(e))).filter(e=>!d.has(e)),m=Math.min(...u);if("start"===r)i=f.length>0?c(f[0]):m;else if("end"===r)i=f.length>0?c(f.at(-1))+1:m;else{let e=c(o.get(K(a)));i="before"in r?e:e+1}return{stack:e,family:t,before:s,after:l,from:u,to:i}}function y5(e,t,n){let{fn:r,mem:i}=e;if(gx(e,t,n.stack.page.objectNumber),!hY(i,4*n.from.length,e=>(n.from.forEach((t,n)=>i.poke(e,"i32",t,4*n)),r.EPDFPage_MoveAnnotsRaw(t.requireDocPtr(),n.stack.pageIndex,e,n.from.length,n.to))))throw new N(G.Unknown,`the annotations of page ${n.stack.page.objectNumber} could not be reordered`)}function y4(e,t,n,r=n){let i=new Set;for(let e of n)e.page&&i.add(e.page.objectNumber);return{affectedPages:[...i].map(e=>q(e)),cacheDelta:null,...e,changedFields:t,changedWidgets:n,redrawnWidgets:r}}function y8(e,t){return"checkbox"===e||"radio"===e?[]:[...t]}var y7=["AP","FS"];function y9(e,t,n){let r=new Map,i=t.map(t=>{var n;let i;return{ref:t.ref,left:(n=t.ref,(i=r.get(n.page.objectNumber))||(i=wc(e,n.page.objectNumber),r.set(n.page.objectNumber,i)),tG(i,n))}}),o=new Set(i.flatMap(e=>e.left.map(e=>K(e.ref)).filter(t=>t!==K(e.ref))));return i.filter(e=>!o.has(K(e.ref))).reverse().map(e=>({kind:"annotation.remove",ref:e.ref,left:e.left,...n?{rights:n}:{}}))}function we(e){oQ(e,"doc.annotate.modify"),oQ(e,"doc.annotate.import")}function wt(e,t,n){if(!n||n===t.nm)return;let r=e.session.resolvePageRef(t.ref.page);if(b5(e.runtime,e.session.requireDocPtr(),r.pageIndex,n)>=0)throw b4(n,r.pageObjectNumber)}function wn(e,t,n){let{page:r}=t.stack;return{item:wo(e,t.family,r,t.after,n),reverse:[{kind:"annotation.reorder",page:r,family:t.family,refs:n,before:t.before,after:t.after}]}}function wr(e,t){let n=e.findIndex(e=>K(e)===K(t));if(!(n<0))return 0===n?null:K(e[n-1])}function wi(e,t,n){if("widgets"===t)return void oQ(e.authority,"doc.forms.modify");for(let t of o1(n.map(t=>wd(e,t))))oQ(e.authority,t)}function wo(e,t,n,r,i){let o=e.session.writeStamp();return"annotations"===t?{type:"annotations.reorder",page:n,order:r,meta:yP(o,n.objectNumber,i)}:{type:"forms.reorderWidgets",page:n,order:r,meta:y4(o,[],i.map(t=>({ref:t,objectNumber:wm(e,t),page:n})))}}function wa(e,t,n,r,i){var o,a;let s;gx(e.runtime,e.session,t.page.objectNumber);let l=wd(e,t),u="widget"===l.subtype?ir(l.fieldKind,n):n,d=(function(e,t){let n=[];if("open"in t&&("text"===e.subtype&&e.popup&&n.push(e.popup),"popup"===e.subtype&&e.parent&&n.push(e.parent)),"popup"===e.subtype&&"parent"in t){e.parent&&n.push(e.parent);let r=t.parent;r&&n.push(r)}return n})(l,u).map(t=>({objectNumber:wm(e,t),deep:[]})),c=yJ(e.runtime,e.session,[{objectNumber:wm(e,t),deep:y7},...d]),f=wu(e).update(t,u,e.authority,e.signal,i),m=yQ(e.runtime,e.session,c);return{item:ws(e,r,t,f),reverse:[{kind:"objects.revert",reports:r,objects:m,subject:{annotation:t},appearanceChanged:f.appearance.changed,fallback:(o=l,a=f.annotation,{kind:"annotation",restore:Object.fromEntries((s=Object.keys(u).filter(e=>!yV(o[e],a[e]))).map(e=>[e,o[e]])),left:Object.fromEntries(s.map(e=>[e,a[e]]))})}]}}function ws(e,t,n,r){if("annotations.update"===t)return{type:"annotations.update",page:n.page,...r};let i=r.annotation;if("widget"!==i.subtype)throw Error("a widget update read back no widget");let o=eR(wm(e,n),n.page);return{type:"forms.updateWidget",widget:i,appearance:r.appearance,meta:y4(e.session.writeStamp(),i.field?[i.field]:[],[o],r.appearance.changed?[o]:[])}}function wl(e,t,n){let r=t.page.objectNumber;gx(e.runtime,e.session,r);let i=tG(wc(e,r),t),o=new Set(i.map(e=>K(e.ref))),a=i.flatMap(t=>"popup"===t.subtype&&t.parent&&!o.has(K(t.parent))?[{objectNumber:wm(e,t.parent),deep:[]}]:[]),s=yJ(e.runtime,e.session,a),{pageIndex:l}=e.session.resolvePageRef(t.page),u=i.length>0?yC(e.runtime,e.session.requireDocPtr(),l,i.map(t=>gC(e.runtime,e.session,t.ref).index)):new Uint8Array,d=n?{...e.authority,grants:null}:e.authority,c=wu(e).delete(t,d,e.signal);return{item:{type:"annotations.delete",page:t.page,...c},reverse:[{kind:"annotation.restore",page:t.page,members:c.meta.changedRefs,capture:u,unlinked:yQ(e.runtime,e.session,s),...n?{rights:n}:{}}]}}function wu(e){return new yD(e.runtime,e.session,e.fonts)}function wd(e,t){gC(e.runtime,e.session,t);let n=K(t),r=wc(e,t.page.objectNumber).find(e=>K(e.ref)===n);if(!r)throw Error(`annotation ${n} is on its page but reads as none`);return r}function wc(e,t){return new DP(e.runtime,e.session,e.fonts).listOne(t,e.signal).annotations}function wf(e,t){try{return wc(e,e.session.resolvePageRef(t).pageObjectNumber)}catch{return null}}function wm(e,t){if("objectNumber"===t.kind)return t.objectNumber;let{pageIndex:n,index:r}=gC(e.runtime,e.session,t),i=gM(e.runtime,e.session,n,r);try{return e.runtime.fn.EPDFAnnot_GetObjectNumber(i)}finally{e.runtime.fn.FPDFPage_CloseAnnot(i)}}var wp=class{constructor(e,t){this.runtime=e,this.session=t}list(e){hW(e);let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr(),i=t.FPDFDoc_GetAttachmentCount(r),o=[];for(let e=0;ee.EPDFDoc_GetAttachmentKey(n,r,t,i))}(t,n,r,e)??"";o.push({..._I(t,n,i),ref:n$(a),index:e})}return o}readFile(e,t,n,r){hW(r);let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s=_G(i,o,a,e);if(s<0)throw new N(G.NotFound,`no embedded file with key \'${e.key}\' in the document`);let l=i.FPDFDoc_GetAttachment(a,s);if(!l)throw new N(G.Unknown,`embedded file with key \'${e.key}\' resolved to index ${s} but could not be opened`);let u=_I(i,o,l);return this.extract(l,u.name,u.mimeType??void 0,t,n)}async readAnnotationFile(e,t,n,r,i,o){hW(i);let{fn:a,mem:s}=this.runtime,l=this.session.pagePool(),u=await l.acquireInSlices(e,i,o),d=null;try{d=gT(this.runtime,this.session,u,t);let e=a.FPDFAnnot_GetFileAttachment(d);if(!e)throw new N(G.InvalidArg,"annotation is not a file attachment or carries no embedded file (/FS)");let i=_I(a,s,e);return this.extract(e,i.name,i.mimeType??void 0,n,r)}finally{null!==d&&a.FPDFPage_CloseAnnot(d),l.release(e)}}extract(e,t,n,r,i){if(void 0!==r){let{size:o}=function(e,t,n,r){let{fn:i,mem:o}=e,a=o.alloc(4),s=o.alloc(4),l=e.fileWrite.toNodeFile(n);try{if(o.poke(a,"i32",0),o.poke(s,"i32",-1),!i.EPDFAttachment_ExtractFile(t,l.ptr,BigInt(r??0),a,s))throw _C(Number(o.peek(s,"i32")),r);return{size:Number(o.peek(a,"i32"))>>>0}}finally{l.close(),o.free(s),o.free(a)}}(this.runtime,e,r,i);return{name:t,...n?{mimeType:n}:{},size:o,path:r}}let{bytes:o,size:a}=_N(this.runtime,e,i);return{name:t,...n?{mimeType:n}:{},size:a,bytes:o}}},wh=class{constructor(e,t){this.runtime=e,this.session=t}create(e,t,n){let r;hW(n);let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr();if(!t)throw new N(G.InvalidArg,"an attachments.create op needs its bytes as its file resource",{details:{field:"resources.file"}});if(0===e.name.length)throw new N(G.InvalidArg,"attachment file requires a name");if(-1!==_G(i,o,a,{kind:"key",key:e.name}))throw new N(G.InvalidArg,`an embedded file with key \'${e.name}\' already exists \\u2014 keys are unique; rename and retry`);hW(n);let s=o.writeU16String(e.name);try{r=i.FPDFDoc_AddAttachment(a,s)}finally{o.free(s)}if(!r)throw new N(G.Unknown,"FPDFDoc_AddAttachment returned NULL");_O(i,o,r,a,e,{bytes:t,...void 0!==e.mimeType?{mimeType:e.mimeType}:{},name:e.name});let l=n$(e.name),u=this.find(l);if(!u)throw new N(G.Unknown,"created attachment did not resolve by key after the write");return{attachment:u,meta:this.meta(l)}}find(e){let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr(),i=_G(t,n,r,e),o=i<0?null:t.FPDFDoc_GetAttachment(r,i);return o?{..._I(t,n,o),ref:e,index:i}:null}meta(e){return{affectedPages:[],cacheDelta:null,...this.session.writeStamp(),changedRefs:[e]}}delete(e,t){hW(t);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=_G(n,r,i,e);if(o<0)throw new N(G.NotFound,`no embedded file with key \'${e.key}\' in the document`);if(!n.FPDFDoc_DeleteAttachment(i,o))throw new N(G.Unknown,"FPDFDoc_DeleteAttachment returned false");return{meta:this.meta(e)}}},wF=e=>new wh(e.runtime,e.session);function wg(e,t){var n,r,i;let o=wF(e);if(!o.find(t))throw new N(G.NotFound,`no embedded file with key \'${t.key}\' in the document`,{details:{field:"ref"}});let a=(n=e.runtime,r=e.session.requireDocPtr(),i=t.key,yz(n,`attachment \'${i}\'`,e=>h5(n.mem,i,t=>n.fn.EPDFAttachment_ExportRawToOwnedBuffer(r,t,e))));return{item:{type:"attachments.delete",...o.delete(t,e.signal)},reverse:[{kind:"attachments.restore",ref:t,capture:a}]}}function w_(e,t){let n=y$(e.runtime,e.session.requireDocPtr(),t.key);if(!n)throw new N(G.Unknown,`attachment \'${t.key}\' is not there to guard`);return{kind:"attachments.remove",ref:t,left:n}}function wP(e,t,n){let{fn:r}=e;if("objectNumber"===n.kind){let e=r.EPDFForm_GetFieldIndexByObjNum(t,n.objectNumber);if(e<0)throw new N(G.NotFound,`form field not found: object ${n.objectNumber}`);return{fieldIndex:e,fieldObjectNumber:n.objectNumber}}let i=r.EPDFForm_CountFields(t);for(let o=0;or.EPDFForm_GetFieldName(t,o,e,n))??"")===n.name)return{fieldIndex:o,fieldObjectNumber:r.EPDFForm_GetFieldObjNum(t,o)};throw new N(G.NotFound,`form field not found: "${n.name}"`)}function wD(e){return"objectNumber"===e.ref.kind?e.ref.objectNumber:0}var wb={0:"whole-revision",1:"partial",2:"malformed"},wy={1:"all",2:"include",3:"exclude"};function ww(e,t){return h3(e.mem,t,"")}function wE(e){return 1===e||2===e||3===e}function wA(e,t,n){let{fn:r,mem:i}=e;return hY(i,32,e=>{for(let t=0;t<4;t++)Ft(i,e,0,8*t);return r.EPDFSig_GetByteRange(t,n,e)?[Fn(i,e,0),Fn(i,e,8),Fn(i,e,16),Fn(i,e,24)]:null})}function wv(e,t,n,r){let{fn:i}=e,o=wy[1===r?i.EPDFSig_GetLockAction(t,n):i.EPDFSig_GetFieldMDPAction(t,n)];if(!o)return null;let a=[],s=i.EPDFSig_GetFieldNameCount(t,n,r);for(let o=0;oi.EPDFSig_GetFieldNameAt(t,n,r,o,e,a))??"");let l={action:o,fields:a};if(1===r){let e=i.EPDFSig_GetLockPermission(t,n);wE(e)&&(l.permission=e)}return l}function wS(e,t){let{fn:n}=e,r=n.EPDFSig_Count(t),i=[],o=(r,i)=>ww(e,(e,o)=>n.EPDFSig_GetString(t,r,i,e,o));for(let s=0;sn.EPDFSig_GetFieldName(t,s,e,r))??"",widget:l>0?eR(l,Dl(n.EPDFSig_GetWidgetPageObjNum(t,s))):null,signed:r,kind:1===n.EPDFSig_GetKind(t,s)?"timestamp":"signature",filter:o(s,0),subFilter:o(s,1),byteRange:r?wA(e,t,s):null,contentsSizeBytes:r?Math.max(0,n.EPDFSig_GetContents(t,s,0n,0)):0,coverage:r?wb[n.EPDFSig_GetCoverage(t,s)]??"malformed":null,revisionIndex:r&&u>=0?u:null,signer:{name:o(s,2),reason:o(s,3),location:o(s,4),contactInfo:o(s,5),signedAt:(a=o(s,6))?hq(a):null},docMdp:wE(d)?d:null,catalogCertification:n.EPDFSig_IsCatalogCertification(t,s),fieldMdp:wv(e,t,s,0),lock:wv(e,t,s,1),seedValue:function(e,t,n){let{fn:r}=e;if(!r.EPDFSig_HasSeedValue(t,n))return null;let i=r.EPDFSig_GetSeedValueRequiredFlags(t,n)>>>0,o=r.EPDFSig_GetSeedValuePresentFlags(t,n)>>>0,a=r.EPDFSig_GetSeedValueVersion(t,n),s=r.EPDFSig_GetSeedValueMDP(t,n),l=i=>{let o=r.EPDFSig_GetSeedValueListCount(t,n,i),a=[];for(let s=0;sr.EPDFSig_GetSeedValueListAt(t,n,i,s,e,o))??"");return a};return{parserVersion:a>0?a:null,parserVersionRequired:(4&i)!=0,mdp:(131072&o)!=0&&s>=0&&s<=3?s:null,filter:ww(e,(e,i)=>r.EPDFSig_GetSeedValueFilter(t,n,e,i)),filterRequired:(1&i)!=0,subFilters:l(0),subFiltersRequired:(2&i)!=0,digestMethods:l(1),digestMethodsRequired:(64&i)!=0,reasons:l(2),reasonsRequired:(8&i)!=0,unsupportedRequired:(432&i)!=0||(4&i)!=0&&a>2}}(e,t,s)})}return i}function wk(e,t,n){let{fn:r,mem:i}=e,o=r.EPDFSig_GetContents(t,n,0n,0);if(o<=0)throw new N(G.NotFound,"signature has no usable /Contents (malformed encoding)");return hY(i,o,e=>{if(r.EPDFSig_GetContents(t,n,e,o)!==o)throw new N(G.Unknown,"failed to read signature contents");let a=new Uint8Array(o);return a.set(i.readBytes(e,o)),a})}function wx(e,t,n){let{fn:r,mem:i}=e,o=r.EPDFDoc_GetRevisionCount(t),a=[];return o<=0||h0(i,[8,8],([e,s])=>{for(let l=0;le.revisionIndex===l);a.push({index:l,end:Fn(i,e),xrefOffset:Fn(i,s),signatureIndex:o?o.index:null})}}),a}function wG(e,t,n){let r=e.fn.EPDFSig_LoadModel(t);if(0n===r)throw new N(G.Unknown,"failed to build signature model");try{return n(r)}finally{e.fn.EPDFSig_CloseModel(r)}}function wO(e,t){let{fn:n,mem:r}=e,[i,o,a]=h0(r,[4,4,4],([e,i,o])=>(r.poke(e,"i32",0),r.poke(i,"i32",0),r.poke(o,"i32",0),n.EPDFDoc_GetStructureObjectNumbers(t,e,i,o),[Number(r.peek(e,"i32"))>>>0,Number(r.peek(i,"i32"))>>>0,Number(r.peek(o,"i32"))>>>0])),s=[],l=n.FPDF_GetPageCount(t);for(let e=0;e{u.push({objectNumber:wD(e),name:e.name,kind:e.kind,widgets:e.widgets.map(e=>e.objectNumber),flags:n.EPDFForm_GetFieldFlags(d,t)})})}finally{n.EPDFForm_CloseModel(d)}return{root:i,acroForm:o,pagesRoot:a,pages:s,fields:u,signatures:wG(e,t,t=>wS(e,t))}}var wI=new WeakMap;function wN(e,t){let n=t.cacheSeq(),r=wI.get(t);if(r&&r.seq===n)return r.ptr;r&&(e.fn.EPDFSig_CloseModel(r.ptr),wI.delete(t));let i=e.fn.EPDFSig_LoadModel(t.requireDocPtr());if(0n===i)throw new N(G.Unknown,"failed to build signature model");return wI.set(t,{seq:n,ptr:i}),i}function wC(e,t){let n=wI.get(t);n&&(e.fn.EPDFSig_CloseModel(n.ptr),wI.delete(t))}var wj={sha1:0,sha256:1,sha384:2,sha512:3},wM={sha1:20,sha256:32,sha384:48,sha512:64},wR=class{constructor(e,t){this.runtime=e,this.session=t}readSnapshot(){let e=wN(this.runtime,this.session),t=this.runtime.fn.EPDFSig_IsRevisionChainValid(e),n=wS(this.runtime,e);return{chainValid:t,revisions:t?wx(this.runtime,this.session.requireDocPtr(),n):[],signatures:n,protection:iM(n)}}readProtection(){let e=wN(this.runtime,this.session);return iM(wS(this.runtime,e))}readContents(e){let t=wN(this.runtime,this.session),n=this.requireSignedIndex(t,e);return wk(this.runtime,t,n).buffer}digest(e,t){let n=wN(this.runtime,this.session),r=this.requireSignedIndex(n,e),i=wA(this.runtime,n,r);if(!i)throw new N(G.NotFound,"signature has no usable /ByteRange");return this.digestRange(i,t)}revisionBytes(e){let t=this.readSnapshot();if(!t.chainValid)throw new N(G.MalformedPdf,"revision chain is not valid");let n=t.revisions[e];if(!n)throw new N(G.NotFound,`no revision ${e}`);return this.readLoadedBytes(0,n.end)}resolveField(e){let{fn:t}=this.runtime,n=wN(this.runtime,this.session),r=this.indexOf(n,e);if(r<0)throw new N(G.NotFound,"objectNumber"===e.kind?`signature field not found: object ${e.objectNumber}`:`signature field not found: "${e.name}"`);let i=t.EPDFSig_GetWidgetObjNum(n,r);return{index:r,fieldObjectNumber:t.EPDFSig_GetFieldObjNum(n,r),signed:t.EPDFSig_IsSigned(n,r),widget:i>0?eR(i,Dl(t.EPDFSig_GetWidgetPageObjNum(n,r))):null,lock:wv(this.runtime,n,r,1)}}readSignatureByObjectNumber(e){let t=this.readSnapshot().signatures.find(t=>"objectNumber"===t.field.kind&&t.field.objectNumber===e);if(!t)throw new N(G.NotFound,`signature field not found: object ${e}`);return t}loadedBytes(){let e=Number(this.runtime.fn.EPDFDoc_GetLoadedBytesSize(this.session.requireDocPtr()));return this.readLoadedBytes(0,e)}version(){let{fn:e,mem:t}=this.runtime,n=this.session.requireDocPtr(),r=Number(e.EPDFDoc_GetBaseBytesSize(n));if(r<=0)throw new N(G.DocNotOpen,"document has no loaded bytes");if("layer"===this.session.kind)return{sha256:hY(t,32,r=>{if(!e.EPDFLayer_GetBaseSha256(n,r))throw new N(G.Unknown,"failed to read the base hash");return wB(t.readBytes(r,32))}),sizeBytes:r};let i=this.session.cachedPlainSha256();if(i)return{sha256:i,sizeBytes:r};let o=wB(new Uint8Array(this.digestRange([0,r,r,0],"sha256")));return this.session.rememberPlainSha256(o),{sha256:o,sizeBytes:r}}digestRange(e,t){let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=wM[t];return h0(r,[32,o,8],([a,s,l])=>{for(let t=0;t<4;t++)Ft(r,a,e[t],8*t);if(Ft(r,l,o),!n.EPDFSig_DigestByteRange(i,a,wj[t],s,l))throw new N(G.InvalidArg,"byte range is not within the loaded bytes");let u=Number(r.peek(l,"i32"));return wT(r.readBytes(s,u))})}readLoadedBytes(e,t){let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr();return 0===t?new ArrayBuffer(0):hY(r,t,o=>{if(n.EPDFDoc_ReadLoadedBytes(i,BigInt(e),o,t)!==t)throw new N(G.Unknown,"failed to read the loaded bytes");return wT(r.readBytes(o,t))})}indexOf(e,t){let{fn:n}=this.runtime;if("objectNumber"===t.kind)return n.EPDFSig_GetIndexByFieldObjNum(e,t.objectNumber);let r=n.EPDFSig_Count(e);for(let i=0;in.EPDFSig_GetFieldName(e,i,t,r))===t.name)return i;return -1}requireSignedIndex(e,t){let{fn:n}=this.runtime,r=this.indexOf(e,t);if(r<0)throw new N(G.NotFound,"objectNumber"===t.kind?`signature field not found: object ${t.objectNumber}`:`signature field not found: "${t.name}"`);if(!n.EPDFSig_IsSigned(e,r))throw new N(G.NotFound,"signature field is not signed");return r}readString(e,t,n){return this.readWide((r,i)=>this.runtime.fn.EPDFSig_GetString(e,t,n,r,i))}readWide(e){return h3(this.runtime.mem,e,"")}};function wT(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}function wB(e){let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}var wL=new WeakMap;function w$(e,t){let n=t.cacheSeq(),r=wL.get(t);if(r&&r.seq===n)return r.locks;let i=null;try{let n=new wR(e,t).readProtection();n.fieldLocks.length>0&&(i=e=>(function(e,t){for(let n of e.fieldLocks)if(ij(n.spec,t))return n;return null})(n,e))}catch{i=null}return wL.set(t,{seq:n,locks:i}),i}function wz(e,t){return"protect"!==t.signedDocumentPolicy?null:w$(e,t)}function wU(e,t,n,r){let{fn:i,mem:o}=e,a=[],s=new Set;for(let l of n){if(!l.ref||s.has(l.objectNumber))continue;s.add(l.objectNumber);let n=function(e,t,n){try{return gC(e,t,n.ref)}catch(e){if(N.is(e)&&e.code===G.NotFound)return null;throw e}}(e,t,l);if(!n)continue;let u=gM(e,t,n.pageIndex,n.index);try{let e=b8(i,o,u,l.ref.page.objectNumber,n.index,gJ(t,r));"widget"===e.subtype&&a.push(e)}finally{i.FPDFPage_CloseAnnot(u)}}return Dd(e,t,a),a}function wV(e,t,n,r){return{...n,widgets:wU(e,t,n.meta.changedWidgets,r)}}var wW=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}snapshot(e){return hW(e),function(e,t,n,r){let{formKind:i,needsAppearances:o,fields:a,calculationOrder:s}=Do(e,gv(e,t),t.requireDocPtr(),w$(e,t));return{formKind:i,needsAppearances:o,fields:a,widgets:function(e,t,n,r){let{fn:i}=e,o=t.requireDocPtr(),a=[],s=i.FPDF_GetPageCount(o);for(let l=0;li.EPDFPage_GetAnnotRaw(o,l,e),signal:n,family:"widgets",...r?{fonts:r}:{}});a.push(...d)}return a}(e,t,n,r),calculationOrder:s}}(this.runtime,this.session,e,this.fonts)}field(e,t){hW(t);let n=gv(this.runtime,this.session),{fieldIndex:r}=wP(this.runtime,n,e);return Di(this.runtime,n,r,this.session.requireDocPtr(),w$(this.runtime,this.session))}};function wq(e,t,n,r,i,o){let{fn:a,mem:s}=e,l=a.EPDFPage_CreateAnnotRaw(t,n,20,i??0);if(0n===l&&void 0!==i)throw Ff(i,"taken");if(0n===l)throw new N(G.Unknown,"failed to create widget annotation");try{DG(a,s,l,"NM",iY());let{page:n,rect:i,rotation:u,exportValue:d,actions:c,...f}=r;Dx(a,s,l,i),u&&b1(a,l,u),Object.keys(f).length>0&&b0(a,s,l,f,o),c&&PM(e,t,l,c);let m=a.EPDFAnnot_GetObjectNumber(l);if(m<=0)throw new N(G.Unknown,"widget annotation has no object number");return m}finally{a.FPDFPage_CloseAnnot(l)}}function wH(e,t,n,r){if(!n.ref)return;let i=gj(e,t,n.ref);try{Dk(e.fn,i,r)}finally{e.fn.FPDFPage_CloseAnnot(i)}}function wK(e,t){let{fn:n}=e,r=[],i=n.EPDFForm_CountCalculationOrder(t);for(let e=0;e0&&!r.includes(o)&&r.push(o)}return r}function wZ(e,t,n){let{fn:r,mem:i}=e;if(!h1(i,n,(e,n)=>r.EPDFForm_SetCalculationOrder(t,e,n)))throw new N(G.InvalidArg,"the calculation order could not be written")}function wJ(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function wQ(e,t){let n=e.indexOf(t);if(!(n<0))return 0===n?null:e[n-1]}function wX(e,t,n,r,i=!1,o="appearance"){let a=i?{mimeType:"application/pdf"}:nx(n);if(!a)throw new N(G.InvalidArg,`the ${o} resource must be PNG, JPEG or one-page PDF bytes`);if("application/pdf"!==a.mimeType)return a;let s=DE(e,t,n);if(null===s)throw new N(G.MalformedPdf,`the ${o} PDF could not be opened`);if(1!==s)throw new N(G.InvalidArg,`the ${o} PDF has ${s} pages; ${r} takes a one-page PDF`);return a}function wY(e){return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer}var w0={readOnly:1,required:2,noExport:4,multiline:4096,password:8192,noToggleToOff:16384,edit:262144,multiSelect:2097152,comb:0x1000000,radiosInUnison:0x2000000};function w1(e){let t=0,n=0;for(let[r,i]of Object.entries(w0)){let o=e[r];!0===o?t|=i:!1===o&&(n|=i)}return{setBits:t,clearBits:n}}function w3(e,t,n,r,i){let{mem:o,fn:a}=e,s=wY(i.bytes),l=wX(a,o,s,"a signature appearance",i.declaredPdf);w2(e,t,r,e=>{let r=Dy(a,o,t,n,s,l);if(!a.EPDFAnnot_SetDrawing(e,r,0))throw new N(G.InvalidArg,"the appearance page could not be drawn into the widget")})}function w2(e,t,n,r){let{fn:i}=e,o=new h8;try{let e=n.page?i.EPDFDoc_LoadPageByObjectNumber(t,n.page.objectNumber):0n;if(!e)throw new N(G.NotFound,"the widget page could not be loaded");o.push(()=>i.FPDF_ClosePage(e));let a=i.EPDFPage_GetAnnotByObjectNumber(e,n.objectNumber);if(!a)throw new N(G.NotFound,"the signature widget could not be loaded");o.push(()=>i.FPDFPage_CloseAnnot(a)),r(a)}finally{o.close()}}var w6={keystroke:0,format:1,validate:2,calculate:3};function w5(e,t,n,r,i){for(let o of Object.keys(w6)){let a=i[o];if(void 0===a)continue;if(null!==a&&!V(a))throw new N(G.InvalidArg,`a field\'s ${o} event takes JavaScript only`,{details:{field:`actions.${o}`}});let s=r?.[o];if(null===a?!s:void 0!==s&&function(e,t){if(e.incomplete||!e.root)return!1;let n=(e,t)=>{if(!e||"javascript"!==e.type||e.script!==t.script)return!1;let r=t.next??[];return e.next.length===r.length&&e.next.every((e,t)=>n(e,r[t]))};return n(e.root,t)}(s,a))continue;let l=null===a?0n:PC(e,t,a);if(!e.fn.EPDFForm_SetFieldEventAction(t,n,w6[o],l))throw new N(G.Unknown,`the field\'s ${o} script could not be written`)}}var w4={none:0,scalar:1,array:2};function w8(e,t,n,r,i){let{fn:o}=e;if("unsupported"===r.kind)return!1;let a="scalar"===r.kind?[r.value]:"array"===r.kind?r.values:[],s="value"===i?o.EPDFForm_SetFieldValue:o.EPDFForm_SetFieldDefaultValue;return gf(e,a,(e,i)=>s(t,n,w4[r.kind],e,i))}var w7={pushbutton:1,checkbox:2,radio:3,text:4,combobox:5,listbox:6,signature:7},w9={visible:0,hidden:1,noPrint:2,noView:3},Ee=new Set(["text","checkbox","radio","combobox","listbox"]),Et=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}setValue(e,t,n){hW(n);let r=gv(this.runtime,this.session),i=wP(this.runtime,r,e);this.assertWritable(i);let o=this.session.requireDocPtr(),a=Di(this.runtime,r,i.fieldIndex,o,w$(this.runtime,this.session)),s=function(e,t){let{field:n}=e,r=r4(n,t);switch(r.kind){case"text":{if("text"!==n.kind)return e;let t=function(e,t){if(!t)return e;let n=Array.from(e);return n.length>t?n.slice(0,t).join(""):e}(r.value,n.maxLength);if(t===n.value)return e;return il({...n,value:t,valueEntry:{kind:"scalar",value:t}},e)}case"toggle":{if("checkbox"!==n.kind&&"radio"!==n.kind)return e;let t=n.widgets.findIndex(e=>e.onState===r.state);return iu(e,null===r.state?-1:t)}case"choice":if("combobox"!==n.kind&&"listbox"!==n.kind)return e;return il(im(n,r.values),e)}}({field:a,widgets:[]},t).field,l=this.writeFieldAfter(i.fieldObjectNumber,a,s);return this.readBack(i.fieldObjectNumber,l??[])}setDisplay(e,t,n){hW(n);let r=wP(this.runtime,gv(this.runtime,this.session),e);this.assertWritable(r);let i=this.session.requireDocPtr(),o=this.withChangedWidgets((e,n,o)=>this.runtime.fn.EPDFForm_SetFieldDisplay(i,r.fieldObjectNumber,w9[t],e,n,o));if(null===o)throw new N(G.Unknown,"the field could not be shown or hidden");return this.readBack(r.fieldObjectNumber,o,!1)}setAppearanceText(e,t,n){hW(n);let r=gv(this.runtime,this.session),i=wP(this.runtime,r,e);this.assertWritable(i);let o=this.session.requireDocPtr(),a=Di(this.runtime,r,i.fieldIndex,o,w$(this.runtime,this.session));if("text"!==a.kind&&"combobox"!==a.kind)throw new N(G.InvalidArg,`appearance text does not apply to a ${a.kind} field`);let s=h5(this.runtime.mem,t,e=>this.withChangedWidgets((t,n,r)=>this.runtime.fn.EPDFForm_SetFieldAppearanceText(o,i.fieldObjectNumber,e,t,n,r)));if(null===s)throw new N(G.Unknown,"the appearance text could not be drawn");return this.readBack(i.fieldObjectNumber,s,!0)}emptyMeta(){return{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}reset(e,t){hW(t);let n=gv(this.runtime,this.session),r=void 0===e?this.wholeFormTargets(n):this.namedTargets(n,e);hW(t);let i=r.filter(e=>!function(e){if("unsupported"===e.valueEntry.kind||!r7(e.valueEntry,e.defaultValueEntry))return!1;if("checkbox"!==e.kind&&"radio"!==e.kind)return!0;let t=e.defaultValueEntry,n="scalar"===t.kind?t.value:null;return e.widgets.every(e=>e.checked===(e.onState===n))}(e)).flatMap(e=>{let t=function(e){let{field:t}=e,n=t.defaultValueEntry;switch(t.kind){case"text":{if("array"===n.kind||"unsupported"===n.kind)throw iw(t);let r="scalar"===n.kind?n.value:"",i="scalar"===n.kind?n:{kind:"none"};return il({...t,value:r,valueEntry:i},e)}case"checkbox":case"radio":{var r,i;let o;if("array"===n.kind||"unsupported"===n.kind)throw iw(t);let a="scalar"===n.kind?n.value:null;if(null===a||"Off"===a)return iu(e,-1);let s=(r=t.widgets,i=a,(o=r.findIndex(e=>e.onState===i))>=0||!/^\\d+$/.test(i)?o:Number(i)0&&this.session.invalidateDerived();let o=[],a=[],s=[];for(let{before:e,changed:t}of i){let n=this.readBackField(wD(e));if(0===t.length&&r7(e.valueEntry,n.valueEntry))continue;o.push(n);let r=new Set(t),i=n.widgets.filter(e=>r.has(e.objectNumber)).map(e=>eR(e.objectNumber,e.page));a.push(...i),s.push(...y8(n.kind,i))}return{fields:o,meta:y4(this.session.writeStamp(),o.map(e=>e.ref),a,s)}}wholeFormTargets(e){let t=this.session.requireDocPtr(),n=wz(this.runtime,this.session),r=[],i=this.runtime.fn.EPDFForm_CountFields(e);for(let o=0;o{if(!n.EPDFForm_Repair(this.session.requireDocPtr(),i,e))throw new N(G.Unknown,"form repair failed");return{acroformCreated:0!==Number(r.peek(e,"i32",0)),fieldsLinked:Number(r.peek(e,"i32",4)),widgetsLinked:Number(r.peek(e,"i32",8)),fieldsUnrepairable:Number(r.peek(e,"i32",12)),appearancesBaked:Number(r.peek(e,"i32",16)),needsAppearancesCleared:0!==Number(r.peek(e,"i32",20))}});return this.session.invalidateDerived(),{...o,meta:this.emptyMeta()}}createField(e,t,n,r={}){let{objectNumber:i,calculationOrder:o}=this.writeField(e,t,n,r);return{field:this.readBackField(i),calculationOrder:o}}writeField(e,t,n,r={}){hW(t);let{fn:i}=this.runtime,o=this.session.requireDocPtr(),a=(e.widgets??[]).map(t=>ot(ir(e.kind,t))),s=a.map(e=>this.preflightPlacement(e)),l=a.map(t=>Ei(e.kind,t));io(e);let u=ee(e),d=rj(e.purpose),c=eC(e.placeholder),f=ex(e,e.kind)??null,m=rK(e,e.kind);if(void 0!==m){for(let e of a)for(let t of rU)if(e.actions?.[t]!==void 0)throw new N(G.InvalidArg,`\'takesImage\' writes each widget\'s press: name it or a widget\'s actions.${t}, not both`,{details:{field:"takesImage"}});if(m&&0===a.length)throw rX()}if("maxLength"in e&&void 0!==e.maxLength&&(!Number.isInteger(e.maxLength)||e.maxLength<=0))throw new N(G.InvalidArg,`maxLength must be a positive integer, got ${e.maxLength}`,{details:{field:"maxLength"}});let{objectNumber:p,widgetObjectNumbers:h}=r;if(h&&h.length!==a.length)throw new N(G.InvalidArg,`forms.create needs one widget object number per widget: ${h.length} for ${a.length}`,{details:{field:"widgetObjectNumbers"}});for(let e of(void 0!==p&&this.session.claimObjectNumber(p),h??[]))this.session.claimObjectNumber(e);hW(t);let F=this.createFieldNode(e,p);this.configureNewField(e,F),f&&w5(this.runtime,o,F,void 0,eA(f)),function(e,t,n,r,i=new Date){r.userId&&P2(e,t,n,[[PZ,r.userId],[PJ,hH(i)]])}(this.runtime,o,F,n),"group"===u.kind&&P2(this.runtime,o,F,[[PW,u.groupId]]),"anyone"===u.kind&&P3(this.runtime,o,F,!0),null!==d&&P2(this.runtime,o,F,[[PH,d]]),null!==c&&P2(this.runtime,o,F,[[PK,c]]);let g=a.map((e,t)=>{let n=wq(this.runtime,o,s[t],m?{...e,actions:rH(e.actions)}:e,h?.[t],yp(this.runtime,this.session,this.fonts));if(!i.EPDFForm_AttachWidget(o,F,n,l[t],0n,0))throw new N(G.Unknown,"widget adoption failed");return eR(n,e.page)}),_=this.followCalculateScript(F,e.actions?.calculate);return this.session.invalidateDerived(),{objectNumber:F,widgets:g,calculationOrder:_}}nativeDeleteField(e){let{fn:t,mem:n}=this.runtime;return h0(n,[1024,8],([r,i])=>(Ft(n,i,0),t.EPDFForm_DeleteField(this.session.requireDocPtr(),e,r,256,i)))}preflightPlacement(e){let t=this.session.resolvePageRef(e.page),{left:n,bottom:r,right:i,top:o}=e.rect;if(![n,r,i,o].every(Number.isFinite))throw new N(G.InvalidArg,"widget rect must be finite numbers",{details:{field:"rect"}});return t.pageIndex}createFieldNode(e,t){let n,{fn:r,mem:i}=this.runtime,o=i.writeU16String(e.name);try{n=r.EPDFForm_CreateField(this.session.requireDocPtr(),w7[e.kind],o,t??0)}finally{i.free(o)}if(n<=0)throw new N(G.InvalidArg,`cannot create field "${e.name}" (name conflict or invalid)`);return n}configureNewField(e,t){let{fn:n}=this.runtime,r=this.session.requireDocPtr(),{setBits:i,clearBits:o}=w1(e);if((0!==i||0!==o)&&n.EPDFForm_SetFieldFlags(r,t,i,o),"options"in e&&e.options&&this.applyOptions(t,e.options),this.writeDefault(t,{kind:"none"},io(e)),"maxLength"in e&&void 0!==e.maxLength&&!n.EPDFForm_SetFieldMaxLen(r,t,e.maxLength))throw new N(G.InvalidArg,"maxLength rejected");void 0!==e.alternateName&&this.applyWideSetter(n.EPDFForm_SetFieldAlternateName,t,e.alternateName,"alternate name rejected"),void 0!==e.mappingName&&this.applyWideSetter(n.EPDFForm_SetFieldMappingName,t,e.mappingName,"mapping name rejected"),e.actions&&w5(this.runtime,r,t,void 0,e.actions)}setSignatureAppearance(e,t,n){hW(n);let r=this.session.requireDocPtr(),i=gv(this.runtime,this.session),o=wP(this.runtime,i,e);this.assertWritable(o);let a=Di(this.runtime,i,o.fieldIndex,r,w$(this.runtime,this.session));if("signature"!==a.kind)throw new N(G.InvalidArg,`\'${a.name}\' is a ${a.kind} field, not a signature field`);if(wG(this.runtime,r,e=>wS(this.runtime,e).some(e=>e.signed&&"objectNumber"===e.field.kind&&e.field.objectNumber===o.fieldObjectNumber)))throw new N(G.ProtectedDocument,`\'${a.name}\' is signed; its appearance is sealed with the signature`);if(0===a.widgets.length)throw new N(G.InvalidArg,`\'${a.name}\' has no widget to draw into`);let s=this.session.drawingIndex();for(let e of a.widgets)null===t?function(e,t,n){let{fn:r}=e;w2(e,t,n,e=>{if(0!==r.EPDFAnnot_GetDrawing(e)&&!r.EPDFAnnot_GenerateFormFieldAP(e))throw new N(G.Unknown,"the signature field\'s box could not be drawn into the widget")})}(this.runtime,r,e):w3(this.runtime,r,s,e,t);return this.session.invalidateDerived(),{field:this.readBackField(o.fieldObjectNumber)}}setButtonImage(e,t,n){hW(n);let{fn:r,mem:i}=this.runtime,o=this.session.requireDocPtr(),a=gv(this.runtime,this.session),s=wP(this.runtime,a,e);this.assertWritable(s);let l=Di(this.runtime,a,s.fieldIndex,o,w$(this.runtime,this.session));if("pushbutton"!==l.kind)throw new N(G.InvalidArg,`\'${l.name}\' is a ${l.kind} field, not a push button`);let u=l.widgets.filter(e=>null!==e.ref);if(null!==t&&0===u.length)throw new N(G.InvalidArg,`\'${l.name}\' has no widget to show an image in`);let d=0;if(null!==t){let e=wY(t),n=wX(r,i,e,"a push button\'s image",!1,"image");d=Dy(r,i,o,this.session.drawingIndex(),e,n)}for(let e of(hW(n),u))PU(this.runtime,this.session,e.ref,d);return this.session.invalidateDerived(),{field:this.readBackField(s.fieldObjectNumber)}}updateField(e,t,n){hW(n);let{fn:r}=this.runtime,i=this.session.requireDocPtr(),o=gv(this.runtime,this.session),a=wP(this.runtime,o,e);this.assertWritable(a);let s=Di(this.runtime,o,a.fieldIndex,this.session.requireDocPtr(),w$(this.runtime,this.session));var l=t,u=s.kind;if(void 0!==l.kind&&l.kind!==u)throw new N(G.InvalidArg,`patch family \'${l.kind}\' does not match field family \'${u}\'`,{details:{field:"kind"}});let d=new Set([...En,...Er[u]??[]]);for(let[e,t]of Object.entries(l))if(void 0!==t&&!d.has(e))throw new N(G.InvalidArg,`\'${e}\' does not apply to a ${u} field`,{details:{field:e}});let c="defaultValue"in l?l.defaultValue:void 0;if(null!=c&&Array.isArray(c)!==("listbox"===u))throw new N(G.InvalidArg,"listbox"===u?"a list\'s defaultValue is a list of option values":`a ${u} field\'s defaultValue is one string`,{details:{field:"defaultValue"}});let f=et(t,s),m=Y(f),p="anyone"===f.kind,h=P1(this.runtime,o,a.fieldIndex),F=void 0===t.purpose?void 0:rj(t.purpose),g=void 0===t.placeholder?void 0:eC(t.placeholder),_=ex(t,s.kind),P=rK(t,s.kind),D=void 0===P?[]:this.pressesOf(s);if(P){let e=D.filter(e=>null!==e);rJ(e,D.length-e.length)}"defaultValue"in t&&void 0!==t.defaultValue&&ia({field:s,widgets:[]},t);let b=a.fieldObjectNumber;void 0!==t.name&&this.applyWideSetter(r.EPDFForm_SetFieldName,b,t.name,`cannot rename to "${t.name}" (sibling conflict or invalid)`);let{setBits:y,clearBits:w}=w1(t);if((0!==y||0!==w)&&!r.EPDFForm_SetFieldFlags(i,b,y,w))throw new N(G.InvalidArg,"flag update rejected");if("maxLength"in t&&void 0!==t.maxLength&&!r.EPDFForm_SetFieldMaxLen(i,b,t.maxLength??0))throw new N(G.InvalidArg,"maxLength rejected (current value exceeds it)");void 0!==t.alternateName&&this.applyWideSetter(r.EPDFForm_SetFieldAlternateName,b,t.alternateName??"","alternate name rejected"),void 0!==t.mappingName&&this.applyWideSetter(r.EPDFForm_SetFieldMappingName,b,t.mappingName??"","mapping name rejected"),m!==s.groupId&&P2(this.runtime,i,b,[[PW,m]]),p!==h&&P3(this.runtime,i,b,p),void 0!==F&&F!==s.purpose&&P2(this.runtime,i,b,[[PH,F]]),void 0!==g&&g!==s.placeholder&&P2(this.runtime,i,b,[[PK,g]]),void 0===_||eS(_,"format"in s?s.format:null)||w5(this.runtime,i,b,s.actions,eA(_));let E="options"in t&&void 0!==t.options,A="defaultValue"in t&&void 0!==t.defaultValue;if(E||A){let e=ia({field:s,widgets:[]},t).field;"options"in t&&t.options&&this.applyOptions(b,t.options),this.writeDefault(b,s.defaultValueEntry,e.defaultValueEntry),E&&this.writeFieldAfter(b,s,e,!0)}t.actions&&w5(this.runtime,i,b,s.actions,t.actions),void 0!==P&&s.widgets.forEach((e,t)=>{let n=D[t];if(!n||!e.ref)return;let r=rZ(n,P);"keep"!==r.kind&&function(e,t,n,r){let i=gj(e,t,n);try{PM(e,t.requireDocPtr(),i,rQ(r))}finally{e.fn.FPDFPage_CloseAnnot(i)}}(this.runtime,this.session,e.ref,r)});let v=this.followCalculateScript(b,t.actions?.calculate);return this.session.invalidateDerived(),{field:this.readBackField(b),calculationOrder:v}}pressesOf(e){let t=this.session.requireDocPtr();return Pz(this.runtime,t,e.widgets,new PR(this.runtime,t))}reorderCalculations(e,t,n){hW(n);let r=gv(this.runtime,this.session),i=e=>wP(this.runtime,r,e).fieldObjectNumber,o=wK(this.runtime,r),a=e.map(i),s=nD(o,a,"start"===t||"end"===t?t:"before"in t?{before:i(t.before)}:{after:i(t.after)},String);return hW(n),wJ(o,s)||(wZ(this.runtime,this.session.requireDocPtr(),s),this.session.invalidateDerived()),{before:o,after:s,moved:a}}followCalculateScript(e,t){if(void 0===t)return null;let n=wK(this.runtime,gv(this.runtime,this.session)),r=n.includes(e),i=null===t?n.filter(t=>t!==e):r?n:[...n,e];return wJ(n,i)?null:(wZ(this.runtime,this.session.requireDocPtr(),i),{before:n,after:i})}deleteField(e,t){hW(t);let n=gv(this.runtime,this.session),r=wP(this.runtime,n,e);this.assertWritable(r);let i=Di(this.runtime,n,r.fieldIndex,this.session.requireDocPtr(),w$(this.runtime,this.session)),o=i.widgets.map(e=>eR(e.objectNumber,e.page));hW(t);let a=this.followCalculateScript(r.fieldObjectNumber,null);if(!this.nativeDeleteField(r.fieldObjectNumber))throw new N(G.InvalidArg,"field cannot be deleted");this.session.invalidateDerived();let s=new yD(this.runtime,this.session);for(let e of o)e.ref&&s.deleteReleasedWidget(e.ref,r.fieldObjectNumber);return this.session.invalidateDerived(),{deleted:i.ref,removedWidgets:o,calculationOrder:a}}deleteFields(e,t){hW(t);let{fn:n}=this.runtime,r=this.session.requireDocPtr(),i=gv(this.runtime,this.session),o=w$(this.runtime,this.session),a=e.map(e=>{let t=wP(this.runtime,i,e);this.assertWritable(t);let n=Di(this.runtime,i,t.fieldIndex,r,o);return{objectNumber:t.fieldObjectNumber,widgets:n.widgets.map(e=>eR(e.objectNumber,e.page))}}),s=new Set(a.map(e=>e.objectNumber)),l=wK(this.runtime,i),u=l.filter(e=>!s.has(e)),d=wJ(l,u)?null:{before:l,after:u};for(let{objectNumber:e}of(hW(t),d&&wZ(this.runtime,r,u),a))if(!this.nativeDeleteField(e))throw new N(G.InvalidArg,"field cannot be deleted");let c=a.flatMap(e=>e.widgets),f=new Map;for(let e of c){if(!e.ref||!e.page)continue;let t=f.get(e.page.objectNumber)??[];t.push(e.objectNumber),f.set(e.page.objectNumber,t)}for(let[e,t]of f){gx(this.runtime,this.session,e);let{pageIndex:i}=this.session.resolvePageRef(q(e));for(let o of t.map(e=>n.EPDFPage_GetAnnotIndexByObjectNumberRaw(r,i,e)).filter(e=>e>=0).sort((e,t)=>t-e))if(!n.EPDFPage_RemoveAnnotRaw(r,i,o))throw new N(G.Unknown,`a widget could not leave page ${e}`)}return this.session.invalidateDerived(),{removedWidgets:c,calculationOrder:d}}addWidget(e,t,n,r={}){let{objectNumber:i,splitObjectNumber:o}=r,{field:a,widgets:s}=this.addWidgets(e,[{placement:t}],n,{...void 0!==i?{objectNumbers:[i]}:{},...void 0!==o?{splitObjectNumber:o}:{}});return{field:a,widget:s[0]}}addWidgets(e,t,n,r={}){hW(n);let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s=gv(this.runtime,this.session),l=wP(this.runtime,s,e);this.assertWritable(l);let u=Di(this.runtime,s,l.fieldIndex,a,w$(this.runtime,this.session)),d="pushbutton"===u.kind&&u.takesImage,c=t.map(({placement:e})=>{let t=ot(ir(u.kind,e));return d?{...t,actions:rH(t.actions)}:t}),f=c.map(e=>this.preflightPlacement(e)),m=c.map(e=>Ei(u.kind,e)),p="checkbox"===u.kind||"radio"===u.kind,h=p?function(e,t,n=[]){let r="checkbox"===e.kind||"radio"===e.kind,i=r?e.widgets:[],o=new Map;for(let e of i)""===e.onState||o.has(e.exportValue)||o.set(e.exportValue,e.onState);let a=new Set(i.map(e=>e.onState)),s=r&&e.hasValuesList;return t.map((e,t)=>{let r=n[t]??o.get(e)??(s?(()=>{let e=0;for(;a.has(String(e));)e+=1;return String(e)})():e);return a.add(r),o.has(e)||o.set(e,r),r})}(u,m,t.map(e=>e.onState)):m,{objectNumbers:F}=r;if(F&&F.length!==t.length)throw new N(G.InvalidArg,`one widget object number per widget: ${F.length} for ${t.length}`,{details:{field:"objectNumbers"}});let g="pushbutton"===u.kind&&u.hasImage?this.imageOf(u):0,_=u.widgets.find(e=>e.objectNumber===l.fieldObjectNumber)?.page??null;for(let e of F??[])this.session.claimObjectNumber(e);let P=_?r.splitObjectNumber:void 0;if(void 0!==P&&this.session.claimObjectNumber(P),hW(n),_&&gx(this.runtime,this.session,_.objectNumber),r.radiosInUnison){let{setBits:e,clearBits:t}=w1({radiosInUnison:!0});i.EPDFForm_SetFieldFlags(a,l.fieldObjectNumber,e,t)}let D=yp(this.runtime,this.session,this.fonts),b=c.map((e,n)=>{let r,s=wq(this.runtime,a,f[n],e,F?.[n],D),u=p?o.writeU16String(m[n]):0n;try{r=i.EPDFForm_AttachWidget(a,l.fieldObjectNumber,s,h[n],u,(0===n?P:void 0)??0)}finally{0n!==u&&o.free(u)}if(!r)throw new N(G.InvalidArg,"the widget could not join the field");let d=eR(s,e.page);0!==g&&PU(this.runtime,this.session,d.ref,g);let c=t[n].flags;return c&&wH(this.runtime,this.session,d,c),d}),y=m.map(e=>(function(e,t,n=!1){return("checkbox"===e.kind||"radio"===e.kind)&&("radio"!==e.kind||!!e.radiosInUnison||!!n)&&e.widgets.some(e=>e.checked&&e.exportValue===t)})(u,e,r.radiosInUnison));if(y.some(Boolean)){let e=[...u.widgets.map(e=>e.checked),...y];if(null===this.withChangedWidgets((t,n,r)=>h1(this.runtime.mem,e.map(e=>+!!e),(e,o)=>i.EPDFForm_SetFieldWidgetsChecked(a,l.fieldObjectNumber,e,o,t,n,r))))throw new N(G.Unknown,"the new widgets could not take the field\'s value")}this.session.invalidateDerived();let w=this.readBackField(l.fieldObjectNumber);if(p){let e=new Map(w.widgets.map(e=>[e.objectNumber,"exportValue"in e?e.exportValue:null]));for(let[t,n]of b.entries()){let r=e.get(n.objectNumber);if(null!=r&&r!==m[t])throw new N(G.Unknown,`a new widget of \'${u.name}\' reads \'${r}\', not \'${m[t]}\'`)}}return{field:w,widgets:b}}imageOf(e){for(let t of e.widgets){if(null===t.ref)continue;let e=PV(this.runtime,this.session,t.ref);if(0!==e)return e}return 0}detachWidget(e,t,n){hW(n);let{fn:r}=this.runtime,i=gv(this.runtime,this.session),o=wP(this.runtime,i,e);this.assertWritable(o);let a=Eo(t);if(a===o.fieldObjectNumber)throw new N(G.InvalidArg,`widget ${a} is the field\'s own dictionary (a merged field/widget) and cannot be removed from it - delete the field with doc.forms.delete`);if(!r.EPDFForm_DetachWidget(this.session.requireDocPtr(),o.fieldObjectNumber,a))throw new N(G.InvalidArg,"widget is not attached to this field");return this.session.invalidateDerived(),{field:this.readBackField(o.fieldObjectNumber),widget:eR(Eo(t),t.page)}}applyOptions(e,t){let{fn:n}=this.runtime,r=this.session.requireDocPtr();if(!gf(this.runtime,t.map(e=>e.label),i=>gf(this.runtime,t.map(e=>e.value),(t,o)=>n.EPDFForm_SetFieldOptions(r,e,i,t,o))))throw new N(G.InvalidArg,"options rejected")}applyWideSetter(e,t,n,r){let{mem:i}=this.runtime,o=this.session.requireDocPtr(),a=i.writeU16String(n);try{if(!e(o,t,a))throw new N(G.InvalidArg,r)}finally{i.free(a)}}writeDefault(e,t,n){if(r7(t,n))return;let r=this.session.requireDocPtr();if(!w8(this.runtime,r,e,n,"default"))throw new N(G.InvalidArg,"default value rejected")}readBackField(e){let t=gv(this.runtime,this.session),n=this.runtime.fn.EPDFForm_GetFieldIndexByObjNum(t,e);if(n<0)throw new N(G.Unknown,"form field vanished after write");return Di(this.runtime,t,n,this.session.requireDocPtr(),w$(this.runtime,this.session))}assertWritable(e){if(0===e.fieldObjectNumber)throw new N(G.InvalidArg,"form field is stored as a direct object and cannot be written");this.assertNotLockedBySignature(e)}assertNotLockedBySignature(e){let t=wz(this.runtime,this.session);if(!t)return;let n=gv(this.runtime,this.session);var r=h3(this.runtime.mem,(t,r)=>this.runtime.fn.EPDFForm_GetFieldName(n,e.fieldIndex,t,r))??"";let i=t?.(r);if(i)throw new N(G.ProtectedDocument,`form field "${r}" is locked by signature ${i.signatureIndex} (${"fieldmdp"===i.source?"FieldMDP":"/Lock"})`)}writeFieldAfter(e,t,n,r=!1){let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s="checkbox"===n.kind||"radio"===n.kind?n.widgets:null,l=!r7(t.valueEntry,n.valueEntry),u=s?.some((e,n)=>e.checked!==t.widgets[n]?.checked)??!1;if(!l&&!u&&!r)return null;let d=()=>new N(G.InvalidArg,`\'${n.name}\' could not take the value`);if(l&&!w8(this.runtime,a,e,n.valueEntry,"value"))throw d();if("combobox"===n.kind||"listbox"===n.kind){var c;let t=n.options.flatMap((e,t)=>e.selected?[t]:[]);if(c=this.runtime,!h1(c.mem,t,(t,n)=>c.fn.EPDFForm_SetFieldSelectedIndices(a,e,t,n)))throw d()}if(s?.length===0)return[];let f=this.withChangedWidgets((t,n,r)=>s?h1(o,s.map(e=>+!!e.checked),(o,s)=>i.EPDFForm_SetFieldWidgetsChecked(a,e,o,s,t,n,r)):i.EPDFForm_RedrawFieldWidgets(a,e,t,n,r));if(null===f)throw d();return f}withChangedWidgets(e){let{mem:t}=this.runtime;return h0(t,[1024,8],([n,r])=>{if(Ft(t,r,0),!e(n,256,r))return null;let i=Math.min(Number(t.peek(r,"i32")),256),o=[];for(let e=0;ea.has(e.objectNumber)).map(e=>eR(e.objectNumber,e.page));return{field:o,meta:y4(this.session.writeStamp(),[o.ref],s,void 0===n?y8(o.kind,s):n?s:[])}}},En=["kind","name","readOnly","required","noExport","alternateName","mappingName","groupId","assignment","purpose","placeholder","actions"],Er={text:["defaultValue","maxLength","multiline","password","comb","format"],radio:["radiosInUnison","noToggleToOff"],combobox:["edit","defaultValue","options","format"],listbox:["multiSelect","options","defaultValue"],pushbutton:["takesImage"]};function Ei(e,t){let{exportValue:n}=t;if("checkbox"!==e&&"radio"!==e){if(void 0!==n)throw new N(G.InvalidArg,`\'exportValue\' applies to checkbox and radio widgets, not a ${e} field\'s`,{details:{field:"exportValue"}});return""}let r=n??("checkbox"===e?"Yes":void 0);if(!r||"Off"===r)throw new N(G.InvalidArg,"radio"===e?\'every radio button needs an exportValue other than "Off"\':"a checkbox\'s exportValue can\'t be \\"Off\\"",{details:{field:"exportValue"}});return r}function Eo(e){if("objectNumber"!==e.kind)throw new N(G.InvalidArg,"widget must be addressed by object number");return e.objectNumber}function Ea(e,t,n,r,i,o){let a=()=>wK(e,gv(e,t)),s=a(),l=gF(e,t),u=new Et(e,t,n),d=r.map((n,r)=>{let{groupId:i,assignment:a,...s}=i6(n.draft,l),d=o.assignmentOf(a??X(i??null)),[c,...f]=n.objectNumbers??[],{objectNumber:m,widgets:p}=u.writeField({...s,assignment:d},o.signal,o.actor,void 0===c?{}:{objectNumber:c,widgetObjectNumbers:f});return p.forEach((r,i)=>wH(e,t,r,n.flags[i])),n.images?.forEach((n,r)=>{let i=p[r];n&&i?.ref&&PU(e,t,i.ref,function(e,t,n){if("drawing"in n)return n.drawing;let{fn:r,mem:i}=e,o=wX(r,i,n.bytes,"a push button\'s image",!1,"image");return Dy(r,i,t.requireDocPtr(),t.drawingIndex(),n.bytes,o)}(e,t,n))}),t.invalidateDerived(),n.value&&u.setValue(Es(m),n.value,o.signal),o.made?.(m,r),m}),c=i.map(e=>Es(d[e]));c.length>0&&u.reorderCalculations(c,"end",o.signal),t.invalidateDerived();let f=a(),m=d.map(n=>{let r=gv(e,t);return Di(e,r,e.fn.EPDFForm_GetFieldIndexByObjNum(r,n),t.requireDocPtr(),w$(e,t))});return wV(e,t,{fields:m,...wJ(s,f)?{}:{calculationOrder:f.map(Es)},meta:y4(t.writeStamp(),m.map(e=>e.ref),m.flatMap(e=>e.widgets))},n)}function Es(e){return{kind:"objectNumber",objectNumber:e}}function El(e){let{groupOf:t,assignmentOf:n}=e;return n||(t?e=>"anyone"===e.kind?e:X(t(Y(e))):e=>e)}var Eu=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}copy(e,t){hW(t),y0(e.limits,"items",e.fields.length),e.page&&this.session.resolvePageRef(e.page);let n=i8(new wW(this.runtime,this.session,this.fonts).snapshot(t),gF(this.runtime,this.session)),r=function(e){let t=function(e){let{form:t,mayScript:n,placement:r}=e,i=new Map(t.widgets.map(e=>[K(e.ref),e])),o=e.widgets?new Set(e.widgets.map(K)):null,a=new Set(t.fields.map(e=>e.name)),s=r.offset??{x:0,y:0},l=[],u=[],d=[],c=new Set;for(let f of(e.fields.forEach((f,m)=>{let p=t.fields.find(e=>ae(e,f));if(!p)throw new N(G.NotFound,`copy: no form field ${eM(f)}`,{details:{item:m}});let h=p.widgets.flatMap(e=>{let t=e.ref?i.get(K(e.ref)):void 0;return t&&(!o||o.has(K(t.ref)))?[t]:[]}),F=aa(p,h);for(let e of h)c.add(K(e.ref));if(o&&0===h.length)throw new N(G.InvalidArg,`copy: \'widgets\' names no widget of field ${m}`,{details:{item:m,field:"widgets"}});if("unknown"===F.kind)return void l.push({ref:F.ref,reason:"unsupported-kind"});let g=af(F.name,e=>ac(a,e));a.add(g);let _=ao(F,n,l),P=h.map(e=>{let t;return{...t=as(F,e,e=>e,n,l),...r.page?{page:r.page}:{},...t.rect?{rect:{...t.rect,x:t.rect.x+s.x,y:t.rect.y+s.y}}:{}}}),D=e.values&&"signature"!==F.kind&&ar(F)?ad(F):null;d.push(p),u.push({source:m,draft:au(F,g,_,P,`copy: field ${m}`),widgets:h.map(e=>e.ref),flags:h.map(al),...D?{value:D}:{}})}),o??[]))if(!c.has(f))throw new N(G.InvalidArg,`copy: widget ${f} is a widget of none of the fields`,{details:{field:"widgets"}});return{creates:u,calculationOrder:t.calculationOrder.flatMap(e=>e?u.flatMap((t,n)=>ae(d[n],e)&&t.draft.actions?.calculate?[n]:[]):[]),dropped:l}}(e);for(let e of t.creates)hT(e.draft,`copy: field ${e.source}`,{item:e.source});return t}({form:n,fields:e.fields,...e.widgets?{widgets:e.widgets}:{},placement:{...e.page?{page:e.page}:{},...e.offset?{offset:e.offset}:{}},values:e.values,mayScript:e.mayScript}),{objectNumbers:i}=e,o=r.creates.reduce((e,t)=>e+1+t.widgets.length,0);if(i&&i.length!==o)throw new N(G.InvalidArg,`copy: objectNumbers names ${i.length} objects of ${o}`,{details:{field:"objectNumbers"}});let a=0,s=Ea(this.runtime,this.session,this.fonts,r.creates.map(t=>{let n=1+t.widgets.length,r=i?.slice(a,a+n);a+=n;let o=e.values&&"pushbutton"===t.draft.kind?t.widgets.map(e=>{let t=PV(this.runtime,this.session,e);return 0===t?null:{drawing:t}}):void 0;return{...t,...r?{objectNumbers:r}:{},...o?{images:o}:{}}}),r.calculationOrder,{actor:e.actor,assignmentOf:El(e),signal:t});return{...s,refMap:r.creates.map((t,r)=>({from:n.fields.find(n=>ae(n,e.fields[t.source])).ref,to:s.fields[r].ref})),dropped:[...r.dropped]}}},Ed=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}import(e,t){hW(t),yI(this.runtime,"form",e.bundle,e.limits,rw);let n=rb(e.bundle),r=this.fieldNames(),i=function(e){let{bundle:t,mayScript:n}=e,r=tP({bundlePages:t.pages,pages:e.pages??"same",target:e.target,named:t.widgets.flatMap(e=>rB(e.data))}),i=new Map(t.widgets.map((e,t)=>[K(e.data.ref),t])),o=new Set,a=[],s=new Set,l=[];return t.fields.forEach(({data:u},d)=>{var c,f,m,p;let h,F=u.widgets.flatMap(e=>{let t=e.ref?i.get(K(e.ref)):void 0;return void 0===t?[]:[t]});for(let e of F)o.add(e);let g=aa(u,F.map(e=>t.widgets[e].data));if("unknown"===g.kind)return void a.push({ref:g.ref,reason:"unsupported-kind"});if(s.has(g.name)||e.nameTaken(g.name))return void a.push({ref:g.ref,reason:"name-conflict"});s.add(g.name);let _=(c=g,f=ao(g,n,a),m=F.map(e=>as(g,t.widgets[e].data,r,n,a)),p=d,h=`import: field ${p}`,hT(au(c,c.name,f,m,h),h,{item:p})),P=e.values&&ar(g)?ad(g):null;l.push({field:d,draft:_,widgets:F,flags:F.map(e=>al(t.widgets[e].data)),...P?{value:P}:{}})}),t.widgets.forEach((e,t)=>{o.has(t)||a.push({ref:e.data.field,widget:e.data.ref,reason:"no-field"})}),{creates:l,calculationOrder:t.calculationOrder.flatMap(e=>{let n=l.findIndex(n=>eM(t.fields[n.field].data.ref)===eM(e)&&n.draft.actions?.calculate);return n<0?[]:[n]}),dropped:a}}({bundle:n,...void 0!==e.pages?{pages:e.pages}:{},target:this.session.allRecords().map(e=>({page:q(e.pageObjectNumber),position:e.pageIndex})),nameTaken:e=>ac(r,e),mayScript:e.mayScript,values:e.values}),o=this.session.requireDocPtr(),a=e.actor.userId??null,s="restore"===e.attribution,l=i.creates.map(t=>{if(!e.values||"pushbutton"!==t.draft.kind)return t;let r=t.widgets.map(e=>{let t=n.widgets[e]?.resources.image,r=void 0===t?void 0:n.resources[t];return r?{bytes:r}:null});return r.some(Boolean)?{...t,images:r}:t}),u=Ea(this.runtime,this.session,this.fonts,l,i.calculationOrder,{actor:e.actor,assignmentOf:El(e),signal:t,made:(e,t)=>{var r;if(!s)return;let l=n.fields[i.creates[t].field].data;r=this.runtime,P2(r,o,e,[[PZ,l.createdBy],[PJ,l.createdAt?hH(l.createdAt):null],[PQ,a]])}});return{...u,refMap:i.creates.map((e,t)=>({from:n.fields[e.field].data.ref,to:u.fields[t].ref})),dropped:[...i.dropped]}}planValues(e,t,n,r){var i;let o,a;hW(n),yI(this.runtime,"form",e,t,rw);let s=wz(this.runtime,this.session),l=(i={bundle:e,target:this.readFields(),refusal:(e,t)=>{if("objectNumber"!==e.ref.kind)return"value-not-allowed";try{r4(e,t)}catch(e){if(N.is(e))return"value-not-allowed";throw e}return s?.(e.name)?"locked":r(e)?null:"fill-not-allowed"}},o=[],a=[],i.bundle.fields.forEach(({data:e},t)=>{let n=ar(e)?ad(e):null;if(!n)return;let r=i.target.find(t=>ae(t,{kind:"fqn",name:e.name}));if(r)if(r.kind!==e.kind)a.push({ref:e.ref,reason:"wrong-kind"});else{let s=i.refusal?.(r,n);s?a.push({ref:e.ref,reason:s}):o.push({field:t,target:r,value:n})}else a.push({ref:e.ref,reason:"no-field"})}),{writes:o,dropped:a});return{writes:l.writes.filter(({target:e,value:t})=>!function(e,t){switch(t.kind){case"text":return"text"===e.kind&&e.value===t.value;case"toggle":return("checkbox"===e.kind||"radio"===e.kind)&&e.widgets.every(e=>e.checked===(e.onState===t.state));case"choice":if("combobox"===e.kind)return 0===t.values.length?""===e.value:e.value===t.values[0];return"listbox"===e.kind&&e.selectedValues.length===t.values.length&&e.selectedValues.every((e,n)=>e===t.values[n])}}(e,r4(e,t))),dropped:l.dropped}}writeValue(e,t){return new Et(this.runtime,this.session,this.fonts).setValue(e.target.ref,e.value,t),this.readField(function(e){if("objectNumber"!==e.kind)throw Error("a written field has an object number");return e.objectNumber}(e.target.ref))}fieldNames(){let{fn:e,mem:t}=this.runtime,n=gv(this.runtime,this.session),r=new Set;for(let i=0;ie.EPDFForm_GetFieldName(n,i,t,r));o&&r.add(o)}return r}readFields(){let e=gv(this.runtime,this.session),t=this.session.requireDocPtr();return Array.from({length:this.runtime.fn.EPDFForm_CountFields(e)},(n,r)=>Di(this.runtime,e,r,t,w$(this.runtime,this.session)))}readField(e){let t=gv(this.runtime,this.session),n=this.runtime.fn.EPDFForm_GetFieldIndexByObjNum(t,e);return Di(this.runtime,t,n,this.session.requireDocPtr(),w$(this.runtime,this.session))}},Ec=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}plan(e,t){hW(t);let n=this.session.requireDocPtr(),r=gF(this.runtime,this.session),i=e=>{let t=this.session.resolvePageRef(e),i=q(t.pageObjectNumber),o=r(i);return{ref:i,size:{width:o.right-o.left,height:o.top-o.bottom},rotation:g_(this.runtime,n,t.pageIndex)}},o=("all"===e.pages?this.session.allRecords().sort((e,t)=>e.pageIndex-t.pageIndex).map(e=>q(e.pageObjectNumber)):e.pages).map(i),a=function(e){let t=function(e){let{form:t,mayScript:n}=e,{as:r,field:i,template:o,from:a,targets:s}=function(e){let{form:t,limits:n}=e,r=t.fields.find(t=>ae(t,e.field));if(!r)throw new N(G.NotFound,`repeat: no form field ${eM(e.field)}`);let i=e.as??ap(r),o=function(e,t,n=ap(t)){return"signature"===t.kind?"a signature field shows in one place: a signer signs once":"unknown"===t.kind?"a field of a kind the engine does not model":am(e,t).length>0?null:"the field shows on no page"}(t,r,i);if(o)throw new N(G.InvalidArg,`repeat: ${o}`,{details:{field:"field"}});let a=am(t,r),s=a[0].page,l=e.pageOf(s);if(!l)throw new N(G.NotFound,`repeat: no page ${s.objectNumber}`);let u=new Set("boxes"===i?r.widgets.flatMap(e=>e.page?.objectNumber??[]):[s.objectNumber]),d=[];for(let t of e.pages)u.has(t.ref.objectNumber)||(u.add(t.ref.objectNumber),d.push(t));let c=d.length*("boxes"===i?a.length:1+a.length);return aF(n,"pages",d.length),aF(n,"items",c),{as:i,field:r,template:a,from:l,targets:d,count:c}}(e),l={as:r,field:i,pages:s.map(e=>e.ref)},u={widgets:[],unison:!1,splits:!1,creates:[],calculationOrder:[]};if(0===s.length)return{...l,...u,dropped:[],needs:0};let d=[],c="fields"===r?aa(i,o):i,f=o.map(e=>{let{rect:t,box:r,rotation:i,...o}=as(c,e,e=>e,n,d);return{row:e,look:o,place:{rect:e.rect,rotation:e.rotation??0}}}),m=e=>f.map(({look:t,place:n})=>{let r,i,o,{rect:s,rotation:l}=(i=Math.min((r=ah(a.rotation)===ah(e.rotation)&&a.size.width===e.size.width&&a.size.height===e.size.height?n.rect:function(e,t){let{x:n,y:r,width:i,height:o}=t,{width:a,height:s}=e.size;switch(ah(e.rotation)){case 90:return{x:r,y:s-n-i,width:o,height:i};case 180:return{x:a-n-i,y:s-r-o,width:i,height:o};case 270:return{x:a-r-o,y:n,width:o,height:i};default:return{x:n,y:r,width:i,height:o}}}(e,function(e,t){let{x:n,y:r,width:i,height:o}=t,{width:a,height:s}=e.size;switch(ah(e.rotation)){case 90:return{x:s-r-o,y:n,width:o,height:i};case 180:return{x:a-n-i,y:s-r-o,width:i,height:o};case 270:return{x:r,y:a-n-i,width:o,height:i};default:return{x:n,y:r,width:i,height:o}}}(a,n.rect))).width,e.size.width),o=Math.min(r.height,e.size.height),{rect:{x:Math.min(Math.max(r.x,0),Math.max(e.size.width-i,0)),y:Math.min(Math.max(r.y,0),Math.max(e.size.height-o,0)),width:i,height:o},rotation:ah(n.rotation+a.rotation-e.rotation)});return{...t,page:e.ref,rect:s,...l?{rotation:l}:{}}});if("boxes"===r){let e=new Map("checkbox"===i.kind||"radio"===i.kind?i.widgets.flatMap(e=>e.ref?[[K(e.ref),e.onState]]:[]):[]),t=s.flatMap(t=>m(t).map((t,n)=>{let r=f[n].row.ref,i=e.get(K(r));return{source:r,placement:t,flags:al(f[n].row),...i?{onState:i}:{}}})),n="objectNumber"===i.ref.kind&&i.widgets.some(e=>e.objectNumber===i.ref.objectNumber);return{...l,...u,widgets:t,unison:"radio"===i.kind&&!i.radiosInUnison,splits:n,dropped:d,needs:t.length+ +!!n}}let p=new Set(t.fields.map(e=>e.name)),h=ao(c,n,d),F=f.map(({row:e})=>al(e)),g=f.map(({row:e})=>e.ref),_=c.name,P=s.map(e=>(_=af(_,e=>ac(p,e)),p.add(_),{source:0,draft:au(c,_,h,m(e),"repeat: the field"),widgets:g,flags:F})),D=t.calculationOrder.some(e=>null!==e&&ae(i,e));return{...l,...u,creates:P,calculationOrder:D?P.flatMap((e,t)=>e.draft.actions?.calculate?[t]:[]):[],dropped:d,needs:P.length*(1+o.length)}}(e);for(let e of t.creates)hT(e.draft,"repeat: the field",{});return t}({form:i8(this.read(e.field),r),field:e.field,pages:o,pageOf:i,...e.as?{as:e.as}:{},mayScript:e.mayScript,limits:e.limits}),{objectNumbers:s}=e;if(s&&s.length!==a.needs)throw new N(G.InvalidArg,`repeat: objectNumbers names ${s.length} objects of ${a.needs}`,{details:{field:"objectNumbers"}});return a}read(e){let t=Do(this.runtime,gv(this.runtime,this.session),this.session.requireDocPtr(),w$(this.runtime,this.session)),n=t.fields.find(t=>ae(t,e));return{...t,widgets:n?wU(this.runtime,this.session,n.widgets,this.fonts):[]}}addBoxes(e,t,n){let r=gF(this.runtime,this.session),i=e.widgets.length,o=e.splits?t?.[i]:void 0,a=new Set(e.field.widgets.map(e=>e.objectNumber)),{field:s,widgets:l}=new Et(this.runtime,this.session,this.fonts).addWidgets(e.field.ref,e.widgets.map(({placement:e,flags:t,onState:n})=>({placement:i2(e,r),flags:t,...void 0!==n?{onState:n}:{}})),n,{...t?{objectNumbers:t.slice(0,i)}:{},...void 0!==o?{splitObjectNumber:o}:{},radiosInUnison:e.unison});for(let e of l)a.add(e.objectNumber);return{field:s,added:l,split:s.widgets.filter(e=>!a.has(e.objectNumber))}}createFields(e,t,n){let r=0;return Ea(this.runtime,this.session,this.fonts,e.creates.map(e=>{let n=1+e.widgets.length,i=t.objectNumbers?.slice(r,r+n);return r+=n,{...e,...i?{objectNumbers:i}:{}}}),e.calculationOrder,{actor:t.actor,assignmentOf:t.assignmentOf,signal:n})}},Ef=["AP","MK"],Em=new Set(["text","checkbox","radio","combobox","listbox"]),Ep=new Set(["forms.setValue","forms.setDisplay","forms.setAppearanceText","forms.reset","forms.setSignatureAppearance","forms.setButtonImage"]);function Eh(e,t){let n=t.field.widgets.find(e=>e.objectNumber===t.objectNumber&&e.page);if(!n?.page)return{split:null,mergedEntry:null};let{pageIndex:r}=e.session.resolvePageRef(n.page),i=e.session.requireDocPtr(),o=e.runtime.fn.EPDFPage_GetAnnotIndexByObjectNumberRaw(i,r,n.objectNumber);return o<0?{split:null,mergedEntry:null}:{split:n,mergedEntry:yC(e.runtime,i,r,[o])}}function EF(e,t,n,r,i,o){let a={kind:"widgets.added",reports:t,direction:"remove",fieldObjectNumber:n,added:i,split:o.merged&&o.mergedEntry&&o.widget?{merged:o.merged,mergedEntry:o.mergedEntry,widget:o.widget}:null,objects:yQ(e.runtime,e.session,r),guards:[],kids:[],states:[],values:[],widgets:[],captures:[]},{field:s}=EU(e,n),l=new Map(s.widgets.map(e=>[e.objectNumber,"onState"in e?{state:e.onState,value:e.exportValue}:null])),u=E_(a);return{...a,guards:EP(e,u),kids:s.widgets.map(e=>e.objectNumber),states:u.map(e=>l.get(e.objectNumber)?.state??""),values:u.map(e=>l.get(e.objectNumber)?.value??"")}}var Eg=e=>e.split?[e.split.merged,e.split.widget]:[],E_=e=>e.split?[e.split.widget,...e.added]:[...e.added];function EP(e,t){return yQ(e.runtime,e.session,t.map(e=>({objectNumber:e.objectNumber,deep:[],before:null})))}function ED(e,t){return EW(e,t)?.field.widgets.map(e=>e.objectNumber)??null}function Eb(e){let{fn:t,mem:n}=e.runtime,r=gv(e.runtime,e.session),i=new Set,o=t.EPDFForm_CountFields(r);for(let e=0;et.EPDFForm_GetFieldName(r,e,n,i));o&&i.add(o)}return i}function Ey(e,t,n,r=[],i=!1){let{field:o}=EU(e,t);return{type:"forms.repeat",as:"boxes",...E0(e,{fields:[o],meta:y4(e.session.writeStamp(),[o.ref],[...n])}),dropped:r,...i?{undone:!0}:{}}}function Ew(e,t,n){return{type:"forms.reorderCalculations",calculationOrder:t.map(EM),meta:y4(e.session.writeStamp(),n.map(EM),[])}}function EE(e,t){if(!o8(e.authority,t.field.assignment,"fill")){var n,r;if(n=e,r=t,r.field.actions?.calculate&&wK(n.runtime,gv(n.runtime,n.session)).includes(r.objectNumber)&&e.fillsOwnField())return void oY(e.authority,"doc.forms.fill");o4(e.authority,t.field.assignment,"fill")}}function EA(e){!function(e,t){let{grants:n,protection:r}=e;return!(r&&iR(r).has(o9(t)))&&(!n||iZ(t,n.scope,n.permissionFlags,r))}(e.authority,"fill")&&oQ(e.authority,"doc.forms.fill")}function Ev(e,t){return o7(e.authority,t),t}function ES(e,t,n){return{kind:"field.remove",objectNumber:EK(t.ref),left:t,widgets:EP(e,t.widgets),...n?{rights:n}:{}}}function Ek(e,t){let n=t.ref;gx(e.runtime,e.session,n.page.objectNumber);let r=wm(e,n),i=t.field?E$(e,t.field):null;if(i&&i.objectNumber===r)throw new N(G.InvalidArg,`widget ${r} is its field\'s own dictionary (a merged field/widget) - delete the field with doc.forms.delete`,{details:{field:"widget"}});let o=[];if(i){let t=yJ(e.runtime,e.session,[{objectNumber:i.objectNumber,deep:[]},{objectNumber:r,deep:[]}]);new Et(e.runtime,e.session,e.fonts).detachWidget({kind:"objectNumber",objectNumber:i.objectNumber},n,e.signal),o=yQ(e.runtime,e.session,t)}let{pageIndex:a,index:s}=gC(e.runtime,e.session,n),l=yC(e.runtime,e.session.requireDocPtr(),a,[s]);new yD(e.runtime,e.session,e.fonts).deleteReleasedWidget(n,0),e.session.invalidateDerived();let u=i?EU(e,i.objectNumber).field:null;return{item:{type:"forms.deleteWidget",widget:n,page:n.page,field:u,meta:y4(e.session.writeStamp(),u?[u.ref]:[],[{ref:n,objectNumber:r,page:n.page}])},reverse:[{kind:"widget.restore",page:n.page,widget:n,capture:l,fieldObjectNumber:i?.objectNumber??null,detached:o}]}}function Ex(e,t,n){let r={kind:"objectNumber",objectNumber:t.objectNumber},i=yJ(e.runtime,e.session,EH(t)),o=new Et(e.runtime,e.session,e.fonts).setValue(r,n,e.signal),a=yQ(e.runtime,e.session,i),s={type:"forms.setValue",...E0(e,o)};return 0===o.meta.changedWidgets.length&&yV(EQ(t.field),EQ(o.field))?{item:s,reverse:[]}:{item:s,reverse:[{...EL("forms.setValue",a,[t.objectNumber]),fallback:{kind:"value",fields:[{objectNumber:t.objectNumber,before:EQ(t.field),left:EQ(o.field)}]}}]}}function EG(e,t,n,r){let i=!1,o=ER(e,r,t,()=>(i=n(new Et(e.runtime,e.session,e.fonts)).meta.changedWidgets.length>0,{field:EU(e,r.objectNumber).field}));return i?o:{item:o.item,reverse:[]}}function EO(e,t,n){let r={kind:"objectNumber",objectNumber:t.objectNumber},i=null;return EN(e,ER(e,t,"forms.update",()=>{let t=new Et(e.runtime,e.session,e.fonts).updateField(r,n,e.signal);return i=t.calculationOrder,t},e=>{let r=EZ(t.field),i=EZ(e),o=[...new Set(Object.keys(n).map(EI))].filter(e=>"kind"!==e&&!yV(r[e],i[e]));return{kind:"properties",objectNumber:t.objectNumber,restore:EJ(r,o),left:EJ(i,o)}}),i)}function EI(e){return"format"===e?"actions":"groupId"===e?"assignment":e}function EN(e,t,n){return!n||iA(t.item)?t:{item:{...t.item,...EC(n)},reverse:[...t.reverse,Ej(n)]}}function EC(e){return e?{calculationOrder:e.after.map(EM)}:{}}function Ej({before:e,after:t}){return{kind:"calculations.restore",before:e,after:t}}function EM(e){return{kind:"objectNumber",objectNumber:e}}function ER(e,t,n,r,i){let o=yJ(e.runtime,e.session,EH(t)),{field:a}=r(),s=EL(n,yQ(e.runtime,e.session,o),[t.objectNumber]);return{item:E3(e,n,[a]),reverse:[i?{...s,fallback:i(a)}:s]}}function ET(e,t,n){let r=yB(e.runtime,e.session.requireDocPtr(),t.objectNumber),i={kind:"objectNumber",objectNumber:t.objectNumber},{deleted:o,removedWidgets:a,calculationOrder:s}=new Et(e.runtime,e.session).deleteField(i,e.signal);return EN(e,{item:{type:"forms.delete",meta:y4(e.session.writeStamp(),[o],a)},reverse:[{kind:"field.restore",objectNumber:t.objectNumber,name:t.field.name,pages:t.field.widgets.flatMap(e=>e.page?[e.page]:[]),capture:r,...n?{rights:n}:{}}]},s)}function EB(e){return new Set(Eq(e).map(({objectNumber:e})=>e))}function EL(e,t,n){return{kind:"objects.revert",reports:e,objects:t,subject:{fields:n}}}function E$(e,t){let n=gv(e.runtime,e.session),r=wP(e.runtime,n,t),i=Di(e.runtime,n,r.fieldIndex,e.session.requireDocPtr(),w$(e.runtime,e.session));return{objectNumber:r.fieldObjectNumber,field:i}}function Ez(e,t){try{let n=wd(e,t);return"widget"===n.subtype?n:null}catch(e){if(N.is(e))return null;throw e}}function EU(e,t){return E$(e,{kind:"objectNumber",objectNumber:t})}function EV(e,t){try{return E$(e,t)}catch{return null}}function EW(e,t){return EV(e,{kind:"objectNumber",objectNumber:t})}function Eq(e){let t=gv(e.runtime,e.session),n=e.runtime.fn.EPDFForm_CountFields(t),r=[];for(let i=0;i({objectNumber:e.objectNumber,deep:Ef}))]}function EK(e){return"objectNumber"===e.kind?e.objectNumber:0}function EZ(e){let t={name:e.name.slice(e.name.lastIndexOf(".")+1),readOnly:e.readOnly,required:e.required,noExport:e.noExport,alternateName:e.alternateName,mappingName:e.mappingName,groupId:e.groupId,assignment:e.assignment,purpose:e.purpose,placeholder:e.placeholder,actions:function(e){let t={};for(let n of["keystroke","format","validate","calculate"]){let r=e.actions?.[n];if(!r){t[n]=null;continue}let i=U(r);i&&(t[n]=i)}return t}(e)},n=e=>null===e||ev(e)?{format:e}:{},r="none"!==e.defaultValueEntry.kind,i=e=>e.map(({label:e,value:t})=>({label:e,value:t}));switch(e.kind){case"text":return{...t,defaultValue:r?e.defaultValue:null,maxLength:e.maxLength,multiline:e.multiline,password:e.password,comb:e.comb,...n(e.format)};case"radio":return{...t,radiosInUnison:e.radiosInUnison,noToggleToOff:e.noToggleToOff};case"combobox":return{...t,edit:e.edit,defaultValue:r?e.defaultValue:null,options:i(e.options),...n(e.format)};case"listbox":return{...t,multiSelect:e.multiSelect,defaultValue:r?e.defaultValue:null,options:i(e.options)};case"pushbutton":return{...t,takesImage:e.takesImage};default:return t}}function EJ(e,t){return Object.fromEntries(t.map(t=>[t,e[t]]))}function EQ(e){return ad(e)??{value:null}}function EX(e,t,n=t.widgets){return E0(e,{field:t,meta:y4(e.session.writeStamp(),[t.ref],t.widgets,n)})}function EY(e,t){let n=t.widgets;return"forms.setDisplay"===e?[]:"forms.setValue"===e||"forms.reset"===e?y8(t.kind,n):n}function E0(e,t){return wV(e.runtime,e.session,t,e.fonts)}function E1(e,t){return{type:"forms.reset",...E0(e,{fields:[...t],meta:y4(e.session.writeStamp(),t.map(e=>e.ref),t.flatMap(e=>e.widgets),t.flatMap(e=>EY("forms.reset",e)))})}}function E3(e,t,n){if("forms.reset"===t)return E1(e,n);let r=n[0];return{type:t,...EX(e,r,EY(t,r))}}function E2(e,t,n,r){let i=t.filter(e=>!yV(E6(n,e),E6(r,e)));return{kind:"metadata.revert",op:e,restore:Object.fromEntries(i.map(e=>[e,E6(n,e)])),left:Object.fromEntries(i.map(e=>[e,E6(r,e)]))}}function E6(e,t){return e[t]??null}function E5(e,t){return Object.fromEntries(t.map(t=>[t,E6(e,t)]))}var E4=class{constructor(e,t){hJ(this,"childrenByParent",new Map),hJ(this,"parentByItem",new Map);let n=(r,i,o)=>{if(o>=128)return;let a=[];this.childrenByParent.set(i,a);for(let s=e.FPDFBookmark_GetFirstChild(t,r);s;s=e.FPDFBookmark_GetNextSibling(t,s)){let t=e.EPDFOutline_GetObjectNumber(s);if(t){if(this.parentByItem.has(t))break;this.parentByItem.set(t,i),a.push(t),n(s,t,o+1)}}};n(0n,0,0)}has(e){return this.parentByItem.has(e)}parentOf(e){return this.parentByItem.get(e)}childrenOf(e){return this.childrenByParent.get(e)??[]}subtreeOf(e){let t=[e];for(let n of this.childrenOf(e))t.push(...this.subtreeOf(n));return t}levelOf(e){let t=-1;for(let n=e;n;n=this.parentOf(n))t+=1;return this.has(e)?t:void 0}isAtOrUnder(e,t){for(let n=e;n;n=this.parentOf(n))if(n===t)return!0;return!1}items(){return this.childrenOf(0).flatMap(e=>this.subtreeOf(e))}},E8={maxModels:5e4,maxNodes:2e5,maxScriptCodeUnits:16e6,maxTargetEntries:65536,maxPayloadCodeUnits:16e6};function E7(e,t,n,r,i,o){let{fn:a,mem:s}=e,l=h3(s,(e,t)=>a.FPDFBookmark_GetTitle(n,e,t))??"",u=0n!==a.FPDFBookmark_GetFirstChild(t,n),d=a.FPDFBookmark_GetStyle(n),{action:c,target:f,complete:m}=function(e,t,n,r){let{fn:i,mem:o}=e,a=i.FPDFBookmark_GetAction(n);if(a)try{let e=F8(i,o,t,i.EPDFAction_LoadModel(a),r);return{action:e,target:e?Pr(e):{kind:"unsupported"},complete:null!==e&&!e.incomplete}}catch(e){if(!N.is(e))throw e;return{action:null,target:{kind:"unsupported"},complete:!1}}let s=i.FPDFBookmark_GetDest(t,n);if(!s)return{action:null,target:null,complete:!0};let l=F2(i,o,t,s);return{action:null,target:l?{kind:"goto",destination:l}:{kind:"unsupported"},complete:!0}}(e,t,n,o);return{item:{ref:nk(r),parent:0===i?null:nk(i),title:l,target:f,action:c,open:u&&a.FPDFBookmark_GetCount(n)>0,color:function(e,t){let{fn:n,mem:r}=e;return h0(r,[4,4,4],([e,i,o])=>{if(!n.FPDFBookmark_GetColor(t,e,i,o))return null;let a=e=>Math.min(255,Math.max(0,Math.round(255*F0(r,e))));return e7(a(e),a(i),a(o))})}(e,n),bold:(2&d)!=0,italic:(1&d)!=0},complete:m}}var E9=class{constructor(e,t){this.runtime=e,this.session=t}read(e){let{fn:t}=this.runtime,n=this.session.requireDocPtr(),r=new F4(E8),i=[],o=new Set,a=!1,s=(l,u,d)=>{for(let c=t.FPDFBookmark_GetFirstChild(n,l);c;c=t.FPDFBookmark_GetNextSibling(n,c)){hW(e);let l=t.EPDFOutline_GetObjectNumber(c);if(!l){a=!0;continue}if(o.has(l)){a=!0;break}if(i.length>=5e4)return a=!0,!1;o.add(l);let f=E7(this.runtime,n,c,l,u,r);if(i.push(f.item),f.complete||(a=!0),0n!==t.FPDFBookmark_GetFirstChild(n,c)){if(d+1>=128){a=!0;continue}if(!s(c,l,d+1))return!1}}return!0};return s(0n,0,0),{items:i,incomplete:a}}readItem(e,t){let n=this.session.requireDocPtr(),r=this.runtime.fn.EPDFOutline_GetItem(n,e);if(!r)throw new N(G.NotFound,`no outline item ${e}`,{details:{field:"ref"}});return E7(this.runtime,n,r,e,t,new F4(E8)).item}},Ae=/^#[0-9a-fA-F]{6}$/;function At(e){let t=(e,t)=>{throw new N(G.InvalidArg,t,{details:{field:e}})};void 0!==e.title&&("string"!=typeof e.title&&t("title","a title is a string"),e.title.length>32767&&t("title","a title holds at most 32767 characters")),null==e.color||Ae.test(e.color)||t("color","expected a color as \'#rrggbb\'");let n=e.target;null==n||"goto"===n.kind||"uri"===n.kind||"named"===n.kind&&["NextPage","PrevPage","FirstPage","LastPage"].includes(n.name??"")||t("target",`a \'${n.kind}\' target can\'t be written`)}function An(e,t,n,r){let{fn:i,mem:o}=e,a=(e,t)=>{if(!e)throw new N(G.Unknown,`the ${t} of outline item ${n} could not be written`)};if(void 0!==r.title&&a(h5(o,r.title,e=>i.EPDFOutline_SetTitle(t,n,e)),"title"),void 0!==r.target){let e=null===r.target?0n:Pi(i,o,t,r.target);a(i.EPDFOutline_SetAction(t,n,e),"target")}if(void 0!==r.color)if(null===r.color)a(i.EPDFOutline_SetColor(t,n,!1,0,0,0),"colour");else{let{r:e,g:o,b:s}=e9(r.color);a(i.EPDFOutline_SetColor(t,n,!0,e/255,o/255,s/255),"colour")}if(void 0!==r.bold||void 0!==r.italic){let e=i.FPDFBookmark_GetStyle(i.EPDFOutline_GetItem(t,n));void 0!==r.bold&&(e=r.bold?2|e:-3&e),void 0!==r.italic&&(e=r.italic?1|e:-2&e),a(i.EPDFOutline_SetStyle(t,n,e),"style")}void 0!==r.open&&a(i.EPDFOutline_SetOpen(t,n,r.open),"open state")}var Ar=class{constructor(e,t){this.runtime=e,this.session=t,hJ(this,"reader",void 0),this.reader=new E9(e,t)}tree(){return new E4(this.runtime.fn,this.session.requireDocPtr())}create(e,t,n,r){At(n);let i=this.tree(),o=this.parentNumberOf(i,e),a=i.childrenOf(o),s=nP(a.map(nk),t,Ai),l=0===s?0:a[s-1];void 0!==r&&this.session.claimObjectNumber(r);let{fn:u,mem:d}=this.runtime,c=this.session.requireDocPtr(),f=h5(d,n.title,e=>u.EPDFOutline_CreateItem(c,r??0,o,l,e));if(!f)throw Aa("create the item");let{title:m,...p}=n;An(this.runtime,c,f,p);let h=this.reader.readItem(f,o);return{item:h,order:this.orderOf(this.tree(),o),meta:this.meta([h.ref])}}update(e,t){At(t);let n=this.tree(),r=this.requireItem(n,e,"ref");return An(this.runtime,this.session.requireDocPtr(),e.objectNumber,t),{item:this.reader.readItem(e.objectNumber,r),meta:this.meta([e])}}move(e,t,n){let r=this.tree(),i=e.map(e=>(this.requireItem(r,e,"refs"),e.objectNumber)),o=new Set(i);for(let e of(o.size!==i.length&&Ao("refs","an item is named twice"),i))i.some(t=>t!==e&&r.isAtOrUnder(e,t))&&Ao("refs",`item ${e} is under another item that moves`);let a=this.parentNumberOf(r,t);i.some(e=>r.isAtOrUnder(a,e))&&Ao("parent","an item would go under itself");let s=r.childrenOf(a).filter(e=>!o.has(e)),l="start"===n||"end"===n?null:"before"in n?n.before:n.after;l&&o.has(l.objectNumber)&&Ao("position",`the neighbour ${l.objectNumber} is one of the items that move`);let u=nP(s.map(nk),n,Ai),d=0===u?0:s[u-1];return this.place(i.map(e=>{let t={item:e,parent:a,after:d};return d=e,t}),r)}place(e,t=this.tree()){let{fn:n}=this.runtime,r=this.session.requireDocPtr(),i=new Set;for(let{item:o,parent:a,after:s}of e){i.add(t.parentOf(o)??0),i.add(a);let e=this.tree(),l=s&&e.parentOf(s)===a?s:0;if(!n.EPDFOutline_MoveItem(r,o,a,l))throw Aa(`move item ${o}`)}let o=this.tree();return{orders:[...i].map(e=>this.orderOf(o,e)),meta:this.meta(e.map(({item:e})=>nk(e)))}}placementsOf(e,t=this.tree()){let n=new Set(e);return t.items().filter(e=>n.has(e)).map(e=>{let n=t.parentOf(e),r=t.childrenOf(n),i=r.indexOf(e);return{item:e,parent:n,after:i>0?r[i-1]:0}})}delete(e){let t=this.tree();this.requireItem(t,e,"ref");let n=t.subtreeOf(e.objectNumber);if(!this.runtime.fn.EPDFOutline_DeleteItem(this.session.requireDocPtr(),e.objectNumber))throw Aa(`delete item ${e.objectNumber}`);return{meta:this.meta(n.map(nk))}}restored(e){let t=this.tree(),n=t.parentOf(e);if(void 0===n)throw Aa(`restore item ${e}`);let r=this.subtree(e,t);return{items:r,order:this.orderOf(t,n),meta:this.meta(r.map(e=>e.ref))}}find(e,t=this.tree()){let n=t.parentOf(e.objectNumber);return void 0===n?null:this.reader.readItem(e.objectNumber,n)}subtree(e,t=this.tree()){return t.subtreeOf(e).map(e=>this.reader.readItem(e,t.parentOf(e)))}updated(e){let t=this.find(e);if(!t)throw Aa(`read item ${e.objectNumber}`);return{item:t,meta:this.meta([e])}}countAgain(e){let t=this.find(e);t&&An(this.runtime,this.session.requireDocPtr(),e.objectNumber,{open:t.open})}parentNumberOf(e,t){return null===t?0:(this.requireItem(e,t,"parent"),(e.levelOf(t.objectNumber)??0)>=127&&Ao("parent",`an item under ${t.objectNumber} would be deeper than reads go`),t.objectNumber)}requireItem(e,t,n){let r=e.parentOf(t.objectNumber);if(void 0===r)throw new N(G.NotFound,`no outline item ${t.objectNumber}`,{details:{field:n}});return r}orderOf(e,t){return{parent:0===t?null:nk(t),children:e.childrenOf(t).map(nk)}}meta(e){return{affectedPages:[],cacheDelta:null,...this.session.writeStamp(),changedRefs:e}}},Ai=e=>String(e.objectNumber);function Ao(e,t){throw new N(G.InvalidArg,t,{details:{field:e}})}function Aa(e){return new N(G.MalformedPdf,`could not ${e}: the outline holds an item that isn\'t an indirect object`)}var As=["title","target","color","bold","italic","open"],Al=["A","Dest"],Au=e=>new Ar(e.runtime,e.session);function Ad(e,t,n,r){var i,o,a;let s,l=yJ(e.runtime,e.session,[{objectNumber:t.objectNumber,deep:Al}]),u=Au(e).update(t,n),d=yQ(e.runtime,e.session,l);return{item:{type:"outline.update",...u},reverse:[{kind:"objects.revert",reports:"outline.update",objects:d,subject:{outlineItem:t},fallback:(i=r,o=u.item,a=n,{kind:"outline",restore:Object.fromEntries((s=As.filter(e=>void 0!==a[e]&&!yV(i[e],o[e]))).map(e=>[e,i[e]])),left:Object.fromEntries(s.map(e=>[e,o[e]]))})}]}}function Ac(e,t){var n,r,i;let o=Au(e),a=o.tree(),s=a.parentOf(t.objectNumber),l=Af(e,a,[t.objectNumber]),u=(n=e.runtime,r=e.session.requireDocPtr(),i=t.objectNumber,yz(n,`outline item ${i}`,e=>n.fn.EPDFOutline_ExportItemRawToOwnedBuffer(r,i,e)));return{item:{type:"outline.delete",...o.delete(t)},reverse:[{kind:"outline.restore",ref:t,parent:void 0===s||0===s?null:nk(s),capture:u},...l]}}function Af(e,t,n){let r=new Set(n),i=new Set(n.map(e=>t.parentOf(e)??0));return i.delete(0),[...i].flatMap(n=>{let i=t.childrenOf(n);return i.every(e=>r.has(e))&&Au(e).find(nk(n),t)?.open?[{kind:"outline.reopen",ref:nk(n),children:i}]:[]})}function Am(e,t){return yQ(e.runtime,e.session,t.map(e=>({objectNumber:e.objectNumber,deep:[],before:null})))}function Ap(e,t){let n=Au(e).find(t);if(!n)throw new N(G.NotFound,`no outline item ${t.objectNumber}`,{details:{field:"ref"}});return n}var Ah=["Annots","Contents","Resources"],AF=["Parent","Rotate"];function Ag(e,t){let n=e.session.pagePool();n.closeIdle();try{return t()}finally{n.closeIdle()}}var A_=e=>new gw(e.runtime,e.session),AP=e=>new gG(e.runtime,e.session);function AD(e,t,n){let r="pages.insertBlank"!==t,i=Aw(e),o=r?EB(e):new Set,a=n();r&&e.session.invalidateDerived();let s=r?[...EB(e)].filter(e=>!o.has(e)):[],l=a.insertedPages.map(e=>e.objectNumber),u=AA(e,i,r0(i,AO(e).indexOf(l[0]),l.length));return{item:{type:t,...a,...AS(e,u)},reverse:[Ay(e,l,u,s)]}}function Ab(e,t,n){let r=e.session.requireDocPtr(),i=AO(e),o=Aw(e),a=t.map(t=>{var n;return{page:t,capture:(n=e.runtime,yz(n,`page ${t}`,e=>n.fn.EPDFPage_ExportRawToOwnedBuffer(r,t,e)))}}),s=t.map(q),l=A_(e).delete(s,e.signal);e.session.invalidateDerived();let u=AA(e,o,AE(o,rY(o,i.length,t.map(e=>i.indexOf(e))),n));return{item:{type:"pages.delete",pages:s,...l,...AS(e,u)},reverse:[{kind:"pages.restore",pages:a,...u?{labels:u}:{}}]}}function Ay(e,t,n,r=[]){return{kind:"pages.remove",pages:t.map(t=>({page:t,left:Ak(e,t)})),...n?{labels:n}:{},...r.length>0?{fields:r}:{}}}function Aw(e){return gp(e.runtime,e.session.requireDocPtr())}function AE(e,t,n){return n&&r1(e,n.left)?n.sections:t}function AA(e,t,n){if(!r1(t,n))return!function(e,t,n){let{fn:r,mem:i}=e;if(!h1(i,n.map(e=>e.firstPage),o=>h1(i,n.map(e=>gm.indexOf(e.style)),a=>h1(i,n.map(e=>e.firstNumber),i=>gf(e,n.map(e=>e.prefix),(e,n)=>r.EPDFDoc_SetPageLabelSections(t,o,a,i,e,n))))))throw new N(G.Unknown,"EPDFDoc_SetPageLabelSections refused",{details:{sections:n.length}})}(e.runtime,e.session.requireDocPtr(),n),{sections:t,left:n}}function Av(e,t,n,r){var i,o,a;return t.every((e,t)=>n[t]===e)?e:(i=t.length,o=r.map(e=>t.indexOf(e)),a=n.indexOf(r[0]),r0(rY(e,i,o),a,o.length))}function AS(e,t){return t?{layout:AI(e)}:{}}function Ak(e,t){let{fn:n,mem:r}=e.runtime,i=e.session.requireDocPtr(),o=yR(e.runtime,i,t,Ah,AF),a=e.session.allRecords().find(e=>e.pageObjectNumber===t),s=a?g_(e.runtime,i,a.pageIndex):0,l=new TextEncoder().encode(`\nturn ${s}`),u=new Uint8Array(o.byteLength+l.byteLength);return u.set(o),u.set(l,o.byteLength),Db(n,r,u)}function Ax(e,t){return AG(e,t).map(t=>({page:t,after:e[e.indexOf(t)-1]??0}))}function AG(e,t){return[...t].sort((t,n)=>e.indexOf(t)-e.indexOf(n))}function AO(e){return e.session.allRecords().map(e=>e.pageObjectNumber)}function AI(e){return new gh(e.runtime,e.session).read(e.signal)}function AN(e){return new Map(e.pages.map(e=>[e.ref.objectNumber,e.rotation]))}function AC(e){return{affectedPages:[],cacheDelta:null,...e.session.writeStamp()}}var Aj=class{constructor(e,t){this.runtime=e,this.session=t}setScale(e,t,n){if(hW(n),null!==t)try{tV(t)}catch(e){throw new N(G.InvalidArg,e.message)}let{fn:r,mem:i}=this.runtime,o=this.session.requireDocPtr(),a=this.session.recordByObjectNumber(e).pageIndex,s=[];for(let e=0;er.EPDFViewport_GetName(t,e,n))!==nb)continue;let n=r.EPDFViewport_GetMeasure(t);n&&1!==r.EPDFMeasure_GetSubtype(n)||s.push(e)}finally{r.EPDFViewport_Close(t)}}let l=hY(i,16,e=>gg(r,i,o,a,e).crop);if(![l.left,l.right,l.bottom,l.top].every(Number.isFinite))throw new N(G.InvalidArg,"Invalid calibration box");if(hW(n),null===t){for(let e of s.reverse())gr(r.EPDFPage_RemoveViewportRaw(o,a,e));return}hY(i,16,e=>{i.poke(e,"f32",l.left),i.poke(e,"f32",l.top,4),i.poke(e,"f32",l.right,8),i.poke(e,"f32",l.bottom,12);let n=s.length?r.EPDFPage_GetViewportRaw(o,a,s[s.length-1]):r.EPDFPage_AddViewportRaw(o,a,e);gr(n);try{gr(r.EPDFViewport_SetBBox(n,e)),gr(h6(i,nb,e=>r.EPDFViewport_SetName(n,e))),gs(r,i,r.EPDFViewport_AddMeasure(n),t)}finally{r.EPDFViewport_Close(n)}})}};function AM(e,t,n){new Aj(e.runtime,e.session).setScale(t,n,e.signal)}function AR(e,t){return{page:t,layout:new gh(e.runtime,e.session).read(e.signal),meta:{affectedPages:[],cacheDelta:null,...e.session.writeStamp()}}}function AT(e,t){let{fn:n,mem:r}=e.runtime,i=e.session.recordByObjectNumber(t).pageIndex,o=gl(n,r,e.session.requireDocPtr(),i).filter(e=>e.owned).pop();return o?.measure?.subtype==="rectilinear"?o.measure:null}function AB(e,t){let{fn:n,mem:r}=e.runtime,i=e.session.recordByObjectNumber(t).pageIndex;return hY(r,16,t=>gg(n,r,e.session.requireDocPtr(),i,t).crop)}var AL={opInFileSpace:e=>e,itemOut:e=>e},A$=class{constructor(e,t,n,r=nI){this.runtime=e,this.session=t,this.fonts=n,this.limits=r}apply(e,t,n,r){let i=this.context(t,n,t=>e.some(e=>{if("forms.setValue"!==e.type&&"forms.setAppearanceText"!==e.type)return!1;let n=EV(t,e.field);return null!==n&&o8(t.authority,n.field.assignment,"fill")}));return Az(this.session,t,e.map((e,t)=>()=>(function(e,t,n){var r,i,o,a;switch(t.type){case"annotations.create":if("widget"===t.data.subtype)throw new N(G.InvalidArg,"a widget is the form\'s: create one with doc.forms.create or doc.forms.addWidget",{details:{field:"subtype"}});oY(e.authority,o0(t.data.subtype));let s=o2(e.authority,t.data.subtype,t.data.groupId),l=e.session.resolvePageRef(t.page).pageObjectNumber,u=wu(e).create(l,t.data,e.signal,{...s?{actor:s}:{},...t.resources?{resources:t.resources}:{},...void 0!==t.objectNumber?{objectNumber:t.objectNumber}:{}});return{item:{type:"annotations.create",page:t.page,...u},reverse:[{kind:"annotation.remove",ref:u.annotation.ref,left:[u.annotation]}]};case"annotations.import":let d,c;return(d="restore"===t.attribution?"import":void 0)&&we(e.authority),{item:{type:"annotations.import",...c=new yN(e.runtime,e.session,e.fonts).import({bundle:t.bundle,...void 0!==t.pages?{pages:t.pages}:{},attribution:t.attribution,...t.actor?{actor:t.actor}:{},limits:t.limits,authorizeCreate:t=>{oY(e.authority,o0(t.subtype)),d||o2(e.authority,t.subtype,t.groupId??void 0)}},e.signal)},reverse:y9(e,c.annotations,d)};case"annotations.update":let f=wd(e,t.ref);if("widget"===f.subtype)throw new N(G.InvalidArg,"a widget is the form\'s: change its place and look with doc.forms.updateWidget");return oY(e.authority,o0(f.subtype)),yK(n,f,t.expect),wt(e,f,t.patch.nm),wa(e,t.ref,t.patch,"annotations.update",t.resources);case"annotations.delete":let m=wd(e,t.ref);if("widget"===m.subtype){let e;throw i=m,e=i.field?.kind==="objectNumber"&&"objectNumber"===i.ref.kind&&i.field.objectNumber===i.ref.objectNumber,new N(G.InvalidArg,e?"widget is its form field\'s own dictionary (a merged field/widget) - delete the field with doc.forms.delete":i.field?"widget is attached to a form field - use doc.forms.removeWidget or doc.forms.delete":"a widget is the form\'s: it isn\'t deleted as an annotation")}return oY(e.authority,o0(m.subtype)),yK(n,m,t.expect),wl(e,t.ref);case"annotations.reorder":let p;return p=y6(y3(e.runtime,e.session,t.page),"annotations",t.refs,t.position),wi(e,"annotations",t.refs),y5(e.runtime,e.session,p),wn(e,p,t.refs);case"annotations.copy":let h;return oQ(e.authority,"doc.annotate.read"),{item:{type:"annotations.copy",...h=new y1(e.runtime,e.session,e.fonts).copy({refs:t.refs,...t.page?{page:t.page}:{},...t.offset?{offset:t.offset}:{},...t.objectNumbers?{objectNumbers:t.objectNumbers}:{},read:t=>wd(e,t),authorizeCreate:t=>(oY(e.authority,o0(t.subtype)),o2(e.authority,t.subtype,void 0)),limits:e.limits},e.signal)},reverse:y9(e,h.annotations,void 0)};case"forms.setValue":let F;return F=E$(e,t.field),EE(e,F),yK(n,EQ(F.field),t.expect),Ex(e,F,t.value);case"forms.setDisplay":let g;return g=E$(e,t.field),function(e,t){if(!o8(e.authority,t.field.assignment,"fill")){if(e.fillsOwnField())return oY(e.authority,"doc.forms.fill");o4(e.authority,t.field.assignment,"fill")}}(e,g),EG(e,"forms.setDisplay",n=>n.setDisplay(t.field,t.display,e.signal),g);case"forms.setAppearanceText":let _;return _=E$(e,t.field),EE(e,_),EG(e,"forms.setAppearanceText",n=>n.setAppearanceText(t.field,t.text,e.signal),_);case"forms.reset":return function(e,t){EA(e);let n=t.fields?t.fields.map(t=>E$(e,t)):Eq(e).filter(({field:e})=>Em.has(e.kind));for(let t of n)o4(e.authority,t.field.assignment,"fill");let r=yJ(e.runtime,e.session,n.flatMap(EH)),i=new Et(e.runtime,e.session,e.fonts).reset(t.fields?[...t.fields]:void 0,e.signal),o=yQ(e.runtime,e.session,r),a=new Set(i.fields.map(e=>EK(e.ref))),s={type:"forms.reset",...E0(e,i)};return 0===a.size?{item:s,reverse:[]}:{item:s,reverse:[{kind:"objects.revert",reports:"forms.reset",objects:o,subject:{fields:[...a]},fallback:{kind:"value",fields:n.filter(({objectNumber:e})=>a.has(e)).map(({objectNumber:e,field:t})=>({objectNumber:e,before:EQ(t),left:EQ(i.fields.find(t=>EK(t.ref)===e))}))}}]}}(e,t);case"forms.create":return function(e,t){var n;oQ(e.authority,"doc.forms.modify"),(T((n=t.draft).actions)||(n.widgets??[]).some(e=>T(e.actions)))&&oQ(e.authority,"doc.forms.script"),o7(e.authority,ee(t.draft));let{field:r,calculationOrder:i}=new Et(e.runtime,e.session,e.fonts).createField(t.draft,e.signal,e.authority.identity,{...void 0!==t.objectNumber?{objectNumber:t.objectNumber}:{},...t.widgetObjectNumbers?{widgetObjectNumbers:t.widgetObjectNumbers}:{}});return{item:{type:"forms.create",...EX(e,r),...EC(i)},reverse:[ES(e,r)]}}(e,t);case"forms.copy":let P,D;return oQ(e.authority,"doc.forms.modify"),D=(P=new Eu(e.runtime,e.session,e.fonts).copy({fields:t.fields,...t.widgets?{widgets:t.widgets}:{},...t.page?{page:t.page}:{},...t.offset?{offset:t.offset}:{},values:t.values??!0,...t.objectNumbers?{objectNumbers:t.objectNumbers}:{},actor:e.authority.identity,mayScript:oX(e.authority,"doc.forms.script"),assignmentOf:t=>Ev(e,t),limits:e.limits},e.signal)).fields.map(t=>ES(e,t)),{item:{type:"forms.copy",...P},reverse:D.reverse()};case"forms.repeat":return function(e,t){oQ(e.authority,"doc.forms.modify");let n=new Ec(e.runtime,e.session,e.fonts),r=n.plan({field:t.field,pages:t.pages,...t.as?{as:t.as}:{},...t.objectNumbers?{objectNumbers:t.objectNumbers}:{},mayScript:oX(e.authority,"doc.forms.script"),limits:e.limits},e.signal),i=[...r.dropped];if(0===r.pages.length){let t=y4(e.session.writeStamp(),[],[]);return{item:{type:"forms.repeat",as:r.as,fields:[],widgets:[],dropped:i,meta:t},reverse:[]}}if("fields"===r.as){let o=n.createFields(r,{...t.objectNumbers?{objectNumbers:t.objectNumbers}:{},actor:e.authority.identity,assignmentOf:t=>Ev(e,t)},e.signal);return{item:{type:"forms.repeat",as:"fields",...o,dropped:i},reverse:[{kind:"fields.repeat",direction:"remove",left:o.fields,guards:o.fields.map(t=>EP(e,t.widgets)),captures:[]}]}}let o=E$(e,t.field),{split:a,mergedEntry:s}=Eh(e,o),l=yJ(e.runtime,e.session,[{objectNumber:o.objectNumber,deep:Ef}]),{added:u,split:d}=n.addBoxes(r,t.objectNumbers,e.signal),c=EF(e,"forms.repeat",o.objectNumber,l,u,{merged:a,mergedEntry:s,widget:d[0]??null});return{item:Ey(e,o.objectNumber,[...Eg(c),...u],i),reverse:[c]}}(e,t);case"forms.update":let b,y;return oQ(e.authority,"doc.forms.modify"),T(t.patch.actions)&&oQ(e.authority,"doc.forms.script"),b=E$(e,t.field),y=et(t.patch,b.field),r=b.field.assignment,(Y(y)!==Y(r)||y.kind!==r.kind)&&o7(e.authority,y),yK(n,EZ(b.field),t.expect),EO(e,b,t.patch);case"forms.delete":let w;return oQ(e.authority,"doc.forms.modify"),yK(n,(w=E$(e,t.field)).field,t.expect),ET(e,w);case"forms.addWidget":return function(e,t){oQ(e.authority,"doc.forms.modify"),T(t.placement.actions)&&oQ(e.authority,"doc.forms.script");let n=E$(e,t.field),{split:r,mergedEntry:i}=Eh(e,n),o=yJ(e.runtime,e.session,[{objectNumber:n.objectNumber,deep:Ef}]),{field:a,widget:s}=new Et(e.runtime,e.session,e.fonts).addWidget(t.field,t.placement,e.signal,{...void 0!==t.objectNumber?{objectNumber:t.objectNumber}:{},...void 0!==t.splitObjectNumber?{splitObjectNumber:t.splitObjectNumber}:{}}),l=new Set(n.field.widgets.map(e=>e.objectNumber)),u=a.widgets.filter(e=>!l.has(e.objectNumber)),d=u.find(e=>e.objectNumber!==s.objectNumber)??null,c=EF(e,"forms.addWidget",n.objectNumber,o,u.filter(e=>e.objectNumber===s.objectNumber),{merged:r,mergedEntry:i,widget:d});return{item:{type:"forms.addWidget",...E0(e,{field:a,meta:y4(e.session.writeStamp(),[a.ref],u)})},reverse:[c]}}(e,t);case"forms.removeWidget":let E,A,v,S,k;return oQ(e.authority,"doc.forms.modify"),E=E$(e,t.field),A="objectNumber"===t.widget.kind?t.widget.objectNumber:0,v=yJ(e.runtime,e.session,[{objectNumber:E.objectNumber,deep:[]},{objectNumber:A,deep:[]}]),S=new Et(e.runtime,e.session,e.fonts).detachWidget(t.field,t.widget,e.signal),k=yQ(e.runtime,e.session,v),{item:{type:"forms.removeWidget",...E0(e,{field:S.field,meta:y4(e.session.writeStamp(),[S.field.ref],[S.widget])})},reverse:[EL("forms.addWidget",k,[E.objectNumber])]};case"forms.deleteWidget":oQ(e.authority,"doc.forms.modify");let x=wd(e,t.widget);if("widget"!==x.subtype)throw new N(G.InvalidArg,`${x.subtype} is not a widget: delete it with page.annotations.delete`,{details:{field:"widget"}});return yK(n,x,t.expect),Ek(e,x);case"forms.updateWidget":oQ(e.authority,"doc.forms.modify"),T(t.patch.actions)&&oQ(e.authority,"doc.forms.script");let O=wd(e,t.widget);if("widget"!==O.subtype)throw new N(G.InvalidArg,`${O.subtype} is not a widget: change it with doc.annotations.update`,{details:{field:"widget"}});return yK(n,O,t.expect),wt(e,O,t.patch.nm),wa(e,t.widget,{...t.patch,subtype:"widget"},"forms.updateWidget");case"forms.reorderWidgets":let I;return oQ(e.authority,"doc.forms.modify"),I=y6(y3(e.runtime,e.session,t.page),"widgets",t.widgets,t.position),y5(e.runtime,e.session,I),wn(e,I,t.widgets);case"forms.reorderCalculations":return function(e,t){oQ(e.authority,"doc.forms.modify");let{before:n,after:r,moved:i}=new Et(e.runtime,e.session,e.fonts).reorderCalculations(t.fields,t.position,e.signal);return{item:Ew(e,r,i),reverse:[Ej({before:n,after:r})]}}(e,t);case"forms.setSignatureAppearance":let C;return C=E$(e,t.field),o4(e.authority,C.field.assignment,"sign"),ER(e,C,"forms.setSignatureAppearance",()=>new Et(e.runtime,e.session,e.fonts).setSignatureAppearance(t.field,iE(t.appearance),e.signal));case"forms.setButtonImage":let j;return j=E$(e,t.field),o4(e.authority,j.field.assignment,"fill"),ER(e,j,"forms.setButtonImage",()=>new Et(e.runtime,e.session,e.fonts).setButtonImage(t.field,function(e){if(null===e)return null;if(ArrayBuffer.isView(e))return e;throw new N(G.InvalidArg,"a push button\'s image reaches a write as bytes, never as a Blob")}(t.image),e.signal));case"forms.import":let M,R,B;return oQ(e.authority,"doc.forms.modify"),M=function(e,t){if("restore"===t.attribution)return oQ(e.authority,"doc.forms.import"),"import"}(e,t),B=(R=new Ed(e.runtime,e.session,e.fonts).import({bundle:t.bundle,...void 0!==t.pages?{pages:t.pages}:{},attribution:t.attribution,values:t.values??!0,actor:t.actor??{},limits:t.limits,mayScript:(t.mayScript??!1)&&oX(e.authority,"doc.forms.script"),assignmentOf:t=>M?t:Ev(e,t)},e.signal)).fields.map(t=>ES(e,t,M)),{item:{type:"forms.import",...R},reverse:B.reverse()};case"forms.importValues":return function(e,t){EA(e);let n=new Ed(e.runtime,e.session,e.fonts),r=n.planValues(t.bundle,t.limits,e.signal,t=>o8(e.authority,t.assignment,"fill")),i=[],o=[];for(let t of r.writes){let r={objectNumber:EK(t.target.ref),field:t.target},a=yJ(e.runtime,e.session,EH(r)),s=n.writeValue(t,e.signal),l=yQ(e.runtime,e.session,a);i.push(s),o.push({...EL("forms.setValue",l,[r.objectNumber]),fallback:{kind:"value",fields:[{objectNumber:r.objectNumber,before:EQ(t.target),left:EQ(s)}]}})}return{item:{type:"forms.importValues",...E0(e,{fields:i,dropped:[...r.dropped],meta:y4(e.session.writeStamp(),i.map(e=>e.ref),i.flatMap(e=>e.widgets))})},reverse:o.reverse()}}(e,t);case"metadata.update":let L,$;return oQ(e.authority,"doc.metadata.modify"),yK(n,L=new FF(e.runtime,e.session).read(e.signal),t.expect),{item:{type:"metadata.update",...$=new FZ(e.runtime,e.session).update(t.patch,e.signal)},reverse:[E2("metadata.update",Object.keys(t.patch),L,$.metadata)]};case"metadata.updateCustom":let z,U;return oQ(e.authority,"doc.metadata.modify"),z=new FF(e.runtime,e.session).readCustom(e.signal),{item:{type:"metadata.updateCustom",...U=new FZ(e.runtime,e.session).updateCustom(t.patch,e.signal)},reverse:[E2("metadata.updateCustom",Object.keys(t.patch),z,U.custom)]};case"outline.create":oQ(e.authority,"doc.outline.modify");let V=Au(e).create(t.parent,t.position??"end",t.data,t.objectNumber);return{item:{type:"outline.create",...V},reverse:[{kind:"outline.remove",ref:V.item.ref,left:Am(e,[V.item.ref])}]};case"outline.update":oQ(e.authority,"doc.outline.modify");let W=Ap(e,t.ref);return yK(n,W,t.expect),Ad(e,t.ref,t.patch,W);case"outline.move":let q,H,K,Z,J,Q,X;return o=e,a=t,oQ(o.authority,"doc.outline.modify"),H=(q=Au(o)).tree(),K=a.refs.map(e=>e.objectNumber),Z=q.placementsOf(K,H),J=Af(o,H,K),Q=q.move(a.refs,a.parent,a.position),X=a.parent?.objectNumber??0,{item:{type:"outline.move",...Q},reverse:[{kind:"outline.move",placements:Z,left:K.map(e=>({item:e,parent:X}))},...J]};case"outline.delete":return oQ(e.authority,"doc.outline.modify"),yK(n,Ap(e,t.ref),t.expect),Ac(e,t.ref);case"pages.rotate":return Ag(e,()=>{var n,r;let i,o,a;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),i=AN(AI(n)),o=A_(n).rotate([...r.pages],r.rotation,n.signal),a=r.pages.map(e=>e.objectNumber),{item:{type:"pages.rotate",pages:[...r.pages],rotation:r.rotation,...o},reverse:function(e,t,n){let r=new Map;for(let n of e){let e=t.get(n);r.set(e,[...r.get(e)??[],n])}return[...r].map(([e,t])=>({kind:"pages.rotate",pages:t,rotation:e,left:n}))}(a,i,r.rotation)}});case"pages.setScale":return function(e,t){oQ(e.authority,"doc.annotate.modify");let n=t.pages.map(e=>e.objectNumber);if(new Set(n).size!==n.length)throw new N(G.InvalidArg,"pages.setScale names a page twice",{details:{field:"pages"}});let r=n.map(n=>{let r=AB(e,n),i=AT(e,n);return AM(e,n,t.measure&&nY(t.measure,r)),{page:n,box:r,before:i,left:AT(e,n)}}),i=new Map;for(let{page:e,box:t,before:n,left:o}of r){let r=JSON.stringify([n,o,t]),a=i.get(r)??{pages:[],measure:n,left:o};a.pages.push(e),i.set(r,a)}return{item:{type:"pages.setScale",pages:[...t.pages],measure:t.measure,...AR(e,t.pages[0])},reverse:[...i.values()].map(e=>({kind:"pages.setScale",...e}))}}(e,t);case"pages.reorder":return Ag(e,()=>{var n,r;let i,o,a,s,l,u,d;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),i=r.pages.map(e=>e.objectNumber),o=AO(n),a=Aw(n),s=Ax(o,i),l=A_(n).reorder([...r.pages],r.position,n.signal),u=AO(n),d=AA(n,a,Av(a,o,u,i)),{item:{type:"pages.reorder",...l,...AS(n,d)},reverse:[{kind:"pages.reorder",placements:s,left:Ax(u,i),...d?{labels:d}:{}}]}});case"pages.delete":return Ag(e,()=>{var n,r;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),Ab(n,AG(AO(n),n.session.resolvePageRefs(r.pages)))});case"pages.insertBlank":return Ag(e,()=>{var n,r;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),AD(n,"pages.insertBlank",()=>AP(n).insertBlank(r.spec,r.position??"end",n.signal,r.objectNumbers))});case"pages.insert":return Ag(e,()=>{var n,r;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),AD(n,"pages.insert",()=>{var e;return AP(n).insert(0===(e=r.source).byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer,r.position??"end",n.signal,r.objectNumbers)})});case"pages.copy":return Ag(e,()=>{var n,r;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),AD(n,"pages.copy",()=>AP(n).copy(r.pages,r.position??"end",n.signal,r.objectNumbers))});case"attachments.create":oQ(e.authority,"doc.attachments.modify");let en=wF(e).create(t.file,t.resources.file,e.signal);return{item:{type:"attachments.create",...en},reverse:[w_(e,en.attachment.ref)]};case"attachments.delete":return oQ(e.authority,"doc.attachments.modify"),wg(e,t.ref)}})(i,r.opInFileSpace(e),t)),r,n)}undo(e,t,n,r){let i=this.context(t,n,t=>e.steps.some(e=>"objects.revert"===e.kind&&("forms.setValue"===e.reports||"forms.setAppearanceText"===e.reports)&&"fields"in e.subject&&e.subject.fields.some(e=>{let n=EW(t,e);return null!==n&&o8(t.authority,n.field.assignment,"fill")})));return Az(this.session,t,e.steps.map(e=>()=>(function(e,t){var n,r,i,o;switch(t.kind){case"objects.revert":if("annotation"in t.subject)return function(e,t){var n,r,i;let o=t.subject.annotation,a=t.reports,s=(n=e,r=o,wf(n,r.page)?.find(e=>K(e.ref)===K(r))??null);if(!s)return yH(e,a);if(oY(e.authority,o0(s.subtype)),yX(e.runtime,e.session,t.objects)){o6(e.authority,s,void 0);let n=yY(e.runtime,e.session,t.objects);return{item:ws(e,a,o,{annotation:wd(e,o),appearance:{action:"restored",changed:t.appearanceChanged??!0},meta:yP(e.session.writeStamp(),o.page.objectNumber,[o])}),reverse:[{...t,objects:n,...(i=t.fallback,i?.kind!=="annotation"?i?{fallback:i}:{}:{fallback:{kind:"annotation",restore:i.left,left:i.restore}})}]}}let l=t.fallback;if(l?.kind!=="annotation")return yH(e,a);let u=l.left,d=l.restore,c=Object.keys(u),f=c.filter(e=>yV(s[e],u[e]));if(0===f.length)return yH(e,a);let m=wa(e,o,Object.fromEntries(f.map(e=>{let t;return[e,(t=d[e],"actions"===e&&"widget"===s.subtype?function(e){let t={};for(let n of z){let r=e?.[n];if(!r){t[n]=null;continue}let i=B(r);i&&(t[n]=i)}return t}(t):t)]})),a),p=c.filter(e=>!f.includes(e)),h=m.item;return 0===p.length||iA(h)||h.type!==a?m:{...m,item:{...h,skipped:p}}}(e,{...t,subject:t.subject});if("outlineItem"in t.subject)return function(e,t){let n=t.subject.outlineItem,r=Au(e),i=r.find(n);if(!i)return yH(e,"outline.update");if(oQ(e.authority,"doc.outline.modify"),yX(e.runtime,e.session,t.objects)){var o;let i=yY(e.runtime,e.session,t.objects);r.countAgain(n);let a=yQ(e.runtime,e.session,i);return{item:{type:"outline.update",...r.updated(n)},reverse:[{...t,objects:a,...(o=t.fallback,o?.kind!=="outline"?o?{fallback:o}:{}:{fallback:{kind:"outline",restore:o.left,left:o.restore}})}]}}let a=t.fallback;if(a?.kind!=="outline")return yH(e,"outline.update");let s=a.left,l=a.restore,u=Object.keys(s),d=u.filter(t=>yV(i[t],s[t])&&function(e,t,n){if("target"!==t||null===n)return!0;if("goto"===n.kind){let t=n.destination?.page.objectNumber;return e.session.allRecords().some(e=>e.pageObjectNumber===t)}return"uri"===n.kind||"named"===n.kind&&["NextPage","PrevPage","FirstPage","LastPage"].includes(n.name??"")}(e,t,l[t]));if(0===d.length)return yH(e,"outline.update");let c=Ad(e,n,Object.fromEntries(d.map(e=>[e,l[e]])),i),f=u.filter(e=>!d.includes(e));return 0===f.length||"outline.update"!==c.item.type?c:{...c,item:{...c.item,skipped:f}}}(e,{...t,subject:t.subject});return function(e,t){if(Ep.has(t.reports)){let n="forms.setSignatureAppearance"===t.reports?"sign":"fill";for(let r of(oY(e.authority,"sign"===n?"doc.sign":"doc.forms.fill"),t.subject.fields)){let t=EW(e,r);t&&("sign"===n?o4(e.authority,t.field.assignment,"sign"):EE(e,t))}}else oQ(e.authority,"doc.forms.modify");if(t.rights&&oQ(e.authority,"doc.forms.import"),yX(e.runtime,e.session,t.objects)){let n=yY(e.runtime,e.session,t.objects),r=t.subject.fields.map(t=>EU(e,t).field);return{item:E3(e,t.reports,r),reverse:[{...t,objects:n,...function(e){switch(e?.kind){case"value":return{fallback:{kind:"value",fields:e.fields.map(({objectNumber:e,before:t,left:n})=>({objectNumber:e,before:n,left:t}))}};case"properties":return{fallback:{...e,restore:e.left,left:e.restore}};default:return{}}}(t.fallback)}]}}if(t.fallback?.kind==="properties")return function(e,t){let n=EW(e,t.objectNumber);if(!n)return yH(e,"forms.update");let r=EZ(n.field),i=t.left,o=t.restore,a=Object.keys(i),s=a.filter(t=>{var a,s,l,u;let d;return yV(r[t],i[t])&&("name"!==t||(a=e,s=n.field.name,l=String(o.name),null===EV(a,{kind:"fqn",name:s.slice(0,s.lastIndexOf(".")+1)+l})))&&("actions"!==t||(u=i.actions,d=o.actions??{},Object.keys(u??{}).every(e=>void 0!==d[e])))&&("takesImage"!==t||!0!==o.takesImage||function(e,t){let n=e.session.requireDocPtr(),r=Pz(e.runtime,n,t.field.widgets,new PR(e.runtime,n)),i=r.filter(e=>null!==e);try{return rJ(i,r.length-i.length),!0}catch(e){if(N.is(e)&&e.code===G.InvalidArg)return!1;throw e}}(e,n))});if(0===s.length)return yH(e,"forms.update");let l=EO(e,n,EJ(o,s)),u=a.filter(e=>!s.includes(e)),d=l.item;return 0===u.length||iA(d)||"forms.update"!==d.type?l:{...l,item:{...d,skipped:u}}}(e,t.fallback);if(t.fallback?.kind!=="value")return yH(e,t.reports);let n=[],r=[];for(let{objectNumber:i,before:o,left:a}of t.fallback.fields){let t=EW(e,i);t&&yV(EQ(t.field),a)?n.push(Ex(e,t,o)):t&&r.push(t.field.name)}return 0===n.length?yH(e,t.reports):"forms.setValue"===t.reports&&1===n.length?n[0]:{item:{...E1(e,n.map(({item:e})=>e.field)),...r.length>0?{skipped:r}:{}},reverse:n.flatMap(e=>e.reverse)}}(e,{...t,subject:t.subject});case"annotation.remove":let a=wf(e,t.ref.page);if(!a)return yH(e,"annotations.delete");let s=tG(a,t.ref),l=new Map(t.left.map(e=>[K(e.ref),e]));if(!(s.length>0&&s.length===l.size&&s.every(e=>{let t=l.get(K(e.ref));return void 0!==t&&yV(e,t)})))return yH(e,"annotations.delete");for(let t of o1(s))oY(e.authority,t);return t.rights&&we(e.authority),wl(e,t.ref,t.rights);case"annotation.restore":return function(e,t){let n=wf(e,t.page),r=t.members[0];if(!n||!r||n.some(e=>K(e.ref)===K(r)))return yH(e,"annotations.restore");let{pageIndex:i,pageObjectNumber:o}=e.session.resolvePageRef(t.page);yj(e.runtime,e.session.requireDocPtr(),i,t.capture),e.session.invalidateDerived(),t.unlinked.length>0&&yX(e.runtime,e.session,t.unlinked)&&yY(e.runtime,e.session,t.unlinked);let a=wc(e,o),s=t.members.map(e=>{let t=a.find(t=>K(t.ref)===K(e));if(!t)throw Error(`a restored annotation is missing: ${K(e)}`);return t});for(let t of o1(s))oY(e.authority,t);return t.rights?we(e.authority):o5(e.authority,s),{item:{type:"annotations.restore",page:t.page,annotations:s,meta:yP(e.session.writeStamp(),o,t.members)},reverse:[{kind:"annotation.remove",ref:r,left:s,...t.rights?{rights:t.rights}:{}}]}}(e,t);case"annotation.reorder":return function(e,t){let n="annotations"===t.family?"annotations.reorder":"forms.reorderWidgets",r=function(e,t){try{return y3(e.runtime,e.session,t)}catch{return null}}(e,t.page);if(!r)return yH(e,n);let i=y2(r,t.family),o=t.refs.filter(e=>{let n=wr(i,e);return void 0!==n&&n===wr(t.after,e)});if(0===o.length)return yH(e,n);wi(e,t.family,o);let a=new Set(o.map(K)),s=new Set(i.map(K).filter(e=>!a.has(e))),l=r;for(let n of t.before.filter(e=>a.has(K(e)))){let r=t.before.findIndex(e=>K(e)===K(n)),i=t.before.slice(0,r).reverse().find(e=>s.has(K(e))),o=y6(l,t.family,[n],i?{after:i}:"start");y5(e.runtime,e.session,o),s.add(K(n)),l=y3(e.runtime,e.session,t.page)}let u=y2(l,t.family);return{item:wo(e,t.family,t.page,u,o),reverse:[{...t,refs:o,before:i,after:u}]}}(e,t);case"field.remove":let u;return oQ(e.authority,"doc.forms.modify"),t.rights&&oQ(e.authority,"doc.forms.import"),(u=EW(e,t.objectNumber))&&yV(u.field,t.left)&&yX(e.runtime,e.session,t.widgets??[])?ET(e,u,t.rights):yH(e,"forms.delete");case"field.restore":return function(e,t){if(oQ(e.authority,"doc.forms.modify"),t.rights&&oQ(e.authority,"doc.forms.import"),ac(Eb(e),t.name))return yH(e,"forms.restore");for(let n of t.pages)try{e.session.resolvePageRef(n)}catch{return yH(e,"forms.restore")}yL(e.runtime,e.session.requireDocPtr(),t.capture),e.session.invalidateDerived();let{field:n}=EU(e,t.objectNumber);return{item:{type:"forms.restore",...EX(e,n)},reverse:[ES(e,n,t.rights)]}}(e,t);case"widget.restore":let d;oQ(e.authority,"doc.forms.modify");try{d=e.session.resolvePageRef(t.page).pageIndex}catch{return yH(e,"forms.restoreWidget")}if(Ez(e,t.widget))return yH(e,"forms.restoreWidget");let c=t.detached.filter(e=>e.objectNumber===t.fieldObjectNumber);if(!yX(e.runtime,e.session,c))return yH(e,"forms.restoreWidget");yj(e.runtime,e.session.requireDocPtr(),d,t.capture),e.session.invalidateDerived(),t.detached.length>0&&yY(e.runtime,e.session,t.detached);let f=function(e,t){let n=wd(e,t);if("widget"!==n.subtype)throw Error(`${K(t)} reads as no widget`);return n}(e,t.widget),m=null===t.fieldObjectNumber?null:EU(e,t.fieldObjectNumber).field;return{item:{type:"forms.restoreWidget",field:m,widgets:[f],meta:y4(e.session.writeStamp(),m?[m.ref]:[],[(n=e,{ref:r=t.widget,objectNumber:wm(n,r),page:r.page})])},reverse:[{kind:"widget.delete",widget:t.widget,left:f}]};case"widget.delete":let p;return oQ(e.authority,"doc.forms.modify"),(p=Ez(e,t.widget))&&yV(p,t.left)?Ek(e,p):yH(e,"forms.deleteWidget");case"widgets.added":return function(e,t){let n,r,i,o;oQ(e.authority,"doc.forms.modify");let a="remove"===t.direction,s="forms.addWidget"===t.reports?"forms.removeWidget":"forms.repeat",l=a?s:t.reports;if(!yX(e.runtime,e.session,t.objects)||!yX(e.runtime,e.session,t.guards)||(i=ED(e,t.fieldObjectNumber),o=t.kids,!(null!==i&&i.length===o.length&&i.every((e,t)=>e===o[t]))))return yH(e,l);let{fn:u,mem:d}=e.runtime,c=e.session.requireDocPtr(),f=t=>{try{return e.session.resolvePageRef(t).pageIndex}catch{return null}},m=(e,t)=>u.EPDFPage_GetAnnotIndexByObjectNumberRaw(c,e,t),p=(e,t,n)=>{if(!u.EPDFPage_RemoveAnnotRaw(c,e,t))throw new N(G.Unknown,`${n} could not leave its page`)},h=(e,t,n)=>{let r=m(e,t);if(!(r<0)&&!(n<0)&&r!==n&&!hY(d,4,t=>(d.poke(t,"i32",r,0),u.EPDFPage_MoveAnnotsRaw(c,e,t,1,n))))throw new N(G.Unknown,"an annotation could not move")},F=t.fieldObjectNumber,{split:g}=t,_=E_(t),P=g?.merged.page?f(g.merged.page):null,D=[],b=[];if(a){for(let t of(b=_.map(t=>({objectNumber:t.objectNumber,capture:yM(e.runtime,c,t.objectNumber,Ef)})),_))if(!u.EPDFForm_DetachWidget(c,F,t.objectNumber))throw new N(G.Unknown,"a widget could not leave its field");let i=new Map;for(let e of t.added){if(!e.page)continue;let t=i.get(e.page.objectNumber)??[];t.push(e),i.set(e.page.objectNumber,t)}for(let[t,n]of i){let r=n[0].page;if(null===f(r))continue;gx(e.runtime,e.session,t);let i=f(r),o=n.map(e=>m(i,e.objectNumber)).filter(e=>e>=0).sort((e,t)=>e-t);if(0!==o.length)for(let t of(D.push({page:r,capture:yC(e.runtime,c,i,o)}),[...o].reverse()))p(i,t,"a widget")}if(g&&null!==P){let t=m(P,g.widget.objectNumber);t>=0&&(n=yC(e.runtime,c,P,[t]),p(P,t,"the split widget")),yj(e.runtime,c,P,g.mergedEntry),h(P,g.merged.objectNumber,t)}e.session.invalidateDerived(),r=yY(e.runtime,e.session,t.objects)}else{let n=t.captures.map(({page:e,capture:t})=>({pageIndex:f(e),capture:t}));if(n.some(({pageIndex:e})=>null===e)||g&&(null===P||!g.widgetEntry))return yH(e,l);if(g&&null!==P&&g.widgetEntry){let t=m(P,g.merged.objectNumber);t>=0&&(p(P,t,"the field"),function(e,t){try{yR(e.runtime,e.session.requireDocPtr(),t,[])}catch{throw new N(G.Unknown,`object ${t} went with its entry on the page`)}}(e,g.merged.objectNumber)),yj(e.runtime,c,P,g.widgetEntry),h(P,g.widget.objectNumber,t)}for(let{pageIndex:t,capture:r}of n)yj(e.runtime,c,t,r);e.session.invalidateDerived();let i=yY(e.runtime,e.session,t.objects);for(let{capture:n}of(_.forEach((e,n)=>{let r,i=t.values[n]??"",o=""!==i?d.writeU16String(i):0n;try{r=u.EPDFForm_AttachWidget(c,F,e.objectNumber,t.states[n]??"",o,0)}finally{0n!==o&&d.free(o)}if(!r)throw new N(G.Unknown,"a widget could not join its field again")}),t.widgets))yT(e.runtime,c,n);e.session.invalidateDerived(),r=i.map(t=>({...t,after:yR(e.runtime,c,t.objectNumber,[])}))}let y=[...Eg(t),...t.added];return{item:"forms.repeat"===t.reports?Ey(e,F,y,[],a):function(e,t,n,r){let{field:i}=EU(e,n);return{type:t,...E0(e,{field:i,meta:y4(e.session.writeStamp(),[i.ref],[...r])})}}(e,l,F,y),reverse:[{...t,direction:a?"restore":"remove",objects:r,guards:a?[]:EP(e,_),kids:ED(e,F)??[],widgets:a?b:[],captures:a?D:[],split:g?{merged:g.merged,mergedEntry:g.mergedEntry,widget:g.widget,...a&&n?{widgetEntry:n}:{}}:null}]}}(e,t);case"fields.repeat":return function(e,t){oQ(e.authority,"doc.forms.modify");let n=e.session.requireDocPtr();if("remove"===t.direction){let r=t.left.flatMap((n,r)=>{let i=EW(e,EK(n.ref));return i&&yV(i.field,n)&&yX(e.runtime,e.session,t.guards[r]??[])?[i]:[]});if(0===r.length)return yH(e,"forms.repeat");let i=r.map(({objectNumber:t,field:r})=>({objectNumber:t,name:r.name,pages:r.widgets.flatMap(e=>e.page?[e.page]:[]),capture:yB(e.runtime,n,t)})),{removedWidgets:o,calculationOrder:a}=new Et(e.runtime,e.session).deleteFields(r.map(({objectNumber:e})=>EM(e)),e.signal),s=r.map(({field:e})=>e);return{item:{type:"forms.repeat",as:"fields",undone:!0,fields:s,widgets:[],dropped:[],...EC(a),meta:y4(e.session.writeStamp(),s.map(e=>e.ref),o,[])},reverse:[{kind:"fields.repeat",direction:"restore",left:[],guards:[],captures:i},...a?[Ej(a)]:[]]}}let r=Eb(e),i=t.captures.filter(({name:t,pages:n})=>{if(ac(r,t))return!1;try{for(let t of n)e.session.resolvePageRef(t)}catch{return!1}return r.add(t),!0});if(0===i.length)return yH(e,"forms.repeat");for(let{capture:t}of i)yL(e.runtime,n,t);e.session.invalidateDerived();let o=i.map(({objectNumber:t})=>EU(e,t).field);return{item:{type:"forms.repeat",as:"fields",...E0(e,{fields:o,meta:y4(e.session.writeStamp(),o.map(e=>e.ref),o.flatMap(e=>e.widgets))}),dropped:[]},reverse:[{kind:"fields.repeat",direction:"remove",left:o,guards:o.map(t=>EP(e,t.widgets)),captures:[]}]}}(e,t);case"calculations.restore":let h,F;return oQ(e.authority,"doc.forms.modify"),F=function(e,{before:t,after:n},r){let i=n.filter(e=>!t.includes(e)),o=e.filter(e=>!i.includes(e));for(let i of t){if(n.includes(i)){if(wQ(t,i)===wQ(n,i)||wQ(e,i)!==wQ(n,i))continue;o=o.filter(e=>e!==i)}else if(o.includes(i)||!r(i))continue;let a=t.indexOf(i),s=t.slice(0,a).reverse().find(e=>o.includes(e)),l=void 0===s?0:o.indexOf(s)+1;o=[...o.slice(0,l),i,...o.slice(l)]}return o}(h=wK(e.runtime,gv(e.runtime,e.session)),t,t=>null!==EW(e,t)),wJ(h,F)?yH(e,"forms.reorderCalculations"):(wZ(e.runtime,e.session.requireDocPtr(),F),e.session.invalidateDerived(),{item:Ew(e,F,[...new Set([...h,...F])].filter(e=>h.indexOf(e)!==F.indexOf(e))),reverse:[Ej({before:h,after:F})]});case"metadata.revert":return function(e,t){oQ(e.authority,"doc.metadata.modify");let n=new FF(e.runtime,e.session),r="metadata.update"===t.op?n.read(e.signal):n.readCustom(e.signal),i=t.left,o=Object.keys(i),a=o.filter(e=>yV(E6(r,e),i[e]));if(0===a.length)return yH(e,t.op);let s=E5(t.restore,a),l=new FZ(e.runtime,e.session),u=o.filter(e=>!a.includes(e)),d={kind:"metadata.revert",op:t.op,restore:E5(t.left,a),left:s};return"metadata.update"===t.op?{item:{type:"metadata.update",...l.update(s,e.signal),...u.length>0?{skipped:u}:{}},reverse:[d]}:{item:{type:"metadata.updateCustom",...l.updateCustom(s,e.signal),...u.length>0?{skipped:u}:{}},reverse:[d]}}(e,t);case"outline.remove":let g=Au(e).tree();if(!g.has(t.ref.objectNumber))return yH(e,"outline.delete");return(oQ(e.authority,"doc.outline.modify"),yV(g.subtreeOf(t.ref.objectNumber),t.left.map(e=>e.objectNumber))&&yX(e.runtime,e.session,t.left))?Ac(e,t.ref):yH(e,"outline.delete");case"outline.restore":return function(e,t){var n,r,i;let o=Au(e),a=o.tree();if(a.has(t.ref.objectNumber)||t.parent&&!a.has(t.parent.objectNumber))return yH(e,"outline.restore");oQ(e.authority,"doc.outline.modify"),n=e.runtime,r=e.session.requireDocPtr(),yU(n,i=t.capture,e=>{if(!n.fn.EPDFOutline_ImportItemRaw(r,e,i.byteLength))throw new N(G.Unknown,"EPDFOutline_ImportItemRaw refused a capture")});let s=o.restored(t.ref.objectNumber);return{item:{type:"outline.restore",...s},reverse:[{kind:"outline.remove",ref:t.ref,left:Am(e,s.items.map(e=>e.ref))}]}}(e,t);case"outline.move":return function(e,t){let n=Au(e),r=n.tree(),i=new Map(t.left.map(({item:e,parent:t})=>[e,t])),o=t.placements.filter(({item:e,parent:t})=>r.parentOf(e)===i.get(e)&&(0===t||r.has(t))&&!r.isAtOrUnder(t,e));if(0===o.length)return yH(e,"outline.move");oQ(e.authority,"doc.outline.modify");let a=o.map(({item:e})=>e),s=n.placementsOf(a,r),l=Af(e,r,a);return{item:{type:"outline.move",...n.place(o,r)},reverse:[{kind:"outline.move",placements:s,left:o.map(({item:e,parent:t})=>({item:e,parent:t}))},...l]}}(e,t);case"outline.reopen":let _,P,D,b,y;return i=e,o=t,P=(_=Au(i)).tree(),D=_.find(o.ref,P),y=(b=P.childrenOf(o.ref.objectNumber)).length===o.children.length&&b.every(e=>o.children.includes(e)),D&&!D.open&&y?(oQ(i.authority,"doc.outline.modify"),{item:{type:"outline.update",..._.update(o.ref,{open:!0})},reverse:[]}):yH(i,"outline.update");case"pages.rotate":return Ag(e,()=>(function(e,t){let n=AN(AI(e)),r=t.pages.filter(e=>n.get(e)===t.left);if(0===r.length)return yH(e,"pages.rotate");oQ(e.authority,"doc.pages.assemble");let i=r.map(q),o=A_(e).rotate(i,t.rotation,e.signal);return{item:{type:"pages.rotate",pages:i,rotation:t.rotation,...o},reverse:[{kind:"pages.rotate",pages:r,rotation:t.left,left:t.rotation}]}})(e,t));case"pages.setScale":let w=t.pages.filter(n=>{let r,i;return r=AT(e,n),i=t.left,JSON.stringify(r)===JSON.stringify(i)});if(0===w.length)return yH(e,"pages.setScale");for(let n of(oQ(e.authority,"doc.annotate.modify"),w))AM(e,n,t.measure);let E=w.map(q);return{item:{type:"pages.setScale",pages:E,measure:t.measure&&nX(t.measure,AB(e,w[0])),...AR(e,E[0])},reverse:[{kind:"pages.setScale",pages:w,measure:t.left,left:t.measure}]};case"pages.reorder":return Ag(e,()=>(function(e,t){let n=AO(e),r=new Map(t.left.map(({page:e,after:t})=>[e,t])),i=t.placements.filter(({page:e,after:t})=>{let i=n.indexOf(e);return i>=0&&(n[i-1]??0)===r.get(e)&&(0===t||n.includes(t))});if(0===i.length)return yH(e,"pages.reorder");oQ(e.authority,"doc.pages.assemble");let o=i.map(({page:e})=>e),a=Ax(n,o),s=Aw(e),l=A_(e),u=null,d=s,c=n;for(let{page:t,after:n}of i){let r=0===n?"start":{after:q(n)};({layout:u}=l.reorder([q(t)],r,e.signal));let i=AO(e);d=Av(d,c,i,[t]),c=i}let f=AA(e,s,AE(s,d,t.labels));return{item:{type:"pages.reorder",pages:o.map(q),layout:f?AI(e):u,meta:AC(e)},reverse:[{kind:"pages.reorder",placements:a,left:Ax(AO(e),o),...f?{labels:f}:{}}]}})(e,t));case"pages.restore":return Ag(e,()=>(function(e,t){let n=AO(e),r=t.pages.filter(({page:e})=>!n.includes(e));if(0===r.length)return yH(e,"pages.restore");oQ(e.authority,"doc.pages.assemble");let i=Aw(e),o=e.session.requireDocPtr();for(let{capture:t}of r)!function(e,t,n){yU(e,n,r=>{if(!e.fn.EPDFPage_ImportRaw(t,r,n.byteLength))throw new N(G.Unknown,"EPDFPage_ImportRaw refused a capture")})}(e.runtime,o,t);e.session.refreshPageRegistry(),e.session.invalidateDerived();let a=AO(e),s=AG(a,r.map(({page:e})=>e)),l=AA(e,i,AE(i,s.reduce((e,t)=>r0(e,a.indexOf(t),1),i),t.labels));return{item:{type:"pages.restore",pages:s.map(q),layout:AI(e),meta:AC(e)},reverse:[Ay(e,s,l)]}})(e,t));case"pages.remove":return Ag(e,()=>(function(e,t){let n=AO(e),r=t.pages.filter(({page:t,left:r})=>n.includes(t)&&Ak(e,t)===r).map(({page:e})=>e);if(0===r.length||r.length>=n.length)return yH(e,"pages.delete");oQ(e.authority,"doc.pages.assemble");let i=function(e,t,n){let r=[];for(let i of t){let t=EW(e,i);t&&t.field.widgets.every(e=>e.page&&n.has(e.page.objectNumber))&&r.push(...ET(e,t).reverse)}return r}(e,t.fields??[],new Set(r)),o=Ab(e,AG(n,r),t.labels);return{item:o.item,reverse:[...o.reverse,...i]}})(e,t));case"attachments.remove":let A=y$(e.runtime,e.session.requireDocPtr(),t.ref.key);if(!A||!yZ(A,t.left))return yH(e,"attachments.delete");return oQ(e.authority,"doc.attachments.modify"),wg(e,t.ref);case"attachments.restore":return function(e,t){var n,r,i;let o=wF(e);if(o.find(t.ref))return yH(e,"attachments.restore");oQ(e.authority,"doc.attachments.modify"),n=e.runtime,r=e.session.requireDocPtr(),yU(n,i=t.capture,e=>{if(!n.fn.EPDFAttachment_ImportRaw(r,e,i.byteLength))throw new N(G.Unknown,"EPDFAttachment_ImportRaw refused a capture")});let a=o.find(t.ref);if(!a)throw new N(G.Unknown,`attachment \'${t.ref.key}\' did not come back`);return{item:{type:"attachments.restore",attachment:a,meta:o.meta(t.ref)},reverse:[w_(e,t.ref)]}}(e,t)}})(i,e)),r,n)}context(e,t,n){let r,i={runtime:this.runtime,session:this.session,...this.fonts?{fonts:this.fonts}:{},authority:e,signal:t,limits:this.limits,fillsOwnField:()=>r??(r=n(i))};return i}};function Az(e,t,n,r,i){let o=[],a=[];for(let t of n){hW(i),e.clearMissingCharacters();let n=t(),s=e.missingCharacters(),l=0===s.length?n.item:{...n.item,meta:{...n.item.meta,missingCharacters:s}};o.push(r.itemOut(l)),a.push(n.reverse)}return{items:o,record:{userId:t.identity.userId??null,steps:a.reverse().flat()}}}var AU=class{constructor(){hJ(this,"entries",new Map),hJ(this,"bytes",0)}outcome(e){return this.entries.get(e)?.outcome}record(e){let t=this.entries.get(e);if(t)return t.unavailable?{unavailable:t.unavailable}:{record:t.record}}keepApplied(e,t,n,r){let i=r?function(e){let t=0,n=e=>{for(let n of e)t+=(n.before?.byteLength??0)+n.after.byteLength};for(let r of e.steps)switch(r.kind){case"objects.revert":n(r.objects);break;case"annotation.restore":t+=r.capture.byteLength,n(r.unlinked);break;case"field.restore":case"outline.restore":case"attachments.restore":t+=r.capture.byteLength;break;case"widgets.added":for(let{capture:e}of(n(r.objects),n(r.guards),r.widgets))t+=e.byteLength;for(let{capture:e}of r.captures)t+=e.byteLength;t+=(r.split?.mergedEntry.byteLength??0)+(r.split?.widgetEntry?.byteLength??0);break;case"fields.repeat":for(let e of r.guards)n(e);for(let{capture:e}of r.captures)t+=e.byteLength;break;case"field.remove":n(r.widgets??[]);break;case"outline.remove":n(r.left);break;case"pages.restore":for(let{capture:e}of r.pages)t+=e.byteLength;break;case"attachments.remove":t+=r.left.byteLength}return t}(r):0;this.add(e,{outcome:{kind:"applied",fingerprint:t,result:n},record:r,bytes:i}),this.bytes+=i,this.trimCaptures()}keepRefused(e,t,n){this.add(e,{outcome:{kind:"refused",fingerprint:t,error:n},record:null,bytes:0})}endUndo(){for(let e of this.entries.values())"applied"!==e.outcome.kind||e.unavailable||this.drop(e,"final-change")}add(e,t){for(let[n,r]of(this.entries.set(e,t),this.entries)){if(this.entries.size<=4096)break;this.drop(r,"expired"),this.entries.delete(n)}}trimCaptures(){for(let e of this.entries.values()){if(this.bytes<=0x4000000)break;e.bytes>0&&this.drop(e,"expired")}}drop(e,t){this.bytes-=e.bytes,e.record=null,e.bytes=0,e.unavailable=t}},AV=new WeakMap;function AW(e){let t=AV.get(e);return t||(t=new AU,AV.set(e,t)),t}function Aq(e){let t="none"!==e.openedAs;return{encryptionState:t?"encrypted":"none",encryptionRequiresPassword:!1,securityHandlerRevision:t?e.securityHandlerRevision:null,pdfPermissionsBits:e.permissionsBits,pdfPermissionsAllAllowed:(0xfffffffc&e.permissionsBits>>>0)>>>0==0xfffffffc,pdfOpenedAs:e.openedAs,securityProbedAt:e.probedAt}}var AH=class{constructor(e){this.runtime=e,hV(this.runtime)}probeFile(e,t=null){let n=Date.now(),r=null,i=null;try{if(r=this.runtime.fileAccess.fromNodeFile(e),!(i=this.runtime.fn.FPDF_LoadCustomDocument(r.ptr,t??""))){var o;let e=this.runtime.fn.FPDF_GetLastError();if(4===e)return{encryptionState:"encrypted",encryptionRequiresPassword:!0,securityHandlerRevision:null,pdfPermissionsBits:null,pdfPermissionsAllAllowed:null,pdfOpenedAs:null,securityProbedAt:n};if(5===e)return{encryptionState:"unsupported",encryptionRequiresPassword:null,securityHandlerRevision:null,pdfPermissionsBits:null,pdfPermissionsAllAllowed:null,pdfOpenedAs:null,securityProbedAt:n};return o=n,{encryptionState:"unknown",encryptionRequiresPassword:null,securityHandlerRevision:null,pdfPermissionsBits:null,pdfPermissionsAllAllowed:null,pdfOpenedAs:null,securityProbedAt:o}}let a=this.runtime.fn.EPDF_IsEncrypted(i),s=this.runtime.fn.FPDF_GetDocPermissions(i)>>>0;return Aq({openedAs:a?this.runtime.fn.EPDF_IsOwnerUnlocked(i)?"owner":"user":"none",permissionsBits:s,securityHandlerRevision:a?this.runtime.fn.FPDF_GetSecurityHandlerRevision(i):null,probedAt:n})}finally{i&&this.runtime.fn.FPDF_CloseDocument(i),r?.close()}}readLiveSecurityInfo(e){let{fn:t}=this.runtime,n=e.requireDocPtr(),r=t.EPDF_IsEncrypted(n),i=t.FPDF_GetDocUserPermissions(n)>>>0;return Aq({openedAs:r?t.EPDF_IsOwnerUnlocked(n)?"owner":"user":"none",permissionsBits:i,securityHandlerRevision:r?t.FPDF_GetSecurityHandlerRevision(n):null,probedAt:Date.now()})}checkPasswordPermissions(e,t,n="any"){let r=e.requireDocPtr(),{mem:i,fn:o}=this.runtime,a=i.alloc(4),s=i.alloc(4),l=i.alloc(4),u=i.alloc(4);try{var d;if(i.poke(a,"i32",0),i.poke(s,"i32",0),i.poke(l,"i32",0),i.poke(u,"i32",0),!o.EPDF_CheckPasswordPermissions(r,t,a,s,l,u))throw new N(G.DocPasswordIncorrect,"incorrect document password");let e=(d=Number(i.peek(a,"i32")),3===d?"owner":2===d?"user":"none");if("owner"===n&&"owner"!==e)throw new N(G.DocPasswordIncorrect,"owner password required");return Aq({openedAs:e,permissionsBits:Number(i.peek(l,"i32"))>>>0,securityHandlerRevision:Number(i.peek(u,"i32")),probedAt:Date.now()})}finally{i.free(u),i.free(l),i.free(s),i.free(a)}}};function AK(e){return"incremental"===e?1:2}function AZ(e){return 1===e?new N(G.DocOpenFailed,"layer artifact cannot be saved because append-only offsets exceed the supported range"):new N(G.DocOpenFailed,"failed to save layer artifact")}function AJ(e,t,n){let r=e.readBytes(t,n);return r.buffer instanceof ArrayBuffer&&0===r.byteOffset&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer}var AQ=class{constructor(e,t){this.runtime=e,this.session=t}snapshot(){if(!this.session.hasUnsavedEdits())return{bytes:this.loadedBytes(),source:"loaded"};let e=this.saveStandaloneToBufferEx("incremental");return e.unchangedSinceLoad?{bytes:this.loadedBytes(),source:"loaded"}:{bytes:e.bytes,source:"working-copy"}}loadedBytes(){return new wR(this.runtime,this.session).loadedBytes()}copyLoadedBytesToFile(e){let t=new wR(this.runtime,this.session),n=Number(this.runtime.fn.EPDFDoc_GetLoadedBytesSize(this.session.requireDocPtr()));this.runtime.fileWrite.removeFile(e);for(let r=0;r{Ft(n,i,0),Ft(n,o,0),Ft(n,a,0);let s=r.EPDFSig_SaveCandidateToOwnedBuffer(e,t,i,o,a);if(!s)throw new N(G.Unknown,"failed to save the signing candidate");try{let e=Fn(n,i);return{kind:"memory",bytes:AX(n.readBytes(s,e)),size:e,objectOffset:Fn(n,o),objectLength:Fn(n,a)}}finally{r.EPDF_FreeBuffer(s)}})}seal(e,t){if("memory"!==e.kind)throw new N(G.InvalidArg,"not a memory candidate");let{mem:n,fn:r}=this.runtime,i=n.alloc(e.bytes.byteLength);try{return n.writeBytes(i,e.bytes),h0(n,[32,8,8,64,8],([o,a,s,l,u])=>{for(let e=0;e<4;e++)Ft(n,o,0,8*e);if(Ft(n,a,0),Ft(n,s,0),Ft(n,u,64),!r.EPDFSig_Seal(i,BigInt(e.bytes.byteLength),BigInt(e.objectOffset),BigInt(e.objectLength),wj[t],o,a,s,l,u))throw new N(G.Unknown,"failed to seal the signing candidate");e.bytes=AX(n.readBytes(i,e.bytes.byteLength));let d=Number(n.peek(u,"i32"));return{byteRange:[Fn(n,o,0),Fn(n,o,8),Fn(n,o,16),Fn(n,o,24)],contentsOffset:Fn(n,a),contentsHexLength:Fn(n,s),digest:AX(n.readBytes(l,d))}})}finally{n.free(i)}}writeContents(e,t,n){if("memory"!==e.kind)throw new N(G.InvalidArg,"not a memory candidate");let{mem:r}=this.runtime,i=r.alloc(e.bytes.byteLength);try{r.writeBytes(i,e.bytes),AY(this.runtime,i,e.bytes.byteLength,0,t,n),e.bytes=AX(r.readBytes(i,e.bytes.byteLength))}finally{r.free(i)}}openSealed(e,t){if("memory"!==e.kind)throw new N(G.InvalidArg,"not a memory candidate");let n=this.baseDocuments.acquireMemoryBase({key:`signed:${iX()}`,bytes:e.bytes,password:t});return h9(this.runtime,n,{kind:"fresh"},t)}discard(){}},A1=class{constructor(e,t,n,r=A3){this.runtime=e,this.baseDocuments=t,this.basePath=n,this.candidatePath=r}save(e,t,n){let{mem:r,fn:i}=this.runtime,o=this.candidatePath(this.basePath,n);this.runtime.fileWrite.removeFile(o);let a=this.runtime.fileWrite.toNodeFile(o);try{return h0(r,[8,8,8],([n,s,l])=>{if(Ft(r,n,0),Ft(r,s,0),Ft(r,l,0),!i.EPDFSig_SaveCandidate(e,t,a.ptr,n,s,l))throw new N(G.Unknown,"failed to save the signing candidate");return{kind:"file",path:o,size:Fn(r,n),objectOffset:Fn(r,s),objectLength:Fn(r,l)}})}catch(e){throw a.close(),this.runtime.fileWrite.removeFile(o),e}finally{a.close()}}seal(e,t){let n;if("file"!==e.kind)throw new N(G.InvalidArg,"not a file candidate");let{mem:r,fn:i}=this.runtime,o=this.runtime.fileAccess.readRange(e.path,e.objectOffset,e.objectLength);if(o.byteLength!==e.objectLength)throw new N(G.Unknown,"the signing candidate file is shorter than its object span");let a=r.alloc(o.byteLength);try{r.writeBytes(a,o),n=function(e,t,n,r,i){let{fn:o,mem:a}=e;return h0(a,[32,8,8],([e,s,l])=>{for(let t=0;t<4;t++)Ft(a,e,0,8*t);if(Ft(a,s,0),Ft(a,l,0),!o.EPDFSig_SealSpan(t,BigInt(n),BigInt(r),BigInt(i),e,s,l))throw new N(G.Unknown,"failed to seal the signing candidate");return{byteRange:[Fn(a,e,0),Fn(a,e,8),Fn(a,e,16),Fn(a,e,24)],contentsOffset:Fn(a,s),contentsHexLength:Fn(a,l)}})}(this.runtime,a,o.byteLength,e.objectOffset,e.size),this.runtime.fileWrite.writeRange(e.path,e.objectOffset,r.readBytes(a,o.byteLength))}finally{r.free(a)}let s=this.runtime.fileAccess.fromNodeFile(e.path);try{let e=h0(r,[32,64,8],([e,o,a])=>{for(let t=0;t<4;t++)Ft(r,e,n.byteRange[t],8*t);if(Ft(r,a,64),!i.EPDFSig_DigestFileRange(s.ptr,e,wj[t],o,a))throw new N(G.Unknown,"failed to digest the signing candidate file");return AX(r.readBytes(o,Number(r.peek(a,"i32"))))});return{...n,digest:e}}finally{s.close()}}writeContents(e,t,n){if("file"!==e.kind)throw new N(G.InvalidArg,"not a file candidate");let{mem:r}=this.runtime,i=this.runtime.fileAccess.readRange(e.path,e.objectOffset,e.objectLength),o=r.alloc(i.byteLength);try{r.writeBytes(o,i),AY(this.runtime,o,i.byteLength,e.objectOffset,t,n),this.runtime.fileWrite.writeRange(e.path,e.objectOffset,r.readBytes(o,i.byteLength))}finally{r.free(o)}}openSealed(e,t){if("file"!==e.kind)throw new N(G.InvalidArg,"not a file candidate");let n=this.baseDocuments.acquireFileBase({key:`signed:${e.path}`,path:e.path,password:t});return h9(this.runtime,n,{kind:"fresh"},t)}discard(e){"file"===e.kind&&this.runtime.fileWrite.removeFile(e.path)}};function A3(e,t){return`${e}.signing-${t}.pdf`}function A2(e,t,n,r){return`${e}.${t}-${n}.${r}`}function A6(e,t,n,r){var i,o;let a=e=>new N(G.SignatureRefused,`the sealed bytes ${e}`),s=wS(e,n),l=s.find(e=>"objectNumber"===e.field.kind&&e.field.objectNumber===r.fieldObjectNumber);if(!l)throw a("lost the signature field");if(!l.signed||"whole-revision"!==l.coverage||!l.byteRange)throw a("do not carry a whole-revision signature on the field");if(i=l.byteRange,o=r.byteRange,i[0]!==o[0]||i[1]!==o[1]||i[2]!==o[2]||i[3]!==o[3])throw a(`carry /ByteRange [${l.byteRange.join(" ")}] where [${r.byteRange.join(" ")}] was sealed`);if(!e.fn.EPDFSig_IsRevisionChainValid(n))throw a("have a broken cross-reference chain");let u=wx(e,t,s);if(l.revisionIndex!==u.length-1)throw a("seal an earlier revision than the candidate");if(!yZ(wk(e,n,l.index),r.cms))throw a("carry /Contents that are not the CMS installed");return l}function A5(e,t,n){let r=gv(e,t),i=e.fn.EPDFForm_GetFieldIndexByObjNum(r,n);return i<0?null:PY(e,r,i)}var A4={"adbe.pkcs7.detached":0,"ETSI.CAdES.detached":1,"ETSI.RFC3161":2},A8={all:1,include:2,exclude:3},A7={bytes:52,ptrBytes:4,subfilter:0,digest:4,contentsSize:8,name:12,reason:16,location:20,contactInfo:24,signingTime:28,docmdpPermission:32,fieldmdpAction:36,fieldmdpFields:40,fieldmdpFieldCount:44,lockPermission:48},A9={bytes:80,ptrBytes:8,subfilter:0,digest:4,contentsSize:8,name:16,reason:24,location:32,contactInfo:40,signingTime:48,docmdpPermission:56,fieldmdpAction:60,fieldmdpFields:64,fieldmdpFieldCount:72,lockPermission:76},ve=class{constructor(e,t,n,r){this.runtime=e,this.session=t,this.baseDocuments=n,this.candidatePath=r}prepare(e,t){if(this.session.pendingSigning)throw new N(G.SigningPending,`a signing is pending (${this.session.pendingSigning.prepared.signingId}); complete or cancel it first`);if(!e.field&&(e.kind??"signature")!=="timestamp")throw new N(G.InvalidArg,"a signature needs a `field`: only a document timestamp (`kind: \'timestamp\'`) can be given one by the engine",{details:{field:"field"}});let n=new wR(this.runtime,this.session),r=e.field?n.resolveField(e.field):null,i=r?A5(this.runtime,this.session,r.fieldObjectNumber):null;r?o4(t,i,"sign"):oQ(t,"doc.sign");let o=e.lock??this.defaultLock(i,(e.kind??"signature")==="signature",r?.lock??null);if(r?.signed)throw new N(G.SignatureRefused,"the signature field is already signed");if(e.appearance&&!r?.widget)throw new N(G.SignatureRefused,r?"the signature field has no widget to carry an appearance":"a timestamp with a field of its own shows nowhere, so it carries no appearance");let a=e.digest??"sha256";if(!(a in wj)||"sha1"===a)throw new N(G.SignatureRefused,`unsupported digest \'${a}\'`);let s=(e.kind??"signature")==="timestamp"?"ETSI.RFC3161":e.subFilter??"ETSI.CAdES.detached";if(!(s in A4))throw new N(G.SignatureRefused,`unsupported subFilter \'${s}\'`);let l=e.contentsSizeBytes??8192;if(!Number.isInteger(l)||l<256||l>4194304)throw new N(G.SignatureRefused,"contentsSize must be an integer in [256, 4194304]");let u=this.session.versionRef(n.version().sha256),d=iX(),c=new h8;try{let t,n=this.openCandidate(d,c);c.push(()=>n.close());let i=r?null:function(e,t){let{fn:n,mem:r}=e;for(let i=1;i<=64;i++){let o,a,s=`Timestamp${i}`,l=r.writeU16String(s);try{o=n.EPDFForm_CreateField(t,7,l,0)}finally{r.free(l)}if(o<=0)continue;let u=n.EPDFPage_CreateAnnotRaw(t,0,20,0);if(0n===u)throw new N(G.SignatureRefused,"the document has no first page to put the timestamp field on");try{Dx(n,r,u,{left:0,top:0,right:0,bottom:0}),Dk(n,u,{print:!0,locked:!0}),a=n.EPDFAnnot_GetObjectNumber(u)}finally{n.FPDFPage_CloseAnnot(u)}if(a<=0||!n.EPDFForm_AttachWidget(t,o,a,"",0n,0))throw new N(G.Unknown,"the timestamp field could not be given its widget");return function(e,t,n){let{fn:r}=e,i=r.EPDFPage_GetAnnotIndexByObjectNumberRaw(t,0,n),o=i<0?0n:r.EPDFPage_GetAnnotRaw(t,0,i);if(0n===o)throw new N(G.Unknown,"the timestamp widget is not on its page");try{if(!r.FPDFAnnot_SetAP(o,0,0n))throw new N(G.Unknown,"the timestamp widget kept its appearance")}finally{r.FPDFPage_CloseAnnot(o)}}(e,t,a),{fieldObjectNumber:o,name:s}}throw new N(G.SignatureRefused,"the engine could not make a field for the timestamp: no name from Timestamp1 to Timestamp64 could be used")}(this.runtime,n.docPtr),f=r?r.fieldObjectNumber:i.fieldObjectNumber,m=e.signer,p=this.callPrepare(n.docPtr,f,{subfilter:A4[s],digest:wj[a],contentsSize:l,name:m?.name??null,reason:m?.reason??null,location:m?.location??null,contactInfo:m?.contactInfo??null,signingTime:m?.signedAt!==void 0?hH(m.signedAt):null,docmdpPermission:e.certify?.permission??0,fieldmdpAction:o?A8[o.action]:0,fieldmdpFields:o?.action==="all"?[]:o?.fields??[],lockPermission:o?.permission??0});if(0===p)throw new N(G.SignatureRefused,"the engine refused to author the signature (the field is signed, read-only or locked, a certification is not allowed here, the seed value requires what is not implemented, or the request is inconsistent)");let h=iE(e.appearance??null);h&&r?.widget&&w3(this.runtime,n.docPtr,new hQ,r.widget,h);let F=this.storeFor(),g=F.save(n.docPtr,p,d);try{t=F.seal(g,a)}catch(e){throw F.discard(g),e}let _={signingId:d,digest:t.digest,algorithm:a,byteRange:t.byteRange,contentsSizeBytes:l,subFilter:s,expectedVersion:u,expiresAt:null,...i?{field:{kind:"fqn",name:i.name}}:{}};return this.session.pendingSigning={prepared:_,fieldObjectNumber:f,madeField:null!==i,saved:g,contentsOffset:t.contentsOffset,contentsHexLength:t.contentsHexLength},_}finally{c.close()}}complete(e,t,n){var r,i;let o=this.session.pendingSigning;if(!o||o.prepared.signingId!==e.signingId){let t=this.session.lastCompletion;if(t&&t.signingId===e.signingId){if(!yZ(t.cms,e.cms))throw new N(G.SignatureRefused,"this signing already completed with a different CMS");return{...t.result,status:"already-completed"}}throw new N(G.NotFound,`no pending signing \'${e.signingId}\'`)}if(o.madeField?oQ(n,"doc.sign"):o4(n,A5(this.runtime,this.session,o.fieldObjectNumber),"sign"),r=o.prepared.expectedVersion,i=e.expectedVersion,r.baseSha256!==i.baseSha256||r.editsVersion!==i.editsVersion)throw new N(G.SigningVersionMismatch,"expectedVersion is not the version the candidate was prepared on");if(0===e.cms.byteLength||48!==e.cms[0])throw new N(G.SignatureRefused,"the CMS is not a DER SEQUENCE");if(e.cms.byteLength>o.prepared.contentsSizeBytes)throw new N(G.SignatureRefused,`the CMS (${e.cms.byteLength} bytes) does not fit the reserved ${o.prepared.contentsSizeBytes} bytes`);let a=this.storeFor(),s={byteRange:o.prepared.byteRange,contentsOffset:o.contentsOffset,contentsHexLength:o.contentsHexLength,digest:o.prepared.digest};a.writeContents(o.saved,s,e.cms);let l=a.openSealed(o.saved,this.session.password);this.verifySealed(l,{fieldObjectNumber:o.fieldObjectNumber,byteRange:o.prepared.byteRange,cms:e.cms}),this.session.install(l),gS(this.runtime,this.session),wC(this.runtime,this.session);let u=new wR(this.runtime,this.session),d=u.readSnapshot(),c=d.signatures.find(e=>"objectNumber"===e.field.kind&&e.field.objectNumber===o.fieldObjectNumber);if(!c)throw new N(G.Unknown,"the installed document lost the signature field");let f={status:"completed",signature:c,version:u.version(),previous:o.prepared.expectedVersion,protection:d.protection,meta:{affectedPages:this.session.allRecords().map(e=>q(e.pageObjectNumber)),cacheDelta:null,opId:t,undoable:!1}};return this.session.lastCompletion={signingId:e.signingId,cms:e.cms.slice(),result:f},f}cancel(e){let t=this.session.pendingSigning;return t&&t.prepared.signingId===e?(this.session.pendingSigning=null,this.storeFor().discard(t.saved),{status:"cancelled"}):this.session.lastCompletion?.signingId===e?{status:"already-completed"}:{status:"unknown"}}defaultLock(e,t,n){if(n)return;let r=t?function(e,t){let{fn:n,mem:r}=e,i=gv(e,t),o=t.requireDocPtr(),a=new PR(e,o),s=[],l=n.EPDFForm_CountFields(i);for(let t=0;tn.EPDFForm_GetFieldName(i,t,e,r));l&&s.push(l)}return s}(this.runtime,this.session):[];if(null!==e||0!==r.length)return{action:"include",fields:[...null===e?[]:function(e,t,n){let{fn:r,mem:i}=e,o=gv(e,t),a=[],s=r.EPDFForm_CountFields(o);for(let t=0;tr.EPDFForm_GetFieldName(o,t,e,n));s&&a.push(s)}return a}(this.runtime,this.session,e),...r]}}callPrepare(e,t,n){let{mem:r,fn:i}=this.runtime,o="wasm"===this.runtime.kind?A7:A9,a=[],s=e=>{if(null===e)return 0n;let t=r.writeU16String(e);return a.push(t),t};try{return gf(this.runtime,n.fieldmdpFields,(l,u)=>hY(r,o.bytes,d=>{for(let e=0;e{4===o.ptrBytes?r.poke(d,"i32",Number(t),e):r.poke(d,"i64",t,e)};return r.poke(d,"i32",n.subfilter,o.subfilter),r.poke(d,"i32",n.digest,o.digest),r.poke(d,"i32",n.contentsSize,o.contentsSize),c(o.name,s(n.name)),c(o.reason,s(n.reason)),c(o.location,s(n.location)),c(o.contactInfo,s(n.contactInfo)),c(o.signingTime,(e=>{if(null===e)return 0n;let t=r.writeU8String(e);return a.push(t),t})(n.signingTime)),r.poke(d,"i32",n.docmdpPermission,o.docmdpPermission),r.poke(d,"i32",n.fieldmdpAction,o.fieldmdpAction),c(o.fieldmdpFields,u>0?l:0n),r.poke(d,"i32",u,o.fieldmdpFieldCount),r.poke(d,"i32",n.lockPermission,o.lockPermission),i.EPDFSig_Prepare(e,t,d)}))}finally{for(let e=a.length-1;e>=0;e--)r.free(a[e])}}storeFor(){let e=this.session.source.base;return e?.kind==="file"?new A1(this.runtime,this.baseDocuments,e.path,this.candidatePath):new A0(this.runtime,this.baseDocuments)}verifySealed(e,t){let{fn:n}=this.runtime;try{let r=n.EPDFSig_LoadModel(e.docPtr);if(!r)throw new N(G.Unknown,"the sealed bytes have no signature model");try{A6(this.runtime,e.docPtr,r,t)}finally{n.EPDFSig_CloseModel(r)}"layer"!==this.session.kind&&(this.session.persistLayerArtifact=!1)}catch(t){throw e.close(),t}}openCandidate(e,t){let n=this.session.password,r=this.session.source,i=new AQ(this.runtime,this.session),o=i.canWriteScratchFiles()&&r.base?.kind==="file"?r.base.path:null;if("layer"===this.session.kind&&r.base&&!this.loadedDeltaHoldsSignedBytes()){let a=this.baseDocuments.retainByKey(r.base.key);if(a){let s=r.layer??{kind:"fresh"};if(this.session.hasUnsavedEdits())if(o){let n=A2(o,"signing",e,"layer");t.push(()=>this.runtime.fileWrite.removeFile(n)),i.saveLayerArtifactToFileEx(n).changedSinceLoad&&(s={kind:"artifact-file",path:n})}else{let e=i.saveLayerArtifactEx();e.changedSinceLoad&&(s={kind:"artifact",bytes:e.bytes})}return h9(this.runtime,a,s,n)}}if(o){let r=A2(o,"signing",e,"base.pdf");t.push(()=>this.runtime.fileWrite.removeFile(r)),i.snapshotToFile(r);let a=this.baseDocuments.acquireFileBase({key:`candidate:${e}`,path:r,password:n});return h9(this.runtime,a,{kind:"fresh"},n)}let a=i.snapshot().bytes,s=this.baseDocuments.acquireMemoryBase({key:`candidate:${e}`,bytes:new Uint8Array(a),password:n});return h9(this.runtime,s,{kind:"fresh"},n)}loadedDeltaHoldsSignedBytes(){let e=this.session.source.layer;if(!e||"fresh"===e.kind)return!1;let t=Number(this.runtime.fn.EPDFDoc_GetBaseBytesSize(this.session.requireDocPtr()));return new wR(this.runtime,this.session).readSnapshot().signatures.some(e=>e.signed&&null!==e.byteRange&&e.byteRange[2]+e.byteRange[3]>t)}},vt={0:"added",1:"modified",2:"freed"},vn={0:"dictionary",1:"stream",2:"array",3:"scalar",4:"xref",5:"objstm",6:"trailer"},vr={0:"ok",1:"failed",2:"absent"};function vi(e,t){let n=new Set([0,e.root,e.pagesRoot,...e.pages,...t]);for(let t of(e.acroForm&&n.add(e.acroForm),e.fields))for(let e of(n.add(t.objectNumber),t.widgets))n.add(e);return n}var vo=class{constructor(e,t){this.runtime=e,this.session=t}readWorkingCopySnapshot(){let e=new h8;try{let t=this.openWorkingCopy(e);if("loaded"===t.source)return new wR(this.runtime,this.session).readSnapshot();let n=t.target;return wG(this.runtime,n,e=>{let t=this.runtime.fn.EPDFSig_IsRevisionChainValid(e),r=wS(this.runtime,e);return{chainValid:t,revisions:t?wx(this.runtime,n,r):[],signatures:r,protection:iM(r)}})}finally{e.close()}}analyze(e){let t,n=new wR(this.runtime,this.session),r=n.readSnapshot(),i=n.version(),o=e.exploratoryLevel?"exploratory":"authoritative",a=e.detail??"summary",s="persisted",l=this.session.editsSeq(),u=null;if("signatureIndex"in e.since){let n=r.signatures[e.since.signatureIndex];if(!n)throw new N(G.NotFound,`no signature ${e.since.signatureIndex}`);if(!n.signed||null===n.revisionIndex)throw new N(G.InvalidArg,`signature ${e.since.signatureIndex} seals no whole revision; nothing to analyze from`);t=n.revisionIndex,u=n.index}else t=e.since.revisionIndex;if(!r.chainValid){let e={verdict:"indeterminate",complete:!1,findings:[{rule:"revision-chain",verdict:"incomplete",objectNumber:0,detail:"the cross-reference chain is broken or was rebuilt: no revision can be told from another"}],method:"net-state"};return{mode:o,policyVersion:6,basis:{version:i,editsVersion:l,source:"persisted"},since:{revisionIndex:t,signatureIndex:u},until:{revisionIndex:t},restrictions:[],current:{...e,primary:e.findings[0]},later:{revisionCount:0,undoneObjectNumbers:[]},verdict:"indeterminate",steps:[]}}if(!Number.isInteger(t)||t<0||t>=r.revisions.length)throw new N(G.InvalidArg,`no revision ${t}`);let d=new h8;try{let n,c,f,m,p,h=this.session.requireDocPtr(),F=r.revisions,g="working-copy"===e.until?this.openWorkingCopy(d):null;if(g&&"working-copy"===g.source){s="working-copy",h=g.target;let e=wG(this.runtime,h,e=>wS(this.runtime,e));if(F=wx(this.runtime,h,e),0===F.length)throw new N(G.MalformedPdf,"the working copy has no valid revision chain")}let _=F.length-1;if("object"==typeof e.until&&(_=e.until.revisionIndex,!Number.isInteger(_)||_=F.length))throw new N(G.InvalidArg,`no revision ${_} at or after ${t}`);let P=new h8,D=[],b=[];try{let e=this.openPrefix(h,F,t,P),n=_===F.length-1?h:this.openPrefix(h,F,_,P);c=wO(this.runtime,e),f=_===t?c:wO(this.runtime,n),_>t&&({changes:D,unwritten:b,health:m}=this.compare(e,n,c,f))}finally{P.close()}let y=null===u?null:c.signatures[u]??null,w=function(e,t){let n=[],r=[],i=null,o=!1;for(let a of e.signatures){if(!a.signed||null===a.revisionIndex)continue;o=!0;let e=null!==t&&a.index===t.index,s=null!==t&&!e&&"timestamp"===t.kind&&1===a.docMdp;a.catalogCertification&&null!==a.docMdp&&!s&&(n.push({signatureIndex:a.index,revisionIndex:a.revisionIndex,source:"docmdp",own:e,permission:a.docMdp}),i=iI(i??"annotate",iO(a.docMdp))),a.lock?.permission!==void 0&&(i=iI(i??"annotate",iO(a.lock.permission))),(null===t||e)&&(a.fieldMdp&&(n.push({signatureIndex:a.index,revisionIndex:a.revisionIndex,source:"fieldmdp",own:e,fields:a.fieldMdp}),r.push({signatureIndex:a.index,source:"fieldmdp",spec:a.fieldMdp})),a.lock&&(n.push({signatureIndex:a.index,revisionIndex:a.revisionIndex,source:"lock",own:e,fields:a.lock}),r.push({signatureIndex:a.index,source:"lock",spec:a.lock})))}return{anchors:n,level:o?i??"annotate":"annotate",locks:r}}(c,y),E=e.exploratoryLevel,A=ow({older:t,newer:_,changes:D,unwritten:b,before:c,after:f,health:m,restrictions:{level:w.level,locks:w.locks},levelOverride:E}),v=w.anchors.some(e=>"docmdp"===e.source&&e.own),S=_-t;p=S<=1?1===S?[A]:[]:v||"full"===a?this.walkSteps(h,F,t,_,c,{level:w.level,locks:w.locks,levelOverride:E}):[];let k=v?{...function(e,t){let n=[...e.findings];for(let r of t)if(r!==e)for(let e of r.findings)"permitted"!==e.verdict&&n.push({...e,detail:`revision ${r.newer}: ${e.detail??e.rule}`});let r=oc(n,"unchanged"!==e.verdict||t.some(e=>"unchanged"!==e.verdict)),i=of(n);return{verdict:r,complete:!n.some(e=>"incomplete"===e.verdict),...i?{primary:i}:{},findings:n}}(A,p),method:"net-state+replay"}:{...(n=of(A.findings),{verdict:A.verdict,complete:!A.findings.some(e=>"incomplete"===e.verdict),...n?{primary:n}:{},findings:A.findings}),method:"net-state"};return{mode:o,policyVersion:6,basis:{version:i,editsVersion:l,source:s},since:{revisionIndex:t,signatureIndex:u},until:{revisionIndex:_},restrictions:w.anchors,current:k,later:{revisionCount:S,undoneObjectNumbers:D.filter(oE).map(e=>e.objectNumber)},verdict:k.verdict,steps:p}}finally{d.close()}}openPrefix(e,t,n,r){let i=this.runtime.fn.EPDFDoc_OpenRevision(e,BigInt(t[n].end));if(0n===i)throw new N(G.MalformedPdf,`revision ${n} does not open as a document`);return r.push(()=>this.runtime.fn.FPDF_CloseDocument(i)),i}walkSteps(e,t,n,r,i,o){let{fn:a}=this.runtime,s=[],l=this.openPrefix(e,t,n,new h8),u=i;try{for(let i=n+1;i<=r;i++){let n=i===t.length-1?e:this.openPrefix(e,t,i,new h8);try{let e=wO(this.runtime,n),{changes:t,unwritten:r,health:a}=this.compare(l,n,u,e);s.push(ow({older:i-1,newer:i,changes:t,unwritten:r,before:u,after:e,health:a,restrictions:{level:o.level,locks:o.locks},levelOverride:o.levelOverride})),u=e}finally{a.FPDF_CloseDocument(l),l=n}}}finally{l!==e&&a.FPDF_CloseDocument(l)}return s}openWorkingCopy(e){let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr();if(!this.session.hasUnsavedEdits())return{target:r,source:"loaded"};let i=new AQ(this.runtime,this.session);if("layer"===this.session.kind){let o=this.session.source.base;if(i.canWriteScratchFiles()&&o?.kind==="file"){let a=A2(o.path,"working-copy",iX(),"delta");if(e.push(()=>this.runtime.fileWrite.removeFile(a)),!i.saveLayerDeltaToFileEx(a).changedSinceLoad)return{target:r,source:"loaded"};if(0===this.runtime.fileAccess.sizeOf(a))return this.freshLayerOverBase(e);let s=h4(n,a,e=>t.EPDFDoc_OpenBaseOverlayFromPath(r,e));if(0n===s)throw new N(G.MalformedPdf,"the working copy does not compose with its base");return e.push(()=>t.FPDF_CloseDocument(s)),{target:s,source:"working-copy"}}let a=i.saveLayerDeltaEx();if(!a.changedSinceLoad)return{target:r,source:"loaded"};if(0===a.size)return this.freshLayerOverBase(e);let s=new Uint8Array(a.bytes),l=n.alloc(s.byteLength);try{n.writeBytes(l,s);let i=t.EPDFDoc_OpenBaseOverlay(r,l,s.byteLength);if(0n===i)throw new N(G.MalformedPdf,"the working copy does not compose with its base");return e.push(()=>t.FPDF_CloseDocument(i)),{target:i,source:"working-copy"}}finally{n.free(l)}}let o=i.saveStandaloneToBufferEx("incremental");if(o.unchangedSinceLoad)return{target:r,source:"loaded"};let a=h7(this.runtime,new Uint8Array(o.bytes),this.session.password);return e.push(()=>a.close()),{target:a.docPtr,source:"working-copy"}}freshLayerOverBase(e){let{fn:t,mem:n}=this.runtime,r=t.EPDFLayer_GetBaseDocument(this.session.requireDocPtr()),i=n.alloc(4);try{n.poke(i,"i32",-1);let o=t.EPDFLayer_OpenLayer(r,0n,this.session.password??"",i);if(0n===o||0!==Number(n.peek(i,"i32")))throw new N(G.MalformedPdf,"the working copy could not be opened over its base");return e.push(()=>t.FPDF_CloseDocument(o)),{target:o,source:"working-copy"}}finally{n.free(i)}}compare(e,t,n,r){let{fn:i,mem:o}=this.runtime,a=i.EPDFDoc_CompareRevisions(e,t);if(0n===a)throw new N(G.MalformedPdf,"the revisions do not share a byte history");try{let t=i.EPDFObjectDiff_GetCount(a),s=[];return h0(o,[4,4,4,4,4,4],([e,n,r,l,u,d])=>{for(let c=0;c>>0,f=Number(o.peek(l,"i32")),m=Number(o.peek(u,"i32")),p=this.readValue(a,c,0),h=this.readValue(a,c,1),F=p.truncated||h.truncated,g=null,_=null;try{g=null===p.text||p.truncated?null:oi(p.text),_=null===h.text||h.truncated?null:oi(h.text)}catch{F=!0}let P=vt[Number(o.peek(n,"i32"))]??"modified";s.push({objectNumber:t,change:P,kind:vn[Number(o.peek(r,"i32"))]??"scalar",present:{old:"added"!==P,new:"freed"!==P},generation:{old:f<0?null:f,new:m<0?null:m},value:{old:g,new:_,truncated:F},raw:{old:p.text,new:h.text},read:{old:vr[i.EPDFObjectDiff_GetReadStatus(a,c,0)]??"failed",new:vr[i.EPDFObjectDiff_GetReadStatus(a,c,1)]??"failed"},streamDataChanged:0!==Number(o.peek(d,"i32")),usage:{old:[],new:[]}})}}),{changes:this.withAnchoredUsage(a,s,n,r),unwritten:(function(e){let t=new Set([...e.before.pages,...e.after.pages]),n=new Set(e.changes.map(e=>e.objectNumber)),r=new Set;for(let i of e.changes)if(t.has(i.objectNumber))for(let e of om){let t=ol(i.value[e])?.Annots;t?.t!=="ref"||n.has(t.num)||r.add(t.num)}return[...r].sort((e,t)=>e-t)})({changes:s,before:n,after:r}).map(t=>this.readUnwritten(e,t)),health:{old:this.readHealth(a,0),new:this.readHealth(a,1)}}}finally{i.EPDFObjectDiff_Close(a)}}readHealth(e,t){let{fn:n,mem:r}=this.runtime;return h0(r,[4,4,4],([i,o,a])=>{for(let e of[i,o,a])r.poke(e,"i32",0);if(!n.EPDFObjectDiff_GetRevisionHealth(e,t,i,o,a))throw new N(G.Unknown,"failed to read revision health");return{sparseXref:0!==Number(r.peek(i,"i32")),bareReferences:Number(r.peek(o,"i32"))>>>0,referrersComplete:0!==Number(r.peek(a,"i32"))}})}withAnchoredUsage(e,t,n,r){let i=new Set(t.map(e=>e.objectNumber)),o={old:new o$(t=>this.readReferrers(e,0,t),vi(n,i)),new:new o$(t=>this.readReferrers(e,1,t),vi(r,i))};return t.map(e=>{let t=e.present.old?o.old.resolve(e.objectNumber):[],n=e.present.new?o.new.resolve(e.objectNumber):[];return{...e,usage:{old:t===oL?[]:t,new:n===oL?[]:n},...t===oL||n===oL?{usageIncomplete:!0}:{}}})}readUnwritten(e,t){let{fn:n,mem:r}=this.runtime;return h0(r,[4,4],([i,o])=>{let a=(a,s)=>(r.poke(i,"i32",-1),r.poke(o,"i32",0),n.EPDFDoc_GetLoadedObjectValue(e,t,a,s,i,o)),s=e=>({objectNumber:t,value:null,read:e}),l=a(0n,0),u=vr[Number(r.peek(i,"i32"))]??"failed",d=0!==Number(r.peek(o,"i32"));return"ok"!==u||d||l<=0?s(u):hY(r,l,e=>{let n=a(e,l);if(n<=0||0!==Number(r.peek(o,"i32")))return s(u);let i=r.readBytes(e,n-1),d="";for(let e of i)d+=String.fromCharCode(e);try{return{objectNumber:t,value:oi(d),read:u}}catch{return s(u)}})})}readValue(e,t,n){let{fn:r,mem:i}=this.runtime;return hY(i,4,o=>{i.poke(o,"i32",0);let a=r.EPDFObjectDiff_GetValue(e,t,n,0n,0,o),s=0!==Number(i.peek(o,"i32"));return a<=0?{text:null,truncated:s}:hY(i,a,s=>{i.poke(o,"i32",0);let l=r.EPDFObjectDiff_GetValue(e,t,n,s,a,o),u=0!==Number(i.peek(o,"i32"));if(l<=0)return{text:null,truncated:u};let d=i.readBytes(s,l-1),c="";for(let e of d)c+=String.fromCharCode(e);return{text:c,truncated:u}})})}readReferrers(e,t,n){let{fn:r,mem:i}=this.runtime,o=r.EPDFObjectDiff_GetReferrerCount(e,t,n),a=[];return o<=0||hY(i,4,s=>{for(let l=0;l{let u=r.EPDFObjectDiff_GetReferrer(e,t,n,l,s,a,o);if(u<=0)return"";let d=i.readBytes(a,u-1),c="";for(let e of d)c+=String.fromCharCode(e);return c});a.push({parent:Number(i.peek(s,"i32"))>>>0,label:u})}}),a}},va={certificates:0,ocspResponses:1,crls:2};function vs(e,t){let n={certificates:[],ocspResponses:[],crls:[]};for(let r of on)n[r]=function(e,t,n){let{fn:r,mem:i}=e,o=r.EPDFDss_GetCount(t,va[n]),a=[];for(let e=0;e{if(r.EPDFDss_GetData(t,va[n],e,a,o)!==o)throw new N(G.Unknown,`failed to read entry ${e} of the document\'s ${n}`);return new Uint8Array(i.readBytes(a,o))}))}return a}(e,t,r);return n}var vl=class{constructor(e,t){this.runtime=e,this.session=t}read(){return vs(this.runtime,this.session.requireDocPtr())}},vu=class{constructor(e,t){this.runtime=e,this.session=t}add(e,t){for(let n of(hW(t),on))(e[n]??[]).forEach((e,t)=>{let r=function(e){if(0===e.length)return"it is empty";if(e.length>0x1000000)return"it is larger than 16777216 bytes";if(48!==e[0])return"it is not a DER SEQUENCE";let t=or(e,0,e.length);return t?t.end!==e.length?"bytes follow the object":!function e(t,n,r,i){if(i>64)return!1;let o=n;for(;oyZ(e,n))}(r,o,a)&&(!function(e,t,n,r){let{fn:i,mem:o}=e;if(0===hY(o,r.byteLength,e=>(o.writeBytes(e,r),i.EPDFDss_Add(t,va[n],e,r.byteLength))))throw new N(G.MalformedPdf,`the document\'s security store can\'t be extended: its /DSS or its list of ${n} is not what the PDF standard says it is`)}(this.runtime,n,o,a),r[o].push(a),i[o]+=1);return{added:i,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}},vd=class{constructor(e,t){this.runtime=e,this.baseDocuments=t}finalize(e){let[t,n,r,i]=e.byteRange,o=this.runtime.fileAccess.sizeOf(e.path);if(!e.byteRange.every(e=>Number.isSafeInteger(e)&&e>=0)||0!==t||n>=r||r+i!==o)throw new N(G.InvalidArg,`byteRange [${e.byteRange.join(" ")}] does not span a ${o}-byte candidate`);let a=r-n-2;if(!Number.isSafeInteger(e.contentsSizeBytes)||a!==2*e.contentsSizeBytes)throw new N(G.InvalidArg,`the /Contents hole holds ${a} hex digits, not the ${2*e.contentsSizeBytes} of contentsSize`);if(0===e.cms.byteLength||48!==e.cms[0])throw new N(G.SignatureRefused,"the CMS is not a DER SEQUENCE");if(e.cms.byteLength>e.contentsSizeBytes)throw new N(G.SignatureRefused,`the CMS (${e.cms.byteLength} bytes) does not fit the reserved ${e.contentsSizeBytes} bytes`);!function(e,t,n,r){let{mem:i}=e,o=e.fileAccess.readRange(t,n.holeOffset,n.hexLength+2);if(o.byteLength!==n.hexLength+2||60!==o[0]||62!==o[o.byteLength-1])throw new N(G.InvalidArg,"the byteRange gap is not a <\\u2026> /Contents hole of the candidate");let a=i.alloc(o.byteLength);try{i.writeBytes(a,o),AY(e,a,o.byteLength,n.holeOffset,{byteRange:[0,0,0,0],contentsOffset:n.holeOffset+1,contentsHexLength:n.hexLength,digest:new Uint8Array},r),e.fileWrite.writeRange(t,n.holeOffset,i.readBytes(a,o.byteLength))}finally{i.free(a)}}(this.runtime,e.path,{holeOffset:n,hexLength:a},e.cms);let s=new Fu(this.runtime),l=this.baseDocuments.acquireFileBase({key:`finalize:${iX()}`,path:e.path,password:e.password});try{s.openFromHandle(h9(this.runtime,l,{kind:"fresh"},e.password));let t=wN(this.runtime,s);A6(this.runtime,s.requireDocPtr(),t,{fieldObjectNumber:e.fieldObjectNumber,byteRange:e.byteRange,cms:e.cms});let n=new wR(this.runtime,s),r=n.readSnapshot();return{signature:r.signatures.find(t=>"objectNumber"===t.field.kind&&t.field.objectNumber===e.fieldObjectNumber),protection:r.protection,version:n.version(),lastObjectNumber:s.lastObjectNumber()}}finally{s.close()}}},vc=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}export(e,t,n){hW(n);let{fields:r,widgets:i,calculationOrder:o}=function(e,t,n){let r=new Set;for(let n of t.fields??[]){let t=e.fields.find(e=>ae(e,n));if(!t)throw new N(G.NotFound,`export: the form has no field ${"fqn"===n.kind?n.name:eM(n)}`);r.add(t)}let i=new Set(n.map(H)),o=new Set;for(let e of t.pages??[]){if(!i.has(H(e)))throw new N(G.NotFound,`export: the document has no page ${H(e)}`);o.add(H(e))}for(let t of e.fields)t.widgets.some(e=>e.page&&o.has(H(e.page)))&&r.add(t);let a=!t.fields&&!t.pages,s=e.fields.filter(e=>a||r.has(e)),l=new Map(e.widgets.map(e=>[K(e.ref),e])),u=s.flatMap(e=>e.widgets.flatMap(e=>{let t=e.ref?l.get(K(e.ref)):void 0;return t?[t]:[]})),d=new Set(s.map(e=>eM(e.ref))),c=e.calculationOrder.filter(e=>null!==e&&d.has(eM(e)));return{fields:s.map(at),widgets:u,calculationOrder:c}}(i8(new wW(this.runtime,this.session,this.fonts).snapshot(n),gF(this.runtime,this.session)),e,this.session.allRecords().map(e=>q(e.pageObjectNumber)));nC("form",t,"items",r.length+i.length);let a=new vf(this.runtime,this.session,t),s=new Set(r.flatMap(e=>"pushbutton"!==e.kind||e.hasImage?[]:e.widgets.flatMap(e=>e.ref?[K(e.ref)]:[]))),l={pages:yk(this.runtime,this.session,i),fields:r.map(e=>({data:e})),widgets:i.map(e=>({data:e,resources:s.has(K(e.ref))?{}:a.of(e)})),calculationOrder:o};nC("form",t,"pages",l.pages.length);let u=nN(l);return nC("form",t,"manifestBytes",u),nC("form",t,"bundleBytes",u+a.totalBytes),{format:"embedpdf/form",version:1,...l,resources:a.byId}}},vf=class extends yx{constructor(e,t,n){super(e,"form",n),this.session=t,hJ(this,"drawings",new Map)}of(e){let t;if("pushbutton"!==e.fieldKind)return{};let n=PV(this.runtime,this.session,e.ref);if(0===n)return{};let r=this.drawings.get(n);if(r)return{image:r};let i=gj(this.runtime,this.session,e.ref);try{t=yA(this.runtime,this.session.requireDocPtr(),i,n)}finally{this.runtime.fn.FPDFPage_CloseAnnot(i)}if(!t)return{};let o=this.keep(t);return this.drawings.set(n,o),{image:o}}},vm=new WeakMap;async function vp(e,t,n,r,i){let o=t.cacheSeq(),a=vm.get(t);a||(a=new Map,vm.set(t,a));let s=a.get(n);if(s&&s.seq===o)return s;let l=await new gL(e,t).read(n,r,i),u={seq:o,folded:rp(l.text),snapshot:l};if(a.delete(n),a.set(n,u),a.size>512){let e=a.keys().next().value;void 0!==e&&a.delete(e)}return u}var vh=class{constructor(e,t){this.runtime=e,this.session=t}async query(e,t,n){hW(t);let r={text:e.text,...e.regex?{regex:!0}:{},...e.matchCase?{matchCase:!0}:{},...e.wholeWord?{wholeWord:!0}:{},...e.matchDiacritics?{matchDiacritics:!0}:{},...e.ignoreWhitespace?{ignoreWhitespace:!0}:{}},i=e.snippets??!1,o=rG(r);if(!o.ok)throw new N(G.InvalidArg,`invalid search query (${o.issue}): ${o.message}`);let a=this.session.allRecords(),s=a.length;if(!r.regex&&0===rp(r.text).folded.trim().length)return{matches:[],nextCursor:null,pagesSearched:0,pageCount:s};let l=this.session.cacheSeq(),u=JSON.stringify([r.regex?"r":"l",r.text,+!!r.matchCase,+!!r.matchDiacritics,+!!r.wholeWord,+!!r.ignoreWhitespace,i?"snippets":"matches"]),d=0,c=0;if(void 0!==e.cursor){let t=function(e,t,n,r){let i;try{i=JSON.parse(t)}catch{throw new N(G.InvalidArg,"malformed search cursor")}if(i?.v!==1||"number"!=typeof i.scanned||"string"!=typeof i.key)throw new N(G.InvalidArg,"malformed search cursor");if(i.key!==r)throw new N(G.InvalidArg,"search cursor belongs to a different query \\u2014 restart the search");if(i.seq!==n)throw new N(G.InvalidArg,"document changed since this search cursor was issued \\u2014 restart the search",{details:{cursorSeq:i.seq,currentSeq:n}});if(void 0!==e.from&&e.from.objectNumber!==i.start)throw new N(G.InvalidArg,"`from` conflicts with the cursor \\u2014 omit it when resuming");return i}(e,e.cursor,l,u);d=t.start,c=t.scanned}else void 0!==e.from&&(d=this.session.resolvePageRef(e.from).pageObjectNumber),void 0!==e.skip&&(c=Math.min(Math.max(0,Math.floor(e.skip)),s));let f=a;if(0!==d){let e=a.findIndex(e=>e.pageObjectNumber===d);f=a.slice(e).concat(a.slice(0,e))}let m=vF(e.limit?.pages,64,256),p=vF(e.limit?.matches,256,1024),h=[],F=0,g=new g$(n,t);for(;c=55296&&t<=56319?2:1;continue}t.wholeWord&&(rS(e,n.index)||rk(e,n.index+n[0].length))||o.push({start:n.index,count:n[0].length})}return o}(s,r):r.matchCase||r.matchDiacritics||r.ignoreWhitespace?rx(rp(s,rE(r)),r):rx(a.folded,r)).length>0){let r=function(e){let t=function(e){let t=[],n=[],r=[n9];for(let i of e.runs){if(!nS(i)){for(let e of i.glyphs)t.push({loose:e.loose,tight:e.tight,space:e.space,empty:e.empty});n.push({start:i.start,count:i.glyphs.length,rect:i.rect,fontSize:i.fontSize,frame:0});continue}let e=function(e,t){let n=t.glyphs.find(e=>!n7(e));if(!n)return 0;let r=n.loose,i=r.upperRight.x-r.upperLeft.x,o=r.upperRight.y-r.upperLeft.y,a=Math.hypot(i,o);if(a<=1e-6)return 0;let s={x:i/a,y:o/a},l=r.upperLeft.x-r.lowerLeft.x,u=r.upperLeft.y-r.lowerLeft.y,d=s.x*u-s.y*l>=0?1:-1,c={x:-s.y*d,y:s.x*d};for(let t=0;t0;if(r>=.9999621552387067&&i)return t}return e.push({baseline:s,ascent:c}),e.length-1}(r,i),o=r[e],a=null;for(let e of i.glyphs){if(n7(e)){t.push({loose:rn,space:e.space,empty:!0});continue}let n=rr(o,e.loose),r=e.tight?rr(o,e.tight):void 0;t.push({loose:n,tight:r,space:e.space}),a=a?{left:Math.min(a.left,n.left),bottom:Math.min(a.bottom,n.bottom),right:Math.max(a.right,n.right),top:Math.max(a.top,n.top)}:n}n.push({start:i.start,count:i.glyphs.length,rect:a??rn,fontSize:i.fontSize,frame:e})}return{glyphs:t,runs:n,frames:r}}(e),n=t.glyphs.length,r=e=>"number"!=typeof e?ro(t,e):Number.isInteger(e)&&e>=0&&e({start:e,count:t-e+1});return{charCount:n,runs:e.runs,charAt:e=>ro(t,e),wordAt:e=>{let n=r(e);return null===n?null:i(function(e,t){let n=e.glyphs.length;if(t<0||t>=n)return[t,t];let r=t;for(;r>0&&!n8(e.glyphs[r-1]);)r--;let i=t;for(;i{let n=r(e);return null===n?null:i(function(e,t){let n=e.runs.findIndex(e=>t>=e.start&&t=0;t--){let n=e.runs[t];if(!rs(n.rect)){if(n.frame!==r.frame||!rl(n.rect.bottom,n.rect.top,i,o))break;a=n.start}}for(let t=n+1;t(function(e,t,n){if(n<=0||0===e.glyphs.length)return[];let r=Math.max(0,t),i=Math.min(e.glyphs.length-1,t+n-1);if(ii)continue;let a=Math.max(r,t.start),s=Math.min(i,n),l=1/0,u=-1/0,d=1/0,c=-1/0,f=0,m=0,p=-1/0,h=0,F=0,g=()=>{f>0&&1/0!==l&&o.push({rect:{left:l,bottom:d,right:u,top:c},charCount:f,fontSize:t.fontSize,frame:t.frame,firstX:h,lastX:F}),l=1/0,u=-1/0,d=1/0,c=-1/0,f=0,m=0,p=-1/0};for(let t=a;t<=s;t++){let n=e.glyphs[t];if(n7(n))continue;let r=n.loose;if(f>0&&p>-1/0){let e=m/f;e>0&&Math.abs(r.left-p)>2.5*e&&g()}let i=(r.left+r.right)/2;0===f&&(h=i),F=i,l=Math.min(l,r.left),u=Math.max(u,r.right),d=Math.min(d,r.bottom),c=Math.max(c,r.top),f++,m+=r.right-r.left,p=r.right}g()}return(function(e){let t=[],n=null,r=null;for(let i of e)n&&r&&n.frame===i.frame&&function(e,t){if(null!=e.fontSize&&null!=t.fontSize&&e.fontSize>0&&t.fontSize>0&&Math.max(e.fontSize,t.fontSize)/Math.min(e.fontSize,t.fontSize)>1.5||.8>function(e,t){let n=e.top-e.bottom,r=t.top-t.bottom;if(n<=0||r<=0)return 0;let i=Math.max(e.top,t.top)-Math.min(e.bottom,t.bottom);return i===n||i===r?1:Math.max(0,Math.min(e.top,t.top)-Math.max(e.bottom,t.bottom))/i}(e.rect,t.rect))return!1;let n=(e.rect.right-e.rect.left)/e.charCount,r=(t.rect.right-t.rect.left)/t.charCount,i=e.rect.left-n,o=e.rect.right+n,a=t.rect.left-r;return ia}(n,i)?r={rect:{left:Math.min(r.rect.left,i.rect.left),bottom:Math.min(r.rect.bottom,i.rect.bottom),right:Math.max(r.rect.right,i.rect.right),top:Math.max(r.rect.top,i.rect.top)},frame:r.frame,firstX:r.firstX,lastX:i.lastX}:(r&&t.push(r),r={rect:i.rect,frame:i.frame,firstX:i.firstX,lastX:i.lastX}),n=i;return r&&r.rect.right>r.rect.left&&r.rect.top>r.rect.bottom&&t.push(r),t})(o).map(t=>(function(e,t){let n=ra(e.frames[t.frame],t.frame,t.rect);return{quad:n,rect:0===t.frame?t.rect:{left:Math.min(n.upperLeft.x,n.upperRight.x,n.lowerLeft.x,n.lowerRight.x),bottom:Math.min(n.upperLeft.y,n.upperRight.y,n.lowerLeft.y,n.lowerRight.y),right:Math.max(n.upperLeft.x,n.upperRight.x,n.lowerLeft.x,n.lowerRight.x),top:Math.max(n.upperLeft.y,n.upperRight.y,n.lowerLeft.y,n.lowerRight.y)},advance:t.lastX>=t.firstX?1:-1}})(e,t))})(t,e.start,e.count),charQuad:e=>(function(e,t){let n=e.glyphs[t];if(!n||n7(n))return null;let r=n.loose;if(r.right<=r.left||r.top<=r.bottom)return null;let i=e.runs.find(e=>t>=e.start&&t0){for(let n=i;n=r;t--)if(oW.test(e[t])){o=t;break}oH(e,o)&&o--}let a=(t,n)=>e.slice(t,n).replace(oq," ");return{before:a(i,t.start),match:a(t.start,r),after:a(r,o)}}(s,t)}:{}})}}c++,F++}return{matches:h,nextCursor:ct.FPDFJavaScriptAction_GetName(l,e,n))??""}finally{t.FPDFDoc_CloseJavaScriptAction(l)}i.reservePayloadBytes(o.length);let u=function(e,t,n){if(e)return e;throw new N(G.MalformedPdf,`failed to read ${t}`,{details:{index:n}})}(F8(t,n,r,t.EPDFDoc_GetNamedJavaScriptActionModel(r,s),i),"name-tree script",s);a.push({name:o,action:u})}let s=F8(t,n,r,t.EPDFDoc_GetOpenActionModel(r),i),l=s?0n:t.EPDFDoc_GetOpenActionDest(r),u=0n!==l?F2(t,n,r,l):null,d={};for(let[o,a]of vg){hW(e);let s=F8(t,n,r,t.EPDFDoc_GetAdditionalActionModel(r,a),i);s&&(d[o]=s)}return{nameTreeScripts:a,openAction:s,openDestination:u,...d}}};function vP(e,t){var n;let{target:r,...i}=e;return r?{...i,target:"rect"===r.kind?(n=t(),"rect"===r.kind?{...r,rect:nA(r.rect,n)}:r):r}:i}function vD(e,t,n){return n4({...e,subtype:"widget"},t,n)}var vb=class{constructor(e,t=0x8000000){this.runtime=e,this.budgetBytes=t,hJ(this,"enabled",void 0),hJ(this,"on",!1),this.enabled=t>0&&"function"==typeof e.fn.EPDF_SetDecodedImageBudget}beginJob(e){this.enabled&&e!==this.on&&(this.runtime.fn.EPDF_SetDecodedImageBudget(e?this.budgetBytes:0),this.on=e)}},vy=class{constructor(e,t){this.runtime=e,this.session=t}viewports(e,t){hW(t);let n=this.session.recordByObjectNumber(e).pageIndex;return gl(this.runtime.fn,this.runtime.mem,this.session.requireDocPtr(),n)}},vw=class{constructor(e,t,n){this.runtime=e,this.session=t,this.pageObjectNumber=n,void 0!==n&&t.recordByObjectNumber(n)}read(e,t){hW(t),vE(e);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=this.pageObjectNumber;if(!(void 0===o?n.EPDFDoc_HasPieceInfoEntry(i,e):n.EPDFDoc_HasPagePieceInfoEntry(i,o,e)))return null;let a=void 0===o?n.EPDFDoc_GetPieceInfoKeyCount(i,e):n.EPDFDoc_GetPagePieceInfoKeyCount(i,o,e),s={};for(let l=0;lvoid 0===o?n.EPDFDoc_GetPieceInfoKeyAt(i,e,l,t,r):n.EPDFDoc_GetPagePieceInfoKeyAt(i,o,e,l,t,r));null!==a&&(s[a]=this.readEntry(e,a))}let l=h3(r,(t,r)=>void 0===o?n.EPDFDoc_GetPieceInfoLastModified(i,e,t,r):n.EPDFDoc_GetPagePieceInfoLastModified(i,o,e,t,r),null);return{entries:s,modifiedAt:l?hq(l):null}}update(e,t,n){hW(n),vE(e),function(e){if("object"!=typeof e||null===e||Array.isArray(e))throw new N(G.InvalidArg,"pieceInfo patch must be an object")}(t);let r=Object.keys(t);if(0===r.length)return;(function(e,t){for(let n of t){if(0===n.length)throw new N(G.InvalidArg,"pieceInfo keys must be non-empty");!function(e,t){if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t){if("number"==typeof t){if(!Number.isFinite(t))throw new N(G.InvalidArg,`pieceInfo number for \'${e}\' must be finite`);return}if(Array.isArray(t)){if(!t.every(e=>"string"==typeof e))throw new N(G.InvalidArg,`pieceInfo string array for \'${e}\' must contain only strings`);return}if("object"==typeof t&&null!==t&&"name"in t){if("string"!=typeof t.name||0===t.name.length)throw new N(G.InvalidArg,`pieceInfo PDF name for \'${e}\' must be a non-empty string`);return}throw new N(G.InvalidArg,`unsupported pieceInfo value for \'${e}\': string | number | boolean | string[] | { name } | null`)}}(n,e[n])}})(t,r),hW(n);let{mem:i}=this.runtime,o=hH(new Date),a=i.writeU16String(o);try{for(let n of r){let r=t[n];if(!this.writeEntry(e,n,r,a))throw new N(G.Unknown,`pieceInfo write rejected for key \'${n}\' after validation`)}}finally{i.free(a)}}applications(e){hW(e);let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr(),i=this.pageObjectNumber,o=void 0===i?t.EPDFDoc_GetPieceInfoEntryCount(r):t.EPDFDoc_GetPagePieceInfoEntryCount(r,i),a=[];for(let e=0;evoid 0===i?t.EPDFDoc_GetPieceInfoEntryAt(r,e,n,o):t.EPDFDoc_GetPagePieceInfoEntryAt(r,i,e,n,o));null!==o&&a.push(o)}return a}delete(e,t){hW(t),vE(e);let{fn:n}=this.runtime,r=this.session.requireDocPtr(),i=this.pageObjectNumber;if(!(void 0===i?n.EPDFDoc_ClearPieceInfoEntry(r,e):n.EPDFDoc_ClearPagePieceInfoEntry(r,i,e)))throw new N(G.Unknown,`pieceInfo delete rejected for application \'${e}\'`)}readEntry(e,t){let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=this.pageObjectNumber;switch(void 0===o?n.EPDFDoc_GetPieceInfoValueType(i,e,t):n.EPDFDoc_GetPagePieceInfoValueType(i,o,e,t)){case 3:{let a=h3(r,(r,a)=>void 0===o?n.EPDFDoc_GetPieceInfoString(i,e,t,r,a):n.EPDFDoc_GetPagePieceInfoString(i,o,e,t,r,a),"");return null===a?{type:"unknown"}:{type:"string",value:a}}case 4:{let a=h2(r,(r,a)=>void 0===o?n.EPDFDoc_GetPieceInfoName(i,e,t,r,a):n.EPDFDoc_GetPagePieceInfoName(i,o,e,t,r,a));return null===a?{type:"unknown"}:{type:"name",value:a}}case 2:{let a=r.alloc(4);try{if(!(void 0===o?n.EPDFDoc_GetPieceInfoNumber(i,e,t,a):n.EPDFDoc_GetPagePieceInfoNumber(i,o,e,t,a)))return{type:"unknown"};return{type:"number",value:Number(r.peek(a,"f32"))}}finally{r.free(a)}}case 1:{let a=r.alloc(4);try{if(!(void 0===o?n.EPDFDoc_GetPieceInfoBoolean(i,e,t,a):n.EPDFDoc_GetPagePieceInfoBoolean(i,o,e,t,a)))return{type:"unknown"};return{type:"boolean",value:0!==Number(r.peek(a,"i32"))}}finally{r.free(a)}}case 5:{let a=void 0===o?n.EPDFDoc_GetPieceInfoStringArrayCount(i,e,t):n.EPDFDoc_GetPagePieceInfoStringArrayCount(i,o,e,t);if(a<0)return{type:"unknown"};let s=[];for(let l=0;lvoid 0===o?n.EPDFDoc_GetPieceInfoStringArrayAt(i,e,t,l,r,a):n.EPDFDoc_GetPagePieceInfoStringArrayAt(i,o,e,t,l,r,a),"");if(null===a)return{type:"unknown"};s.push(a)}return{type:"string-array",value:s}}default:return{type:"unknown"}}}writeEntry(e,t,n,r){let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s=this.pageObjectNumber;if(null===n)return void 0===s?i.EPDFDoc_ClearPieceInfoKey(a,e,t,r):i.EPDFDoc_ClearPagePieceInfoKey(a,s,e,t,r);if("string"==typeof n)return h6(o,n,n=>void 0===s?i.EPDFDoc_SetPieceInfoString(a,e,t,n,r):i.EPDFDoc_SetPagePieceInfoString(a,s,e,t,n,r));if("number"==typeof n)return void 0===s?i.EPDFDoc_SetPieceInfoNumber(a,e,t,n,r):i.EPDFDoc_SetPagePieceInfoNumber(a,s,e,t,n,r);if("boolean"==typeof n)return void 0===s?i.EPDFDoc_SetPieceInfoBoolean(a,e,t,n,r):i.EPDFDoc_SetPagePieceInfoBoolean(a,s,e,t,n,r);if(Array.isArray(n))return gf(this.runtime,n,(n,o)=>void 0===s?i.EPDFDoc_SetPieceInfoStringArray(a,e,t,n,o,r):i.EPDFDoc_SetPagePieceInfoStringArray(a,s,e,t,n,o,r));if("object"==typeof n&&null!==n&&"name"in n)return void 0===s?i.EPDFDoc_SetPieceInfoName(a,e,t,n.name,r):i.EPDFDoc_SetPagePieceInfoName(a,s,e,t,n.name,r);throw new N(G.Unknown,`unvalidated pieceInfo value for \'${t}\'`)}};function vE(e){if("string"!=typeof e||0===e.length)throw new N(G.InvalidArg,"pieceInfo application must be non-empty")}function vA(e){return"pages.render"===e.kind||"pages.renderEncoded"===e.kind||"document.renderPageFile"===e.kind||"document.renderPageFileEncoded"===e.kind}var vv=class{constructor(e,t,n={}){this.runtime=e,this.post=t,this.options=n,hJ(this,"sessions",new Map),hJ(this,"baseDocuments",void 0),hJ(this,"aborts",new Map),hJ(this,"fontIds",new Map),hJ(this,"fonts",void 0),hJ(this,"residency",void 0),hJ(this,"decodedImages",void 0),hJ(this,"slices",void 0),hJ(this,"busy",!1),hJ(this,"held",[]),hJ(this,"destroyed",!1),hV(this.runtime),this.baseDocuments=new Fp(this.runtime),this.fonts=new y_(this.runtime,this.fontIds),this.residency=new Fo(this.runtime,{...Fr,budgetBytes:this.options.parsedPageBudgetBytes??Fr.budgetBytes},()=>this.busy),this.decodedImages=new vb(this.runtime,this.options.decodedImageBudgetBytes),this.slices={budgetMs:this.options.sliceMs??8,between:function(){if("function"==typeof setImmediate)return()=>new Promise(e=>setImmediate(e));if("function"==typeof MessageChannel){let e=new MessageChannel,t=[];return e.port1.onmessage=()=>t.shift()?.(),()=>new Promise(n=>{t.push(n),e.port2.postMessage(null)})}return()=>new Promise(e=>setTimeout(e,0))}()}}registerStartupFonts(e){this.fonts.registerStartup(e)}receive(e){"abort"===e.kind?this.abort(e.jobId):"pages.workingSet"===e.kind?this.setWorkingSet(e):this.busy||this.held.length>0?this.held.push(e):this.run(e)}setWorkingSet(e){let t=this.sessions.get(vN(e.docId,e.layerName));t?.isOpen()&&t.pagePool().setWorkingSet(e.view,e.pages.map(({page:e,role:t,pixels:n})=>({pageObjectNumber:e.objectNumber,role:t,pixels:n})))}abort(e){let t=this.held.findIndex(t=>t.jobId===e);if(t<0)return void this.aborts.get(e)?.abort();this.held.splice(t,1);let n=C(new ns("aborted before it ran"));this.post(aC({kind:"reject",jobId:e,error:n},aN))}drain(){for(;!this.busy;){let e=this.takeHeld();if(!e)return;this.run(e)}}takeHeld(){let e=this.held[0];if(!e||!vA(e))return this.held.shift();let t=0,n=e;for(let e=1;et(e.page))}:r}(e,t)}}(e,this.visibleBoxesFor(e))}catch(t){this.post(aC({kind:"reject",jobId:e.jobId,error:C(t)},aN));return}let o=this.slicedWork(n);if(o)return void this.runSliced(e,n,i,o);let a=new AbortController;this.aborts.set(n.jobId,a);let s=this.transactedSession(n);try{if(this.assertNoPendingSigning(n),this.options.reportEveryFontChange){let e=this.sessionWrittenBy(n);e&&ym(this.runtime,e)}switch(s&&vO(n)&&s.beginTransaction(n.opId),this.writingSession(n)?.clearMissingCharacters(),s&&"objectNumberFloor"in n&&void 0!==n.objectNumberFloor&&s.raiseLastObjectNumber(n.objectNumberFloor-1),n.kind){case"open.fatMem":case"open.layerMemBase":case"open.layerFileBase":r=this.handleOpen(n);break;case"metadata.read":r=this.handleMetadataRead(n,a.signal);break;case"metadata.update":r=this.handleMetadataUpdate(n,a.signal);break;case"metadata.readCustom":r=this.handleMetadataReadCustom(n,a.signal);break;case"metadata.updateCustom":r=this.handleMetadataUpdateCustom(n,a.signal);break;case"actions.read":r=this.handleActionsRead(n,a.signal);break;case"outline.read":r=this.handleOutlineRead(n,a.signal);break;case"annotations.list":r=this.handleAnnotationsList(n,a.signal);break;case"annotations.create":r=this.handleAnnotationsCreate(n,a.signal);break;case"annotations.update":r=this.handleAnnotationsUpdate(n,a.signal);break;case"annotations.delete":r=this.handleAnnotationsDelete(n,a.signal);break;case"annotations.reorder":r=this.handleAnnotationsReorder(n,a.signal);break;case"document.apply":r=this.handleDocumentApply(n,a.signal);break;case"document.applyChanges":r=this.handleDocumentApplyChanges(n,a.signal);break;case"signatures.list":r=this.handleSignaturesList(n);break;case"signatures.contents":r=this.handleSignaturesContents(n);break;case"signatures.digest":r=this.handleSignaturesDigest(n);break;case"signatures.revisionBytes":r=this.handleSignaturesRevisionBytes(n);break;case"document.version":r=this.handleDocumentVersion(n);break;case"signatures.prepare":r=this.handleSignaturesPrepare(n);break;case"signatures.complete":r=this.handleSignaturesComplete(n);break;case"signatures.cancel":r=this.handleSignaturesCancel(n);break;case"signatures.validationInfo":r=this.handleSignaturesValidationInfo(n);break;case"signatures.addValidationInfo":r=this.handleSignaturesAddValidationInfo(n,a.signal);break;case"signatures.analyze":r=this.handleSignaturesAnalyze(n);break;case"signatures.finalizeCandidate":r=this.handleSignaturesFinalizeCandidate(n);break;case"forms.list":r=this.handleFormsList(n,a.signal);break;case"forms.setValue":r=this.handleFormsSetValue(n,a.signal);break;case"forms.reset":r=this.handleFormsReset(n,a.signal);break;case"forms.export":r=this.handleFormsExport(n,a.signal);break;case"forms.import":r=this.handleFormsImport(n,a.signal);break;case"forms.importValues":r=this.handleFormsImportValues(n,a.signal);break;case"forms.repair":r=this.handleFormsRepair(n,a.signal);break;case"forms.createField":r=this.handleFormsCreateField(n,a.signal);break;case"forms.updateField":r=this.handleFormsUpdateField(n,a.signal);break;case"forms.setSignatureAppearance":r=this.handleFormsSetSignatureAppearance(n,a.signal);break;case"forms.deleteField":r=this.handleFormsDeleteField(n,a.signal);break;case"forms.addWidget":r=this.handleFormsAddWidget(n,a.signal);break;case"forms.detachWidget":r=this.handleFormsDetachWidget(n,a.signal);break;case"forms.updateWidget":r=this.handleFormsUpdateWidget(n,a.signal);break;case"forms.deleteWidget":r=this.handleFormsDeleteWidget(n,a.signal);break;case"forms.reorderWidgets":r=this.handleFormsReorderWidgets(n,a.signal);break;case"forms.reorderCalculations":r=this.handleFormsReorderCalculations(n,a.signal);break;case"pages.list":r=this.handlePagesList(n,a.signal);break;case"pages.setName":r=this.handlePagesSetName(n,a.signal);break;case"annotations.flatten":r=this.handleAnnotationsFlatten(n,a.signal);break;case"annotations.exportAppearance":r=this.handleAnnotationsExportAppearance(n,a.signal);break;case"annotations.readAppearance":r=this.handleAnnotationsReadAppearance(n,a.signal);break;case"annotations.export":r=this.handleAnnotationsExport(n,a.signal);break;case"annotations.import":r=this.handleAnnotationsImport(n,a.signal);break;case"pages.removeName":r=this.handlePagesRemoveName(n,a.signal);break;case"pages.flatten":r=this.handlePagesFlatten(n,a.signal);break;case"redaction.apply":r=this.handleRedactionApply(n,a.signal);break;case"pages.extract":r=this.handlePagesExtract(n,a.signal);break;case"attachments.list":r=this.handleAttachmentsList(n,a.signal);break;case"attachments.readFile":r=this.handleAttachmentsReadFile(n,a.signal);break;case"measure.setScale":r=this.handleMeasureSetScale(n,a.signal);break;case"pieceInfo.read":r=this.handlePieceInfoRead(n,a.signal);break;case"pieceInfo.update":r=this.handlePieceInfoUpdate(n,a.signal);break;case"pieceInfo.applications":r=this.handlePieceInfoApplications(n,a.signal);break;case"pieceInfo.delete":r=this.handlePieceInfoDelete(n,a.signal);break;case"document.saveBuffer":r=this.handleDocumentSaveBuffer(n);break;case"document.saveLayerBuffer":r=this.handleDocumentSaveLayerBuffer(n);break;case"document.saveFile":r=this.handleDocumentSaveFile(n);break;case"document.probeSecurityFile":r=this.handleDocumentProbeSecurityFile(n);break;case"document.checkPasswordPermissions":r=this.handleDocumentCheckPasswordPermissions(n);break;case"fonts.register":r=this.handleFontsRegister(n);break;case"fonts.addFallback":r=this.handleFontsAddFallback(n);break;case"fonts.clearFallbacks":r=this.handleFontsClearFallbacks(n);break;case"fonts.clear":r=this.handleFontsClear(n);break;case"fonts.authorizeEditing":r=this.handleFontsAuthorizeEditing(n);break;case"fonts.list":r=aC({tag:"fonts.list",engineFonts:this.fonts.engineFontFacts(),fallbacks:this.fonts.fallbackKeys()});break;case"fonts.program":r=this.handleFontsProgram(n);break;case"document.setFontSettings":r=this.handleDocumentSetFontSettings(n);break;case"document.fonts.list":r=this.handleDocumentFontsList(n);break;case"document.fonts.resolve":r=this.handleDocumentFontsResolve(n);break;case"document.fonts.program":r=this.handleDocumentFontsProgram(n);break;case"objectNumbers.reserve":r=aC({tag:"objectNumbers.reserve",range:this.requireSession(n).reserveObjectNumbers(n.count)});break;case"layer.close":r=this.handleLayerClose(n);break;case"close":r=this.handleClose(n);break;case"shutdown":r=this.handleShutdown(n);break;default:throw new N(G.InvalidArg,`unknown request kind: ${n.kind}`)}s?.inTransaction()&&s.commitTransaction(),this.resolve(n,r)}catch(t){s?.inTransaction()&&s.abortTransaction();let e=C(t);this.post(aC({kind:"reject",jobId:n.jobId,error:e},aN))}finally{this.aborts.delete(n.jobId),this.closePagesChangedBy(e,i)}}writingSession(e){if(!vO(e)||!("docId"in e))return;let t="layerName"in e?e.layerName:void 0,n=this.sessions.get(vN(e.docId,t));return n?.isOpen()?n:void 0}sessionWrittenBy(e){if(!("docId"in e)||"write"!==e.effect&&"contentWrite"!==e.effect)return;let t="layerName"in e?e.layerName:void 0,n=this.sessions.get(vN(e.docId,t));return n?.isOpen()?n:void 0}transactedSession(e){if(!vO(e))return;let t="layerName"in e?e.layerName:void 0,n=this.sessions.get(vN(e.docId,t));if(n?.isOpen()&&"layer"===n.kind)return n.assertUsable(),n}closePagesChangedBy(e,t){if("runtime"===t)return void this.residency.closeIdle();if("document"!==t||!("docId"in e))return;let n="layerName"in e?e.layerName:void 0;this.sessions.get(vN(e.docId,n))?.pagePool().closeIdle()}resolve(e,t){let n=function(e,t){var n,r,i,o;let a=e=>n6(e,t(e.page),t),s=e=>e.map(e=>i4(e,t));switch(e.tag){case"pages.list":return{...e,snapshot:i1(e.snapshot)};case"pages.setName":case"pages.removeName":case"measure.setScale":return{...e,result:{...e.result,layout:i1(e.result.layout)}};case"pages.geometry":return{...e,snapshot:(n=e.snapshot,r=t(e.page),{...n,runs:n.runs.map(e=>{let t=e.glyphs.some(e=>!e.empty)?nE(e.rect,r):ru;return nS(e)?{...e,rect:t,glyphs:e.glyphs.map(({loose:e,tight:t,...n})=>({...n,loose:n.empty?rd:nv(e,r),...t?{tight:nv(t,r)}:{}}))}:{...e,rect:t,glyphs:e.glyphs.map(({loose:e,tight:t,...n})=>({...n,loose:n.empty?ru:nE(e,r),...t?{tight:nE(t,r)}:{}}))}})})};case"pages.render":return{...e,area:nE(e.area,t(e.page))};case"search.query":return{...e,slice:(i=e.slice,{...i,matches:i.matches.map(e=>{let n=t(e.page);return{...e,segments:e.segments.map(e=>({...e,quad:nv(e.quad,n),rect:nE(e.rect,n)}))}})})};case"annotations.renderAppearances":{let n=i3(e.result.appearances,t(e.page));return{...e,result:{...e.result,appearances:n}}}case"annotations.renderAppearancesEncoded":{let n=i3(e.result.appearances,t(e.page));return{...e,result:{...e.result,appearances:n}}}case"actions.read":return{...e,snapshot:function(e,t){let{nameTreeScripts:n,openAction:r,openDestination:i,...o}=e;return{...nJ(o,t),nameTreeScripts:n.map(e=>({...e,action:nK(e.action,t)})),openAction:r?nK(r,t):null,..."openDestination"in e?{openDestination:i?t(i):i}:{}}}(e.snapshot,e=>nW(e,t))};case"outline.read":return{...e,outline:(o=e.outline,{...o,items:o.items.map(e=>i9(e,t))})};case"annotations.list":return{...e,list:{...e.list,annotations:e.list.annotations.map(a)}};case"annotations.create":case"annotations.update":return{...e,result:{...e.result,annotation:a(e.result.annotation)}};case"document.apply":case"document.applyChanges":default:return e;case"annotations.import":return{...e,result:{...e.result,annotations:e.result.annotations.map(a)}};case"measure.viewports":return{...e,viewports:n0(e.viewports,t(e.page))};case"forms.list":return{...e,snapshot:i8(e.snapshot,t)};case"forms.import":return{...e,result:{...e.result,fields:e.result.fields.map(e=>i5(e,t)),widgets:s(e.result.widgets)}};case"forms.importValues":return{...e,result:{...e.result,fields:e.result.fields.map(e=>i5(e,t)),widgets:s(e.result.widgets)}};case"forms.setValue":case"forms.createField":case"forms.updateField":case"forms.setSignatureAppearance":case"forms.addWidget":case"forms.detachWidget":return{...e,result:{...e.result,field:i5(e.result.field,t),widgets:s(e.result.widgets)}};case"forms.reset":return{...e,result:{...e.result,fields:e.result.fields.map(e=>i5(e,t)),widgets:s(e.result.widgets)}};case"forms.updateWidget":return{...e,result:{...e.result,widget:i4(e.result.widget,t)}};case"forms.deleteWidget":return{...e,result:{...e.result,field:e.result.field&&i5(e.result.field,t)}}}}(t.payload,this.visibleBoxesFor(e));this.post(aC({kind:"resolve",jobId:e.jobId,result:n},t.transfer))}visibleBoxesFor(e){let t=null;return n=>{if(!("docId"in e))throw new N(G.InvalidArg,`${e.kind} has no document`);return t??(t=gF(this.runtime,this.requireSession(e))),t(n)}}handleOpen(e){let t,n=vN(e.docId,"open.fatMem"===e.kind?void 0:e.layerName);if(this.sessions.has(n))throw new N(G.InvalidArg,`document session already open: ${n}`);let r=new Fu(this.runtime);if(r.residency=this.residency,r.signedDocumentPolicy=e.signedDocumentPolicy??"protect",r.password=e.password,r.objectNumberAuthority=e.objectNumbers??"session","open.fatMem"===e.kind){let n=new Uint8Array(e.bytes);t=e=>this.openBytesAsLayer(r,n,e)}else if("open.layerMemBase"===e.kind){let n=new Uint8Array(e.baseBytes);t=t=>{let i=this.baseDocuments.acquireMemoryBase({key:e.baseKey,bytes:n,password:t,knownSha256:e.baseSha256});r.openFromHandle(h9(this.runtime,i,e.layer,t))}}else{if("native"!==this.runtime.kind)throw new N(G.NotImplemented,"\'layerFile\' needs the native Node runtime; open the file\'s bytes instead");t=t=>{let n=this.baseDocuments.acquireFileBase({key:e.baseKey,path:e.basePath,password:t,knownSha256:e.baseSha256});r.openFromHandle(h9(this.runtime,n,e.layer,t))}}try{t(e.password)}catch(o){var i;if(!((i=o)instanceof N&&(i.code===G.DocPasswordRequired||i.code===G.DocPasswordIncorrect)))throw o;return r.parkLocked(t),this.sessions.set(n,r),aC({tag:"open",docId:e.docId,security:{encryptionState:"encrypted",encryptionRequiresPassword:!0,securityHandlerRevision:null,pdfPermissionsBits:null,pdfPermissionsAllAllowed:null,pdfOpenedAs:null,securityProbedAt:Date.now()},...e.password?{passwordRejected:!0}:{}})}return this.sessions.set(n,r),aC({tag:"open",docId:e.docId,security:new AH(this.runtime).checkPasswordPermissions(r,e.password??""),protection:this.probeProtection(r),...e.reserveObjectNumbers?{objectNumbers:r.reserveObjectNumbers(e.reserveObjectNumbers)}:{},lastObjectNumber:r.lastObjectNumber()})}openBytesAsLayer(e,t,n){let r=this.baseDocuments.acquireMemoryBase({key:`bytes-open:${iX()}`,bytes:t,password:n});e.openFromHandle(h9(this.runtime,r,{kind:"fresh"},n)),e.persistLayerArtifact=!1}probeProtection(e){try{return new wR(this.runtime,e).readProtection()}catch{return null}}handleSignaturesList(e){let t=this.requireSession(e);return aC({tag:"signatures.list",snapshot:e.workingCopy?new vo(this.runtime,t).readWorkingCopySnapshot():new wR(this.runtime,t).readSnapshot()})}handleSignaturesContents(e){let t=this.requireSession(e),n=new wR(this.runtime,t).readContents(e.ref);return aC({tag:"signatures.contents",bytes:n},[n])}handleSignaturesDigest(e){let t=this.requireSession(e),n=new wR(this.runtime,t).digest(e.ref,e.algorithm);return aC({tag:"signatures.digest",digest:n},[n])}handleSignaturesRevisionBytes(e){let t=this.requireSession(e),n=new wR(this.runtime,t).revisionBytes(e.revisionIndex);return aC({tag:"signatures.revisionBytes",bytes:n,size:n.byteLength},[n])}handleDocumentVersion(e){let t=this.requireSession(e);return aC({tag:"document.version",version:new wR(this.runtime,t).version()})}handleSignaturesPrepare(e){let t=this.requireSession(e);return aC({tag:"signatures.prepare",result:new ve(this.runtime,t,this.baseDocuments,this.options.signingCandidatePath).prepare(e.input,e.authority),fieldObjectNumber:t.pendingSigning.fieldObjectNumber})}handleSignaturesComplete(e){let t=this.requireSession(e),n=new ve(this.runtime,t,this.baseDocuments,this.options.signingCandidatePath).complete(e.input,e.opId,e.authority);return"already-completed"===n.status?aC({tag:"signatures.complete",result:n}):this.finishMutation(t,{tag:"signatures.complete",result:n},e.artifactPath)}handleSignaturesValidationInfo(e){let t=this.requireSession(e),n=new vl(this.runtime,t).read(),r=e=>e.buffer,i=n.certificates.map(r),o=n.ocspResponses.map(r),a=n.crls.map(r);return aC({tag:"signatures.validationInfo",certificates:i,ocspResponses:o,crls:a},[...i,...o,...a])}handleSignaturesAddValidationInfo(e,t){let n=this.requireSession(e),r=new vu(this.runtime,n).add({certificates:e.certificates.map(e=>new Uint8Array(e)),ocspResponses:e.ocspResponses.map(e=>new Uint8Array(e)),crls:e.crls.map(e=>new Uint8Array(e))},t),i={tag:"signatures.addValidationInfo",result:r};return Object.values(r.added).some(e=>e>0)?this.finishMutation(n,i,e.artifactPath):aC(i)}handleSignaturesAnalyze(e){let t=this.requireSession(e);return aC({tag:"signatures.analyze",analysis:new vo(this.runtime,t).analyze(e.input)})}handleSignaturesFinalizeCandidate(e){return aC({tag:"signatures.finalizeCandidate",...new vd(this.runtime,this.baseDocuments).finalize({path:e.path,byteRange:e.byteRange,contentsSizeBytes:e.contentsSizeBytes,fieldObjectNumber:e.fieldObjectNumber,cms:new Uint8Array(e.cms),password:e.password??null})})}handleSignaturesCancel(e){let t=this.requireSession(e);return aC({tag:"signatures.cancel",result:new ve(this.runtime,t,this.baseDocuments,this.options.signingCandidatePath).cancel(e.signingId)})}assertNoPendingSigning(e){if(!vO(e))return;let t="layerName"in e?e.layerName:void 0,n=this.sessions.get(vN(e.docId,t));if(n?.pendingSigning)throw new N(G.SigningPending,`a signing is pending (${n.pendingSigning.prepared.signingId}); complete or cancel it before mutating the document`)}handleMetadataRead(e,t){let n=this.requireSession(e);return aC({tag:"metadata.read",metadata:new FF(this.runtime,n).read(t)})}handleMetadataUpdate(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"metadata.update",patch:e.patch},vk(),t);return this.finishMutation(n,{tag:"metadata.update",result:o},e.artifactPath)}handleMetadataReadCustom(e,t){let n=this.requireSession(e);return aC({tag:"metadata.readCustom",custom:new FF(this.runtime,n).readCustom(t)})}handleMetadataUpdateCustom(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"metadata.updateCustom",patch:e.patch},vk(),t);return this.finishMutation(n,{tag:"metadata.updateCustom",result:o},e.artifactPath)}handleActionsRead(e,t){let n=this.requireSession(e);return aC({tag:"actions.read",snapshot:new v_(this.runtime,n).read(t)})}handleOutlineRead(e,t){let n=this.requireSession(e);return aC({tag:"outline.read",outline:new E9(this.runtime,n).read(t)})}handleAnnotationsList(e,t){let n=this.requireSession(e),r=e.pages?.map(e=>n.resolvePageRef(e).pageObjectNumber);return aC({tag:"annotations.list",list:new DP(this.runtime,n,this.fonts).list(r,t,"annotations")})}async handleAnnotationsRenderAppearances(e,t){let n=this.requireSession(e),r=n.resolvePageRef(e.page).pageObjectNumber,i=await new DF(this.runtime,n).render(r,e.family,e.options??{},t,this.slices),o=i.appearances.map(e=>e.raster.data);return aC({tag:"annotations.renderAppearances",page:e.page,result:i},o)}handleAnnotationsCreate(e,t){let n=this.requireSession(e),{type:r,page:i,...o}=this.applyOne(n,e.opId,{type:"annotations.create",page:e.page,data:e.draft,...e.resources?{resources:e.resources}:{},...void 0!==e.objectNumber?{objectNumber:e.objectNumber}:{}},vk(e.actor),t);return this.finishMutation(n,{tag:"annotations.create",result:o},e.artifactPath)}handleAnnotationsUpdate(e,t){let n=this.requireSession(e),{type:r,page:i,skipped:o,...a}=this.applyOne(n,e.opId,{type:"annotations.update",ref:e.ref,patch:e.patch,...e.resources?{resources:e.resources}:{}},{...e.authority,protection:null},t);return this.finishMutation(n,{tag:"annotations.update",result:a},e.artifactPath)}handleAnnotationsDelete(e,t){let n=this.requireSession(e),{type:r,page:i,...o}=this.applyOne(n,e.opId,{type:"annotations.delete",ref:e.ref},{...e.authority,protection:null},t);return this.finishMutation(n,{tag:"annotations.delete",result:o},e.artifactPath)}handleAnnotationsFlatten(e,t){let n=this.requireSession(e),r=n.resolvePageRef(e.page).pageObjectNumber,i=new yE(this.runtime,n).flatten(r,e.refs,e.usage,t),o=i.meta.affectedPages.length>0;return o?this.finishMutation(n,{tag:"annotations.flatten",result:i,wrote:o},e.artifactPath):aC({tag:"annotations.flatten",result:i,wrote:o})}handleAnnotationsExportAppearance(e,t){let n=this.requireSession(e),r=n.resolvePageRef(e.page).pageObjectNumber,i=new yE(this.runtime,n).exportAppearance(r,e.refs,t);return aC({tag:"annotations.exportAppearance",bytes:i.bytes,size:i.size},[i.bytes])}handleAnnotationsExport(e,t){let n=this.requireSession(e),r=new yG(this.runtime,n,this.fonts).export(e.selection,e.limits??nI,t);return aC({tag:"annotations.export",bundle:r},Object.values(r.resources))}handleAnnotationsImport(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"annotations.import",bundle:e.bundle,...void 0!==e.pages?{pages:e.pages}:{},attribution:e.attribution,...e.actor?{actor:e.actor}:{},limits:e.limits??nI},vk(e.actor),t);return 0===i.annotations.length?aC({tag:"annotations.import",result:i}):this.finishMutation(n,{tag:"annotations.import",result:i},e.artifactPath)}handleAnnotationsReadAppearance(e,t){let n=this.requireSession(e),r=n.resolvePageRef(e.page).pageObjectNumber,i=new yE(this.runtime,n).readAppearance(r,e.ref,t);return aC({tag:"annotations.readAppearance",bytes:i.bytes,size:i.size},[i.bytes])}handleAnnotationsReorder(e,t){let n=this.requireSession(e),{type:r,page:i,...o}=this.applyOne(n,e.opId,{type:"annotations.reorder",page:e.page,refs:e.refs,position:e.position},{...e.authority,protection:null},t);return this.finishMutation(n,{tag:"annotations.reorder",result:o},e.artifactPath)}handleDocumentApply(e,t){let n=this.requireSession(e);!function(e){if(iS(e))return;let t={"annotations.import":"doc.annotations.import","forms.import":"doc.forms.import","forms.importValues":"doc.forms.importValues"},n=e.ops.find(({type:e})=>e in t);if(n)throw new N(G.InvalidArg,`doc.apply takes no import: import a bundle with ${t[n.type]}`)}(e.change);let r=oZ(e.change),i=AW(n).outcome(e.opId);if(i)return aC({tag:"document.apply",result:this.replayed(i,r,e.opId),replayed:!0});let o=this.recorded(n,e.opId,r,()=>this.runChange(n,e,t)),a={tag:"document.apply",result:o,replayed:!1};return o.items.some(iv)?this.finishMutation(n,a,e.artifactPath):aC(a)}applyOne(e,t,n,r,i){let o={ops:[n]},a=AW(e),s=oZ(o),l=a.outcome(t),u=(l?this.replayed(l,s,t):this.recorded(e,t,s,()=>new A$(this.runtime,e,this.fonts).apply(o.ops,r,i,AL))).items[0];if(!u||iA(u))throw new N(G.Unknown,`${n.type} wrote nothing`);return u}replayed(e,t,n){if(e.fingerprint!==t)throw new N(G.IdempotencyKeyReused,`opId ${n} already answered a different change`);if("refused"===e.kind){var r;throw new N((r=e.error).code,r.message,{details:r.details})}return e.result}recorded(e,t,n,r){let i=AW(e);try{let o=r(),a=vG(e,o);return i.keepApplied(t,n,a,a.meta.undoable?o.record:null),a}catch(e){var o;throw N.is(e)&&(o=e.code,oK.has(o))&&i.keepRefused(t,n,C(e)),e}}handleDocumentApplyChanges(e,t){let n=this.requireSession(e);n.assertUsable(),void 0!==e.objectNumberFloor&&n.raiseLastObjectNumber(e.objectNumberFloor-1);let r=new A$(this.runtime,n,this.fonts,e.limits),i=this.pageSpaceOf(n),o=new Map,a=[];for(let l of e.changes){n.beginTransaction(l.opId);try{let e=function(e,t,n,r,i){let{change:o,authority:a}=t;if(!iS(o))return e.apply(o.ops,a,r,i);let s=a.identity.userId??null,l=n.has(o.undoOf)?n.get(o.undoOf):t.record;if(void 0===l)throw new N(G.UndoUnavailable,`change ${o.undoOf} can no longer be undone`,{details:{reason:"expired"}});return l?e.undo(l,a,r,i):{items:[],record:{userId:s,steps:[]}}}(r,l,o,t,i),s=vG(n,e);n.commitTransaction();let u=s.meta.undoable?e.record:null;o.set(l.opId,u),a.push({opId:l.opId,status:"applied",result:s,record:u})}catch(e){var s;if(n.inTransaction()&&n.abortTransaction(),!N.is(e)||(s=e.code,!oK.has(s)))throw e;o.set(l.opId,null),a.push({opId:l.opId,status:"refused",error:C(e)})}}let l={tag:"document.applyChanges",outcomes:a};return a.some(e=>"applied"===e.status&&e.result.items.some(iv))?this.finishMutation(n,l,e.artifactPath):aC(l)}pageSpaceOf(e){return{opInFileSpace:t=>(function(e,t){switch(e.type){case"annotations.import":case"forms.import":case"forms.importValues":case"annotations.copy":case"forms.copy":case"forms.repeat":case"pages.setScale":default:return e;case"annotations.create":return{...e,data:n5(e.data,t(e.page),t)};case"annotations.update":{let n=t(e.ref.page),{expect:r,...i}=e;return{...i,patch:n4(e.patch,n,t),...r?{expect:n4(r,n,t)}:{}}}case"annotations.delete":{let{expect:n,...r}=e;return n?{...r,expect:n4(n,t(e.ref.page),t)}:r}case"forms.create":return{...e,draft:i6(e.draft,t)};case"forms.addWidget":return{...e,placement:i2(e.placement,t)};case"forms.updateWidget":{let n=t(e.widget.page),{expect:r,...i}=e;return{...i,patch:vD(e.patch,n,t),...r?{expect:vD(r,n,t)}:{}}}case"forms.deleteWidget":{let{expect:n,...r}=e;return n?{...r,expect:vD(n,t(e.widget.page),t)}:r}case"outline.create":var n;return{...e,data:(n=e.data,i7(n,e=>nq(e,t)))};case"outline.update":{let{expect:n,...r}=e;return{...r,patch:oe(e.patch,t),...n?{expect:oe(n,t)}:{}}}case"outline.delete":{let{expect:n,...r}=e;return n?{...r,expect:oe(n,t)}:r}}})(t,gF(this.runtime,e)),itemOut:t=>(function(e,t){if(iA(e))return e;let n=e=>n6(e,t(e.page),t),r=e=>e.map(e=>i4(e,t));switch(e.type){case"annotations.create":case"annotations.update":return{...e,annotation:n(e.annotation)};case"annotations.restore":case"annotations.import":case"annotations.copy":return{...e,annotations:e.annotations.map(n)};case"forms.setValue":case"forms.setDisplay":case"forms.setAppearanceText":case"forms.setSignatureAppearance":case"forms.setButtonImage":case"forms.create":case"forms.update":case"forms.restore":case"forms.addWidget":case"forms.removeWidget":return{...e,field:i5(e.field,t),widgets:r(e.widgets)};case"forms.reset":case"forms.import":case"forms.importValues":case"forms.copy":case"forms.repeat":return{...e,fields:e.fields.map(e=>i5(e,t)),widgets:r(e.widgets)};case"forms.updateWidget":return{...e,widget:i4(e.widget,t)};case"forms.deleteWidget":return{...e,field:e.field&&i5(e.field,t)};case"forms.restoreWidget":return{...e,field:e.field&&i5(e.field,t),widgets:r(e.widgets)};case"outline.create":case"outline.update":return{...e,item:i9(e.item,t)};case"outline.restore":return{...e,items:e.items.map(e=>i9(e,t))};case"pages.rotate":case"pages.setScale":case"pages.reorder":case"pages.delete":case"pages.insertBlank":case"pages.insert":case"pages.copy":case"pages.restore":return{...e,layout:i1(e.layout)};default:return e}})(t,gF(this.runtime,e))}}runChange(e,t,n){let r=new A$(this.runtime,e,this.fonts),i=this.pageSpaceOf(e),o=t.authority.identity.userId??null;if(!iS(t.change))return r.apply(t.change.ops,t.authority,n,i);let a=AW(e).record(t.change.undoOf);if(!a||"unavailable"in a)throw new N(G.UndoUnavailable,`change ${t.change.undoOf} can no longer be undone`,{details:{reason:a?a.unavailable:"expired"}});if(!a.record)return{items:[],record:{userId:o,steps:[]}};if(null!==a.record.userId&&a.record.userId!==o)throw new na("changes:undo","target");return r.undo(a.record,t.authority,n,i)}handlePagesList(e,t){let n=this.requireSession(e);return aC({tag:"pages.list",snapshot:new gh(this.runtime,n).read(t)})}handlePagesSetName(e,t){let n=this.requireSession(e),r=new gw(this.runtime,n).setName({name:e.name,page:e.page,...void 0!==e.replace?{replace:e.replace}:{}},t);return this.finishMutation(n,{tag:"pages.setName",result:r},e.artifactPath)}handlePagesRemoveName(e,t){let n=this.requireSession(e),r=new gw(this.runtime,n).removeName({name:e.name},t);return this.finishMutation(n,{tag:"pages.removeName",result:r},e.artifactPath)}handlePagesFlatten(e,t){let n=this.requireSession(e),r=new gO(this.runtime,n).flatten(e.pages,e.usage,t),i=r.meta.affectedPages.length>0;return i?this.finishMutation(n,{tag:"pages.flatten",result:r,wrote:i},e.artifactPath):aC({tag:"pages.flatten",result:r,wrote:i})}handleRedactionApply(e,t){let n=this.requireSession(e),r=new gB(this.runtime,n).apply(e.scope,t),i=r.meta.affectedPages.length>0;return i?this.finishMutation(n,{tag:"redaction.apply",result:r,wrote:i},e.artifactPath):aC({tag:"redaction.apply",result:r,wrote:i})}handlePagesExtract(e,t){let n=this.requireSession(e),r=new gE(this.runtime,n).extract(e.pages,e.flatten,t);return aC({tag:"pages.extract",bytes:r.bytes,size:r.size},[r.bytes])}handleDocumentFontsList(e){let t=this.requireSession(e);return ym(this.runtime,t),aC({tag:"document.fonts.list",facts:new yl(this.runtime,t,this.fonts).facts()})}handleDocumentFontsResolve(e){let t=new yl(this.runtime,this.requireSession(e),this.fonts),n=t.facts(),{runs:r,missingCharacters:i}=t.resolve(e.annotation,e.runs,n);return aC({tag:"document.fonts.resolve",runs:r,missingCharacters:i,facts:n})}handleDocumentFontsProgram(e){let t=new yl(this.runtime,this.requireSession(e),this.fonts).program(e.displaySha256,"data"===e.part),n=t.bytes?t.bytes.buffer.slice(t.bytes.byteOffset,t.bytes.byteOffset+t.bytes.byteLength):null;return aC({tag:"document.fonts.program",covers:t.covers,ascent:t.ascent,descent:t.descent,bytes:n},n?[n]:[])}handleAttachmentsList(e,t){let n=this.requireSession(e);return aC({tag:"attachments.list",attachments:new wp(this.runtime,n).list(t)})}handleAttachmentsReadFile(e,t){let n=this.requireSession(e),r=new wp(this.runtime,n).readFile(e.ref,e.path,e.maxDecodedBytes,t);return aC({tag:"attachments.readFile",content:r},void 0!==r.bytes?[r.bytes]:[])}async handleAnnotationsReadFile(e,t){let n=this.requireSession(e),r=await new wp(this.runtime,n).readAnnotationFile(n.resolvePageRef(e.page).pageObjectNumber,e.ref,e.path,e.maxDecodedBytes,t,this.slices);return aC({tag:"annotations.readFile",content:r},void 0!==r.bytes?[r.bytes]:[])}async handleMeasureViewports(e,t){let n=this.requireSession(e),r=new vy(this.runtime,n).viewports(n.resolvePageRef(e.page).pageObjectNumber,t);return aC({tag:"measure.viewports",page:e.page,viewports:r})}handleMeasureSetScale(e,t){let n=this.requireSession(e);return new Aj(this.runtime,n).setScale(n.resolvePageRef(e.page).pageObjectNumber,e.measure,t),this.finishMutation(n,{tag:"measure.setScale",result:{page:e.page,layout:new gh(this.runtime,n).read(t),meta:{affectedPages:[],cacheDelta:null,...n.writeStamp()}}},e.artifactPath)}handlePieceInfoRead(e,t){let n=this.requireSession(e);return aC({tag:"pieceInfo.read",snapshot:new vw(this.runtime,n,e.page?n.resolvePageRef(e.page).pageObjectNumber:void 0).read(e.application,t)})}handlePieceInfoUpdate(e,t){let n=this.requireSession(e),r=new vw(this.runtime,n,e.page?n.resolvePageRef(e.page).pageObjectNumber:void 0);r.update(e.application,e.patch,t);let i={pieceInfo:r.read(e.application,t),meta:{affectedPages:[],cacheDelta:null,...n.writeStamp()}};return this.finishMutation(n,{tag:"pieceInfo.update",result:i},e.artifactPath)}handlePieceInfoApplications(e,t){let n=this.requireSession(e);return aC({tag:"pieceInfo.applications",applications:new vw(this.runtime,n,e.page?n.resolvePageRef(e.page).pageObjectNumber:void 0).applications(t)})}handlePieceInfoDelete(e,t){let n=this.requireSession(e);new vw(this.runtime,n,e.page?n.resolvePageRef(e.page).pageObjectNumber:void 0).delete(e.application,t);let r={meta:{affectedPages:[],cacheDelta:null,...n.writeStamp()}};return this.finishMutation(n,{tag:"pieceInfo.delete",result:r},e.artifactPath)}async handlePagesText(e,t){let n=this.requireSession(e),r=new gL(this.runtime,n),i=n.resolvePageRef(e.page).pageObjectNumber;return aC({tag:"pages.text",snapshot:await r.read(i,t,this.slices)})}async handlePagesGeometry(e,t){let n=this.requireSession(e),r=new gz(this.runtime,n),i=n.resolvePageRef(e.page).pageObjectNumber,o=await r.read(i,t,this.slices);return aC({tag:"pages.geometry",page:e.page,snapshot:o})}async handleSearchQuery(e,t){let n=this.requireSession(e);return aC({tag:"search.query",slice:await new vh(this.runtime,n).query(e.request,t,this.slices)})}async handlePagesRender(e,t){let n=this.requireSession(e),{raster:r,area:i}=await new gZ(this.runtime,n).render(n.resolvePageRef(e.page).pageObjectNumber,e.options??{},t,this.slices);return aC({tag:"pages.render",page:e.page,area:i,raster:r},[r.data])}slicedWork(e){switch(e.kind){case"pages.render":return{pdfium:t=>this.handlePagesRender(e,t)};case"pages.renderEncoded":return{pdfium:t=>this.handlePagesRender({...e,kind:"pages.render"},t),encode:(t,n)=>this.encodeRendered(t,e.encode,n)};case"document.renderPageFile":return{pdfium:t=>this.handleDocumentRenderPageFile(e,t)};case"document.renderPageFileEncoded":return{pdfium:t=>this.handleDocumentRenderPageFile({...e,kind:"document.renderPageFile"},t),encode:(t,n)=>this.encodeRendered(t,e.encode,n)};case"annotations.renderAppearances":return{pdfium:t=>this.handleAnnotationsRenderAppearances(e,t)};case"annotations.renderAppearancesEncoded":return{pdfium:t=>this.handleAnnotationsRenderAppearances({...e,kind:"annotations.renderAppearances"},t),encode:(t,n)=>this.encodeAppearances(t,e.page,e.encode,n)};case"pages.text":return{pdfium:t=>this.handlePagesText(e,t)};case"pages.geometry":return{pdfium:t=>this.handlePagesGeometry(e,t)};case"measure.viewports":return{pdfium:t=>this.handleMeasureViewports(e,t)};case"annotations.readFile":return{pdfium:t=>this.handleAnnotationsReadFile(e,t)};case"search.query":return{pdfium:t=>this.handleSearchQuery(e,t)};default:return null}}async runSliced(e,t,n,r){if(r.encode&&!this.options.imageEncoder)return void this.post(aC({kind:"reject",jobId:t.jobId,error:C(new N(G.NotImplemented,vC))},aN));let i=new AbortController;this.aborts.set(t.jobId,i),this.busy=!0;try{let e;try{e=await r.pdfium(i.signal)}finally{this.busy=!1,queueMicrotask(()=>this.drain())}this.resolve(t,r.encode?await r.encode(e,i.signal):e)}catch(e){this.post(aC({kind:"reject",jobId:t.jobId,error:C(e)},aN))}finally{this.aborts.delete(t.jobId),this.closePagesChangedBy(e,n)}}async encodeRaster(e,t,n){let r=this.options.imageEncoder;if(!r)throw new N(G.NotImplemented,vC);let{bytes:i,mimeType:o}=await r.encode(e,t);if(n.aborted)throw new N(G.Aborted,"aborted during image encode");return{mimeType:o,width:e.width,height:e.height,bytes:i}}async encodeRendered(e,t,n){let{payload:r}=e;if("pages.render"===r.tag){let e=await this.encodeRaster(r.raster,t,n);return aC({tag:"pages.renderEncoded",image:e},[e.bytes.buffer])}if("document.renderPageFile"===r.tag){let e=await this.encodeRaster(r.raster,t,n);return aC({tag:"document.renderPageFileEncoded",page:r.page,pageCount:r.pageCount,image:e},[e.bytes.buffer])}throw new N(G.WireFormat,`unexpected ${r.tag}`)}async encodeAppearances(e,t,n,r){if("annotations.renderAppearances"!==e.payload.tag)throw new N(G.WireFormat,`unexpected ${e.payload.tag}`);let{appearances:i}=e.payload.result,o=[];for(let e of i)o.push({ref:e.ref,mode:e.mode,state:e.state,rect:e.rect,image:await this.encodeRaster(e.raster,n,r)});return aC({tag:"annotations.renderAppearancesEncoded",page:t,result:{page:e.payload.result.page,appearances:o}},o.map(e=>e.image.bytes.buffer))}assertRewriteKeepsSignatures(e,t){if("rewrite"!==t||"protect"!==e.signedDocumentPolicy)return;let n=this.probeProtection(e);if(n&&null!==n.judged)throw new N(G.ProtectedDocument,"the document is signed: a rewrite save would void every signature (use an incremental save)")}handleDocumentSaveBuffer(e){let t=this.requireSession(e);if(this.assertRewriteKeepsSignatures(t,e.mode),"incremental"===e.mode){let e=new AQ(this.runtime,t).snapshot();return aC({tag:"document.saveBuffer",bytes:e.bytes,size:e.bytes.byteLength},[e.bytes])}let n=new AQ(this.runtime,t).saveStandaloneToBuffer(e.mode);return aC({tag:"document.saveBuffer",bytes:n.bytes,size:n.size},[n.bytes])}handleDocumentSaveFile(e){let t=this.requireSession(e);return(this.assertRewriteKeepsSignatures(t,e.mode),"incremental"===e.mode&&(!t.hasUnsavedEdits()||new AQ(this.runtime,t).saveStandaloneToFileEx(e.path,e.mode).unchangedSinceLoad))?(new AQ(this.runtime,t).copyLoadedBytesToFile(e.path),aC({tag:"document.saveFile",path:e.path})):"incremental"===e.mode?aC({tag:"document.saveFile",path:e.path}):aC({tag:"document.saveFile",path:new AQ(this.runtime,t).saveStandaloneToFile(e.path,e.mode).path})}handleDocumentSaveLayerBuffer(e){let t=this.requireSession(e);if("layer"!==t.kind)throw new N(G.InvalidArg,"document has no layer to export (opened without a layer)");let n=new AQ(this.runtime,t).saveLayerArtifact();return aC({tag:"document.saveLayerBuffer",bytes:n.bytes,size:n.size},[n.bytes])}handleDocumentProbeSecurityFile(e){return aC({tag:"document.probeSecurityFile",security:new AH(this.runtime).probeFile(e.path,e.password)})}async handleDocumentRenderPageFile(e,t){let n=new Fu(this.runtime),r=this.baseDocuments.acquireFileBase({key:`adhoc-file:${e.path}`,path:e.path,password:e.password});try{n.openFromHandle(h9(this.runtime,r,{kind:"fresh"},e.password));let i=new gh(this.runtime,n).read(t),o=i.pages[e.pageIndex];if(!o)throw new N(G.NotFound,`renderPageFile: no page at index ${e.pageIndex} (pageCount=${i.pageCount})`);let{raster:a}=await new gZ(this.runtime,n).render(o.ref.objectNumber,vP(e.options??{},()=>o.pdfCropBox),t,this.slices);return aC({tag:"document.renderPageFile",page:o.ref,pageCount:i.pageCount,raster:a},[a.data])}finally{n.close()}}handleDocumentCheckPasswordPermissions(e){let t,n=this.sessions.get(vN(e.docId));return n?.isLocked()?(n.unlockWith(e.password),n.password=e.password,t=n):t=this.requireSession(e),aC({tag:"document.checkPasswordPermissions",security:new AH(this.runtime).checkPasswordPermissions(t,e.password,e.mode??"any"),protection:this.probeProtection(t)})}handleFontsRegister(e){return this.fonts.register(e.fontKey,e.familyName,e.weight,e.italic,new Uint8Array(e.data),e.builtIn??!1),aC({tag:"fonts.register",fontKey:e.fontKey,identity:this.fonts.describe(e.fontKey)})}handleFontsAuthorizeEditing(e){return aC({tag:"fonts.authorizeEditing",identity:this.fonts.authorizeEditing(e.fontKey)})}handleDocumentSetFontSettings(e){let t=this.requireSession(e).requireDocPtr(),{fn:n}=this.runtime;if(void 0!==e.embeddingPolicy){let r={default:0,subset:1,full:2}[e.embeddingPolicy];if(!n.EPDFDoc_SetFontEmbeddingPolicy(t,r))throw new N(G.InvalidArg,"EPDFDoc_SetFontEmbeddingPolicy failed")}if(void 0!==e.typographicFeatures&&!n.EPDFDoc_SetTypographicFeatures(t,e.typographicFeatures))throw new N(G.InvalidArg,"EPDFDoc_SetTypographicFeatures failed");return aC({tag:"document.setFontSettings"})}handleFontsAddFallback(e){return this.fonts.addFallback(e.fontKey,e.tier),aC({tag:"fonts.addFallback"})}handleFontsClearFallbacks(e){return this.fonts.clearFallbacks(),aC({tag:"fonts.clearFallbacks"})}handleFontsProgram(e){let t=this.fonts.engineFontFacts().some(t=>t.sha256===e.sha256&&t.served)?this.fonts.programFor(e.sha256):void 0;if(!t)throw new N(G.NotFound,`no served font has the program ${e.sha256}`);let n=t.bytes(),r=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength);return aC({tag:"fonts.program",bytes:r},[r])}handleFontsClear(e){return this.fonts.clear(),aC({tag:"fonts.clear"})}handleLayerClose(e){let t=vN(e.docId,e.layerName),n=this.sessions.get(t);return n&&(gS(this.runtime,n),wC(this.runtime,n),n.close(),this.sessions.delete(t)),aC({tag:"close"})}handleClose(e){for(let[r,i]of Array.from(this.sessions.entries())){var t,n;((t=r)===vN(n=e.docId)||t.startsWith(`${n}::layer:`))&&(gS(this.runtime,i),wC(this.runtime,i),i.close(),this.sessions.delete(r))}return aC({tag:"close"})}handleShutdown(e){if(!this.destroyed){var t;for(let e of(this.destroyed=!0,this.sessions.values()))gS(this.runtime,e),wC(this.runtime,e),e.close();this.sessions.clear(),this.residency.closeIdle(),this.baseDocuments.releaseAll(),t=this.runtime,hU.has(t)&&(t.fn.EPDF_ShutdownThread(),hU.delete(t))}return aC({tag:"shutdown"})}requireSession(e){let t=vN(e.docId,e.layerName),n=this.sessions.get(t);if(n?.isLocked())throw new N(G.DocPasswordRequired,`document session is password-locked: ${t}`);if(!n||!n.isOpen())throw new N(G.DocNotOpen,`document session not open: ${t}`);return n.assertUsable(),n}handleFormsList(e,t){let n=this.requireSession(e);return aC({tag:"forms.list",snapshot:new wW(this.runtime,n,this.fonts).snapshot(t)})}handleFormsSetValue(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.setValue",field:e.ref,value:e.value},e.authority,t);return this.finishMutation(n,{tag:"forms.setValue",result:i},e.artifactPath)}handleFormsReset(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"forms.reset",...e.refs?{fields:e.refs}:{}},e.authority,t);return this.finishMutation(n,{tag:"forms.reset",result:o},e.artifactPath)}handleFormsExport(e,t){let n=this.requireSession(e),r=new vc(this.runtime,n,this.fonts).export(e.selection,e.limits??nI,t);return aC({tag:"forms.export",bundle:r},Object.values(r.resources))}handleFormsImport(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.import",bundle:e.bundle,...void 0!==e.pages?{pages:e.pages}:{},attribution:e.attribution,values:e.values,actor:vx(e.authority),limits:e.limits??nI,mayScript:e.mayScript},e.authority,t);return 0===i.fields.length?aC({tag:"forms.import",result:i}):this.finishMutation(n,{tag:"forms.import",result:i},e.artifactPath)}handleFormsImportValues(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.importValues",bundle:e.bundle,attribution:e.attribution,actor:vx(e.authority),limits:e.limits??nI},e.authority,t);return 0===i.fields.length?aC({tag:"forms.importValues",result:i}):this.finishMutation(n,{tag:"forms.importValues",result:i},e.artifactPath)}handleFormsRepair(e,t){let n=this.requireSession(e),r=new Et(this.runtime,n,this.fonts).repair(e.bakeAppearances??!1,t);return this.finishMutation(n,{tag:"forms.repair",result:r},e.artifactPath)}handleFormsCreateField(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.create",draft:e.draft,...void 0!==e.objectNumber?{objectNumber:e.objectNumber}:{},...e.widgetObjectNumbers?{widgetObjectNumbers:e.widgetObjectNumbers}:{}},e.authority,t);return this.finishMutation(n,{tag:"forms.createField",result:i},e.artifactPath)}handleFormsUpdateField(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"forms.update",field:e.ref,patch:e.patch},e.authority,t);return this.finishMutation(n,{tag:"forms.updateField",result:o},e.artifactPath)}handleFormsSetSignatureAppearance(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.setSignatureAppearance",field:e.ref,appearance:function(e){if(void 0!==e.appearance)return e.appearance&&new Uint8Array(e.appearance);if(void 0!==e.pdf)return{pdf:new Uint8Array(e.pdf)};throw new N(G.InvalidArg,"a signature appearance request carries \'appearance\' (the mark\'s bytes, or null for no mark) or \'pdf\'")}(e)},e.authority,t);return this.finishMutation(n,{tag:"forms.setSignatureAppearance",result:i},e.artifactPath)}handleFormsDeleteField(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.delete",field:e.ref},vk(),t);return this.finishMutation(n,{tag:"forms.deleteField",result:i},e.artifactPath)}handleFormsAddWidget(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.addWidget",field:e.ref,placement:e.placement,...void 0!==e.objectNumber?{objectNumber:e.objectNumber}:{},...void 0!==e.splitObjectNumber?{splitObjectNumber:e.splitObjectNumber}:{}},vk(),t);return this.finishMutation(n,{tag:"forms.addWidget",result:i},e.artifactPath)}handleFormsDetachWidget(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.removeWidget",field:e.ref,widget:e.widget},vk(),t);return this.finishMutation(n,{tag:"forms.detachWidget",result:i},e.artifactPath)}handleFormsUpdateWidget(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"forms.updateWidget",widget:e.widget,patch:e.patch},vk(),t);return this.finishMutation(n,{tag:"forms.updateWidget",result:o},e.artifactPath)}handleFormsDeleteWidget(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.deleteWidget",widget:e.widget},vk(),t);return this.finishMutation(n,{tag:"forms.deleteWidget",result:i},e.artifactPath)}handleFormsReorderCalculations(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.reorderCalculations",fields:e.fields,position:e.position},vk(),t);return this.finishMutation(n,{tag:"forms.reorderCalculations",result:i},e.artifactPath)}handleFormsReorderWidgets(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.reorderWidgets",page:e.page,widgets:e.widgets,position:e.position},vk(),t);return this.finishMutation(n,{tag:"forms.reorderWidgets",result:i},e.artifactPath)}finishMutation(e,t,n){e.inTransaction()&&e.commitTransaction(),vI.has(t.tag)&&AW(e).endUndo(),t.tag.startsWith("forms.")||"pages.flatten"===t.tag||"redaction.apply"===t.tag||"signatures.complete"===t.tag||e.invalidateDerived(),"signatures.complete"!==t.tag&&e.noteEdit();let r=function(e,t){if(0===t.length||!("result"in e))return e;let n=e.result;if("object"!=typeof n||null===n||!("meta"in n))return e;let{meta:r}=n;return"object"!=typeof r||null===r||"missingCharacters"in r?e:{...e,result:{...n,meta:{...r,missingCharacters:t}}}}(t,e.missingCharacters()),i=!function(e,t){let n=yd.get(t);if(!n)return!1;let r=yc(e,t);if(r===n.fingerprint)return!1;let i=yf(e,t);return yd.set(t,{fingerprint:r,documentFonts:i}),i!==n.documentFonts}(this.runtime,e)?r:{...r,fontsChanged:!0};if("layer"!==e.kind||!e.persistLayerArtifact)return aC(i);let o=this.saveLayerArtifact(e,n);return aC({...i,...o.payload},o.transfer)}saveLayerArtifact(e,t){let n=new AQ(this.runtime,e),r=e.lastObjectNumber();if(t)return{payload:{artifactFile:{...n.saveLayerArtifactToFile(t),lastObjectNumber:r}},transfer:[]};let i={...n.saveLayerArtifact(),lastObjectNumber:r};return{payload:{artifact:i},transfer:[i.bytes]}}},vS={read:"none",snapshot:"none",session:"none",open:"none",close:"none",write:"keepsPages",contentWrite:"document",runtimeWrite:"runtime"};function vk(e){return{identity:e??{},grants:null,protection:null}}function vx({identity:e}){return{...void 0!==e.userId?{userId:e.userId}:{},...void 0!==e.groupId?{groupId:e.groupId}:{},...void 0!==e.displayName?{displayName:e.displayName}:{}}}function vG(e,t){let n=t.record.steps.length>0;n&&e.markUndoable();let r=t.items.map(e=>({...e,meta:{...e.meta,undoable:n}})),i=[...new Set(r.flatMap(e=>e.meta.missingCharacters??[]))];return{items:r,meta:{affectedPages:function(e){let t=new Map;for(let n of e)for(let e of n.meta.affectedPages)t.set(e.objectNumber,e);return[...t.values()]}(r),cacheDelta:null,...e.writeStamp(),...i.length>0?{missingCharacters:i}:{}}}}function vO(e){return"shutdown"!==e.kind&&"signatures.complete"!==e.kind&&"document.applyChanges"!==e.kind&&("write"===e.effect||"contentWrite"===e.effect)&&"docId"in e}var vI=new Set(["redaction.apply","pages.flatten","annotations.flatten","forms.repair","signatures.complete"]);function vN(e,t){return`${e}::${t?`layer:${t}`:"__base__"}`}var vC="this engine has no image encoder (the *.renderEncoded kinds are cloud-server surface)";(g=self).onmessage=e=>{var t,n;let r=e.data;r&&"object"==typeof r&&"init"===r.kind&&(t=g,n=r,(async()=>{var e;let r={wasmUrl:(e=n).wasmUrl,wasmBinary:e.wasmBinary},i=new vv(await a$({prefer:"wasm",wasmUrl:r.wasmUrl,wasmBinary:r.wasmBinary}),e=>{t.postMessage(e.payload,e.transfer)});t.onmessage=e=>{i.receive(e.data)},t.postMessage({kind:"ready"})})().catch(e=>{t.postMessage({kind:"init-error",error:function(e,t){let n=String(e?.stack??e);if(t.wasmBinary)return n;let r=t.wasmUrl?`failed to load embedpdf.wasm from ${t.wasmUrl}`:"failed to load embedpdf.wasm (resolved relative to the worker script)";return`${r}. Your build did not ship the wasm at that location \\u2014 either import \\`localEngine\\` from \\`@embedpdf/engine/portable\\` (the wasm travels inside your build), or self-host the file and pass \\`assetsUrl\\`/\\`wasmUrl\\` to localEngine(), or provide the bytes via \\`wasmBinary\\`. See https://www.embedpdf.com/docs/viewer/self-hosting \\u2014 ${n}`}(e,n)})}))}})();'; -export { - e as default -}; -//# sourceMappingURL=embedpdf-worker.source-CCHXFWYh-CTEHza5m.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/embedpdf-worker.source-Z0o39l7i-qFIWKZ_I.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/embedpdf-worker.source-Z0o39l7i-qFIWKZ_I.js new file mode 100644 index 00000000..6d68e732 --- /dev/null +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/embedpdf-worker.source-Z0o39l7i-qFIWKZ_I.js @@ -0,0 +1,5 @@ +var e = '"use strict";(()=>{let e,t,n,r,i,o,a,s,l,u,d,c,f,m,p;var h,F,g,_,P,D,b,y,w=Object.defineProperty,E=Object.getOwnPropertyNames,A=(e=function(e){if("u">typeof require)return require.apply(this,arguments);throw Error(\'Dynamic require of "\'+e+\'" is not supported\')},"u">typeof require?require:"u">typeof Proxy?new Proxy(e,{get:(e,t)=>("u">typeof require?require:e)[t]}):e),v=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},S=(e,t,n)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?w(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n},k={};v(k,{default:()=>_});var x=(t={"../runtime/npm/wasm32/lib/embedpdf.browser.js"(){var e;e=self.location.href,_=function(t={}){var n,r,i,o,a,s,l,u,d,c,f,m,p,h,F,g,_,P,D,b,y=new Promise((e,t)=>{n=e,r=t});["_EPDF_CheckPasswordPermissions","_EPDF_DigestBuffer","_EPDF_FreeBuffer","_EPDF_GetDecodedImageBytes","_EPDF_GetMetaKeyCount","_EPDF_GetMetaKeyName","_EPDF_GetMetaTrapped","_EPDF_GetPageBoxByIndex","_EPDF_GetPageRotateByIndex","_EPDF_GetPageTabOrderByIndex","_EPDF_GetPageUserUnitByIndex","_EPDF_HasMetaText","_EPDF_InitThread","_EPDF_IsEncrypted","_EPDF_IsOwnerUnlocked","_EPDF_LoadBaseDocument","_EPDF_LoadMemBaseDocument","_EPDF_LoadMemBaseDocument64","_EPDF_LoadPageNormalized","_EPDF_PNG_EncodeRGBA","_EPDF_ReleaseBaseDocument","_EPDF_RemoveEncryption","_EPDF_RenderAnnotBitmap","_EPDF_RenderAnnotBitmapUnrotated","_EPDF_RenderPage_Continue","_EPDF_RenderPageBitmapWithMatrix_Start","_EPDF_SaveAsCopyEx","_EPDF_SaveDocumentToOwnedBuffer","_EPDF_SaveDocumentToOwnedBufferEx","_EPDF_SaveDocumentToOwnedBufferWithVersion","_EPDF_SetBaseDocumentSha256","_EPDF_SetDecodedImageBudget","_EPDF_SetEncryption","_EPDF_SetMetaText","_EPDF_SetMetaTrapped","_EPDF_SetRuntimeOwnerPermissions","_EPDF_ShutdownThread","_EPDF_UnlockOwnerPermissions","_EPDFAction_CloseModel","_EPDFAction_CreateGoTo","_EPDFAction_CreateGoToNamed","_EPDFAction_CreateHide","_EPDFAction_CreateJavaScript","_EPDFAction_CreateLaunch","_EPDFAction_CreateNamed","_EPDFAction_CreateRemoteGoToByName","_EPDFAction_CreateRemoteGoToDest","_EPDFAction_CreateResetForm","_EPDFAction_CreateSubmitForm","_EPDFAction_CreateURI","_EPDFAction_GetNextAt","_EPDFAction_GetNextCount","_EPDFAction_GetNodeCount","_EPDFAction_GetNodeDest","_EPDFAction_GetNodeFilePath","_EPDFAction_GetNodeHideFlag","_EPDFAction_GetNodeJavaScript","_EPDFAction_GetNodeName","_EPDFAction_GetNodeResetForm","_EPDFAction_GetNodeSubmitForm","_EPDFAction_GetNodeSubmitFormCharSet","_EPDFAction_GetNodeSubmitFormURL","_EPDFAction_GetNodeSubtype","_EPDFAction_GetNodeTargetCount","_EPDFAction_GetNodeTargetName","_EPDFAction_GetNodeTargetObjectNumber","_EPDFAction_GetNodeType","_EPDFAction_GetNodeURI","_EPDFAction_GetNodeURIIsMap","_EPDFAction_GetRootNode","_EPDFAction_GetWarningFlags","_EPDFAction_IsComplete","_EPDFAction_LoadModel","_EPDFAction_NodeHasJavaScript","_EPDFAction_SetNext","_EPDFAnnot_AddMeasure","_EPDFAnnot_ClearBorderEffect","_EPDFAnnot_ClearColor","_EPDFAnnot_ClearEmbedMetadata","_EPDFAnnot_ClearEmbedMetadataKey","_EPDFAnnot_ClearMKColor","_EPDFAnnot_ClearMKIcon","_EPDFAnnot_ClearRectangleDifferences","_EPDFAnnot_ExportAppearance","_EPDFAnnot_GenerateAppearance","_EPDFAnnot_GenerateAppearanceWithBlend","_EPDFAnnot_GenerateFormFieldAP","_EPDFAnnot_GetActionModel","_EPDFAnnot_GetAPMatrix","_EPDFAnnot_GetAppearanceState","_EPDFAnnot_GetAppearanceStateCount","_EPDFAnnot_GetAppearanceStateName","_EPDFAnnot_GetAppearanceTransform","_EPDFAnnot_GetAvailableAppearanceModes","_EPDFAnnot_GetBlendMode","_EPDFAnnot_GetBooleanValue","_EPDFAnnot_GetBorderDashPattern","_EPDFAnnot_GetBorderDashPatternCount","_EPDFAnnot_GetBorderEffect","_EPDFAnnot_GetBorderStyle","_EPDFAnnot_GetCalloutLine","_EPDFAnnot_GetCalloutLineCount","_EPDFAnnot_GetColor","_EPDFAnnot_GetDefaultAppearance","_EPDFAnnot_GetDefaultAppearanceFontFace","_EPDFAnnot_GetDefaultAppearanceFontPostScriptName","_EPDFAnnot_GetDrawing","_EPDFAnnot_GetDrawingRect","_EPDFAnnot_GetEmbedMetadataBoolean","_EPDFAnnot_GetEmbedMetadataJSON","_EPDFAnnot_GetEmbedMetadataNumber","_EPDFAnnot_GetEmbedMetadataRect","_EPDFAnnot_GetEmbedMetadataString","_EPDFAnnot_GetFileAttachmentForWrite","_EPDFAnnot_GetIntent","_EPDFAnnot_GetLineCaption","_EPDFAnnot_GetLineEndings","_EPDFAnnot_GetLineLeader","_EPDFAnnot_GetMeasure","_EPDFAnnot_GetMKColor","_EPDFAnnot_GetMKIcon","_EPDFAnnot_GetMKRotation","_EPDFAnnot_GetMKText","_EPDFAnnot_GetMKTextPosition","_EPDFAnnot_GetName","_EPDFAnnot_GetObjectNumber","_EPDFAnnot_GetOpacity","_EPDFAnnot_GetOverlayText","_EPDFAnnot_GetOverlayTextRepeat","_EPDFAnnot_GetRect","_EPDFAnnot_GetRectangleDifferences","_EPDFAnnot_GetReplyType","_EPDFAnnot_GetRichContent","_EPDFAnnot_GetRichTextJSON","_EPDFAnnot_GetRotate","_EPDFAnnot_GetShapeCaption","_EPDFAnnot_GetStructurePosition","_EPDFAnnot_GetTextAlignment","_EPDFAnnot_HasAppearanceStream","_EPDFAnnot_HasEmbedMetadata","_EPDFAnnot_HasMKIcon","_EPDFAnnot_IsValid","_EPDFAnnot_RemoveAction","_EPDFAnnot_RemoveDest","_EPDFAnnot_RemoveKey","_EPDFAnnot_RemoveMeasure","_EPDFAnnot_SetAction","_EPDFAnnot_SetAPMatrix","_EPDFAnnot_SetAppearanceFromPage","_EPDFAnnot_SetBooleanValue","_EPDFAnnot_SetBorderDashPattern","_EPDFAnnot_SetBorderEffect","_EPDFAnnot_SetBorderStyle","_EPDFAnnot_SetCalloutLine","_EPDFAnnot_SetColor","_EPDFAnnot_SetDefaultAppearance","_EPDFAnnot_SetDefaultAppearanceDocumentFont","_EPDFAnnot_SetDefaultAppearanceRegisteredFont","_EPDFAnnot_SetDrawing","_EPDFAnnot_SetEmbedMetadataBoolean","_EPDFAnnot_SetEmbedMetadataJSON","_EPDFAnnot_SetEmbedMetadataNumber","_EPDFAnnot_SetEmbedMetadataRect","_EPDFAnnot_SetEmbedMetadataString","_EPDFAnnot_SetEventAction","_EPDFAnnot_SetIntent","_EPDFAnnot_SetLine","_EPDFAnnot_SetLineCaption","_EPDFAnnot_SetLineEndings","_EPDFAnnot_SetLineLeader","_EPDFAnnot_SetLinkedAnnot","_EPDFAnnot_SetMKColor","_EPDFAnnot_SetMKIcon","_EPDFAnnot_SetMKRotation","_EPDFAnnot_SetMKText","_EPDFAnnot_SetMKTextPosition","_EPDFAnnot_SetName","_EPDFAnnot_SetNoColor","_EPDFAnnot_SetNumberValue","_EPDFAnnot_SetOpacity","_EPDFAnnot_SetOverlayText","_EPDFAnnot_SetOverlayTextRepeat","_EPDFAnnot_SetRect","_EPDFAnnot_SetReplyType","_EPDFAnnot_SetRichTextJSON","_EPDFAnnot_SetRichTextXHTML","_EPDFAnnot_SetRotate","_EPDFAnnot_SetShapeCaption","_EPDFAnnot_SetStampOpacity","_EPDFAnnot_SetSubtype","_EPDFAnnot_SetTextAlignment","_EPDFAnnot_SetVertices","_EPDFAnnot_UpdateAppearanceToRect","_EPDFAttachment_ExportCanonicalToOwnedBuffer","_EPDFAttachment_ExportRawToOwnedBuffer","_EPDFAttachment_ExtractFile","_EPDFAttachment_ExtractFileToOwnedBuffer","_EPDFAttachment_GetDescription","_EPDFAttachment_GetIntegerValue","_EPDFAttachment_ImportRaw","_EPDFAttachment_SetDescription","_EPDFAttachment_SetName","_EPDFAttachment_SetSubtype","_EPDFCatalog_GetLanguage","_EPDFCatalog_GetMetadata","_EPDFCatalog_SetMetadata","_EPDFDest_CreateRemoteView","_EPDFDest_CreateRemoteXYZ","_EPDFDest_CreateView","_EPDFDest_CreateViewByObjectNumber","_EPDFDest_CreateXYZ","_EPDFDest_CreateXYZByObjectNumber","_EPDFDest_GetPageObjectNumber","_EPDFDest_GetViewNullParams","_EPDFDoc_CanonicalDrawing","_EPDFDoc_ClearMissingCharacters","_EPDFDoc_ClearPagePieceInfoEntry","_EPDFDoc_ClearPagePieceInfoKey","_EPDFDoc_ClearPieceInfoEntry","_EPDFDoc_ClearPieceInfoKey","_EPDFDoc_CompareRevisions","_EPDFDoc_CountMissingCharacters","_EPDFDoc_DeletePageByObjectNumber","_EPDFDoc_ExportDictCanonicalToOwnedBuffer","_EPDFDoc_ExportDictRawToOwnedBuffer","_EPDFDoc_ExportDrawing","_EPDFDoc_ExportPagesFlattened","_EPDFDoc_GetAdditionalActionModel","_EPDFDoc_GetAttachmentIndexByKey","_EPDFDoc_GetAttachmentKey","_EPDFDoc_GetBaseBytesSize","_EPDFDoc_GetDrawings","_EPDFDoc_GetFontDisplayProgramCoverage","_EPDFDoc_GetFontDisplayProgramData","_EPDFDoc_GetFontEmbeddingPolicy","_EPDFDoc_GetFontProgramData","_EPDFDoc_GetFontsFingerprint","_EPDFDoc_GetImportFieldRoots","_EPDFDoc_GetLastModified","_EPDFDoc_GetLoadedBytesSize","_EPDFDoc_GetLoadedObjectValue","_EPDFDoc_GetMissingCharacter","_EPDFDoc_GetNamedJavaScriptActionModel","_EPDFDoc_GetNamedPageAt","_EPDFDoc_GetNamedPageCount","_EPDFDoc_GetOpenActionDest","_EPDFDoc_GetOpenActionModel","_EPDFDoc_GetPageActionModel","_EPDFDoc_GetPageLabelSectionAt","_EPDFDoc_GetPageLabelSectionCount","_EPDFDoc_GetPageLastModified","_EPDFDoc_GetPageObjectNumberByIndex","_EPDFDoc_GetPagePieceInfoBoolean","_EPDFDoc_GetPagePieceInfoEntryAt","_EPDFDoc_GetPagePieceInfoEntryCount","_EPDFDoc_GetPagePieceInfoKeyAt","_EPDFDoc_GetPagePieceInfoKeyCount","_EPDFDoc_GetPagePieceInfoLastModified","_EPDFDoc_GetPagePieceInfoName","_EPDFDoc_GetPagePieceInfoNumber","_EPDFDoc_GetPagePieceInfoString","_EPDFDoc_GetPagePieceInfoStringArrayAt","_EPDFDoc_GetPagePieceInfoStringArrayCount","_EPDFDoc_GetPagePieceInfoValueType","_EPDFDoc_GetPieceInfoBoolean","_EPDFDoc_GetPieceInfoEntryAt","_EPDFDoc_GetPieceInfoEntryCount","_EPDFDoc_GetPieceInfoKeyAt","_EPDFDoc_GetPieceInfoKeyCount","_EPDFDoc_GetPieceInfoLastModified","_EPDFDoc_GetPieceInfoName","_EPDFDoc_GetPieceInfoNumber","_EPDFDoc_GetPieceInfoString","_EPDFDoc_GetPieceInfoStringArrayAt","_EPDFDoc_GetPieceInfoStringArrayCount","_EPDFDoc_GetPieceInfoValueType","_EPDFDoc_GetRevision","_EPDFDoc_GetRevisionCount","_EPDFDoc_GetStructureObjectNumbers","_EPDFDoc_GetTypographicFeatures","_EPDFDoc_HasPagePieceInfoEntry","_EPDFDoc_HasPieceInfoEntry","_EPDFDoc_ImportDictRaw","_EPDFDoc_ImportDrawing","_EPDFDoc_ImportPages","_EPDFDoc_LoadPageByObjectNumber","_EPDFDoc_LoadPageByObjectNumberNormalized","_EPDFDoc_OpenBaseOverlay","_EPDFDoc_OpenBaseOverlayFromPath","_EPDFDoc_OpenRevision","_EPDFDoc_ReadLoadedBytes","_EPDFDoc_RemoveNamedPage","_EPDFDoc_RemoveNamedPagesForPage","_EPDFDoc_ResolveFonts","_EPDFDoc_SetFontEmbeddingPolicy","_EPDFDoc_SetNamedPage","_EPDFDoc_SetPageLabelSections","_EPDFDoc_SetPagePieceInfoBoolean","_EPDFDoc_SetPagePieceInfoName","_EPDFDoc_SetPagePieceInfoNumber","_EPDFDoc_SetPagePieceInfoString","_EPDFDoc_SetPagePieceInfoStringArray","_EPDFDoc_SetPageRotationByObjectNumber","_EPDFDoc_SetPieceInfoBoolean","_EPDFDoc_SetPieceInfoName","_EPDFDoc_SetPieceInfoNumber","_EPDFDoc_SetPieceInfoString","_EPDFDoc_SetPieceInfoStringArray","_EPDFDoc_SetTypographicFeatures","_EPDFDoc_StartLoadPageByObjectNumber","_EPDFDocument_ClearEmbedMetadata","_EPDFDss_Add","_EPDFDss_GetCount","_EPDFDss_GetData","_EPDFFont_AddFallbackFont","_EPDFFont_AuthorizeEditing","_EPDFFont_ClearFallbackFonts","_EPDFFont_ClearRegisteredFonts","_EPDFFont_GetCoverage","_EPDFFont_GetEmbeddingPermission","_EPDFFont_GetFallbackOrder","_EPDFFont_GetFamilyName","_EPDFFont_GetLastResortFont","_EPDFFont_GetMetrics","_EPDFFont_GetPostScriptName","_EPDFFont_GetProgramData","_EPDFFont_GetProgramFormat","_EPDFFont_GetProgramHash","_EPDFFont_GetWeight","_EPDFFont_IsEditingAuthorized","_EPDFFont_IsInstanced","_EPDFFont_IsItalic","_EPDFFont_RegisterFont","_EPDFFont_RegisterMemFont","_EPDFFont_RegisterMemFont64","_EPDFFont_SetLastResortFont","_EPDFFontFaces_Close","_EPDFFontFaces_Count","_EPDFFontFaces_CountPrograms","_EPDFFontFaces_GetFamily","_EPDFFontFaces_GetProgramDisplayHash","_EPDFFontFaces_GetProgramEmbedded","_EPDFFontFaces_GetProgramEmbeddingPermission","_EPDFFontFaces_GetProgramFormat","_EPDFFontFaces_GetProgramHash","_EPDFFontFaces_GetProgramMetrics","_EPDFFontFaces_GetProgramObjNum","_EPDFFontFaces_GetProgramPostScriptName","_EPDFFontFaces_GetWeight","_EPDFFontFaces_IsItalic","_EPDFFontFaces_Load","_EPDFFontFaces_ProgramMapsUnicode","_EPDFFontResolution_Close","_EPDFFontResolution_CountMissingCharacters","_EPDFFontResolution_GetBaseFontName","_EPDFFontResolution_GetFallbacks","_EPDFFontResolution_GetFamily","_EPDFFontResolution_GetMissingCharacter","_EPDFFontResolution_GetProgramDisplayHash","_EPDFFontResolution_GetProgramObjNum","_EPDFFontResolution_GetRegisteredFont","_EPDFFontResolution_GetSource","_EPDFFontResolution_GetWeight","_EPDFFontResolution_IsDegraded","_EPDFFontResolution_IsItalic","_EPDFForm_AttachWidget","_EPDFForm_ClearFieldEmbedMetadata","_EPDFForm_ClearFieldEmbedMetadataKey","_EPDFForm_CloseModel","_EPDFForm_CountCalculationOrder","_EPDFForm_CountFieldDefaultValues","_EPDFForm_CountFieldOptions","_EPDFForm_CountFields","_EPDFForm_CountFieldValues","_EPDFForm_CountFieldWidgets","_EPDFForm_CreateField","_EPDFForm_DeleteField","_EPDFForm_DetachWidget","_EPDFForm_ExportFDF","_EPDFForm_ExportFieldRawToOwnedBuffer","_EPDFForm_ExportXFDF","_EPDFForm_GetCalculationOrderFieldIndex","_EPDFForm_GetFieldActionModel","_EPDFForm_GetFieldAlternateName","_EPDFForm_GetFieldDefaultValueAt","_EPDFForm_GetFieldDefaultValueKind","_EPDFForm_GetFieldEmbedMetadataBoolean","_EPDFForm_GetFieldEmbedMetadataJSON","_EPDFForm_GetFieldEmbedMetadataNumber","_EPDFForm_GetFieldEmbedMetadataString","_EPDFForm_GetFieldFamily","_EPDFForm_GetFieldFlags","_EPDFForm_GetFieldIndexByObjNum","_EPDFForm_GetFieldIndexForWidget","_EPDFForm_GetFieldMappingName","_EPDFForm_GetFieldMaxLen","_EPDFForm_GetFieldName","_EPDFForm_GetFieldObjNum","_EPDFForm_GetFieldOptionLabel","_EPDFForm_GetFieldOptionValue","_EPDFForm_GetFieldOrigin","_EPDFForm_GetFieldPartialName","_EPDFForm_GetFieldTopIndex","_EPDFForm_GetFieldValueAt","_EPDFForm_GetFieldValueKind","_EPDFForm_GetFieldWidgetExportValue","_EPDFForm_GetFieldWidgetObjNum","_EPDFForm_GetFieldWidgetOnState","_EPDFForm_GetFieldWidgetPageObjNum","_EPDFForm_GetFieldWidgetRect","_EPDFForm_GetFormKind","_EPDFForm_GetNeedAppearances","_EPDFForm_HasFieldEmbedMetadata","_EPDFForm_HasFieldValuesList","_EPDFForm_ImportFieldRaw","_EPDFForm_IsFieldOptionSelected","_EPDFForm_IsFieldWidgetChecked","_EPDFForm_LoadModel","_EPDFForm_RedrawFieldWidgets","_EPDFForm_Repair","_EPDFForm_SetCalculationOrder","_EPDFForm_SetFieldAlternateName","_EPDFForm_SetFieldAppearanceText","_EPDFForm_SetFieldDefaultValue","_EPDFForm_SetFieldDisplay","_EPDFForm_SetFieldEmbedMetadataBoolean","_EPDFForm_SetFieldEmbedMetadataJSON","_EPDFForm_SetFieldEmbedMetadataNumber","_EPDFForm_SetFieldEmbedMetadataString","_EPDFForm_SetFieldEventAction","_EPDFForm_SetFieldFlags","_EPDFForm_SetFieldMappingName","_EPDFForm_SetFieldMaxLen","_EPDFForm_SetFieldName","_EPDFForm_SetFieldOptions","_EPDFForm_SetFieldSelectedIndices","_EPDFForm_SetFieldValue","_EPDFForm_SetFieldWidgetsChecked","_EPDFImageObj_SetJpeg","_EPDFImageObj_SetPng","_EPDFLayer_AbortTransaction","_EPDFLayer_BeginTransaction","_EPDFLayer_CommitTransaction","_EPDFLayer_GetBaseDocument","_EPDFLayer_GetBaseSha256","_EPDFLayer_GetBirthName","_EPDFLayer_GetBirthObjectNumber","_EPDFLayer_GetLastObjectNumber","_EPDFLayer_GetPromotedObjectCount","_EPDFLayer_IsInTransaction","_EPDFLayer_IsObjectPromoted","_EPDFLayer_IsPagePromoted","_EPDFLayer_OpenLayer","_EPDFLayer_OpenLayerArtifact","_EPDFLayer_OpenLayerArtifactFromPath","_EPDFLayer_RaiseLastObjectNumber","_EPDFLayer_SaveDelta","_EPDFLayer_SaveDeltaEx","_EPDFLayer_SaveDeltaToOwnedBuffer","_EPDFLayer_SaveDeltaToOwnedBufferEx","_EPDFLayer_SaveLayerArtifact","_EPDFLayer_SaveLayerArtifactEx","_EPDFLayer_SaveLayerArtifactToOwnedBuffer","_EPDFLayer_SaveLayerArtifactToOwnedBufferEx","_EPDFMeasure_AddFormat","_EPDFMeasure_CountFormats","_EPDFMeasure_GetCYX","_EPDFMeasure_GetFormat","_EPDFMeasure_GetOrigin","_EPDFMeasure_GetRatio","_EPDFMeasure_GetSubtype","_EPDFMeasure_RemoveFormats","_EPDFMeasure_SetCYX","_EPDFMeasure_SetOrigin","_EPDFMeasure_SetRatio","_EPDFNamedDest_Remove","_EPDFNamedDest_SetDest","_EPDFNumberFormat_GetConversion","_EPDFNumberFormat_GetFixedDenominator","_EPDFNumberFormat_GetFraction","_EPDFNumberFormat_GetLabelPosition","_EPDFNumberFormat_GetPrecision","_EPDFNumberFormat_GetText","_EPDFNumberFormat_GetUnit","_EPDFNumberFormat_SetConversion","_EPDFNumberFormat_SetFixedDenominator","_EPDFNumberFormat_SetFraction","_EPDFNumberFormat_SetLabelPosition","_EPDFNumberFormat_SetPrecision","_EPDFNumberFormat_SetText","_EPDFNumberFormat_SetUnit","_EPDFObjectDiff_Close","_EPDFObjectDiff_GetCount","_EPDFObjectDiff_GetEntry","_EPDFObjectDiff_GetReadStatus","_EPDFObjectDiff_GetReferrer","_EPDFObjectDiff_GetReferrerCount","_EPDFObjectDiff_GetRevisionHealth","_EPDFObjectDiff_GetValue","_EPDFOutline_CreateItem","_EPDFOutline_DeleteItem","_EPDFOutline_ExportItemRawToOwnedBuffer","_EPDFOutline_GetItem","_EPDFOutline_GetObjectNumber","_EPDFOutline_ImportItemRaw","_EPDFOutline_MoveItem","_EPDFOutline_SetAction","_EPDFOutline_SetColor","_EPDFOutline_SetOpen","_EPDFOutline_SetStyle","_EPDFOutline_SetTitle","_EPDFPage_AddViewport","_EPDFPage_AddViewportRaw","_EPDFPage_ApplyRedactions","_EPDFPage_ContinueLoad","_EPDFPage_CountViewports","_EPDFPage_CountViewportsRaw","_EPDFPage_CreateAnnot","_EPDFPage_CreateAnnotRaw","_EPDFPage_ExportAnnotationsAsDocument","_EPDFPage_ExportAnnotsRawToOwnedBuffer","_EPDFPage_ExportRawToOwnedBuffer","_EPDFPage_FindViewport","_EPDFPage_Flatten","_EPDFPage_FlattenAnnotations","_EPDFPage_GetAnnotByName","_EPDFPage_GetAnnotByObjectNumber","_EPDFPage_GetAnnotCountRaw","_EPDFPage_GetAnnotIndexByNameRaw","_EPDFPage_GetAnnotIndexByObjectNumberRaw","_EPDFPage_GetAnnotRaw","_EPDFPage_GetObjectNumber","_EPDFPage_GetParsedSize","_EPDFPage_GetViewport","_EPDFPage_GetViewportRaw","_EPDFPage_ImportAnnotsRaw","_EPDFPage_ImportRaw","_EPDFPage_InsertBlankRaw","_EPDFPage_IsContentCurrent","_EPDFPage_IsValid","_EPDFPage_MoveAnnots","_EPDFPage_MoveAnnotsRaw","_EPDFPage_PromoteInlineAnnotsRaw","_EPDFPage_RemoveAnnot","_EPDFPage_RemoveAnnotByName","_EPDFPage_RemoveAnnotByObjectNumber","_EPDFPage_RemoveAnnotRaw","_EPDFPage_RemoveViewport","_EPDFPage_RemoveViewportRaw","_EPDFPage_ResetRenderCache","_EPDFSig_CloseModel","_EPDFSig_Count","_EPDFSig_DigestByteRange","_EPDFSig_DigestFileRange","_EPDFSig_GetByteRange","_EPDFSig_GetContents","_EPDFSig_GetCoverage","_EPDFSig_GetDocMDPPermission","_EPDFSig_GetFieldMDPAction","_EPDFSig_GetFieldName","_EPDFSig_GetFieldNameAt","_EPDFSig_GetFieldNameCount","_EPDFSig_GetFieldObjNum","_EPDFSig_GetIndexByFieldObjNum","_EPDFSig_GetKind","_EPDFSig_GetLockAction","_EPDFSig_GetLockPermission","_EPDFSig_GetRevisionIndex","_EPDFSig_GetSeedValueFilter","_EPDFSig_GetSeedValueListAt","_EPDFSig_GetSeedValueListCount","_EPDFSig_GetSeedValueMDP","_EPDFSig_GetSeedValuePresentFlags","_EPDFSig_GetSeedValueRequiredFlags","_EPDFSig_GetSeedValueVersion","_EPDFSig_GetString","_EPDFSig_GetValueObjNum","_EPDFSig_GetWidgetObjNum","_EPDFSig_GetWidgetPageObjNum","_EPDFSig_HasSeedValue","_EPDFSig_IsCatalogCertification","_EPDFSig_IsRevisionChainValid","_EPDFSig_IsSigned","_EPDFSig_LoadModel","_EPDFSig_Prepare","_EPDFSig_SaveCandidate","_EPDFSig_SaveCandidateToOwnedBuffer","_EPDFSig_Seal","_EPDFSig_SealSpan","_EPDFSig_SetFieldLock","_EPDFSig_WriteContents","_EPDFText_GetCharGeometry","_EPDFText_GetCharToTextMap","_EPDFText_GetPageGeometry","_EPDFText_GetTextFull","_EPDFText_RedactInQuads","_EPDFText_RedactInRect","_EPDFViewport_AddMeasure","_EPDFViewport_Close","_EPDFViewport_GetBBox","_EPDFViewport_GetMeasure","_EPDFViewport_GetName","_EPDFViewport_RemoveMeasure","_EPDFViewport_SetBBox","_EPDFViewport_SetName","_FORM_CanRedo","_FORM_CanUndo","_FORM_DoDocumentAAction","_FORM_DoDocumentJSAction","_FORM_DoDocumentOpenAction","_FORM_DoPageAAction","_FORM_ForceToKillFocus","_FORM_GetFocusedAnnot","_FORM_GetFocusedText","_FORM_GetSelectedText","_FORM_GetTextDirection","_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_SetTextDirection","_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_GetExpansion","_FPDF_StructElement_GetID","_FPDF_StructElement_GetLang","_FPDF_StructElement_GetMarkedContentID","_FPDF_StructElement_GetMarkedContentIdAtIndex","_FPDF_StructElement_GetMarkedContentIdCount","_FPDF_StructElement_GetObjType","_FPDF_StructElement_GetParent","_FPDF_StructElement_GetRawType","_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_SetFontColor","_FPDFAnnot_SetFormFieldFlags","_FPDFAnnot_SetRect","_FPDFAnnot_SetStringValue","_FPDFAnnot_SetURI","_FPDFAnnot_UpdateObject","_FPDFAttachment_GetAFRelationship","_FPDFAttachment_GetDescription","_FPDFAttachment_GetFile","_FPDFAttachment_GetName","_FPDFAttachment_GetStringValue","_FPDFAttachment_GetSubtype","_FPDFAttachment_GetValueType","_FPDFAttachment_HasKey","_FPDFAttachment_SetDescription","_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_GetColor","_FPDFBookmark_GetCount","_FPDFBookmark_GetDest","_FPDFBookmark_GetFirstChild","_FPDFBookmark_GetNextSibling","_FPDFBookmark_GetStyle","_FPDFBookmark_GetTitle","_FPDFCatalog_GetLanguage","_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","_FPDFFormObj_RemoveObject","_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_InsertObjectAtIndex","_FPDFPage_New","_FPDFPage_RemoveAnnot","_FPDFPage_RemoveObject","_FPDFPage_SetArtBox","_FPDFPage_SetBleedBox","_FPDFPage_SetCropBox","_FPDFPage_SetMediaBox","_FPDFPage_SetRotation","_FPDFPage_SetTrimBox","_FPDFPage_TransformAnnots","_FPDFPage_TransFormWithClip","_FPDFPageObj_AddExistingMark","_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_GetRenderedFillPattern","_FPDFPageObj_GetRenderedStrokePattern","_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_GetParamFloatValue","_FPDFPageObjMark_GetParamIntValue","_FPDFPageObjMark_GetParamKey","_FPDFPageObjMark_GetParamStringValue","_FPDFPageObjMark_GetParamValueType","_FPDFPageObjMark_RemoveParam","_FPDFPageObjMark_SetBlobParam","_FPDFPageObjMark_SetFloatParam","_FPDFPageObjMark_SetIntParam","_FPDFPageObjMark_SetStringParam","_FPDFPath_BezierTo","_FPDFPath_Close","_FPDFPath_CountSegments","_FPDFPath_GetBezierControlPoints","_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_SetPositions","_FPDFText_SetText","_FPDFTextObj_GetFont","_FPDFTextObj_GetFontSize","_FPDFTextObj_GetRenderedBitmap","_FPDFTextObj_GetText","_FPDFTextObj_GetTextRenderMode","_FPDFTextObj_SetFontSize","_FPDFTextObj_SetTextRenderMode","_malloc","_free","_memory","_EPDF_FillFromHostCrypto","___indirect_function_table","onRuntimeInitialized"].forEach(e=>{Object.getOwnPropertyDescriptor(y,e)||Object.defineProperty(y,e,{get:()=>J("You are getting "+e+" 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"),set:()=>J("You are setting "+e+" 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")})});var w="object"==typeof window,E="u">typeof WorkerGlobalScope,v="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type,k=!w&&!v&&!E,x=Object.assign({},t),G="./this.program",O="";if(k){if("object"==typeof process&&"function"==typeof A||"object"==typeof window||"u">typeof WorkerGlobalScope)throw 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?)")}else if(w||E){if(E?O=self.location.href:"u">typeof document&&document.currentScript&&(O=document.currentScript.src),e&&(O=e),O=O.startsWith("blob:")?"":O.substr(0,O.replace(/[?#].*/,"").lastIndexOf("/")+1),"object"!=typeof window&&"u"{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=e=>(M(!Q(e),"readAsync does not work with file:// URLs"),fetch(e,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+" : "+e.url))))}else throw Error("environment detection error");var I=t.print||console.log.bind(console),N=t.printErr||console.error.bind(console);Object.assign(t,x),x=null,Object.getOwnPropertyDescriptor(t,b="fetchSettings")&&J(`\\`Module.${b}\\` was supplied but \\`${b}\\` not included in INCOMING_MODULE_JS_API`),t.arguments&&t.arguments,er("arguments","arguments_"),t.thisProgram&&(G=t.thisProgram),er("thisProgram","thisProgram"),M(void 0===t.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.read,"Module.read option was removed"),M(void 0===t.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),M(void 0===t.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),M(void 0===t.setWindowTitle,"Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),M(void 0===t.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),er("asm","wasmExports"),er("readAsync","readAsync"),er("readBinary","readBinary"),er("setWindowTitle","setWindowTitle"),M(!v,"node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."),M(!k,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var C=t.wasmBinary;er("wasmBinary","wasmBinary"),"object"!=typeof WebAssembly&&N("no native wasm support detected");var j=!1;function M(e,t){e||J("Assertion failed"+(t?": "+t:""))}function R(){var e=a.buffer;t.HEAP8=s=new Int8Array(e),t.HEAP16=u=new Int16Array(e),t.HEAPU8=l=new Uint8Array(e),t.HEAPU16=d=new Uint16Array(e),t.HEAP32=c=new Int32Array(e),t.HEAPU32=f=new Uint32Array(e),t.HEAPF32=m=new Float32Array(e),t.HEAPF64=p=new Float64Array(e)}function T(){if(!j){var e=e1();0==e&&(e+=4);var t=f[e>>>2>>>0],n=f[e+4>>>2>>>0];(0x2135467!=t||0x89bacdfe!=n)&&J(`Stack overflow! Stack cookie has been overwritten at ${ec(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ec(n)} ${ec(t)}`),0x63736d65!=f[0]&&J("Runtime error: The application has corrupted its heap memory area (address zero)!")}}M(!t.STACK_SIZE,"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),M("u">typeof Int32Array&&"u">typeof Float64Array&&void 0!=Int32Array.prototype.subarray&&void 0!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),M(!t.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),M(!t.INITIAL_MEMORY,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var B=[],L=[],$=[],z=!1;M(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var U=0,V=null,W=null,q={};function H(e){for(var t=e;;){if(!q[e])return e;e=t+Math.random()}}function K(e){U++,t.monitorRunDependencies?.(U),e?(M(!q[e]),q[e]=1,null===V&&"u">typeof setInterval&&(V=setInterval(()=>{if(j){clearInterval(V),V=null;return}var e=!1;for(var t in q)e||(e=!0,N("still waiting on run dependencies:")),N(`dependency: ${t}`);e&&N("(end of list)")},1e4))):N("warning: run dependency added without ID")}function Z(e){if(U--,t.monitorRunDependencies?.(U),e?(M(q[e]),delete q[e]):N("warning: run dependency removed without ID"),0==U&&(null!==V&&(clearInterval(V),V=null),W)){var n=W;W=null,n()}}function J(e){t.onAbort?.(e),N(e="Aborted("+e+")"),j=!0;var n=new WebAssembly.RuntimeError(e);throw r(n),n}var Q=e=>e.startsWith("file://");function X(e,t){return(...n)=>{M(z,`native function \\`${e}\\` called before runtime initialization`);var r=eZ[e];return M(r,`exported native function \\`${e}\\` not found`),M(n.length<=t,`native function \\`${e}\\` called with ${n.length} args but expects ${t}`),r(...n)}}function Y(e){if(e==h&&C)return new Uint8Array(C);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e,t,n){return(!C?i(e).then(e=>new Uint8Array(e),()=>Y(e)):Promise.resolve().then(()=>Y(e))).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{N(`failed to asynchronously prepare wasm: ${e}`),Q(h)&&N(`warning: Loading from a file URI (${h}) 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`),J(e)})}var et=new Int16Array(1),en=new Int8Array(et.buffer);if(et[0]=25459,115!==en[0]||99!==en[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";if(t.ENVIRONMENT)throw Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");function er(e,n,r=!0){Object.getOwnPropertyDescriptor(t,e)||Object.defineProperty(t,e,{configurable:!0,get(){J(`\\`Module.${e}\\` has been replaced by \\`${n}\\``+(r?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":""))}})}function ei(e){return"FS_createPath"===e||"FS_createDataFile"===e||"FS_createPreloadedFile"===e||"FS_unlink"===e||"addRunDependency"===e||"FS_createLazyFile"===e||"FS_createDevice"===e||"removeRunDependency"===e}function eo(e,t){"u">typeof globalThis&&!Object.getOwnPropertyDescriptor(globalThis,e)&&Object.defineProperty(globalThis,e,{configurable:!0,get(){t()}})}function ea(e,t){eo(e,()=>{em(`\\`${e}\\` is not longer defined by emscripten. ${t}`)})}function es(e){Object.getOwnPropertyDescriptor(t,e)||Object.defineProperty(t,e,{configurable:!0,get(){var t=`\'${e}\' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;ei(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),J(t)}})}ea("buffer","Please use HEAP8.buffer or wasmMemory.buffer"),ea("asm","Please use wasmExports instead");class el{constructor(e){S(this,"name","ExitStatus"),this.message=`Program terminated with exit(${e})`,this.status=e}}var eu=e=>{for(;e.length>0;)e.shift()(t)},ed=t.noExitRuntime||!0,ec=e=>(M("number"==typeof e),"0x"+e.toString(16).padStart(8,"0")),ef=()=>e6(),em=e=>{em.shown||(em.shown={}),em.shown[e]||(em.shown[e]=1,N(e))},ep=(e,t)=>(M(e==e>>>0||e==(0|e)),M(t===(0|t)),t+2097152>>>0<4194305-!!e?(e>>>0)+0x100000000*t:0/0),eh="u">typeof TextDecoder?new TextDecoder:void 0,eF=(e,t=0,n=0/0)=>{for(var r=(t>>>=0)+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&eh)return eh.decode(e.subarray(t,i));for(var o="";t>10,56320|1023&u)}}return o},eg=(e,t)=>(M("number"==typeof e,`UTF8ToString expects a number (got ${typeof e})`),(e>>>=0)?eF(l,e,t):""),e_=()=>{M(void 0!=eC.varargs);var e=c[eC.varargs>>>2>>>0];return eC.varargs+=4,e},eP={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},normalize:e=>{var t=eP.isAbs(e),n="/"===e.substr(-1);return(e=eP.normalizeArray(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=eP.splitPath(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=eP.normalize(e)).replace(/\\/$/,"")).lastIndexOf("/");return -1===t?e:e.substr(t+1)},join:(...e)=>eP.normalize(e.join("/")),join2:(e,t)=>eP.normalize(e+"/"+t)},eD=e=>(eD=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);J("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")})())(e),eb={resolve:(...e)=>{for(var t="",n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:eN.cwd();if("string"!=typeof i)throw TypeError("Arguments to path.resolve must be strings");if(!i)return"";t=i+"/"+t,n=eP.isAbs(i)}return t=eP.normalizeArray(t.split("/").filter(e=>!!e),!n).join("/"),(n?"/":"")+t||"."},relative:(e,t)=>{function n(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=eb.resolve(e).substr(1),t=eb.resolve(t).substr(1);for(var r=n(e.split("/")),i=n(t.split("/")),o=Math.min(r.length,i.length),a=o,s=0;s{for(var t=0,n=0;n=55296&&r<=57343?(t+=4,++n):t+=3}return t},eE=(e,t,n,r)=>{if(n>>>=0,M("string"==typeof e,`stringToUTF8Array expects a string (got ${typeof e})`),!(r>0))return 0;for(var i=n,o=n+r-1,a=0;a=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=o)break;t[n++>>>0]=s}else if(s<=2047){if(n+1>=o)break;t[n++>>>0]=192|s>>6,t[n++>>>0]=128|63&s}else if(s<=65535){if(n+2>=o)break;t[n++>>>0]=224|s>>12,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|63&s}else{if(n+3>=o)break;s>1114111&&em("Invalid Unicode code point "+ec(s)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[n++>>>0]=240|s>>18,t[n++>>>0]=128|s>>12&63,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|63&s}}return t[n>>>0]=0,n-i};function eA(e,t,n){var r=Array(n>0?n:ew(e)+1),i=eE(e,r,0,r.length);return t&&(r.length=i),r}var ev={ttys:[],init(){},shutdown(){},register(e,t){ev.ttys[e]={input:[],output:[],ops:t},eN.registerDevice(e,ev.stream_ops)},stream_ops:{open(e){var t=ev.ttys[e.node.rdev];if(!t)throw new eN.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new eN.ErrnoError(60);for(var o,a=0,s=0;s(()=>{if(!ey.length){var e=null;if("u">typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+=`\n`),!e)return null;ey=eA(e,!0)}return ey.shift()})(),put_char(e,t){null===t||10===t?(I(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(I(eF(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,n)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(N(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(N(eF(e.output)),e.output=[])}}},eS=(e,t)=>(M(t,"alignment argument is required"),Math.ceil(e/t)*t),ek=e=>{var t,n=eX(65536,e=eS(e,65536));return n&&(t=e,l.fill(0,n,n+t)),n},ex={ops_table:null,mount:e=>ex.createNode(null,"/",16895,0),createNode(e,t,n,r){if(eN.isBlkdev(n)||eN.isFIFO(n))throw new eN.ErrnoError(63);ex.ops_table||(ex.ops_table={dir:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr,lookup:ex.node_ops.lookup,mknod:ex.node_ops.mknod,rename:ex.node_ops.rename,unlink:ex.node_ops.unlink,rmdir:ex.node_ops.rmdir,readdir:ex.node_ops.readdir,symlink:ex.node_ops.symlink},stream:{llseek:ex.stream_ops.llseek}},file:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr},stream:{llseek:ex.stream_ops.llseek,read:ex.stream_ops.read,write:ex.stream_ops.write,allocate:ex.stream_ops.allocate,mmap:ex.stream_ops.mmap,msync:ex.stream_ops.msync}},link:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr,readlink:ex.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr},stream:eN.chrdev_stream_ops}});var i=eN.createNode(e,t,n,r);return eN.isDir(i.mode)?(i.node_ops=ex.ops_table.dir.node,i.stream_ops=ex.ops_table.dir.stream,i.contents={}):eN.isFile(i.mode)?(i.node_ops=ex.ops_table.file.node,i.stream_ops=ex.ops_table.file.stream,i.usedBytes=0,i.contents=null):eN.isLink(i.mode)?(i.node_ops=ex.ops_table.link.node,i.stream_ops=ex.ops_table.link.stream):eN.isChrdev(i.mode)&&(i.node_ops=ex.ops_table.chrdev.node,i.stream_ops=ex.ops_table.chrdev.stream),i.timestamp=Date.now(),e&&(e.contents[t]=i,e.timestamp=i.timestamp),i},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),0!=n&&(t=Math.max(t,256));var r=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=eN.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,eN.isDir(e.mode)?t.size=4096:eN.isFile(e.mode)?t.size=e.usedBytes:eN.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&ex.resizeFileStorage(e,t.size)},lookup(e,t){throw new eN.ErrnoError(44)},mknod:(e,t,n,r)=>ex.createNode(e,t,n,r),rename(e,t,n){if(eN.isDir(e.mode)){var r;try{r=eN.lookupNode(t,n)}catch{}if(r)for(var i in r.contents)throw new eN.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var n=eN.lookupNode(e,t);for(var r in n.contents)throw new eN.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=ex.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!eN.isLink(e.mode))throw new eN.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var o=e.node.contents;if(i>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-i,r);if(M(a>=0),a>8&&o.subarray)t.set(o.subarray(i,i+a),n);else for(var s=0;s0||n+t>>0))}return{ptr:o,allocated:a}},msync:(e,t,n,r,i)=>(ex.stream_ops.write(e,t,0,r,n,!1),0)}},eG=t.preloadPlugins||[],eO=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},eI={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},eN={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class extends Error{constructor(e){for(var t in super(z?eg(eQ(e)):""),S(this,"name","ErrnoError"),this.errno=e,eI)if(eI[t]===e){this.code=t;break}}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){S(this,"shared",{})}get object(){return this.node}set object(e){this.node=e}get isRead(){return(2097155&this.flags)!=1}get isWrite(){return(2097155&this.flags)!=0}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){S(this,"node_ops",{}),S(this,"stream_ops",{}),S(this,"readMode",365),S(this,"writeMode",146),S(this,"mounted",null),e||(e=this),this.parent=e,this.mount=e.mount,this.id=eN.nextInode++,this.name=t,this.mode=n,this.rdev=r}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return eN.isDir(this.mode)}get isDevice(){return eN.isChrdev(this.mode)}},lookupPath(e,t={}){if(!(e=eb.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new eN.ErrnoError(32);for(var n=e.split("/").filter(e=>!!e),r=eN.root,i="/",o=0;o40)throw new eN.ErrnoError(32)}}return{path:i,node:r}},getPath(e){for(var t;;){if(eN.isRoot(e)){var n=e.mount.mountpoint;if(!t)return n;return"/"!==n[n.length-1]?`${n}/${t}`:n+t}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r>>0)%eN.nameTable.length},hashAddNode(e){var t=eN.hashName(e.parent.id,e.name);e.name_next=eN.nameTable[t],eN.nameTable[t]=e},hashRemoveNode(e){var t=eN.hashName(e.parent.id,e.name);if(eN.nameTable[t]===e)eN.nameTable[t]=e.name_next;else for(var n=eN.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=eN.mayLookup(e);if(n)throw new eN.ErrnoError(n);for(var r=eN.hashName(e.id,t),i=eN.nameTable[r];i;i=i.name_next){var o=i.name;if(i.parent.id===e.id&&o===t)return i}return eN.lookup(e,t)},createNode(e,t,n,r){M("object"==typeof e);var i=new eN.FSNode(e,t,n,r);return eN.hashAddNode(i),i},destroyNode(e){eN.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(61440&e)==32768,isDir:e=>(61440&e)==16384,isLink:e=>(61440&e)==40960,isChrdev:e=>(61440&e)==8192,isBlkdev:e=>(61440&e)==24576,isFIFO:e=>(61440&e)==4096,isSocket:e=>(49152&e)==49152,flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>eN.ignorePermissions?0:t.includes("r")&&!(292&e.mode)||t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0,mayLookup:e=>eN.isDir(e.mode)?eN.nodePermissions(e,"x")||2*!e.node_ops.lookup:54,mayCreate(e,t){try{return eN.lookupNode(e,t),20}catch(e){}return eN.nodePermissions(e,"wx")},mayDelete(e,t,n){try{r=eN.lookupNode(e,t)}catch(e){return e.errno}var r,i=eN.nodePermissions(e,"wx");if(i)return i;if(n){if(!eN.isDir(r.mode))return 54;if(eN.isRoot(r)||eN.getPath(r)===eN.cwd())return 10}else if(eN.isDir(r.mode))return 31;return 0},mayOpen:(e,t)=>e?eN.isLink(e.mode)?32:eN.isDir(e.mode)&&("r"!==eN.flagsToPermissionString(t)||512&t)?31:eN.nodePermissions(e,eN.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=eN.MAX_OPEN_FDS;e++)if(!eN.streams[e])return e;throw new eN.ErrnoError(33)},getStreamChecked(e){var t=eN.getStream(e);if(!t)throw new eN.ErrnoError(8);return t},getStream:e=>eN.streams[e],createStream:(e,t=-1)=>(M(t>=-1),e=Object.assign(new eN.FSStream,e),-1==t&&(t=eN.nextfd()),e.fd=t,eN.streams[t]=e,e),closeStream(e){eN.streams[e]=null},dupStream(e,t=-1){var n=eN.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){var t=eN.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new eN.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){eN.devices[e]={stream_ops:t}},getDevice:e=>eN.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),eN.syncFSRequests++,eN.syncFSRequests>1&&N(`warning: ${eN.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=eN.getMounts(eN.root.mount),r=0;function i(e){return M(eN.syncFSRequests>0),eN.syncFSRequests--,t(e)}function o(e){if(e)return o.errored?void 0:(o.errored=!0,i(e));++r>=n.length&&i(null)}n.forEach(t=>{if(!t.type.syncfs)return o(null);t.type.syncfs(t,e,o)})},mount(e,t,n){if("string"==typeof e)throw e;var r,i="/"===n,o=!n;if(i&&eN.root)throw new eN.ErrnoError(10);if(!i&&!o){var a=eN.lookupPath(n,{follow_mount:!1});if(n=a.path,r=a.node,eN.isMountpoint(r))throw new eN.ErrnoError(10);if(!eN.isDir(r.mode))throw new eN.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},l=e.mount(s);return l.mount=s,s.root=l,i?eN.root=l:r&&(r.mounted=s,r.mount&&r.mount.mounts.push(s)),l},unmount(e){var t=eN.lookupPath(e,{follow_mount:!1});if(!eN.isMountpoint(t.node))throw new eN.ErrnoError(28);var n=t.node,r=n.mounted,i=eN.getMounts(r);Object.keys(eN.nameTable).forEach(e=>{for(var t=eN.nameTable[e];t;){var n=t.name_next;i.includes(t.mount)&&eN.destroyNode(t),t=n}}),n.mounted=null;var o=n.mount.mounts.indexOf(r);M(-1!==o),n.mount.mounts.splice(o,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,n){var r=eN.lookupPath(e,{parent:!0}).node,i=eP.basename(e);if(!i||"."===i||".."===i)throw new eN.ErrnoError(28);var o=eN.mayCreate(r,i);if(o)throw new eN.ErrnoError(o);if(!r.node_ops.mknod)throw new eN.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},create:(e,t)=>(t=(void 0!==t?t:438)&4095|32768,eN.mknod(e,t,0)),mkdir:(e,t)=>(t=(void 0!==t?t:511)&1023|16384,eN.mknod(e,t,0)),mkdirTree(e,t){for(var n=e.split("/"),r="",i=0;i(void 0===n&&(n=t,t=438),t|=8192,eN.mknod(e,t,n)),symlink(e,t){if(!eb.resolve(e))throw new eN.ErrnoError(44);var n=eN.lookupPath(t,{parent:!0}).node;if(!n)throw new eN.ErrnoError(44);var r=eP.basename(t),i=eN.mayCreate(n,r);if(i)throw new eN.ErrnoError(i);if(!n.node_ops.symlink)throw new eN.ErrnoError(63);return n.node_ops.symlink(n,r,e)},rename(e,t){var n,r,i,o=eP.dirname(e),a=eP.dirname(t),s=eP.basename(e),l=eP.basename(t);if(n=eN.lookupPath(e,{parent:!0}).node,r=eN.lookupPath(t,{parent:!0}).node,!n||!r)throw new eN.ErrnoError(44);if(n.mount!==r.mount)throw new eN.ErrnoError(75);var u=eN.lookupNode(n,s),d=eb.relative(e,a);if("."!==d.charAt(0))throw new eN.ErrnoError(28);if("."!==(d=eb.relative(t,o)).charAt(0))throw new eN.ErrnoError(55);try{i=eN.lookupNode(r,l)}catch(e){}if(u!==i){var c=eN.isDir(u.mode),f=eN.mayDelete(n,s,c);if(f||(f=i?eN.mayDelete(r,l,c):eN.mayCreate(r,l)))throw new eN.ErrnoError(f);if(!n.node_ops.rename)throw new eN.ErrnoError(63);if(eN.isMountpoint(u)||i&&eN.isMountpoint(i))throw new eN.ErrnoError(10);if(r!==n&&(f=eN.nodePermissions(n,"w")))throw new eN.ErrnoError(f);eN.hashRemoveNode(u);try{n.node_ops.rename(u,r,l),u.parent=r}catch(e){throw e}finally{eN.hashAddNode(u)}}},rmdir(e){var t=eN.lookupPath(e,{parent:!0}).node,n=eP.basename(e),r=eN.lookupNode(t,n),i=eN.mayDelete(t,n,!0);if(i)throw new eN.ErrnoError(i);if(!t.node_ops.rmdir)throw new eN.ErrnoError(63);if(eN.isMountpoint(r))throw new eN.ErrnoError(10);t.node_ops.rmdir(t,n),eN.destroyNode(r)},readdir(e){var t=eN.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new eN.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=eN.lookupPath(e,{parent:!0}).node;if(!t)throw new eN.ErrnoError(44);var n=eP.basename(e),r=eN.lookupNode(t,n),i=eN.mayDelete(t,n,!1);if(i)throw new eN.ErrnoError(i);if(!t.node_ops.unlink)throw new eN.ErrnoError(63);if(eN.isMountpoint(r))throw new eN.ErrnoError(10);t.node_ops.unlink(t,n),eN.destroyNode(r)},readlink(e){var t=eN.lookupPath(e).node;if(!t)throw new eN.ErrnoError(44);if(!t.node_ops.readlink)throw new eN.ErrnoError(28);return eb.resolve(eN.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var n=eN.lookupPath(e,{follow:!t}).node;if(!n)throw new eN.ErrnoError(44);if(!n.node_ops.getattr)throw new eN.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>eN.stat(e,!0),chmod(e,t,n){var r;if(!(r="string"==typeof e?eN.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new eN.ErrnoError(63);r.node_ops.setattr(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})},lchmod(e,t){eN.chmod(e,t,!0)},fchmod(e,t){var n=eN.getStreamChecked(e);eN.chmod(n.node,t)},chown(e,t,n,r){var i;if(!(i="string"==typeof e?eN.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new eN.ErrnoError(63);i.node_ops.setattr(i,{timestamp:Date.now()})},lchown(e,t,n){eN.chown(e,t,n,!0)},fchown(e,t,n){var r=eN.getStreamChecked(e);eN.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new eN.ErrnoError(28);if("string"==typeof e){var n;n=eN.lookupPath(e,{follow:!0}).node}else n=e;if(!n.node_ops.setattr)throw new eN.ErrnoError(63);if(eN.isDir(n.mode))throw new eN.ErrnoError(31);if(!eN.isFile(n.mode))throw new eN.ErrnoError(28);var r=eN.nodePermissions(n,"w");if(r)throw new eN.ErrnoError(r);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=eN.getStreamChecked(e);if((2097155&n.flags)==0)throw new eN.ErrnoError(28);eN.truncate(n.node,t)},utime(e,t,n){var r=eN.lookupPath(e,{follow:!0}).node;r.node_ops.setattr(r,{timestamp:Math.max(t,n)})},open(e,n,r){if(""===e)throw new eN.ErrnoError(44);if(r=64&(n="string"==typeof n?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw Error(`Unknown file open mode: ${e}`);return t})(n):n)?4095&(r=void 0===r?438:r)|32768:0,"object"==typeof e)i=e;else{e=eP.normalize(e);try{var i;i=eN.lookupPath(e,{follow:!(131072&n)}).node}catch(e){}}var o=!1;if(64&n)if(i){if(128&n)throw new eN.ErrnoError(20)}else i=eN.mknod(e,r,0),o=!0;if(!i)throw new eN.ErrnoError(44);if(eN.isChrdev(i.mode)&&(n&=-513),65536&n&&!eN.isDir(i.mode))throw new eN.ErrnoError(54);if(!o){var a=eN.mayOpen(i,n);if(a)throw new eN.ErrnoError(a)}512&n&&!o&&eN.truncate(i,0),n&=-131713;var s=eN.createStream({node:i,path:eN.getPath(i),flags:n,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!t.logReadFiles||1&n||e in eN.readFiles||(eN.readFiles[e]=1),s},close(e){if(eN.isClosed(e))throw new eN.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{eN.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,n){if(eN.isClosed(e))throw new eN.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new eN.ErrnoError(70);if(0!=n&&1!=n&&2!=n)throw new eN.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(M(n>=0),r<0||i<0)throw new eN.ErrnoError(28);if(eN.isClosed(e)||(2097155&e.flags)==1)throw new eN.ErrnoError(8);if(eN.isDir(e.node.mode))throw new eN.ErrnoError(31);if(!e.stream_ops.read)throw new eN.ErrnoError(28);var o=void 0!==i;if(o){if(!e.seekable)throw new eN.ErrnoError(70)}else i=e.position;var a=e.stream_ops.read(e,t,n,r,i);return o||(e.position+=a),a},write(e,t,n,r,i,o){if(M(n>=0),r<0||i<0)throw new eN.ErrnoError(28);if(eN.isClosed(e)||(2097155&e.flags)==0)throw new eN.ErrnoError(8);if(eN.isDir(e.node.mode))throw new eN.ErrnoError(31);if(!e.stream_ops.write)throw new eN.ErrnoError(28);e.seekable&&1024&e.flags&&eN.llseek(e,0,2);var a=void 0!==i;if(a){if(!e.seekable)throw new eN.ErrnoError(70)}else i=e.position;var s=e.stream_ops.write(e,t,n,r,i,o);return a||(e.position+=s),s},allocate(e,t,n){if(eN.isClosed(e))throw new eN.ErrnoError(8);if(t<0||n<=0)throw new eN.ErrnoError(28);if((2097155&e.flags)==0)throw new eN.ErrnoError(8);if(!eN.isFile(e.node.mode)&&!eN.isDir(e.node.mode))throw new eN.ErrnoError(43);if(!e.stream_ops.allocate)throw new eN.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,i){if((2&r)!=0&&(2&i)==0&&(2097155&e.flags)!=2||(2097155&e.flags)==1)throw new eN.ErrnoError(2);if(!e.stream_ops.mmap)throw new eN.ErrnoError(43);if(!t)throw new eN.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync:(e,t,n,r,i)=>(M(n>=0),e.stream_ops.msync)?e.stream_ops.msync(e,t,n,r,i):0,ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new eN.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw Error(`Invalid encoding type "${t.encoding}"`);var n,r=eN.open(e,t.flags),i=eN.stat(e).size,o=new Uint8Array(i);return eN.read(r,o,0,i,0),"utf8"===t.encoding?n=eF(o):"binary"===t.encoding&&(n=o),eN.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=eN.open(e,n.flags,n.mode);if("string"==typeof t){var i=new Uint8Array(ew(t)+1),o=eE(t,i,0,i.length);eN.write(r,i,0,o,void 0,n.canOwn)}else if(ArrayBuffer.isView(t))eN.write(r,t,0,t.byteLength,void 0,n.canOwn);else throw Error("Unsupported data type");eN.close(r)},cwd:()=>eN.currentPath,chdir(e){var t=eN.lookupPath(e,{follow:!0});if(null===t.node)throw new eN.ErrnoError(44);if(!eN.isDir(t.node.mode))throw new eN.ErrnoError(54);var n=eN.nodePermissions(t.node,"x");if(n)throw new eN.ErrnoError(n);eN.currentPath=t.path},createDefaultDirectories(){eN.mkdir("/tmp"),eN.mkdir("/home"),eN.mkdir("/home/web_user")},createDefaultDevices(){eN.mkdir("/dev"),eN.registerDevice(eN.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r,llseek:()=>0}),eN.mkdev("/dev/null",eN.makedev(1,3)),ev.register(eN.makedev(5,0),ev.default_tty_ops),ev.register(eN.makedev(6,0),ev.default_tty1_ops),eN.mkdev("/dev/tty",eN.makedev(5,0)),eN.mkdev("/dev/tty1",eN.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(0===t&&(t=eD(e).byteLength),e[--t]);eN.createDevice("/dev","random",n),eN.createDevice("/dev","urandom",n),eN.mkdir("/dev/shm"),eN.mkdir("/dev/shm/tmp")},createSpecialDirectories(){eN.mkdir("/proc");var e=eN.mkdir("/proc/self");eN.mkdir("/proc/self/fd"),eN.mount({mount(){var t=eN.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var n=eN.getStreamChecked(+t),r={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return r.parent=r,r}},t}},{},"/proc/self/fd")},createStandardStreams(e,t,n){e?eN.createDevice("/dev","stdin",e):eN.symlink("/dev/tty","/dev/stdin"),t?eN.createDevice("/dev","stdout",null,t):eN.symlink("/dev/tty","/dev/stdout"),n?eN.createDevice("/dev","stderr",null,n):eN.symlink("/dev/tty1","/dev/stderr");var r=eN.open("/dev/stdin",0),i=eN.open("/dev/stdout",1),o=eN.open("/dev/stderr",1);M(0===r.fd,`invalid handle for stdin (${r.fd})`),M(1===i.fd,`invalid handle for stdout (${i.fd})`),M(2===o.fd,`invalid handle for stderr (${o.fd})`)},staticInit(){eN.nameTable=Array(4096),eN.mount(ex,{},"/"),eN.createDefaultDirectories(),eN.createDefaultDevices(),eN.createSpecialDirectories(),eN.filesystems={MEMFS:ex}},init(e,n,r){M(!eN.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),eN.initialized=!0,e??(e=t.stdin),n??(n=t.stdout),r??(r=t.stderr),eN.createStandardStreams(e,n,r)},quit(){eN.initialized=!1,eJ(0);for(var e=0;etypeof XMLHttpRequest)throw Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=o(e.url),e.usedBytes=e.contents.length}catch(e){throw new eN.ErrnoError(29)}},createLazyFile(e,t,n,r,i){if("u">typeof XMLHttpRequest){if(!E)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o={isDevice:!1,contents:new class{constructor(){S(this,"lengthKnown",!1),S(this,"chunks",[])}get(e){if(!(e>this.length-1)&&!(e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e,t=new XMLHttpRequest;if(t.open("HEAD",n,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw Error("Couldn\'t load "+n+". Status: "+t.status);var r=Number(t.getResponseHeader("Content-length")),i=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,o=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,a=1048576;i||(a=r);var s=this;s.setDataGetter(e=>{var t=e*a,i=(e+1)*a-1;if(i=Math.min(i,r-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,t)=>{if(e>t)throw Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>r-1)throw Error("only "+r+" bytes available! programmer error!");var i=new XMLHttpRequest;if(i.open("GET",n,!1),r!==a&&i.setRequestHeader("Range","bytes="+e+"-"+t),i.responseType="arraybuffer",i.overrideMimeType&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.send(null),!(i.status>=200&&i.status<300||304===i.status))throw Error("Couldn\'t load "+n+". Status: "+i.status);return void 0!==i.response?new Uint8Array(i.response||[]):eA(i.responseText||"",!0)})(t,i)),void 0===s.chunks[e])throw Error("doXHR failed!");return s.chunks[e]}),(o||!r)&&(a=r=1,a=r=this.getter(0).length,I("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=r,this._chunkSize=a,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}}}else var o={isDevice:!1,url:n};var a=eN.createFile(e,t,o,r,i);o.contents?a.contents=o.contents:o.url&&(a.contents=null,a.url=o.url),Object.defineProperties(a,{usedBytes:{get:function(){return this.contents.length}}});var l={};function u(e,t,n,r,i){var o=e.node.contents;if(i>=o.length)return 0;var a=Math.min(o.length-i,r);if(M(a>=0),o.slice)for(var s=0;s{var t=a.stream_ops[e];l[e]=(...e)=>(eN.forceLoadFile(a),t(...e))}),l.read=(e,t,n,r,i)=>(eN.forceLoadFile(a),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{eN.forceLoadFile(a);var o=ek(t);if(!o)throw new eN.ErrnoError(48);return u(e,s,o,t,n),{ptr:o,allocated:!0}},a.stream_ops=l,a},absolutePath(){J("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){J("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){J("FS.createLink has been removed; use FS.symlink instead")},joinPath(){J("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){J("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){J("FS.standardizePath has been removed; use PATH.normalize instead")}},eC={DEFAULT_POLLMASK:5,calculateAt(e,t,n){if(eP.isAbs(t))return t;if(-100===e)r=eN.cwd();else{var r;r=eC.getStreamFromFD(e).path}if(0==t.length){if(!n)throw new eN.ErrnoError(44);return r}return eP.join2(r,t)},doStat(e,t,n){var r=e(t);c[n>>>2>>>0]=r.dev,c[n+4>>>2>>>0]=r.mode,f[n+8>>>2>>>0]=r.nlink,c[n+12>>>2>>>0]=r.uid,c[n+16>>>2>>>0]=r.gid,c[n+20>>>2>>>0]=r.rdev,g=[r.size>>>0,+Math.abs(F=r.size)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+24>>>2>>>0]=g[0],c[n+28>>>2>>>0]=g[1],c[n+32>>>2>>>0]=4096,c[n+36>>>2>>>0]=r.blocks;var i=r.atime.getTime(),o=r.mtime.getTime(),a=r.ctime.getTime();return g=[Math.floor(i/1e3)>>>0,+Math.abs(F=Math.floor(i/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+40>>>2>>>0]=g[0],c[n+44>>>2>>>0]=g[1],f[n+48>>>2>>>0]=i%1e3*1e6,g=[Math.floor(o/1e3)>>>0,+Math.abs(F=Math.floor(o/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+56>>>2>>>0]=g[0],c[n+60>>>2>>>0]=g[1],f[n+64>>>2>>>0]=o%1e3*1e6,g=[Math.floor(a/1e3)>>>0,+Math.abs(F=Math.floor(a/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+72>>>2>>>0]=g[0],c[n+76>>>2>>>0]=g[1],f[n+80>>>2>>>0]=a%1e3*1e6,g=[r.ino>>>0,+Math.abs(F=r.ino)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+88>>>2>>>0]=g[0],c[n+92>>>2>>>0]=g[1],0},doMsync(e,t,n,r,i){if(!eN.isFile(t.node.mode))throw new eN.ErrnoError(43);if(2&r)return 0;var o=l.slice(e,e+n);eN.msync(t,o,i,n,r)},getStreamFromFD:e=>eN.getStreamChecked(e),varargs:void 0,getStr:e=>eg(e)},ej=(e,t,n)=>(M("number"==typeof n,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),eE(e,l,t,n)),eM=[0,31,60,91,121,152,182,213,244,274,305,335],eR=[0,31,59,90,120,151,181,212,243,273,304,334],eT=e=>{var t=a.buffer,n=(e-t.byteLength+65535)/65536|0;try{return a.grow(n),R(),1}catch(n){N(`growMemory: Attempted to grow heap from ${t.byteLength} bytes to ${e} bytes, but got error: ${n}`)}},eB={},eL=()=>{if(!eL.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:G||"./this.program"};for(var t in eB)void 0===eB[t]?delete e[t]:e[t]=eB[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);eL.strings=n}return eL.strings},e$=[],ez=e=>{var t=e$[e];return t||(e>=e$.length&&(e$.length=e+1),e$[e]=t=_.get(e)),M(_.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t},eU="u">typeof TextDecoder?new TextDecoder("utf-16le"):void 0,eV=(e,t)=>{M(e<16384),e<128?t.push(e):t.push(e%128|128,e>>7)},eW=[],eq=(e,t)=>{_.set(e,t),e$[e]=_.get(e)},eH=(e,n,r,i,o)=>{var a,l,u={string:e=>{var t,n,r=0;return null!=e&&0!==e&&(t=ew(e)+1,ej(e,n=e2(t),t),r=n),r},array:e=>{let t;var n=(t=e.length,e2(t));return M(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),s.set(e,n>>>0),n}},d=(M(a=t["_"+e],"Cannot call unknown function "+e+", make sure it is exported"),a),c=[],f=0;if(M("array"!==n,\'Return type should not be "array".\'),i)for(var m=0;m{var c,f=t?eb.resolve(eP.join2(e,t)):e,m=H(`cp ${f}`);function p(n){var i,c;function p(n){d?.(),l||eN.createDataFile(e,t,n,r,o,u),a?.(),Z(m)}i=()=>{s?.(),Z(m)},"u">typeof Browser&&Browser.init(),c=!1,eG.forEach(e=>{!c&&e.canHandle(f)&&(e.handle(n,f,p,i),c=!0)}),c||p(n)}(K(m),"string"==typeof n)?(c=H(`al ${n}`),i(n).then(e=>{M(e,`Loading data file "${n}" failed (no arrayBuffer).`),p(new Uint8Array(e)),c&&Z(c)},e=>{if(s)s();else throw`Loading data file "${n}" failed.`}),c&&K(c)):p(n)},eN.staticInit();var eK={EPDF_FillFromHostCrypto:function(e,t){var n=globalThis.crypto;if(!n||"function"!=typeof n.getRandomValues)return 0;e>>>=0,t>>>=0;try{n.getRandomValues(l.subarray(e>>>0,e+t>>>0))}catch{return 0}return 1},__assert_fail:function(e,t,n,r){e>>>=0,t>>>=0,r>>>=0,J(`Assertion failed: ${eg(e)}, at: `+[t?eg(t):"unknown filename",n,r?eg(r):"unknown function"])},__syscall_fcntl64:function(e,t,n){eC.varargs=n>>>=0;try{var r=eC.getStreamFromFD(e);switch(t){case 0:var i=e_();if(i<0)break;for(;eN.streams[i];)i++;return eN.dupStream(r,i).fd;case 1:case 2:case 13:case 14:return 0;case 3:return r.flags;case 4:var i=e_();return r.flags|=i,0;case 12:var i=e_();return u[i+0>>>1>>>0]=2,0}return -28}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_fstat64:function(e,t){t>>>=0;try{var n=eC.getStreamFromFD(e);return eC.doStat(eN.stat,n.path,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ftruncate64:function(e,t,n){var r=ep(t,n);try{if(isNaN(r))return 61;return eN.ftruncate(e,r),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_getdents64:function(e,t,n){t>>>=0,n>>>=0;try{var r=eC.getStreamFromFD(e);r.getdents||(r.getdents=eN.readdir(r.path));for(var i=0,o=eN.llseek(r,0,1),a=Math.floor(o/280);a>>0,(F=l,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[t+i>>>2>>>0]=g[0],c[t+i+4>>>2>>>0]=g[1],g=[(a+1)*280>>>0,(F=(a+1)*280,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[t+i+8>>>2>>>0]=g[0],c[t+i+12>>>2>>>0]=g[1],u[t+i+16>>>1>>>0]=280,s[t+i+18>>>0]=d,ej(f,t+i+19,256),i+=280,a+=1}return eN.llseek(r,280*a,0),i}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ioctl:function(e,t,n){eC.varargs=n>>>=0;try{var r=eC.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:if(!r.tty)return -59;return 0;case 21505:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),o=e_();c[o>>>2>>>0]=i.c_iflag||0,c[o+4>>>2>>>0]=i.c_oflag||0,c[o+8>>>2>>>0]=i.c_cflag||0,c[o+12>>>2>>>0]=i.c_lflag||0;for(var a=0;a<32;a++)s[o+a+17>>>0]=i.c_cc[a]||0}return 0;case 21506:case 21507:case 21508:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcsets){for(var o=e_(),l=c[o>>>2>>>0],d=c[o+4>>>2>>>0],f=c[o+8>>>2>>>0],m=c[o+12>>>2>>>0],p=[],a=0;a<32;a++)p.push(s[o+a+17>>>0]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:l,c_oflag:d,c_cflag:f,c_lflag:m,c_cc:p})}return 0;case 21519:if(!r.tty)return -59;var o=e_();return c[o>>>2>>>0]=0,0;case 21520:if(!r.tty)return -59;return -28;case 21531:var o=e_();return eN.ioctl(r,t,o);case 21523:if(!r.tty)return -59;if(r.tty.ops.ioctl_tiocgwinsz){var h=r.tty.ops.ioctl_tiocgwinsz(r.tty),o=e_();u[o>>>1>>>0]=h[0],u[o+2>>>1>>>0]=h[1]}return 0;default:return -28}}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_lstat64:function(e,t){e>>>=0,t>>>=0;try{return e=eC.getStr(e),eC.doStat(eN.lstat,e,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_newfstatat:function(e,t,n,r){t>>>=0,n>>>=0;try{t=eC.getStr(t);var i=256&r,o=4096&r;return r&=-6401,M(!r,`unknown flags in __syscall_newfstatat: ${r}`),t=eC.calculateAt(e,t,o),eC.doStat(i?eN.lstat:eN.stat,t,n)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_openat:function(e,t,n,r){t>>>=0,eC.varargs=r>>>=0;try{t=eC.getStr(t),t=eC.calculateAt(e,t);var i=r?e_():0;return eN.open(t,n,i).fd}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_rmdir:function(e){e>>>=0;try{return e=eC.getStr(e),eN.rmdir(e),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_stat64:function(e,t){e>>>=0,t>>>=0;try{return e=eC.getStr(e),eC.doStat(eN.stat,e,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_unlinkat:function(e,t,n){t>>>=0;try{return t=eC.getStr(t),t=eC.calculateAt(e,t),0===n?eN.unlink(t):512===n?eN.rmdir(t):J("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_abort_js:()=>{J("native code called abort()")},_emscripten_get_now_is_monotonic:()=>1,_emscripten_memcpy_js:function(e,t,n){return e>>>=0,t>>>=0,n>>>=0,l.copyWithin(e>>>0,t>>>0,t+n>>>0)},_emscripten_throw_longjmp:()=>{throw 1/0},_gmtime_js:function(e,t,n){var r=ep(e,t);n>>>=0;var i=new Date(1e3*r);c[n>>>2>>>0]=i.getUTCSeconds(),c[n+4>>>2>>>0]=i.getUTCMinutes(),c[n+8>>>2>>>0]=i.getUTCHours(),c[n+12>>>2>>>0]=i.getUTCDate(),c[n+16>>>2>>>0]=i.getUTCMonth(),c[n+20>>>2>>>0]=i.getUTCFullYear()-1900,c[n+24>>>2>>>0]=i.getUTCDay();var o=Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0),a=(i.getTime()-o)/864e5|0;c[n+28>>>2>>>0]=a},_localtime_js:function(e,t,n){let r;var i=ep(e,t);n>>>=0;var o=new Date(1e3*i);c[n>>>2>>>0]=o.getSeconds(),c[n+4>>>2>>>0]=o.getMinutes(),c[n+8>>>2>>>0]=o.getHours(),c[n+12>>>2>>>0]=o.getDate(),c[n+16>>>2>>>0]=o.getMonth(),c[n+20>>>2>>>0]=o.getFullYear()-1900,c[n+24>>>2>>>0]=o.getDay();var a=0|((r=o.getFullYear())%4==0&&(r%100!=0||r%400==0)?eM:eR)[o.getMonth()]+o.getDate()-1;c[n+28>>>2>>>0]=a,c[n+36>>>2>>>0]=-(60*o.getTimezoneOffset());var s=new Date(o.getFullYear(),0,1),l=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=s.getTimezoneOffset(),d=0|(l!=u&&o.getTimezoneOffset()==Math.min(u,l));c[n+32>>>2>>>0]=d},_mmap_js:function(e,t,n,r,i,o,a,s){e>>>=0;var l=ep(i,o);a>>>=0,s>>>=0;try{if(isNaN(l))return 61;var u=eC.getStreamFromFD(r),d=eN.mmap(u,e,l,t,n),m=d.ptr;return c[a>>>2>>>0]=d.allocated,f[s>>>2>>>0]=m,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_munmap_js:function(e,t,n,r,i,o,a){e>>>=0,t>>>=0;var s=ep(o,a);try{var l=eC.getStreamFromFD(i);2&n&&eC.doMsync(e,l,t,r,s)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_tzset_js:function(e,t,n,r){e>>>=0,t>>>=0,n>>>=0,r>>>=0;var i=(new Date).getFullYear(),o=new Date(i,0,1),a=new Date(i,6,1),s=o.getTimezoneOffset(),l=a.getTimezoneOffset(),u=Math.max(s,l);f[e>>>2>>>0]=60*u,c[t>>>2>>>0]=Number(s!=l);var d=e=>{var t=Math.abs(e),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");return`UTC${e>=0?"-":"+"}${n}${r}`},m=d(s),p=d(l);M(m),M(p),M(16>=ew(m),`timezone name truncated to fit in TZNAME_MAX (${m})`),M(16>=ew(p),`timezone name truncated to fit in TZNAME_MAX (${p})`),lDate.now(),emscripten_err:function(e){return e>>>=0,N(eg(e))},emscripten_get_now:()=>performance.now(),emscripten_resize_heap:function(e){e>>>=0;var t=l.length;M(e>t);if(e>0xffff0000)return N(`Cannot enlarge memory, requested ${e} bytes, but the limit is 4294901760 bytes!`),!1;for(var n=1;n<=4;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+0x6000000);var i=Math.min(0xffff0000,eS(Math.max(e,r),65536));if(eT(i))return!0}return N(`Failed to grow the heap from ${t} bytes to ${i} bytes, not enough memory!`),!1},environ_get:function(e,t){e>>>=0,t>>>=0;var n=0;return eL().forEach((r,i)=>{var o=t+n;f[e+4*i>>>2>>>0]=o;for(var a=o,l=0;l>>0]=r.charCodeAt(l);s[a>>>0]=0,n+=r.length+1}),0},environ_sizes_get:function(e,t){e>>>=0,t>>>=0;var n=eL();f[e>>>2>>>0]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),f[t>>>2>>>0]=r,0},exit:(e,n)=>{if(function(){var e=I,t=N,n=!1;I=N=e=>{n=!0};try{eJ(0),["stdout","stderr"].forEach(e=>{var t=eN.analyzePath("/dev/"+e);if(t){var r=t.object.rdev,i=ev.ttys[r];i?.output?.length&&(n=!0)}})}catch{}I=e,N=t,n&&em("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}(),(ed||0)&&!n){var i=`program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=0) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;r(i),N(i)}throw ed||(t.onExit?.(e),j=!0),new el(e)},fd_close:function(e){try{var t=eC.getStreamFromFD(e);return eN.close(t),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_read:function(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=eC.getStreamFromFD(e),o=((e,t,n,r)=>{for(var i=0,o=0;o>>2>>>0],l=f[t+4>>>2>>>0];t+=8;var u=eN.read(e,s,a,l,r);if(u<0)return -1;if(i+=u,u>>2>>>0]=o,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_seek:function(e,t,n,r,i){var o=ep(t,n);i>>>=0;try{if(isNaN(o))return 61;var a=eC.getStreamFromFD(e);return eN.llseek(a,o,r),g=[a.position>>>0,(F=a.position,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[i>>>2>>>0]=g[0],c[i+4>>>2>>>0]=g[1],a.getdents&&0===o&&0===r&&(a.getdents=null),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_sync:function(e){try{var t=eC.getStreamFromFD(e);if(t.stream_ops?.fsync)return t.stream_ops.fsync(t);return 0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_write:function(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=eC.getStreamFromFD(e),o=((e,t,n,r)=>{for(var i=0,o=0;o>>2>>>0],l=f[t+4>>>2>>>0];t+=8;var u=eN.write(e,s,a,l,r);if(u<0)return -1;if(i+=u,u>>2>>>0]=o,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},invoke_ii:function(e,t){var n=ef();try{return ez(e)(t)}catch(e){if(e3(n),e!==e+0)throw e;eY(1,0)}},invoke_iii:function(e,t,n){var r=ef();try{return ez(e)(t,n)}catch(e){if(e3(r),e!==e+0)throw e;eY(1,0)}},invoke_iiii:function(e,t,n,r){var i=ef();try{return ez(e)(t,n,r)}catch(e){if(e3(i),e!==e+0)throw e;eY(1,0)}},invoke_iiiii:function(e,t,n,r,i){var o=ef();try{return ez(e)(t,n,r,i)}catch(e){if(e3(o),e!==e+0)throw e;eY(1,0)}},invoke_iiiiii:function(e,t,n,r,i,o){var a=ef();try{return ez(e)(t,n,r,i,o)}catch(e){if(e3(a),e!==e+0)throw e;eY(1,0)}},invoke_iiiiiii:function(e,t,n,r,i,o,a){var s=ef();try{return ez(e)(t,n,r,i,o,a)}catch(e){if(e3(s),e!==e+0)throw e;eY(1,0)}},invoke_v:function(e){var t=ef();try{ez(e)()}catch(e){if(e3(t),e!==e+0)throw e;eY(1,0)}},invoke_vi:function(e,t){var n=ef();try{ez(e)(t)}catch(e){if(e3(n),e!==e+0)throw e;eY(1,0)}},invoke_vii:function(e,t,n){var r=ef();try{ez(e)(t,n)}catch(e){if(e3(r),e!==e+0)throw e;eY(1,0)}},invoke_viii:function(e,t,n,r){var i=ef();try{ez(e)(t,n,r)}catch(e){if(e3(i),e!==e+0)throw e;eY(1,0)}},invoke_viiii:function(e,t,n,r,i){var o=ef();try{ez(e)(t,n,r,i)}catch(e){if(e3(o),e!==e+0)throw e;eY(1,0)}},invoke_viiiiiiiii:function(e,t,n,r,i,o,a,s,l,u){var d=ef();try{ez(e)(t,n,r,i,o,a,s,l,u)}catch(e){if(e3(d),e!==e+0)throw e;eY(1,0)}}},eZ=function(){function e(e,n){var r,i,o,s;let l,u;return i=Object.assign({},i=eZ=e.exports),o=e=>t=>e(t)>>>0,s=e=>()=>e()>>>0,i.strerror=(l=i.strerror,e=>l(e)>>>0),i.emscripten_builtin_memalign=(u=i.emscripten_builtin_memalign,(e,t)=>u(e,t)>>>0),i.malloc=o(i.malloc),i.emscripten_stack_get_base=s(i.emscripten_stack_get_base),i.emscripten_stack_get_end=s(i.emscripten_stack_get_end),i._emscripten_stack_alloc=o(i._emscripten_stack_alloc),i.emscripten_stack_get_current=s(i.emscripten_stack_get_current),t.wasmExports=eZ=i,M(a=eZ.memory,"memory not found in wasm exports"),R(),M(_=eZ.__indirect_function_table,"table not found in wasm exports"),r=eZ.__wasm_call_ctors,L.unshift(r),Z("wasm-instantiate"),eZ}K("wasm-instantiate");var n,i,o=t,s={env:eK,wasi_snapshot_preview1:eK};if(t.instantiateWasm)try{return t.instantiateWasm(s,e)}catch(e){N(`Module.instantiateWasm callback failed with error: ${e}`),r(e)}return h??(h=function(){if(t.locateFile){var e="embedpdf.wasm";return e.startsWith("data:application/octet-stream;base64,")?e:t.locateFile?t.locateFile(e,O):O+e}return new URL("embedpdf.wasm",self.location.href).href}()),(n=h,i=function(n){M(t===o,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),o=null,e(n.instance)},!C&&"function"==typeof WebAssembly.instantiateStreaming&&!n.startsWith("data:application/octet-stream;base64,")&&"function"==typeof fetch?fetch(n,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,s).then(i,function(e){return N(`wasm streaming compile failed: ${e}`),N("falling back to ArrayBuffer instantiation"),ee(n,s,i)})):ee(n,s,i)).catch(r),{}}();X("__wasm_call_ctors",0),t._EPDFAction_CloseModel=X("EPDFAction_CloseModel",1),t._EPDFAction_LoadModel=X("EPDFAction_LoadModel",1),t._EPDFAction_GetRootNode=X("EPDFAction_GetRootNode",1),t._EPDFAction_GetNodeCount=X("EPDFAction_GetNodeCount",1),t._EPDFAction_GetNodeType=X("EPDFAction_GetNodeType",2),t._EPDFAction_GetNodeSubtype=X("EPDFAction_GetNodeSubtype",4),t._EPDFAction_NodeHasJavaScript=X("EPDFAction_NodeHasJavaScript",2),t._EPDFAction_GetNodeJavaScript=X("EPDFAction_GetNodeJavaScript",4),t._EPDFAction_GetNodeDest=X("EPDFAction_GetNodeDest",3),t._EPDFAction_GetNodeURI=X("EPDFAction_GetNodeURI",5),t._EPDFAction_GetNodeFilePath=X("EPDFAction_GetNodeFilePath",4),t._EPDFAction_GetNodeName=X("EPDFAction_GetNodeName",4),t._EPDFAction_GetNodeTargetCount=X("EPDFAction_GetNodeTargetCount",2),t._EPDFAction_GetNodeTargetName=X("EPDFAction_GetNodeTargetName",5),t._EPDFAction_GetNodeTargetObjectNumber=X("EPDFAction_GetNodeTargetObjectNumber",4),t._EPDFAction_GetNodeHideFlag=X("EPDFAction_GetNodeHideFlag",3),t._EPDFAction_GetNodeResetForm=X("EPDFAction_GetNodeResetForm",4),t._EPDFAction_GetNodeSubmitForm=X("EPDFAction_GetNodeSubmitForm",4),t._EPDFAction_GetNodeSubmitFormURL=X("EPDFAction_GetNodeSubmitFormURL",4),t._EPDFAction_GetNodeSubmitFormCharSet=X("EPDFAction_GetNodeSubmitFormCharSet",4),t._EPDFAction_GetNodeURIIsMap=X("EPDFAction_GetNodeURIIsMap",3),t._EPDFAction_GetNextCount=X("EPDFAction_GetNextCount",2),t._EPDFAction_GetNextAt=X("EPDFAction_GetNextAt",3),t._EPDFAction_GetWarningFlags=X("EPDFAction_GetWarningFlags",1),t._EPDFAction_IsComplete=X("EPDFAction_IsComplete",1),t._EPDFDoc_GetOpenActionModel=X("EPDFDoc_GetOpenActionModel",1),t._EPDFDoc_GetOpenActionDest=X("EPDFDoc_GetOpenActionDest",1),t._EPDFDoc_GetAdditionalActionModel=X("EPDFDoc_GetAdditionalActionModel",2),t._EPDFDoc_GetPageActionModel=X("EPDFDoc_GetPageActionModel",3),t._EPDFAnnot_GetActionModel=X("EPDFAnnot_GetActionModel",2),t._EPDFAction_CreateJavaScript=X("EPDFAction_CreateJavaScript",2),t._EPDFAction_CreateHide=X("EPDFAction_CreateHide",4),t._EPDFAction_CreateResetForm=X("EPDFAction_CreateResetForm",4),t._EPDFAction_CreateSubmitForm=X("EPDFAction_CreateSubmitForm",5),t._EPDFAction_SetNext=X("EPDFAction_SetNext",4),t._EPDFAnnot_SetEventAction=X("EPDFAnnot_SetEventAction",3),t._EPDFAnnot_SetNumberValue=X("EPDFAnnot_SetNumberValue",3),t._EPDFAnnot_HasEmbedMetadata=X("EPDFAnnot_HasEmbedMetadata",1),t._EPDFAnnot_ClearEmbedMetadata=X("EPDFAnnot_ClearEmbedMetadata",1),t._EPDFAnnot_ClearEmbedMetadataKey=X("EPDFAnnot_ClearEmbedMetadataKey",2),t._EPDFAnnot_SetEmbedMetadataString=X("EPDFAnnot_SetEmbedMetadataString",3),t._EPDFAnnot_GetEmbedMetadataString=X("EPDFAnnot_GetEmbedMetadataString",4),t._EPDFAnnot_SetEmbedMetadataNumber=X("EPDFAnnot_SetEmbedMetadataNumber",3),t._EPDFAnnot_GetEmbedMetadataNumber=X("EPDFAnnot_GetEmbedMetadataNumber",3),t._EPDFAnnot_SetEmbedMetadataBoolean=X("EPDFAnnot_SetEmbedMetadataBoolean",3),t._EPDFAnnot_GetEmbedMetadataBoolean=X("EPDFAnnot_GetEmbedMetadataBoolean",3),t._EPDFAnnot_SetEmbedMetadataRect=X("EPDFAnnot_SetEmbedMetadataRect",3),t._EPDFAnnot_GetEmbedMetadataRect=X("EPDFAnnot_GetEmbedMetadataRect",3),t._EPDFAnnot_SetEmbedMetadataJSON=X("EPDFAnnot_SetEmbedMetadataJSON",2),t._EPDFAnnot_GetEmbedMetadataJSON=X("EPDFAnnot_GetEmbedMetadataJSON",3),t._EPDFDocument_ClearEmbedMetadata=X("EPDFDocument_ClearEmbedMetadata",1),t._EPDFAnnot_SetAction=X("EPDFAnnot_SetAction",2),t._EPDFAnnot_RemoveAction=X("EPDFAnnot_RemoveAction",1),t._EPDFAnnot_RemoveDest=X("EPDFAnnot_RemoveDest",1),t._EPDFAnnot_RemoveKey=X("EPDFAnnot_RemoveKey",2),t._EPDFAnnot_GetFileAttachmentForWrite=X("EPDFAnnot_GetFileAttachmentForWrite",1),t._EPDFAnnot_SetColor=X("EPDFAnnot_SetColor",5),t._EPDFAnnot_GetColor=X("EPDFAnnot_GetColor",5),t._EPDFAnnot_ClearColor=X("EPDFAnnot_ClearColor",2),t._EPDFAnnot_SetNoColor=X("EPDFAnnot_SetNoColor",2),t._EPDFAnnot_SetOpacity=X("EPDFAnnot_SetOpacity",2),t._EPDFAnnot_GetOpacity=X("EPDFAnnot_GetOpacity",2),t._EPDFAnnot_GetBorderEffect=X("EPDFAnnot_GetBorderEffect",2),t._EPDFAnnot_SetBorderEffect=X("EPDFAnnot_SetBorderEffect",2),t._EPDFAnnot_ClearBorderEffect=X("EPDFAnnot_ClearBorderEffect",1),t._EPDFAnnot_GetRectangleDifferences=X("EPDFAnnot_GetRectangleDifferences",5),t._EPDFAnnot_ClearRectangleDifferences=X("EPDFAnnot_ClearRectangleDifferences",1),t._EPDFAnnot_GetBorderDashPatternCount=X("EPDFAnnot_GetBorderDashPatternCount",1),t._EPDFAnnot_GetBorderDashPattern=X("EPDFAnnot_GetBorderDashPattern",3),t._EPDFAnnot_SetBorderDashPattern=X("EPDFAnnot_SetBorderDashPattern",3),t._EPDFAnnot_GetBorderStyle=X("EPDFAnnot_GetBorderStyle",2),t._EPDFAnnot_SetBorderStyle=X("EPDFAnnot_SetBorderStyle",3),t._EPDFAnnot_GenerateAppearance=X("EPDFAnnot_GenerateAppearance",1),t._EPDFAnnot_GenerateAppearanceWithBlend=X("EPDFAnnot_GenerateAppearanceWithBlend",2),t._EPDFAnnot_GetBlendMode=X("EPDFAnnot_GetBlendMode",1),t._EPDFAnnot_SetIntent=X("EPDFAnnot_SetIntent",2),t._EPDFAnnot_GetIntent=X("EPDFAnnot_GetIntent",3),t._EPDFAnnot_GetRichContent=X("EPDFAnnot_GetRichContent",3),t._EPDFAnnot_GetRichTextJSON=X("EPDFAnnot_GetRichTextJSON",3),t._EPDFAnnot_SetRichTextJSON=X("EPDFAnnot_SetRichTextJSON",2),t._EPDFAnnot_SetRichTextXHTML=X("EPDFAnnot_SetRichTextXHTML",2),t._EPDFDoc_SetTypographicFeatures=X("EPDFDoc_SetTypographicFeatures",2),t._EPDFDoc_GetTypographicFeatures=X("EPDFDoc_GetTypographicFeatures",1),t._EPDFAnnot_SetLineEndings=X("EPDFAnnot_SetLineEndings",3),t._EPDFAnnot_GetLineEndings=X("EPDFAnnot_GetLineEndings",3),t._EPDFAnnot_SetVertices=X("EPDFAnnot_SetVertices",3),t._EPDFAnnot_SetLine=X("EPDFAnnot_SetLine",3),t._EPDFAnnot_SetDefaultAppearance=X("EPDFAnnot_SetDefaultAppearance",6),t._EPDFAnnot_SetDefaultAppearanceRegisteredFont=X("EPDFAnnot_SetDefaultAppearanceRegisteredFont",6),t._EPDFAnnot_GetDefaultAppearance=X("EPDFAnnot_GetDefaultAppearance",6),t._EPDFAnnot_GetDefaultAppearanceFontFace=X("EPDFAnnot_GetDefaultAppearanceFontFace",5),t._EPDFAnnot_GetDefaultAppearanceFontPostScriptName=X("EPDFAnnot_GetDefaultAppearanceFontPostScriptName",3),t._EPDFAnnot_SetDefaultAppearanceDocumentFont=X("EPDFAnnot_SetDefaultAppearanceDocumentFont",6),t._EPDFAnnot_SetTextAlignment=X("EPDFAnnot_SetTextAlignment",2),t._EPDFAnnot_GetTextAlignment=X("EPDFAnnot_GetTextAlignment",1),t._EPDFPage_GetAnnotByName=X("EPDFPage_GetAnnotByName",2),t._EPDFPage_RemoveAnnotByName=X("EPDFPage_RemoveAnnotByName",2),t._EPDFAnnot_SetLinkedAnnot=X("EPDFAnnot_SetLinkedAnnot",3),t._EPDFPage_GetAnnotIndexByNameRaw=X("EPDFPage_GetAnnotIndexByNameRaw",3),t._EPDFPage_GetAnnotIndexByObjectNumberRaw=X("EPDFPage_GetAnnotIndexByObjectNumberRaw",3),t._EPDFPage_GetAnnotCountRaw=X("EPDFPage_GetAnnotCountRaw",2),t._EPDFPage_GetAnnotRaw=X("EPDFPage_GetAnnotRaw",3),t._EPDFPage_CreateAnnotRaw=X("EPDFPage_CreateAnnotRaw",4),t._EPDFPage_RemoveAnnotRaw=X("EPDFPage_RemoveAnnotRaw",3),t._EPDFPage_PromoteInlineAnnotsRaw=X("EPDFPage_PromoteInlineAnnotsRaw",2),t._EPDFAnnot_IsValid=X("EPDFAnnot_IsValid",1),t._EPDFAnnot_SetSubtype=X("EPDFAnnot_SetSubtype",2),t._EPDFAnnot_SetName=X("EPDFAnnot_SetName",2),t._EPDFAnnot_GetName=X("EPDFAnnot_GetName",3),t._EPDFAnnot_UpdateAppearanceToRect=X("EPDFAnnot_UpdateAppearanceToRect",2),t._EPDFAnnot_SetStampOpacity=X("EPDFAnnot_SetStampOpacity",3),t._EPDFPage_CreateAnnot=X("EPDFPage_CreateAnnot",2),t._EPDFAnnot_SetRotate=X("EPDFAnnot_SetRotate",2),t._EPDFAnnot_GetRotate=X("EPDFAnnot_GetRotate",2),t._EPDFAnnot_GetAppearanceTransform=X("EPDFAnnot_GetAppearanceTransform",3),t._EPDFAnnot_GetReplyType=X("EPDFAnnot_GetReplyType",1),t._EPDFAnnot_SetReplyType=X("EPDFAnnot_SetReplyType",2),t._EPDFAnnot_GetBooleanValue=X("EPDFAnnot_GetBooleanValue",3),t._EPDFAnnot_SetBooleanValue=X("EPDFAnnot_SetBooleanValue",3),t._EPDFAnnot_SetOverlayText=X("EPDFAnnot_SetOverlayText",2),t._EPDFAnnot_GetOverlayText=X("EPDFAnnot_GetOverlayText",3),t._EPDFAnnot_SetOverlayTextRepeat=X("EPDFAnnot_SetOverlayTextRepeat",2),t._EPDFAnnot_GetOverlayTextRepeat=X("EPDFAnnot_GetOverlayTextRepeat",1),t._EPDFAnnot_SetAppearanceFromPage=X("EPDFAnnot_SetAppearanceFromPage",3),t._EPDFAnnot_ExportAppearance=X("EPDFAnnot_ExportAppearance",3),t._EPDFDoc_CanonicalDrawing=X("EPDFDoc_CanonicalDrawing",2),t._EPDFDoc_ImportDrawing=X("EPDFDoc_ImportDrawing",2),t._EPDFDoc_ExportDrawing=X("EPDFDoc_ExportDrawing",2),t._EPDFDoc_GetDrawings=X("EPDFDoc_GetDrawings",3),t._EPDFAnnot_SetDrawing=X("EPDFAnnot_SetDrawing",3),t._EPDFAnnot_GetDrawing=X("EPDFAnnot_GetDrawing",1),t._EPDFAnnot_GetRect=X("EPDFAnnot_GetRect",2),t._EPDFAnnot_SetRect=X("EPDFAnnot_SetRect",2),t._EPDFAnnot_SetAPMatrix=X("EPDFAnnot_SetAPMatrix",3),t._EPDFAnnot_GetAPMatrix=X("EPDFAnnot_GetAPMatrix",3),t._EPDFAnnot_GetAvailableAppearanceModes=X("EPDFAnnot_GetAvailableAppearanceModes",1),t._EPDFAnnot_GetAppearanceStateCount=X("EPDFAnnot_GetAppearanceStateCount",2),t._EPDFAnnot_GetAppearanceStateName=X("EPDFAnnot_GetAppearanceStateName",5),t._EPDFAnnot_GetAppearanceState=X("EPDFAnnot_GetAppearanceState",3),t._EPDFAnnot_HasAppearanceStream=X("EPDFAnnot_HasAppearanceStream",2),t._EPDFAnnot_GetDrawingRect=X("EPDFAnnot_GetDrawingRect",3),t._EPDFAnnot_SetMKColor=X("EPDFAnnot_SetMKColor",5),t._EPDFAnnot_GetMKColor=X("EPDFAnnot_GetMKColor",5),t._EPDFAnnot_ClearMKColor=X("EPDFAnnot_ClearMKColor",2),t._EPDFAnnot_SetMKText=X("EPDFAnnot_SetMKText",3),t._EPDFAnnot_GetMKText=X("EPDFAnnot_GetMKText",4),t._EPDFAnnot_SetMKTextPosition=X("EPDFAnnot_SetMKTextPosition",2),t._EPDFAnnot_GetMKTextPosition=X("EPDFAnnot_GetMKTextPosition",1),t._EPDFAnnot_SetMKIcon=X("EPDFAnnot_SetMKIcon",3),t._EPDFAnnot_GetMKIcon=X("EPDFAnnot_GetMKIcon",2),t._EPDFAnnot_ClearMKIcon=X("EPDFAnnot_ClearMKIcon",2),t._EPDFAnnot_HasMKIcon=X("EPDFAnnot_HasMKIcon",2),t._EPDFAnnot_SetMKRotation=X("EPDFAnnot_SetMKRotation",2),t._EPDFAnnot_GetMKRotation=X("EPDFAnnot_GetMKRotation",1),t._EPDFAnnot_GenerateFormFieldAP=X("EPDFAnnot_GenerateFormFieldAP",1),t._EPDFAnnot_GetCalloutLineCount=X("EPDFAnnot_GetCalloutLineCount",1),t._EPDFAnnot_GetCalloutLine=X("EPDFAnnot_GetCalloutLine",3),t._EPDFAnnot_SetCalloutLine=X("EPDFAnnot_SetCalloutLine",3),t._EPDFAnnot_GetObjectNumber=X("EPDFAnnot_GetObjectNumber",1),t._EPDFAnnot_GetStructurePosition=X("EPDFAnnot_GetStructurePosition",3),t._EPDFPage_GetAnnotByObjectNumber=X("EPDFPage_GetAnnotByObjectNumber",2),t._EPDFPage_RemoveAnnot=X("EPDFPage_RemoveAnnot",2),t._EPDFPage_RemoveAnnotByObjectNumber=X("EPDFPage_RemoveAnnotByObjectNumber",2),t._EPDFPage_MoveAnnots=X("EPDFPage_MoveAnnots",4),t._EPDFPage_MoveAnnotsRaw=X("EPDFPage_MoveAnnotsRaw",5),t._EPDF_LoadBaseDocument=X("EPDF_LoadBaseDocument",2),t._EPDF_LoadMemBaseDocument=X("EPDF_LoadMemBaseDocument",3),t._EPDF_LoadMemBaseDocument64=X("EPDF_LoadMemBaseDocument64",3),t._EPDF_ReleaseBaseDocument=X("EPDF_ReleaseBaseDocument",1),t._EPDFPage_ExportAnnotsRawToOwnedBuffer=X("EPDFPage_ExportAnnotsRawToOwnedBuffer",5),t._EPDFPage_ImportAnnotsRaw=X("EPDFPage_ImportAnnotsRaw",4),t._EPDFDoc_ExportDictRawToOwnedBuffer=X("EPDFDoc_ExportDictRawToOwnedBuffer",4),t._EPDFDoc_ExportDictCanonicalToOwnedBuffer=X("EPDFDoc_ExportDictCanonicalToOwnedBuffer",5),t._EPDFDoc_ImportDictRaw=X("EPDFDoc_ImportDictRaw",3),t._EPDFForm_ExportFieldRawToOwnedBuffer=X("EPDFForm_ExportFieldRawToOwnedBuffer",3),t._EPDFForm_ImportFieldRaw=X("EPDFForm_ImportFieldRaw",3),t._EPDFOutline_ExportItemRawToOwnedBuffer=X("EPDFOutline_ExportItemRawToOwnedBuffer",3),t._EPDFOutline_ImportItemRaw=X("EPDFOutline_ImportItemRaw",3),t._EPDFPage_ExportRawToOwnedBuffer=X("EPDFPage_ExportRawToOwnedBuffer",3),t._EPDFPage_ImportRaw=X("EPDFPage_ImportRaw",3),t._EPDFAttachment_ExportRawToOwnedBuffer=X("EPDFAttachment_ExportRawToOwnedBuffer",3),t._EPDFAttachment_ExportCanonicalToOwnedBuffer=X("EPDFAttachment_ExportCanonicalToOwnedBuffer",3),t._EPDFAttachment_ImportRaw=X("EPDFAttachment_ImportRaw",3),t._EPDFCatalog_GetMetadata=X("EPDFCatalog_GetMetadata",3),t._EPDFCatalog_SetMetadata=X("EPDFCatalog_SetMetadata",3),t._EPDFFont_RegisterFont=X("EPDFFont_RegisterFont",4),t._EPDFFont_RegisterMemFont=X("EPDFFont_RegisterMemFont",5),t._EPDFFont_RegisterMemFont64=X("EPDFFont_RegisterMemFont64",5),t._EPDFFont_ClearRegisteredFonts=X("EPDFFont_ClearRegisteredFonts",0),t._EPDFFont_GetEmbeddingPermission=X("EPDFFont_GetEmbeddingPermission",1),t._EPDFFont_IsEditingAuthorized=X("EPDFFont_IsEditingAuthorized",1),t._EPDFFont_AuthorizeEditing=X("EPDFFont_AuthorizeEditing",1),t._EPDFFont_IsInstanced=X("EPDFFont_IsInstanced",1),t._EPDFFont_GetFamilyName=X("EPDFFont_GetFamilyName",3),t._EPDFFont_GetWeight=X("EPDFFont_GetWeight",1),t._EPDFFont_IsItalic=X("EPDFFont_IsItalic",1),t._EPDFDoc_SetFontEmbeddingPolicy=X("EPDFDoc_SetFontEmbeddingPolicy",2),t._EPDFDoc_GetFontEmbeddingPolicy=X("EPDFDoc_GetFontEmbeddingPolicy",1),t._EPDFFont_AddFallbackFont=X("EPDFFont_AddFallbackFont",2),t._EPDFFont_ClearFallbackFonts=X("EPDFFont_ClearFallbackFonts",0),t._EPDFFont_SetLastResortFont=X("EPDFFont_SetLastResortFont",1),t._EPDFFont_GetLastResortFont=X("EPDFFont_GetLastResortFont",0),t._EPDFFont_GetFallbackOrder=X("EPDFFont_GetFallbackOrder",4),t._EPDFFont_GetProgramData=X("EPDFFont_GetProgramData",3),t._EPDFFont_GetProgramFormat=X("EPDFFont_GetProgramFormat",1),t._EPDFFont_GetProgramHash=X("EPDFFont_GetProgramHash",2),t._EPDFFont_GetCoverage=X("EPDFFont_GetCoverage",3),t._EPDFFont_GetMetrics=X("EPDFFont_GetMetrics",3),t._EPDFFont_GetPostScriptName=X("EPDFFont_GetPostScriptName",3),t._EPDFFontFaces_Load=X("EPDFFontFaces_Load",1),t._EPDFFontFaces_Close=X("EPDFFontFaces_Close",1),t._EPDFDoc_GetFontsFingerprint=X("EPDFDoc_GetFontsFingerprint",2),t._EPDFFontFaces_Count=X("EPDFFontFaces_Count",1),t._EPDFFontFaces_GetFamily=X("EPDFFontFaces_GetFamily",4),t._EPDFFontFaces_GetWeight=X("EPDFFontFaces_GetWeight",2),t._EPDFFontFaces_IsItalic=X("EPDFFontFaces_IsItalic",2),t._EPDFFontFaces_CountPrograms=X("EPDFFontFaces_CountPrograms",2),t._EPDFFontFaces_GetProgramObjNum=X("EPDFFontFaces_GetProgramObjNum",3),t._EPDFFontFaces_GetProgramFormat=X("EPDFFontFaces_GetProgramFormat",3),t._EPDFFontFaces_GetProgramEmbedded=X("EPDFFontFaces_GetProgramEmbedded",3),t._EPDFFontFaces_GetProgramPostScriptName=X("EPDFFontFaces_GetProgramPostScriptName",5),t._EPDFFontFaces_GetProgramEmbeddingPermission=X("EPDFFontFaces_GetProgramEmbeddingPermission",3),t._EPDFFontFaces_ProgramMapsUnicode=X("EPDFFontFaces_ProgramMapsUnicode",3),t._EPDFFontFaces_GetProgramHash=X("EPDFFontFaces_GetProgramHash",4),t._EPDFFontFaces_GetProgramDisplayHash=X("EPDFFontFaces_GetProgramDisplayHash",4),t._EPDFFontFaces_GetProgramMetrics=X("EPDFFontFaces_GetProgramMetrics",5),t._EPDFDoc_GetFontProgramData=X("EPDFDoc_GetFontProgramData",4),t._EPDFDoc_GetFontDisplayProgramData=X("EPDFDoc_GetFontDisplayProgramData",4),t._EPDFDoc_GetFontDisplayProgramCoverage=X("EPDFDoc_GetFontDisplayProgramCoverage",4),t._EPDFDoc_ResolveFonts=X("EPDFDoc_ResolveFonts",8),t._EPDFFontResolution_Close=X("EPDFFontResolution_Close",1),t._EPDFFontResolution_GetSource=X("EPDFFontResolution_GetSource",2),t._EPDFFontResolution_GetRegisteredFont=X("EPDFFontResolution_GetRegisteredFont",2),t._EPDFFontResolution_GetProgramObjNum=X("EPDFFontResolution_GetProgramObjNum",2),t._EPDFFontResolution_GetProgramDisplayHash=X("EPDFFontResolution_GetProgramDisplayHash",3),t._EPDFFontResolution_GetBaseFontName=X("EPDFFontResolution_GetBaseFontName",4),t._EPDFFontResolution_GetFamily=X("EPDFFontResolution_GetFamily",4),t._EPDFFontResolution_GetWeight=X("EPDFFontResolution_GetWeight",2),t._EPDFFontResolution_IsItalic=X("EPDFFontResolution_IsItalic",2),t._EPDFFontResolution_IsDegraded=X("EPDFFontResolution_IsDegraded",2),t._EPDFFontResolution_GetFallbacks=X("EPDFFontResolution_GetFallbacks",4),t._EPDFFontResolution_CountMissingCharacters=X("EPDFFontResolution_CountMissingCharacters",1),t._EPDFFontResolution_GetMissingCharacter=X("EPDFFontResolution_GetMissingCharacter",4),t._EPDFDoc_ClearMissingCharacters=X("EPDFDoc_ClearMissingCharacters",1),t._EPDFDoc_CountMissingCharacters=X("EPDFDoc_CountMissingCharacters",1),t._EPDFDoc_GetMissingCharacter=X("EPDFDoc_GetMissingCharacter",4),t._EPDFForm_LoadModel=X("EPDFForm_LoadModel",1),t._EPDFForm_CloseModel=X("EPDFForm_CloseModel",1),t._EPDFForm_GetFormKind=X("EPDFForm_GetFormKind",1),t._EPDFForm_GetNeedAppearances=X("EPDFForm_GetNeedAppearances",1),t._EPDFForm_CountFields=X("EPDFForm_CountFields",1),t._EPDFForm_GetFieldActionModel=X("EPDFForm_GetFieldActionModel",3),t._EPDFForm_CountCalculationOrder=X("EPDFForm_CountCalculationOrder",1),t._EPDFForm_GetCalculationOrderFieldIndex=X("EPDFForm_GetCalculationOrderFieldIndex",2),t._EPDFForm_GetFieldObjNum=X("EPDFForm_GetFieldObjNum",2),t._EPDFForm_GetFieldFamily=X("EPDFForm_GetFieldFamily",2),t._EPDFForm_GetFieldFlags=X("EPDFForm_GetFieldFlags",2),t._EPDFForm_GetFieldOrigin=X("EPDFForm_GetFieldOrigin",2),t._EPDFForm_GetFieldName=X("EPDFForm_GetFieldName",4),t._EPDFForm_GetFieldAlternateName=X("EPDFForm_GetFieldAlternateName",4),t._EPDFForm_GetFieldMappingName=X("EPDFForm_GetFieldMappingName",4),t._EPDFForm_HasFieldEmbedMetadata=X("EPDFForm_HasFieldEmbedMetadata",2),t._EPDFForm_HasFieldValuesList=X("EPDFForm_HasFieldValuesList",2),t._EPDFForm_GetFieldEmbedMetadataString=X("EPDFForm_GetFieldEmbedMetadataString",5),t._EPDFForm_GetFieldEmbedMetadataNumber=X("EPDFForm_GetFieldEmbedMetadataNumber",4),t._EPDFForm_GetFieldEmbedMetadataBoolean=X("EPDFForm_GetFieldEmbedMetadataBoolean",4),t._EPDFForm_GetFieldEmbedMetadataJSON=X("EPDFForm_GetFieldEmbedMetadataJSON",4),t._EPDFForm_GetFieldValueKind=X("EPDFForm_GetFieldValueKind",2),t._EPDFForm_CountFieldValues=X("EPDFForm_CountFieldValues",2),t._EPDFForm_GetFieldValueAt=X("EPDFForm_GetFieldValueAt",5),t._EPDFForm_GetFieldDefaultValueKind=X("EPDFForm_GetFieldDefaultValueKind",2),t._EPDFForm_CountFieldDefaultValues=X("EPDFForm_CountFieldDefaultValues",2),t._EPDFForm_GetFieldDefaultValueAt=X("EPDFForm_GetFieldDefaultValueAt",5),t._EPDFForm_GetFieldMaxLen=X("EPDFForm_GetFieldMaxLen",2),t._EPDFForm_GetFieldTopIndex=X("EPDFForm_GetFieldTopIndex",2),t._EPDFForm_CountFieldOptions=X("EPDFForm_CountFieldOptions",2),t._EPDFForm_GetFieldOptionLabel=X("EPDFForm_GetFieldOptionLabel",5),t._EPDFForm_GetFieldOptionValue=X("EPDFForm_GetFieldOptionValue",5),t._EPDFForm_IsFieldOptionSelected=X("EPDFForm_IsFieldOptionSelected",3),t._EPDFForm_CountFieldWidgets=X("EPDFForm_CountFieldWidgets",2),t._EPDFForm_GetFieldWidgetObjNum=X("EPDFForm_GetFieldWidgetObjNum",3),t._EPDFForm_GetFieldWidgetPageObjNum=X("EPDFForm_GetFieldWidgetPageObjNum",3),t._EPDFForm_GetFieldWidgetRect=X("EPDFForm_GetFieldWidgetRect",4),t._EPDFForm_GetFieldWidgetOnState=X("EPDFForm_GetFieldWidgetOnState",5),t._EPDFForm_GetFieldWidgetExportValue=X("EPDFForm_GetFieldWidgetExportValue",5),t._EPDFForm_IsFieldWidgetChecked=X("EPDFForm_IsFieldWidgetChecked",3),t._EPDFForm_GetFieldIndexByObjNum=X("EPDFForm_GetFieldIndexByObjNum",2),t._EPDFForm_GetFieldIndexForWidget=X("EPDFForm_GetFieldIndexForWidget",2),t._EPDFForm_SetFieldValue=X("EPDFForm_SetFieldValue",5),t._EPDFForm_SetFieldDefaultValue=X("EPDFForm_SetFieldDefaultValue",5),t._EPDFForm_SetFieldSelectedIndices=X("EPDFForm_SetFieldSelectedIndices",4),t._EPDFForm_SetFieldWidgetsChecked=X("EPDFForm_SetFieldWidgetsChecked",7),t._EPDFForm_RedrawFieldWidgets=X("EPDFForm_RedrawFieldWidgets",5),t._EPDFForm_SetFieldDisplay=X("EPDFForm_SetFieldDisplay",6),t._EPDFForm_SetFieldAppearanceText=X("EPDFForm_SetFieldAppearanceText",6),t._EPDFForm_ExportFDF=X("EPDFForm_ExportFDF",5),t._EPDFForm_ExportXFDF=X("EPDFForm_ExportXFDF",5),t._EPDFForm_Repair=X("EPDFForm_Repair",3),t._EPDFForm_CreateField=X("EPDFForm_CreateField",4),t._EPDFForm_AttachWidget=X("EPDFForm_AttachWidget",6),t._EPDFForm_DetachWidget=X("EPDFForm_DetachWidget",3),t._EPDFForm_DeleteField=X("EPDFForm_DeleteField",5),t._EPDFForm_SetFieldName=X("EPDFForm_SetFieldName",3),t._EPDFForm_GetFieldPartialName=X("EPDFForm_GetFieldPartialName",4),t._EPDFForm_SetFieldFlags=X("EPDFForm_SetFieldFlags",4),t._EPDFForm_SetFieldEventAction=X("EPDFForm_SetFieldEventAction",4),t._EPDFForm_SetCalculationOrder=X("EPDFForm_SetCalculationOrder",3),t._EPDFForm_SetFieldMaxLen=X("EPDFForm_SetFieldMaxLen",3),t._EPDFForm_SetFieldAlternateName=X("EPDFForm_SetFieldAlternateName",3),t._EPDFForm_SetFieldMappingName=X("EPDFForm_SetFieldMappingName",3),t._EPDFForm_SetFieldEmbedMetadataString=X("EPDFForm_SetFieldEmbedMetadataString",4),t._EPDFForm_SetFieldEmbedMetadataNumber=X("EPDFForm_SetFieldEmbedMetadataNumber",4),t._EPDFForm_SetFieldEmbedMetadataBoolean=X("EPDFForm_SetFieldEmbedMetadataBoolean",4),t._EPDFForm_SetFieldEmbedMetadataJSON=X("EPDFForm_SetFieldEmbedMetadataJSON",3),t._EPDFForm_ClearFieldEmbedMetadataKey=X("EPDFForm_ClearFieldEmbedMetadataKey",3),t._EPDFForm_ClearFieldEmbedMetadata=X("EPDFForm_ClearFieldEmbedMetadata",2),t._EPDFForm_SetFieldOptions=X("EPDFForm_SetFieldOptions",5),t._EPDFPage_Flatten=X("EPDFPage_Flatten",2),t._EPDFPage_FlattenAnnotations=X("EPDFPage_FlattenAnnotations",5),t._EPDFPage_ExportAnnotationsAsDocument=X("EPDFPage_ExportAnnotationsAsDocument",3),t._EPDFDoc_ExportPagesFlattened=X("EPDFDoc_ExportPagesFlattened",5),t._EPDFLayer_OpenLayer=X("EPDFLayer_OpenLayer",4),t._EPDFLayer_OpenLayerArtifact=X("EPDFLayer_OpenLayerArtifact",4),t._EPDFLayer_OpenLayerArtifactFromPath=X("EPDFLayer_OpenLayerArtifactFromPath",4),t._EPDFLayer_IsObjectPromoted=X("EPDFLayer_IsObjectPromoted",2),t._EPDFPage_IsValid=X("EPDFPage_IsValid",1),t._EPDFLayer_IsPagePromoted=X("EPDFLayer_IsPagePromoted",2),t._EPDFLayer_GetBirthObjectNumber=X("EPDFLayer_GetBirthObjectNumber",3),t._EPDFLayer_GetBirthName=X("EPDFLayer_GetBirthName",4),t._EPDFLayer_BeginTransaction=X("EPDFLayer_BeginTransaction",1),t._EPDFLayer_CommitTransaction=X("EPDFLayer_CommitTransaction",1),t._EPDFLayer_AbortTransaction=X("EPDFLayer_AbortTransaction",1),t._EPDFLayer_IsInTransaction=X("EPDFLayer_IsInTransaction",1),t._EPDFLayer_GetLastObjectNumber=X("EPDFLayer_GetLastObjectNumber",1),t._EPDFLayer_RaiseLastObjectNumber=X("EPDFLayer_RaiseLastObjectNumber",2),t._EPDFLayer_GetPromotedObjectCount=X("EPDFLayer_GetPromotedObjectCount",1),t._EPDFLayer_GetBaseDocument=X("EPDFLayer_GetBaseDocument",1),t._EPDF_SetBaseDocumentSha256=X("EPDF_SetBaseDocumentSha256",2),t._EPDFLayer_GetBaseSha256=X("EPDFLayer_GetBaseSha256",2),t._EPDFLayer_SaveDelta=X("EPDFLayer_SaveDelta",3),t._EPDFLayer_SaveDeltaEx=X("EPDFLayer_SaveDeltaEx",4),t._EPDFLayer_SaveDeltaToOwnedBuffer=X("EPDFLayer_SaveDeltaToOwnedBuffer",3),t._EPDFLayer_SaveDeltaToOwnedBufferEx=X("EPDFLayer_SaveDeltaToOwnedBufferEx",4),t._EPDFLayer_SaveLayerArtifact=X("EPDFLayer_SaveLayerArtifact",3),t._EPDFLayer_SaveLayerArtifactEx=X("EPDFLayer_SaveLayerArtifactEx",4),t._EPDFLayer_SaveLayerArtifactToOwnedBuffer=X("EPDFLayer_SaveLayerArtifactToOwnedBuffer",3),t._EPDFLayer_SaveLayerArtifactToOwnedBufferEx=X("EPDFLayer_SaveLayerArtifactToOwnedBufferEx",4),t._EPDFNamedDest_SetDest=X("EPDFNamedDest_SetDest",3),t._EPDFNamedDest_Remove=X("EPDFNamedDest_Remove",2),t._EPDFDest_CreateView=X("EPDFDest_CreateView",4),t._EPDFDest_CreateXYZ=X("EPDFDest_CreateXYZ",7),t._EPDFDest_CreateRemoteView=X("EPDFDest_CreateRemoteView",5),t._EPDFDest_CreateRemoteXYZ=X("EPDFDest_CreateRemoteXYZ",8),t._EPDFDest_CreateXYZByObjectNumber=X("EPDFDest_CreateXYZByObjectNumber",8),t._EPDFDest_CreateViewByObjectNumber=X("EPDFDest_CreateViewByObjectNumber",5),t._EPDFDest_GetViewNullParams=X("EPDFDest_GetViewNullParams",1),t._EPDFAction_CreateGoTo=X("EPDFAction_CreateGoTo",2),t._EPDFAction_CreateGoToNamed=X("EPDFAction_CreateGoToNamed",2),t._EPDFAction_CreateLaunch=X("EPDFAction_CreateLaunch",2),t._EPDFAction_CreateRemoteGoToByName=X("EPDFAction_CreateRemoteGoToByName",3),t._EPDFAction_CreateRemoteGoToDest=X("EPDFAction_CreateRemoteGoToDest",3),t._EPDFAction_CreateURI=X("EPDFAction_CreateURI",2),t._EPDFAction_CreateNamed=X("EPDFAction_CreateNamed",2),t._EPDFOutline_GetObjectNumber=X("EPDFOutline_GetObjectNumber",1),t._EPDFOutline_GetItem=X("EPDFOutline_GetItem",2),t._EPDFOutline_CreateItem=X("EPDFOutline_CreateItem",5),t._EPDFOutline_MoveItem=X("EPDFOutline_MoveItem",4),t._EPDFOutline_DeleteItem=X("EPDFOutline_DeleteItem",2),t._EPDFOutline_SetTitle=X("EPDFOutline_SetTitle",3),t._EPDFOutline_SetOpen=X("EPDFOutline_SetOpen",3),t._EPDFOutline_SetColor=X("EPDFOutline_SetColor",6),t._EPDFOutline_SetStyle=X("EPDFOutline_SetStyle",3),t._EPDFOutline_SetAction=X("EPDFOutline_SetAction",3),t._EPDFDoc_GetNamedPageCount=X("EPDFDoc_GetNamedPageCount",2),t._EPDFDoc_GetNamedPageAt=X("EPDFDoc_GetNamedPageAt",7),t._EPDFDoc_SetNamedPage=X("EPDFDoc_SetNamedPage",3),t._EPDFDoc_RemoveNamedPage=X("EPDFDoc_RemoveNamedPage",2),t._EPDFDoc_RemoveNamedPagesForPage=X("EPDFDoc_RemoveNamedPagesForPage",2),t._EPDFDoc_GetPageLabelSectionCount=X("EPDFDoc_GetPageLabelSectionCount",1),t._EPDFDoc_GetPageLabelSectionAt=X("EPDFDoc_GetPageLabelSectionAt",7),t._EPDFDoc_SetPageLabelSections=X("EPDFDoc_SetPageLabelSections",6),t._EPDF_DigestBuffer=X("EPDF_DigestBuffer",5),t._EPDFDoc_GetRevisionCount=X("EPDFDoc_GetRevisionCount",1),t._EPDFDoc_GetRevision=X("EPDFDoc_GetRevision",4),t._EPDFDoc_OpenRevision=X("EPDFDoc_OpenRevision",3),t._EPDFDoc_OpenBaseOverlayFromPath=X("EPDFDoc_OpenBaseOverlayFromPath",2),t._EPDFDoc_OpenBaseOverlay=X("EPDFDoc_OpenBaseOverlay",3),t._EPDFSig_LoadModel=X("EPDFSig_LoadModel",1),t._EPDFSig_CloseModel=X("EPDFSig_CloseModel",1),t._EPDFSig_Count=X("EPDFSig_Count",1),t._EPDFSig_IsRevisionChainValid=X("EPDFSig_IsRevisionChainValid",1),t._EPDFSig_GetIndexByFieldObjNum=X("EPDFSig_GetIndexByFieldObjNum",2),t._EPDFSig_GetFieldObjNum=X("EPDFSig_GetFieldObjNum",2),t._EPDFSig_GetWidgetObjNum=X("EPDFSig_GetWidgetObjNum",2),t._EPDFSig_GetWidgetPageObjNum=X("EPDFSig_GetWidgetPageObjNum",2),t._EPDFSig_GetValueObjNum=X("EPDFSig_GetValueObjNum",2),t._EPDFSig_GetFieldName=X("EPDFSig_GetFieldName",4),t._EPDFSig_IsSigned=X("EPDFSig_IsSigned",2),t._EPDFSig_GetKind=X("EPDFSig_GetKind",2),t._EPDFSig_GetByteRange=X("EPDFSig_GetByteRange",3),t._EPDFSig_GetCoverage=X("EPDFSig_GetCoverage",2),t._EPDFSig_GetRevisionIndex=X("EPDFSig_GetRevisionIndex",2),t._EPDFSig_GetContents=X("EPDFSig_GetContents",4),t._EPDFSig_GetString=X("EPDFSig_GetString",5),t._EPDFSig_GetDocMDPPermission=X("EPDFSig_GetDocMDPPermission",2),t._EPDFSig_IsCatalogCertification=X("EPDFSig_IsCatalogCertification",2),t._EPDFSig_GetFieldMDPAction=X("EPDFSig_GetFieldMDPAction",2),t._EPDFSig_GetLockAction=X("EPDFSig_GetLockAction",2),t._EPDFSig_GetLockPermission=X("EPDFSig_GetLockPermission",2),t._EPDFSig_GetFieldNameCount=X("EPDFSig_GetFieldNameCount",3),t._EPDFSig_GetFieldNameAt=X("EPDFSig_GetFieldNameAt",6),t._EPDFSig_HasSeedValue=X("EPDFSig_HasSeedValue",2),t._EPDFSig_GetSeedValueRequiredFlags=X("EPDFSig_GetSeedValueRequiredFlags",2),t._EPDFSig_GetSeedValuePresentFlags=X("EPDFSig_GetSeedValuePresentFlags",2),t._EPDFSig_GetSeedValueMDP=X("EPDFSig_GetSeedValueMDP",2),t._EPDFSig_GetSeedValueVersion=X("EPDFSig_GetSeedValueVersion",2),t._EPDFSig_GetSeedValueFilter=X("EPDFSig_GetSeedValueFilter",4),t._EPDFSig_GetSeedValueListCount=X("EPDFSig_GetSeedValueListCount",3),t._EPDFSig_GetSeedValueListAt=X("EPDFSig_GetSeedValueListAt",6),t._EPDFSig_DigestByteRange=X("EPDFSig_DigestByteRange",5),t._EPDFSig_DigestFileRange=X("EPDFSig_DigestFileRange",5),t._EPDFDoc_GetLoadedBytesSize=X("EPDFDoc_GetLoadedBytesSize",1),t._EPDFDoc_GetBaseBytesSize=X("EPDFDoc_GetBaseBytesSize",1),t._EPDFDoc_GetStructureObjectNumbers=X("EPDFDoc_GetStructureObjectNumbers",4),t._EPDFDoc_ReadLoadedBytes=X("EPDFDoc_ReadLoadedBytes",5),t._EPDFSig_Prepare=X("EPDFSig_Prepare",3),t._EPDFSig_SetFieldLock=X("EPDFSig_SetFieldLock",6),t._EPDFSig_SaveCandidateToOwnedBuffer=X("EPDFSig_SaveCandidateToOwnedBuffer",5),t._EPDFSig_SaveCandidate=X("EPDFSig_SaveCandidate",6),t._EPDFSig_Seal=X("EPDFSig_Seal",13),t._EPDFSig_SealSpan=X("EPDFSig_SealSpan",10),t._EPDFSig_WriteContents=X("EPDFSig_WriteContents",9),t._EPDFDss_GetCount=X("EPDFDss_GetCount",2),t._EPDFDss_GetData=X("EPDFDss_GetData",5),t._EPDFDss_Add=X("EPDFDss_Add",4),t._EPDFDoc_CompareRevisions=X("EPDFDoc_CompareRevisions",2),t._EPDFObjectDiff_Close=X("EPDFObjectDiff_Close",1),t._EPDFObjectDiff_GetCount=X("EPDFObjectDiff_GetCount",1),t._EPDFObjectDiff_GetEntry=X("EPDFObjectDiff_GetEntry",8),t._EPDFObjectDiff_GetValue=X("EPDFObjectDiff_GetValue",6),t._EPDFObjectDiff_GetReadStatus=X("EPDFObjectDiff_GetReadStatus",3),t._EPDFObjectDiff_GetRevisionHealth=X("EPDFObjectDiff_GetRevisionHealth",5),t._EPDFObjectDiff_GetReferrerCount=X("EPDFObjectDiff_GetReferrerCount",3),t._EPDFObjectDiff_GetReferrer=X("EPDFObjectDiff_GetReferrer",7),t._EPDFDoc_GetLoadedObjectValue=X("EPDFDoc_GetLoadedObjectValue",6),t._EPDFDoc_HasPieceInfoEntry=X("EPDFDoc_HasPieceInfoEntry",2),t._EPDFDoc_GetPieceInfoEntryCount=X("EPDFDoc_GetPieceInfoEntryCount",1),t._EPDFDoc_GetPieceInfoEntryAt=X("EPDFDoc_GetPieceInfoEntryAt",4),t._EPDFDoc_GetLastModified=X("EPDFDoc_GetLastModified",3),t._EPDFDoc_GetPieceInfoLastModified=X("EPDFDoc_GetPieceInfoLastModified",4),t._EPDFDoc_GetPieceInfoKeyCount=X("EPDFDoc_GetPieceInfoKeyCount",2),t._EPDFDoc_GetPieceInfoKeyAt=X("EPDFDoc_GetPieceInfoKeyAt",5),t._EPDFDoc_GetPieceInfoValueType=X("EPDFDoc_GetPieceInfoValueType",3),t._EPDFDoc_SetPieceInfoString=X("EPDFDoc_SetPieceInfoString",5),t._EPDFDoc_GetPieceInfoString=X("EPDFDoc_GetPieceInfoString",5),t._EPDFDoc_SetPieceInfoNumber=X("EPDFDoc_SetPieceInfoNumber",5),t._EPDFDoc_GetPieceInfoNumber=X("EPDFDoc_GetPieceInfoNumber",4),t._EPDFDoc_SetPieceInfoBoolean=X("EPDFDoc_SetPieceInfoBoolean",5),t._EPDFDoc_GetPieceInfoBoolean=X("EPDFDoc_GetPieceInfoBoolean",4),t._EPDFDoc_SetPieceInfoName=X("EPDFDoc_SetPieceInfoName",5),t._EPDFDoc_GetPieceInfoName=X("EPDFDoc_GetPieceInfoName",5),t._EPDFDoc_SetPieceInfoStringArray=X("EPDFDoc_SetPieceInfoStringArray",6),t._EPDFDoc_GetPieceInfoStringArrayCount=X("EPDFDoc_GetPieceInfoStringArrayCount",3),t._EPDFDoc_GetPieceInfoStringArrayAt=X("EPDFDoc_GetPieceInfoStringArrayAt",6),t._EPDFDoc_ClearPieceInfoKey=X("EPDFDoc_ClearPieceInfoKey",4),t._EPDFDoc_ClearPieceInfoEntry=X("EPDFDoc_ClearPieceInfoEntry",2),t._EPDFDoc_HasPagePieceInfoEntry=X("EPDFDoc_HasPagePieceInfoEntry",3),t._EPDFDoc_GetPagePieceInfoEntryCount=X("EPDFDoc_GetPagePieceInfoEntryCount",2),t._EPDFDoc_GetPagePieceInfoEntryAt=X("EPDFDoc_GetPagePieceInfoEntryAt",5),t._EPDFDoc_GetPageLastModified=X("EPDFDoc_GetPageLastModified",4),t._EPDFDoc_GetPagePieceInfoLastModified=X("EPDFDoc_GetPagePieceInfoLastModified",5),t._EPDFDoc_GetPagePieceInfoKeyCount=X("EPDFDoc_GetPagePieceInfoKeyCount",3),t._EPDFDoc_GetPagePieceInfoKeyAt=X("EPDFDoc_GetPagePieceInfoKeyAt",6),t._EPDFDoc_GetPagePieceInfoValueType=X("EPDFDoc_GetPagePieceInfoValueType",4),t._EPDFDoc_SetPagePieceInfoString=X("EPDFDoc_SetPagePieceInfoString",6),t._EPDFDoc_GetPagePieceInfoString=X("EPDFDoc_GetPagePieceInfoString",6),t._EPDFDoc_SetPagePieceInfoNumber=X("EPDFDoc_SetPagePieceInfoNumber",6),t._EPDFDoc_GetPagePieceInfoNumber=X("EPDFDoc_GetPagePieceInfoNumber",5),t._EPDFDoc_SetPagePieceInfoBoolean=X("EPDFDoc_SetPagePieceInfoBoolean",6),t._EPDFDoc_GetPagePieceInfoBoolean=X("EPDFDoc_GetPagePieceInfoBoolean",5),t._EPDFDoc_SetPagePieceInfoName=X("EPDFDoc_SetPagePieceInfoName",6),t._EPDFDoc_GetPagePieceInfoName=X("EPDFDoc_GetPagePieceInfoName",6),t._EPDFDoc_SetPagePieceInfoStringArray=X("EPDFDoc_SetPagePieceInfoStringArray",7),t._EPDFDoc_GetPagePieceInfoStringArrayCount=X("EPDFDoc_GetPagePieceInfoStringArrayCount",4),t._EPDFDoc_GetPagePieceInfoStringArrayAt=X("EPDFDoc_GetPagePieceInfoStringArrayAt",7),t._EPDFDoc_ClearPagePieceInfoKey=X("EPDFDoc_ClearPagePieceInfoKey",5),t._EPDFDoc_ClearPagePieceInfoEntry=X("EPDFDoc_ClearPagePieceInfoEntry",3),t._EPDFAnnot_GetMeasure=X("EPDFAnnot_GetMeasure",1),t._EPDFAnnot_AddMeasure=X("EPDFAnnot_AddMeasure",1),t._EPDFAnnot_RemoveMeasure=X("EPDFAnnot_RemoveMeasure",1),t._EPDFPage_CountViewports=X("EPDFPage_CountViewports",1),t._EPDFPage_GetViewport=X("EPDFPage_GetViewport",2),t._EPDFPage_AddViewport=X("EPDFPage_AddViewport",2),t._EPDFPage_RemoveViewport=X("EPDFPage_RemoveViewport",2),t._EPDFPage_CountViewportsRaw=X("EPDFPage_CountViewportsRaw",2),t._EPDFPage_GetViewportRaw=X("EPDFPage_GetViewportRaw",3),t._EPDFPage_AddViewportRaw=X("EPDFPage_AddViewportRaw",3),t._EPDFPage_RemoveViewportRaw=X("EPDFPage_RemoveViewportRaw",3),t._EPDFViewport_Close=X("EPDFViewport_Close",1),t._EPDFPage_FindViewport=X("EPDFPage_FindViewport",2),t._EPDFViewport_GetBBox=X("EPDFViewport_GetBBox",2),t._EPDFViewport_SetBBox=X("EPDFViewport_SetBBox",2),t._EPDFViewport_GetMeasure=X("EPDFViewport_GetMeasure",1),t._EPDFViewport_AddMeasure=X("EPDFViewport_AddMeasure",1),t._EPDFViewport_RemoveMeasure=X("EPDFViewport_RemoveMeasure",1),t._EPDFMeasure_GetSubtype=X("EPDFMeasure_GetSubtype",1),t._EPDFMeasure_GetOrigin=X("EPDFMeasure_GetOrigin",2),t._EPDFMeasure_SetOrigin=X("EPDFMeasure_SetOrigin",2),t._EPDFMeasure_GetCYX=X("EPDFMeasure_GetCYX",2),t._EPDFMeasure_SetCYX=X("EPDFMeasure_SetCYX",2),t._EPDFMeasure_CountFormats=X("EPDFMeasure_CountFormats",2),t._EPDFMeasure_GetFormat=X("EPDFMeasure_GetFormat",3),t._EPDFMeasure_AddFormat=X("EPDFMeasure_AddFormat",4),t._EPDFMeasure_RemoveFormats=X("EPDFMeasure_RemoveFormats",2),t._EPDFViewport_GetName=X("EPDFViewport_GetName",3),t._EPDFViewport_SetName=X("EPDFViewport_SetName",2),t._EPDFMeasure_GetRatio=X("EPDFMeasure_GetRatio",3),t._EPDFMeasure_SetRatio=X("EPDFMeasure_SetRatio",2),t._EPDFNumberFormat_GetUnit=X("EPDFNumberFormat_GetUnit",3),t._EPDFNumberFormat_SetUnit=X("EPDFNumberFormat_SetUnit",2),t._EPDFNumberFormat_GetConversion=X("EPDFNumberFormat_GetConversion",2),t._EPDFNumberFormat_SetConversion=X("EPDFNumberFormat_SetConversion",2),t._EPDFNumberFormat_GetPrecision=X("EPDFNumberFormat_GetPrecision",2),t._EPDFNumberFormat_SetPrecision=X("EPDFNumberFormat_SetPrecision",2),t._EPDFNumberFormat_GetFixedDenominator=X("EPDFNumberFormat_GetFixedDenominator",2),t._EPDFNumberFormat_SetFixedDenominator=X("EPDFNumberFormat_SetFixedDenominator",2),t._EPDFNumberFormat_GetText=X("EPDFNumberFormat_GetText",4),t._EPDFNumberFormat_SetText=X("EPDFNumberFormat_SetText",3),t._EPDFNumberFormat_GetFraction=X("EPDFNumberFormat_GetFraction",2),t._EPDFNumberFormat_SetFraction=X("EPDFNumberFormat_SetFraction",2),t._EPDFNumberFormat_GetLabelPosition=X("EPDFNumberFormat_GetLabelPosition",2),t._EPDFNumberFormat_SetLabelPosition=X("EPDFNumberFormat_SetLabelPosition",2),t._EPDFAnnot_SetLineLeader=X("EPDFAnnot_SetLineLeader",4),t._EPDFAnnot_GetLineLeader=X("EPDFAnnot_GetLineLeader",4),t._EPDFAnnot_SetLineCaption=X("EPDFAnnot_SetLineCaption",4),t._EPDFAnnot_GetLineCaption=X("EPDFAnnot_GetLineCaption",4),t._EPDFAnnot_SetShapeCaption=X("EPDFAnnot_SetShapeCaption",3),t._EPDFAnnot_GetShapeCaption=X("EPDFAnnot_GetShapeCaption",4),t._EPDFPage_GetParsedSize=X("EPDFPage_GetParsedSize",2),t._EPDFPage_IsContentCurrent=X("EPDFPage_IsContentCurrent",1),t._EPDF_PNG_EncodeRGBA=X("EPDF_PNG_EncodeRGBA",6),t._EPDFDoc_ImportPages=X("EPDFDoc_ImportPages",6),t._EPDFDoc_GetImportFieldRoots=X("EPDFDoc_GetImportFieldRoots",5),t._EPDFPage_ApplyRedactions=X("EPDFPage_ApplyRedactions",4),t._EPDF_InitThread=X("EPDF_InitThread",0),t._EPDF_ShutdownThread=X("EPDF_ShutdownThread",0),t._FPDFAnnot_IsSupportedSubtype=X("FPDFAnnot_IsSupportedSubtype",1),t._FPDFPage_CreateAnnot=X("FPDFPage_CreateAnnot",2),t._FPDFPage_GetAnnotCount=X("FPDFPage_GetAnnotCount",1),t._FPDFPage_GetAnnot=X("FPDFPage_GetAnnot",2),t._FPDFPage_GetAnnotIndex=X("FPDFPage_GetAnnotIndex",2),t._FPDFPage_CloseAnnot=X("FPDFPage_CloseAnnot",1),t._FPDFPage_RemoveAnnot=X("FPDFPage_RemoveAnnot",2),t._FPDFAnnot_GetSubtype=X("FPDFAnnot_GetSubtype",1),t._FPDFAnnot_IsObjectSupportedSubtype=X("FPDFAnnot_IsObjectSupportedSubtype",1),t._FPDFAnnot_UpdateObject=X("FPDFAnnot_UpdateObject",2),t._FPDFAnnot_AddInkStroke=X("FPDFAnnot_AddInkStroke",3),t._FPDFAnnot_RemoveInkList=X("FPDFAnnot_RemoveInkList",1),t._FPDFAnnot_AppendObject=X("FPDFAnnot_AppendObject",2),t._FPDFAnnot_GetObjectCount=X("FPDFAnnot_GetObjectCount",1),t._FPDFAnnot_GetObject=X("FPDFAnnot_GetObject",2),t._FPDFAnnot_RemoveObject=X("FPDFAnnot_RemoveObject",2),t._FPDFAnnot_SetColor=X("FPDFAnnot_SetColor",6),t._FPDFAnnot_GetColor=X("FPDFAnnot_GetColor",6),t._FPDFAnnot_HasAttachmentPoints=X("FPDFAnnot_HasAttachmentPoints",1),t._FPDFAnnot_SetAttachmentPoints=X("FPDFAnnot_SetAttachmentPoints",3),t._FPDFAnnot_AppendAttachmentPoints=X("FPDFAnnot_AppendAttachmentPoints",2),t._FPDFAnnot_CountAttachmentPoints=X("FPDFAnnot_CountAttachmentPoints",1),t._FPDFAnnot_GetAttachmentPoints=X("FPDFAnnot_GetAttachmentPoints",3),t._FPDFAnnot_SetRect=X("FPDFAnnot_SetRect",2),t._FPDFAnnot_GetRect=X("FPDFAnnot_GetRect",2),t._FPDFAnnot_GetVertices=X("FPDFAnnot_GetVertices",3),t._FPDFAnnot_GetInkListCount=X("FPDFAnnot_GetInkListCount",1),t._FPDFAnnot_GetInkListPath=X("FPDFAnnot_GetInkListPath",4),t._FPDFAnnot_GetLine=X("FPDFAnnot_GetLine",3),t._FPDFAnnot_SetBorder=X("FPDFAnnot_SetBorder",4),t._FPDFAnnot_GetBorder=X("FPDFAnnot_GetBorder",4),t._FPDFAnnot_HasKey=X("FPDFAnnot_HasKey",2),t._FPDFAnnot_GetValueType=X("FPDFAnnot_GetValueType",2),t._FPDFAnnot_SetStringValue=X("FPDFAnnot_SetStringValue",3),t._FPDFAnnot_GetStringValue=X("FPDFAnnot_GetStringValue",4),t._FPDFAnnot_GetNumberValue=X("FPDFAnnot_GetNumberValue",3),t._FPDFAnnot_SetAP=X("FPDFAnnot_SetAP",3),t._FPDFAnnot_GetAP=X("FPDFAnnot_GetAP",4),t._FPDFAnnot_GetLinkedAnnot=X("FPDFAnnot_GetLinkedAnnot",2),t._FPDFAnnot_GetFlags=X("FPDFAnnot_GetFlags",1),t._FPDFAnnot_SetFlags=X("FPDFAnnot_SetFlags",2),t._FPDFAnnot_GetFormFieldFlags=X("FPDFAnnot_GetFormFieldFlags",2),t._FPDFAnnot_SetFormFieldFlags=X("FPDFAnnot_SetFormFieldFlags",3),t._FPDFAnnot_GetFormFieldAtPoint=X("FPDFAnnot_GetFormFieldAtPoint",3),t._FPDFAnnot_GetFormFieldName=X("FPDFAnnot_GetFormFieldName",4),t._FPDFAnnot_GetFormFieldType=X("FPDFAnnot_GetFormFieldType",2),t._FPDFAnnot_GetFormAdditionalActionJavaScript=X("FPDFAnnot_GetFormAdditionalActionJavaScript",5),t._FPDFAnnot_GetFormFieldAlternateName=X("FPDFAnnot_GetFormFieldAlternateName",4),t._FPDFAnnot_GetFormFieldValue=X("FPDFAnnot_GetFormFieldValue",4),t._FPDFAnnot_GetOptionCount=X("FPDFAnnot_GetOptionCount",2),t._FPDFAnnot_GetOptionLabel=X("FPDFAnnot_GetOptionLabel",5),t._FPDFAnnot_IsOptionSelected=X("FPDFAnnot_IsOptionSelected",3),t._FPDFAnnot_GetFontSize=X("FPDFAnnot_GetFontSize",3),t._FPDFAnnot_SetFontColor=X("FPDFAnnot_SetFontColor",5),t._FPDFAnnot_GetFontColor=X("FPDFAnnot_GetFontColor",5),t._FPDFAnnot_IsChecked=X("FPDFAnnot_IsChecked",2),t._FPDFAnnot_SetFocusableSubtypes=X("FPDFAnnot_SetFocusableSubtypes",3),t._FPDFAnnot_GetFocusableSubtypesCount=X("FPDFAnnot_GetFocusableSubtypesCount",1),t._FPDFAnnot_GetFocusableSubtypes=X("FPDFAnnot_GetFocusableSubtypes",3),t._FPDFAnnot_GetLink=X("FPDFAnnot_GetLink",1),t._FPDFAnnot_GetFormControlCount=X("FPDFAnnot_GetFormControlCount",2),t._FPDFAnnot_GetFormControlIndex=X("FPDFAnnot_GetFormControlIndex",2),t._FPDFAnnot_GetFormFieldExportValue=X("FPDFAnnot_GetFormFieldExportValue",4),t._FPDFAnnot_SetURI=X("FPDFAnnot_SetURI",2),t._FPDFAnnot_GetFileAttachment=X("FPDFAnnot_GetFileAttachment",1),t._FPDFAnnot_AddFileAttachment=X("FPDFAnnot_AddFileAttachment",2),t._FPDFDoc_GetAttachmentCount=X("FPDFDoc_GetAttachmentCount",1),t._FPDFDoc_AddAttachment=X("FPDFDoc_AddAttachment",2),t._FPDFDoc_GetAttachment=X("FPDFDoc_GetAttachment",2),t._EPDFDoc_GetAttachmentKey=X("EPDFDoc_GetAttachmentKey",4),t._EPDFDoc_GetAttachmentIndexByKey=X("EPDFDoc_GetAttachmentIndexByKey",2),t._FPDFDoc_DeleteAttachment=X("FPDFDoc_DeleteAttachment",2),t._FPDFAttachment_GetName=X("FPDFAttachment_GetName",3),t._FPDFAttachment_HasKey=X("FPDFAttachment_HasKey",2),t._FPDFAttachment_GetValueType=X("FPDFAttachment_GetValueType",2),t._FPDFAttachment_SetStringValue=X("FPDFAttachment_SetStringValue",3),t._FPDFAttachment_GetStringValue=X("FPDFAttachment_GetStringValue",4),t._FPDFAttachment_SetDescription=X("FPDFAttachment_SetDescription",2),t._FPDFAttachment_GetDescription=X("FPDFAttachment_GetDescription",3),t._FPDFAttachment_SetFile=X("FPDFAttachment_SetFile",4),t._FPDFAttachment_GetFile=X("FPDFAttachment_GetFile",4),t._FPDFAttachment_GetSubtype=X("FPDFAttachment_GetSubtype",3),t._FPDFAttachment_GetAFRelationship=X("FPDFAttachment_GetAFRelationship",3),t._EPDFAttachment_SetSubtype=X("EPDFAttachment_SetSubtype",2),t._EPDFAttachment_SetDescription=X("EPDFAttachment_SetDescription",2),t._EPDFAttachment_SetName=X("EPDFAttachment_SetName",2),t._EPDFAttachment_GetDescription=X("EPDFAttachment_GetDescription",3),t._EPDFAttachment_GetIntegerValue=X("EPDFAttachment_GetIntegerValue",3),t._EPDFAttachment_ExtractFile=X("EPDFAttachment_ExtractFile",6),t._EPDFAttachment_ExtractFileToOwnedBuffer=X("EPDFAttachment_ExtractFileToOwnedBuffer",6),t._FPDFCatalog_IsTagged=X("FPDFCatalog_IsTagged",1),t._FPDFCatalog_GetLanguage=X("FPDFCatalog_GetLanguage",3),t._FPDFCatalog_SetLanguage=X("FPDFCatalog_SetLanguage",2),t._EPDFCatalog_GetLanguage=X("EPDFCatalog_GetLanguage",3),t._FPDFAvail_Create=X("FPDFAvail_Create",2),t._FPDFAvail_Destroy=X("FPDFAvail_Destroy",1),t._FPDFAvail_IsDocAvail=X("FPDFAvail_IsDocAvail",2),t._FPDFAvail_GetDocument=X("FPDFAvail_GetDocument",2),t._FPDFAvail_GetFirstPageNum=X("FPDFAvail_GetFirstPageNum",1),t._FPDFAvail_IsPageAvail=X("FPDFAvail_IsPageAvail",3),t._FPDFAvail_IsFormAvail=X("FPDFAvail_IsFormAvail",2),t._FPDFAvail_IsLinearized=X("FPDFAvail_IsLinearized",1),t._FPDFBookmark_GetFirstChild=X("FPDFBookmark_GetFirstChild",2),t._FPDFBookmark_GetNextSibling=X("FPDFBookmark_GetNextSibling",2),t._FPDFBookmark_GetTitle=X("FPDFBookmark_GetTitle",3),t._FPDFBookmark_GetCount=X("FPDFBookmark_GetCount",1),t._FPDFBookmark_Find=X("FPDFBookmark_Find",2),t._FPDFBookmark_GetDest=X("FPDFBookmark_GetDest",2),t._FPDFBookmark_GetAction=X("FPDFBookmark_GetAction",1),t._FPDFBookmark_GetColor=X("FPDFBookmark_GetColor",4),t._FPDFBookmark_GetStyle=X("FPDFBookmark_GetStyle",1),t._FPDFAction_GetType=X("FPDFAction_GetType",1),t._FPDFAction_GetDest=X("FPDFAction_GetDest",2),t._FPDFAction_GetFilePath=X("FPDFAction_GetFilePath",3),t._FPDFAction_GetURIPath=X("FPDFAction_GetURIPath",4),t._FPDFDest_GetDestPageIndex=X("FPDFDest_GetDestPageIndex",2),t._EPDFDest_GetPageObjectNumber=X("EPDFDest_GetPageObjectNumber",2),t._FPDFDest_GetView=X("FPDFDest_GetView",3),t._FPDFDest_GetLocationInPage=X("FPDFDest_GetLocationInPage",7),t._FPDFLink_GetLinkAtPoint=X("FPDFLink_GetLinkAtPoint",3),t._FPDFLink_GetLinkZOrderAtPoint=X("FPDFLink_GetLinkZOrderAtPoint",3),t._FPDFLink_GetDest=X("FPDFLink_GetDest",2),t._FPDFLink_GetAction=X("FPDFLink_GetAction",1),t._FPDFLink_Enumerate=X("FPDFLink_Enumerate",3),t._FPDFLink_GetAnnot=X("FPDFLink_GetAnnot",2),t._FPDFLink_GetAnnotRect=X("FPDFLink_GetAnnotRect",2),t._FPDFLink_CountQuadPoints=X("FPDFLink_CountQuadPoints",1),t._FPDFLink_GetQuadPoints=X("FPDFLink_GetQuadPoints",3),t._FPDF_GetPageAAction=X("FPDF_GetPageAAction",2),t._FPDF_GetFileIdentifier=X("FPDF_GetFileIdentifier",4),t._FPDF_GetMetaText=X("FPDF_GetMetaText",4),t._FPDF_GetPageLabel=X("FPDF_GetPageLabel",4),t._EPDF_SetMetaText=X("EPDF_SetMetaText",3),t._EPDF_HasMetaText=X("EPDF_HasMetaText",2),t._EPDF_GetMetaTrapped=X("EPDF_GetMetaTrapped",1),t._EPDF_SetMetaTrapped=X("EPDF_SetMetaTrapped",2),t._EPDF_GetMetaKeyCount=X("EPDF_GetMetaKeyCount",2),t._EPDF_GetMetaKeyName=X("EPDF_GetMetaKeyName",5),t._FPDFPageObj_NewImageObj=X("FPDFPageObj_NewImageObj",1),t._FPDFImageObj_LoadJpegFile=X("FPDFImageObj_LoadJpegFile",4),t._FPDFImageObj_LoadJpegFileInline=X("FPDFImageObj_LoadJpegFileInline",4),t._FPDFImageObj_SetMatrix=X("FPDFImageObj_SetMatrix",7),t._FPDFImageObj_SetBitmap=X("FPDFImageObj_SetBitmap",4),t._FPDFImageObj_GetBitmap=X("FPDFImageObj_GetBitmap",1),t._FPDFImageObj_GetRenderedBitmap=X("FPDFImageObj_GetRenderedBitmap",3),t._FPDFImageObj_GetImageDataDecoded=X("FPDFImageObj_GetImageDataDecoded",3),t._FPDFImageObj_GetImageDataRaw=X("FPDFImageObj_GetImageDataRaw",3),t._FPDFImageObj_GetImageFilterCount=X("FPDFImageObj_GetImageFilterCount",1),t._FPDFImageObj_GetImageFilter=X("FPDFImageObj_GetImageFilter",4),t._FPDFImageObj_GetImageMetadata=X("FPDFImageObj_GetImageMetadata",3),t._FPDFImageObj_GetImagePixelSize=X("FPDFImageObj_GetImagePixelSize",3),t._FPDFImageObj_GetIccProfileDataDecoded=X("FPDFImageObj_GetIccProfileDataDecoded",5),t._EPDFImageObj_SetPng=X("EPDFImageObj_SetPng",5),t._EPDFImageObj_SetJpeg=X("EPDFImageObj_SetJpeg",5),t._FPDF_CreateNewDocument=X("FPDF_CreateNewDocument",0),t._FPDFPage_Delete=X("FPDFPage_Delete",2),t._FPDF_MovePages=X("FPDF_MovePages",4),t._FPDFPage_New=X("FPDFPage_New",4),t._EPDFPage_InsertBlankRaw=X("EPDFPage_InsertBlankRaw",5),t._FPDFPage_GetRotation=X("FPDFPage_GetRotation",1),t._FPDFPage_InsertObject=X("FPDFPage_InsertObject",2),t._FPDFPage_InsertObjectAtIndex=X("FPDFPage_InsertObjectAtIndex",3),t._FPDFPage_RemoveObject=X("FPDFPage_RemoveObject",2),t._FPDFPage_CountObjects=X("FPDFPage_CountObjects",1),t._FPDFPage_GetObject=X("FPDFPage_GetObject",2),t._FPDFPage_HasTransparency=X("FPDFPage_HasTransparency",1),t._FPDFPageObj_Destroy=X("FPDFPageObj_Destroy",1),t._FPDFPageObj_GetMarkedContentID=X("FPDFPageObj_GetMarkedContentID",1),t._FPDFPageObj_CountMarks=X("FPDFPageObj_CountMarks",1),t._FPDFPageObj_GetMark=X("FPDFPageObj_GetMark",2),t._FPDFPageObj_AddExistingMark=X("FPDFPageObj_AddExistingMark",2),t._FPDFPageObj_AddMark=X("FPDFPageObj_AddMark",2),t._FPDFPageObj_RemoveMark=X("FPDFPageObj_RemoveMark",2),t._FPDFPageObjMark_GetName=X("FPDFPageObjMark_GetName",4),t._FPDFPageObjMark_CountParams=X("FPDFPageObjMark_CountParams",1),t._FPDFPageObjMark_GetParamKey=X("FPDFPageObjMark_GetParamKey",5),t._FPDFPageObjMark_GetParamValueType=X("FPDFPageObjMark_GetParamValueType",2),t._FPDFPageObjMark_GetParamIntValue=X("FPDFPageObjMark_GetParamIntValue",3),t._FPDFPageObjMark_GetParamFloatValue=X("FPDFPageObjMark_GetParamFloatValue",3),t._FPDFPageObjMark_GetParamStringValue=X("FPDFPageObjMark_GetParamStringValue",5),t._FPDFPageObjMark_GetParamBlobValue=X("FPDFPageObjMark_GetParamBlobValue",5),t._FPDFPageObj_HasTransparency=X("FPDFPageObj_HasTransparency",1),t._FPDFPageObjMark_SetIntParam=X("FPDFPageObjMark_SetIntParam",5),t._FPDFPageObjMark_SetFloatParam=X("FPDFPageObjMark_SetFloatParam",5),t._FPDFPageObjMark_SetStringParam=X("FPDFPageObjMark_SetStringParam",5),t._FPDFPageObjMark_SetBlobParam=X("FPDFPageObjMark_SetBlobParam",6),t._FPDFPageObjMark_RemoveParam=X("FPDFPageObjMark_RemoveParam",3),t._FPDFPageObj_GetType=X("FPDFPageObj_GetType",1),t._FPDFPageObj_GetIsActive=X("FPDFPageObj_GetIsActive",2),t._FPDFPageObj_SetIsActive=X("FPDFPageObj_SetIsActive",2),t._FPDFPage_GenerateContent=X("FPDFPage_GenerateContent",1),t._FPDFPageObj_Transform=X("FPDFPageObj_Transform",7),t._FPDFPageObj_TransformF=X("FPDFPageObj_TransformF",2),t._FPDFPageObj_GetMatrix=X("FPDFPageObj_GetMatrix",2),t._FPDFPageObj_SetMatrix=X("FPDFPageObj_SetMatrix",2),t._FPDFPageObj_SetBlendMode=X("FPDFPageObj_SetBlendMode",2),t._FPDFPage_TransformAnnots=X("FPDFPage_TransformAnnots",7),t._FPDFPage_SetRotation=X("FPDFPage_SetRotation",2),t._FPDFPageObj_SetFillColor=X("FPDFPageObj_SetFillColor",5),t._FPDFPageObj_GetFillColor=X("FPDFPageObj_GetFillColor",5),t._FPDFPageObj_GetBounds=X("FPDFPageObj_GetBounds",5),t._FPDFPageObj_GetRotatedBounds=X("FPDFPageObj_GetRotatedBounds",2),t._FPDFPageObj_SetStrokeColor=X("FPDFPageObj_SetStrokeColor",5),t._FPDFPageObj_GetStrokeColor=X("FPDFPageObj_GetStrokeColor",5),t._FPDFPageObj_SetStrokeWidth=X("FPDFPageObj_SetStrokeWidth",2),t._FPDFPageObj_GetStrokeWidth=X("FPDFPageObj_GetStrokeWidth",2),t._FPDFPageObj_GetLineJoin=X("FPDFPageObj_GetLineJoin",1),t._FPDFPageObj_SetLineJoin=X("FPDFPageObj_SetLineJoin",2),t._FPDFPageObj_GetLineCap=X("FPDFPageObj_GetLineCap",1),t._FPDFPageObj_SetLineCap=X("FPDFPageObj_SetLineCap",2),t._FPDFPageObj_GetDashPhase=X("FPDFPageObj_GetDashPhase",2),t._FPDFPageObj_SetDashPhase=X("FPDFPageObj_SetDashPhase",2),t._FPDFPageObj_GetDashCount=X("FPDFPageObj_GetDashCount",1),t._FPDFPageObj_GetDashArray=X("FPDFPageObj_GetDashArray",3),t._FPDFPageObj_SetDashArray=X("FPDFPageObj_SetDashArray",4),t._FPDFPageObj_GetRenderedStrokePattern=X("FPDFPageObj_GetRenderedStrokePattern",2),t._FPDFPageObj_GetRenderedFillPattern=X("FPDFPageObj_GetRenderedFillPattern",2),t._FPDFFormObj_CountObjects=X("FPDFFormObj_CountObjects",1),t._FPDFFormObj_GetObject=X("FPDFFormObj_GetObject",2),t._FPDFFormObj_RemoveObject=X("FPDFFormObj_RemoveObject",2),t._FPDFPageObj_CreateNewPath=X("FPDFPageObj_CreateNewPath",2),t._FPDFPageObj_CreateNewRect=X("FPDFPageObj_CreateNewRect",4),t._FPDFPath_CountSegments=X("FPDFPath_CountSegments",1),t._FPDFPath_GetPathSegment=X("FPDFPath_GetPathSegment",2),t._FPDFPath_MoveTo=X("FPDFPath_MoveTo",3),t._FPDFPath_LineTo=X("FPDFPath_LineTo",3),t._FPDFPath_BezierTo=X("FPDFPath_BezierTo",7),t._FPDFPath_GetBezierControlPoints=X("FPDFPath_GetBezierControlPoints",4),t._FPDFPath_Close=X("FPDFPath_Close",1),t._FPDFPath_SetDrawMode=X("FPDFPath_SetDrawMode",3),t._FPDFPath_GetDrawMode=X("FPDFPath_GetDrawMode",3),t._FPDFPathSegment_GetPoint=X("FPDFPathSegment_GetPoint",3),t._FPDFPathSegment_GetType=X("FPDFPathSegment_GetType",1),t._FPDFPathSegment_GetClose=X("FPDFPathSegment_GetClose",1),t._FPDFPageObj_NewTextObj=X("FPDFPageObj_NewTextObj",3),t._FPDFText_SetText=X("FPDFText_SetText",2),t._FPDFText_SetCharcodes=X("FPDFText_SetCharcodes",3),t._FPDFText_SetPositions=X("FPDFText_SetPositions",3),t._FPDFText_LoadFont=X("FPDFText_LoadFont",5),t._FPDFText_LoadStandardFont=X("FPDFText_LoadStandardFont",2),t._FPDFText_LoadCidType2Font=X("FPDFText_LoadCidType2Font",6),t._FPDFTextObj_GetFontSize=X("FPDFTextObj_GetFontSize",2),t._FPDFTextObj_SetFontSize=X("FPDFTextObj_SetFontSize",2),t._FPDFTextObj_GetText=X("FPDFTextObj_GetText",4),t._FPDFTextObj_GetRenderedBitmap=X("FPDFTextObj_GetRenderedBitmap",4),t._FPDFFont_Close=X("FPDFFont_Close",1),t._FPDFPageObj_CreateTextObj=X("FPDFPageObj_CreateTextObj",3),t._FPDFTextObj_GetTextRenderMode=X("FPDFTextObj_GetTextRenderMode",1),t._FPDFTextObj_SetTextRenderMode=X("FPDFTextObj_SetTextRenderMode",2),t._FPDFTextObj_GetFont=X("FPDFTextObj_GetFont",1),t._FPDFFont_GetBaseFontName=X("FPDFFont_GetBaseFontName",3),t._FPDFFont_GetFamilyName=X("FPDFFont_GetFamilyName",3),t._FPDFFont_GetFontData=X("FPDFFont_GetFontData",4),t._FPDFFont_GetIsEmbedded=X("FPDFFont_GetIsEmbedded",1),t._FPDFFont_GetFlags=X("FPDFFont_GetFlags",1),t._FPDFFont_GetWeight=X("FPDFFont_GetWeight",1),t._FPDFFont_GetItalicAngle=X("FPDFFont_GetItalicAngle",2),t._FPDFFont_GetAscent=X("FPDFFont_GetAscent",3),t._FPDFFont_GetDescent=X("FPDFFont_GetDescent",3),t._FPDFFont_GetGlyphWidth=X("FPDFFont_GetGlyphWidth",4),t._FPDFFont_GetGlyphPath=X("FPDFFont_GetGlyphPath",3),t._FPDFGlyphPath_CountGlyphSegments=X("FPDFGlyphPath_CountGlyphSegments",1),t._FPDFGlyphPath_GetGlyphPathSegment=X("FPDFGlyphPath_GetGlyphPathSegment",2),t._EPDFText_RedactInRect=X("EPDFText_RedactInRect",4),t._EPDFText_RedactInQuads=X("EPDFText_RedactInQuads",5),t._FPDFDoc_GetPageMode=X("FPDFDoc_GetPageMode",1),t._FPDFPage_Flatten=X("FPDFPage_Flatten",2),t._FPDFPage_HasFormFieldAtPoint=X("FPDFPage_HasFormFieldAtPoint",4),t._FPDFPage_FormFieldZOrderAtPoint=X("FPDFPage_FormFieldZOrderAtPoint",4),t._FPDFDOC_InitFormFillEnvironment=X("FPDFDOC_InitFormFillEnvironment",2),t._FPDFDOC_ExitFormFillEnvironment=X("FPDFDOC_ExitFormFillEnvironment",1),t._FORM_OnMouseMove=X("FORM_OnMouseMove",5),t._FORM_OnMouseWheel=X("FORM_OnMouseWheel",6),t._FORM_OnFocus=X("FORM_OnFocus",5),t._FORM_OnLButtonDown=X("FORM_OnLButtonDown",5),t._FORM_OnLButtonUp=X("FORM_OnLButtonUp",5),t._FORM_OnLButtonDoubleClick=X("FORM_OnLButtonDoubleClick",5),t._FORM_OnRButtonDown=X("FORM_OnRButtonDown",5),t._FORM_OnRButtonUp=X("FORM_OnRButtonUp",5),t._FORM_OnKeyDown=X("FORM_OnKeyDown",4),t._FORM_OnKeyUp=X("FORM_OnKeyUp",4),t._FORM_OnChar=X("FORM_OnChar",4),t._FORM_GetFocusedText=X("FORM_GetFocusedText",4),t._FORM_GetSelectedText=X("FORM_GetSelectedText",4),t._FORM_ReplaceAndKeepSelection=X("FORM_ReplaceAndKeepSelection",3),t._FORM_ReplaceSelection=X("FORM_ReplaceSelection",3),t._FORM_SelectAllText=X("FORM_SelectAllText",2),t._FORM_CanUndo=X("FORM_CanUndo",2),t._FORM_CanRedo=X("FORM_CanRedo",2),t._FORM_Undo=X("FORM_Undo",2),t._FORM_Redo=X("FORM_Redo",2),t._FORM_ForceToKillFocus=X("FORM_ForceToKillFocus",1),t._FORM_GetFocusedAnnot=X("FORM_GetFocusedAnnot",3),t._FORM_SetFocusedAnnot=X("FORM_SetFocusedAnnot",2),t._FPDF_FFLDraw=X("FPDF_FFLDraw",9),t._FPDF_SetFormFieldHighlightColor=X("FPDF_SetFormFieldHighlightColor",3),t._FPDF_SetFormFieldHighlightAlpha=X("FPDF_SetFormFieldHighlightAlpha",2),t._FPDF_RemoveFormFieldHighlight=X("FPDF_RemoveFormFieldHighlight",1),t._FORM_OnAfterLoadPage=X("FORM_OnAfterLoadPage",2),t._FORM_OnBeforeClosePage=X("FORM_OnBeforeClosePage",2),t._FORM_DoDocumentJSAction=X("FORM_DoDocumentJSAction",1),t._FORM_DoDocumentOpenAction=X("FORM_DoDocumentOpenAction",1),t._FORM_DoDocumentAAction=X("FORM_DoDocumentAAction",2),t._FORM_DoPageAAction=X("FORM_DoPageAAction",3),t._FORM_SetIndexSelected=X("FORM_SetIndexSelected",4),t._FORM_IsIndexSelected=X("FORM_IsIndexSelected",3),t._FORM_GetTextDirection=X("FORM_GetTextDirection",2),t._FORM_SetTextDirection=X("FORM_SetTextDirection",3),t._FPDFDoc_GetJavaScriptActionCount=X("FPDFDoc_GetJavaScriptActionCount",1),t._FPDFDoc_GetJavaScriptAction=X("FPDFDoc_GetJavaScriptAction",2),t._EPDFDoc_GetNamedJavaScriptActionModel=X("EPDFDoc_GetNamedJavaScriptActionModel",2),t._FPDFDoc_CloseJavaScriptAction=X("FPDFDoc_CloseJavaScriptAction",1),t._FPDFJavaScriptAction_GetName=X("FPDFJavaScriptAction_GetName",3),t._FPDFJavaScriptAction_GetScript=X("FPDFJavaScriptAction_GetScript",3),t._FPDF_ImportPagesByIndex=X("FPDF_ImportPagesByIndex",5),t._FPDF_ImportPages=X("FPDF_ImportPages",4),t._FPDF_ImportNPagesToOne=X("FPDF_ImportNPagesToOne",5),t._FPDF_NewXObjectFromPage=X("FPDF_NewXObjectFromPage",3),t._FPDF_CloseXObject=X("FPDF_CloseXObject",1),t._FPDF_NewFormObjectFromXObject=X("FPDF_NewFormObjectFromXObject",1),t._FPDF_CopyViewerPreferences=X("FPDF_CopyViewerPreferences",2),t._FPDF_RenderPageBitmapWithColorScheme_Start=X("FPDF_RenderPageBitmapWithColorScheme_Start",10),t._FPDF_RenderPageBitmap_Start=X("FPDF_RenderPageBitmap_Start",9),t._FPDF_RenderPage_Continue=X("FPDF_RenderPage_Continue",2),t._FPDF_RenderPage_Close=X("FPDF_RenderPage_Close",1),t._EPDF_RenderPageBitmapWithMatrix_Start=X("EPDF_RenderPageBitmapWithMatrix_Start",6),t._EPDF_RenderPage_Continue=X("EPDF_RenderPage_Continue",2),t._EPDF_FreeBuffer=X("EPDF_FreeBuffer",1),t._FPDF_SaveAsCopy=X("FPDF_SaveAsCopy",3),t._FPDF_SaveWithVersion=X("FPDF_SaveWithVersion",4),t._EPDF_SaveDocumentToOwnedBuffer=X("EPDF_SaveDocumentToOwnedBuffer",3),t._EPDF_SaveDocumentToOwnedBufferWithVersion=X("EPDF_SaveDocumentToOwnedBufferWithVersion",4),t._EPDF_SaveDocumentToOwnedBufferEx=X("EPDF_SaveDocumentToOwnedBufferEx",5),t._EPDF_SaveAsCopyEx=X("EPDF_SaveAsCopyEx",4),t._FPDFText_GetCharIndexFromTextIndex=X("FPDFText_GetCharIndexFromTextIndex",2),t._FPDFText_GetTextIndexFromCharIndex=X("FPDFText_GetTextIndexFromCharIndex",2),t._FPDF_GetSignatureCount=X("FPDF_GetSignatureCount",1),t._FPDF_GetSignatureObject=X("FPDF_GetSignatureObject",2),t._FPDFSignatureObj_GetContents=X("FPDFSignatureObj_GetContents",3),t._FPDFSignatureObj_GetByteRange=X("FPDFSignatureObj_GetByteRange",3),t._FPDFSignatureObj_GetSubFilter=X("FPDFSignatureObj_GetSubFilter",3),t._FPDFSignatureObj_GetReason=X("FPDFSignatureObj_GetReason",3),t._FPDFSignatureObj_GetTime=X("FPDFSignatureObj_GetTime",3),t._FPDFSignatureObj_GetDocMDPPermission=X("FPDFSignatureObj_GetDocMDPPermission",1),t._FPDF_StructTree_GetForPage=X("FPDF_StructTree_GetForPage",1),t._FPDF_StructTree_Close=X("FPDF_StructTree_Close",1),t._FPDF_StructTree_CountChildren=X("FPDF_StructTree_CountChildren",1),t._FPDF_StructTree_GetChildAtIndex=X("FPDF_StructTree_GetChildAtIndex",2),t._FPDF_StructElement_GetAltText=X("FPDF_StructElement_GetAltText",3),t._FPDF_StructElement_GetActualText=X("FPDF_StructElement_GetActualText",3),t._FPDF_StructElement_GetExpansion=X("FPDF_StructElement_GetExpansion",3),t._FPDF_StructElement_GetID=X("FPDF_StructElement_GetID",3),t._FPDF_StructElement_GetLang=X("FPDF_StructElement_GetLang",3),t._FPDF_StructElement_GetAttributeCount=X("FPDF_StructElement_GetAttributeCount",1),t._FPDF_StructElement_GetAttributeAtIndex=X("FPDF_StructElement_GetAttributeAtIndex",2),t._FPDF_StructElement_GetStringAttribute=X("FPDF_StructElement_GetStringAttribute",4),t._FPDF_StructElement_GetMarkedContentID=X("FPDF_StructElement_GetMarkedContentID",1),t._FPDF_StructElement_GetRawType=X("FPDF_StructElement_GetRawType",3),t._FPDF_StructElement_GetType=X("FPDF_StructElement_GetType",3),t._FPDF_StructElement_GetObjType=X("FPDF_StructElement_GetObjType",3),t._FPDF_StructElement_GetTitle=X("FPDF_StructElement_GetTitle",3),t._FPDF_StructElement_CountChildren=X("FPDF_StructElement_CountChildren",1),t._FPDF_StructElement_GetChildAtIndex=X("FPDF_StructElement_GetChildAtIndex",2),t._FPDF_StructElement_GetChildMarkedContentID=X("FPDF_StructElement_GetChildMarkedContentID",2),t._FPDF_StructElement_GetParent=X("FPDF_StructElement_GetParent",1),t._FPDF_StructElement_Attr_GetCount=X("FPDF_StructElement_Attr_GetCount",1),t._FPDF_StructElement_Attr_GetName=X("FPDF_StructElement_Attr_GetName",5),t._FPDF_StructElement_Attr_GetValue=X("FPDF_StructElement_Attr_GetValue",2),t._FPDF_StructElement_Attr_GetType=X("FPDF_StructElement_Attr_GetType",1),t._FPDF_StructElement_Attr_GetBooleanValue=X("FPDF_StructElement_Attr_GetBooleanValue",2),t._FPDF_StructElement_Attr_GetNumberValue=X("FPDF_StructElement_Attr_GetNumberValue",2),t._FPDF_StructElement_Attr_GetStringValue=X("FPDF_StructElement_Attr_GetStringValue",4),t._FPDF_StructElement_Attr_GetBlobValue=X("FPDF_StructElement_Attr_GetBlobValue",4),t._FPDF_StructElement_Attr_CountChildren=X("FPDF_StructElement_Attr_CountChildren",1),t._FPDF_StructElement_Attr_GetChildAtIndex=X("FPDF_StructElement_Attr_GetChildAtIndex",2),t._FPDF_StructElement_GetMarkedContentIdCount=X("FPDF_StructElement_GetMarkedContentIdCount",1),t._FPDF_StructElement_GetMarkedContentIdAtIndex=X("FPDF_StructElement_GetMarkedContentIdAtIndex",2),t._FPDF_AddInstalledFont=X("FPDF_AddInstalledFont",3),t._FPDF_SetSystemFontInfo=X("FPDF_SetSystemFontInfo",1),t._FPDF_GetDefaultTTFMap=X("FPDF_GetDefaultTTFMap",0),t._FPDF_GetDefaultTTFMapCount=X("FPDF_GetDefaultTTFMapCount",0),t._FPDF_GetDefaultTTFMapEntry=X("FPDF_GetDefaultTTFMapEntry",1),t._FPDF_GetDefaultSystemFontInfo=X("FPDF_GetDefaultSystemFontInfo",0),t._FPDF_FreeDefaultSystemFontInfo=X("FPDF_FreeDefaultSystemFontInfo",1),t._FPDFText_LoadPage=X("FPDFText_LoadPage",1),t._FPDFText_ClosePage=X("FPDFText_ClosePage",1),t._FPDFText_CountChars=X("FPDFText_CountChars",1),t._FPDFText_GetUnicode=X("FPDFText_GetUnicode",2),t._FPDFText_GetTextObject=X("FPDFText_GetTextObject",2),t._FPDFText_IsGenerated=X("FPDFText_IsGenerated",2),t._FPDFText_IsHyphen=X("FPDFText_IsHyphen",2),t._FPDFText_HasUnicodeMapError=X("FPDFText_HasUnicodeMapError",2),t._FPDFText_GetFontSize=X("FPDFText_GetFontSize",2),t._FPDFText_GetFontInfo=X("FPDFText_GetFontInfo",5),t._FPDFText_GetFontWeight=X("FPDFText_GetFontWeight",2),t._FPDFText_GetFillColor=X("FPDFText_GetFillColor",6),t._FPDFText_GetStrokeColor=X("FPDFText_GetStrokeColor",6),t._FPDFText_GetCharAngle=X("FPDFText_GetCharAngle",2),t._FPDFText_GetCharBox=X("FPDFText_GetCharBox",6),t._FPDFText_GetLooseCharBox=X("FPDFText_GetLooseCharBox",3),t._EPDFText_GetCharGeometry=X("EPDFText_GetCharGeometry",3),t._EPDFText_GetPageGeometry=X("EPDFText_GetPageGeometry",4),t._EPDFText_GetTextFull=X("EPDFText_GetTextFull",3),t._EPDFText_GetCharToTextMap=X("EPDFText_GetCharToTextMap",3),t._FPDFText_GetMatrix=X("FPDFText_GetMatrix",3),t._FPDFText_GetCharOrigin=X("FPDFText_GetCharOrigin",4),t._FPDFText_GetCharIndexAtPos=X("FPDFText_GetCharIndexAtPos",5),t._FPDFText_GetText=X("FPDFText_GetText",4),t._FPDFText_CountRects=X("FPDFText_CountRects",3),t._FPDFText_GetRect=X("FPDFText_GetRect",6),t._FPDFText_GetBoundedText=X("FPDFText_GetBoundedText",7),t._FPDFText_FindStart=X("FPDFText_FindStart",4),t._FPDFText_FindNext=X("FPDFText_FindNext",1),t._FPDFText_FindPrev=X("FPDFText_FindPrev",1),t._FPDFText_GetSchResultIndex=X("FPDFText_GetSchResultIndex",1),t._FPDFText_GetSchCount=X("FPDFText_GetSchCount",1),t._FPDFText_FindClose=X("FPDFText_FindClose",1),t._FPDFLink_LoadWebLinks=X("FPDFLink_LoadWebLinks",1),t._FPDFLink_CountWebLinks=X("FPDFLink_CountWebLinks",1),t._FPDFLink_GetURL=X("FPDFLink_GetURL",4),t._FPDFLink_CountRects=X("FPDFLink_CountRects",2),t._FPDFLink_GetRect=X("FPDFLink_GetRect",7),t._FPDFLink_GetTextRange=X("FPDFLink_GetTextRange",4),t._FPDFLink_CloseWebLinks=X("FPDFLink_CloseWebLinks",1),t._FPDFPage_GetDecodedThumbnailData=X("FPDFPage_GetDecodedThumbnailData",3),t._FPDFPage_GetRawThumbnailData=X("FPDFPage_GetRawThumbnailData",3),t._FPDFPage_GetThumbnailAsBitmap=X("FPDFPage_GetThumbnailAsBitmap",1),t._FPDFPage_SetMediaBox=X("FPDFPage_SetMediaBox",5),t._FPDFPage_SetCropBox=X("FPDFPage_SetCropBox",5),t._FPDFPage_SetBleedBox=X("FPDFPage_SetBleedBox",5),t._FPDFPage_SetTrimBox=X("FPDFPage_SetTrimBox",5),t._FPDFPage_SetArtBox=X("FPDFPage_SetArtBox",5),t._FPDFPage_GetMediaBox=X("FPDFPage_GetMediaBox",5),t._FPDFPage_GetCropBox=X("FPDFPage_GetCropBox",5),t._FPDFPage_GetBleedBox=X("FPDFPage_GetBleedBox",5),t._FPDFPage_GetTrimBox=X("FPDFPage_GetTrimBox",5),t._FPDFPage_GetArtBox=X("FPDFPage_GetArtBox",5),t._FPDFPage_TransFormWithClip=X("FPDFPage_TransFormWithClip",3),t._FPDFPageObj_TransformClipPath=X("FPDFPageObj_TransformClipPath",7),t._FPDFPageObj_GetClipPath=X("FPDFPageObj_GetClipPath",1),t._FPDFClipPath_CountPaths=X("FPDFClipPath_CountPaths",1),t._FPDFClipPath_CountPathSegments=X("FPDFClipPath_CountPathSegments",2),t._FPDFClipPath_GetPathSegment=X("FPDFClipPath_GetPathSegment",3),t._FPDF_CreateClipPath=X("FPDF_CreateClipPath",4),t._FPDF_DestroyClipPath=X("FPDF_DestroyClipPath",1),t._FPDFPage_InsertClipPath=X("FPDFPage_InsertClipPath",2),t._FPDF_InitLibrary=X("FPDF_InitLibrary",0),t._FPDF_InitLibraryWithConfig=X("FPDF_InitLibraryWithConfig",1),t._FPDF_DestroyLibrary=X("FPDF_DestroyLibrary",0),t._FPDF_SetSandBoxPolicy=X("FPDF_SetSandBoxPolicy",2),t._FPDF_LoadDocument=X("FPDF_LoadDocument",2),t._FPDF_GetFormType=X("FPDF_GetFormType",1),t._FPDF_LoadXFA=X("FPDF_LoadXFA",1),t._FPDF_LoadMemDocument=X("FPDF_LoadMemDocument",3),t._FPDF_LoadMemDocument64=X("FPDF_LoadMemDocument64",3),t._FPDF_LoadCustomDocument=X("FPDF_LoadCustomDocument",2),t._FPDF_GetFileVersion=X("FPDF_GetFileVersion",2),t._FPDF_DocumentHasValidCrossReferenceTable=X("FPDF_DocumentHasValidCrossReferenceTable",1),t._FPDF_GetDocPermissions=X("FPDF_GetDocPermissions",1),t._FPDF_GetDocUserPermissions=X("FPDF_GetDocUserPermissions",1),t._FPDF_GetSecurityHandlerRevision=X("FPDF_GetSecurityHandlerRevision",1),t._EPDF_SetEncryption=X("EPDF_SetEncryption",4),t._EPDF_RemoveEncryption=X("EPDF_RemoveEncryption",1),t._EPDF_UnlockOwnerPermissions=X("EPDF_UnlockOwnerPermissions",2),t._EPDF_CheckPasswordPermissions=X("EPDF_CheckPasswordPermissions",6),t._EPDF_SetRuntimeOwnerPermissions=X("EPDF_SetRuntimeOwnerPermissions",2),t._EPDF_IsEncrypted=X("EPDF_IsEncrypted",1),t._EPDF_IsOwnerUnlocked=X("EPDF_IsOwnerUnlocked",1),t._FPDF_GetPageCount=X("FPDF_GetPageCount",1),t._FPDF_LoadPage=X("FPDF_LoadPage",2),t._EPDFDoc_LoadPageByObjectNumber=X("EPDFDoc_LoadPageByObjectNumber",2),t._EPDFDoc_LoadPageByObjectNumberNormalized=X("EPDFDoc_LoadPageByObjectNumberNormalized",2),t._EPDFDoc_GetPageObjectNumberByIndex=X("EPDFDoc_GetPageObjectNumberByIndex",2),t._EPDFDoc_DeletePageByObjectNumber=X("EPDFDoc_DeletePageByObjectNumber",2),t._EPDFDoc_SetPageRotationByObjectNumber=X("EPDFDoc_SetPageRotationByObjectNumber",3),t._EPDFDoc_StartLoadPageByObjectNumber=X("EPDFDoc_StartLoadPageByObjectNumber",3),t._EPDFPage_ContinueLoad=X("EPDFPage_ContinueLoad",2),t._EPDFPage_GetObjectNumber=X("EPDFPage_GetObjectNumber",1),t._FPDF_GetPageWidthF=X("FPDF_GetPageWidthF",1),t._FPDF_GetPageWidth=X("FPDF_GetPageWidth",1),t._FPDF_GetPageHeightF=X("FPDF_GetPageHeightF",1),t._FPDF_GetPageHeight=X("FPDF_GetPageHeight",1),t._FPDF_GetPageBoundingBox=X("FPDF_GetPageBoundingBox",2),t._FPDF_RenderPageBitmap=X("FPDF_RenderPageBitmap",8),t._FPDF_RenderPageBitmapWithMatrix=X("FPDF_RenderPageBitmapWithMatrix",5),t._EPDF_RenderAnnotBitmap=X("EPDF_RenderAnnotBitmap",7),t._EPDF_RenderAnnotBitmapUnrotated=X("EPDF_RenderAnnotBitmapUnrotated",9),t._EPDF_SetDecodedImageBudget=X("EPDF_SetDecodedImageBudget",1),t._EPDF_GetDecodedImageBytes=X("EPDF_GetDecodedImageBytes",0),t._EPDFPage_ResetRenderCache=X("EPDFPage_ResetRenderCache",1),t._FPDF_ClosePage=X("FPDF_ClosePage",1),t._FPDF_CloseDocument=X("FPDF_CloseDocument",1),t._FPDF_GetLastError=X("FPDF_GetLastError",0),t._FPDF_DeviceToPage=X("FPDF_DeviceToPage",10),t._FPDF_PageToDevice=X("FPDF_PageToDevice",10),t._FPDFBitmap_Create=X("FPDFBitmap_Create",3),t._FPDFBitmap_CreateEx=X("FPDFBitmap_CreateEx",5),t._FPDFBitmap_GetFormat=X("FPDFBitmap_GetFormat",1),t._FPDFBitmap_FillRect=X("FPDFBitmap_FillRect",6),t._FPDFBitmap_GetBuffer=X("FPDFBitmap_GetBuffer",1),t._FPDFBitmap_GetWidth=X("FPDFBitmap_GetWidth",1),t._FPDFBitmap_GetHeight=X("FPDFBitmap_GetHeight",1),t._FPDFBitmap_GetStride=X("FPDFBitmap_GetStride",1),t._FPDFBitmap_Destroy=X("FPDFBitmap_Destroy",1),t._FPDF_GetPageSizeByIndexF=X("FPDF_GetPageSizeByIndexF",3),t._EPDF_GetPageRotateByIndex=X("EPDF_GetPageRotateByIndex",3),t._EPDF_GetPageTabOrderByIndex=X("EPDF_GetPageTabOrderByIndex",4),t._EPDF_GetPageBoxByIndex=X("EPDF_GetPageBoxByIndex",4),t._EPDF_GetPageUserUnitByIndex=X("EPDF_GetPageUserUnitByIndex",3),t._EPDF_LoadPageNormalized=X("EPDF_LoadPageNormalized",3),t._FPDF_GetPageSizeByIndex=X("FPDF_GetPageSizeByIndex",4),t._FPDF_VIEWERREF_GetPrintScaling=X("FPDF_VIEWERREF_GetPrintScaling",1),t._FPDF_VIEWERREF_GetNumCopies=X("FPDF_VIEWERREF_GetNumCopies",1),t._FPDF_VIEWERREF_GetPrintPageRange=X("FPDF_VIEWERREF_GetPrintPageRange",1),t._FPDF_VIEWERREF_GetPrintPageRangeCount=X("FPDF_VIEWERREF_GetPrintPageRangeCount",1),t._FPDF_VIEWERREF_GetPrintPageRangeElement=X("FPDF_VIEWERREF_GetPrintPageRangeElement",2),t._FPDF_VIEWERREF_GetDuplex=X("FPDF_VIEWERREF_GetDuplex",1),t._FPDF_VIEWERREF_GetName=X("FPDF_VIEWERREF_GetName",4),t._FPDF_CountNamedDests=X("FPDF_CountNamedDests",1),t._FPDF_GetNamedDestByName=X("FPDF_GetNamedDestByName",2),t._FPDF_GetNamedDest=X("FPDF_GetNamedDest",4),t._FPDF_GetXFAPacketCount=X("FPDF_GetXFAPacketCount",1),t._FPDF_GetXFAPacketName=X("FPDF_GetXFAPacketName",4),t._FPDF_GetXFAPacketContent=X("FPDF_GetXFAPacketContent",5),t._FPDF_GetTrailerEnds=X("FPDF_GetTrailerEnds",3);var eJ=X("fflush",1),eQ=X("strerror",1),eX=X("emscripten_builtin_memalign",2);t._malloc=X("malloc",1),t._free=X("free",1);var eY=X("setThrew",2);X("_emscripten_tempret_set",1);var e0=()=>(e0=eZ.emscripten_stack_init)(),e1=()=>(e1=eZ.emscripten_stack_get_end)(),e3=e=>(e3=eZ._emscripten_stack_restore)(e),e2=e=>(e2=eZ._emscripten_stack_alloc)(e),e6=()=>(e6=eZ.emscripten_stack_get_current)();function e5(){var e,r;if(!(U>0)){if(e0(),M((3&(e=e1()))==0),0==e&&(e+=4),f[e>>>2>>>0]=0x2135467,f[e+4>>>2>>>0]=0x89bacdfe,f[0]=0x63736d65,t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)r=t.preRun.shift(),B.unshift(r);eu(B),U>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>t.setStatus(""),1),i()},1)):i(),T())}function i(){if(!D&&(D=!0,t.calledRun=!0,!j)){if(M(!z),z=!0,T(),t.noFSInit||eN.initialized||eN.init(),eN.ignorePermissions=!1,ev.init(),eu(L),n(t),t.onRuntimeInitialized?.(),M(!t._main,\'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]\'),T(),t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;){var e;e=t.postRun.shift(),$.unshift(e)}eu($)}}}if(t.dynCall_jiji=X("dynCall_jiji",5),t.dynCall_iiiiij=X("dynCall_iiiiij",7),t.dynCall_iiiiijj=X("dynCall_iiiiijj",9),t.dynCall_iiiiiijj=X("dynCall_iiiiiijj",10),t.dynCall_viijii=X("dynCall_viijii",7),t.dynCall_ji=X("dynCall_ji",2),t.dynCall_iiij=X("dynCall_iiij",5),t.dynCall_j=X("dynCall_j",1),t.dynCall_iji=X("dynCall_iji",4),t.dynCall_jji=X("dynCall_jji",4),t.dynCall_iiji=X("dynCall_iiji",5),t.dynCall_viijj=X("dynCall_viijj",7),t.dynCall_jij=X("dynCall_jij",4),t.dynCall_iij=X("dynCall_iij",4),t.dynCall_viji=X("dynCall_viji",5),t.wasmExports=eZ,t.ccall=eH,t.cwrap=(e,t,n,r)=>(...i)=>eH(e,t,n,i,r),t.addFunction=(e,t)=>{M(void 0!==e);var n=(e=>{if(!P){P=new WeakMap;var t=_.length;if(P)for(var n=0;n<0+t;n++){var r=ez(n);r&&P.set(r,n)}}return P.get(e)||0})(e);if(n)return n;var r=(()=>{if(eW.length)return eW.pop();try{_.grow(1)}catch(e){if(!(e instanceof RangeError))throw e;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return _.length-1})();try{eq(r,e)}catch(n){if(!(n instanceof TypeError))throw n;M(void 0!==t,"Missing signature argument to addFunction: "+e),eq(r,((e,t)=>{if(M(!t.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled"),"function"==typeof WebAssembly.Function)return new WebAssembly.Function((e=>{M(!e.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled");for(var t={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},n={parameters:[],results:"v"==e[0]?[]:[t[e[0]]]},r=1;r{P.delete(ez(e)),eq(e,null),eW.push(e)},t.setValue=function(e,t,n="i8"){switch(n.endsWith("*")&&(n="*"),n){case"i1":case"i8":s[e>>>0]=t;break;case"i16":u[e>>>1>>>0]=t;break;case"i32":c[e>>>2>>>0]=t;break;case"i64":J("to do setValue(i64) use WASM_BIGINT");case"float":m[e>>>2>>>0]=t;break;case"double":p[e>>>3>>>0]=t;break;case"*":f[e>>>2>>>0]=t;break;default:J(`invalid type for setValue: ${n}`)}},t.getValue=function(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return s[e>>>0];case"i16":return u[e>>>1>>>0];case"i32":return c[e>>>2>>>0];case"i64":J("to do getValue(i64) use WASM_BIGINT");case"float":return m[e>>>2>>>0];case"double":return p[e>>>3>>>0];case"*":return f[e>>>2>>>0];default:J(`invalid type for getValue: ${t}`)}},t.UTF8ToString=eg,t.stringToUTF8=ej,t.UTF16ToString=(e,t)=>{M(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var n=e,r=n>>1,i=r+t/2;!(r>=i)&&d[r>>>0];)++r;if((n=r<<1)-e>32&&eU)return eU.decode(l.subarray(e>>>0,n>>>0));for(var o="",a=0;!(a>=t/2);++a){var s=u[e+2*a>>>1>>>0];if(0==s)break;o+=String.fromCharCode(s)}return o},t.stringToUTF16=(e,t,n)=>{if(M(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),M("number"==typeof n,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),n??(n=0x7fffffff),n<2)return 0;for(var r=t,i=(n-=2)<2*e.length?n/2:e.length,o=0;o>>1>>>0]=a,t+=2}return u[t>>>1>>>0]=0,t-r},["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertU32PairToI53","getTempRet0","setTempRet0","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","readEmAsmArgs","jstoi_q","listenOnce","autoResumeAudioContext","dynCallLegacy","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","checkWasiClock","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","safeSetTimeout","setImmediateWrapped","safeRequestAnimationFrame","clearImmediateWrapped","polyfillSetImmediate","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","ExceptionInfo","findMatchingCatch","Browser_asyncPrepareDataCounter","arraySum","addDays","getSocketFromFD","getSocketAddress","FS_unlink","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace"].forEach(function(e){eo(e,()=>{var t=`\\`${e}\\` 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=e;n.startsWith("_")||(n="$"+e),t+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\'${n}\')`,ei(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),em(t)}),es(e)}),["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","out","err","callMain","abort","wasmMemory","writeStackCookie","checkStackCookie","convertI32PairToI53Checked","stackSave","stackRestore","stackAlloc","ptrToString","zeroMemory","exitJS","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","jstoi_s","getExecutableName","keepRuntimeAlive","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","freeTableIndexes","functionsInTableMap","getEmptyTableSlot","updateTableMap","getFunctionAddress","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","stringToUTF8Array","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","stringToUTF8OnStack","writeArrayToMemory","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","doReadv","doWritev","initRandomFill","randomFill","promiseMap","uncaughtExceptionCount","exceptionLast","exceptionCaught","Browser","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","ydayFromDate","SYSCALLS","preloadPlugins","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_createPath","FS_createDevice","FS_readFile","FS","FS_createDataFile","FS_createLazyFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack","print","printErr"].forEach(es),W=function e(){D||e5(),D||(W=e)},t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();for(let e of(e5(),Object.keys(t)))e in t||Object.defineProperty(t,e,{configurable:!0,get(){J(`Access to module property (\'${e}\') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return y}}},function(){if(r)throw r[0];try{return t&&(n=(0,t[E(t)[0]])(t=0)),n}catch(e){throw r=[e],e}}),G={Unknown:"Unknown",InvalidArg:"InvalidArg",DocNotOpen:"DocNotOpen",DocOpenFailed:"DocOpenFailed",DocPasswordRequired:"DocPasswordRequired",DocPasswordIncorrect:"DocPasswordIncorrect",GrantPassphraseRequired:"GrantPassphraseRequired",Aborted:"Aborted",Network:"Network",Unauthenticated:"Unauthenticated",Forbidden:"Forbidden",NotFound:"NotFound",WireFormat:"WireFormat",RuntimeUnavailable:"RuntimeUnavailable",LayerVersionConflict:"LayerVersionConflict",NotImplemented:"NotImplemented",MalformedPdf:"MalformedPdf",SigningPending:"SigningPending",SigningExpired:"SigningExpired",SigningVersionMismatch:"SigningVersionMismatch",SignatureRefused:"SignatureRefused",ProtectedDocument:"ProtectedDocument",PayloadTooLarge:"PayloadTooLarge",ObjectNumberUnavailable:"ObjectNumberUnavailable",LayerFull:"LayerFull",ChangeConflict:"ChangeConflict",UndoUnavailable:"UndoUnavailable",IdempotencyKeyReused:"IdempotencyKeyReused",LayerDeleted:"LayerDeleted",VisitorIdentityRequired:"VisitorIdentityRequired",Conflict:"Conflict",EngineBusy:"EngineBusy",EngineRestarting:"EngineRestarting",DocumentQuarantined:"DocumentQuarantined",ThumbnailNotReady:"ThumbnailNotReady",TooManyRequests:"TooManyRequests",GrantExpired:"GrantExpired",OriginRequired:"OriginRequired",OriginNotAllowed:"OriginNotAllowed",FeatureNotEnabled:"FeatureNotEnabled",FeatureStopped:"FeatureStopped",LicenseInvalid:"LicenseInvalid",LicenseUsageLimit:"LicenseUsageLimit",UpstreamError:"UpstreamError"};function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(e,t,n){var r;return(r=function(e,t){if("object"!=O(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=O(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==O(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.values(G);var N=class e extends Error{constructor(e,t,n={}){super(t??e,void 0===n.cause?void 0:{cause:n.cause}),I(this,"name","EngineError"),I(this,"code",void 0),I(this,"details",void 0),this.code=e,this.details=n.details}static is(t,n){return(t instanceof e||t?.name==="EngineError")&&(void 0===n||t.code===n)}toJSON(){return{code:this.code,message:this.message,details:this.details}}};function C(e){return N.is(e)?e.toJSON():e instanceof Error?{code:"AbortError"===e.name?G.Aborted:G.Unknown,message:e.message}:{code:G.Unknown,message:String(e??"unknown error")}}var j=e=>{let t=t=>(e&1<[[1,e.exclude],[2,e.includeNoValueFields],[3,"html"===e.format],[4,"get"===e.method],[5,e.submitCoordinates],[6,"xfdf"===e.format],[7,e.includeAppendSaves],[8,e.includeAnnotations],[9,"pdf"===e.format],[10,e.canonicalFormat],[11,e.exclNonUserAnnots],[12,e.exclFKey],[14,e.embedForm]].reduce((e,[t,n])=>n?e|1<null!=e&&!("root"in e)&&R(e))}function B(e){return e.incomplete||!e.root?null:function e(t){let n=[];for(let r of t.next){let t=e(r);if(!t)return null;n.push(t)}let r=n.length>0?{next:n}:{};switch(t.type){case"javascript":return{type:"javascript",script:t.script,...r};case"goto":return{type:"goto",destination:t.destination,...r};case"uri":return{type:"uri",uri:t.uri,...r};case"named":return{type:"named",name:t.name,...r};case"hide":return{type:"hide",targets:t.targets,hide:t.hide,...r};case"reset-form":return{type:"reset-form",fields:t.fields,exclude:t.exclude,...r};case"submit-form":return t.payload?{...function(e){let{url:t,fields:n,charSet:r,...i}=e;return i}(t.payload),type:"submit-form",url:t.payload.url,fields:t.payload.fields,...r}:null;default:return null}}(e.root)}var L={javascript:"JavaScript",goto:"GoTo",uri:"URI",named:"Named",hide:"Hide","reset-form":"ResetForm","submit-form":"SubmitForm"};function $(e){return{root:function e(t){let n={subtype:L[t.type],next:(t.next??[]).map(e)};switch(t.type){case"javascript":return{type:"javascript",script:t.script,...n};case"goto":return{type:"goto",destination:t.destination,...n};case"uri":return{type:"uri",uri:t.uri,isMap:!1,...n};case"named":return{type:"named",name:t.name,...n};case"hide":return{type:"hide",targets:t.targets,hide:t.hide,...n};case"reset-form":return{type:"reset-form",fields:t.fields,exclude:t.exclude,...n};case"submit-form":return{type:"submit-form",payload:{url:t.url,fields:t.fields,...j(M(t))},...n}}}(e),incomplete:!1,warnings:[]}}var z=["activate","cursorEnter","cursorExit","mouseDown","mouseUp","focus","blur","pageOpen","pageClose","pageVisible","pageInvisible"];function U(e){let t=B(e);return t&&V(t)?t:null}function V(e){return"javascript"===e.type&&(e.next??[]).every(V)}function W(e){return"number"==typeof e&&Number.isInteger(e)&&e>0}function q(e){return{kind:"objectNumber",objectNumber:e}}function H(e){if(!W(e.objectNumber))throw RangeError(`encodePageKey: objectNumber must be a positive integer, got ${e.objectNumber}`);return`obj:${e.objectNumber}`}function K(e){switch(e.kind){case"objectNumber":return`obj:${e.objectNumber}`;case"baseIndex":return`base:${e.page.objectNumber}:${e.baseIndex}`}}var Z=["courier","courier-bold","courier-bold-oblique","courier-oblique","helvetica","helvetica-bold","helvetica-bold-oblique","helvetica-oblique","times-roman","times-bold","times-bold-italic","times-italic","symbol","zapf-dingbats"],J={invisible:!1,hidden:!1,print:!1,noZoom:!1,noRotate:!1,noView:!1,readOnly:!1,locked:!1,toggleNoView:!1,lockedContents:!1};function Q(e){return void 0!==e.layout?e:{...e,layout:"pushbutton"===e.fieldKind?"caption":null}}function X(e){return null===e?{kind:"unassigned"}:{kind:"group",groupId:e}}function Y(e){return"group"===e.kind?e.groupId:null}function ee(e){return eo(er(e)??{kind:"unassigned"},e.kind)}function et(e,t){let n=er(e);return void 0===n?t.assignment:eo(n,t.kind)}function en(e){if(void 0!==e.assignment)return e;let t="string"==typeof e.groupId?e.groupId:null;return{...e,assignment:X(t)}}function er(e){if(void 0!==e.assignment&&void 0!==e.groupId)throw ea("assignment",\'name a field\\\'s assignment or its groupId, not both: { kind: "group", groupId } says both\');return void 0!==e.assignment?function(e){let t=null!==e&&"object"==typeof e?e.kind:void 0;if("anyone"===t||"unassigned"===t)return{kind:t};if("group"===t){let n=e.groupId;return ei(n,"assignment"),{kind:t,groupId:n}}throw ea("assignment","a field\'s assignment is { kind: \'group\', groupId }, { kind: \'anyone\' } or { kind: \'unassigned\' }")}(e.assignment):void 0!==e.groupId?(null!==e.groupId&&ei(e.groupId,"groupId"),X(e.groupId)):void 0}function ei(e,t){if("string"!=typeof e||e.length<1||e.length>256)throw ea(t,`a field\'s groupId is 1 to 256 characters${"groupId"===t?", or null for no group":""}`)}function eo(e,t){if("anyone"===e.kind&&"signature"===t)throw ea("assignment","a signature field is signed by one signer, so it is never for anyone");return e}function ea(e,t){return new N(G.InvalidArg,t,{details:{field:e}})}function es(e){return void 0===e.lockedBy?{...e,lockedBy:null}:e}function el(e){if("pushbutton"!==e.kind)return e;let t=void 0===e.hasImage,n=void 0===e.takesImage;return t||n?{...e,...t?{hasImage:!1}:{},...n?{takesImage:!1}:{}}:e}var eu=Object.freeze(["m/d","m/d/yy","mm/dd/yy","mm/yy","d-mmm","d-mmm-yy","dd-mmm-yy","yy-mm-dd","mmm-yy","mmmm-yy","mmm d, yyyy","mmmm d, yyyy","m/d/yy h:MM tt","m/d/yy HH:MM"]),ed=Object.freeze(["HH:MM","h:MM tt","HH:MM:ss","h:MM:ss tt"]),ec=new Map([["yyyy",{part:"year",written:"digits"}],["yy",{part:"year",written:"digits"}],["mmmm",{part:"month",written:"letters"}],["mmm",{part:"month",written:"letters"}],["mm",{part:"month",written:"digits"}],["m",{part:"month",written:"digits"}],["dd",{part:"day",written:"digits"}],["d",{part:"day",written:"digits"}]]),ef=/(?:HH|H|hh|h):MM(?::ss)?(?: *tt)?/;function em(e){let t={written:[],groups:[]};for(let n of e.match(/([A-Za-z])\\1*|[^A-Za-z]/g)??[]){let e=ec.get(n);if(e)t.written.push(e.written),t.groups.push(e.part);else{if(!" /-.,".includes(n))return null;t.written.push("separator")}}return t}function ep(e){if("string"!=typeof e||e.length<1||e.length>64)return!1;let t=ef.exec(e),n=em(t?e.slice(0,t.index):e),r=em(t?e.slice(t.index+t[0].length):"");if(!n||!r)return!1;let i=[...n.groups,...r.groups];if(0===i.length||new Set(i).size!==i.length)return!1;let o=t?["digits",t[0].endsWith("tt")?"letters":"digits"]:[],a=[...n.written,...o,...r.written];return!a.some((e,t)=>"digits"===e&&"digits"===a[t+1]&&t!==n.written.length)}var eh=RegExp(`^${ef.source}$`);function eF(e){return"string"==typeof e&&e.length<=64&&eh.test(e)}function eg(e){return"text"===e||"combobox"===e}var e_={date:{format:"AFDate_FormatEx",numberedFormat:"AFDate_Format",keystroke:"AFDate_KeystrokeEx",numberedKeystroke:"AFDate_Keystroke",standard:eu,isPattern:ep},time:{format:"AFTime_FormatEx",numberedFormat:"AFTime_Format",keystroke:"AFTime_KeystrokeEx",numberedKeystroke:"AFTime_Keystroke",standard:ed,isPattern:eF}},eP=["date","time"];function eD(e,t,n,r){let i=e.trim();i.endsWith(";")&&(i=i.slice(0,-1).trimEnd());let o=/^([A-Za-z_]+)\\(\\s*(?:(["\'])([^"\'\\\\]*)\\2|(\\d{1,2}))\\s*\\)$/.exec(i);if(!o)return null;let[,a,,s,l]=o,{isPattern:u,standard:d}=e_[t];return a===n&&void 0!==s?u(s)?s:null:a===r&&void 0!==l?d[Number(l)]??null:null}function eb(e){let t=e?.format;if(null==t)return null;if("object"!=typeof t)return{kind:"other"};let n=ew(t);return null===n?{kind:"other"}:function(e){for(let t of eP){let n=e_[t],r=eD(e,t,n.format,n.numberedFormat);if(null!==r)return{kind:t,pattern:r}}return{kind:"other"}}(n)}function ey(e){let t=void 0===e.purpose,n=void 0===e.format&&"string"==typeof e.kind&&eg(e.kind);return t||n?{...e,...t?{purpose:null}:{},...n?{format:eb(e.actions)}:{}}:e}function ew(e){let t=e.root;return!1===e.incomplete&&t&&"javascript"===t.type&&Array.isArray(t.next)&&!(t.next.length>0)&&"string"==typeof t.script?t.script:null}function eE(e){var t;let n=e_[e.kind];return{format:`${n.format}("${e.pattern}");`,keystroke:"date"===e.kind?`${n.keystroke}("${e.pattern}");`:`${n.numberedKeystroke}(${2*!!(t=e.pattern).includes("ss")+ +!!t.includes("tt")});`}}function eA(e){if(null===e)return{keystroke:null,format:null};let t=eE(e),n=e=>({type:"javascript",script:e});return{keystroke:n(t.keystroke),format:n(t.format)}}function ev(e){return null!==e&&"other"!==e.kind}function eS(e,t){return null===e||null===t?e===t:e.kind===t.kind&&("other"===e.kind||e.pattern===t.pattern)}var ek={date:"a date format\'s pattern is 1 to 64 characters: the groups yyyy yy mmmm mmm mm m dd d, at least one of them and the year, the month and the day each once at most, with spaces and / - . , between them, and at most one time (HH, H, hh or h, then :MM, then :ss and tt when it has them); two groups written in digits never touch",time:"a time format\'s pattern is a time and nothing else, at most 64 characters: HH, H, hh or h, then :MM, then :ss when it has seconds, then tt when it has one"};function ex(e,t){if(void 0===e.format)return;if(!eg(t))throw new N(G.InvalidArg,`\'format\' does not apply to a ${t} field`,{details:{field:"format"}});let n=function(e){if(null===e)return null;let t="object"==typeof e?e:{};if("other"===t.kind)throw new N(G.InvalidArg,"a format of kind \'other\' is read, never written: write its scripts in actions",{details:{field:"format"}});if("date"!==t.kind&&"time"!==t.kind)throw new N(G.InvalidArg,"a field\'s format is a date or a time with a pattern, or null for none",{details:{field:"format"}});let{pattern:n}=t;if(!e_[t.kind].isPattern(n))throw new N(G.InvalidArg,ek[t.kind],{details:{field:"format.pattern"}});return{kind:t.kind,pattern:n}}(e.format);for(let t of["format","keystroke"])if(e.actions?.[t]!==void 0)throw new N(G.InvalidArg,`\'format\' writes the field\'s ${t} script: name it or actions.${t}, not both`,{details:{field:`actions.${t}`}});return n}function eG(e){return $({type:"javascript",script:e})}function eO(e){return"string"==typeof e&&e.length>=1&&e.length<=256&&e.trim()===e&&!e.includes("\\0")}function eI(e,t){if(null==e)return null;if(!eO(e))throw new N(G.InvalidArg,`a field\'s ${t} is 1 to 256 characters with no space at its start or end and no NUL character, or null for none`,{details:{field:t}});return e}function eN(e){return eO(e)}function eC(e){return eI(e,"placeholder")}function ej(e){return void 0!==e.placeholder?e:{...e,placeholder:null}}function eM(e){if("objectNumber"===e.kind){if(!Number.isInteger(e.objectNumber)||e.objectNumber<=0)throw RangeError(`encodeFieldRefKey: objectNumber must be a positive integer, got ${e.objectNumber}`);return`obj:${e.objectNumber}`}return`fqn:${e.name}`}function eR(e,t){return{ref:e>0&&t?{kind:"objectNumber",page:t,objectNumber:e}:null,objectNumber:e,page:t}}var eT=(e,t)=>e.replace(/\\B(?=(\\d{3})+(?!\\d))/g,()=>t),eB=(e,t)=>t?eB(t,e%t):e;function eL(e){let t=Math.fround(e.conversion??0/0);if(!Number.isFinite(t)||t<=0)return!1;let n=e.precision??("fraction"===e.fraction?16:100);return!!Number.isInteger(n)&&!(n<1)&&!(n>0x7fffffff)&&((e.fraction??"decimal")!=="decimal"||!!Number.isInteger(Math.log10(n)))}function e$(e,t){if(!Number.isFinite(e)||!t.length||!t.every(eL))throw new N(G.InvalidArg,"Measurement requires a finite value and valid number formats");let n=Math.abs(e),r=[];for(let[e,i]of t.entries()){if(!Number.isFinite(n*=Math.fround(i.conversion)))throw new N(G.InvalidArg,"Measurement overflow");let o=Math.floor(n),a=n-o,s=e===t.length-1,l=s||0===a,u=s?function(e,t){let n=t.fraction??"decimal",r=t.thousands??",";if("round"===n)return eT(String(Math.round(e)),r);if("truncate"===n)return eT(String(Math.trunc(e)),r);if("fraction"===n){let n=t.precision??16,i=Math.floor(e),o=Math.round((e-i)*n);if(o===n&&(i++,o=0),!o)return eT(String(i),r);let a=t.fixed?1:eB(o,n);return`${i?`${eT(String(i),r)} `:""}${o/a}/${n/a}`}let i=Math.log10(t.precision??100),[o,a=""]=e.toFixed(i).split(".");return eT(o,r)+(a?(t.decimal||".")+a:"")}(n,i):eT(String(o),i.thousands??","),d="prefix"===i.labelPosition,c=i.prefixSpacing??(d&&0===e?"":" "),f=i.suffixSpacing??(!d&&l?"":" "),m=c+i.unit+f;if(r.push(d?m+u:u+m),l)break;n=a}return(e<0?"-":"")+r.join("")}var ez={courier:{family:"Courier",weight:400,italic:!1},"courier-bold":{family:"Courier",weight:700,italic:!1},"courier-bold-oblique":{family:"Courier",weight:700,italic:!0},"courier-oblique":{family:"Courier",weight:400,italic:!0},helvetica:{family:"Helvetica",weight:400,italic:!1},"helvetica-bold":{family:"Helvetica",weight:700,italic:!1},"helvetica-bold-oblique":{family:"Helvetica",weight:700,italic:!0},"helvetica-oblique":{family:"Helvetica",weight:400,italic:!0},"times-roman":{family:"Times",weight:400,italic:!1},"times-bold":{family:"Times",weight:700,italic:!1},"times-bold-italic":{family:"Times",weight:700,italic:!0},"times-italic":{family:"Times",weight:400,italic:!0},symbol:{family:"Symbol",weight:400,italic:!1},"zapf-dingbats":{family:"ZapfDingbats",weight:400,italic:!1}};function eU(e,t){if(Z.includes(e)){let t=ez[e];return{family:t.family,weight:t.weight,italic:t.italic}}let n=t?.(e);return n?{family:n.familyName,weight:n.weight,italic:n.italic}:{family:e}}function eV(e){return e.toLowerCase().replace(/[\\s\\-_\'"]/g,"")}var eW={helvetica:"Helvetica",arial:"Helvetica",arialmt:"Helvetica",sansserif:"Helvetica",times:"Times",timesroman:"Times",timesnewroman:"Times",timesnewromanpsmt:"Times",serif:"Times",courier:"Courier",couriernew:"Courier",couriernewpsmt:"Courier",monospace:"Courier",symbol:"Symbol",zapfdingbats:"ZapfDingbats",dingbats:"ZapfDingbats"};function eq(e){if("object"!=typeof e||null===e)return!1;let{left:t,bottom:n,right:r,top:i}=e;return[t,n,r,i].every(e=>"number"==typeof e&&Number.isFinite(e))}function eH(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),bottom:Math.min(e.top,e.bottom),top:Math.max(e.top,e.bottom)}}var eK=e=>Number.isFinite(e.x)&&Number.isFinite(e.y);function eZ([e,t,n,r]){if(![e,t,n,r].every(eK))return!1;let i={x:t.x-e.x,y:t.y-e.y},o={x:r.x-n.x,y:r.y-n.y},a={x:n.x-e.x,y:n.y-e.y},s={x:r.x-t.x,y:r.y-t.y},l=[i,o,a,s].map(e=>Math.hypot(e.x,e.y));if(l.some(e=>e<=1e-6)||i.x*o.x+i.y*o.y<=0||a.x*s.x+a.y*s.y<=0)return!1;let u=i.x*a.y-i.y*a.x,d=o.x*s.y-o.y*s.x;return!(Math.abs(u)<=1e-6*l[0]*l[2]||Math.abs(d)<=1e-6*l[1]*l[3])&&Math.sign(u)===Math.sign(d)}function eJ(e,t){let n=eQ(t);if(null!==n)return eX(e,n);let r=t*Math.PI/180,i=Math.abs(Math.cos(r)),o=Math.abs(Math.sin(r)),a=e.right-e.left,s=e.top-e.bottom,l=(a*i+s*o)/2,u=(a*o+s*i)/2,d=(e.left+e.right)/2,c=(e.bottom+e.top)/2;return{left:d-l,bottom:c-u,right:d+l,top:c+u}}function eQ(e){let t=(e%360+360)%360;return t%90==0?t:null}function eX(e,t){if(0===t||180===t)return e;let n=(e.left+e.right)/2,r=(e.bottom+e.top)/2,i=(e.top-e.bottom)/2,o=(e.right-e.left)/2;return{left:n-i,bottom:r-o,right:n+i,top:r+o}}function eY(e,t){let n=.01+1e-4*Math.max(e.right-e.left,e.top-e.bottom,t.right-t.left,t.top-t.bottom);return Math.abs(e.left-t.left)<=n&&Math.abs(e.bottom-t.bottom)<=n&&Math.abs(e.right-t.right)<=n&&Math.abs(e.top-t.top)<=n}function e0(e){if(0===e.length)return{left:0,bottom:0,right:0,top:0};let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let{x:o,y:a}of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),i=Math.max(i,a);return{left:t,bottom:n,right:r,top:i}}function e1(e,t){let n=t.degrees*Math.PI/180,r=Math.cos(n),i=Math.sin(n),o=e.x-t.center.x,a=e.y-t.center.y;return{x:t.center.x+o*r+a*i,y:t.center.y-o*i+a*r}}function e3(e,t){return e1(e,{degrees:-t.degrees,center:t.center})}function e2(e,t){return e.replace(/\\r\\n|\\r|\\n/g,t)}var e6={family:"Helvetica",weight:400,italic:!1,size:12,color:"#000000",decoration:[],script:"normal",letterSpacing:0,horizontalScale:1,align:"left",dir:"ltr"};function e5(e){return e2(e.paragraphs.map(e=>e.runs.map(e=>e.text).join("")).join(`\n`),`\n`)}function e4(e){return e.split(/\\r\\n|\\r|\\n/).map(e=>({runs:[{text:e}]}))}var e8=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");function e7(e,t,n){return`#${e8(e)}${e8(t)}${e8(n)}`}function e9(e){let t=Number.parseInt(e.slice(1),16);return{r:t>>16&255,g:t>>8&255,b:255&t}}var te={highlight:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},underline:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},squiggly:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},strikeout:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data",intent:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},circle:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",box:"data",rotation:"data",cloudyIntensity:"data"},readBack:["rect","borderStyle"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{}},square:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",box:"data",rotation:"data",cloudyIntensity:"data"},readBack:["rect","borderStyle"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{}},polygon:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",vertices:"data",rotation:"data",captionEnabled:"data",captionCenter:"data",intent:"data",measure:"data",cloudyIntensity:"data"},readBack:["rect","borderStyle","vertices"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",vertices:"points",captionCenter:"point",measure:"measure"},resources:{}},polyline:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",vertices:"data",rotation:"data",captionEnabled:"data",captionCenter:"data",intent:"data",measure:"data",lineEndings:"data"},readBack:["rect","borderStyle","vertices"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",vertices:"points",captionCenter:"point",measure:"measure"},resources:{}},line:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",linePoints:"data",lineEndings:"data",rotation:"data",intent:"data",measure:"data",captionEnabled:"data",captionPosition:"data",captionOffset:"data",leader:"data"},readBack:["rect","borderStyle"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",linePoints:"linePoints",measure:"measure"},resources:{}},link:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",target:"data"},readBack:["target"],colors:[],spaces:{rect:"box",actions:"actions",target:"linkTarget"},resources:{}},ink:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",inkList:"data",intent:"data",rotation:"data"},readBack:["rect","strokeWidth","borderStyle","inkList"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",inkList:"strokes"},resources:{}},"free-text":{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",box:"data",rotation:"data",intent:"data",fontFamily:"data",fontSize:"data",textAlign:"data",verticalAlign:"data",color:"data",fontColor:"data",interiorColor:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",cloudyIntensity:"data",calloutLine:"data",lineEnding:"data"},readBack:["rect","intent","borderStyle"],colors:["color","fontColor","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box",calloutLine:"calloutLine"},resources:{}},caret:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",box:"data",rotation:"data",intent:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{}},text:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",icon:"data",open:"data",state:"data",stateModel:"data"},readBack:[],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length"},resources:{}},stamp:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",box:"data",rotation:"data",name:"data",fit:"data",opacity:"data"},readBack:["rect"],colors:[],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{appearance:"required"}},"file-attachment":{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",icon:"data",file:"data"},readBack:[],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length"},resources:{file:"required"}},widget:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"data",box:"data",rotation:"data",color:"data",interiorColor:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",fontFamily:"data",fontSize:"data",fontColor:"data",textAlign:"data",caption:"data",checkStyle:"data",layout:"data",field:"engine",fieldKind:"engine",hasMark:"engine"},readBack:["rect","actions"],colors:["color","interiorColor","fontColor"],spaces:{rect:"box",actions:"actions",box:"box"},resources:{}},redact:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data",interiorColor:"data",overlayText:"data",repeat:"data",fontFamily:"data",fontSize:"data",fontColor:"data",textAlign:"data"},readBack:[],colors:["color","interiorColor","fontColor"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},popup:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",parent:"data",open:"data"},readBack:["parent"],colors:[],spaces:{rect:"box",actions:"actions"},resources:{}},unsupported:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",rawSubtypeCode:"engine",rawSubtypeName:"engine"},readBack:[],colors:[],spaces:{rect:"box",actions:"actions"},resources:{}}};function tt(e){let t={};for(let n of Object.keys(te))t[n]=e(te[n]);return t}function tn(e){return Object.prototype.hasOwnProperty.call(te,e)?te[e]:null}var tr=tt(e=>Object.keys(e.owners)),ti=tt(e=>e.resources),to=tt(e=>e.spaces),ta=Object.assign({},...Object.values(to)),ts=[["highlight","underline","squiggly","strikeout"],["square","circle"]],tl=/^sha256-[0-9a-f]{64}$/,tu=["page","position","size"];async function td(e){let t=new Uint8Array(await crypto.subtle.digest("SHA-256",e)),n="";for(let e of t)n+=e.toString(16).padStart(2,"0");return`sha256-${n}`}async function tc(e,t){for(let[n,r]of Object.entries(t))await td(r)!==n&&tF(e,`resource ${n} doesn\'t match its id`)}function tf(e,t){let n=new Set,r=new Set;for(let o of t){var i;tg(o)&&t_(o.page)&&tg(i=o.size)&&[i.width,i.height].every(e=>"number"==typeof e&&Number.isFinite(e)&&e>=0)||tF(e,"a page needs a page ref, a position and a size"),th(e,"a page",o,tu);let{position:t}=o;(!Number.isInteger(t)||t<0)&&tF(e,`page position ${JSON.stringify(t)} is not a position`);let a=H(o.page);n.has(a)&&tF(e,`page ${a} is listed twice`),r.has(t)&&tF(e,`position ${t} is listed twice`),n.add(a),r.add(t)}return n}function tm(e,t,n,r,i,o){for(let[a,s]of(tg(n)||tF(e,`${t} has no resources`),Object.entries(n)))r.includes(a)||tF(e,`${t} names an unknown resource role \'${a}\'`),"string"==typeof s&&tl.test(s)||tF(e,`${t} names ${JSON.stringify(s)}, which is not a resource id`),i.has(s)||tF(e,`${t} names ${s}, which the bundle doesn\'t hold`),o.add(s)}function tp(e,t,n,r){for(let i of n.keys())tl.test(i)||tF(e,`${JSON.stringify(i)} is not a resource id`),r.has(i)||tF(e,`resource ${i} is named by no ${t}`)}function th(e,t,n,r){for(let i of Object.keys(n))r.includes(i)||tF(e,`${t} has an unknown field \'${i}\'`)}function tF(e,t){throw new N(G.InvalidArg,`${e} bundle: ${t}`)}function tg(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function t_(e){return tg(e)&&"objectNumber"===e.kind&&Number.isInteger(e.objectNumber)&&e.objectNumber>0}function tP(e){let t=function(e,t,n){let r=new Map(n.map(e=>[H(e.page),e.page])),i=new Map;if("same"===t)for(let t of e){let e=r.get(H(t.page));e&&i.set(H(t.page),e)}else if("by-position"===t){let t=new Map(n.map(e=>[e.position,e.page]));for(let n of e){let e=t.get(n.position);e&&i.set(H(n.page),e)}}else for(let{from:e,to:n}of t){let t=H(e);if(i.has(t))throw new N(G.InvalidArg,`import: page ${t} is mapped twice`);let o=r.get(H(n));if(!o)throw new N(G.NotFound,`import: the document has no page ${H(n)}`);i.set(t,o)}return i}(e.bundlePages,e.pages,e.target),n=new Set;for(let r of e.named)t.has(H(r))||n.add(H(r));if(n.size>0){let e=[...n];throw new N(G.InvalidArg,`import: ${1===e.length?"page":"pages"} ${e.join(", ")} map to no page of this document`,{details:{pages:e}})}return e=>t.get(H(e))}var tD=new Set(["subtype","invisible","hidden","print","noZoom","noRotate","noView","readOnly","locked","toggleNoView","lockedContents","nm","reply","popup","parent","open","groupId","subject","state","stateModel","ref","page","hasAppearance","appearanceState","author","createdAt","modifiedAt","userId","createdBy","modifiedBy","importedBy","actions","file","field","fieldKind"]),tb=new Set(["free-text","redact"]),ty=new Set(["square","circle","free-text","stamp","caret","widget","line","polyline","polygon","ink"]),tw={square:["box"],circle:["box"],"free-text":["box","calloutLine"],line:["linePoints"],polygon:["vertices"],polyline:["vertices"],ink:["inkList"],highlight:["quadPoints"],underline:["quadPoints"],squiggly:["quadPoints"],strikeout:["quadPoints"],redact:["rect","quadPoints"],caret:["box"],text:["rect"],stamp:["box"],"file-attachment":["rect"],link:["rect"],widget:["box"]},tE=(e,t)=>.001>=Math.abs(e-t),tA=e=>"number"==typeof e?(e%360+360)%360:0;function tv(e,t){if(null==e||null==t)return null==e&&null==t;if("number"==typeof e&&"number"==typeof t)return tE(e,t);if(Array.isArray(e)||Array.isArray(t))return!!Array.isArray(e)&&!!Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>tv(e,t[n]));if("object"==typeof e&&"object"==typeof t){for(let n of new Set([...Object.keys(e),...Object.keys(t)]))if(!tv(e[n],t[n]))return!1;return!0}return e===t}function tS(e){return null==e||"object"!=typeof e?void 0:Array.isArray(e)?e.length>0?tS(e[0]):void 0:"number"==typeof e.x&&"number"==typeof e.y?{x:e.x,y:e.y}:"number"==typeof e.left&&"number"==typeof e.bottom?{x:e.left,y:e.bottom}:tS(e.start??e.upperLeft)}var tk={impact:"inert"},tx={impact:"regenerate"};function tG(e,t){let n=new Map(e.map(e=>[K(e.ref),e])),r=n.get(K(t));if(!r)return[];let i=new Map,o=new Map,a=(e,t,n)=>e.set(t,[...e.get(t)??[],n]);for(let t of e){let e=t.reply?n.get(K(t.reply.to)):void 0;e&&e!==t&&a(i,e,t);let r="popup"===t.subtype&&t.parent?n.get(K(t.parent)):void 0;r&&r!==t&&a(o,r,t);let s=t.popup?n.get(K(t.popup)):void 0;s&&s!==t&&"popup"===s.subtype&&a(o,t,s)}let s=[],l=new Set,u=e=>{if(!l.has(e)){for(let t of(l.add(e),i.get(e)??[]))u(t);for(let t of o.get(e)??[])l.has(t)||(l.add(t),s.push(t));s.push(e)}};return u(r),s}var tO=new Set(["accepted","rejected","cancelled","completed","none"]),tI=new Set(["marked","unmarked"]);function tN(e){return tO.has(e)?"review":tI.has(e)?"marked":null}var tC=new Set(["highlight","underline","squiggly","strikeout","square","circle","free-text","stamp","caret","widget","line","polyline","polygon","ink"]),tj=new Set(["box","point","points","strokes","quads","linePoints","calloutLine"]);function tM(e){return[...Object.entries(to[e]).filter(([e,t])=>"rect"!==e&&tj.has(t)).map(([e])=>e),"rotation"]}function tR(e,t){return new N(G.InvalidArg,`${e} field \'rect\': ${t}`,{details:{field:"rect"}})}var tT=e=>Number.isFinite(e)&&e>0,tB=e=>({x:Math.fround(e.x),y:Math.fround(e.y)});function tL(e,t,n){let r=0,i=e.map(tB);for(let e=0;e<(t?i.length:i.length-1);e++){let t=i[e],o=i[(e+1)%i.length];r+=Math.hypot((o.x-t.x)*n.sx,(o.y-t.y)*n.sy)}return r}function t$(e,t){if(e.length<3)return 0;let n=e.map(tB),r=n[0],i=0;for(let e=1;e!Number.isFinite(Math.fround(e.x))||!Number.isFinite(Math.fround(e.y))))return{unavailable:"invalid-geometry"};let i="polygon"===e.subtype;if(i&&!function(e){let t=e.map(tB),n=(e,t)=>e.x===t.x&&e.y===t.y;if(t.length>1&&n(t[0],t[t.length-1])&&t.pop(),t.length<3||0===t$(t,{sx:1,sy:1}))return!1;let r=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),i=(e,t,n)=>0===r(e,t,n)&&n.x>=Math.min(e.x,t.x)&&n.x<=Math.max(e.x,t.x)&&n.y>=Math.min(e.y,t.y)&&n.y<=Math.max(e.y,t.y);for(let e=0;e=Math.fround(e.cyx)))throw new N(G.InvalidArg,"Invalid CYX")}function tW(e){if("number"!=typeof e||!Number.isFinite(Math.fround(e)))throw new N(G.InvalidArg,"Value is outside PDF float range")}var tq=["linePoints","vertices","measure","intent","contents"],tH=["captionEnabled","captionPosition","captionOffset","captionCenter"],tK=e=>tH.some(t=>void 0!==e[t]);function tZ(e,t){try{if(null!=t.measure&&"rectilinear"===t.measure.subtype&&tV(t.measure),"line"===e&&"leader"in t&&null!=t.leader&&("object"!=typeof t.leader||Array.isArray(t.leader)))throw new N(G.InvalidArg,"Invalid line leader");if(null!=t.intent&&!("line"===e?["line-dimension","line-arrow"]:"polygon"===e?["polygon-dimension","polygon-cloud"]:["polyline-dimension"]).includes(t.intent))throw new N(G.InvalidArg,"Invalid measurement intent");if(null!=t.captionEnabled&&"boolean"!=typeof t.captionEnabled)throw new N(G.InvalidArg,"Invalid caption visibility");if("captionPosition"in t&&null!=t.captionPosition&&!["inline","top"].includes(t.captionPosition))throw new N(G.InvalidArg,"Invalid caption position");if("captionOffset"in t&&t.captionOffset&&(tW(t.captionOffset.along),tW(t.captionOffset.perpendicular)),"captionCenter"in t&&t.captionCenter&&(tW(t.captionCenter.x),tW(t.captionCenter.y)),"leader"in t&&t.leader){for(let e of[t.leader.length,t.leader.extension??0,t.leader.offset??0])tW(e);if((t.leader.extension??0)<0||(t.leader.offset??0)<0)throw new N(G.InvalidArg,"Leader extension and offset must be nonnegative")}for(let e of"linePoints"in t?t.linePoints?[t.linePoints.start,t.linePoints.end]:[]:"vertices"in t?t.vertices??[]:[])tW(e.x),tW(e.y)}catch(e){throw new N(G.InvalidArg,e.message)}}function tJ(e){if(void 0!==e.richText&&null!==e.richText&&void 0!==e.contents&&null!==e.contents&&e2(e.contents,`\n`)!==e5(e.richText))throw new N(G.InvalidArg,`${e.subtype??"annotation"}: \\`contents\\` must equal the plain projection of \\`richText\\` when both are given`)}function tQ(e){return void 0!==e&&"free-text"!==e&&(tr[e]?.includes("richText")??!1)}var tX="#ff0000",tY="#000000",t0="#ffff00",t1={invisible:!1,hidden:!1,print:!0,noZoom:!1,noRotate:!1,noView:!1,readOnly:!1,locked:!1,toggleNoView:!1,lockedContents:!1,blendMode:"normal"},t3={...t1,color:tX,opacity:1,strokeWidth:1,borderStyle:"solid"},t2={start:"none",end:"none"},t6={...t1,color:tY,opacity:1},t5={square:t3,circle:t3,line:{...t3,lineEndings:t2,captionEnabled:!1,captionPosition:"inline"},polygon:t3,polyline:{...t3,lineEndings:t2},ink:t3,highlight:{...t1,blendMode:"multiply",color:t0,opacity:1},underline:t6,squiggly:t6,strikeout:t6,caret:{...t1,color:tX,opacity:1},"free-text":{...t1,contents:"",intent:"free-text",fontFamily:"helvetica",fontSize:12,textAlign:"left",verticalAlign:"top",color:tY,fontColor:tY,opacity:1,strokeWidth:1,borderStyle:"solid"},text:{...t1,icon:"note",open:!1,color:t0,opacity:1},"file-attachment":{...t1,icon:"paperclip",color:t0,opacity:1},link:t1,redact:{...t1,quadPoints:[],color:tX,opacity:1,repeat:!1,fontFamily:"helvetica",fontSize:12,fontColor:tY,textAlign:"left"},stamp:{...t1,fit:"contain",opacity:1},widget:{...t1,strokeWidth:1,borderStyle:"solid",textAlign:"left"},popup:{...t1,print:!1,open:!1}};function t4(e){return"unsupported"===e?{}:t5[e]}var t8=[3,3];function t7(e,t){return"dashed"===e&&void 0===t}var t9=e=>tn(e)?.owners.dashArray!==void 0;function ne(e,t,n){let r={...e};if(void 0!==t.fontFamily){let e=eU(t.fontFamily,n);r.family=e.family,void 0!==e.weight&&(r.weight=e.weight),void 0!==e.italic&&(r.italic=e.italic)}return void 0!==t.fontSize&&(r.size=t.fontSize),null!=t.fontColor&&(r.color=t.fontColor),void 0!==t.textAlign&&(r.align=t.textAlign),r}function nt(e,t){if(null!=t&&"free-text-callout"!==e)throw new N(G.InvalidArg,`free-text: a callout line needs intent \'free-text-callout\', not \'${e}\'`,{details:{field:"intent"}})}function nn(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>"subtype"===e||!t(e,n)))}function nr(e){return new N(G.InvalidArg,`text: the custom state \'${e}\' needs a stateModel`,{details:{field:"stateModel"}})}function ni(e,t){let n=tr[e],r=Object.keys(t).filter(e=>"subtype"!==e&&!n.includes(e));if(r.length>0)throw new N(G.InvalidArg,`${e} has no field ${r.map(e=>`\'${e}\'`).join(", ")}`)}var no=class extends N{constructor(e,t){super(G.InvalidArg,`invalid scope "${e}": ${t}`,{details:{scope:e,reason:t}}),this.scope=e,I(this,"name","InvalidScope")}},na=class extends N{constructor(e,t,n,r){super(G.Forbidden,`permission denied${t?` (${t})`:""}: ${n?`one of ${n.join(", ")}`:e}${r?` for ${r.length} annotation${1===r.length?"":"s"}`:""}`,{details:{required:e,...void 0===t?{}:{context:t},...void 0===n?{}:{anyOf:[...n]},...void 0===r?{}:{refs:[...r]}}}),this.required=e,this.context=t,this.anyOf=n,this.refs=r,I(this,"name","PermissionDenied")}},ns=class extends N{constructor(e){super(G.Aborted,function(e){if(null==e)return"aborted";if("string"==typeof e)return e;if(e instanceof Error)return e.message||"aborted";try{return JSON.stringify(e)}catch{return"aborted"}}(e)),I(this,"name","AbortError"),I(this,"reason",void 0),this.reason=e}};function nl(e,t){throw new N(G.InvalidArg,t,{details:{field:e}})}var nu=["normal","rollover","down"],nd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nc=Uint8Array.from(nd,e=>e.charCodeAt(0)),nf=(()=>{let e=(new Int16Array(128)).fill(-1);for(let t=0;t<64;t++)e[nd.charCodeAt(t)]=t;return e})();function nm(e){let t=e.length;for(;t>0&&61===e.charCodeAt(t-1);)t-=1;return t}var np=(e,t,n)=>Math.min(Math.max(Math.floor(e),t),n);function nh(e,t){let n=np(t,0,e.charCount),r=e.charMap;if(!r||0===r.length)return Math.min(n,e.text.length);let[i,o]=function(e,t){let n=0,r=e.length-1,i=null;for(;n<=r;){let o=n+r>>1;e[o][0]<=t?(i=e[o],n=o+1):r=o-1}return i??[0,0]}(r,n);return o+(n-i)}function nF(e,t,n){let r=np(t,0,e.text.length),i=0,o=e.charCount;if("start"===n){for(;i>1;nh(e,t)>=r?o=t:i=t+1}return i}var ng=/[\\r\\p{Noncharacter_Code_Point}]/u;function n_(e){return"start"===e||"end"===e?null:"before"in e?e.before:e.after}function nP(e,t,n){if("start"===t)return 0;if("end"===t)return e.length;let r=n_(t),i=e.findIndex(e=>n(e)===n(r));if(i<0)throw new N(G.NotFound,`no neighbour ${n(r)} in the list`,{details:{field:"position"}});return"before"in t?i:i+1}function nD(e,t,n,r){let i=new Set(t.map(r));if(i.size!==t.length)throw new N(G.InvalidArg,"a row is named twice",{details:{field:"refs"}});let o=new Set(e.map(r)),a=t.find(e=>!o.has(r(e)));if(void 0!==a)throw new N(G.NotFound,`no row ${r(a)} in the list`,{details:{field:"refs"}});let s=n_(n);if(null!==s&&i.has(r(s)))throw new N(G.InvalidArg,`the neighbour ${r(s)} is one of the rows that move`,{details:{field:"position"}});let l=e.filter(e=>!i.has(r(e))),u=nP(l,n,r);return[...l.slice(0,u),...t,...l.slice(u)]}var nb="EmbedPDF";function ny(e,t){return{x:e.x-t.left,y:t.top-e.y}}function nw(e,t){return{x:e.x+t.left,y:t.top-e.y}}function nE(e,t){return{x:e.left-t.left,y:t.top-e.top,width:e.right-e.left,height:e.top-e.bottom}}function nA(e,t){let n=e.x+t.left,r=t.top-e.y;return{left:n,right:n+e.width,bottom:r-e.height,top:r}}function nv(e,t){return{upperLeft:ny(e.upperLeft,t),upperRight:ny(e.upperRight,t),lowerLeft:ny(e.lowerLeft,t),lowerRight:ny(e.lowerRight,t)}}function nS(e){return"rotation"in e}function nk(e){return{kind:"objectNumber",objectNumber:e}}function nx(e){if(e.byteLength<4)return null;let t=new Uint8Array(e);return 137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]?function(e){if(e.byteLength<24)return null;let t=new DataView(e),n=t.getUint32(16),r=t.getUint32(20);return 0===n||0===r?null:{mimeType:"image/png",width:n,height:r}}(e):255===t[0]&&216===t[1]&&255===t[2]?function(e){let t=new Uint8Array(e),n=2;for(;n+4=192&&r<=195){if(n+9>t.byteLength)return null;let r=new DataView(e,n+5),i=r.getUint16(0),o=r.getUint16(2);if(0===o||0===i)return null;return{mimeType:"image/jpeg",width:o,height:i}}if(216===r||217===r)n+=2;else if(255===r)n+=1;else{let e=t[n+2]<<8|t[n+3];n+=2+e}}return null}(e):37===t[0]&&80===t[1]&&68===t[2]&&70===t[3]?{mimeType:"application/pdf"}:null}var nG=["appearance","file"];function nO(e,t,n){let r=ti[e]??{};for(let i of nG){let o=t?.[i]!==void 0;if(o&&void 0===r[i])throw new N(G.InvalidArg,`a ${e} annotation takes no \'${i}\' resource`);if(!o&&"create"===n&&"required"===r[i])throw new N(G.InvalidArg,`creating a ${e} annotation needs its \'${i}\' resource`)}}var nI=Object.freeze({bundleBytes:0x3200000,manifestBytes:0x1000000,items:1e4,pages:2e3,resources:2e3,resourceBytes:0x3200000,imagePixels:4e7});function nN(e){return new TextEncoder().encode(JSON.stringify(e)).length}function nC(e,t,n,r){let i=t[n];if(!(r<=i))throw new N(G.PayloadTooLarge,`the ${e} bundle is past its ${n} limit: ${r} > ${i}`,{details:{limit:n,max:i,value:r}})}var nj={annotation:"an annotation bundle",form:"a form bundle"};function nM(e){let t=t=>new N(G.InvalidArg,`the file is not ${nj[e.kind]}`,void 0===t?void 0:{cause:t});return{stringify(t,n){let r=n?.limits??nI,i=new Map;for(let[e,n]of Object.entries(t.resources))i.set(e,n.length);e.assertManifest(t,i,r);let o={};for(let n of e.keys)o[n]=t[n];let a={};for(let[e,n]of Object.entries(t.resources))a[e]=function(e){let t=new Uint8Array(4*Math.ceil(e.length/3)),n=0,r=0;for(;r+2>18],t[n++]=nc[i>>12&63],t[n++]=nc[i>>6&63],t[n++]=nc[63&i]}let i=e.length-r;if(i>0){let o=e[r]<<16|(2===i?e[r+1]<<8:0);t[n++]=nc[o>>18],t[n++]=nc[o>>12&63],t[n++]=2===i?nc[o>>6&63]:61,t[n++]=61}return new TextDecoder().decode(t)}(n);return o.resources=a,JSON.stringify(o)},async parse(n,r){let i,o=r?.limits??nI,a=Math.ceil(4*o.bundleBytes/3)+81*o.resources+256;if(n.length>a)throw new N(G.PayloadTooLarge,`the file is ${n.length} characters, more than a bundle within ${o.bundleBytes} bytes can be`,{details:{limit:"bundleBytes",max:o.bundleBytes,fileLength:n.length}});try{i=JSON.parse(n)}catch(e){throw t(e)}let s="object"==typeof i&&null!==i?i.resources:null;if("object"!=typeof s||null===s||Array.isArray(s))throw t();let l=new Map;for(let[e,t]of Object.entries(s)){let n="string"==typeof t?function(e){let t=nm(e);return t%4==1?null:Math.floor(3*t/4)}(t):null;if(null===n)throw new N(G.InvalidArg,`resource ${e} is not base64`);l.set(e,n)}e.assertManifest(i,l,o);let u={};for(let[e,t]of Object.entries(s))try{u[e]=function(e){let t=nm(e);if(t%4==1)throw Error("malformed base64");let n=new Uint8Array(Math.floor(3*t/4)),r=0,i=0,o=0;for(let a=0;a=8&&(o-=8,n[r++]=i>>o&255)}return n}(t)}catch(t){throw new N(G.InvalidArg,`resource ${e} is not base64`,{cause:t})}await tc(e.kind,u);let d={};for(let t of e.keys)d[t]=i[t];return d.resources=u,e.complete?e.complete(d):d}}}var nR=["format","version","pages","items"],nT=[...nR,"resources"],nB=["data","resources"];function nL(e,t,n){tg(e)||tF("annotation","not an annotation bundle"),th("annotation","the bundle",e,nT),"embedpdf/annotations"!==e.format&&tF("annotation",`unknown format ${JSON.stringify(e.format)}`),1!==e.version&&tF("annotation",`unknown version ${JSON.stringify(e.version)}`);let{pages:r,items:i}=e;Array.isArray(r)||tF("annotation","pages is not a list"),Array.isArray(i)||tF("annotation","items is not a list"),nC("annotation",n,"items",i.length),nC("annotation",n,"pages",r.length),nC("annotation",n,"resources",t.size);let o=nN({pages:r,items:i});for(let e of(nC("annotation",n,"manifestBytes",o),t.values()))nC("annotation",n,"resourceBytes",e),o+=e;nC("annotation",n,"bundleBytes",o);let a=tf("annotation",r),s=new Set;i.forEach((e,n)=>{tg(e)&&tg(e.data)&&"string"==typeof e.data.subtype||tF("annotation",`item ${n} has no annotation data`),th("annotation",`item ${n}`,e,nB);let r=e.data.ref,i=tg(r)?r.page:void 0;t_(i)&&a.has(H(i))||tF("annotation",`item ${n} is on a page the bundle doesn\'t list`),tm("annotation",`item ${n}`,e.resources,nG,t,s)}),tp("annotation","item",t,s)}function n$(e){return{kind:"key",key:e}}nM({kind:"annotation",keys:nR,assertManifest:nL});var nz=new Set(["square","circle","free-text","stamp","caret"]),nU=(e,t)=>"function"==typeof t?t(e):t,nV=(e,t)=>null===e?null:t(e);function nW(e,t){let{left:n,top:r}=nU(e.page,t),i=e=>nV(e,e=>e-n),o=e=>nV(e,e=>r-e);switch(e.kind){case"xyz":{let{left:t,top:n,...r}=e;return{...r,x:i(t),y:o(n)}}case"fitH":case"fitBH":{let{top:t,...n}=e;return{...n,y:o(t)}}case"fitV":case"fitBV":{let{left:t,...n}=e;return{...n,x:i(t)}}case"fitR":{let{left:t,bottom:i,right:o,top:a,...s}=e,l=Math.min(i,a),u=Math.max(i,a);return{...s,x:Math.min(t,o)-n,y:r-u,width:Math.abs(o-t),height:u-l}}case"fit":case"fitB":return e}}function nq(e,t){let{left:n,top:r}=nU(e.page,t),i=e=>nV(e,e=>e+n),o=e=>nV(e,e=>r-e);switch(e.kind){case"xyz":{let{x:t,y:n,...r}=e;return{...r,left:i(t),top:o(n)}}case"fitH":case"fitBH":{let{y:t,...n}=e;return{...n,top:o(t)}}case"fitV":case"fitBV":{let{x:t,...n}=e;return{...n,left:i(t)}}case"fitR":{let{x:t,y:i,width:o,height:a,...s}=e,l=r-i;return{...s,left:t+n,bottom:l-a,right:t+n+o,top:l}}case"fit":case"fitB":return e}}function nH(e,t){return"goto"===e.kind?{...e,destination:t(e.destination)}:e}function nK(e,t){return{...e,root:e.root?function e(t,n){let r=t.next.map(t=>e(t,n));return"goto"===t.type?{...t,next:r,destination:n(t.destination)}:{...t,next:r}}(e.root,t):null}}function nZ(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>null==n?[e,n]:[e,"root"in n?nK(n,t):function e(t,n){let r=t.next?.map(t=>e(t,n)),i="goto"===t.type?{...t,destination:n(t.destination)}:t;return r?{...i,next:r}:i}(n,t)]))}function nJ(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,n?nK(n,t):n]))}var nQ=(e,t)=>"rectilinear"===e.subtype&&e.origin?{...e,origin:t(e.origin)}:e;function nX(e,t){return nQ(e,e=>ny(e,t))}function nY(e,t){return nQ(e,e=>nw(e,t))}function n0(e,t){return e.map(e=>({...e,bbox:nE(e.bbox,t),measure:e.measure?nX(e.measure,t):null}))}var n1={length:e=>e,point:(e,{visible:t})=>ny(e,t),points:(e,{visible:t})=>e.map(e=>ny(e,t)),strokes:(e,{visible:t})=>e.map(e=>e.map(e=>ny(e,t))),box:(e,{visible:t})=>nE(e,t),quads:(e,{visible:t})=>e.map(e=>nv(e,t)),linePoints:(e,{visible:t})=>({start:ny(e.start,t),end:ny(e.end,t)}),calloutLine:(e,{visible:t})=>e.map(e=>ny(e,t)),measure:(e,{visible:t})=>nX(e,t),linkTarget:(e,{boxOf:t})=>nH(e,e=>nW(e,t)),actions:(e,{boxOf:t})=>nZ(e,e=>nW(e,t))},n3={length:e=>e,point:(e,{visible:t})=>nw(e,t),points:(e,{visible:t})=>e.map(e=>nw(e,t)),strokes:(e,{visible:t})=>e.map(e=>e.map(e=>nw(e,t))),box:(e,{visible:t})=>nA(e,t),quads:(e,{visible:t})=>e.map(e=>({upperLeft:nw(e.upperLeft,t),upperRight:nw(e.upperRight,t),lowerLeft:nw(e.lowerLeft,t),lowerRight:nw(e.lowerRight,t)})),linePoints:(e,{visible:t})=>({start:nw(e.start,t),end:nw(e.end,t)}),calloutLine:(e,{visible:t})=>e.map(e=>nw(e,t)),measure:(e,{visible:t})=>nY(e,t),linkTarget:(e,{boxOf:t})=>nH(e,e=>nq(e,t)),actions:(e,{boxOf:t})=>nZ(e,e=>nq(e,t))};function n2(e,t,n,r){let i=void 0===e?ta:to[e]??to.unsupported;return Object.fromEntries(Object.entries(t).map(([e,t])=>{let o=i[e];if(!o||null==t)return[e,t];let a=r[o](t,n);if(r===n3&&function e(t){return"number"==typeof t?Number.isNaN(t):"object"==typeof t&&null!==t&&Object.values(t).some(e)}(a)){var s,l;throw s=e,l=o,new N(G.InvalidArg,`field \'${s}\': expected page space, ${"box"===l?"{ x, y, width, height }":"points as { x, y }"} from the page\'s top-left`,{details:{field:s}})}return[e,a]}))}function n6(e,t,n){return n2(e.subtype,e,{visible:t,boxOf:n},n1)}function n5(e,t,n){return n2(e.subtype,e,{visible:t,boxOf:n},n3)}function n4(e,t,n){return n2(e.subtype,e,{visible:t,boxOf:n},n3)}var n8=e=>!!(e.space||e.empty),n7=e=>!!e.empty,n9={baseline:{x:1,y:0},ascent:{x:0,y:1}},re=(e,t)=>({x:t.x*e.baseline.x+t.y*e.baseline.y,y:t.x*e.ascent.x+t.y*e.ascent.y}),rt=(e,t)=>({x:e.baseline.x*t.x+e.ascent.x*t.y,y:e.baseline.y*t.x+e.ascent.y*t.y}),rn={left:0,bottom:0,right:0,top:0};function rr(e,t){let n=[t.upperLeft,t.upperRight,t.lowerLeft,t.lowerRight].map(t=>re(e,t)),r=n.map(e=>e.x),i=n.map(e=>e.y);return{left:Math.min(...r),bottom:Math.min(...i),right:Math.max(...r),top:Math.max(...i)}}var ri=(e,t)=>t.x>=e.left&&t.x<=e.right&&t.y>=e.bottom&&t.y<=e.top;function ro(e,t,n=1.5){let r=e.frames.map((e,n)=>0===n?t:re(e,t));for(let t of e.runs){let n=r[t.frame];if(ri(t.rect,n))for(let r=0;rs.right+i)&&!(n.ys.top+i))for(let r=0;rl.right+i||n.yl.top+i)continue;let u=Math.min(Math.abs(n.x-l.left),Math.abs(n.x-l.right)),d=Math.min(Math.abs(n.y-l.bottom),Math.abs(n.y-l.top));u+d=0?o:null}function ra(e,t,n){return 0===t?{upperLeft:{x:n.left,y:n.top},upperRight:{x:n.right,y:n.top},lowerLeft:{x:n.left,y:n.bottom},lowerRight:{x:n.right,y:n.bottom}}:{upperLeft:rt(e,{x:n.left,y:n.top}),upperRight:rt(e,{x:n.right,y:n.top}),lowerLeft:rt(e,{x:n.left,y:n.bottom}),lowerRight:rt(e,{x:n.right,y:n.bottom})}}var rs=e=>e.right===e.left&&e.top===e.bottom;function rl(e,t,n,r){let i=Math.max(t,r)-Math.min(e,n);return 0!==i&&Math.max(0,Math.min(t,r)-Math.max(e,n))/i>=.5}var ru={x:0,y:0,width:0,height:0},rd={upperLeft:{x:0,y:0},upperRight:{x:0,y:0},lowerLeft:{x:0,y:0},lowerRight:{x:0,y:0}},rc=/\\s/,rf=/\\p{M}/gu,rm=/^(?![\\t\\n\\v\\f\\r])[\\p{Cf}\\p{Cc}\\p{Noncharacter_Code_Point}]$/u;function rp(e,t={}){let n=[],r=[],i=!1,o=0;for(let a of e){let e;if(rm.test(a)){o+=a.length;continue}rc.test(a)?e=" ":(e=a.normalize("NFKD"),t.keepMarks||(e=e.replace(rf,"")),t.keepCase||(e=e.toUpperCase().toLowerCase()));for(let a=0;a=55296&&n<=56319&&t+1=56320&&n<=57343)return 2}return 1}(e.original,i)-r}}var rF=["format","version","pages","fields","widgets","calculationOrder"],rg=["image"],r_=[...rF,"resources"],rP=["data"],rD=["data","resources"];function rb(e){let t=ry(e.fields,e=>es(ej(en(el(ey(e)))))),n=e.widgets&&ry(e.widgets,Q);return t===e.fields&&n===e.widgets?e:{...e,fields:t,...n?{widgets:n}:{}}}function ry(e,t){let n=!1,r=e.map(e=>{let r=t(e.data);return r===e.data?e:(n=!0,{...e,data:r})});return n?r:e}function rw(e,t,n){tg(e)||tF("form","not a form bundle"),th("form","the bundle",e,r_),"embedpdf/form"!==e.format&&tF("form",`unknown format ${JSON.stringify(e.format)}`),1!==e.version&&tF("form",`unknown version ${JSON.stringify(e.version)}`);let{pages:r,fields:i,widgets:o,calculationOrder:a}=e;Array.isArray(r)||tF("form","pages is not a list"),Array.isArray(i)||tF("form","fields is not a list"),Array.isArray(o)||tF("form","widgets is not a list"),Array.isArray(a)||tF("form","calculationOrder is not a list"),nC("form",n,"items",i.length+o.length),nC("form",n,"pages",r.length),nC("form",n,"resources",t.size);let s=nN({pages:r,fields:i,widgets:o,calculationOrder:a});for(let e of(nC("form",n,"manifestBytes",s),t.values()))nC("form",n,"resourceBytes",e),s+=e;nC("form",n,"bundleBytes",s);let l=tf("form",r);i.forEach((e,t)=>{tg(e)&&tg(e.data)&&"string"==typeof e.data.kind&&"string"==typeof e.data.name&&tg(e.data.ref)||tF("form",`field ${t} has no field data`),th("form",`field ${t}`,e,rP)});let u=new Set;o.forEach((e,n)=>{tg(e)&&tg(e.data)&&"widget"===e.data.subtype||tF("form",`widget ${n} has no widget data`),th("form",`widget ${n}`,e,rD);let r=e.data.ref,i=tg(r)?r.page:void 0;t_(i)&&l.has(H(i))||tF("form",`widget ${n} is on a page the bundle doesn\'t list`),tm("form",`widget ${n}`,e.resources,rg,t,u)}),a.forEach((e,t)=>{tg(e)||tF("form",`calculation order entry ${t} is not a field ref`)}),tp("form","widget",t,u)}function rE(e){return{keepCase:!!e.matchCase,keepMarks:!!e.matchDiacritics,dropWhitespace:!!e.ignoreWhitespace}}nM({kind:"form",keys:rF,assertManifest:rw,complete:rb});var rA=/[\\p{L}\\p{N}_]/u,rv=/\\p{M}/u;function rS(e,t){if(t<=0)return!1;let n=e.charCodeAt(t-1);return rA.test(String.fromCodePoint(e.codePointAt(n>=56320&&n<=57343&&t>=2?t-2:t-1)))}function rk(e,t){return!(t>=e.length)&&rA.test(String.fromCodePoint(e.codePointAt(t)))}function rx(e,t){let n=rp(t.text,rE(t)).folded;if(0===n.trim().length)return[];let r=[],i=0;for(;i<=e.folded.length-n.length;){let o=e.folded.indexOf(n,i);if(o<0)break;if(t.wholeWord&&!function(e,t,n,r){if(!r.ignoreWhitespace)return!rS(e.folded,t)&&!rk(e.folded,t+n);let{start:i,count:o}=rh(e,t,n);return!rS(e.original,i)&&!rk(e.original,i+o)}(e,o,n.length,t)){i=o+1;continue}if(t.matchDiacritics&&o+n.length512)return{ok:!1,issue:"too-long",message:"Pattern exceeds 512 characters."};let t=!1;for(let n=0;n="1"&&r<="9")return{ok:!1,issue:"backreference",message:`Backreference \\\\${r} is not supported.`};if(!t&&"k"===r&&"<"===e[n+2])return{ok:!1,issue:"backreference",message:"Named backreferences (\\\\k<\\u2026>) are not supported."};n++;continue}if(t){"]"===r&&(t=!1);continue}if("["===r){t=!0;continue}if("("===r&&"?"===e[n+1]){let t=e[n+2]??"";if("="===t||"!"===t)return{ok:!1,issue:"lookaround",message:"Lookahead ((?=\\u2026), (?!\\u2026)) is not supported."};if("<"===t&&("="===e[n+3]||"!"===e[n+3]))return{ok:!1,issue:"lookaround",message:"Lookbehind ((?<=\\u2026), (?{var r;let i;return"link"!==e.subtype||"activate"!==t||o&&(r=n,i=r?.root,!r||!!r.incomplete||!i||!!(i.next.length>0)||!!("uri"===i.type&&i.isMap))})&&n.push({field:"actions",reason:"unsupported-action"}),n}var rT=new Set(["NextPage","PrevPage","FirstPage","LastPage"]);function rB(e){let t=[],n=(e,r)=>{if("object"==typeof e&&null!==e){if(Array.isArray(e))return void e.forEach(e=>n(e));if("page"===r&&r$(e))return void t.push(e);Object.entries(e).forEach(([e,t])=>n(t,e))}};return n(e),t}function rL(e,t){let n=(e,r)=>"object"!=typeof e||null===e?e:Array.isArray(e)?e.map(e=>n(e)):"page"===r&&r$(e)?t(e):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,n(t,e)]));return n(e)}function r$(e){return 2===Object.keys(e).length&&"objectNumber"===e.kind&&"number"==typeof e.objectNumber}var rz=/^\\s*event\\s*\\.\\s*target\\s*\\.\\s*buttonImportIcon\\s*\\(\\s*\\)\\s*(?:;\\s*)?$/,rU=["activate","mouseUp"];function rV(e){let t,n=rU.flatMap(t=>{let n=e?.[t];return null==n?[]:[n]});return 1===n.length&&null!==(t=ew(n[0]))&&rz.test(t)}function rW(e){return e.length>0&&e.every(rV)}function rq(){return{type:"javascript",script:"event.target.buttonImportIcon();"}}function rH(e){return rU.some(t=>e?.[t]!==void 0)?e??{}:{...e,activate:rq()}}function rK(e,t){let{takesImage:n}=e;if(void 0!==n){if("pushbutton"!==t)throw new N(G.InvalidArg,`\'takesImage\' does not apply to a ${t} field`,{details:{field:"takesImage"}});if("boolean"!=typeof n)throw new N(G.InvalidArg,"\'takesImage\' is true or false",{details:{field:"takesImage"}});return n}}function rZ(e,t){if(!t)return rV(e)?{kind:"remove",event:e?.activate!=null?"activate":"mouseUp"}:{kind:"keep"};if(rV(e))return{kind:"keep"};if(rU.some(t=>e?.[t]!=null))throw new N(G.InvalidArg,"\'takesImage\' can\'t be set: a widget\'s press already runs another action, which is never overwritten. Remove it first (updateWidget, actions.activate and actions.mouseUp)",{details:{field:"takesImage"}});return{kind:"write"}}function rJ(e,t=0){if(e.length+t===0)throw rX();if(t>0)throw new N(G.InvalidArg,"\'takesImage\' can\'t be set: a widget of the button is on no page, so its press can\'t be written",{details:{field:"takesImage"}});for(let t of e)rZ(t,!0)}function rQ(e){return"write"===e.kind?{activate:rq()}:"remove"===e.kind?{[e.event]:null}:{}}function rX(){return new N(G.InvalidArg,"\'takesImage\' needs a widget: the script that makes an image field is its widgets\' press",{details:{field:"takesImage"}})}function rY(e,t,n){if(0===e.length||0===n.length)return e;let r=new Set(n),i=[0];for(let e=0;ei[Math.min(Math.max(e,0),t)],a=[];return e.forEach((n,r)=>{if(o(e[r+1]?.firstPage??t)===o(n.firstPage))return;let i=o(n.firstPage);a.push(i===n.firstPage?n:{...n,firstPage:i})}),r1(a,e)?e:a}function r0(e,t,n){if(n<=0)return e;let r=!1,i=e.map(e=>0===e.firstPage||e.firstPage{let r=t[n];return e.firstPage===r.firstPage&&e.style===r.style&&e.firstNumber===r.firstNumber&&e.prefix===r.prefix})}var r3=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function r2(e){let t=e%1e6,n="";for(let[e,r]of r3)for(;t>=e;)n+=r,t-=e;return n}function r6(e){if(e<=0)return"";let t=e-1;return String.fromCharCode(97+t%26).repeat((Math.floor(t/26)+1)%1e3)}var r5={text:"{ value }",checkbox:"{ checked } or { value }",radio:"{ value }",combobox:"{ value }",listbox:"{ selectedValues }"};function r4(e,t){var n;switch(e.kind){case"text":if("value"in t)return{kind:"text",value:t.value??""};break;case"checkbox":if("checked"in t){if(!t.checked)return{kind:"toggle",state:null};let n=e.widgets[0];if(!n)throw it(`\'${e.name}\' has no widget to check`);return{kind:"toggle",state:n.onState}}if("value"in t)return{kind:"toggle",state:r9(e,t.value)};break;case"radio":if("value"in t){let n=r9(e,t.value);if(null===n&&e.noToggleToOff)throw it(`\'${e.name}\' must keep a choice: it can\'t be cleared`);return{kind:"toggle",state:n}}break;case"combobox":if("value"in t)return ie(e,null===t.value?[]:[t.value]);break;case"listbox":if("selectedValues"in t)return ie(e,t.selectedValues);break;default:throw it(`${e.kind} fields hold no value you can set`)}throw it(`a ${e.kind} field takes ${r5[e.kind]}, not ${"checked"in(n=t)?"{ checked }":"selectedValues"in n?"{ selectedValues }":"{ value }"}`)}function r8(e,t){let n=e=>new N(G.InvalidArg,e,{details:{field:"defaultValue"}});if(new Set(t).size!==t.length)throw n("the default values must not repeat");if(t.length>1&&!("listbox"===e.kind&&e.multiSelect))throw n(`a ${"listbox"===e.kind?"list without multiSelect":"dropdown"} has one default`);let r="combobox"===e.kind&&!0===e.edit,i=new Set(e.options.map(e=>e.value)),o=t.find(e=>!i.has(e));if(void 0!==o&&!r)throw n(`\'${o}\' is not an option value of the ${"listbox"===e.kind?"list":"dropdown"}`)}function r7(e,t){return e.kind===t.kind&&("scalar"===e.kind&&"scalar"===t.kind?e.value===t.value:"array"!==e.kind||"array"!==t.kind||e.values.length===t.values.length&&e.values.every((e,n)=>e===t.values[n]))}function r9(e,t){if(null===t||"Off"===t)return null;let n=e.widgets.find(e=>e.exportValue===t);if(!n)throw it(`no widget of \'${e.name}\' has the export value \'${t}\'`);return n.onState}function ie(e,t){if(new Set(t).size!==t.length)throw it("the values must not repeat");if("listbox"===e.kind&&!e.multiSelect&&t.length>1)throw it(`\'${e.name}\' takes one value (it has no multiSelect)`);let n=new Set(e.options.map(e=>e.value)),r="combobox"===e.kind&&e.edit&&1===t.length,i=t.find(e=>!n.has(e));if(!r&&void 0!==i)throw it(`\'${i}\' is not an option value of \'${e.name}\'`);return{kind:"choice",values:t}}function it(e){return new N(G.InvalidArg,e,{details:{field:"value"}})}function ir(e,t){let n="checkbox"===e||"radio"===e,r="pushbutton"===e,i=ii(e,t,"caption",r,"a push button\'s");if(r&&null===t.layout)throw new N(G.InvalidArg,"a push button\'s widget always has a layout: \'caption\' shows its caption alone",{details:{field:"layout"}});return ii(e,ii(e,i,"layout",r,"a push button\'s"),"checkStyle",n,"a checkbox\'s or radio button\'s")}function ii(e,t,n,r,i){if(r||void 0===t[n])return t;if(null!==t[n]){let t="unknown"===e?"this widget":`a ${e} field\'s widget`;throw new N(G.InvalidArg,`\'${n}\' applies to ${i} widgets, not to ${t}`,{details:{field:n}})}let{[n]:o,...a}=t;return a}function io(e){if(("combobox"===e.kind||"listbox"===e.kind)&&void 0!==e.defaultValue){let t=Array.isArray(e.defaultValue)?e.defaultValue:[e.defaultValue];r8({...e,options:e.options??[]},t)}switch(e.kind){case"text":case"combobox":return void 0!==e.defaultValue?ib(e.defaultValue):iy();case"listbox":return ip(ih((e.options??[]).map(iP),e.defaultValue??[]));default:return iy()}}function ia(e,t){var n,r,i;let o,a,s,l,u,d={...e.field};if(void 0!==t.name){let e=d.name.lastIndexOf(".");d.name=e<0?t.name:`${d.name.slice(0,e+1)}${t.name}`}for(let e of is)"boolean"==typeof t[e]&&e in d&&(d[e]=t[e]);if(void 0!==t.alternateName&&(d.alternateName=t.alternateName||null),void 0!==t.mappingName&&(d.mappingName=t.mappingName||null),d.assignment=et(t,d),d.groupId=Y(d.assignment),void 0!==t.purpose&&(d.purpose=rj(t.purpose)),void 0!==t.placeholder&&(d.placeholder=eC(t.placeholder)),"text"===d.kind||"combobox"===d.kind){let e=ex(t,d.kind);if(void 0!==e&&!eS(e,d.format)){let t=function(e,t){let{keystroke:n,format:r,...i}=e??{};if(null===t)return Object.keys(i).length>0?i:void 0;let o=eE(t);return{keystroke:eG(o.keystroke),format:eG(o.format),...i}}(d.actions,e);d.format=e,t?d.actions=t:delete d.actions}}if("text"===d.kind&&("maxLength"in t&&void 0!==t.maxLength&&(d.maxLength=t.maxLength),"defaultValue"in t&&void 0!==t.defaultValue)){let e=t.defaultValue;d.defaultValue=e??"",d.defaultValueEntry=null===e?iy():ib(e)}let c=!1;if(("combobox"===d.kind||"listbox"===d.kind)&&("options"in t&&t.options&&(n=d,o=(r=t.options.map(iP)).map(e=>e.value),a="combobox"===n.kind&&n.edit,s=ig("combobox"===n.kind?""===n.value?[]:[n.value]:n.selectedValues,o,a),l=im("listbox"===n.kind?{...n,options:r,topIndex:iF(n.topIndex,r)}:{...n,options:r},s),u="scalar"===(i=n.defaultValueEntry).kind?[i.value]:"array"===i.kind?[...i.values]:[],d="none"===n.defaultValueEntry.kind?l:i_(l,ig(u,o,a),!0),c=!0),"defaultValue"in t&&void 0!==t.defaultValue)){let e=null===t.defaultValue?[]:Array.isArray(t.defaultValue)?t.defaultValue:[t.defaultValue];r8(d,e),d=i_(d,e)}let f={...e,field:d},m=rK(t,d.kind);return void 0!==m?function(e,t){if("pushbutton"!==e.field.kind)return e;let n=new Set(e.field.widgets.map(e=>e.objectNumber)),r=e=>n.has(iD(e.ref)),i=e.widgets.filter(r);t&&rJ(i.map(e=>e.actions),e.field.widgets.length-i.length);let o=e.widgets.map(e=>{if(!r(e))return e;let n=rQ(rZ(e.actions,t)),i=function(e,t){if(null===t)return null;let n={...e},r=!1;for(let e of z){let i=t[e];void 0!==i&&(null===i?(void 0!==n[e]&&(r=!0),delete n[e]):"root"in i||(n[e]=$(i),r=!0))}let i=r?n:e??{};return Object.keys(i).length>0?i:null}(e.actions,n);return i===(e.actions??null)?e:{...e,actions:i}});return{field:{...e.field,takesImage:t},widgets:o}}(f,m):c?il(f.field,f):f}var is=["readOnly","required","noExport","multiline","password","comb","radiosInUnison","noToggleToOff","edit","multiSelect"];function il(e,t){return{field:e,widgets:t.widgets.map(e=>e.hasAppearance?e:{...e,hasAppearance:!0})}}function iu(e,t){let n=e.field;if("checkbox"!==n.kind&&"radio"!==n.kind)return e;let r="checkbox"===n.kind||n.radiosInUnison,i=t>=0?n.widgets[t]:null,o=n.widgets.map((e,n)=>{let o=null!==i&&(r?e.exportValue===i.exportValue&&e.onState===i.onState:n===t);return e.checked===o?e:{...e,checked:o}}),a=ib(i?i.onState:"Off"),s="checkbox"===n.kind?{...n,widgets:o,valueEntry:a,checked:o.some(e=>e.checked)}:{...n,widgets:o,valueEntry:a,value:o.find(e=>e.checked)?.exportValue??"Off"},l=new Map(o.map(e=>[e.objectNumber,e.checked?e.onState:"Off"]));return{field:s,widgets:e.widgets.map(e=>{let t=l.get(iD(e.ref));return void 0===t||e.appearanceState===t?e:{...e,appearanceState:t}})}}function id(e,t){let n=new Set;for(let r of t){let t=e.findIndex(e=>e.value===r);t>=0&&n.add(t)}return[...n].sort((e,t)=>e-t)}var ic=(e,t)=>t.every(t=>e.options.some(e=>e.value===t));function im(e,t){let n=ic(e,t)?id(e.options,t):[],r=t.length>0&&0===n.length,i=e.options.map((e,t)=>{let r=n.includes(t);return e.selected===r?e:{...e,selected:r}}),o=r?[...t]:n.map(t=>e.options[t].value),a=ip(o);return"combobox"===e.kind?{...e,options:i,valueEntry:a,value:o[0]??""}:{...e,options:i,valueEntry:a,selectedValues:o}}function ip(e){return 0===e.length?iy():1===e.length?ib(e[0]):{kind:"array",values:[...e]}}function ih(e,t){return id(e,t).map(t=>e[t].value)}function iF(e,t){return Math.max(0,Math.min(e,t.length-1))}function ig(e,t,n){let r=e.filter(e=>t.includes(e));return 0===r.length&&n&&e.length>0?[...e]:r}function i_(e,t,n=!1){if(0===t.length){let t=n?"listbox"===e.kind&&e.multiSelect?{kind:"array",values:[]}:ib(""):iy();return"combobox"===e.kind?{...e,defaultValueEntry:t,defaultValue:""}:{...e,defaultValueEntry:t,defaultValue:[]}}let r=ic(e,t),i=r?ih(e.options,t):[...t],o=r?ip(i):ib(t[0]);return"combobox"===e.kind?{...e,defaultValueEntry:o,defaultValue:i[0]??""}:{...e,defaultValueEntry:o,defaultValue:i}}var iP=e=>({label:e.label,value:e.value,selected:!1}),iD=e=>"objectNumber"===e.kind?e.objectNumber:0,ib=e=>({kind:"scalar",value:e}),iy=()=>({kind:"none"});function iw(e){return new N(G.Unknown,`\'${e.name}\' could not be reset`)}function iE(e){var t,n;if(null===e)return null;let r=!ArrayBuffer.isView(t=e)&&(n=t,!("u">typeof Blob&&n instanceof Blob)),i=r?e.pdf:e;if(ArrayBuffer.isView(i))return{bytes:i,declaredPdf:r};throw new N(G.InvalidArg,"a signature appearance reaches a write as bytes, never as a Blob")}function iA(e){return"skipped"===e.type}function iv(e){switch(e.type){case"skipped":return!1;case"annotations.import":case"annotations.copy":return e.annotations.length>0;case"forms.import":case"forms.importValues":case"forms.copy":return e.fields.length>0;case"forms.repeat":return e.meta.changedFields.length>0;default:return!0}}function iS(e){return"undoOf"in e}function ik(e,t){return{all:()=>`${e}:${t}:all`,self:()=>`${e}:${t}:self`,createdBy:n=>`${e}:${t}:createdBy=${n}`,group:n=>`${e}:${t}:group=${n}`}}function ix(e,t){return{all:()=>`${e}:${t}:all`,group:n=>`${e}:${t}:group=${n}`}}Object.assign(()=>"doc.render",{thumbnail:()=>"doc.render.thumbnail"}),Object.assign(()=>"doc.download",{flattened:()=>"doc.download.flattened"}),Object.assign(()=>"doc.print",{high:()=>"doc.print.high"}),Object.assign(()=>"doc.sign",{certify:()=>"doc.sign.certify"}),ik("annotations","create"),ik("annotations","update"),ik("annotations","delete"),ix("annotations","set-group"),ik("annotations","*"),ix("fields","fill"),ix("fields","sign"),ix("fields","set-group"),ix("fields","*");var iG={none:0,lta:1,fill:2,annotate:3};function iO(e){return 1===e?"lta":2===e?"fill":"annotate"}function iI(e,t){return iG[e]<=iG[t]?e:t}function iN(e,t){return null===e||iG[e]>=iG[t]}function iC(e,t){return t===e||t.startsWith(`${e}.`)}function ij(e,t){switch(e.action){case"all":return!0;case"include":return e.fields.some(e=>iC(e,t));case"exclude":return!e.fields.some(e=>iC(e,t))}}function iM(e){let t=!1,n=null,r=null,i=[];for(let o of e)o.signed&&(t=!0,o.catalogCertification&&null!==o.docMdp&&null===r&&(r={signatureIndex:o.index,permission:o.docMdp},n=iI(n??"annotate",iO(o.docMdp))),o.fieldMdp&&i.push({signatureIndex:o.index,source:"fieldmdp",spec:o.fieldMdp}),o.lock&&(i.push({signatureIndex:o.index,source:"lock",spec:o.lock}),void 0!==o.lock.permission&&(n=iI(n??"annotate",iO(o.lock.permission)))));return{enforced:n,judged:t?n??"annotate":null,certification:r,fieldLocks:i,policyVersion:6}}function iR(e){let t=new Set;return e&&null!==e.judged&&(t.add("doc.download.flattened"),null===e.enforced||(t.add("doc.pages.modify"),t.add("doc.pages.assemble"),t.add("doc.redact"),t.add("doc.attachments.modify"),t.add("doc.outline.modify"),t.add("doc.forms.modify"),t.add("doc.forms.script"),iN(e.enforced,"annotate")||(t.add("doc.annotate.modify"),t.add("doc.annotate.import")),iN(e.enforced,"fill")||(t.add("doc.forms.fill"),t.add("doc.forms.import"),t.add("doc.metadata.modify"),t.add("doc.sign")))),t}var iT=new Set(["doc.open","doc.render","doc.render.thumbnail","doc.text.select","doc.text.copy","doc.text.search","doc.content.copy","doc.download","doc.download.flattened","doc.print","doc.print.high","doc.pages.modify","doc.pages.assemble","doc.forms.read","doc.forms.fill","doc.forms.modify","doc.forms.import","doc.forms.script","doc.forms.submit","doc.annotate.read","doc.annotate.modify","doc.annotate.import","doc.metadata.modify","doc.attachments.modify","doc.outline.modify","doc.redact","doc.sign","doc.sign.certify"]);function iB(e){if("*"===e)return{kind:"wildcard"};if("pdf.permissions"===e)return{kind:"virtual",name:"pdf.permissions"};if(e.includes(":"))return function(e){let t=e.indexOf(":"),n=e.indexOf(":",t+1);if(-1===t||-1===n)throw new no(e,"collab scope requires entity:action:filter");let r=e.slice(0,t),i=e.slice(t+1,n),o=e.slice(n+1);if("fields"===r){var a=e,s=i,l=o;if("fill"!==s&&"sign"!==s&&"set-group"!==s&&"*"!==s)throw new no(a,`unknown fields action: ${s}`);let t=i$(l,a);if("all"!==t.kind&&"group"!==t.kind)throw new no(a,`fields only support :all or :group= filters (got :${t.kind})`);return{kind:"collab",entity:"fields",action:s,filter:t}}if("annotations"!==r)throw new no(e,`unknown collab entity: ${r}`);if("create"!==i&&"update"!==i&&"delete"!==i&&"set-group"!==i&&"*"!==i)throw new no(e,`unknown collab action: ${i}`);let u=i$(o,e);if("set-group"===i&&("self"===u.kind||"createdBy"===u.kind))throw new no(e,`set-group only supports :all or :group= filters (got :${u.kind})`);return{kind:"collab",entity:r,action:i,filter:u}}(e);let t=function(e){if(e.includes(":"))return null;let t=e.indexOf(".");if(t<=0)return null;let n=e.slice(0,t);return iL.has(n)?null:n}(e);return null!==t?function(e,t){if(!iU.test(e))throw new no(e,"invalid plugin permission shape (expected .)");return{kind:"plugin",name:e,plugin:t}}(e,t):function(e){if(!iz.test(e))throw new no(e,"invalid capability name shape");if(!iT.has(e))throw new no(e,`unknown capability: ${e}`);return{kind:"capability",name:e}}(e)}var iL=new Set(["doc","docs","pdf","annotations","fields","tokens","grants","shares","tenants","layer","visitor","document","submission","signature"]);function i$(e,t){if("all"===e)return{kind:"all"};if("self"===e)return{kind:"self"};if(e.startsWith("createdBy=")){let n=e.slice(10);if(!n)throw new no(t,"createdBy= requires a value");return{kind:"createdBy",userId:n}}if(e.startsWith("group=")){let n=e.slice(6);if(!n)throw new no(t,"group= requires a value");return{kind:"group",groupId:n}}throw new no(t,`unknown filter: ${e}`)}var iz=/^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$/,iU=/^[a-z][a-z0-9]*(-[a-z0-9]+)*(\\.[a-z][a-z0-9]*(-[a-z0-9]+)*)+$/;function iV(e){return{...e.userId?{userId:e.userId}:{},...e.groupId?{groupId:e.groupId}:{}}}function iW(e,t,n,r=null){if(iR(r).has(e))return!1;let i=t.map(iB);return!!i.some(e=>"wildcard"===e.kind)||iH(i,n,r).has(e)}function iq(e,t,n,r,i){let o=n.map(iB);if(o.some(e=>"wildcard"===e.kind))return!0;let a=o.filter(t=>"collab"===t.kind&&"annotations"===t.entity&&(t.action===e||"*"===t.action));return a.length>0?a.some(e=>(function(e,t,n){switch(e.kind){case"all":return!0;case"self":return!!n.userId&&t.userId===n.userId;case"createdBy":return t.userId===e.userId;case"group":return t.groupId===e.groupId}})(e.filter,t,r)):iH(o,i).has("doc.annotate.modify")}function iH(e,t,n=null){let r=new Set,i=!1,o=!1;for(let n of e)"capability"===n.kind?r.add(n.name):"virtual"===n.kind&&"pdf.permissions"===n.name?function(e,t){let n;for(let r of((n=new Set).add("doc.open"),n.add("doc.render"),n.add("doc.annotate.read"),n.add("doc.forms.read"),n.add("doc.text.search"),n.add("doc.text.select"),t.copy&&(n.add("doc.text.copy"),n.add("doc.content.copy")),t.print&&n.add("doc.print"),t.printHighQuality&&t.print&&n.add("doc.print.high"),t.modifyContents&&(n.add("doc.pages.modify"),n.add("doc.redact"),n.add("doc.metadata.modify"),n.add("doc.attachments.modify")),(t.modifyContents||t.assemble)&&(n.add("doc.pages.assemble"),n.add("doc.outline.modify")),t.modifyAnnotations&&n.add("doc.annotate.modify"),(t.modifyContents||t.modifyAnnotations||t.fillForms)&&(n.add("doc.forms.fill"),n.add("doc.sign")),t.modifyAnnotations&&t.modifyContents&&n.add("doc.forms.modify"),[...n]))e.add(r)}(r,t):"collab"===n.kind&&"annotations"===n.entity?i=!0:"collab"===n.kind&&"fields"===n.entity&&(o=!0);for(let e of(r.has("doc.render")&&r.add("doc.render.thumbnail"),r.has("doc.annotate.modify")&&r.add("doc.annotate.read"),r.has("doc.forms.modify")&&(r.add("doc.forms.fill"),r.add("doc.forms.read")),r.has("doc.forms.fill")&&r.add("doc.forms.read"),i&&r.add("doc.annotate.read"),o&&r.add("doc.forms.read"),iR(n)))r.delete(e);return r}function iK(e,t,n,r){if(t===n)return!0;let i=r.map(iB);if(i.some(e=>"wildcard"===e.kind))return!0;for(let n of i)if("collab"===n.kind&&n.entity===e&&("set-group"===n.action||"*"===n.action)&&("all"===n.filter.kind||"group"===n.filter.kind&&n.filter.groupId===t))return!0;return!1}function iZ(e,t,n,r=null){let i="fill"===e?"doc.forms.fill":"doc.sign";if(iR(r).has(i))return!1;let o=t.map(iB);return!!(o.some(e=>"wildcard"===e.kind)||o.some(t=>"collab"===t.kind&&"fields"===t.entity&&(t.action===e||"*"===t.action)))||iH(o,n,r).has(i)}var iJ={left:0,bottom:0,right:612,top:792},iQ={left:0,right:0,bottom:0,top:0};function iX(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));return e[6]=15&e[6]|64,e[8]=63&e[8]|128,i0(e)}function iY(e=Date.now()){let t=globalThis.crypto.getRandomValues(new Uint8Array(16)),n=Math.max(0,Math.floor(e));for(let e=5;e>=0;e--)t[e]=n%256,n=Math.floor(n/256);return t[6]=15&t[6]|112,t[8]=63&t[8]|128,i0(t)}function i0(e){let t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function i1(e){let t,n=(t=new Map(e.pages.map(e=>[e.ref.objectNumber,e.boxes.crop])),e=>{let n=t.get(e.objectNumber);if(!n)throw new N(G.InvalidArg,`No page ${e.objectNumber} in this document`);return n});return{...e,pages:e.pages.map(e=>(function(e,t){var n;let r,{actions:i,viewports:o,...a}=e;return{...a,boxes:(r=(n=e.boxes).crop,{media:nE(n.media,r),crop:nE(n.crop,r),bleed:nE(n.bleed,r),trim:nE(n.trim,r),art:nE(n.art,r)}),...i?{actions:nJ(i,e=>nW(e,t))}:{},...o?{viewports:n0(o,e.boxes.crop)}:{}}})(e,n))}}function i3(e,t){return e.map(e=>({...e,rect:nE(e.rect,t)}))}function i2(e,t){let{actions:n,...r}=e,i=t(e.page);return{...r,...e.rect?{rect:nA(e.rect,i)}:{},...e.box?{box:nA(e.box,i)}:{},...n?{actions:nZ(n,e=>nq(e,t))}:{}}}function i6(e,t){return e.widgets?{...e,widgets:e.widgets.map(e=>i2(e,t))}:e}function i5(e,t){var n,r;return e.actions?{...e,actions:(n=e.actions,r=t,nJ(n,e=>nW(e,r)))}:e}function i4(e,t){return n6(e,t(e.page),t)}function i8(e,t){return{...e,fields:e.fields.map(e=>i5(e,t)),widgets:e.widgets.map(e=>i4(e,t))}}function i7(e,t){let{target:n,...r}=e;return void 0===n?r:{...r,target:n&&"goto"===n.kind?{...n,destination:t(n.destination)}:n}}function i9(e,t){var n;return n=e=>nW(e,t),{...e,target:e.target&&nH(e.target,n),action:e.action&&nK(e.action,n)}}function oe(e,t){return i7(e,e=>nq(e,t))}function ot(e){let{box:t,rect:n,rotation:r,...i}=e;if(void 0!==r&&![0,90,180,270].includes(r))throw new N(G.InvalidArg,`a widget turns by a quarter turn (0, 90, 180 or 270), not ${r}`,{details:{field:"rotation"}});let o=t?eJ(eH(t),r??0):n;if(!o)throw new N(G.InvalidArg,"a widget\'s placement needs its `rect` or its `box`",{details:{field:"rect"}});return{...i,rect:o,...void 0!==r?{rotation:r}:{},...t7(i.borderStyle,i.dashArray)?{dashArray:[...t8]}:{}}}var on=["certificates","ocspResponses","crls"];function or(e,t,n){let r=t;if(r>=n)return null;let i=e[r++];if((31&i)==31)for(;;){if(r>=n)return null;if((128&e[r++])==0)break}if(r>=n)return null;let o=e[r++],a=o;if(128&o){let t=127&o;if(0===t||t>4||r+t>n)return null;a=0;for(let n=0;nn?null:{constructed:(32&i)!=0,contents:r,end:s}}function oi(e){let t=new oo(e),n=t.value();if(t.skipSpaces(),!t.atEnd())throw Error(`trailing input at ${t.pos}: ${e.slice(t.pos,t.pos+20)}`);return n}var oo=class{constructor(e){this.text=e,I(this,"pos",0)}atEnd(){return this.pos>=this.text.length}skipSpaces(){for(;this.pos>",this.pos))return this.pos+=2,e;if("/"!==this.text[this.pos])throw Error(`expected a key at ${this.pos}`);let t=this.name();this.skipSpaces(),e[t]=this.value()}}stream(){let e=/^stream\\((\\d+),([0-9a-fA-F]*)\\)/.exec(this.text.slice(this.pos));if(!e)throw Error(`malformed stream signature at ${this.pos}`);this.pos+=e[0].length;let t=this.dictEntries();return{t:"stream",length:Number(e[1]),sha256:e[2].toLowerCase(),dict:t}}array(){this.expect("[");let e=[];for(;;){if(this.skipSpaces(),"]"===this.text[this.pos])return this.pos++,{t:"array",items:e};e.push(this.value())}}name(){this.expect("/");let e="";for(;this.pos"===t||"("===t||")"===t)break;if("#"===t&&/^[0-9A-Fa-f]{2}/.test(this.text.slice(this.pos+1,this.pos+3))){e+=String.fromCharCode(parseInt(this.text.slice(this.pos+1,this.pos+3),16)),this.pos+=3;continue}e+=t,this.pos++}return e}literalString(){this.expect("(");let e=1,t="";for(;this.pos",this.pos);if(e<0)throw Error("unterminated hex string");let t=this.text.slice(this.pos,e).replace(/\\s+/g,"");this.pos=e+1;let n="";for(let e=0;e`/${t} ${os(e.entries[t])}`).join("")}>>`;case"stream":return`stream(${e.length},${e.sha256})${os({t:"dict",entries:e.dict})}`;case"array":return`[${e.items.map(os).join(" ")}]`;case"ref":return`${e.num} 0 R`;case"name":return`/${function(e){let t="";for(let n of e){let e=n.charCodeAt(0);e<33||e>126||"#/[]<>(){}%".includes(n)?t+=`#${e.toString(16).toUpperCase().padStart(2,"0")}`:t+=n}return t}(e.v)}`;case"string":return`(${e.v.replace(/[\\\\()]/g,e=>`\\\\${e}`)})`;case"number":return String(e.v);case"bool":return e.v?"true":"false";case"null":return"null"}}function ol(e){return e?"dict"===e.t?e.entries:"stream"===e.t?e.dict:null:null}function ou(e,t){let n=ol(e)??{},r=ol(t)??{},i=new Set;for(let e of new Set([...Object.keys(n),...Object.keys(r)]))oa(n[e]??null,r[e]??null)||i.add(e);return i}function od(e){return e?"ref"===e.t?[e.num]:"array"===e.t?e.items.flatMap(od):[]:[]}function oc(e,t){return e.some(e=>"forbidden"===e.verdict)?"forbidden":e.some(e=>"incomplete"===e.verdict)?"indeterminate":t?"permitted":"unchanged"}function of(e){return e.find(e=>"forbidden"===e.verdict)??e.find(e=>"incomplete"===e.verdict)??e.find(e=>"permitted"===e.verdict)}var om=["old","new"],op=new Set(["Size","Prev","XRefStm","Info","ID","Root","Type","W","Index","Filter","DecodeParms","Length","Encrypt"]),oh=new Set(["Metadata","Extensions","Version","DSS","AcroForm","Perms"]),oF=new Set(["DR","DA","Q","SigFlags","NeedAppearances","Fields"]),og={annotate:new Set(["V","AS","AP","I","DA","Ff","RV","MK","Q","TU","F","Rect","BS","Opt","DV","MaxLen"]),fill:new Set(["V","AS","AP","I","RV","DA","Ff"])},o_={annotate:new Set(["AS","AP","DA","MK","Q","TU","F","Rect","BS"]),fill:new Set(["AS","AP","DA"])},oP={annotate:new Set(["V","AP","AS","Ff","TU","Lock"]),fill:new Set(["V","AP","AS","Ff"])},oD=new Set(["AP","AS"]);function ob(e){return"annotate"===e?oP.annotate:oP.fill}var oy=new Set(["identical-rewrite","orphan","xref-container","trailer"]);function ow(e){let t,n=e.changes.map(e=>{if(e.value.truncated||"xref"===e.kind||"objstm"===e.kind)return e;let t=e.present.old&&(null===e.value.old||e.read?.old==="failed"),n=e.present.new&&(null===e.value.new||e.read?.new==="failed");return t||n?{...e,value:{...e.value,truncated:!0}}:e}),{level:r,locks:i}=e.restrictions??{level:(t=iM(e.before.signatures)).judged??"annotate",locks:t.fieldLocks},o=e.levelOverride??r,a=new oS({...e,changes:n},o,i);(function(e){let t=e.input.health;if(!t)return;let n=t.old;if(n.sparseXref||n.bareReferences>0){let t=[n.sparseXref?"its cross-reference table has no entry for some object numbers below /Size":null,n.bareReferences>0?`${n.bareReferences} reachable indirect object(s) consist of a bare reference`:null].filter(e=>null!==e).join("; ");e.findings.push({rule:"base-unverifiable",verdict:"incomplete",objectNumber:0,detail:`the signed revision cannot be verified against later changes by Acrobat (${t}); no verdict is given rather than one Acrobat would contradict`})}for(let n of om)t[n].referrersComplete||e.findings.push({rule:"unexplained",verdict:"incomplete",objectNumber:0,detail:`the ${"old"===n?"older":"newer"} revision\'s reachability walk hit its budget; not every use of a changed object is known`})})(a),function(e){for(let t of e.changes)("xref"===t.kind||"objstm"===t.kind)&&(e.claimAll(t,"xref-container"),e.permitted(t,"xref-container","cross-reference container; members are judged on their own"))}(a),function(e){for(let t of e.changes)e.isIdentical(t)&&(e.allows("fill")?(e.claimAll(t,"identical-rewrite"),e.permitted(t,"identical-rewrite","written again with the sealed value")):(e.claimAll(t,"identical-rewrite",!1),e.forbidden(t,"identical-rewrite",`written again with the sealed value under level \'${e.level}\' (not established for this level)`)))}(a),a.allows("fill")?(function(e){if(0===e.locks.length)return;let t=e.input.before.fields.filter(t=>e.locks.some(e=>ij(e.spec,t.name))),n=new Set;for(let e of t)for(let t of(n.add(e.objectNumber),e.widgets))n.add(t);let r=new Set(n),i=!0;for(;i;)for(let t of(i=!1,e.changes))!r.has(t.objectNumber)&&t.usage.old.length>0&&t.usage.old.every(e=>r.has(e.parent))&&(r.add(t.objectNumber),i=!0);for(let n of e.changes){if(!r.has(n.objectNumber)||e.isIdentical(n))continue;let i=t.find(e=>e.objectNumber===n.objectNumber||e.widgets.includes(n.objectNumber));if(i&&i.objectNumber===n.objectNumber){let t=ou(n.value.old,n.value.new);if(1===t.size&&t.has("Ff")&&oj(n,e.before.fieldByObj.get(n.objectNumber)?.flags)){e.claimStable(n,"field-lock"),e.permitted(n,"field-lock",`ReadOnly set on locked field "${i.name}"`);continue}}e.locked.add(n.objectNumber),e.forbidden(n,"field-lock",i?`field "${i.name}" is locked by the signature`:"part of a locked field changed")}}(a),ok(a),function(e){for(let t of e.changes)!e.isIdentical(t)&&0!==t.objectNumber&&ox(t,e=>0===e.parent&&"Info"===e.label)&&(e.claimAll(t,"info"),e.permitted(t,"info","document information dictionary"))}(a),function(e){let t=new Set([e.input.before.root,e.input.after.root]);for(let n of e.changes)!e.isIdentical(n)&&ox(n,e=>t.has(e.parent)&&"Metadata"===e.label)&&(e.claimAll(n,"metadata"),e.permitted(n,"metadata","XMP metadata stream"))}(a),function(e){let t=e.input.after.root,n=e.byNum.get(t);if(!n||e.isIdentical(n))return;let r=ou(n.value.old,n.value.new),i=[...r].filter(e=>!oh.has(e));if(i.length>0)return e.forbidden(n,"catalog-housekeeping",`catalog keys changed: ${i.join(", ")}`);if(r.has("AcroForm")&&!e.input.after.acroForm&&!e.input.before.acroForm){let r=oG(e,ol(n.value.old)?.AcroForm??null,ol(n.value.new)?.AcroForm??null);if(r)return e.forbidden(n,"acroform-housekeeping",r);for(let n of om)e.claimSubtree(n,new Set([t]),e=>e.startsWith("AcroForm/DR/"),"acroform-housekeeping")}if(r.has("Perms")){let t=iM(e.input.after.signatures),r=iM(e.input.before.signatures);if(!t.certification||null!==r.judged)return e.forbidden(n,"catalog-housekeeping","/Perms may only appear with the certification signature, in the first signed revision")}e.claimAll(n,"catalog-housekeeping"),e.permitted(n,"catalog-housekeeping")}(a),function(e){let t=e.input.after.acroForm||e.input.before.acroForm;if(!t)return;let n=e.byNum.get(t);if(!n||e.isIdentical(n))return;let r=oG(e,n.value.old,n.value.new);if(r)return e.forbidden(n,"acroform-housekeeping",r);for(let r of(e.claimAll(n,"acroform-housekeeping"),e.permitted(n,"acroform-housekeeping"),om))e.claimSubtree(r,new Set([t]),e=>e.startsWith("DR/"),"acroform-housekeeping")}(a),function(e){let t=new Set([e.input.before.root,e.input.after.root]);for(let n of om)e.claimSubtree(n,t,e=>"DSS"===e||e.startsWith("DSS/"),"dss");for(let n of e.changes)n.usage.new.some(e=>t.has(e.parent)&&"DSS"===e.label)&&!e.findings.some(e=>e.objectNumber===n.objectNumber)&&e.permitted(n,"dss","document security store")}(a),function(e){let t=oC(e);if(0===t.size)return;let n="signature-field-added";if(!e.allows("fill")){for(let r of t){let t=e.byNum.get(r);t&&e.forbidden(t,n,`a signature field was added under level \'${e.level}\'`)}return}let r=new Set;for(let i of t){let t=e.after.fieldByObj.get(i),o=e.byNum.get(i);for(let a of(o&&(e.claimAll(o,n),e.permitted(o,n,`new signature field "${t.name}"`)),t.widgets)){if(r.add(a),a===i)continue;let o=e.byNum.get(a);o&&(e.claimAll(o,n),e.permitted(o,n,`widget of new signature field "${t.name}"`))}}let i=oO(e);for(let t of e.after.pages){let o=e.byNum.get(t);if(!o||e.isIdentical(o))continue;let a=ou(o.value.old,o.value.new);if(1!==a.size||!a.has("Annots"))continue;let s=oI(e,i,o,"old"),l=oI(e,i,o,"new");if(!s||!l)continue;let u=oN(s.refs,l.refs);if(!u||!u.every(e=>r.has(e))||s.object!==l.object&&0===u.length)continue;e.claimAll(o,n),e.permitted(o,n,"page /Annots gained the new signature widget");let d=0!==s.object&&0!==l.object;for(let t of new Set([s.holder,l.holder]))t&&(e.claimAll(t,n),e.permitted(t,n,d?"page /Annots moved to another list object, with the new signature widget":"page /Annots moved into an object of its own, with the new signature widget"))}for(let t of i.keys()){let i=e.byNum.get(t);if("modified"!==i.change||e.isIdentical(i))continue;let o=oN(od(i.value.old),od(i.value.new));o&&o.length>0&&o.every(e=>r.has(e))&&(e.claimAll(i,n),e.permitted(i,n,"page /Annots, an object of its own, gained the new signature widget"))}for(let i of e.changes){if("dictionary"!==i.kind||e.isIdentical(i))continue;let o=ou(i.value.old,i.value.new);if(1!==o.size||!o.has("Kids"))continue;let a=function(e,t){let n=ol(e.value.old)?.[t],r=ol(e.value.new)?.[t],i=od(n),o=od(r);if(n&&"array"!==n.t||!r||"array"!==r.t||i.length>o.length)return null;for(let e=0;e0&&a.every(e=>t.has(e)||r.has(e))&&(e.claimAll(i,n),e.permitted(i,n,"field /Kids gained the new signature field"))}}(a),function(e){let t="signature-added",n=e.newlySigned();if(0===n.length)return;let r=oC(e),i=iM(e.input.before.signatures),o=iM(e.input.after.signatures),a=new Set,s=new Set;for(let{fieldObjectNumber:o,sig:l}of n){let n="timestamp"===l.kind?"lta":"fill";if(!e.allows(n)){let n=e.byNum.get(o);n&&e.forbidden(n,t,`a ${l.kind} was added under level \'${e.level}\'`);continue}if(l.catalogCertification&&null!==i.judged){let n=e.byNum.get(o);n&&e.forbidden(n,t,"a certification signature after another signature");continue}let u=e.after.fieldByObj.get(o);for(let e of(a.add(o),u?.widgets??[]))a.add(e);let d=r.has(o),c=null===i.judged?new Set([...ob(e.level),"Lock"]):ob(e.level),f=e.byNum.get(o);if(f&&d)e.permitted(f,t,`new field "${l.fieldName}" signed`);else if(f&&!e.isIdentical(f)){let n=ou(f.value.old,f.value.new),r=[...n].filter(e=>!c.has(e));r.length>0?(e.forbidden(f,t,`signature field keys changed: ${r.join(", ")}`),e.claimStable(f,t,!1)):n.has("Ff")&&!oj(f,e.before.fieldByObj.get(o)?.flags)?(e.forbidden(f,t,"signature field flags changed beyond ReadOnly"),e.claimStable(f,t,!1)):(e.claimStable(f,t),e.permitted(f,t,`field "${l.fieldName}" signed`))}for(let n of u?.widgets??[]){if(n===o||d)continue;let r=e.byNum.get(n);if(!r||e.isIdentical(r))continue;let i=[...ou(r.value.old,r.value.new)].filter(e=>!oD.has(e));if(i.length>0){e.forbidden(r,t,`signature widget keys changed: ${i.join(", ")}`),e.claimStable(r,t,!1);continue}e.claimStable(r,t),e.permitted(r,t,"signature widget appearance")}for(let n of e.changes){if("added"!==n.change)continue;let r=n.usage.new.filter(e=>e.parent===o&&"V"===e.label),i=n.usage.new.filter(e=>e.parent===o&&"Lock"===e.label),a=ol(n.value.new)?.Type;if(r.length>0){if((a?.t!=="name"||"Sig"!==a.v&&"DocTimeStamp"!==a.v)&&void 0!==a)continue;for(let r of n.usage.new)(r.parent===o&&"V"===r.label||"DocMDP"===r.label)&&e.claimEdge(n,"new",r,t);e.permitted(n,t,"signature value"),s.add(n.objectNumber)}else if(i.length>0){if(void 0!==a&&("name"!==a.t||"SigFieldLock"!==a.v))continue;for(let r of i)e.claimEdge(n,"new",r,t);e.permitted(n,t,"field lock installed with the signature")}}}if(o.certification&&null===i.judged){let n=e.input.after.root;for(let r of e.changes)"added"===r.change&&ox(r,e=>e.parent===n&&"Perms"===e.label)&&(e.claimAll(r,t),e.permitted(r,t,"certification permissions"))}for(let n of om)e.claimSubtree(n,a,e=>"AP"===e||e.startsWith("AP/"),t);s.size>0&&e.claimSubtree("new",s,()=>!0,t)}(a),function(e){let t="signature-appearance",n=e=>"AP"===e||e.startsWith("AP/"),r=new Set;for(let[n,i]of e.before.fieldByObj){let o=e.after.fieldByObj.get(n);if("signature"!==i.kind||o?.kind!=="signature"||e.before.signedFields.has(n)||e.after.signedFields.has(n))continue;let a=new Set([n,...i.widgets]);if(o.widgets.length!==i.widgets.length||o.widgets.some(e=>!a.has(e)))continue;let s=[...a].map(t=>e.byNum.get(t)).filter(t=>void 0!==t&&!e.isIdentical(t));if(0===s.length||s.some(t=>e.locked.has(t.objectNumber)))continue;let l=e=>[...ou(e.value.old,e.value.new)].filter(e=>"AP"!==e);if(s.some(e=>l(e).length>0)){for(let n of s){let r=l(n);0!==r.length&&(e.forbidden(n,t,`signature field "${i.name}", not signed, keys changed: ${r.join(", ")}`),e.claimStable(n,t,!1))}continue}for(let n of s)e.claimStable(n,t),e.permitted(n,t,`new appearance on signature field "${i.name}", not signed`);for(let e of a)r.add(e)}0!==r.size&&(e.claimSubtree("new",r,n,t,e=>"added"===e.change),e.claimSubtree("old",r,n,t,e=>"freed"===e.change))}(a),function(e){let t="form-fill",n="annotate"===e.level?og.annotate:og.fill,r="annotate"===e.level?o_.annotate:o_.fill,i=new Set,o=new Set;for(let[a,s]of new Map([...e.before.fieldByObj,...e.after.fieldByObj])){if("signature"===s.kind)continue;let l="pushbutton"===s.kind,u=e=>l&&function(e){let t=ol(e.value.old)?.MK??null,n=ol(e.value.new)?.MK??null;if(t&&"dict"!==t.t||n&&"dict"!==n.t)return!1;let r=ou(t,n);return r.size>0&&[...r].every(e=>"I"===e)}(e),d=e.byNum.get(a),c=s.widgets.filter(e=>e!==a).map(t=>e.byNum.get(t)).filter(Boolean),f=new Set([a,...s.widgets]),m=d||0!==c.length?[]:e.changes.filter(e=>om.some(t=>e.usage[t].some(e=>f.has(e.parent)&&oR(e.label)))&&om.every(t=>e.usage[t].every(e=>!oR(e.label)||f.has(e.parent))));if(!d&&0===c.length&&0===m.length)continue;if(!e.allows("fill")){for(let n of[d,...c,...m])n&&!e.isIdentical(n)&&e.forbidden(n,t,`form fill under level \'${e.level}\'`);continue}if(m.length>0){for(let n of m)e.permitted(n,t,`appearance of field "${s.name}" regenerated`);for(let e of(i.add(a),s.widgets))i.add(e);continue}let p=!0;if(d&&!e.isIdentical(d)){let r=ou(d.value.old,d.value.new),i=r.has("MK")&&u(d),o=[...r].filter(e=>!n.has(e)&&!("MK"===e&&i));if(o.length>0)e.forbidden(d,t,`field "${s.name}" keys changed: ${o.join(", ")}`),e.claimStable(d,t,!1),p=!1;else if(r.has("Ff")&&!oj(d,e.before.fieldByObj.get(a)?.flags))e.forbidden(d,t,`field "${s.name}" flags changed beyond adding ReadOnly`),e.claimStable(d,t,!1),p=!1;else{e.claimStable(d,t);let n=[...r].filter(e=>"V"!==e&&"AP"!==e&&"AS"!==e&&"I"!==e&&"RV"!==e&&!("MK"===e&&i));e.permitted(d,t,n.length>0?`field "${s.name}" ${r.has("V")||r.has("AS")?"filled, ":""}properties changed: ${n.join(", ")}`:i?`push button "${s.name}" image changed`:`field "${s.name}" filled`)}}for(let n of c){if(e.isIdentical(n))continue;let i=ou(n.value.old,n.value.new),o=i.has("MK")&&u(n),a=[...i].filter(e=>!r.has(e)&&!("MK"===e&&o));if(a.length>0){e.forbidden(n,t,`widget of "${s.name}" keys changed: ${a.join(", ")}`),e.claimStable(n,t,!1),p=!1;continue}e.claimStable(n,t),e.permitted(n,t,`widget of "${s.name}" ${o?"image":"appearance"}`)}if(p){for(let e of(i.add(a),s.widgets))i.add(e);if(l)for(let e of(o.add(a),s.widgets))o.add(e)}}for(let n of om)e.claimSubtree(n,i,(e,t)=>oR(e)||o.has(t)&&oM(e),t)}(a),function(e){let t="annotation",n=new Set([...e.before.pages,...e.after.pages]),r=new Set([...e.before.widgetToField.keys(),...e.after.widgetToField.keys()]),i=e=>{if(r.has(e.objectNumber))return!0;let t=ol(e.value.new??e.value.old)?.Subtype;return t?.t==="name"&&"Widget"===t.v},o=oO(e),a=[];for(let t of e.changes)"dictionary"!==t.kind||e.isIdentical(t)||[...t.usage.old,...t.usage.new].some(e=>n.has(e.parent)&&e.label.startsWith("Annots/")||o.has(e.parent)&&/^\\[\\d+\\]$/.test(e.label))&&!i(t)&&a.push(t);if(a.length,!e.allows("annotate")){for(let n of a)e.forbidden(n,t,`annotation change under level \'${e.level}\'`);return}let s=new Set;for(let n of a)e.claimAll(n,t),e.permitted(n,t,`${n.change} annotation`),s.add(n.objectNumber);for(let i of n){let n=e.byNum.get(i);if(!n||e.isIdentical(n)||e.findings.some(e=>e.objectNumber===i&&"signature-field-added"===e.rule&&"permitted"===e.verdict))continue;let a=ou(n.value.old,n.value.new);if(1===a.size&&a.has("Annots")){let i=oI(e,o,n,"old"),a=oI(e,o,n,"new"),s=[i?.holder,a?.holder].filter(e=>null!=e);if(!i||!a){for(let r of(e.claimAll(n,t,!1),s))e.claimAll(r,t,!1);e.forbidden(n,t,"page /Annots points at a list object this revision did not write, and that list could not be read: what it held cannot be compared");continue}if("widget"===oT(e,r,i.refs,a.refs)){e.forbidden(n,t,"page /Annots added or removed a form widget");continue}for(let r of(e.claimAll(n,t),e.permitted(n,t,"page /Annots changed"),s))e.claimAll(r,t),e.permitted(r,t,"page /Annots, an object of its own, changed")}}for(let n of o.keys()){let i=e.byNum.get(n);if(!("modified"!==i.change||e.isIdentical(i))&&!e.findings.some(e=>e.objectNumber===n&&"permitted"===e.verdict)){if("widget"===oT(e,r,od(i.value.old),od(i.value.new))){e.forbidden(i,t,"page /Annots added or removed a form widget");continue}e.claimAll(i,t),e.permitted(i,t,"page /Annots, an object of its own, changed")}}for(let n of om)e.claimSubtree(n,s,e=>"AP"===e||e.startsWith("AP/")||"Popup"===e||"IRT"===e,t)}(a)):(ok(a),function(e){let t="no-changes-certification";for(let n of e.changes)0!==n.objectNumber&&"xref"!==n.kind&&"objstm"!==n.kind&&(e.isIdentical(n)||(e.claimAll(n,t,!1),e.forbidden(n,t,`${n.change} after a certification that allows no changes: Acrobat reports the certification as altered (ISO 32000-2 allows validation data and document timestamps here, Acrobat does not)`)))}(a)),function(e){for(let t of e.changes){if(t.value.truncated){e.findings.push({rule:"unexplained",verdict:"incomplete",objectNumber:t.objectNumber,detail:"value too large to inspect"});continue}if(t.usageIncomplete){e.findings.push({rule:"unexplained",verdict:"incomplete",objectNumber:t.objectNumber,detail:"references could not be resolved within budget (depth, fan-out or total reads)"});continue}if(!e.locked.has(t.objectNumber)){for(let n of om)for(let r of t.usage[n])e.isClaimed(t,n,r)||e.forbidden(t,"unexplained",`${"old"===n?"was":"is"} referenced from object ${r.parent} at ${r.label} and no rule explains it`,r);0!==t.usage.old.length||0!==t.usage.new.length||e.findings.some(e=>e.objectNumber===t.objectNumber)||e.permitted(t,"orphan","referenced from nowhere reachable")}}}(a);let s=oc(a.findings,a.findings.some(e=>"permitted"===e.verdict&&!oy.has(e.rule)));return{older:e.older,newer:e.newer,levelInForce:o,locks:i,verdict:s,findings:a.findings,changes:n}}function oE(e){return"modified"===e.change&&!e.value.truncated&&e.read?.old!=="failed"&&e.read?.new!=="failed"&&null!==e.raw.old&&null!==e.raw.new&&e.raw.old===e.raw.new&&!e.streamDataChanged}function oA(e){let t=new Map,n=new Map,r=new Set;for(let i of e.fields)for(let e of(t.set(i.objectNumber,i),"signature"===i.kind&&r.add(i.objectNumber),i.widgets))n.set(e,i.objectNumber);let i=new Set;for(let t of e.signatures)t.signed&&"objectNumber"===t.field.kind&&i.add(t.field.objectNumber);return{fieldByObj:t,widgetToField:n,pages:new Set(e.pages),signedFields:i,sigFields:r}}function ov(e){return`${e.parent}:${e.label}`}var oS=class{constructor(e,t,n){for(let r of(this.input=e,this.level=t,this.locks=n,I(this,"findings",[]),I(this,"byNum",new Map),I(this,"unwritten",new Map),I(this,"before",void 0),I(this,"after",void 0),I(this,"claims",new Map),I(this,"locked",new Set),e.changes))this.byNum.set(r.objectNumber,r);for(let t of e.unwritten??[])this.byNum.has(t.objectNumber)||this.unwritten.set(t.objectNumber,t);this.before=oA(e.before),this.after=oA(e.after)}get changes(){return this.input.changes}allows(e){return iN(this.level,e)}claimEdge(e,t,n,r,i=!0){if(this.locked.has(e.objectNumber))return;let o=`${e.objectNumber}:${t}:${ov(n)}`;this.claims.has(o)||this.claims.set(o,{rule:r,allow:i})}claimAll(e,t,n=!0){for(let r of om)for(let i of e.usage[r])this.claimEdge(e,r,i,t,n)}claimStable(e,t,n=!0){let r=new Set(e.usage.old.map(ov)),i=new Set(e.usage.new.map(ov));for(let r of e.usage.old)i.has(ov(r))&&this.claimEdge(e,"old",r,t,n);for(let i of e.usage.new)r.has(ov(i))&&this.claimEdge(e,"new",i,t,n)}isClaimed(e,t,n){return this.claims.has(`${e.objectNumber}:${t}:${ov(n)}`)}isAllowed(e,t,n){return this.claims.get(`${e.objectNumber}:${t}:${ov(n)}`)?.allow===!0}permitted(e,t,n){this.locked.has(e.objectNumber)||this.findings.push({rule:t,verdict:"permitted",objectNumber:e.objectNumber,detail:n})}forbidden(e,t,n,r){this.findings.push({rule:t,verdict:e.value.truncated?"incomplete":"forbidden",objectNumber:e.objectNumber,edge:r?ov(r):void 0,detail:e.value.truncated?`${n} (judged on missing evidence: not proven)`:n})}claimSubtree(e,t,n,r,i=()=>!0){let o=new Set,a=!0;for(;a;)for(let s of(a=!1,this.changes)){if(t.has(s.objectNumber)||o.has(s.objectNumber)||this.locked.has(s.objectNumber)||!i(s))continue;let l=s.usage[e];if(0===l.length)continue;let u=l.filter(e=>t.has(e.parent)&&n(e.label,e.parent)||o.has(e.parent));if(0!==u.length){for(let t of u)this.claimEdge(s,e,t,r);l.every(t=>u.includes(t)||this.isAllowed(s,e,t))&&(o.add(s.objectNumber),a=!0)}}}isIdentical(e){return oE(e)}newlySigned(){let e=[];for(let t of this.input.after.signatures)t.signed&&"objectNumber"===t.field.kind&&(this.before.signedFields.has(t.field.objectNumber)||e.push({fieldObjectNumber:t.field.objectNumber,sig:t}));return e}};function ok(e){let t=e.byNum.get(0);if(!t)return;let n=ou(t.value.old,t.value.new),r=[...n].filter(e=>!op.has(e)),i=ol(t.value.old)?.Root,o=ol(t.value.new)?.Root;r.length>0?e.forbidden(t,"trailer",`trailer keys changed: ${r.join(", ")}`):n.has("Root")&&!oa(i??null,o??null)?e.forbidden(t,"trailer","the trailer points at a different catalog"):n.has("Encrypt")&&!oa(ol(t.value.old)?.Encrypt??null,ol(t.value.new)?.Encrypt??null)?e.forbidden(t,"trailer","the trailer points at a different encryption dictionary"):(e.claimAll(t,"trailer"),e.permitted(t,"trailer"))}function ox(e,t){let n=[...e.usage.old,...e.usage.new];return n.length>0&&n.every(t)}function oG(e,t,n){let r=ou(t,n),i=[...r].filter(e=>!oF.has(e));if(i.length>0)return`AcroForm keys changed: ${i.join(", ")}`;if(r.has("Fields")){let r=od(ol(t)?.Fields),i=od(ol(n)?.Fields);if(r.length>i.length||r.some((e,t)=>i[t]!==e))return"/AcroForm /Fields is not append-only";let o=oC(e),a=i.slice(r.length).filter(e=>!o.has(e));if(a.length>0)return`/AcroForm /Fields gained non-signature fields: ${a.join(", ")}`}return null}function oO(e){let t=new Set([...e.before.pages,...e.after.pages]),n=new Map;for(let r of e.changes){if("array"!==r.kind||r.value.truncated)continue;let e=[...r.usage.old,...r.usage.new];0!==e.length&&e.every(e=>t.has(e.parent)&&"Annots"===e.label)&&1===new Set(e.map(e=>e.parent)).size&&[r.value.old,r.value.new].every(e=>null===e||"array"===e.t&&od(e).length===e.items.length)&&n.set(r.objectNumber,e[0].parent)}return n}function oI(e,t,n,r){let i=ol(n.value[r])?.Annots;if(!i)return{refs:[],object:0,holder:null};if("array"===i.t)return{refs:od(i),object:0,holder:null};if("ref"!==i.t)return null;let o=e.byNum.get(i.num);if(!o){let t=e.unwritten.get(i.num);if(!t||"ok"!==t.read||t.value?.t!=="array")return null;let n=od(t.value);return n.length!==t.value.items.length?null:{refs:n,object:i.num,holder:null}}if(t.get(o.objectNumber)!==n.objectNumber)return null;let a=o.value[r];return a?{refs:od(a),object:o.objectNumber,holder:o}:null}function oN(e,t){if(e.length>t.length)return null;for(let n=0;n"MK/I"===e||e.startsWith("MK/I/"),oR=e=>"AP"===e||e.startsWith("AP/");function oT(e,t,n,r){return[...n.filter(e=>!r.includes(e)),...r.filter(e=>!n.includes(e))].some(n=>t.has(n)&&!e.findings.some(e=>e.objectNumber===n&&"permitted"===e.verdict))?"widget":"annotations"}var oB={maxDepth:16,maxEdgesPerObject:256,maxReads:2e4},oL="incomplete",o$=class{constructor(e,t,n=oB){this.read=e,this.anchors=t,this.budget=n,I(this,"referrers",new Map),I(this,"resolved",new Map),I(this,"reads",0),I(this,"exhausted",!1)}resolve(e){if(!this.resolved.has(e)){for(let t of this.componentsAbove(e)??[])if(!this.resolveComponent(t))break}return this.resolved.get(e)??"incomplete"}readReferrers(e){let t=this.referrers.get(e);if(t)return t;if(this.exhausted||this.reads>=this.budget.maxReads)return this.exhausted=!0,null;this.reads+=1;let n=this.read(e);return this.referrers.set(e,n),n}pendingParents(e){let t=new Set;for(let n of e)this.anchors.has(n.parent)||this.resolved.has(n.parent)||t.add(n.parent);return[...t]}componentsAbove(e){let t=new Map,n=new Map,r=[],i=new Set,o=[],a=[],s=e=>{let a=this.readReferrers(e);return!!a&&(t.set(e,t.size),n.set(e,t.get(e)),r.push(e),i.add(e),o.push({node:e,parents:this.pendingParents(a),next:0}),!0)};if(!s(e))return null;for(;o.length>0;){let e=o[o.length-1];if(e.next0){let e=o[o.length-1].node;n.set(e,Math.min(n.get(e),n.get(l)))}if(n.get(l)===t.get(l)){let e,t=[];do e=r.pop(),i.delete(e),t.push(e);while(e!==l)a.push(t)}}return a}resolveComponent(e){let t=new Set(e),n=1===e.length?this.edgesOfSingle(e[0]):this.edgesOfLoop(e,t);if(!n){for(let t of e)this.resolved.set(t,null);return!1}for(let t of e)this.resolved.set(t,n.get(t));return!0}edgesOfSingle(e){let t=[];for(let n of this.referrers.get(e)){if(n.parent===e)continue;let r=this.through(n);if(!r)return null;t.push(...r)}let n=oV(t);return n.length>this.budget.maxEdgesPerObject?null:new Map([[e,n]])}edgesOfLoop(e,t){let n=new Map,r=new Map;for(let i of e){let e=[];for(let n of this.referrers.get(i)){if(t.has(n.parent))continue;let o=this.through(n);if(!o)return null;for(let t of o){e.push(t);let n=[...t.via??[],i];if(n.length>=this.budget.maxDepth)return null;let o={parent:t.parent,label:`${t.label}/\\u2026`,via:n},a=r.get(oz(o));a?1===a.length&&oU(a[0])!==i&&a.push(o):r.set(oz(o),[o])}if(e.length>this.budget.maxEdgesPerObject)return null}e.length>0&&n.set(i,oV(e))}if(r.size>this.budget.maxEdgesPerObject)return null;let i=new Map,o=[...r.values()].map(e=>e[0]);for(let t of e){let e=n.get(t);if(!e){i.set(t,o);continue}let a=[];for(let e of r.values()){let n=e.find(e=>oU(e)!==t);n&&a.push(n)}let s=[...e,...a];if(s.length>this.budget.maxEdgesPerObject)return null;i.set(t,s)}return i}through(e){if(this.anchors.has(e.parent))return[e];let t=this.resolved.get(e.parent);if(!t)return null;let n=[];for(let r of t){let t=[...r.via??[],e.parent];if(t.length>=this.budget.maxDepth)return null;n.push({parent:r.parent,label:`${r.label}/${e.label}`,via:t})}return n}};function oz(e){return`${e.parent}:${e.label}`}function oU(e){return e.via[e.via.length-1]}function oV(e){let t=new Set;return e.filter(e=>{if(!e.label.includes("\\u2026"))return!0;let n=oz(e);return!t.has(n)&&(t.add(n),!0)})}var oW=/\\s/,oq=/\\s/g,oH=(e,t)=>{let n=e.charCodeAt(t);return n>=56320&&n<=57343},oK=new Set([G.InvalidArg,G.NotFound,G.Forbidden,G.ProtectedDocument,G.MalformedPdf,G.PayloadTooLarge,G.ObjectNumberUnavailable,G.LayerFull,G.ChangeConflict,G.UndoUnavailable]);function oZ(e){let t=function e(t){if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){let e=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return JSON.stringify({$bytes:`${e.byteLength.toString(36)}-${function(e){let t=0xdeadbeef,n=0x41c6ce57;for(let r of e)t=Math.imul(t^r,0x9e3779b1),n=Math.imul(n^r,0x5f356495);return oJ(t,n)}(e)}`})}return Array.isArray(t)?`[${t.map(e).join(",")}]`:null!==t&&"object"==typeof t?`{${Object.entries(t).filter(([,e])=>void 0!==e).sort(([e],[t])=>et)).map(([t,n])=>`${JSON.stringify(t)}:${e(n)}`).join(",")}}`:JSON.stringify(t)??"null"}(e);return`${t.length.toString(36)}-${function(e){let t=0xdeadbeef,n=0x41c6ce57;for(let r=0;r>>16,0x85ebca6b)^Math.imul(t^t>>>13,0xc2b2ae35),(0x100000000*(2097151&(t=Math.imul(t^t>>>16,0x85ebca6b)^Math.imul(e^e>>>13,0xc2b2ae35)))+(e>>>0)).toString(36)}function oQ(e,t){oY(e,t);let{grants:n,protection:r}=e;if(n&&!iW(t,n.scope,n.permissionFlags,r))throw new na(t,"target")}function oX(e,t){let{grants:n,protection:r}=e;return!(r&&iR(r).has(t))&&(!n||iW(t,n.scope,n.permissionFlags,r))}function oY(e,t){let{protection:n}=e;if(n&&iR(n).has(t))throw new N(G.ProtectedDocument,`the document is signed: ${n.certification?`certification signature ${n.certification.signatureIndex} (permission ${n.certification.permission})`:`an existing signature (declared level \'${n.enforced??"none declared"}\')`} forbids \'${t}\'`)}function o0(e){return"widget"===e?"doc.forms.modify":"doc.annotate.modify"}function o1(e){return[...new Set(e.map(e=>o0(e.subtype)))]}function o3(e,t){let{identity:n,grants:r}=e;if(r&&!iW("doc.forms.modify",r.scope,r.permissionFlags))throw new na("doc.forms.modify","target");if("string"==typeof t)throw new N(G.InvalidArg,"a widget has no group of its own: a form field\'s group is the field\'s");let i={...void 0!==n.userId?{userId:n.userId}:{},...void 0!==n.displayName?{displayName:n.displayName}:{}};return i.userId||i.displayName?i:void 0}function o2(e,t,n){if("widget"===t)return o3(e,n);let{identity:r,grants:i}=e;if(null===n&&void 0!==r.groupId)throw new N(G.InvalidArg,"your annotations have a group: leave groupId out for your own, or name another",{details:{field:"groupId"}});let o=void 0===n?r.groupId:n??void 0;if(i){if(void 0!==o&&!iK("annotations",o,r.groupId,i.scope))throw new na(`annotations:set-group:group=${o}`,"target");if(!iq("create",iV({userId:r.userId,groupId:o}),i.scope,r,i.permissionFlags))throw new na("annotations:create","target")}let a={...void 0!==r.userId?{userId:r.userId}:{},...void 0!==o?{groupId:o}:{},...void 0!==r.displayName?{displayName:r.displayName}:{}};return a.userId||a.groupId||a.displayName?a:void 0}function o6(e,t,n){if("widget"===t.subtype)return o3(e,n);let{identity:r,grants:i}=e,o=iV(t);if(i&&!iq("update",o,i.scope,r,i.permissionFlags))throw new na("annotations:update","target");if(null===n&&void 0!==o.groupId)throw new N(G.InvalidArg,"an annotation\'s group can\'t be removed");let a="string"==typeof n&&n!==o.groupId;if(a&&i&&!iK("annotations",n,r.groupId,i.scope))throw new na(`annotations:set-group:group=${n}`,"target");let s={...void 0!==r.userId?{userId:r.userId}:{},...void 0!==r.displayName?{displayName:r.displayName}:{},...a?{groupId:n}:{}};return s.userId||s.groupId||s.displayName?s:void 0}function o5(e,t){let{identity:n,grants:r}=e;if(!r)return;let i=iW("doc.forms.modify",r.scope,r.permissionFlags),o=t.filter(e=>"widget"===e.subtype?!i:!iq("delete",iV(e),r.scope,n,r.permissionFlags));if(o.length>0)throw new na("annotations:delete","target",void 0,o.map(e=>e.ref))}function o4(e,t,n){if(oY(e,o9(n)),!o8(e,t,n)){let e="string"==typeof t||null===t?t:Y(t);throw new na(null===e?o9(n):`fields:${n}:group=${e}`,"target")}}function o8(e,t,n){let{grants:r,protection:i}=e;return!(i&&iR(i).has(o9(n)))&&(!r||function(e,t,n,r,i=null){let o=null!==t&&"object"==typeof t?t:X(t);if("anyone"===o.kind)return iZ(e,n,r,i);let a="group"===o.kind?o.groupId:null,s="fill"===e?"doc.forms.fill":"doc.sign";if(iR(i).has(s))return!1;let l=n.map(iB);if(l.some(e=>"wildcard"===e.kind))return!0;let u=l.filter(t=>"collab"===t.kind&&"fields"===t.entity&&(t.action===e||"*"===t.action));return u.length>0?u.some(e=>"all"===e.filter.kind||null!==a&&e.filter.groupId===a):iH(l,r,i).has(s)}(n,t,r.scope,r.permissionFlags,i))}function o7(e,t){if("group"===t.kind)return function(e,t){if(null===t)return;let{identity:n,grants:r}=e;if(r&&!iK("fields",t,n.groupId,r.scope))throw new na(`fields:set-group:group=${t}`,"target")}(e,t.groupId);if("unassigned"===t.kind)return;let{grants:n}=e;if(n&&!n.scope.map(iB).some(e=>"wildcard"===e.kind||"collab"===e.kind&&"fields"===e.entity&&("set-group"===e.action||"*"===e.action)&&"all"===e.filter.kind))throw new na("fields:set-group:all","target")}function o9(e){return"fill"===e?"doc.forms.fill":"doc.sign"}function ae(e,t){return"fqn"===t.kind?e.name===t.name:"objectNumber"===e.ref.kind&&e.ref.objectNumber===t.objectNumber}function at(e){if("signature"===e.kind)return{...e,valueEntry:{kind:"none"}};if(!e.noExport)return e;let t={...e,valueEntry:{kind:"none"},filledBy:null,filledByName:null,filledAt:null};switch(e.kind){case"text":case"combobox":return{...t,kind:e.kind,value:""};case"checkbox":return{...t,kind:"checkbox",checked:!1,widgets:e.widgets.map(e=>({...e,checked:!1}))};case"radio":return{...t,kind:"radio",value:"Off",widgets:e.widgets.map(e=>({...e,checked:!1}))};case"listbox":return{...t,kind:"listbox",selectedValues:[],options:e.options.map(e=>({...e,selected:!1}))};case"pushbutton":return{...t,kind:"pushbutton",hasImage:!1};default:return t}}Array.from({length:128},(e,t)=>({print:(1&t)!=0,modifyContents:(2&t)!=0,copy:(4&t)!=0,modifyAnnotations:(8&t)!=0,fillForms:(16&t)!=0,copyForAccessibility:!1,assemble:(32&t)!=0,printHighQuality:(64&t)!=0}));var an=["invisible","hidden","print","noZoom","noRotate","noView","readOnly","locked","toggleNoView","lockedContents"];function ar(e){return"scalar"===e.valueEntry.kind||"array"===e.valueEntry.kind}function ai(e){if(!eg(e.kind))return null;let t=eb(e.actions);return ev(t)?t:null}function ao(e,t,n){let r={},i=t?null:ai(e);for(let[o,a]of Object.entries(e.actions??{})){if(!a)continue;let s=U(a),l=`actions.${o}`;if(s)if(t)r[o]=s;else{if(i&&"format"===o||i&&"keystroke"===o&&function(e,t){let n=t?ew(t):null;if(null===n)return!1;let r=e_[e.kind];return"time"===e.kind?null!==eD(n,"time","",r.numberedKeystroke)||eD(n,"time",r.keystroke,"")===e.pattern:eD(n,"date",r.keystroke,r.numberedKeystroke)===e.pattern}(i,a))continue;n.push({ref:e.ref,field:l,reason:"script-not-allowed"})}else n.push({ref:e.ref,field:l,reason:"unsupported-action"})}return r}function aa(e,t){if("pushbutton"!==e.kind)return e;let n=rW(t.map(e=>e.actions));return e.takesImage===n?e:{...e,takesImage:n}}function as(e,t,n,r,i){let o={},a=!r&&"pushbutton"===e.kind&&e.takesImage&&rV(t.actions);for(let s of z){let l=t.actions?.[s];if(!l||a&&rU.includes(s))continue;let u=B(l),d=n=>i.push({ref:e.ref,widget:t.ref,field:`actions.${s}`,reason:n});u?!r&&R(u)?d("script-not-allowed"):o[s]=rL(u,n):d("unsupported-action")}let s="checkbox"===e.kind||"radio"===e.kind?e.widgets.find(e=>e.ref&&K(e.ref)===K(t.ref)):void 0,l={color:t.color,interiorColor:t.interiorColor,dashArray:t.dashArray,checkStyle:t.checkStyle,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,caption:"pushbutton"===e.kind?t.caption:null,layout:"pushbutton"===e.kind&&"caption"!==t.layout?t.layout:null};return{page:n(t.page),rect:t.rect,...t.rotation?{rotation:t.rotation}:{},strokeWidth:t.strokeWidth,borderStyle:t.borderStyle,textAlign:t.textAlign,...Object.fromEntries(Object.entries(l).filter(([,e])=>null!=e)),...s&&"exportValue"in s?{exportValue:s.exportValue}:{},...Object.keys(o).length>0?{actions:o}:{}}}function al(e){return Object.fromEntries(an.map(t=>[t,e[t]]))}function au(e,t,n,r,i){let o={name:t,readOnly:e.readOnly,required:e.required,noExport:e.noExport,...null!==e.alternateName?{alternateName:e.alternateName}:{},...null!==e.mappingName?{mappingName:e.mappingName}:{},assignment:e.assignment,...rC(e.purpose)?{purpose:e.purpose}:{},...eN(e.placeholder)?{placeholder:e.placeholder}:{},...Object.keys(n).length>0?{actions:n}:{},widgets:r},a=void 0===n.format?ai(e):null,s=a?{format:a}:{},l="none"!==e.defaultValueEntry.kind,u=e=>e.map(({label:e,value:t})=>({label:e,value:t}));switch(e.kind){case"text":return{...o,...s,kind:"text",...l?{defaultValue:e.defaultValue}:{},...null!==e.maxLength?{maxLength:e.maxLength}:{},multiline:e.multiline,password:e.password,comb:e.comb};case"radio":return{...o,kind:"radio",radiosInUnison:e.radiosInUnison,noToggleToOff:e.noToggleToOff};case"combobox":return{...o,...s,kind:"combobox",edit:e.edit,options:u(e.options),...l?{defaultValue:e.defaultValue}:{}};case"listbox":return{...o,kind:"listbox",multiSelect:e.multiSelect,options:u(e.options),...l?{defaultValue:e.defaultValue}:{}};case"pushbutton":{let t=r.every(e=>rU.every(t=>e.actions?.[t]===void 0)),n=e.takesImage&&r.length>0&&t;return{...o,kind:"pushbutton",...n?{takesImage:!0}:{}}}case"checkbox":case"signature":return{...o,kind:e.kind};default:throw new N(G.InvalidArg,`${i} has no family`)}}function ad(e){switch(e.kind){case"checkbox":return{checked:e.checked};case"listbox":return{selectedValues:e.selectedValues};case"radio":return{value:"Off"===e.value?null:e.value};case"text":case"combobox":return{value:e.value};default:return null}}function ac(e,t){if(e.has(t))return!0;for(let n of e)if(n.startsWith(`${t}.`)||t.startsWith(`${n}.`))return!0;return!1}function af(e,t){let n=e.lastIndexOf("."),r=e.slice(0,n+1),i=e.slice(n+1),o=/^(.*)_(\\d+)$/.exec(i),a=o?o[1]:i,s=o?Number(o[2])+1:2;for(;t(`${r}${a}_${s}`);)s+=1;return`${r}${a}_${s}`}function am(e,t){let n=new Set(t.widgets.flatMap(e=>e.ref?K(e.ref):[])),r=new Map;for(let t of e.widgets){let e=K(t.ref);n.has(e)&&r.set(e,t)}let i=t.widgets.flatMap(e=>{let t=e.ref?r.get(K(e.ref)):void 0;return t?[t]:[]}),o=i[0];return o?i.filter(e=>e.page.objectNumber===o.page.objectNumber):[]}var ap=e=>"pushbutton"===e.kind&&e.takesImage?"fields":"boxes",ah=e=>(e%360+360)%360;function aF(e,t,n){let r=e?.[t];if(void 0!==r&&!(n<=r))throw new N(G.PayloadTooLarge,`repeat: past the ${t} limit: ${n} > ${r}`,{details:{limit:t,max:r,value:n}})}var ag=e=>"truetype"===e||"opentype"===e,a_=e=>"installable"===e||"editable"===e;function aP(e){return"whole"===e.embedded&&ag(e.format)&&e.mapsUnicode&&a_(e.permission)}function aD(e){return null!==e.displaySha256&&(null===e.permission||a_(e.permission))}function ab(e){let t=[];return"none"===e.embedded?t.push("type3"===e.format?"unsupported-format":"not-embedded"):("subset"===e.embedded&&t.push("subset"),ag(e.format)?e.mapsUnicode||t.push("no-unicode-map"):t.push("unsupported-format"),null===e.permission||a_(e.permission)||t.push("preview-and-print")),t}function ay(e){let t=aD(e);return{displaySha256:t?e.displaySha256:null,sourceSha256:"none"===e.embedded?null:e.sha256,embedded:e.embedded,format:"none"===e.embedded?null:e.format,embeddingPermission:"restricted"===e.permission||"bitmap-only"===e.permission?"preview-and-print":e.permission,canDownload:t}}var aw=e=>aP(e)?0:aD(e)?1:"none"!==e.embedded?2:3,aE={100:"Thin",200:"ExtraLight",300:"Light",400:"",500:"Medium",600:"SemiBold",700:"Bold",800:"ExtraBold",900:"Black"};function aA(e,t){if(t)return t;let n=`${aE[e.weight]??String(e.weight)}${e.italic?"Italic":""}`;return n?`${e.familyName},${n}`:e.familyName}function av(e){let t=new Map;for(let n of e)for(let e of n.programs){if(!e.postScriptName&&""===n.familyName)continue;let r=aA(n,e.postScriptName),i=t.get(r)??[];i.some(({program:t})=>e.objectNumber>0?t.objectNumber===e.objectNumber&&t.displaySha256===e.displaySha256:0===t.objectNumber&&t.embedded===e.embedded&&t.format===e.format&&t.sha256===e.sha256)||i.push({face:n,program:e}),t.set(r,i)}return[...t].map(([e,t])=>{let n=[...t].sort((e,t)=>aw(e.program)-aw(t.program)),{familyName:r,weight:i,italic:o}=n[0].face;return{name:e,face:{familyName:r,weight:i,italic:o},programs:n.map(({program:e})=>e)}})}function aS(e){return void 0!==eW[eV(e.face.familyName)]&&e.programs.every(e=>"none"===e.embedded)}function ak(e){let t=e.programs[0];return{name:e.name,source:"document",builtIn:!1,familyName:e.face.familyName,weight:e.face.weight,italic:e.face.italic,postScriptName:t?.postScriptName??null,canChoose:!!t&&aP(t),restrictions:t?ab(t):["not-embedded"],programs:e.programs.map(ay)}}function ax(e){let{identity:t}=e,n=[];return t.editingAuthorized||n.push("preview-and-print"),e.served||n.push("not-served"),{name:e.key,source:"engine",builtIn:e.builtIn,familyName:t.familyName,weight:t.weight,italic:t.italic,postScriptName:e.postScriptName,canChoose:t.editingAuthorized,restrictions:n,programs:[{displaySha256:e.sha256,sourceSha256:e.sha256,embedded:"none",format:e.format,embeddingPermission:t.embeddingPermission,canDownload:e.served}]}}function aG(e,t){let n=av(e.faces).find(e=>e.name===t&&!aS(e));if(!n)return;let r=n.programs[0];return r?{objectNumber:r.objectNumber,choosable:aP(r)&&r.objectNumber>0,restrictions:ab(r)}:{objectNumber:0,choosable:!1,restrictions:["not-embedded"]}}var aO={elsewhere:0,near:1,visible:2};function aI(e,t){let n=aO[e.place]-aO[t.place];return 0!==n?n>0:e.pixels>t.pixels}var aN=Object.freeze([]);function aC(e,t=aN){return{payload:e,transfer:t}}var aj=[{ts:"boolean",wasm:{kind:"bool",cwrap:"boolean"},native:{kind:"bool",cwrap:"boolean"}},{ts:"Ptr",wasm:{kind:"pointer",cwrap:"number"},native:{kind:"pointer",cwrap:"bigint"}},{ts:"string",wasm:{kind:"cstring",cwrap:"string"},native:{kind:"cstring",cwrap:"string"}},{ts:"number",wasm:{kind:"i32",cwrap:"number"},native:{kind:"i32",cwrap:"number"}},{ts:"Ptr",wasm:{kind:"cstring",cwrap:"number"},native:{kind:"cstring",cwrap:"bigint"}},{ts:"number",wasm:{kind:"f32",cwrap:"number"},native:{kind:"f32",cwrap:"number"}},{ts:"Ptr",wasm:{kind:"utf16ptr",cwrap:"number"},native:{kind:"utf16ptr",cwrap:"bigint"}},{ts:"bigint",wasm:{kind:"i64",cwrap:"bigint"},native:{kind:"i64",cwrap:"bigint"}},{ts:"number",wasm:{kind:"f64",cwrap:"number"},native:{kind:"f64",cwrap:"number"}}],aM=function(e){let t={};for(let n of e.split(`\n`)){if(!n)continue;let[e,r,...i]=n.split(" ");t[e]={params:i.map(e=>aj[Number(e)]),result:"-"===r?null:aj[Number(r)]}}return t}(`\nEPDF_CheckPasswordPermissions 0 1 2 1 1 1 1\nEPDF_DigestBuffer 0 1 3 3 4 1\nEPDF_FreeBuffer - 1\nEPDF_GetDecodedImageBytes 3\nEPDF_GetMetaKeyCount 3 1 0\nEPDF_GetMetaKeyName 3 1 3 0 1 3\nEPDF_GetMetaTrapped 3 1\nEPDF_GetPageBoxByIndex 0 1 3 3 1\nEPDF_GetPageRotateByIndex 0 1 3 1\nEPDF_GetPageTabOrderByIndex 3 1 3 1 3\nEPDF_GetPageUserUnitByIndex 0 1 3 1\nEPDF_HasMetaText 0 1 2\nEPDF_InitThread -\nEPDF_IsEncrypted 0 1\nEPDF_IsOwnerUnlocked 0 1\nEPDF_LoadBaseDocument 1 1 2\nEPDF_LoadMemBaseDocument 1 1 3 2\nEPDF_LoadMemBaseDocument64 1 1 3 2\nEPDF_LoadPageNormalized 1 1 3 1\nEPDF_PNG_EncodeRGBA 3 4 3 3 3 3 4\nEPDF_ReleaseBaseDocument - 1\nEPDF_RemoveEncryption 0 1\nEPDF_RenderAnnotBitmap 0 1 1 1 3 2 1 3\nEPDF_RenderAnnotBitmapUnrotated 0 1 1 1 3 2 5 1 1 3\nEPDF_RenderPage_Continue 3 1 3\nEPDF_RenderPageBitmapWithMatrix_Start 3 1 1 1 1 3 3\nEPDF_SaveAsCopyEx 0 1 1 3 1\nEPDF_SaveDocumentToOwnedBuffer 1 1 3 1\nEPDF_SaveDocumentToOwnedBufferEx 1 1 3 3 1 1\nEPDF_SaveDocumentToOwnedBufferWithVersion 1 1 3 1 3\nEPDF_SetBaseDocumentSha256 - 1 4\nEPDF_SetDecodedImageBudget - 3\nEPDF_SetEncryption 0 1 2 2 3\nEPDF_SetMetaText 0 1 2 1\nEPDF_SetMetaTrapped 0 1 3\nEPDF_SetRuntimeOwnerPermissions 0 1 0\nEPDF_ShutdownThread -\nEPDF_UnlockOwnerPermissions 0 1 2\nEPDFAction_CloseModel - 1\nEPDFAction_CreateGoTo 1 1 1\nEPDFAction_CreateGoToNamed 1 1 2\nEPDFAction_CreateHide 1 1 1 3 0\nEPDFAction_CreateJavaScript 1 1 1\nEPDFAction_CreateLaunch 1 1 1\nEPDFAction_CreateNamed 1 1 2\nEPDFAction_CreateRemoteGoToByName 1 1 1 1\nEPDFAction_CreateRemoteGoToDest 1 1 1 1\nEPDFAction_CreateResetForm 1 1 1 3 0\nEPDFAction_CreateSubmitForm 1 1 1 1 3 3\nEPDFAction_CreateURI 1 1 2\nEPDFAction_GetNextAt 3 1 3 3\nEPDFAction_GetNextCount 3 1 3\nEPDFAction_GetNodeCount 3 1\nEPDFAction_GetNodeDest 1 1 1 3\nEPDFAction_GetNodeFilePath 3 1 3 1 3\nEPDFAction_GetNodeHideFlag 0 1 3 1\nEPDFAction_GetNodeJavaScript 3 1 3 6 3\nEPDFAction_GetNodeName 3 1 3 1 3\nEPDFAction_GetNodeResetForm 0 1 3 1 1\nEPDFAction_GetNodeSubmitForm 0 1 3 1 1\nEPDFAction_GetNodeSubmitFormCharSet 3 1 3 1 3\nEPDFAction_GetNodeSubmitFormURL 3 1 3 1 3\nEPDFAction_GetNodeSubtype 3 1 3 4 3\nEPDFAction_GetNodeTargetCount 3 1 3\nEPDFAction_GetNodeTargetName 3 1 3 3 1 3\nEPDFAction_GetNodeTargetObjectNumber 0 1 3 3 1\nEPDFAction_GetNodeType 3 1 3\nEPDFAction_GetNodeURI 3 1 1 3 1 3\nEPDFAction_GetNodeURIIsMap 0 1 3 1\nEPDFAction_GetRootNode 3 1\nEPDFAction_GetWarningFlags 3 1\nEPDFAction_IsComplete 0 1\nEPDFAction_LoadModel 1 1\nEPDFAction_NodeHasJavaScript 0 1 3\nEPDFAction_SetNext 0 1 1 1 3\nEPDFAnnot_AddMeasure 1 1\nEPDFAnnot_ClearBorderEffect 0 1\nEPDFAnnot_ClearColor 0 1 3\nEPDFAnnot_ClearEmbedMetadata 0 1\nEPDFAnnot_ClearEmbedMetadataKey 0 1 2\nEPDFAnnot_ClearMKColor 0 1 3\nEPDFAnnot_ClearMKIcon 0 1 3\nEPDFAnnot_ClearRectangleDifferences 0 1\nEPDFAnnot_ExportAppearance 1 1 5 1\nEPDFAnnot_GenerateAppearance 0 1\nEPDFAnnot_GenerateAppearanceWithBlend 0 1 3\nEPDFAnnot_GenerateFormFieldAP 0 1\nEPDFAnnot_GetActionModel 1 1 3\nEPDFAnnot_GetAPMatrix 0 1 3 1\nEPDFAnnot_GetAppearanceState 3 1 1 3\nEPDFAnnot_GetAppearanceStateCount 3 1 3\nEPDFAnnot_GetAppearanceStateName 3 1 3 3 1 3\nEPDFAnnot_GetAppearanceTransform 0 1 1 1\nEPDFAnnot_GetAvailableAppearanceModes 3 1\nEPDFAnnot_GetBlendMode 3 1\nEPDFAnnot_GetBooleanValue 0 1 2 1\nEPDFAnnot_GetBorderDashPattern 0 1 1 3\nEPDFAnnot_GetBorderDashPatternCount 3 1\nEPDFAnnot_GetBorderEffect 0 1 1\nEPDFAnnot_GetBorderStyle 3 1 1\nEPDFAnnot_GetCalloutLine 3 1 1 3\nEPDFAnnot_GetCalloutLineCount 3 1\nEPDFAnnot_GetColor 0 1 3 1 1 1\nEPDFAnnot_GetDefaultAppearance 0 1 1 1 1 1 1\nEPDFAnnot_GetDefaultAppearanceFontFace 3 1 6 3 1 1\nEPDFAnnot_GetDefaultAppearanceFontPostScriptName 3 1 4 3\nEPDFAnnot_GetDrawing 3 1\nEPDFAnnot_GetDrawingRect 0 1 3 1\nEPDFAnnot_GetEmbedMetadataBoolean 0 1 2 1\nEPDFAnnot_GetEmbedMetadataJSON 3 1 6 3\nEPDFAnnot_GetEmbedMetadataNumber 0 1 2 1\nEPDFAnnot_GetEmbedMetadataRect 0 1 2 1\nEPDFAnnot_GetEmbedMetadataString 3 1 2 6 3\nEPDFAnnot_GetFileAttachmentForWrite 1 1\nEPDFAnnot_GetIntent 3 1 6 3\nEPDFAnnot_GetLineCaption 0 1 1 1 1\nEPDFAnnot_GetLineEndings 0 1 1 1\nEPDFAnnot_GetLineLeader 0 1 1 1 1\nEPDFAnnot_GetMeasure 1 1\nEPDFAnnot_GetMKColor 0 1 3 1 1 1\nEPDFAnnot_GetMKIcon 3 1 3\nEPDFAnnot_GetMKRotation 3 1\nEPDFAnnot_GetMKText 3 1 3 6 3\nEPDFAnnot_GetMKTextPosition 3 1\nEPDFAnnot_GetName 3 1 4 3\nEPDFAnnot_GetObjectNumber 3 1\nEPDFAnnot_GetOpacity 0 1 1\nEPDFAnnot_GetOverlayText 3 1 6 3\nEPDFAnnot_GetOverlayTextRepeat 0 1\nEPDFAnnot_GetRect 0 1 1\nEPDFAnnot_GetRectangleDifferences 0 1 1 1 1 1\nEPDFAnnot_GetReplyType 3 1\nEPDFAnnot_GetRichContent 3 1 6 3\nEPDFAnnot_GetRichTextJSON 3 1 4 3\nEPDFAnnot_GetRotate 0 1 1\nEPDFAnnot_GetShapeCaption 0 1 1 1 1\nEPDFAnnot_GetStructurePosition 3 1 1 3\nEPDFAnnot_GetTextAlignment 3 1\nEPDFAnnot_HasAppearanceStream 0 1 3\nEPDFAnnot_HasEmbedMetadata 0 1\nEPDFAnnot_HasMKIcon 0 1 3\nEPDFAnnot_IsValid 0 1\nEPDFAnnot_RemoveAction 0 1\nEPDFAnnot_RemoveDest 0 1\nEPDFAnnot_RemoveKey 0 1 2\nEPDFAnnot_RemoveMeasure 0 1\nEPDFAnnot_SetAction 0 1 1\nEPDFAnnot_SetAPMatrix 0 1 3 1\nEPDFAnnot_SetAppearanceFromPage 0 1 1 3\nEPDFAnnot_SetBooleanValue 0 1 2 0\nEPDFAnnot_SetBorderDashPattern 0 1 1 3\nEPDFAnnot_SetBorderEffect 0 1 5\nEPDFAnnot_SetBorderStyle 0 1 3 5\nEPDFAnnot_SetCalloutLine 0 1 1 3\nEPDFAnnot_SetColor 0 1 3 3 3 3\nEPDFAnnot_SetDefaultAppearance 0 1 3 5 3 3 3\nEPDFAnnot_SetDefaultAppearanceDocumentFont 0 1 3 5 3 3 3\nEPDFAnnot_SetDefaultAppearanceRegisteredFont 0 1 3 5 3 3 3\nEPDFAnnot_SetDrawing 0 1 3 3\nEPDFAnnot_SetEmbedMetadataBoolean 0 1 2 0\nEPDFAnnot_SetEmbedMetadataJSON 0 1 1\nEPDFAnnot_SetEmbedMetadataNumber 0 1 2 5\nEPDFAnnot_SetEmbedMetadataRect 0 1 2 1\nEPDFAnnot_SetEmbedMetadataString 0 1 2 1\nEPDFAnnot_SetEventAction 0 1 3 1\nEPDFAnnot_SetIntent 0 1 2\nEPDFAnnot_SetLine 0 1 1 1\nEPDFAnnot_SetLineCaption 0 1 0 3 1\nEPDFAnnot_SetLineEndings 0 1 3 3\nEPDFAnnot_SetLineLeader 0 1 5 5 5\nEPDFAnnot_SetLinkedAnnot 0 1 2 1\nEPDFAnnot_SetMKColor 0 1 3 3 3 3\nEPDFAnnot_SetMKIcon 0 1 3 3\nEPDFAnnot_SetMKRotation 0 1 3\nEPDFAnnot_SetMKText 0 1 3 1\nEPDFAnnot_SetMKTextPosition 0 1 3\nEPDFAnnot_SetName 0 1 2\nEPDFAnnot_SetNoColor 0 1 3\nEPDFAnnot_SetNumberValue 0 1 2 5\nEPDFAnnot_SetOpacity 0 1 5\nEPDFAnnot_SetOverlayText 0 1 1\nEPDFAnnot_SetOverlayTextRepeat 0 1 0\nEPDFAnnot_SetRect 0 1 1\nEPDFAnnot_SetReplyType 0 1 3\nEPDFAnnot_SetRichTextJSON 0 1 2\nEPDFAnnot_SetRichTextXHTML 0 1 1\nEPDFAnnot_SetRotate 0 1 5\nEPDFAnnot_SetShapeCaption 0 1 0 1\nEPDFAnnot_SetStampOpacity 0 1 3 5\nEPDFAnnot_SetSubtype 0 1 3\nEPDFAnnot_SetTextAlignment 0 1 3\nEPDFAnnot_SetVertices 0 1 1 3\nEPDFAnnot_UpdateAppearanceToRect 0 1 3\nEPDFAttachment_ExportCanonicalToOwnedBuffer 1 1 1 1\nEPDFAttachment_ExportRawToOwnedBuffer 1 1 1 1\nEPDFAttachment_ExtractFile 0 1 1 7 1 1\nEPDFAttachment_ExtractFileToOwnedBuffer 0 1 7 1 1 1\nEPDFAttachment_GetDescription 3 1 6 3\nEPDFAttachment_GetIntegerValue 0 1 2 1\nEPDFAttachment_ImportRaw 0 1 1 3\nEPDFAttachment_SetDescription 0 1 1\nEPDFAttachment_SetName 0 1 1\nEPDFAttachment_SetSubtype 0 1 2\nEPDFCatalog_GetLanguage 3 1 1 3\nEPDFCatalog_GetMetadata 3 1 1 3\nEPDFCatalog_SetMetadata 0 1 1 3\nEPDFDest_CreateRemoteView 1 1 3 3 1 3\nEPDFDest_CreateRemoteXYZ 1 1 3 0 5 0 5 0 5\nEPDFDest_CreateView 1 1 3 1 3\nEPDFDest_CreateViewByObjectNumber 1 1 3 3 1 3\nEPDFDest_CreateXYZ 1 1 0 5 0 5 0 5\nEPDFDest_CreateXYZByObjectNumber 1 1 3 0 5 0 5 0 5\nEPDFDest_GetPageObjectNumber 3 1 1\nEPDFDest_GetViewNullParams 3 1\nEPDFDoc_CanonicalDrawing 1 1 3\nEPDFDoc_ClearMissingCharacters - 1\nEPDFDoc_ClearPagePieceInfoEntry 0 1 3 2\nEPDFDoc_ClearPagePieceInfoKey 0 1 3 2 2 1\nEPDFDoc_ClearPieceInfoEntry 0 1 2\nEPDFDoc_ClearPieceInfoKey 0 1 2 2 1\nEPDFDoc_CompareRevisions 1 1 1\nEPDFDoc_CountMissingCharacters 3 1\nEPDFDoc_DeletePageByObjectNumber 0 1 3\nEPDFDoc_ExportDictCanonicalToOwnedBuffer 1 1 3 2 2 1\nEPDFDoc_ExportDictRawToOwnedBuffer 1 1 3 2 1\nEPDFDoc_ExportDrawing 1 1 3\nEPDFDoc_ExportPagesFlattened 1 1 1 3 3 3\nEPDFDoc_GetAdditionalActionModel 1 1 3\nEPDFDoc_GetAttachmentIndexByKey 3 1 1\nEPDFDoc_GetAttachmentKey 3 1 3 6 3\nEPDFDoc_GetBaseBytesSize 7 1\nEPDFDoc_GetDrawings 3 1 1 3\nEPDFDoc_GetFontDisplayProgramCoverage 3 1 4 1 3\nEPDFDoc_GetFontDisplayProgramData 3 1 4 1 3\nEPDFDoc_GetFontEmbeddingPolicy 3 1\nEPDFDoc_GetFontProgramData 3 1 3 1 3\nEPDFDoc_GetFontsFingerprint 0 1 4\nEPDFDoc_GetImportFieldRoots 3 1 1 3 1 3\nEPDFDoc_GetLastModified 3 1 6 3\nEPDFDoc_GetLoadedBytesSize 7 1\nEPDFDoc_GetLoadedObjectValue 3 1 3 4 3 1 1\nEPDFDoc_GetMissingCharacter 3 1 3 6 3\nEPDFDoc_GetNamedJavaScriptActionModel 1 1 3\nEPDFDoc_GetNamedPageAt 3 1 3 3 6 3 1 1\nEPDFDoc_GetNamedPageCount 3 1 3\nEPDFDoc_GetOpenActionDest 1 1\nEPDFDoc_GetOpenActionModel 1 1\nEPDFDoc_GetPageActionModel 1 1 3 3\nEPDFDoc_GetPageLabelSectionAt 3 1 3 6 3 1 1 1\nEPDFDoc_GetPageLabelSectionCount 3 1\nEPDFDoc_GetPageLastModified 3 1 3 6 3\nEPDFDoc_GetPageObjectNumberByIndex 3 1 3\nEPDFDoc_GetPagePieceInfoBoolean 0 1 3 2 2 1\nEPDFDoc_GetPagePieceInfoEntryAt 3 1 3 3 4 3\nEPDFDoc_GetPagePieceInfoEntryCount 3 1 3\nEPDFDoc_GetPagePieceInfoKeyAt 3 1 3 2 3 4 3\nEPDFDoc_GetPagePieceInfoKeyCount 3 1 3 2\nEPDFDoc_GetPagePieceInfoLastModified 3 1 3 2 6 3\nEPDFDoc_GetPagePieceInfoName 3 1 3 2 2 4 3\nEPDFDoc_GetPagePieceInfoNumber 0 1 3 2 2 1\nEPDFDoc_GetPagePieceInfoString 3 1 3 2 2 6 3\nEPDFDoc_GetPagePieceInfoStringArrayAt 3 1 3 2 2 3 6 3\nEPDFDoc_GetPagePieceInfoStringArrayCount 3 1 3 2 2\nEPDFDoc_GetPagePieceInfoValueType 3 1 3 2 2\nEPDFDoc_GetPieceInfoBoolean 0 1 2 2 1\nEPDFDoc_GetPieceInfoEntryAt 3 1 3 4 3\nEPDFDoc_GetPieceInfoEntryCount 3 1\nEPDFDoc_GetPieceInfoKeyAt 3 1 2 3 4 3\nEPDFDoc_GetPieceInfoKeyCount 3 1 2\nEPDFDoc_GetPieceInfoLastModified 3 1 2 6 3\nEPDFDoc_GetPieceInfoName 3 1 2 2 4 3\nEPDFDoc_GetPieceInfoNumber 0 1 2 2 1\nEPDFDoc_GetPieceInfoString 3 1 2 2 6 3\nEPDFDoc_GetPieceInfoStringArrayAt 3 1 2 2 3 6 3\nEPDFDoc_GetPieceInfoStringArrayCount 3 1 2 2\nEPDFDoc_GetPieceInfoValueType 3 1 2 2\nEPDFDoc_GetRevision 0 1 3 1 1\nEPDFDoc_GetRevisionCount 3 1\nEPDFDoc_GetStructureObjectNumbers 0 1 1 1 1\nEPDFDoc_GetTypographicFeatures 0 1\nEPDFDoc_HasPagePieceInfoEntry 0 1 3 2\nEPDFDoc_HasPieceInfoEntry 0 1 2\nEPDFDoc_ImportDictRaw 0 1 1 3\nEPDFDoc_ImportDrawing 3 1 1\nEPDFDoc_ImportPages 0 1 1 1 3 3 1\nEPDFDoc_LoadPageByObjectNumber 1 1 3\nEPDFDoc_LoadPageByObjectNumberNormalized 1 1 3\nEPDFDoc_OpenBaseOverlay 1 1 1 3\nEPDFDoc_OpenBaseOverlayFromPath 1 1 4\nEPDFDoc_OpenRevision 1 1 7\nEPDFDoc_ReadLoadedBytes 3 1 7 1 3\nEPDFDoc_RemoveNamedPage 0 1 1\nEPDFDoc_RemoveNamedPagesForPage 3 1 3\nEPDFDoc_ResolveFonts 1 1 1 3 6 6 1 1 1\nEPDFDoc_SetFontEmbeddingPolicy 0 1 3\nEPDFDoc_SetNamedPage 0 1 1 3\nEPDFDoc_SetPageLabelSections 0 1 1 1 1 6 3\nEPDFDoc_SetPagePieceInfoBoolean 0 1 3 2 2 0 1\nEPDFDoc_SetPagePieceInfoName 0 1 3 2 2 2 1\nEPDFDoc_SetPagePieceInfoNumber 0 1 3 2 2 5 1\nEPDFDoc_SetPagePieceInfoString 0 1 3 2 2 1 1\nEPDFDoc_SetPagePieceInfoStringArray 0 1 3 2 2 6 3 1\nEPDFDoc_SetPageRotationByObjectNumber 0 1 3 3\nEPDFDoc_SetPieceInfoBoolean 0 1 2 2 0 1\nEPDFDoc_SetPieceInfoName 0 1 2 2 2 1\nEPDFDoc_SetPieceInfoNumber 0 1 2 2 5 1\nEPDFDoc_SetPieceInfoString 0 1 2 2 1 1\nEPDFDoc_SetPieceInfoStringArray 0 1 2 2 6 3 1\nEPDFDoc_SetTypographicFeatures 0 1 0\nEPDFDoc_StartLoadPageByObjectNumber 1 1 3 0\nEPDFDocument_ClearEmbedMetadata 0 1\nEPDFDss_Add 3 1 3 1 3\nEPDFDss_GetCount 3 1 3\nEPDFDss_GetData 3 1 3 3 1 3\nEPDFFont_AddFallbackFont 0 3 3\nEPDFFont_AuthorizeEditing 0 3\nEPDFFont_ClearFallbackFonts -\nEPDFFont_ClearRegisteredFonts -\nEPDFFont_GetCoverage 3 3 1 3\nEPDFFont_GetEmbeddingPermission 3 3\nEPDFFont_GetFallbackOrder 3 3 0 1 3\nEPDFFont_GetFamilyName 3 3 4 3\nEPDFFont_GetLastResortFont 3\nEPDFFont_GetMetrics 0 3 1 1\nEPDFFont_GetPostScriptName 3 3 4 3\nEPDFFont_GetProgramData 3 3 1 3\nEPDFFont_GetProgramFormat 3 3\nEPDFFont_GetProgramHash 0 3 4\nEPDFFont_GetWeight 3 3\nEPDFFont_IsEditingAuthorized 0 3\nEPDFFont_IsInstanced 0 3\nEPDFFont_IsItalic 0 3\nEPDFFont_RegisterFont 3 2 3 3 1\nEPDFFont_RegisterMemFont 3 2 3 3 1 3\nEPDFFont_RegisterMemFont64 3 2 3 3 1 3\nEPDFFont_SetLastResortFont 0 3\nEPDFFontFaces_Close - 1\nEPDFFontFaces_Count 3 1\nEPDFFontFaces_CountPrograms 3 1 3\nEPDFFontFaces_GetFamily 3 1 3 6 3\nEPDFFontFaces_GetProgramDisplayHash 0 1 3 3 4\nEPDFFontFaces_GetProgramEmbedded 3 1 3 3\nEPDFFontFaces_GetProgramEmbeddingPermission 3 1 3 3\nEPDFFontFaces_GetProgramFormat 3 1 3 3\nEPDFFontFaces_GetProgramHash 0 1 3 3 4\nEPDFFontFaces_GetProgramMetrics 0 1 3 3 1 1\nEPDFFontFaces_GetProgramObjNum 3 1 3 3\nEPDFFontFaces_GetProgramPostScriptName 3 1 3 3 4 3\nEPDFFontFaces_GetWeight 3 1 3\nEPDFFontFaces_IsItalic 0 1 3\nEPDFFontFaces_Load 1 1\nEPDFFontFaces_ProgramMapsUnicode 0 1 3 3\nEPDFFontResolution_Close - 1\nEPDFFontResolution_CountMissingCharacters 3 1\nEPDFFontResolution_GetBaseFontName 3 1 3 4 3\nEPDFFontResolution_GetFallbacks 3 1 3 1 3\nEPDFFontResolution_GetFamily 3 1 3 6 3\nEPDFFontResolution_GetMissingCharacter 3 1 3 6 3\nEPDFFontResolution_GetProgramDisplayHash 0 1 3 4\nEPDFFontResolution_GetProgramObjNum 3 1 3\nEPDFFontResolution_GetRegisteredFont 3 1 3\nEPDFFontResolution_GetSource 3 1 3\nEPDFFontResolution_GetWeight 3 1 3\nEPDFFontResolution_IsDegraded 0 1 3\nEPDFFontResolution_IsItalic 0 1 3\nEPDFForm_AttachWidget 0 1 3 3 2 1 3\nEPDFForm_ClearFieldEmbedMetadata 0 1 3\nEPDFForm_ClearFieldEmbedMetadataKey 0 1 3 2\nEPDFForm_CloseModel - 1\nEPDFForm_CountCalculationOrder 3 1\nEPDFForm_CountFieldDefaultValues 3 1 3\nEPDFForm_CountFieldOptions 3 1 3\nEPDFForm_CountFields 3 1\nEPDFForm_CountFieldValues 3 1 3\nEPDFForm_CountFieldWidgets 3 1 3\nEPDFForm_CreateField 3 1 3 1 3\nEPDFForm_DeleteField 0 1 3 1 3 1\nEPDFForm_DetachWidget 0 1 3 3\nEPDFForm_ExportFDF 3 1 1 3 1 3\nEPDFForm_ExportFieldRawToOwnedBuffer 1 1 3 1\nEPDFForm_ExportXFDF 3 1 1 3 1 3\nEPDFForm_GetCalculationOrderFieldIndex 3 1 3\nEPDFForm_GetFieldActionModel 1 1 3 3\nEPDFForm_GetFieldAlternateName 3 1 3 6 3\nEPDFForm_GetFieldDefaultValueAt 3 1 3 3 6 3\nEPDFForm_GetFieldDefaultValueKind 3 1 3\nEPDFForm_GetFieldEmbedMetadataBoolean 0 1 3 2 1\nEPDFForm_GetFieldEmbedMetadataJSON 3 1 3 6 3\nEPDFForm_GetFieldEmbedMetadataNumber 0 1 3 2 1\nEPDFForm_GetFieldEmbedMetadataString 3 1 3 2 6 3\nEPDFForm_GetFieldFamily 3 1 3\nEPDFForm_GetFieldFlags 3 1 3\nEPDFForm_GetFieldIndexByObjNum 3 1 3\nEPDFForm_GetFieldIndexForWidget 3 1 3\nEPDFForm_GetFieldMappingName 3 1 3 6 3\nEPDFForm_GetFieldMaxLen 3 1 3\nEPDFForm_GetFieldName 3 1 3 6 3\nEPDFForm_GetFieldObjNum 3 1 3\nEPDFForm_GetFieldOptionLabel 3 1 3 3 6 3\nEPDFForm_GetFieldOptionValue 3 1 3 3 6 3\nEPDFForm_GetFieldOrigin 3 1 3\nEPDFForm_GetFieldPartialName 3 1 3 6 3\nEPDFForm_GetFieldTopIndex 3 1 3\nEPDFForm_GetFieldValueAt 3 1 3 3 6 3\nEPDFForm_GetFieldValueKind 3 1 3\nEPDFForm_GetFieldWidgetExportValue 3 1 3 3 6 3\nEPDFForm_GetFieldWidgetObjNum 3 1 3 3\nEPDFForm_GetFieldWidgetOnState 3 1 3 3 1 3\nEPDFForm_GetFieldWidgetPageObjNum 3 1 3 3\nEPDFForm_GetFieldWidgetRect 0 1 3 3 1\nEPDFForm_GetFormKind 3 1\nEPDFForm_GetNeedAppearances 0 1\nEPDFForm_HasFieldEmbedMetadata 0 1 3\nEPDFForm_HasFieldValuesList 0 1 3\nEPDFForm_ImportFieldRaw 0 1 1 3\nEPDFForm_IsFieldOptionSelected 0 1 3 3\nEPDFForm_IsFieldWidgetChecked 0 1 3 3\nEPDFForm_LoadModel 1 1\nEPDFForm_RedrawFieldWidgets 0 1 3 1 3 1\nEPDFForm_Repair 0 1 3 1\nEPDFForm_SetCalculationOrder 0 1 1 3\nEPDFForm_SetFieldAlternateName 0 1 3 1\nEPDFForm_SetFieldAppearanceText 0 1 3 1 1 3 1\nEPDFForm_SetFieldDefaultValue 0 1 3 3 6 3\nEPDFForm_SetFieldDisplay 0 1 3 3 1 3 1\nEPDFForm_SetFieldEmbedMetadataBoolean 0 1 3 2 0\nEPDFForm_SetFieldEmbedMetadataJSON 0 1 3 1\nEPDFForm_SetFieldEmbedMetadataNumber 0 1 3 2 5\nEPDFForm_SetFieldEmbedMetadataString 0 1 3 2 1\nEPDFForm_SetFieldEventAction 0 1 3 3 1\nEPDFForm_SetFieldFlags 0 1 3 3 3\nEPDFForm_SetFieldMappingName 0 1 3 1\nEPDFForm_SetFieldMaxLen 0 1 3 3\nEPDFForm_SetFieldName 0 1 3 1\nEPDFForm_SetFieldOptions 0 1 3 6 6 3\nEPDFForm_SetFieldSelectedIndices 0 1 3 1 3\nEPDFForm_SetFieldValue 0 1 3 3 6 3\nEPDFForm_SetFieldWidgetsChecked 0 1 3 1 3 1 3 1\nEPDFImageObj_SetJpeg 0 1 3 1 4 3\nEPDFImageObj_SetPng 0 1 3 1 4 3\nEPDFLayer_AbortTransaction 0 1\nEPDFLayer_BeginTransaction 0 1\nEPDFLayer_CommitTransaction 0 1\nEPDFLayer_GetBaseDocument 1 1\nEPDFLayer_GetBaseSha256 0 1 4\nEPDFLayer_GetBirthName 0 1 3 1 1\nEPDFLayer_GetBirthObjectNumber 3 1 3 3\nEPDFLayer_GetLastObjectNumber 3 1\nEPDFLayer_GetPromotedObjectCount 3 1\nEPDFLayer_IsInTransaction 0 1\nEPDFLayer_IsObjectPromoted 0 1 3\nEPDFLayer_IsPagePromoted 0 1 3\nEPDFLayer_OpenLayer 1 1 1 2 1\nEPDFLayer_OpenLayerArtifact 1 1 1 2 1\nEPDFLayer_OpenLayerArtifactFromPath 1 1 4 2 1\nEPDFLayer_RaiseLastObjectNumber 0 1 3\nEPDFLayer_SaveDelta 0 1 1 1\nEPDFLayer_SaveDeltaEx 0 1 1 1 1\nEPDFLayer_SaveDeltaToOwnedBuffer 1 1 1 1\nEPDFLayer_SaveDeltaToOwnedBufferEx 1 1 1 1 1\nEPDFLayer_SaveLayerArtifact 0 1 1 1\nEPDFLayer_SaveLayerArtifactEx 0 1 1 1 1\nEPDFLayer_SaveLayerArtifactToOwnedBuffer 1 1 1 1\nEPDFLayer_SaveLayerArtifactToOwnedBufferEx 1 1 1 1 1\nEPDFMeasure_AddFormat 1 1 3 1 5\nEPDFMeasure_CountFormats 3 1 3\nEPDFMeasure_GetCYX 0 1 1\nEPDFMeasure_GetFormat 1 1 3 3\nEPDFMeasure_GetOrigin 0 1 1\nEPDFMeasure_GetRatio 3 1 6 3\nEPDFMeasure_GetSubtype 3 1\nEPDFMeasure_RemoveFormats 0 1 3\nEPDFMeasure_SetCYX 0 1 1\nEPDFMeasure_SetOrigin 0 1 1\nEPDFMeasure_SetRatio 0 1 1\nEPDFNamedDest_Remove 0 1 2\nEPDFNamedDest_SetDest 0 1 2 1\nEPDFNumberFormat_GetConversion 0 1 1\nEPDFNumberFormat_GetFixedDenominator 0 1 1\nEPDFNumberFormat_GetFraction 0 1 1\nEPDFNumberFormat_GetLabelPosition 0 1 1\nEPDFNumberFormat_GetPrecision 0 1 1\nEPDFNumberFormat_GetText 3 1 3 6 3\nEPDFNumberFormat_GetUnit 3 1 6 3\nEPDFNumberFormat_SetConversion 0 1 5\nEPDFNumberFormat_SetFixedDenominator 0 1 0\nEPDFNumberFormat_SetFraction 0 1 3\nEPDFNumberFormat_SetLabelPosition 0 1 3\nEPDFNumberFormat_SetPrecision 0 1 3\nEPDFNumberFormat_SetText 0 1 3 1\nEPDFNumberFormat_SetUnit 0 1 1\nEPDFObjectDiff_Close - 1\nEPDFObjectDiff_GetCount 3 1\nEPDFObjectDiff_GetEntry 0 1 3 1 1 1 1 1 1\nEPDFObjectDiff_GetReadStatus 3 1 3 3\nEPDFObjectDiff_GetReferrer 3 1 3 3 3 1 4 3\nEPDFObjectDiff_GetReferrerCount 3 1 3 3\nEPDFObjectDiff_GetRevisionHealth 0 1 3 1 1 1\nEPDFObjectDiff_GetValue 3 1 3 3 4 3 1\nEPDFOutline_CreateItem 3 1 3 3 3 1\nEPDFOutline_DeleteItem 0 1 3\nEPDFOutline_ExportItemRawToOwnedBuffer 1 1 3 1\nEPDFOutline_GetItem 1 1 3\nEPDFOutline_GetObjectNumber 3 1\nEPDFOutline_ImportItemRaw 0 1 1 3\nEPDFOutline_MoveItem 0 1 3 3 3\nEPDFOutline_SetAction 0 1 3 1\nEPDFOutline_SetColor 0 1 3 0 5 5 5\nEPDFOutline_SetOpen 0 1 3 0\nEPDFOutline_SetStyle 0 1 3 3\nEPDFOutline_SetTitle 0 1 3 1\nEPDFPage_AddViewport 1 1 1\nEPDFPage_AddViewportRaw 1 1 3 1\nEPDFPage_ApplyRedactions 0 1 1 3 1\nEPDFPage_ContinueLoad 3 1 3\nEPDFPage_CountViewports 3 1\nEPDFPage_CountViewportsRaw 3 1 3\nEPDFPage_CreateAnnot 1 1 3\nEPDFPage_CreateAnnotRaw 1 1 3 3 3\nEPDFPage_ExportAnnotationsAsDocument 1 1 1 3\nEPDFPage_ExportAnnotsRawToOwnedBuffer 1 1 3 1 3 1\nEPDFPage_ExportRawToOwnedBuffer 1 1 3 1\nEPDFPage_FindViewport 3 1 1\nEPDFPage_Flatten 3 1 3\nEPDFPage_FlattenAnnotations 3 1 1 3 3 1\nEPDFPage_GetAnnotByName 1 1 1\nEPDFPage_GetAnnotByObjectNumber 1 1 3\nEPDFPage_GetAnnotCountRaw 3 1 3\nEPDFPage_GetAnnotIndexByNameRaw 3 1 3 1\nEPDFPage_GetAnnotIndexByObjectNumberRaw 3 1 3 3\nEPDFPage_GetAnnotRaw 1 1 3 3\nEPDFPage_GetObjectNumber 3 1\nEPDFPage_GetParsedSize 0 1 1\nEPDFPage_GetViewport 1 1 3\nEPDFPage_GetViewportRaw 1 1 3 3\nEPDFPage_ImportAnnotsRaw 0 1 3 1 3\nEPDFPage_ImportRaw 0 1 1 3\nEPDFPage_InsertBlankRaw 0 1 3 8 8 3\nEPDFPage_IsContentCurrent 0 1\nEPDFPage_IsValid 0 1\nEPDFPage_MoveAnnots 0 1 1 3 3\nEPDFPage_MoveAnnotsRaw 0 1 3 1 3 3\nEPDFPage_PromoteInlineAnnotsRaw 3 1 3\nEPDFPage_RemoveAnnot 0 1 3\nEPDFPage_RemoveAnnotByName 0 1 1\nEPDFPage_RemoveAnnotByObjectNumber 0 1 3\nEPDFPage_RemoveAnnotRaw 0 1 3 3\nEPDFPage_RemoveViewport 0 1 3\nEPDFPage_RemoveViewportRaw 0 1 3 3\nEPDFPage_ResetRenderCache 0 1\nEPDFSig_CloseModel - 1\nEPDFSig_Count 3 1\nEPDFSig_DigestByteRange 0 1 1 3 4 1\nEPDFSig_DigestFileRange 0 1 1 3 4 1\nEPDFSig_GetByteRange 0 1 3 1\nEPDFSig_GetContents 3 1 3 1 3\nEPDFSig_GetCoverage 3 1 3\nEPDFSig_GetDocMDPPermission 3 1 3\nEPDFSig_GetFieldMDPAction 3 1 3\nEPDFSig_GetFieldName 3 1 3 6 3\nEPDFSig_GetFieldNameAt 3 1 3 3 3 6 3\nEPDFSig_GetFieldNameCount 3 1 3 3\nEPDFSig_GetFieldObjNum 3 1 3\nEPDFSig_GetIndexByFieldObjNum 3 1 3\nEPDFSig_GetKind 3 1 3\nEPDFSig_GetLockAction 3 1 3\nEPDFSig_GetLockPermission 3 1 3\nEPDFSig_GetRevisionIndex 3 1 3\nEPDFSig_GetSeedValueFilter 3 1 3 6 3\nEPDFSig_GetSeedValueListAt 3 1 3 3 3 6 3\nEPDFSig_GetSeedValueListCount 3 1 3 3\nEPDFSig_GetSeedValueMDP 3 1 3\nEPDFSig_GetSeedValuePresentFlags 3 1 3\nEPDFSig_GetSeedValueRequiredFlags 3 1 3\nEPDFSig_GetSeedValueVersion 3 1 3\nEPDFSig_GetString 3 1 3 3 6 3\nEPDFSig_GetValueObjNum 3 1 3\nEPDFSig_GetWidgetObjNum 3 1 3\nEPDFSig_GetWidgetPageObjNum 3 1 3\nEPDFSig_HasSeedValue 0 1 3\nEPDFSig_IsCatalogCertification 0 1 3\nEPDFSig_IsRevisionChainValid 0 1\nEPDFSig_IsSigned 0 1 3\nEPDFSig_LoadModel 1 1\nEPDFSig_Prepare 3 1 3 1\nEPDFSig_SaveCandidate 0 1 3 1 1 1 1\nEPDFSig_SaveCandidateToOwnedBuffer 1 1 3 1 1 1\nEPDFSig_Seal 0 4 7 7 7 3 1 1 1 4 1\nEPDFSig_SealSpan 0 4 7 7 7 1 1 1\nEPDFSig_SetFieldLock 0 1 3 3 6 3 3\nEPDFSig_WriteContents 0 4 7 7 7 4 3\nEPDFText_GetCharGeometry 0 1 3 1\nEPDFText_GetCharToTextMap 3 1 1 3\nEPDFText_GetPageGeometry 3 1 3 3 1\nEPDFText_GetTextFull 3 1 1 3\nEPDFText_RedactInQuads 0 1 1 3 0 0\nEPDFText_RedactInRect 0 1 1 0 0\nEPDFViewport_AddMeasure 1 1\nEPDFViewport_Close - 1\nEPDFViewport_GetBBox 0 1 1\nEPDFViewport_GetMeasure 1 1\nEPDFViewport_GetName 3 1 6 3\nEPDFViewport_RemoveMeasure 0 1\nEPDFViewport_SetBBox 0 1 1\nEPDFViewport_SetName 0 1 1\nFORM_CanRedo 0 1 1\nFORM_CanUndo 0 1 1\nFORM_DoDocumentAAction - 1 3\nFORM_DoDocumentJSAction - 1\nFORM_DoDocumentOpenAction - 1\nFORM_DoPageAAction - 1 1 3\nFORM_ForceToKillFocus 0 1\nFORM_GetFocusedAnnot 0 1 1 1\nFORM_GetFocusedText 3 1 1 1 3\nFORM_GetSelectedText 3 1 1 1 3\nFORM_GetTextDirection 3 1 1\nFORM_IsIndexSelected 0 1 1 3\nFORM_OnAfterLoadPage - 1 1\nFORM_OnBeforeClosePage - 1 1\nFORM_OnChar 0 1 1 3 3\nFORM_OnFocus 0 1 1 3 8 8\nFORM_OnKeyDown 0 1 1 3 3\nFORM_OnKeyUp 0 1 1 3 3\nFORM_OnLButtonDoubleClick 0 1 1 3 8 8\nFORM_OnLButtonDown 0 1 1 3 8 8\nFORM_OnLButtonUp 0 1 1 3 8 8\nFORM_OnMouseMove 0 1 1 3 8 8\nFORM_OnMouseWheel 0 1 1 3 1 3 3\nFORM_OnRButtonDown 0 1 1 3 8 8\nFORM_OnRButtonUp 0 1 1 3 8 8\nFORM_Redo 0 1 1\nFORM_ReplaceAndKeepSelection - 1 1 1\nFORM_ReplaceSelection - 1 1 1\nFORM_SelectAllText 0 1 1\nFORM_SetFocusedAnnot 0 1 1\nFORM_SetIndexSelected 0 1 1 3 0\nFORM_SetTextDirection 0 1 1 3\nFORM_Undo 0 1 1\nFPDF_AddInstalledFont - 1 4 3\nFPDF_CloseDocument - 1\nFPDF_ClosePage - 1\nFPDF_CloseXObject - 1\nFPDF_CopyViewerPreferences 0 1 1\nFPDF_CountNamedDests 3 1\nFPDF_CreateClipPath 1 5 5 5 5\nFPDF_CreateNewDocument 1\nFPDF_DestroyClipPath - 1\nFPDF_DestroyLibrary -\nFPDF_DeviceToPage 0 1 3 3 3 3 3 3 3 1 1\nFPDF_DocumentHasValidCrossReferenceTable 0 1\nFPDF_FFLDraw - 1 1 1 3 3 3 3 3 3\nFPDF_FreeDefaultSystemFontInfo - 1\nFPDF_GetDefaultSystemFontInfo 1\nFPDF_GetDefaultTTFMap 1\nFPDF_GetDefaultTTFMapCount 3\nFPDF_GetDefaultTTFMapEntry 1 3\nFPDF_GetDocPermissions 3 1\nFPDF_GetDocUserPermissions 3 1\nFPDF_GetFileIdentifier 3 1 3 1 3\nFPDF_GetFileVersion 0 1 1\nFPDF_GetFormType 3 1\nFPDF_GetLastError 3\nFPDF_GetMetaText 3 1 2 1 3\nFPDF_GetNamedDest 1 1 3 1 1\nFPDF_GetNamedDestByName 1 1 2\nFPDF_GetPageAAction 1 1 3\nFPDF_GetPageBoundingBox 0 1 1\nFPDF_GetPageCount 3 1\nFPDF_GetPageHeight 8 1\nFPDF_GetPageHeightF 5 1\nFPDF_GetPageLabel 3 1 3 1 3\nFPDF_GetPageSizeByIndex 3 1 3 1 1\nFPDF_GetPageSizeByIndexF 0 1 3 1\nFPDF_GetPageWidth 8 1\nFPDF_GetPageWidthF 5 1\nFPDF_GetSecurityHandlerRevision 3 1\nFPDF_GetSignatureCount 3 1\nFPDF_GetSignatureObject 1 1 3\nFPDF_GetTrailerEnds 3 1 1 3\nFPDF_GetXFAPacketContent 0 1 3 1 3 1\nFPDF_GetXFAPacketCount 3 1\nFPDF_GetXFAPacketName 3 1 3 1 3\nFPDF_ImportNPagesToOne 1 1 5 5 3 3\nFPDF_ImportPages 0 1 1 2 3\nFPDF_ImportPagesByIndex 0 1 1 1 3 3\nFPDF_InitLibrary -\nFPDF_InitLibraryWithConfig - 1\nFPDF_LoadCustomDocument 1 1 2\nFPDF_LoadDocument 1 4 2\nFPDF_LoadMemDocument 1 1 3 2\nFPDF_LoadMemDocument64 1 1 3 2\nFPDF_LoadPage 1 1 3\nFPDF_LoadXFA 0 1\nFPDF_MovePages 0 1 1 3 3\nFPDF_NewFormObjectFromXObject 1 1\nFPDF_NewXObjectFromPage 1 1 1 3\nFPDF_PageToDevice 0 1 3 3 3 3 3 8 8 1 1\nFPDF_RemoveFormFieldHighlight - 1\nFPDF_RenderPage_Close - 1\nFPDF_RenderPage_Continue 3 1 1\nFPDF_RenderPageBitmap - 1 1 3 3 3 3 3 3\nFPDF_RenderPageBitmap_Start 3 1 1 3 3 3 3 3 3 1\nFPDF_RenderPageBitmapWithColorScheme_Start 3 1 1 3 3 3 3 3 3 1 1\nFPDF_RenderPageBitmapWithMatrix - 1 1 1 1 3\nFPDF_SaveAsCopy 0 1 1 3\nFPDF_SaveWithVersion 0 1 1 3 3\nFPDF_SetFormFieldHighlightAlpha - 1 3\nFPDF_SetFormFieldHighlightColor - 1 3 3\nFPDF_SetSandBoxPolicy - 3 0\nFPDF_SetSystemFontInfo - 1\nFPDF_StructElement_Attr_CountChildren 3 1\nFPDF_StructElement_Attr_GetBlobValue 0 1 1 3 1\nFPDF_StructElement_Attr_GetBooleanValue 0 1 1\nFPDF_StructElement_Attr_GetChildAtIndex 1 1 3\nFPDF_StructElement_Attr_GetCount 3 1\nFPDF_StructElement_Attr_GetName 0 1 3 1 3 1\nFPDF_StructElement_Attr_GetNumberValue 0 1 1\nFPDF_StructElement_Attr_GetStringValue 0 1 1 3 1\nFPDF_StructElement_Attr_GetType 3 1\nFPDF_StructElement_Attr_GetValue 1 1 2\nFPDF_StructElement_CountChildren 3 1\nFPDF_StructElement_GetActualText 3 1 1 3\nFPDF_StructElement_GetAltText 3 1 1 3\nFPDF_StructElement_GetAttributeAtIndex 1 1 3\nFPDF_StructElement_GetAttributeCount 3 1\nFPDF_StructElement_GetChildAtIndex 1 1 3\nFPDF_StructElement_GetChildMarkedContentID 3 1 3\nFPDF_StructElement_GetExpansion 3 1 1 3\nFPDF_StructElement_GetID 3 1 1 3\nFPDF_StructElement_GetLang 3 1 1 3\nFPDF_StructElement_GetMarkedContentID 3 1\nFPDF_StructElement_GetMarkedContentIdAtIndex 3 1 3\nFPDF_StructElement_GetMarkedContentIdCount 3 1\nFPDF_StructElement_GetObjType 3 1 1 3\nFPDF_StructElement_GetParent 1 1\nFPDF_StructElement_GetRawType 3 1 6 3\nFPDF_StructElement_GetStringAttribute 3 1 2 1 3\nFPDF_StructElement_GetTitle 3 1 1 3\nFPDF_StructElement_GetType 3 1 1 3\nFPDF_StructTree_Close - 1\nFPDF_StructTree_CountChildren 3 1\nFPDF_StructTree_GetChildAtIndex 1 1 3\nFPDF_StructTree_GetForPage 1 1\nFPDF_VIEWERREF_GetDuplex 3 1\nFPDF_VIEWERREF_GetName 3 1 2 4 3\nFPDF_VIEWERREF_GetNumCopies 3 1\nFPDF_VIEWERREF_GetPrintPageRange 1 1\nFPDF_VIEWERREF_GetPrintPageRangeCount 3 1\nFPDF_VIEWERREF_GetPrintPageRangeElement 3 1 3\nFPDF_VIEWERREF_GetPrintScaling 0 1\nFPDFAction_GetDest 1 1 1\nFPDFAction_GetFilePath 3 1 1 3\nFPDFAction_GetType 3 1\nFPDFAction_GetURIPath 3 1 1 1 3\nFPDFAnnot_AddFileAttachment 1 1 1\nFPDFAnnot_AddInkStroke 3 1 1 3\nFPDFAnnot_AppendAttachmentPoints 0 1 1\nFPDFAnnot_AppendObject 0 1 1\nFPDFAnnot_CountAttachmentPoints 3 1\nFPDFAnnot_GetAP 3 1 3 6 3\nFPDFAnnot_GetAttachmentPoints 0 1 3 1\nFPDFAnnot_GetBorder 0 1 1 1 1\nFPDFAnnot_GetColor 0 1 3 1 1 1 1\nFPDFAnnot_GetFileAttachment 1 1\nFPDFAnnot_GetFlags 3 1\nFPDFAnnot_GetFocusableSubtypes 0 1 1 3\nFPDFAnnot_GetFocusableSubtypesCount 3 1\nFPDFAnnot_GetFontColor 0 1 1 1 1 1\nFPDFAnnot_GetFontSize 0 1 1 1\nFPDFAnnot_GetFormAdditionalActionJavaScript 3 1 1 3 6 3\nFPDFAnnot_GetFormControlCount 3 1 1\nFPDFAnnot_GetFormControlIndex 3 1 1\nFPDFAnnot_GetFormFieldAlternateName 3 1 1 6 3\nFPDFAnnot_GetFormFieldAtPoint 1 1 1 1\nFPDFAnnot_GetFormFieldExportValue 3 1 1 6 3\nFPDFAnnot_GetFormFieldFlags 3 1 1\nFPDFAnnot_GetFormFieldName 3 1 1 6 3\nFPDFAnnot_GetFormFieldType 3 1 1\nFPDFAnnot_GetFormFieldValue 3 1 1 6 3\nFPDFAnnot_GetInkListCount 3 1\nFPDFAnnot_GetInkListPath 3 1 3 1 3\nFPDFAnnot_GetLine 0 1 1 1\nFPDFAnnot_GetLink 1 1\nFPDFAnnot_GetLinkedAnnot 1 1 2\nFPDFAnnot_GetNumberValue 0 1 2 1\nFPDFAnnot_GetObject 1 1 3\nFPDFAnnot_GetObjectCount 3 1\nFPDFAnnot_GetOptionCount 3 1 1\nFPDFAnnot_GetOptionLabel 3 1 1 3 6 3\nFPDFAnnot_GetRect 0 1 1\nFPDFAnnot_GetStringValue 3 1 2 6 3\nFPDFAnnot_GetSubtype 3 1\nFPDFAnnot_GetValueType 3 1 2\nFPDFAnnot_GetVertices 3 1 1 3\nFPDFAnnot_HasAttachmentPoints 0 1\nFPDFAnnot_HasKey 0 1 2\nFPDFAnnot_IsChecked 0 1 1\nFPDFAnnot_IsObjectSupportedSubtype 0 3\nFPDFAnnot_IsOptionSelected 0 1 1 3\nFPDFAnnot_IsSupportedSubtype 0 3\nFPDFAnnot_RemoveInkList 0 1\nFPDFAnnot_RemoveObject 0 1 3\nFPDFAnnot_SetAP 0 1 3 1\nFPDFAnnot_SetAttachmentPoints 0 1 3 1\nFPDFAnnot_SetBorder 0 1 5 5 5\nFPDFAnnot_SetColor 0 1 3 3 3 3 3\nFPDFAnnot_SetFlags 0 1 3\nFPDFAnnot_SetFocusableSubtypes 0 1 1 3\nFPDFAnnot_SetFontColor 0 1 1 3 3 3\nFPDFAnnot_SetFormFieldFlags 0 1 1 3\nFPDFAnnot_SetRect 0 1 1\nFPDFAnnot_SetStringValue 0 1 2 1\nFPDFAnnot_SetURI 0 1 4\nFPDFAnnot_UpdateObject 0 1 1\nFPDFAttachment_GetAFRelationship 3 1 6 3\nFPDFAttachment_GetDescription 3 1 6 3\nFPDFAttachment_GetFile 0 1 1 3 1\nFPDFAttachment_GetName 3 1 6 3\nFPDFAttachment_GetStringValue 3 1 2 6 3\nFPDFAttachment_GetSubtype 3 1 6 3\nFPDFAttachment_GetValueType 3 1 2\nFPDFAttachment_HasKey 0 1 2\nFPDFAttachment_SetDescription 0 1 1\nFPDFAttachment_SetFile 0 1 1 1 3\nFPDFAttachment_SetStringValue 0 1 2 1\nFPDFAvail_Create 1 1 1\nFPDFAvail_Destroy - 1\nFPDFAvail_GetDocument 1 1 2\nFPDFAvail_GetFirstPageNum 3 1\nFPDFAvail_IsDocAvail 3 1 1\nFPDFAvail_IsFormAvail 3 1 1\nFPDFAvail_IsLinearized 3 1\nFPDFAvail_IsPageAvail 3 1 3 1\nFPDFBitmap_Create 1 3 3 3\nFPDFBitmap_CreateEx 1 3 3 3 1 3\nFPDFBitmap_Destroy - 1\nFPDFBitmap_FillRect 0 1 3 3 3 3 3\nFPDFBitmap_GetBuffer 1 1\nFPDFBitmap_GetFormat 3 1\nFPDFBitmap_GetHeight 3 1\nFPDFBitmap_GetStride 3 1\nFPDFBitmap_GetWidth 3 1\nFPDFBookmark_Find 1 1 1\nFPDFBookmark_GetAction 1 1\nFPDFBookmark_GetColor 0 1 1 1 1\nFPDFBookmark_GetCount 3 1\nFPDFBookmark_GetDest 1 1 1\nFPDFBookmark_GetFirstChild 1 1 1\nFPDFBookmark_GetNextSibling 1 1 1\nFPDFBookmark_GetStyle 3 1\nFPDFBookmark_GetTitle 3 1 1 3\nFPDFCatalog_GetLanguage 3 1 6 3\nFPDFCatalog_IsTagged 0 1\nFPDFCatalog_SetLanguage 0 1 1\nFPDFClipPath_CountPaths 3 1\nFPDFClipPath_CountPathSegments 3 1 3\nFPDFClipPath_GetPathSegment 1 1 3 3\nFPDFDest_GetDestPageIndex 3 1 1\nFPDFDest_GetLocationInPage 0 1 1 1 1 1 1 1\nFPDFDest_GetView 3 1 1 1\nFPDFDoc_AddAttachment 1 1 1\nFPDFDoc_CloseJavaScriptAction - 1\nFPDFDoc_DeleteAttachment 0 1 3\nFPDFDOC_ExitFormFillEnvironment - 1\nFPDFDoc_GetAttachment 1 1 3\nFPDFDoc_GetAttachmentCount 3 1\nFPDFDoc_GetJavaScriptAction 1 1 3\nFPDFDoc_GetJavaScriptActionCount 3 1\nFPDFDoc_GetPageMode 3 1\nFPDFDOC_InitFormFillEnvironment 1 1 1\nFPDFFont_Close - 1\nFPDFFont_GetAscent 0 1 5 1\nFPDFFont_GetBaseFontName 3 1 4 3\nFPDFFont_GetDescent 0 1 5 1\nFPDFFont_GetFamilyName 3 1 4 3\nFPDFFont_GetFlags 3 1\nFPDFFont_GetFontData 0 1 4 3 1\nFPDFFont_GetGlyphPath 1 1 3 5\nFPDFFont_GetGlyphWidth 0 1 3 5 1\nFPDFFont_GetIsEmbedded 3 1\nFPDFFont_GetItalicAngle 0 1 1\nFPDFFont_GetWeight 3 1\nFPDFFormObj_CountObjects 3 1\nFPDFFormObj_GetObject 1 1 3\nFPDFFormObj_RemoveObject 0 1 1\nFPDFGlyphPath_CountGlyphSegments 3 1\nFPDFGlyphPath_GetGlyphPathSegment 1 1 3\nFPDFImageObj_GetBitmap 1 1\nFPDFImageObj_GetIccProfileDataDecoded 0 1 1 4 3 1\nFPDFImageObj_GetImageDataDecoded 3 1 1 3\nFPDFImageObj_GetImageDataRaw 3 1 1 3\nFPDFImageObj_GetImageFilter 3 1 3 1 3\nFPDFImageObj_GetImageFilterCount 3 1\nFPDFImageObj_GetImageMetadata 0 1 1 1\nFPDFImageObj_GetImagePixelSize 0 1 1 1\nFPDFImageObj_GetRenderedBitmap 1 1 1 1\nFPDFImageObj_LoadJpegFile 0 1 3 1 1\nFPDFImageObj_LoadJpegFileInline 0 1 3 1 1\nFPDFImageObj_SetBitmap 0 1 3 1 1\nFPDFImageObj_SetMatrix 0 1 8 8 8 8 8 8\nFPDFJavaScriptAction_GetName 3 1 6 3\nFPDFJavaScriptAction_GetScript 3 1 6 3\nFPDFLink_CloseWebLinks - 1\nFPDFLink_CountQuadPoints 3 1\nFPDFLink_CountRects 3 1 3\nFPDFLink_CountWebLinks 3 1\nFPDFLink_Enumerate 0 1 1 1\nFPDFLink_GetAction 1 1\nFPDFLink_GetAnnot 1 1 1\nFPDFLink_GetAnnotRect 0 1 1\nFPDFLink_GetDest 1 1 1\nFPDFLink_GetLinkAtPoint 1 1 8 8\nFPDFLink_GetLinkZOrderAtPoint 3 1 8 8\nFPDFLink_GetQuadPoints 0 1 3 1\nFPDFLink_GetRect 0 1 3 3 1 1 1 1\nFPDFLink_GetTextRange 0 1 3 1 1\nFPDFLink_GetURL 3 1 3 1 3\nFPDFLink_LoadWebLinks 1 1\nFPDFPage_CloseAnnot - 1\nFPDFPage_CountObjects 3 1\nFPDFPage_CreateAnnot 1 1 3\nFPDFPage_Delete - 1 3\nFPDFPage_Flatten 3 1 3\nFPDFPage_FormFieldZOrderAtPoint 3 1 1 8 8\nFPDFPage_GenerateContent 0 1\nFPDFPage_GetAnnot 1 1 3\nFPDFPage_GetAnnotCount 3 1\nFPDFPage_GetAnnotIndex 3 1 1\nFPDFPage_GetArtBox 0 1 1 1 1 1\nFPDFPage_GetBleedBox 0 1 1 1 1 1\nFPDFPage_GetCropBox 0 1 1 1 1 1\nFPDFPage_GetDecodedThumbnailData 3 1 1 3\nFPDFPage_GetMediaBox 0 1 1 1 1 1\nFPDFPage_GetObject 1 1 3\nFPDFPage_GetRawThumbnailData 3 1 1 3\nFPDFPage_GetRotation 3 1\nFPDFPage_GetThumbnailAsBitmap 1 1\nFPDFPage_GetTrimBox 0 1 1 1 1 1\nFPDFPage_HasFormFieldAtPoint 3 1 1 8 8\nFPDFPage_HasTransparency 0 1\nFPDFPage_InsertClipPath - 1 1\nFPDFPage_InsertObject 0 1 1\nFPDFPage_InsertObjectAtIndex 0 1 1 3\nFPDFPage_New 1 1 3 8 8\nFPDFPage_RemoveAnnot 0 1 3\nFPDFPage_RemoveObject 0 1 1\nFPDFPage_SetArtBox - 1 5 5 5 5\nFPDFPage_SetBleedBox - 1 5 5 5 5\nFPDFPage_SetCropBox - 1 5 5 5 5\nFPDFPage_SetMediaBox - 1 5 5 5 5\nFPDFPage_SetRotation - 1 3\nFPDFPage_SetTrimBox - 1 5 5 5 5\nFPDFPage_TransformAnnots - 1 8 8 8 8 8 8\nFPDFPage_TransFormWithClip 0 1 1 1\nFPDFPageObj_AddExistingMark 0 1 1\nFPDFPageObj_AddMark 1 1 2\nFPDFPageObj_CountMarks 3 1\nFPDFPageObj_CreateNewPath 1 5 5\nFPDFPageObj_CreateNewRect 1 5 5 5 5\nFPDFPageObj_CreateTextObj 1 1 1 5\nFPDFPageObj_Destroy - 1\nFPDFPageObj_GetBounds 0 1 1 1 1 1\nFPDFPageObj_GetClipPath 1 1\nFPDFPageObj_GetDashArray 0 1 1 3\nFPDFPageObj_GetDashCount 3 1\nFPDFPageObj_GetDashPhase 0 1 1\nFPDFPageObj_GetFillColor 0 1 1 1 1 1\nFPDFPageObj_GetIsActive 0 1 1\nFPDFPageObj_GetLineCap 3 1\nFPDFPageObj_GetLineJoin 3 1\nFPDFPageObj_GetMark 1 1 3\nFPDFPageObj_GetMarkedContentID 3 1\nFPDFPageObj_GetMatrix 0 1 1\nFPDFPageObj_GetRenderedFillPattern 1 1 1\nFPDFPageObj_GetRenderedStrokePattern 1 1 1\nFPDFPageObj_GetRotatedBounds 0 1 1\nFPDFPageObj_GetStrokeColor 0 1 1 1 1 1\nFPDFPageObj_GetStrokeWidth 0 1 1\nFPDFPageObj_GetType 3 1\nFPDFPageObj_HasTransparency 0 1\nFPDFPageObj_NewImageObj 1 1\nFPDFPageObj_NewTextObj 1 1 2 5\nFPDFPageObj_RemoveMark 0 1 1\nFPDFPageObj_SetBlendMode - 1 2\nFPDFPageObj_SetDashArray 0 1 1 3 5\nFPDFPageObj_SetDashPhase 0 1 5\nFPDFPageObj_SetFillColor 0 1 3 3 3 3\nFPDFPageObj_SetIsActive 0 1 0\nFPDFPageObj_SetLineCap 0 1 3\nFPDFPageObj_SetLineJoin 0 1 3\nFPDFPageObj_SetMatrix 0 1 1\nFPDFPageObj_SetStrokeColor 0 1 3 3 3 3\nFPDFPageObj_SetStrokeWidth 0 1 5\nFPDFPageObj_Transform - 1 8 8 8 8 8 8\nFPDFPageObj_TransformClipPath - 1 8 8 8 8 8 8\nFPDFPageObj_TransformF 0 1 1\nFPDFPageObjMark_CountParams 3 1\nFPDFPageObjMark_GetName 0 1 6 3 1\nFPDFPageObjMark_GetParamBlobValue 0 1 2 4 3 1\nFPDFPageObjMark_GetParamFloatValue 0 1 2 1\nFPDFPageObjMark_GetParamIntValue 0 1 2 1\nFPDFPageObjMark_GetParamKey 0 1 3 6 3 1\nFPDFPageObjMark_GetParamStringValue 0 1 2 6 3 1\nFPDFPageObjMark_GetParamValueType 3 1 2\nFPDFPageObjMark_RemoveParam 0 1 1 2\nFPDFPageObjMark_SetBlobParam 0 1 1 1 2 4 3\nFPDFPageObjMark_SetFloatParam 0 1 1 1 2 5\nFPDFPageObjMark_SetIntParam 0 1 1 1 2 3\nFPDFPageObjMark_SetStringParam 0 1 1 1 2 2\nFPDFPath_BezierTo 0 1 5 5 5 5 5 5\nFPDFPath_Close 0 1\nFPDFPath_CountSegments 3 1\nFPDFPath_GetBezierControlPoints 0 1 3 1 1\nFPDFPath_GetDrawMode 0 1 1 1\nFPDFPath_GetPathSegment 1 1 3\nFPDFPath_LineTo 0 1 5 5\nFPDFPath_MoveTo 0 1 5 5\nFPDFPath_SetDrawMode 0 1 3 0\nFPDFPathSegment_GetClose 0 1\nFPDFPathSegment_GetPoint 0 1 1 1\nFPDFPathSegment_GetType 3 1\nFPDFSignatureObj_GetByteRange 3 1 1 3\nFPDFSignatureObj_GetContents 3 1 1 3\nFPDFSignatureObj_GetDocMDPPermission 3 1\nFPDFSignatureObj_GetReason 3 1 1 3\nFPDFSignatureObj_GetSubFilter 3 1 4 3\nFPDFSignatureObj_GetTime 3 1 4 3\nFPDFText_ClosePage - 1\nFPDFText_CountChars 3 1\nFPDFText_CountRects 3 1 3 3\nFPDFText_FindClose - 1\nFPDFText_FindNext 0 1\nFPDFText_FindPrev 0 1\nFPDFText_FindStart 1 1 1 3 3\nFPDFText_GetBoundedText 3 1 8 8 8 8 1 3\nFPDFText_GetCharAngle 5 1 3\nFPDFText_GetCharBox 0 1 3 1 1 1 1\nFPDFText_GetCharIndexAtPos 3 1 8 8 8 8\nFPDFText_GetCharIndexFromTextIndex 3 1 3\nFPDFText_GetCharOrigin 0 1 3 1 1\nFPDFText_GetFillColor 0 1 3 1 1 1 1\nFPDFText_GetFontInfo 3 1 3 1 3 1\nFPDFText_GetFontSize 8 1 3\nFPDFText_GetFontWeight 3 1 3\nFPDFText_GetLooseCharBox 0 1 3 1\nFPDFText_GetMatrix 0 1 3 1\nFPDFText_GetRect 0 1 3 1 1 1 1\nFPDFText_GetSchCount 3 1\nFPDFText_GetSchResultIndex 3 1\nFPDFText_GetStrokeColor 0 1 3 1 1 1 1\nFPDFText_GetText 3 1 3 3 1\nFPDFText_GetTextIndexFromCharIndex 3 1 3\nFPDFText_GetTextObject 1 1 3\nFPDFText_GetUnicode 3 1 3\nFPDFText_HasUnicodeMapError 3 1 3\nFPDFText_IsGenerated 3 1 3\nFPDFText_IsHyphen 3 1 3\nFPDFText_LoadCidType2Font 1 1 4 3 2 4 3\nFPDFText_LoadFont 1 1 4 3 3 0\nFPDFText_LoadPage 1 1\nFPDFText_LoadStandardFont 1 1 2\nFPDFText_SetCharcodes 0 1 1 3\nFPDFText_SetPositions 0 1 1 3\nFPDFText_SetText 0 1 1\nFPDFTextObj_GetFont 1 1\nFPDFTextObj_GetFontSize 0 1 1\nFPDFTextObj_GetRenderedBitmap 1 1 1 1 5\nFPDFTextObj_GetText 3 1 1 6 3\nFPDFTextObj_GetTextRenderMode 3 1\nFPDFTextObj_SetFontSize 0 1 5\nFPDFTextObj_SetTextRenderMode 0 1 3\n`);function aR(e){return BigInt("number"==typeof e?e>>>0:e)}function aT(e){return Number(e)}function aB(e){switch(e){case"i8":return"i8";case"i16":return"i16";case"i32":return"i32";case"i64":return"i64";case"f32":return"float";case"f64":return"double";case"ptr":return"*"}}async function aL(e={}){let t,n,r=await Promise.resolve().then(()=>(x(),k)),i=r.default??r,o=await i((t={...e.wasm??{}},void 0!==e.wasmBinary&&void 0===t.wasmBinary&&(t.wasmBinary=e.wasmBinary instanceof Uint8Array?e.wasmBinary:new Uint8Array(e.wasmBinary)),void 0!==(n=e.wasmUrl)&&void 0===t.locateFile&&(t.locateFile=(e,t)=>e.endsWith(".wasm")?n:t+e),void 0!==t.wasmBinary&&void 0===t.locateFile&&(t.locateFile=(e,t)=>e.endsWith(".wasm")?e:t+e),t)),a=function(e){let t=e._malloc??e.wasmExports?.malloc,n=e._free??e.wasmExports?.free;if(!t||!n)throw Error("WASM runtime does not expose malloc/free");return{alloc:e=>aR(t(e)),free(e){n(aT(e))},readBytes:(t,n)=>e.HEAPU8.slice(aT(t),aT(t)+n),writeBytes(t,n){e.HEAPU8.set(n,aT(t))},readU8String:t=>e.UTF8ToString?.(aT(t))??"",writeU8String(n){let r=new TextEncoder().encode(`${n}\\0`),i=aR(t(r.length));return e.HEAPU8.set(r,aT(i)),i},readU16String:t=>e.UTF16ToString?.(aT(t))??"",writeU16String(n){let r=(n.length+1)*2,i=aR(t(r));return e.stringToUTF16?.(n,aT(i),r),i},peek(t,n,r=0){let i=e.getValue?.(aT(t)+r,aB(n))??0;return"ptr"===n?aR(i):i},poke(t,n,r,i=0){let o="ptr"===n&&"bigint"==typeof r?Number(r):r;e.setValue?.(aT(t)+i,o,aB(n))}}}(o),s={register(e,t){if(!o.addFunction)throw Error("WASM runtime does not expose addFunction");return BigInt(o.addFunction(t,e))},dispose(e){o.removeFunction?.(aT(e))}};return{kind:"wasm",platform:"wasm32",mem:a,cb:s,fileAccess:{fromMemory(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t.byteLength>0xffffffff)throw RangeError("FPDF_FILEACCESS on wasm supports files up to 4 GiB");let n=a.alloc(12),r=null,i=!1;try{return r=s.register("iiiii",(e,n,r,i)=>{let o=Number(n),s=Number(i);return!Number.isSafeInteger(o)||!Number.isSafeInteger(s)||o<0||s<0||o+s>t.byteLength?0:(a.writeBytes(aR(r),t.subarray(o,o+s)),1)}),a.poke(n,"i32",t.byteLength,0),a.poke(n,"i32",aT(r),4),a.poke(n,"i32",0,8),{ptr:n,close(){i||(i=!0,s.dispose(r),a.free(n))}}}catch(e){throw r&&s.dispose(r),a.free(n),e}},fromNodeFile(){throw Error("fromNodeFile() is only available on the native Node runtime")},readRange(){throw Error("readRange() is only available on the native Node runtime")},sizeOf(){throw Error("sizeOf() is only available on the native Node runtime")}},fileWrite:{toNodeFile(){throw Error("toNodeFile() is only available on the native Node runtime")},writeRange(){throw Error("writeRange() is only available on the native Node runtime")},appendBytes(){throw Error("appendBytes() is only available on the native Node runtime")},removeFile(){throw Error("removeFile() is only available on the native Node runtime")}},fn:function(e){let t={};for(let[n,r]of Object.entries(aM)){let i=r.params.some(e=>"i64"===e.wasm.kind),o=e=>(...t)=>{let n=t.map((e,t)=>{var n;return n=r.params[t],n&&"Ptr"===n.ts&&"bigint"==typeof e?Number(e):e});var o=r.result,a=e(...i?function(e,t){let n=[];return e.params.forEach((e,r)=>{if("i64"===e.wasm.kind){let e=BigInt(t[r]??0);n.push(Number(4294967295n&e),Number(e>>32n&4294967295n))}else n.push(t[r])}),n}(r,n):n);if(o)return"Ptr"===o.ts&&"number"==typeof a?aR(a):"bigint"===o.ts&&"number"==typeof a?BigInt(a):a};if(e.cwrap){let i=r.params.flatMap(e=>"i64"===e.wasm.kind?["number","number"]:[e.wasm.cwrap]);t[n]=o(e.cwrap(n,r.result?r.result.wasm.cwrap:null,i))}else"function"==typeof e[`_${n}`]&&(t[n]=o(e[`_${n}`].bind(e)))}return t}(o),async destroy(){o._free=o._free}}}async function a$(e={}){return aL(e)}var az={};function aU(e){return e}function aV(e){return e}function aW(){return e=>e}function aq(e){}function aH(e){throw Error("Unexpected value in exhaustive check")}function aK(e){}function aZ(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function aJ(e,t="|"){return e.map(e=>sy(e)).join(t)}function aQ(e,t){return"bigint"==typeof t?t.toString():t}v(az,{BIGINT_FORMAT_RANGES:()=>sA,CONSTANT_CATCH:()=>le,Class:()=>s1,NUMBER_FORMAT_RANGES:()=>sE,aborted:()=>sj,allowsEval:()=>sc,assert:()=>aK,assertEqual:()=>aU,assertIs:()=>aq,assertNever:()=>aH,assertNotEqual:()=>aV,assignProp:()=>a4,attachSchema:()=>sL,base64ToUint8Array:()=>sZ,base64urlToUint8Array:()=>sQ,cached:()=>aY,captureStackTrace:()=>su,cleanEnum:()=>sK,cleanRegex:()=>a1,clone:()=>sP,cloneDef:()=>sr,codePointLength:()=>sV,constantCatch:()=>lt,createTransparentProxy:()=>sb,defineLazy:()=>a6,defineLazyInternal:()=>s7,derived:()=>s5,esc:()=>ss,escapeRegex:()=>s_,explicitlyAborted:()=>sM,extend:()=>sx,finalizeIssue:()=>s$,floatSafeRemainder:()=>a3,getElementAtPath:()=>si,getEnumValues:()=>aZ,getLengthableOrigin:()=>sW,getParsedType:()=>sh,getSizableOrigin:()=>sz,hexToUint8Array:()=>sY,hide:()=>s6,installLazyProp:()=>s9,isObject:()=>sd,isPlainObject:()=>sf,issue:()=>sH,joinValues:()=>aJ,jsonStringifyReplacer:()=>aQ,members:()=>s3,merge:()=>sI,mergeDefs:()=>sn,normalizeParams:()=>sD,nullish:()=>a0,numKeys:()=>sp,objectClone:()=>a5,omit:()=>sk,optionalKeys:()=>sw,own:()=>s2,parsedType:()=>sq,partial:()=>sN,pick:()=>sv,prefixIssues:()=>sR,primitiveTypes:()=>sg,promiseAllObject:()=>so,propertyKeyTypes:()=>sF,randomString:()=>sa,rawShape:()=>a8,required:()=>sC,safeExtend:()=>sO,shallowClone:()=>sm,sizeCaps:()=>sB,slugify:()=>sl,stringifyPrimitive:()=>sy,toZod:()=>aW,uint8ArrayToBase64:()=>sJ,uint8ArrayToBase64url:()=>sX,uint8ArrayToHex:()=>s0,unwrapMessage:()=>sT});var aX=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}};function aY(e){return new aX(e)}function a0(e){return null==e}function a1(e){let t=+!!e.startsWith("^"),n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function a3(e,t){let n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){let e=t._zod.def.shape[o];return r?r(e,o):e}):se(e,o,r?r(n.value,o):n.value))}}function sn(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function sr(e){return sn(e._zod.def)}function si(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function so(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let n={};for(let r=0;r{};function sd(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var sc=aY(()=>{if(ls.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch{return!1}});function sf(e){if(!1===sd(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let n=t.prototype;return!1!==sd(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function sm(e){return sf(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function sp(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var sh=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("u">typeof Map&&e instanceof Map)return"map";if("u">typeof Set&&e instanceof Set)return"set";if("u">typeof Date&&e instanceof Date)return"date";if("u">typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},sF=new Set(["string","number","symbol"]),sg=new Set(["string","number","bigint","boolean","symbol","undefined"]);function s_(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function sP(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function sD(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function sb(e){let t;return new Proxy({},{get:(n,r,i)=>(t??(t=e()),Reflect.get(t,r,i)),set:(n,r,i,o)=>(t??(t=e()),Reflect.set(t,r,i,o)),has:(n,r)=>(t??(t=e()),Reflect.has(t,r)),deleteProperty:(n,r)=>(t??(t=e()),Reflect.deleteProperty(t,r)),ownKeys:n=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(n,r)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)),defineProperty:(n,r,i)=>(t??(t=e()),Reflect.defineProperty(t,r,i))})}function sy(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function sw(e){return Object.keys(e).filter(t=>void 0!==e[t]._zod.optin&&"optional"===e[t]._zod.optout)}var sE={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},sA={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function sv(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return st(i,e,sS(e,t)),sP(e,sn(n,{shape:i,checks:[]}))}function sS(e,t){let n=a7(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function sk(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(sS(e,t)),o={};return st(o,e,Reflect.ownKeys(a7(e)).filter(e=>!i.has(e))),sP(e,sn(n,{shape:o,checks:[]}))}function sx(e,t){if(!sf(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let n=a7(e);for(let e of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return sP(e,sn(e._zod.def,{shape:sG(e,t)}))}function sG(e,t){let n={};st(n,e,Reflect.ownKeys(a7(e)));for(let e of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,e);r.enumerable&&(r.get?a9(n,e,()=>t[e]):se(n,e,r.value))}return n}function sO(e,t){if(!sf(t))throw Error("Invalid input to safeExtend: expected a plain object");return sP(e,sn(e._zod.def,{shape:sG(e,t)}))}function sI(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};st(n,e,Reflect.ownKeys(a7(e))),st(n,t,Reflect.ownKeys(a7(t)));let r=sn(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return sP(e,r)}function sN(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let o=n?new Set(sS(t,n)):void 0,a={};return st(a,t,Reflect.ownKeys(a7(t)),e&&((t,n)=>o&&!o.has(n)?t:new e({type:"optional",innerType:t}))),sP(t,sn(t._zod.def,{shape:a,checks:[]}))}function sC(e,t,n){let r=n?new Set(sS(t,n)):void 0,i={};return st(i,t,Reflect.ownKeys(a7(t)),(t,n)=>r&&!r.has(n)?t:new e({type:"nonoptional",innerType:t})),sP(t,sn(t._zod.def,{shape:i}))}function sj(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n(t.path??(t.path=[]),t.path.unshift(e),t))}function sT(e){return"string"==typeof e?e:e?.message}function sB(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function sL(e,t,n){var r;for(let i=t;iNumber.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function sZ(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;ee.toString(16).padStart(2,"0")).join("")}var s1=class{constructor(...e){}};function s3(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):function(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:s2(this,t,n.bind(this))},set(e){s2(this,t,e)}})}(e,n,r.value)}}function s2(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function s6(e,t,n){return s2(e,t,n,!1)}function s5(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return s2(this,n,r(this))},set(e){s2(this,n,e)}})}return t}var s4=!1,s8={configurable:!0,get(){s4=!0}};function s7(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&P!==e._zod){P=void 0;return}P=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,s8);let e=s4;s4=!1;try{let r=n(this);return s4?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),s4=s4||e,r}catch(n){throw delete this[t],s4=s4||e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function s9(e,t,n,r){let i,o=t in(i=Object.getPrototypeOf(e))?void 0:i;o&&Object.defineProperty(o,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var le="~constantCatch";function lt(e){let t=()=>e;return t[le]=!0,t}var ln={value:void 0,enumerable:!1},lr="captureStackTrace"in Error?Error:null;function li(e,t,n,r){function i(e){this.def=e,this.constr=u,this.traits=new Set}i.prototype={};let o=n&&new WeakSet;function a(r,a){if(r._zod){if(r._zod.traits.has(e))return}else{ln.value=new i(a);try{Object.defineProperty(r,"_zod",ln)}finally{ln.value=void 0}}if(r._zod.traits.add(e),t(r,a),o){let e=Object.getPrototypeOf(r),t=r._zod.constr.prototype,i=e;for(;i&&i!==t;)i=Object.getPrototypeOf(i);let a=i??e;o.has(a)||(o.add(a),s3(a,n))}let s=u.prototype;for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&(e in r||(r[e]=s[e].bind(r)))}let s=r?.Parent??Object;class l extends s{}function u(e){let t=r?.Parent?function(e){let t=lr;if(t){let n=t.stackTraceLimit;if("number"==typeof n){try{t.stackTraceLimit=0}catch{return lr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}(l):this;a(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(l,"name",{value:e}),Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}var lo=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},la=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(D=globalThis).__zod_globalConfig??(D.__zod_globalConfig={});var ls=globalThis.__zod_globalConfig;function ll(e){return e&&Object.assign(ls,e),ls}var lu={get:function(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,aQ,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},ld={value:void 0,enumerable:!1},lc=new WeakSet([Object.prototype,Error.prototype]),lf=(e,t)=>{e.name="$ZodError",ld.value=t,Object.defineProperty(e,"issues",ld),ld.value=void 0,Object.defineProperty(e,"message",lu);let n=Object.getPrototypeOf(e);lc.has(n)||(lc.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},lm=li("$ZodError",lf);function lp(e,t){return{callee:t?.callee??e,Err:t?.Err}}li("$ZodError",lf,void 0,{Parent:Error});var lh=e=>{let t=(n,r,i,o)=>{let a=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new lo;if(s.issues.length){let n=new(o?.Err??e)(s.issues.map(e=>s$(e,a,ll())));throw su(n,o?.callee??t),n}return s.value};return t},lF=e=>{let t=async(n,r,i,o)=>{let a=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new(o?.Err??e)(s.issues.map(e=>s$(e,a,ll())));throw su(n,o?.callee??t),n}return s.value};return t},lg=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new lo;return o.issues.length?l_(e,o.issues,i):{success:!0,data:o.value}};function l_(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>s$(e,n,ll()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var lP=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?l_(e,o.issues,i):{success:!0,data:o.value}},lD=Symbol.for("zod.compile.invalid"),lb=Symbol.for("zod.compile.fallback"),ly=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),0===i.issues.length},lw=/^[cC][0-9a-z]{6,}$/,lE=/^[0-9a-z]+$/,lA=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,lv=/^[0-9a-vA-V]{20}$/,lS=/^[A-Za-z0-9]{27}$/,lk=/^[a-zA-Z0-9_-]{21}$/,lx=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,lG=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lO=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,lI=/^(?:[A-Za-z0-9_\'+\\-]+\\.)*[A-Za-z0-9_\'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,lN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lC=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,lj=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$/,lM=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lR=/^https?$/,lT=/^\\+[1-9]\\d{6,14}$/,lB="(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))",lL=RegExp(`^${lB}$`);function l$(e){let t="(?:[01]\\\\d|2[0-3]):[0-5]\\\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\\\d`:`${t}:[0-5]\\\\d\\\\.\\\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\\\d(?:\\\\.\\\\d+)?`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}var lz=/^[\\s\\S]{0,}$/,lU=/^-?\\d+(?:\\.\\d+)?$/,lV=/^(?:true|false)$/i,lW=/^[^A-Z]*$/,lq=/^[^a-z]*$/,lH=li("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),lK=e=>{let t=e.value;return!a0(t)&&void 0!==t.length},lZ={number:"number",bigint:"bigint",object:"date"},lJ=li("$ZodCheckLessThan",(e,t)=>{lH.init(e,t);let n=lZ[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{lH.init(e,t);let n=lZ[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:lZ[typeof r.value]??n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lX=li("$ZodCheckMultipleOf",(e,t)=>{lH.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):0===a3(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),lY=li("$ZodCheckNumberFormat",(e,t)=>{lH.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[i,o]=sE[t.format];e._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s))return void a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}so&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),l0=li("$ZodCheckMaxLength",(e,t)=>{var n;lH.init(e,t),(n=e._zod.def).when??(n.when=lK),e._zod.check=n=>{let r=n.value,i=r.length;if(("string"==typeof r&&i>t.maximum?sV(r):i)<=t.maximum)return;let o=sW(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),l1=li("$ZodCheckMinLength",(e,t)=>{var n;lH.init(e,t),(n=e._zod.def).when??(n.when=lK),e._zod.check=n=>{let r=n.value,i=r.length;if(("string"==typeof r&&i>=t.minimum&&i<2*t.minimum?sV(r):i)>=t.minimum)return;let o=sW(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),l3=li("$ZodCheckLengthEquals",(e,t)=>{var n;lH.init(e,t),(n=e._zod.def).when??(n.when=lK),e._zod.check=n=>{let r=n.value,i=r.length,o="string"==typeof r&&i>=t.length&&i<=2*t.length?sV(r):i;if(o===t.length)return;let a=sW(r),s=o>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),l2=li("$ZodCheckStringFormat",(e,t)=>{var n,r;lH.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),l6=li("$ZodCheckRegex",(e,t)=>{l2.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),l5=li("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lW),l2.init(e,t)}),l4=li("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=lq),l2.init(e,t)}),l8=li("$ZodCheckIncludes",(e,t)=>{lH.init(e,t);let n=s_(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),l7=li("$ZodCheckStartsWith",(e,t)=>{lH.init(e,t);let n=RegExp(`^${s_(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),l9=li("$ZodCheckEndsWith",(e,t)=>{lH.init(e,t);let n=RegExp(`.*${s_(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ue=li("$ZodCheckOverwrite",(e,t)=>{lH.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),ut=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split(`\n`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${t.join(`\n`)}\n};`)(...Object.values(this.closed))}},un={major:4,minor:6,patch:7},ur=li("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=un;let r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{let i;if(t.memo)return t;let o=sj(t);for(let a of n){if(a._zod.def.when){if(sM(t)||!a._zod.def.when(t))continue}else if(o)continue;let n=t.issues.length,s=a._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new lo;if(i||s instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(sL(t.issues,n,e),o||(o=sj(t,n)))});else{if(t.issues.length===n)continue;sL(t.issues,n,e),o||(o=sj(t,n))}}return i?i.then(()=>t):t},n=(n,r,o)=>{if(sj(n))return n.aborted=!0,n;let a=t(r,i,o);if(a instanceof Promise){if(!1===o.async)throw new lo;return a.then(t=>e._zod.parse(t,o))}return e._zod.parse(a,o)};e._zod.run=(r,o)=>{if(o.skipChecks)return e._zod.parse(r,o);if("backward"===o.direction){let t=e._zod.parse({value:r.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,o)):n(t,r,o)}let a=e._zod.parse(r,o);if(a instanceof Promise){if(!1===o.async)throw new lo;return a.then(e=>t(e,i,o))}return t(a,i,o)}}},{get"~standard"(){return s6(this,"~standard",ua(this))},set"~standard"(e){s2(this,"~standard",e)}}),ui=(e,t)=>e.issues.length?{issues:e.issues.map(e=>s$(e,t,ll()))}:{value:e.value};async function uo(e,t){let n={async:!0};return ui(await e._zod.run({value:t,issues:[]},n),n)}function ua(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return ui(r,n)}catch{}return uo(e,t)},vendor:"zod",version:1}}var us=li("$ZodString",(e,t)=>{ur.init(e,t),e._zod.pattern=t.pattern??lz,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ul=li("$ZodStringFormat",(e,t)=>{l2.init(e,t),us.init(e,t)}),uu=li("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=lG),ul.init(e,t)}),ud=li("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lO(e))}else t.pattern??(t.pattern=lO());ul.init(e,t)}),uc=li("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lI),ul.init(e,t)});function uf(e){try{if("u">typeof URL&&"function"==typeof URL.canParse)return URL.canParse(e);return new URL(e),!0}catch{return!1}}var um=/[\\t\\n\\r]/g;function up(e){return e.replace(um,"")}var uh=li("$ZodURL",(e,t)=>{ul.init(e,t),e._zod.check=n=>{try{var r,i;let o=n.value.trim(),a="normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===lR.source&&!/^https?:\\/\\//i.test(e))return 1;try{if("u">typeof URL){let t=URL;if("function"==typeof t.parse)return t.parse(e)??2}return new URL(e)}catch{return 2}}(o,t):uf(o)||2;if(1===a)return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});if(2===a)return void n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});if(!0===a){n.value=up(o);return}t.hostname&&((r=t.hostname).lastIndex=0,!r.test(a.hostname))&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&((i=t.protocol).lastIndex=0,!i.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol))&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?a.href:up(o);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),uF=li("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$","u")),ul.init(e,t)}),ug=li("$ZodNanoID",(e,t)=>{var n;if(void 0!==t.length&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=void 0===t.length?lk:(n=t.length,RegExp(`^[a-zA-Z0-9_-]{${n}}$`))),ul.init(e,t)}),u_=li("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=lw),ul.init(e,t)}),uP=li("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=lE),ul.init(e,t)}),uD=li("$ZodULID",(e,t)=>{t.pattern??(t.pattern=lA),ul.init(e,t)}),ub=li("$ZodXID",(e,t)=>{t.pattern??(t.pattern=lv),ul.init(e,t)}),uy=li("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=lS),ul.init(e,t)}),uw=li("$ZodISODateTime",(e,t)=>{let n,r,i;t.pattern??(n=["Z"],t.offset&&n.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)"),r=`${l$({precision:t.precision,seconds:!0})}(?:${n.join("|")})`,i=t.local?`${r}|${l$({precision:t.precision})}`:r,t.pattern=RegExp(`^${lB}T(?:${i})$`)),ul.init(e,t)}),uE=li("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=lL),ul.init(e,t)}),uA=li("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${l$(t)}$`)),ul.init(e,t)}),uv=li("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=lx),ul.init(e,t)}),uS=li("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=lN),ul.init(e,t)}),uk=/^[0-9a-fA-F:.]+$/;function ux(e){return!!uk.test(e)&&uf(`http://[${e}]`)}var uG=li("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=lC),ul.init(e,t),e._zod.check=n=>{ux(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),uO=li("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=lj),ul.init(e,t)}),uI=li("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=lM),ul.init(e,t),e._zod.check=n=>{!function(e){let t=e.split("/");if(2!==t.length)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`===r&&!(i<0)&&!(i>128)&&ux(n)}(n.value)&&n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function uN(e){if(""===e)return!0;if(/\\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var uC=/^[0-9a-zA-Z+/]*={0,2}$/,uj=li("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=uC),ul.init(e,t),e._zod.check=n=>{uN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),uM=/^[A-Za-z0-9_-]*$/,uR=li("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=uM),ul.init(e,t),e._zod.check=n=>{!function(e){if(!uM.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return uN(t.padEnd(4*Math.ceil(t.length/4),"="))}(n.value)&&n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),uT=li("$ZodE164",(e,t)=>{t.pattern??(t.pattern=lT),ul.init(e,t)}),uB=li("$ZodJWT",(e,t)=>{ul.init(e,t),e._zod.check=n=>{!function(e,t=null){try{let n=e.split(".");if(3!==n.length)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(n.value,t.alg)&&n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),uL=li("$ZodNumber",(e,t)=>{ur.init(e,t),e._zod.pattern=lU,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;let o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),u$=li("$ZodNumberFormat",(e,t)=>{lY.init(e,t),uL.init(e,t)}),uz=li("$ZodBoolean",(e,t)=>{ur.init(e,t),e._zod.pattern=lV,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),uU=li("$ZodUnknown",(e,t)=>{ur.init(e,t),e._zod.parse=e=>e}),uV=li("$ZodNever",(e,t)=>{ur.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),uW=li("$ZodDate",(e,t)=>{ur.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),n}}),uq=e=>Array.isArray(e)?e.length:-1;function uH(e,t,n){e.issues.length&&t.issues.push(...sR(n,e.issues)),t.value[n]=e.value}var uK=li("$ZodArray",(e,t)=>{ur.init(e,t);let n=ls.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=n?n.alloc(e,r,Array(o.length),i):Array(o.length);let a=[],s=i?.abortEarly;for(let e=0;euH(t,r,e)));else if(uH(l,r,e),s&&0!==l.issues.length&&sj(l))break}return a.length?Promise.all(a).then(()=>r):r},function(e,t){let n=sB(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,o)=>{let a=t(n.value);if(a>r&&!o?.skipChecks&&o?.direction!=="backward"){for(let[t,r]of sB(e._zod.def.checks))if(a>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,sL(n.issues,t,e),n}}return i(n,o)}}(e,uq)});function uZ(e,t,n,r,i,o){let a=n in r,s="optional"===o;if(a||!s||"optional"!==i){if(e.issues.length){if(void 0!==i&&s&&!a)return;t.issues.push(...sR(n,e.issues))}if(!a&&void 0===i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}void 0===e.value?(a||"defaulted"===i&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var uJ=[];function uQ(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:uJ,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let o=sw(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function uX(e,t,n,r,i,o,a){let s=[],l=i.keySet,u=i.catchall._zod,d=u.def.type,c=u.optin,f=u.optout,m=0;for(let i in t){if(a&&n.issues.length!==m){if(sj(n,m))break;m=n.issues.length}if(l.has(i))continue;if("__proto__"===i){"never"===d&&s.push(i);continue}if("never"===d){s.push(i);continue}let o=u.run({value:t[i],issues:[]},r);o instanceof Promise?e.push(o.then(e=>uZ(e,n,i,t,c,f))):uZ(o,n,i,t,c,f)}return(s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o,continue:!0}),e.length)?Promise.all(e).then(()=>n):n}var uY=li("$ZodObject",(e,t)=>{let n;ur.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),i=r?.get?r.get.raw:t.shape??{};if(i){let e=()=>{let n={...i};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=i,Object.defineProperty(t,"shape",{get:e})}let o=aY(()=>uQ(t));s7(e,"propValues",e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){for(let t of(Object.prototype.hasOwnProperty.call(n,e)||a4(n,e,new Set),r.values))n[e].add(t);void 0!==r.optin&&n[e].add(void 0)}}return n});let a=t.catchall,s=ls.memoizer;s?.attach(e),e._zod.parse=(t,r)=>{n??(n=o.value);let i=t.value;if(!sd(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value=s?s.alloc(e,t,{},r):{};let l=[],u=n.shape,d=r?.abortEarly,c=t.issues.length;for(let e of n.allKeys){if(d&&t.issues.length!==c){if(sj(t,c))break;c=t.issues.length}if("__proto__"===e)continue;let n=u[e],o=n._zod.optin,a=n._zod.optout,s=n._zod.run({value:i[e],issues:[]},r);s instanceof Promise?l.push(s.then(n=>uZ(n,t,e,i,o,a))):uZ(s,t,e,i,o,a)}return a?uX(l,i,t,r,o.value,e,!0===d):l.length?Promise.all(l).then(()=>t):t}}),u0=li("$ZodObjectJIT",(e,t)=>{let n,r;uY.init(e,t);let i=e._zod.parse,o=aY(()=>uQ(t)),a=ls.memoizer,s=!ls.jitless,l=s&&sc.value,u=t.catchall;e._zod.parse=(d,c)=>{r??(r=o.value);let f=d.value;return sd(f)?s&&l&&c?.async===!1&&!0!==c.jitless?(n||(n=(t=>{let n=o.value,r=n.symbolKeys,i=new ut(["payload","ctx"],{shape:t,inst:e,memo:a,syms:r}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,l=(e,t)=>`\n let ${e}_ab = false;\n for (let i = 0; i < ${e}.issues.length; i++) {\n const iss = ${e}.issues[i];\n iss.path = iss.path ? [${t}, ...iss.path] : [${t}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${e}_ab = true;\n }\n if (${e}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;i.write("const input = payload.value;");let u=Object.create(null),d=0;for(let e of n.allKeys)u[e]=`key_${d++}`;for(let e of(i.write(a?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};"),n.allKeys)){if("__proto__"===e)continue;let n=u[e],o="symbol"==typeof e?`syms[${r.indexOf(e)}]`:ss(e),a=`${o} in input`,d=t[e],c=d?._zod?.optin,f=void 0!==c,m=d?._zod?.optout==="optional";if(i.write(`const ${n} = ${s(o)};`),f&&m){let e="optional"===c?`${n}_present`:`${n}.value !== undefined || ${n}_present`;i.write(`\n const ${n}_present = ${a};\n if (!${n}.issues.length || ${n}_present) {\n if (${n}.issues.length) {${l(n,o)}\n }\n\n if (${e}) {\n newResult[${o}] = ${n}.value;\n }\n }\n\n `)}else f?(i.write(`\n if (${n}.issues.length) {${l(n,o)}\n }\n `),"defaulted"===c?i.write(`newResult[${o}] = ${n}.value;`):i.write(`\n if (${n}.value !== undefined || ${a}) {\n newResult[${o}] = ${n}.value;\n }\n `)):i.write(`\n const ${n}_present = ${a};\n if (${n}.issues.length) {${l(n,o)}\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${o}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${n}_present) {\n newResult[${o}] = ${n}.value;\n }\n\n `)}return i.write("payload.value = newResult;"),i.write("return payload;"),i.compile()})(t.shape)),d=n(d,c),u)?uX([],f,d,c,r,e,c?.abortEarly===!0):d:i(d,c):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function u1(e,t,n,r){for(let n of e)if(0===n.issues.length)return t.value=n.value,t;let i=e.filter(e=>!sj(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>s$(e,r,ll())))}),t)}var u3=li("$ZodUnion",(e,t)=>{ur.init(e,t),s7(e,"optin",e=>e.def.options.some(e=>"defaulted"===e._zod.optin)?"defaulted":e.def.options.some(e=>void 0!==e._zod.optin)?"optional":void 0),s7(e,"optout",e=>e.def.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),s7(e,"values",e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),s7(e,"pattern",e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>a1(e.source)).join("|")})$`)}});let n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1,a=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)a.push(t),o=!0;else{if(0===t.issues.length)return t;a.push(t)}}return o?Promise.all(a).then(t=>u1(t,r,e,i)):u1(a,r,e,i)}});function u2(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||0===r.size)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(void 0!==e)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var u6=li("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,u3.init(e,t);let n=e._zod.parse;s7(e,"propValues",e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||0===Object.keys(i).length)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);for(let[r,o]of(i[e.def.discriminator]?.has(void 0)&&n++,Object.entries(i)))for(let e of(Object.prototype.hasOwnProperty.call(t,r)||a4(t,r,new Set),o))t[r].add(e)}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=a8(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=aY(()=>u2(t));e._zod.parse=(i,o)=>{let a=i.value;if(!sd(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let s=a?.[t.discriminator],l=r.value.get(s);return l&&(void 0!==s||"backward"!==o.direction)?l._zod.run(i,o):t.unionFallback||"backward"===o.direction?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>null!==r.value.get(e)),input:a,path:[t.discriminator],inst:e}),i)}}),u5=li("$ZodIntersection",(e,t)=>{ur.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>u4(e,t,n)):u4(e,i,o)}});function u4(e,t,n){let r,i=new Map,o=new Map,a=(e,t)=>{let n;if("unrecognized_keys"!==e.code||e.path?.length)if("invalid_key"!==e.code||"record"!==e.origin||e.path?.length!==1)return!1;else{let t=String(e.path[0]);o.has(t)||o.set(t,e),n=[t]}else r??(r=e),n=e.keys;for(let e of n)i.has(e)||i.set(e,{}),i.get(e)[t]=!0;return!0};for(let n of t.issues)a(n,"l")||e.issues.push(n);for(let t of n.issues)a(t,"r")||e.issues.push(t);let s=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=r?s.filter(e=>r.keys.includes(e)):[];for(let n of(t.length&&e.issues.push({...r,keys:t}),s))!t.includes(n)&&o.has(n)&&e.issues.push(o.get(n))}let l=function e(t,n){if(t===n||t instanceof Date&&n instanceof Date&&+t==+n)return{valid:!0,data:t};if(sf(t)&&sf(n)){let r=Object.keys(n),i=Object.keys(t).filter(e=>-1!==r.indexOf(e)),o={...t,...n};for(let r of(Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__,i)){if("__proto__"===r)continue;let i=e(t[r],n[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};o[r]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let i=0;i{ur.init(e,t);let n=t.items,r=ls.memoizer;r?.attach(e),e._zod.parse=(i,o)=>{let a=i.value;if(!Array.isArray(a))return i.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=r?r.alloc(e,i,[],o):[];let s=[],l=u7(n,"optin"),u=u7(n,"optout");if(!t.rest){if(a.lengthn.length&&i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:a,inst:e,origin:"array"})}let d=Array(n.length),c=t.rest?o?.abortEarly:void 0,f=!1;for(let e=0;e{d[e]=t})):(d[e]=t,c&&!f&&t.issues.length&&(f=sj(t)))}if(t.rest&&!f){let e=n.length-1,r=a.slice(n.length),l=i.issues.length;for(let n of r){if(c&&i.issues.length!==l){if(sj(i,l))break;l=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},o);r instanceof Promise?s.push(r.then(t=>u9(t,i,e))):u9(r,i,e)}}return s.length?Promise.all(s).then(()=>de(d,i,n,a,u)):de(d,i,n,a,u)}});function u7(e,t){for(let n=e.length-1;n>=0;n--)if(!("optin"===t?void 0!==e[n]._zod.optin:"optional"===e[n]._zod.optout))return n+1;return 0}function u9(e,t,n){e.issues.length&&t.issues.push(...sR(n,e.issues)),t.value[n]=e.value}function de(e,t,n,r,i){for(let o=0;o=i&&"optional"===n[o]._zod.optin){t.value.length=o;break}if(a.issues.length){if(!s&&o>=i){t.value.length=o;break}t.issues.push(...sR(o,a.issues))}t.value[o]=a.value}for(let e=t.value.length-1;e>=r.length;e--)if("optional"===n[e]._zod.optout&&void 0===t.value[e])t.value.length=e;else break;return t}var dt=li("$ZodEnum",(e,t)=>{ur.init(e,t);let n=aZ(t.entries),r=new Set(n);e._zod.values=r,s7(e,"pattern",e=>{let t=aZ(e.def.entries).filter(e=>sF.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>s_(e.toString())).join("|")})$`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(t,i)=>{let o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),dn=li("$ZodLiteral",(e,t)=>{ur.init(e,t);let n=new Set(t.values);e._zod.values=n,s7(e,"pattern",e=>{let t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?s_(e):e?s_(e.toString()):String(e)).join("|")})$`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(r,i)=>{let o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),dr=li("$ZodTransform",(e,t)=>{ur.init(e,t),e._zod.optin="optional",ls.memoizer?.guard(e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new la(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new lo;return n.value=i,n}});function di(e,t){return e.value=t.issues.length?void 0:t.value,e}var da=li("$ZodOptional",(e,t)=>{ur.init(e,t),s7(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",s7(e,"values",e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),s7(e,"pattern",e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${a1(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>di(e,t)):di(e,r)}return t.innerType._zod.run(e,n)}}),ds=li("$ZodExactOptional",(e,t)=>{da.init(e,t),s7(e,"values",e=>e.def.innerType._zod.values),s7(e,"pattern",e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),dl=li("$ZodNullable",(e,t)=>{ur.init(e,t),s7(e,"optin",e=>e.def.innerType._zod.optin),s7(e,"optout",e=>e.def.innerType._zod.optout),s7(e,"pattern",e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${a1(t.source)}|null)$`):void 0}),s7(e,"values",e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),du=li("$ZodDefault",(e,t)=>{ur.init(e,t),e._zod.optin="defaulted",s7(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>dd(e,t)):dd(r,t)}});function dd(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var dc=li("$ZodPrefault",(e,t)=>{ur.init(e,t),e._zod.optin="defaulted",s7(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),df=li("$ZodNonOptional",(e,t)=>{ur.init(e,t),s7(e,"values",e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>dm(t,e)):dm(i,e)}});function dm(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function dp(e,t,n,r){return t.issues.length?e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>s$(e,r,ll()))},input:e.value}):(e.value=t.value,t.memo&&(e.memo=!0)),e}var dh=li("$ZodCatch",(e,t)=>{ur.init(e,t),s7(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),s7(e,"optout",e=>e.def.innerType._zod.optout),s7(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>dp(e,r,t,n)):dp(e,r,t,n)}}),dF=li("$ZodPipe",(e,t)=>{ur.init(e,t),s7(e,"values",e=>e.def.in._zod.values),s7(e,"optin",e=>e.def.in._zod.optin),s7(e,"optout",e=>e.def.out._zod.optout),s7(e,"propValues",e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>dg(e,t.in,n)):dg(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>dg(e,t.out,n)):dg(r,t.out,n)}});function dg(e,t,n){return e.issues.some(e=>"unrecognized_keys"!==e.code)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var d_=li("$ZodPreprocess",(e,t)=>{dF.init(e,t)}),dP=li("$ZodReadonly",(e,t)=>{ur.init(e,t),s7(e,"propValues",e=>e.def.innerType._zod.propValues),s7(e,"values",e=>e.def.innerType._zod.values),s7(e,"optin",e=>e.def.innerType?._zod?.optin),s7(e,"optout",e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(dD):dD(r)}});function dD(e){return e.memo||(e.value=Object.freeze(e.value)),e}var db=li("$ZodLazy",(e,t)=>{ur.init(e,t),a6(e._zod,"innerType",()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner)),s7(e,"pattern",e=>e.innerType?._zod?.pattern),s7(e,"propValues",e=>e.innerType?._zod?.propValues),s7(e,"optin",e=>e.innerType?._zod?.optin??void 0),s7(e,"optout",e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),dy=li("$ZodCustom",(e,t)=>{lH.init(e,t),ur.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>dw(t,n,r,e));dw(i,n,r,e)}});function dw(e,t,n,r){if(!e){let e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(sH(e))}}var dE=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},dA="~memo",dv=[];function dS(e){return null!==e&&"object"==typeof e}function dk(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var dx=new WeakMap,dG=[],dO={alloc(e,t,n){let r=b;if(!r)return n;b=void 0;let i={value:n,issues:null};return r.set(t.value,i),dG.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{var r,i;let o;if("backward"!==n.direction&&(r=n,i=e.value,void 0!==(o=r[dA]?.backEdges)&&dS(i)&&o.has(i)))throw new dE;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i,o=!1;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(s,l)=>{let u;if(void 0===n){let r=function e(t,n,r){var i,o;let a=dx.get(t);if(void 0!==a)return 2*!!a;if(n.has(t))return 2;n.add(t);let s=0,l=t=>{if(2!==s&&t?._zod){let i=e(t,n,r);i>s&&(s=i)}},u=e=>{e>s&&(s=e)},d=t._zod.def;switch(d.type){case"object":{let t=a8(d);u(t?((t,i)=>{let o=0;for(let a of Reflect.ownKeys(t)){let s=Object.getOwnPropertyDescriptor(t,a);if(i&&!s.enumerable)continue;let l=s.get?1:s.value?._zod?e(s.value,n,r):0;l>o&&(o=l)}return o})(t,!0):1),l(d.catchall);break}case"array":l(d.element);break;case"tuple":for(let e of d.items)l(e);l(d.rest);break;case"record":case"map":l(d.keyType),l(d.valueType);break;case"set":l(d.valueType);break;case"union":for(let e of d.options)l(e);break;case"intersection":l(d.left),l(d.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":l(d.innerType);break;case"pipe":l(d.in),l(d.out);break;case"function":l(d.input),l(d.output);break;case"lazy":{let i=d._cachedInner??(r?t._zod.innerType:void 0);u(i?e(i,n,!1):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let e in d){let t=Object.getOwnPropertyDescriptor(d,e);if(!t||t.get)continue;let n=t.value;if(n&&"object"==typeof n){if(n._zod)l(n);else if(Array.isArray(n))for(let e of n)l(e)}}}return n.delete(t),i=t,1!==(o=s)&&dx.set(i,2===o),o}(e,new Set,!1);if(0===r)return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(s,l);2===r||o?n=!0:o=!0}let d=s.value;if(!dS(d))return t(s,l);let c=l[dA];if(c||(c={buckets:new WeakMap,backEdges:void 0},l[dA]=c),r===l)u=i;else{var f;let t;(t=(f=c).buckets.get(e))||(t=new WeakMap,f.buckets.set(e,t)),u=t,r=l,i=u}let m=u.get(d);if(m)return s.value=m.value,m.issues?m.issues.length&&s.issues.push(...dk(m.issues)):(s.memo=!0,c.backEdges??(c.backEdges=new WeakSet),c.backEdges.add(m.value)),s;b=u;let p=dG.length,h=t(s,l);b=void 0;let F=dG.length>p?dG.pop():void 0;return h instanceof Promise?h.then(e=>(F&&(F.issues=e.issues.length?dk(e.issues):dv),e)):(F&&(F.issues=h.issues.length?dk(h.issues):dv),h)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}},dI=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};(y=globalThis).__zod_globalRegistry??(y.__zod_globalRegistry=new dI);var dN=globalThis.__zod_globalRegistry;function dC(e){return e.checks&&(e.checks=[...e.checks]),e}function dj(e,t){return new lJ({check:"less_than",...sD(t),value:e,inclusive:!1})}function dM(e,t){return new lJ({check:"less_than",...sD(t),value:e,inclusive:!0})}function dR(e,t){return new lQ({check:"greater_than",...sD(t),value:e,inclusive:!1})}function dT(e,t){return new lQ({check:"greater_than",...sD(t),value:e,inclusive:!0})}function dB(e,t){return new lX({check:"multiple_of",...sD(t),value:e})}function dL(e,t){return new l0({check:"max_length",...sD(t),maximum:e})}function d$(e,t){return new l1({check:"min_length",...sD(t),minimum:e})}function dz(e,t){return new l3({check:"length_equals",...sD(t),length:e})}function dU(e){return new ue({check:"overwrite",tx:e})}function dV(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&a4(e,t,n[t]);return e}function dW(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??dN,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function dq(e,t,n,r,i){let o="function"==typeof t.unrepresentable?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw Error(i);return Object.assign(n,o),!0}function dH(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,r);else{let n=a.schema,o=t.processors[i.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}let o=e._zod.parent;o&&(a.ref||(a.ref=o),dH(o,t,r),t.seen.get(o).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&dV(a.schema,l),"input"===t.io&&function e(t,n){let r=n??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,r);if("set"===i.type)return e(i.valueType,r);if("lazy"===i.type)return e(i.getter(),r);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type||"catch"===i.type)return e(i.innerType,r);if("intersection"===i.type)return e(i.left,r)||e(i.right,r);if("record"===i.type||"map"===i.type)return e(i.keyType,r)||e(i.valueType,r);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,r)||e(i.out,r);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],r))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,r))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,r))return!0;if(i.rest&&e(i.rest,r))return!0}return!1}(e)&&(delete a.schema.examples,delete a.schema.default),"input"===t.io&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function dK(e){return e.replace(/~/g,"~0").replace(/\\//g,"~1")}function dZ(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let r=t[1],{ref:i,defId:o}=(t=>{let r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let o=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${dK(o)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:"#"};let o=t[1].schema.id??`__schema${e.counter++}`;return{defId:o,ref:i+dK(o)}})(t);r.def={...r.schema},o&&(r.defId=o);let a=r.schema;for(let e in a)delete a[e];a.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){i(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}if(e.metadataRegistry.get(n[0])?.id||r.cycle){i(n);continue}r.count>1&&"ref"===e.reused&&i(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}var dJ=new Set(["type","properties","required","additionalProperties"]),dQ=["oneOf","anyOf"];function dX(e){let t=e.additionalProperties;return void 0===t||!1===t||"object"!=typeof t||null===t?null:Object.keys(t).length?t:null}function dY(e){let t=[];for(let n of e){if("object"!=typeof n||"object"!==n.type)return null;for(let e in n)if(!dJ.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??dX(n);null!=t&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}a4(n,r,1===e.length?e[0]:dY(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(e=>!1===e.additionalProperties))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=dX(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}1===e.length?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function d0(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=t=>{let n=e.seen.get(t);if(null===n.ref)return;let i=n.def??n.schema,o={...i},a=n.ref;if(n.ref=null,a){r(a);let n=e.seen.get(a),s=n.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):dV(i,s),dV(i,o),t._zod.parent===a)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(s.$ref&&n.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==a){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if("openapi-3.0"!==e.target)for(let t of e.seen.entries())!function e(t){let n=t.anyOf;if(!Array.isArray(n)||0===n.length||void 0!==t.type)return;let r=[];for(let t of n){if(!t||"object"!=typeof t)return;e(t);let n=Object.keys(t);if(1!==n.length||"type"!==n[0])return;let i=t.type;for(let e of Array.isArray(i)?i:[i]){if("string"!=typeof e)return;r.includes(e)||r.push(e)}}delete t.anyOf,t.type=1===r.length?r[0]:r}(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])!function(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of dJ)if(t in e)return;let n=t.filter(e=>dQ.some(t=>Array.isArray(e[t]))),r=null;if(n.length){let e=n[0],i=dQ.find(t=>Array.isArray(e[t]));if(1!==Object.keys(e).length)return;let o=t.filter(t=>t!==e),a=e[i].map(e=>dY([...o,e]));if(a.some(e=>!e))return;r={[i]:a}}else r=dY(t);r&&(delete e.allOf,dV(e,r))}(e)}}let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}dV(i,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,a4(a,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&("draft-2020-12"===e.target?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:d1(t,"input",e.processors),output:d1(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error("Error converting schema to JSON.")}}var d1=(e,t,n={})=>r=>{let{libraryOptions:i,target:o}=r??{},a=dW({...i??{},target:o,io:t,processors:n});return dH(e,a),dZ(a,e),d0(a,e)},d3=(e,t,n)=>{(void 0===e[t]||n>e[t])&&(e[t]=n)},d2=(e,t,n)=>{(void 0===e[t]||n{d3(e,"minimum",t),d2(e,"maximum",t)},d5=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},d4=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},d8=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},d7=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},d9=(e,t)=>d3(e,"minimum",t.minimum),ce=(e,t)=>d2(e,"maximum",t.maximum),ct=e=>(t,n)=>{d7(t,n.format);let[r,i]=e[n.format];d3(t,"minimum",r),d2(t,"maximum",i)},cn={greater_than:(e,t)=>d3(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>d2(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>d5(e,t.value),number_format:ct(sE),bigint_format:ct(sA),min_length:d9,max_length:ce,length_equals:(e,t)=>d6(e,t.length),min_size:d9,max_size:ce,size_equals:(e,t)=>d6(e,t.size),string_format:(e,t)=>{d7(e,t.format),t.pattern&&d4(e,t.pattern),("base64"===t.format||"base64url"===t.format)&&(e.contentEncoding=t.format),(t.local||-1===t.precision)&&(e.laxFormat=!0)},mime_type:(e,t)=>d8(e,t.mime)};function cr(e){let t={},n=e._zod.def;for(let r of e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[])cn[r._zod.def.check]?.(t,r._zod.def);let r=e._zod.bag;for(let e of(void 0!==r.minimum&&d3(t,"minimum",r.minimum),void 0!==r.exclusiveMinimum&&d3(t,"exclusiveMinimum",r.exclusiveMinimum),void 0!==r.maximum&&d2(t,"maximum",r.maximum),void 0!==r.exclusiveMaximum&&d2(t,"exclusiveMaximum",r.exclusiveMaximum),void 0!==r.multipleOf&&d5(t,r.multipleOf),void 0!==r.format&&(t.format??(t.format=r.format),r.format.includes("int")&&(t.isInt=!0)),r.mime&&d8(t,r.mime),r.patterns??[]))d4(t,e);return t}var ci={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},co=new Map([[uC,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[uM,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),ca=e=>co.get(e)??e;function cs(e){let t=e._zod.def;return"pipe"===t.type&&t.in._zod.traits.has("$ZodTransform")?cs(t.out):"catch"===t.type?cs(t.innerType):e._zod.optin}var cl=Symbol();function cu(e,t,n,r,i){let o=!1,a=JSON.stringify(e,(e,t)=>"bigint"!=typeof t?t:(o=!0,null));return o?(dq(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),cl):JSON.parse(a)}var cd=(e,t,n,r)=>{let i=e._zod.def;dH(i.innerType,t,r),t.seen.get(e).ref=i.innerType},cc=new WeakSet([Object.prototype,Error.prototype]);function cf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var cm=li("ZodError",(e,t)=>{lm.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);cc.has(n)||(cc.add(n),cf(n,"format",e=>t=>(function(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{let e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;it=>(function(e,t=e=>e.message){let n={},r=[];for(let a of e.issues)if(a.path.length>0){var i,o;(i=a.path[0],o=()=>[],!Object.prototype.hasOwnProperty.call(n,i)&&("__proto__"===i?Object.defineProperty(n,i,{value:o(),writable:!0,enumerable:!0,configurable:!0}):n[i]=o()),n[i]).push(t(a))}else r.push(t(a));return{formErrors:r,fieldErrors:n}})(e,t)),cf(n,"addIssue",e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,aQ,2)}),cf(n,"addIssues",e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,aQ,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},void 0,{Parent:Error}),cp=lh(cm),ch=lF(cm),cF=lg(cm),cg=lP(cm),c_=(i=lh(cm),o=(e,t,n,r)=>i(e,t,n?{...n,direction:"backward"}:{direction:"backward"},lp(o,r))),cP=(a=lh(cm),s=(e,t,n,r)=>a(e,t,n,lp(s,r))),cD=(l=lF(cm),u=async(e,t,n,r)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return await l(e,t,i,lp(u,r))}),cb=(d=lF(cm),c=async(e,t,n,r)=>await d(e,t,n,lp(c,r))),cy=(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return lg(cm)(e,t,r)},cw=(e,t,n)=>lg(cm)(e,t,n),cE=async(e,t,n)=>{let r=n?{...n,direction:"backward"}:{direction:"backward"};return lP(cm)(e,t,r)},cA=async(e,t,n)=>lP(cm)(e,t,n);function cv(){ls.memoizer||ll({memoizer:dO})}var cS=li("ZodType",(e,t)=>(ls.localeError||ll({localeError:(()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function r(e,t){return"number"!==e||"number"!=typeof t||Number.isFinite(t)?n[e]??e:String(t)}return n=>{switch(n.code){case"invalid_type":{let e=r(n.expected),t=r(sq(n.input),n.input);return`Invalid input: expected ${e}, received ${t}`}case"invalid_value":if(1===n.values.length)return`Invalid input: expected ${sy(n.values[0])}`;return`Invalid option: expected one of ${aJ(n.values,"|")}`;case"too_big":{let t=n.exact?"exactly ":n.inclusive?"<=":"<",r=e[n.origin]??null;if(r)return`Too big: expected ${n.origin??"value"} to have ${t}${n.maximum.toString()} ${r.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${t}${n.maximum.toString()}`}case"too_small":{let t=n.exact?"exactly ":n.inclusive?">=":">",r=e[n.origin]??null;if(r)return`Too small: expected ${n.origin} to have ${t}${n.minimum.toString()} ${r.unit}`;return`Too small: expected ${n.origin} to be ${t}${n.minimum.toString()}`}case"invalid_format":if("starts_with"===n.format)return`Invalid string: must start with "${n.prefix}"`;if("ends_with"===n.format)return`Invalid string: must end with "${n.suffix}"`;if("includes"===n.format)return`Invalid string: must include "${n.includes}"`;if("regex"===n.format)return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${t[n.format]??n.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${aJ(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0){let e=n.options.map(e=>`\'${e}\'`).join(" | ");return`Invalid discriminator value. Expected ${e}`}if(!1===n.inclusive)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}})()}),ur.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(az.mergeDefs(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return sP(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new fC({type:"custom",check:"custom",fn:e,...sD(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var n;let r,i;return n=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(sH(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),"input"in e||(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(sH(e)))},e(t.value,t)),(i=new lH({check:"custom",...sD(t)}))._zod.check=n,r=i}(e,t))},overwrite(e){return this.check(dU(e))},optional(){return fD(this)},exactOptional(){var e;return e=this,new fb({type:"optional",innerType:e})},nullable(){return fw(this)},nullish(){return fD(fw(this))},nonoptional(e){var t,n;return t=this,n=e,new fv({type:"nonoptional",innerType:t,...az.normalizeParams(n)})},array(){return fr(this)},or(e){return fs([this,e])},and(e){var t;return t=this,new fd({type:"intersection",left:t,right:e})},transform(e){return fx(this,f_(e))},default(e){var t,n;return t=this,n=e,new fE({type:"default",innerType:t,get defaultValue(){return"function"==typeof n?n():az.shallowClone(n)}})},prefault(e){var t,n;return t=this,n=e,new fA({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof n?n():az.shallowClone(n)}})},catch(e){var t,n;return t=this,new fS({type:"catch",innerType:t,catchValue:"function"==typeof(n=e)?n:az.constantCatch(n)})},pipe(e){return fx(this,e)},readonly(){var e;return e=this,new fO({type:"readonly",innerType:e})},describe(e){let t=this.clone();return dN.add(t,{description:e}),t},meta(...e){if(0===e.length)return dN.get(this);let t=this.clone();return dN.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return 0===t.length?e(this):e(this,...t)},get"~standard"(){return az.hide(this,"~standard",{...ua(this),jsonSchema:{input:d1(this,"input"),output:d1(this,"output")}})},set"~standard"(e){az.own(this,"~standard",e)},parse:function e(t,n){return cp(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ch(this,t,n,{callee:e})},safeParse(e,t){return cF(this,e,t)},async safeParseAsync(e,t){return cg(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){az.own(this,"spa",e)},validate(e,t){let n=this._zod.bag.validator;if(void 0!==n){if(n(e)!==lD)return!0;if(!0===n.definite&&void 0===t)return!1}return function(e,t,n){let r,i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun;if(o?(i[lb]=!0,r=o({value:t,issues:[]},i)):r=e._zod.run({value:t,issues:[]},i),r instanceof Promise)throw new lo;return 0===r.issues.length}(this,e,t)},validateAsync(e,t){return ly(this,e,t)},encode:function e(t,n){return c_(this,t,n,{callee:e})},decode:function e(t,n){return cP(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await cD(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await cb(this,t,n,{callee:e})},safeEncode(e,t){return cy(this,e,t)},safeDecode(e,t){return cw(this,e,t)},async safeEncodeAsync(e,t){return cE(this,e,t)},async safeDecodeAsync(e,t){return cA(this,e,t)},toJSONSchema(e){return((e,t={})=>n=>{let r=dW({...n,processors:t});return dH(e,r),dZ(r,e),d0(r,e)})(this,{})(e)},get description(){return dN.get(this)?.description},get _def(){return this._zod.def}}),ck=li("_ZodString",(e,t)=>{us.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{n.type="string";let{minimum:r,maximum:i,format:o,patterns:a,contentEncoding:s,laxFormat:l}=cr(e);if("number"==typeof r&&(n.minLength=r),"number"==typeof i&&(n.maxLength=i),o&&(n.format=ci[o]??o,""===n.format&&delete n.format,("time"===o||l)&&delete n.format),s&&(n.contentEncoding=s),a&&a.size>0){let e=[...a].map(ca);1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n)},az.derived({format:e=>cr(e).format??null,minLength:e=>cr(e).minimum??null,maxLength:e=>cr(e).maximum??null},{regex(...e){return this.check(function(e,t){return new l6({check:"string_format",format:"regex",...sD(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new l8({check:"string_format",format:"includes",...sD(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new l7({check:"string_format",format:"starts_with",...sD(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new l9({check:"string_format",format:"ends_with",...sD(t),suffix:e})}(...e))},min(...e){return this.check(d$(...e))},max(...e){return this.check(dL(...e))},length(...e){return this.check(dz(...e))},nonempty(...e){return this.check(d$(1,...e))},lowercase(e){return this.check(new l5({check:"string_format",format:"lowercase",...sD(e)}))},uppercase(e){return this.check(new l4({check:"string_format",format:"uppercase",...sD(e)}))},trim(){return this.check(dU(e=>e.trim()))},normalize(...e){return this.check(function(e){return dU(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(dU(e=>e.toLowerCase()))},toUpperCase(){return this.check(dU(e=>e.toUpperCase()))},slugify(){return this.check(dU(e=>sl(e)))}})),cx=li("ZodString",(e,t)=>{us.init(e,t),ck.init(e,t)},{email(e){return this.check(new cM({type:"string",format:"email",check:"string_format",abort:!1,...sD(e)}))},url(e){return this.check(new cB({type:"string",format:"url",check:"string_format",abort:!1,...sD(e)}))},jwt(e){return this.check(new c0({type:"string",format:"jwt",check:"string_format",abort:!1,...sD(e)}))},emoji(e){return this.check(new cL({type:"string",format:"emoji",check:"string_format",abort:!1,...sD(e)}))},guid(e){return this.check(new cR({type:"string",format:"guid",check:"string_format",abort:!1,...sD(e)}))},uuid(e){return this.check(new cT({type:"string",format:"uuid",check:"string_format",abort:!1,...sD(e)}))},uuidv4(e){return this.check(new cT({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...sD(e)}))},uuidv6(e){return this.check(new cT({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...sD(e)}))},uuidv7(e){return this.check(new cT({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...sD(e)}))},nanoid(e){return this.check(new c$({type:"string",format:"nanoid",check:"string_format",abort:!1,...sD(e)}))},cuid(e){return this.check(new cz({type:"string",format:"cuid",check:"string_format",abort:!1,...sD(e)}))},cuid2(e){return this.check(new cU({type:"string",format:"cuid2",check:"string_format",abort:!1,...sD(e)}))},ulid(e){return this.check(new cV({type:"string",format:"ulid",check:"string_format",abort:!1,...sD(e)}))},base64(e){return this.check(new cQ({type:"string",format:"base64",check:"string_format",abort:!1,...sD(e)}))},base64url(e){return this.check(new cX({type:"string",format:"base64url",check:"string_format",abort:!1,...sD(e)}))},xid(e){return this.check(new cW({type:"string",format:"xid",check:"string_format",abort:!1,...sD(e)}))},ksuid(e){return this.check(new cq({type:"string",format:"ksuid",check:"string_format",abort:!1,...sD(e)}))},ipv4(e){return this.check(new cH({type:"string",format:"ipv4",check:"string_format",abort:!1,...sD(e)}))},ipv6(e){return this.check(new cK({type:"string",format:"ipv6",check:"string_format",abort:!1,...sD(e)}))},cidrv4(e){return this.check(new cZ({type:"string",format:"cidrv4",check:"string_format",abort:!1,...sD(e)}))},cidrv6(e){return this.check(new cJ({type:"string",format:"cidrv6",check:"string_format",abort:!1,...sD(e)}))},e164(e){return this.check(new cY({type:"string",format:"e164",check:"string_format",abort:!1,...sD(e)}))},datetime(e){return this.check(new cI({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...sD(e)}))},date(e){return this.check(new cN({type:"string",format:"date",check:"string_format",...sD(e)}))},time(e){return this.check(new cC({type:"string",format:"time",check:"string_format",precision:null,...sD(e)}))},duration(e){return this.check(new cj({type:"string",format:"duration",check:"string_format",...sD(e)}))}});function cG(e){return new cx(dC({type:"string",...sD(e)}))}var cO=li("ZodStringFormat",(e,t)=>{ul.init(e,t),ck.init(e,t)}),cI=li("ZodISODateTime",(e,t)=>{uw.init(e,t),cO.init(e,t)}),cN=li("ZodISODate",(e,t)=>{uE.init(e,t),cO.init(e,t)}),cC=li("ZodISOTime",(e,t)=>{uA.init(e,t),cO.init(e,t)}),cj=li("ZodISODuration",(e,t)=>{uv.init(e,t),cO.init(e,t)}),cM=li("ZodEmail",(e,t)=>{uc.init(e,t),cO.init(e,t)}),cR=li("ZodGUID",(e,t)=>{uu.init(e,t),cO.init(e,t)}),cT=li("ZodUUID",(e,t)=>{ud.init(e,t),cO.init(e,t)}),cB=li("ZodURL",(e,t)=>{uh.init(e,t),cO.init(e,t)}),cL=li("ZodEmoji",(e,t)=>{uF.init(e,t),cO.init(e,t)}),c$=li("ZodNanoID",(e,t)=>{ug.init(e,t),cO.init(e,t)}),cz=li("ZodCUID",(e,t)=>{u_.init(e,t),cO.init(e,t)}),cU=li("ZodCUID2",(e,t)=>{uP.init(e,t),cO.init(e,t)}),cV=li("ZodULID",(e,t)=>{uD.init(e,t),cO.init(e,t)}),cW=li("ZodXID",(e,t)=>{ub.init(e,t),cO.init(e,t)}),cq=li("ZodKSUID",(e,t)=>{uy.init(e,t),cO.init(e,t)}),cH=li("ZodIPv4",(e,t)=>{uS.init(e,t),cO.init(e,t)}),cK=li("ZodIPv6",(e,t)=>{uG.init(e,t),cO.init(e,t)}),cZ=li("ZodCIDRv4",(e,t)=>{uO.init(e,t),cO.init(e,t)}),cJ=li("ZodCIDRv6",(e,t)=>{uI.init(e,t),cO.init(e,t)}),cQ=li("ZodBase64",(e,t)=>{uj.init(e,t),cO.init(e,t)}),cX=li("ZodBase64URL",(e,t)=>{uR.init(e,t),cO.init(e,t)}),cY=li("ZodE164",(e,t)=>{uT.init(e,t),cO.init(e,t)}),c0=li("ZodJWT",(e,t)=>{uB.init(e,t),cO.init(e,t)}),c1=li("ZodNumber",(e,t)=>{uL.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let{minimum:i,maximum:o,multipleOf:a,exclusiveMaximum:s,exclusiveMinimum:l,isInt:u}=cr(e);n.type=u?"integer":"number";let d="number"==typeof l&&l>=(i??-1/0),c="number"==typeof s&&s<=(o??1/0),f="draft-04"===t.target||"openapi-3.0"===t.target;if(d?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:"number"==typeof i&&(n.minimum=i),c?f?(n.maximum=s,n.exclusiveMaximum=!0):n.exclusiveMaximum=s:"number"==typeof o&&(n.maximum=o),a){let i=new Set;for(let o of a)Number.isFinite(o)&&0!==o?i.add(Math.abs(o)):dq(e,t,n,r,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);let[o,...s]=i;void 0!==o&&(n.multipleOf=o),s.length&&(n.allOf=[...n.allOf??[],...s.map(e=>({multipleOf:e}))])}})(e,t,n,r),e.isFinite=!0},az.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=cr(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=cr(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=cr(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>cr(e).format??null},{gt(e,t){return this.check(dR(e,t))},gte(e,t){return this.check(dT(e,t))},min(e,t){return this.check(dT(e,t))},lt(e,t){return this.check(dj(e,t))},lte(e,t){return this.check(dM(e,t))},max(e,t){return this.check(dM(e,t))},int(e){return this.check(c6(e))},safe(e){return this.check(c6(e))},positive(e){return this.check(dR(0,e))},nonnegative(e){return this.check(dT(0,e))},negative(e){return this.check(dj(0,e))},nonpositive(e){return this.check(dM(0,e))},multipleOf(e,t){return this.check(dB(e,t))},step(e,t){return this.check(dB(e,t))},finite(){return this}}));function c3(e){return new c1(dC({type:"number",checks:[],...sD(e)}))}var c2=li("ZodNumberFormat",(e,t)=>{u$.init(e,t),c1.init(e,t)});function c6(e){return new c2({type:"number",check:"number_format",abort:!1,format:"safeint",...sD(e)})}var c5=li("ZodBoolean",(e,t)=>{uz.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.type="boolean"}});function c4(e){return new c5({type:"boolean",...sD(e)})}var c8=li("ZodUnknown",(e,t)=>{uU.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function c7(){return new c8({type:"unknown"})}var c9=li("ZodNever",(e,t)=>{uV.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.not={}}});function fe(e){return new c9({type:"never",...sD(e)})}var ft=li("ZodDate",(e,t)=>{uW.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{dq(e,t,n,r,"Date cannot be represented in JSON Schema")},e.min=(t,n)=>e.check(dT(t,n)),e.max=(t,n)=>e.check(dM(t,n))},az.derived({minDate:e=>{let{minimum:t}=cr(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=cr(e);return t?new Date(t):null}},{})),fn=li("ZodArray",(e,t)=>{cv(),uK.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def,{minimum:o,maximum:a}=cr(e);"number"==typeof o&&(n.minItems=o),"number"==typeof a&&(n.maxItems=a),n.type="array",n.items=dH(i.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element},{min(e,t){return this.check(d$(e,t))},nonempty(e){return this.check(d$(1,e))},max(e,t){return this.check(dL(e,t))},length(e,t){return this.check(dz(e,t))},unwrap(){return this.element}});function fr(e,t){return new fn({type:"array",element:e,...sD(t)})}var fi=li("ZodObject",(e,t)=>{cv(),u0.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def,o=i.shape;if(Object.getOwnPropertySymbols(o).length&&dq(e,t,n,r,"Symbol keys cannot be represented in JSON Schema"))return;for(let e in n.type="object",n.properties={},o)a4(n.properties,e,dH(o[e],t,{...r,path:[...r.path,"properties",e]}));let a=[];for(let e of Object.keys(o)){let n=i.shape[e];("input"===t.io?void 0===cs(n):void 0===n._zod.optout)&&a.push(e)}a.length>0&&(n.required=a),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=dH(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(n.additionalProperties=!1)})(e,t,n,r),az.installLazyProp(e,"shape",e=>e._zod.def.shape,!1)},{keyof(){return fp(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(az.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(az.mergeDefs(this._zod.def,{catchall:c7()}))},loose(){return this.clone(az.mergeDefs(this._zod.def,{catchall:c7()}))},strict(){return this.clone(az.mergeDefs(this._zod.def,{catchall:fe()}))},strip(){return this.clone(az.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return az.extend(this,e)},safeExtend(e){return az.safeExtend(this,e)},merge(e){return az.merge(this,e)},pick(e){return az.pick(this,e)},omit(e){return az.omit(this,e)},partial(...e){return az.partial(fP,this,e[0])},exactPartial(...e){return az.partial(fb,this,e[0],"exactPartial")},required(...e){return az.required(fv,this,e[0])}});function fo(e,t){return new fi({type:"object",shape:e??{},...az.normalizeParams(t)})}var fa=li("ZodUnion",(e,t)=>{u3.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a;return o=!1===(i=e._zod.def).inclusive,a=i.options.map((e,n)=>dH(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]})),void(o?n.oneOf=a:n.anyOf=a)},e.options=t.options});function fs(e,t){return new fa({type:"union",options:e,...az.normalizeParams(t)})}var fl=li("ZodDiscriminatedUnion",(e,t)=>{fa.init(e,t),u6.init(e,t)});function fu(e,t,n){return new fl({type:"union",options:t,discriminator:e,...az.normalizeParams(n)})}var fd=li("ZodIntersection",(e,t)=>{u5.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a,s,l;return o=dH((i=e._zod.def).left,t,{...r,path:[...r.path,"allOf",0]}),a=dH(i.right,t,{...r,path:[...r.path,"allOf",1]}),void(n.allOf=l=[...(s=e=>"allOf"in e&&1===Object.keys(e).length)(o)?o.allOf:[o],...s(a)?a.allOf:[a]],t.intersections.push(l))}}),fc=li("ZodTuple",(e,t)=>{cv(),u8.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def;n.type="array";let o="draft-2020-12"===t.target?"prefixItems":"items",a="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=i.items.map((e,n)=>dH(e,t,{...r,path:[...r.path,o,n]})),l=i.rest?dH(i.rest,t,{...r,path:[...r.path,a,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let e=i.items[u-1];if(!("input"===t.io?void 0!==cs(e):"optional"===e._zod.optout))break;u--}let d=i.items.length,c=!i.rest;"draft-2020-12"===t.target?(n.prefixItems=s,c?n.items=!1:l&&(n.items=l)):"openapi-3.0"===t.target?(n.items={anyOf:s},l&&n.items.anyOf.push(l)):(n.items=s,c?n.additionalItems=!1:l&&(n.additionalItems=l)),u>0&&(n.minItems=u),c&&(n.maxItems=d);let{minimum:f,maximum:m}=cr(e);"number"==typeof f&&(n.minItems=f),"number"==typeof m&&(n.maxItems=m)})(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(e=>new fP({type:"optional",innerType:e}))})}});function ff(e,t,n){let r=t instanceof ur,i=r?n:t;return new fc({type:"tuple",items:e,rest:r?t:null,...az.normalizeParams(i)})}var fm=li("ZodEnum",(e,t)=>{dt.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t)=>{let n=aZ(e._zod.def.entries);if(0===n.length){t.not={};return}n.every(e=>"number"==typeof e)&&(t.type="number"),n.every(e=>"string"==typeof e)&&(t.type="string"),t.enum=n})(e,n),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new fm({...t,checks:[],...az.normalizeParams(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new fm({...t,checks:[],...az.normalizeParams(r),entries:i})}});function fp(e,t){return new fm({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...az.normalizeParams(t)})}var fh=li("ZodLiteral",(e,t)=>{dn.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def;if(0===i.values.length){n.not={};return}let o=[];for(let a of i.values)if(void 0===a){if(dq(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof a){if(dq(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(a))}else o.push(a);if(0===o.length);else if(1===o.length){let e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function fF(e,t){return new fh({type:"literal",values:Array.isArray(e)?e:[e],...az.normalizeParams(t)})}var fg=li("ZodTransform",(e,t)=>{cv(),dr.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{dq(e,t,n,r,"Transforms cannot be represented in JSON Schema")},e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new la(e.constructor.name);n.addIssue=r=>{"string"==typeof r?n.issues.push(az.issue(r,n.value,t)):(r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=n.value),r.inst??(r.inst=e),n.issues.push(az.issue(r)))};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function f_(e){return new fg({type:"transform",transform:e})}var fP=li("ZodOptional",(e,t)=>{da.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cd(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fD(e){return new fP({type:"optional",innerType:e})}var fb=li("ZodExactOptional",(e,t)=>{ds.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cd(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),fy=li("ZodNullable",(e,t)=>{dl.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a;return o=dH((i=e._zod.def).innerType,t,r),a=t.seen.get(e),void("openapi-3.0"===t.target?(a.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function fw(e){return new fy({type:"nullable",innerType:e})}var fE=li("ZodDefault",(e,t)=>{du.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o;return dH((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType,void((o=cu(i.defaultValue,e,t,n,r))!==cl&&(n.default=o))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),fA=li("ZodPrefault",(e,t)=>{dc.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def;if(dH(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"!==t.io)return;let o=cu(i.defaultValue,e,t,n,r);o!==cl&&(n._prefault=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),fv=li("ZodNonOptional",(e,t)=>{df.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;dH((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType},e.unwrap=()=>e._zod.def.innerType}),fS=li("ZodCatch",(e,t)=>{dh.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i,o=e._zod.def;dH(o.innerType,t,r),t.seen.get(e).ref=o.innerType;try{i=o.catchValue(void 0)}catch{dq(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=i})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),fk=li("ZodPipe",(e,t)=>{dF.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a;return o=(i=e._zod.def).in._zod.traits.has("$ZodTransform"),void(dH(a="input"===t.io?o?i.out:i.in:i.out,t,r),t.seen.get(e).ref=a)},e.in=t.in,e.out=t.out});function fx(e,t){return new fk({type:"pipe",in:e,out:t})}var fG=li("ZodPreprocess",(e,t)=>{fk.init(e,t),d_.init(e,t)}),fO=li("ZodReadonly",(e,t)=>{dP.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;dH((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),fI=li("ZodLazy",(e,t)=>{db.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;dH(i=e._zod.innerType,t,r),t.seen.get(e).ref=i},e.unwrap=()=>e._zod.def.getter()});function fN(e){return new fI({type:"lazy",getter:e})}var fC=li("ZodCustom",(e,t)=>{dy.init(e,t),cS.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{dq(e,t,n,r,"Custom types cannot be represented in JSON Schema")}});function fj(e,t){return new fG({type:"pipe",in:f_(e),out:t})}var fM=(("document"in globalThis||"WorkerGlobalScope"in globalThis)&&ll({jitless:!0}),fo),fR=Symbol.for("@embedpdf/engine-core/reading");function fT(e,t){e._zod.def[fR]=t}function fB(e){return fT(e,{closed:!0}),e}function fL(e,t,n=e=>e,r=e=>e){let{discriminator:i}=e.def,o=fj(o=>{if("object"!=typeof o||null===o||Array.isArray(o))return o;let a=r(o),s=a[i];return"string"!=typeof s||function(e,t){let n=e._zod,r=n.bag.optionsMap;r||(r=u2(n.def),n.bag.optionsMap=r);let i=r.get(t);if(null===i)throw Error(`Ambiguous discriminator value "${String(t)}"`);return i}(e,s)?a:n({...a,[i]:t})},e);return fT(o,{unknownAs:t}),o}var f$=fM({kind:fB(fF("objectNumber")),objectNumber:c3().int().positive()}),fz=cG().regex(/^#[0-9a-fA-F]{6}$/,"expected a color as \'#rrggbb\'"),fU=fB(fp(["solid","dashed","beveled","inset"])),fV=fB(fp(["solid","dashed","beveled","inset","underline"])),fW=fB(fp(["check","cross","star","circle","square","diamond"])),fq=fB(fp(["caption","image","caption-below","caption-above","caption-right","caption-left","caption-over"])),fH=fp(["solid","dashed"]),fK=fr(c3().nonnegative()).min(1),fZ=fB(fp(["none","square","circle","diamond","open-arrow","closed-arrow","butt","r-open-arrow","r-closed-arrow","slash"])),fJ=fM({start:fZ,end:fZ});fp(Z);var fQ=fB(fp(["left","center","right"])),fX=fB(fp(["free-text","free-text-callout","free-text-typewriter"])),fY=fp(["free-text","free-text-callout"]),f0=fB(fp(["top","middle","bottom"])),f1=fB(fF("replace")),f3=fB(fF("strikeout-text-edit")),f2=fB(fF("ink-highlight")),f6=fB(fp(["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"])),f5=fB(fu("kind",[fM({kind:fF("objectNumber"),page:f$,objectNumber:c3().int().positive()}),fM({kind:fF("baseIndex"),page:f$,baseIndex:c3().int().nonnegative()})])),f4=c3().nullable(),f8=fB(fu("kind",[fM({kind:fF("xyz"),page:f$,left:f4,top:f4,zoom:f4}),fM({kind:fF("fit"),page:f$}),fM({kind:fF("fitH"),page:f$,top:f4}),fM({kind:fF("fitV"),page:f$,left:f4}),fM({kind:fF("fitR"),page:f$,left:c3(),bottom:c3(),right:c3(),top:c3()}),fM({kind:fF("fitB"),page:f$}),fM({kind:fF("fitBH"),page:f$,top:f4}),fM({kind:fF("fitBV"),page:f$,left:f4})])),f7=fB(fu("kind",[fM({kind:fF("xyz"),page:f$,x:f4,y:f4,zoom:f4}),fM({kind:fF("fit"),page:f$}),fM({kind:fF("fitH"),page:f$,y:f4}),fM({kind:fF("fitV"),page:f$,x:f4}),fM({kind:fF("fitR"),page:f$,x:c3(),y:c3(),width:c3().nonnegative(),height:c3().nonnegative()}),fM({kind:fF("fitB"),page:f$}),fM({kind:fF("fitBH"),page:f$,y:f4}),fM({kind:fF("fitBV"),page:f$,x:f4})]));function f9(e){let t=fM({kind:fF("goto"),destination:e}),n=fM({kind:fF("uri"),uri:cG()});return{read:fL(fu("kind",[t,n,fM({kind:fF("goto-remote"),file:cG()}),fM({kind:fF("launch"),path:cG()}),fM({kind:fF("javascript")}),fM({kind:fF("named"),name:cG()}),fM({kind:fF("unsupported")})]),"unsupported").describe("Where a link goes, by its `kind`. A newer server can add kinds: read one your client doesn\'t know as `unsupported`."),write:fu("kind",[t,n,fM({kind:fF("named"),name:fp(["NextPage","PrevPage","FirstPage","LastPage"])})])}}var me=f9(f7),mt=f9(f8),mn=me.read,mr=me.write,mi=mt.read,mo=mt.write,ma=fB(fu("kind",[fM({kind:fF("name"),name:cG()}),fM({kind:fF("objectNumber"),objectNumber:c3().int().positive()})])),ms={exclude:c4(),includeNoValueFields:c4(),format:fB(fp(["fdf","html","xfdf","pdf"])),method:fB(fp(["post","get"])),submitCoordinates:c4(),includeAppendSaves:c4(),includeAnnotations:c4(),canonicalFormat:c4(),exclNonUserAnnots:c4(),exclFKey:c4(),embedForm:c4()},ml=Object.fromEntries(Object.entries(ms).map(([e,t])=>[e,t.optional()]));function mu(e){let t={subtype:cG(),next:fr(fN(()=>i))},n=(e,n={})=>fM({type:fF(e),...t,...n}),r=[n("javascript",{script:cG()}),n("goto",{destination:e}),n("uri",{uri:cG(),isMap:c4()}),n("named",{name:cG()}),n("hide",{targets:fr(ma),hide:c4()}),n("reset-form",{fields:fr(ma).nullable(),exclude:c4()}),n("goto-remote",{filePath:cG()}),n("goto-embedded",{filePath:cG()}),n("launch",{filePath:cG()}),n("rendition",{script:cG().optional()}),n("submit-form",{payload:fM({url:cG(),fields:fr(ma).nullable(),...ms,charSet:cG().optional()}).optional()}),n("thread"),n("sound"),n("movie"),n("import-data"),n("set-ocg-state"),n("transition"),n("goto-3d-view"),n("unknown")],i=fN(()=>fL(fu("type",[...r]),"unknown").describe("An action, by its `type`. A newer server can add types: read one your client doesn\'t know as `unknown`, keeping its `subtype` and `next`.")),o=fM({root:i.nullable(),incomplete:c4(),warnings:fr(fB(fp(["cycle-dropped","malformed-next","incomplete","payload-dropped"])))});return{arms:r,node:i,tree:o,fieldActions:fM({keystroke:o.optional(),format:o.optional(),validate:o.optional(),calculate:o.optional()}),pageActions:fM({open:o.optional(),close:o.optional()}),annotationActions:fM({activate:o.optional(),cursorEnter:o.optional(),cursorExit:o.optional(),mouseDown:o.optional(),mouseUp:o.optional(),focus:o.optional(),blur:o.optional(),pageOpen:o.optional(),pageClose:o.optional(),pageVisible:o.optional(),pageInvisible:o.optional()}),documentActions:fM({nameTreeScripts:fr(fM({name:cG(),action:o})),openAction:o.nullable(),openDestination:e.nullable(),willClose:o.optional(),willSave:o.optional(),didSave:o.optional(),willPrint:o.optional(),didPrint:o.optional()}).superRefine((e,t)=>{null!==e.openAction&&null!==e.openDestination&&t.addIssue({code:"custom",message:"openAction and openDestination are mutually exclusive",path:["openDestination"]})})}}var md=mu(f7),mc=mu(f8);function mf(e){let t=()=>({next:fr(fN(()=>r)).optional()}),n=[fM({type:fF("javascript"),script:cG(),...t()}),fM({type:fF("goto"),destination:e,...t()}),fM({type:fF("uri"),uri:cG().min(1),...t()}),fM({type:fF("named"),name:cG().min(1),...t()}),fM({type:fF("hide"),targets:fr(ma).min(1),hide:c4(),...t()}),fM({type:fF("reset-form"),fields:fr(ma).nullable(),exclude:c4(),...t()}),fM({type:fF("submit-form"),url:cG().min(1),fields:fr(ma).nullable(),...ml,...t()})],r=fN(()=>fu("type",[...n])),i=()=>r.nullable().optional();return{node:r,widgetActions:fM({activate:i(),cursorEnter:i(),cursorExit:i(),mouseDown:i(),mouseUp:i(),focus:i(),blur:i(),pageOpen:i(),pageClose:i(),pageVisible:i(),pageInvisible:i()}).strict()}}var mm=mf(f7),mp=mf(f8);mm.node;var mh=mm.widgetActions,mF=mp.widgetActions;md.node,fp(md.arms.map(e=>e.shape.type.value)),md.tree;var mg=md.fieldActions;md.pageActions,md.documentActions;var m_=md.annotationActions,mP=mc.annotationActions,mD=fN(()=>fM({type:fF("javascript"),script:cG(),next:fr(mD).optional()})),mb=fM({keystroke:mD.nullable().optional(),format:mD.nullable().optional(),validate:mD.nullable().optional(),calculate:mD.nullable().optional()}),my=fM({x:c3(),y:c3()}),mw=fM({start:my,end:my}),mE=fs([ff([my,my]),ff([my,my,my])]),mA=fr(fr(my)),mv=fM({left:c3().finite(),bottom:c3().finite(),right:c3().finite(),top:c3().finite()});fM({width:c3().nonnegative(),height:c3().nonnegative()});var mS=fM({upperLeft:my,upperRight:my,lowerLeft:my,lowerRight:my}),mk=fB(fs([fF(0),fF(90),fF(180),fF(270)])),mx=fM({x:c3(),y:c3()}),mG=fM({x:c3().finite(),y:c3().finite(),width:c3().finite().nonnegative(),height:c3().finite().nonnegative()});function mO(e,t,n){let r=r=>mO(e,t,{...n,...r});return{read:e,write:t,traits:n,nullable:()=>r({readNullable:!0,writeNullable:!0}),nullableOnRead:()=>r({readNullable:!0}),optional:()=>r({required:!1}),readBack:()=>r({readBack:!0}),space:e=>r({space:e}),writes:t=>mO(e,t,n)}}fM({upperLeft:mx,upperRight:mx,lowerLeft:mx,lowerRight:mx});var mI=(e,t)=>({owner:e,readNullable:!1,writeNullable:!1,required:t,readBack:!1,space:"none"}),mN=e=>mO(e,e,mI("data",!0)),mC=e=>mO(e,e,mI("attribution",!1)),mj=e=>mO(e,e,mI("engine",!1)),mM={box:{read:mG,write:mG},linkTarget:{read:mn,write:mr},actions:{read:m_,write:mh}};function mR(e,t,n){let r={subtype:fB(fF(e))},i={subtype:fF(e)},o={subtype:fF(e).optional()},a={};for(let[e,s]of Object.entries(t)){let{owner:t,readNullable:l,writeNullable:u,required:d,readBack:c}=s.traits,f=n(s);if(r[e]=l?f.read.nullable():f.read,"data"===t){let t=u?f.write.nullable():f.write;i[e]=d?t:t.optional();let n=f.read===f.write?l||u?f.write.nullable():f.write:fs([t,r[e]]);o[e]=(c?n:t).optional(),c&&(a[e]=t)}else i[e]=c?r[e].optional():c7().optional(),o[e]=c?r[e].optional():c7().optional(),c&&(a[e]=null)}return{read:r,create:i,update:o,readBackWrites:a}}function mT(e,t,n={}){let r=mR(e,t,e=>e),i=mR(e,t,e=>mM[e.traits.space]??e);return{subtype:e,fields:t,resources:n,readSchema:fM(i.read),createSchema:fM(i.create).strict(),updateSchema:fM(i.update).strict(),fileSchemas:{read:fM(r.read),create:fM(r.create).strict(),update:fM(r.update).strict()},readBackWrites:r.readBackWrites,shapes:{read:i.read,create:i.create,update:i.update}}}var mB=cG().datetime({offset:!0,local:!0}),mL=fs([mB,new ft({type:"date",...sD(void 0)})]),m$=c3().finite().refine(e=>Number.isFinite(Math.fround(e)),"Outside PDF float range"),mz=fM({x:m$,y:m$}),mU=mz.strict(),mV=m$.refine(e=>Math.fround(e)>0,"Must be positive in PDF float precision"),mW=fM({unit:cG(),conversion:m$.optional(),fraction:fB(fp(["decimal","fraction","round","truncate"])).optional(),precision:c3().int().optional(),fixed:c4().optional(),thousands:cG().optional(),decimal:cG().optional(),prefixSpacing:cG().optional(),suffixSpacing:cG().optional(),labelPosition:fB(fp(["suffix","prefix"])).optional()}),mq=fM({subtype:fF("rectilinear"),ratio:cG().optional(),x:fr(mW),y:fr(mW).optional(),distance:fr(mW),area:fr(mW),angle:fr(mW).optional(),slope:fr(mW).optional(),origin:mz.optional(),cyx:m$.optional()}),mH=mW.extend({conversion:mV,precision:c3().int().min(1).max(0x7fffffff).optional()}).refine(eL,"Invalid number format precision"),mK=mq.extend({x:fr(mH),y:fr(mH).optional(),distance:fr(mH),area:fr(mH),angle:fr(mH).optional(),slope:fr(mH).optional(),cyx:mV.optional(),origin:mU.optional()}),mZ=fM({subtype:fF("geospatial")}),mJ=fM({subtype:fF("unknown")}),mQ=fs([mZ,mJ]);fM({measure:mK.nullable()});var mX=fL(fu("subtype",[mq,mZ,mJ]),"unknown").describe("A measure, by its `subtype`. A newer server can add subtypes: read one your client doesn\'t know as `unknown`."),mY=fM({bbox:mG,name:cG().nullable(),measure:mX.nullable(),owned:c4()});fM({viewports:fr(mY)});var m0=fB(fp(["line-arrow","line-dimension"])),m1=fB(fp(["polygon-cloud","polygon-dimension"])),m3=fB(fF("polyline-dimension")),m2=fM({along:m$,perpendicular:m$}).strict();fM({enabled:c4(),position:fp(["inline","top"]).optional(),offset:m2.optional()}).strict(),fM({enabled:c4(),center:mU.optional()}).strict();var m6=fM({length:m$,extension:m$.refine(e=>e>=0).optional(),offset:m$.refine(e=>e>=0).optional()}),m5=m6.strict(),m4=fB(fp(["left","center","right","justify"])),m8={family:cG().min(1),weight:c3().int().min(100).max(900),italic:c4(),size:c3().nonnegative(),color:fz,decoration:fr(fB(fp(["underline","line-through","word"]))),script:fB(fp(["normal","sub","super"])),letterSpacing:c3(),horizontalScale:c3().positive(),unknown:cG().optional()},m7={align:m4,dir:fB(fp(["ltr","rtl"])),lineHeight:c3().positive().optional(),margins:fM({top:c3(),bottom:c3(),left:c3(),right:c3()}).optional(),textIndent:c3().optional(),unknown:cG().optional()},m9=fM(m8).partial(),pe=fM({...m7,runs:fr(fM({text:cG(),style:m9.optional()}))}).partial({align:!0,dir:!0}),pt=fM({body:fM({...m8,...m7}),paragraphs:fr(pe)}),pn=fM({body:fM({...m8,...m7}).partial().optional(),paragraphs:fr(pe)}),pr=fM({to:f5,type:fB(fp(["reply","group"]))}),pi=fM({to:f5,type:fp(["reply","group"]).optional()}),po=cG().min(1),pa=()=>mN(c4()).optional(),ps={ref:mj(f5),page:mj(f$),hasAppearance:mj(c4()),appearanceState:mj(cG()).nullable(),structurePosition:mj(fr(c3().int().nonnegative())).nullable(),nm:mN(cG()).nullable().optional(),rect:mN(mv).space("box"),contents:mN(cG()).nullable().optional(),subject:mN(cG()).nullable().optional(),blendMode:mN(f6).optional(),invisible:pa(),hidden:pa(),print:pa(),noZoom:pa(),noRotate:pa(),noView:pa(),readOnly:pa(),locked:pa(),toggleNoView:pa(),lockedContents:pa(),reply:mN(pr).writes(pi).nullable().optional(),popup:mj(f5).nullable(),groupId:mN(cG().min(1)).nullable().optional(),author:mC(cG()).nullable(),createdAt:mC(mB).writes(mL).nullable(),modifiedAt:mC(mB).writes(mL).nullable(),userId:mC(cG()).nullable(),createdBy:mC(cG()).nullable(),modifiedBy:mC(cG()).nullable(),importedBy:mj(cG()).nullable(),actions:mO(p=mP,p,mI("preserved",!1)).nullable().space("actions")},pl={...ps,richText:mN(pt).writes(pn).nullable().optional().space("length")},pu={color:mN(fz).optional(),opacity:mN(c3().min(0).max(1)).optional()},pd={...pu,color:mN(fz).nullable().optional(),strokeWidth:mN(c3().nonnegative()).optional(),borderStyle:mN(fU).writes(fH).readBack().optional(),dashArray:mN(fr(c3().nonnegative())).writes(fK).nullable().optional()},pc={...pd,interiorColor:mN(fz).nullable().optional()},pf={rect:mj(mv).readBack().space("box")},pm={rotation:mN(c3()).nullable().optional()},pp={...pf,box:mN(mv).space("box").optional(),rotation:mN(c3()).nullable().optional()},ph={...pf,box:mN(mv).space("box").optional(),rotation:mN(mk).nullable().optional()},pF={...pl,...pu,...pf,quadPoints:mN(fr(mS).min(1)).space("quads")},pg={...pl,...pc,...pp,cloudyIntensity:mN(c3().positive()).nullable().optional()},p_={...pl,...pc,...pf,vertices:mN(fr(my)).space("points"),...pm},pP=mN(mX).writes(fs([mK,mQ])).nullable().optional().space("measure"),pD={captionEnabled:mN(c4()).nullable().optional(),captionCenter:mN(my).nullable().optional().space("point")},pb=mT("caret",{...pl,...pu,...pp,intent:mN(f1).nullable().optional()}),py={subtype:"caret",pdfSubtypeCode:14,dtoSchema:pb.readSchema,draftSchema:pb.createSchema,patchSchema:pb.updateSchema,readBackWrites:pb.readBackWrites},pw=mT("circle",pg),pE={subtype:"circle",pdfSubtypeCode:6,dtoSchema:pw.readSchema,draftSchema:pw.createSchema,patchSchema:pw.updateSchema,readBackWrites:pw.readBackWrites},pA=cG().min(1);fM({appearance:pA.optional(),file:pA.optional()}).strict(),fM({appearance:pA}).strict(),fM({appearance:pA.nullable()}).strict(),fM({image:pA.nullable()}).strict();var pv=fM({file:pA}).strict();fM({source:pA}).strict(),fM({image:pA}),fM({resources:pv,name:cG().min(1),mimeType:cG().optional(),description:cG().optional()}),fM({name:cG().min(1),mimeType:cG().optional(),description:cG().optional()});var pS=fM({name:cG(),mimeType:cG().nullable(),description:cG().nullable(),sizeBytes:c3().int().nonnegative().nullable(),md5:cG().nullable(),createdAt:mB.nullable(),modifiedAt:mB.nullable()});fM({kind:fB(fF("key")),key:cG().min(1)}),fM({ref:fM({kind:fB(fF("key")),key:cG()}),name:cG(),mimeType:cG().nullable(),description:cG().nullable(),sizeBytes:c3().int().nonnegative().nullable(),md5:cG().nullable(),createdAt:mB.nullable(),modifiedAt:mB.nullable(),index:c3().int().nonnegative()});var pk=fB(fp(["push-pin","paperclip","graph","tag"])),px=fM({name:cG().min(1),mimeType:cG().nullable().optional(),description:cG().nullable().optional()}),pG=mT("file-attachment",{...pl,...pu,icon:mN(pk).optional(),file:mN(pS).writes(px).nullable().optional()},{file:"required"}),pO=mT("free-text",{...pl,...pp,intent:mN(fX).writes(fY).readBack().optional(),fontFamily:mN(po).optional(),fontSize:mN(c3().positive()).optional(),textAlign:mN(m4).optional(),verticalAlign:mN(f0).optional(),richText:mN(pt).writes(pn).optional().space("length"),color:mN(fz).optional(),fontColor:mN(fz).optional(),interiorColor:mN(fz).nullable().optional(),opacity:mN(c3().min(0).max(1)).optional(),strokeWidth:mN(c3().nonnegative()).optional(),borderStyle:mN(fU).writes(fH).readBack().optional(),dashArray:mN(fr(c3().nonnegative())).writes(fK).nullable().optional(),cloudyIntensity:mN(c3().positive()).nullable().optional(),calloutLine:mN(mE).nullable().optional().space("calloutLine"),lineEnding:mN(fZ).nullable().optional()}),pI=mT("highlight",pF),pN=mT("ink",{...pl,...pd,strokeWidth:mN(c3().nonnegative()).writes(c3().positive()).readBack().optional(),...pf,inkList:mN(mA).writes(fr(fr(my).min(1)).min(1)).readBack().space("strokes"),intent:mN(f2).nullable().optional(),...pm}),pC=mT("line",{...pl,...pc,...pf,linePoints:mN(mw).space("linePoints"),lineEndings:mN(fJ).optional(),...pm,intent:mN(m0).nullable().optional(),measure:pP,captionEnabled:mN(c4()).optional(),captionPosition:mN(fB(fp(["inline","top"]))).optional(),captionOffset:mN(fM({along:c3(),perpendicular:c3()})).nullable().optional(),leader:mN(m6).writes(m5).nullable().optional()}),pj=mT("link",{...ps,target:mN(mi).writes(mo).nullable().readBack().space("linkTarget")}),pM=mT("polygon",{...p_,vertices:mN(fr(my)).writes(fr(my).min(3)).readBack().space("points"),...pD,intent:mN(m1).nullable().optional(),measure:pP,cloudyIntensity:mN(c3().positive()).nullable().optional()}),pR=mT("polyline",{...p_,vertices:mN(fr(my)).writes(fr(my).min(2)).readBack().space("points"),...pD,intent:mN(m3).nullable().optional(),measure:pP,lineEndings:mN(fJ).optional()}),pT=mT("popup",{...ps,parent:mN(f5).nullableOnRead().readBack(),open:mN(c4()).optional()}),pB=mT("redact",{...pl,...pu,rect:mN(mv).optional().space("box"),quadPoints:mN(fr(mS)).optional().space("quads"),interiorColor:mN(fz).nullable().optional(),overlayText:mN(cG()).nullable().optional(),repeat:mN(c4()).optional(),fontFamily:mN(po).optional(),fontSize:mN(c3().nonnegative()).optional(),fontColor:mN(fz).optional(),textAlign:mN(fQ).optional()}),pL=mT("square",pg),p$=mT("squiggly",pF),pz=fB(fp(["contain","cover","fill"])),pU=mT("stamp",{...pl,...pp,name:mN(cG()).nullable().optional(),fit:mN(pz).nullable().optional(),opacity:mN(c3().min(0).max(1)).optional()},{appearance:"required"}),pV=mT("strikeout",{...pF,intent:mN(f3).nullable().optional()}),pW=fB(fp(["comment","key","note","help","new-paragraph","paragraph","insert"])),pq=mT("text",{...pl,...pu,icon:mN(pW).optional(),open:mN(c4()).optional(),state:mN(cG().min(1)).nullable().optional(),stateModel:mN(cG().min(1)).nullable().optional()}),pH=mT("underline",pF),pK=mT("unsupported",{...ps,rawSubtypeCode:mj(c3().int()),rawSubtypeName:mj(cG()).nullable()}),pZ=fB(fu("kind",[fM({kind:fF("objectNumber"),objectNumber:c3().int().positive()}),fM({kind:fF("fqn"),name:cG().min(1)})])),pJ=mT("widget",{...ps,...ph,color:mN(fz).nullable().optional(),interiorColor:mN(fz).nullable().optional(),strokeWidth:mN(c3().nonnegative()).optional(),borderStyle:mN(fV).optional(),dashArray:mN(fr(c3().nonnegative())).writes(fK).nullable().optional(),fontFamily:mN(po).nullable().optional(),fontSize:mN(c3().nonnegative()).nullable().optional(),fontColor:mN(fz).nullable().optional(),textAlign:mN(fQ).optional(),caption:mN(cG()).nullable().optional(),checkStyle:mN(fW).nullable().optional(),layout:mN(fq).nullable().optional(),actions:mN(mP).writes(mF).readBack().nullable().optional().space("actions"),field:mj(pZ).nullable(),fieldKind:mj((h=fp(["text","checkbox","radio","combobox","listbox","pushbutton","signature","unknown"]),F="unknown",f=new Set(h.options),fT(m=fj(e=>"string"!=typeof e||f.has(e)?e:F,h),{unknownAs:F}),m).describe("Its field\'s family. A newer server can add families: read one your client doesn\'t know as `unknown`.")),hasMark:mj(c4())}),pQ=[pI,pH,p$,pV,pw,pL,pM,pR,pC,pj,pN,pO,pb,pq,pU,pG,pJ,pB,pT,pK];function pX(e){return pQ.find(t=>t.subtype===e)??null}var pY={subtype:"file-attachment",pdfSubtypeCode:17,dtoSchema:pG.readSchema,draftSchema:pG.createSchema,patchSchema:pG.updateSchema,readBackWrites:pG.readBackWrites},p0={subtype:"free-text",pdfSubtypeCode:3,dtoSchema:pO.readSchema,draftSchema:pO.createSchema,patchSchema:pO.updateSchema,readBackWrites:pO.readBackWrites},p1={subtype:"highlight",pdfSubtypeCode:9,dtoSchema:pI.readSchema,draftSchema:pI.createSchema,patchSchema:pI.updateSchema,readBackWrites:pI.readBackWrites},p3={subtype:"ink",pdfSubtypeCode:15,dtoSchema:pN.readSchema,draftSchema:pN.createSchema,patchSchema:pN.updateSchema,readBackWrites:pN.readBackWrites},p2={subtype:"line",pdfSubtypeCode:4,dtoSchema:pC.readSchema,draftSchema:pC.createSchema,patchSchema:pC.updateSchema,readBackWrites:pC.readBackWrites},p6={subtype:"link",pdfSubtypeCode:2,dtoSchema:pj.readSchema,draftSchema:pj.createSchema,patchSchema:pj.updateSchema,readBackWrites:pj.readBackWrites},p5={subtype:"polygon",pdfSubtypeCode:7,dtoSchema:pM.readSchema,draftSchema:pM.createSchema,patchSchema:pM.updateSchema,readBackWrites:pM.readBackWrites},p4={subtype:"polyline",pdfSubtypeCode:8,dtoSchema:pR.readSchema,draftSchema:pR.createSchema,patchSchema:pR.updateSchema,readBackWrites:pR.readBackWrites},p8={subtype:"popup",pdfSubtypeCode:16,dtoSchema:pT.readSchema,draftSchema:pT.createSchema,patchSchema:pT.updateSchema,readBackWrites:pT.readBackWrites},p7={subtype:"redact",pdfSubtypeCode:28,dtoSchema:pB.readSchema,draftSchema:pB.createSchema,patchSchema:pB.updateSchema,readBackWrites:pB.readBackWrites},p9={subtype:"square",pdfSubtypeCode:5,dtoSchema:pL.readSchema,draftSchema:pL.createSchema,patchSchema:pL.updateSchema,readBackWrites:pL.readBackWrites},he={subtype:"squiggly",pdfSubtypeCode:11,dtoSchema:p$.readSchema,draftSchema:p$.createSchema,patchSchema:p$.updateSchema,readBackWrites:p$.readBackWrites},ht={subtype:"stamp",pdfSubtypeCode:13,dtoSchema:pU.readSchema,draftSchema:pU.createSchema,patchSchema:pU.updateSchema,readBackWrites:pU.readBackWrites},hn={subtype:"strikeout",pdfSubtypeCode:12,dtoSchema:pV.readSchema,draftSchema:pV.createSchema,patchSchema:pV.updateSchema,readBackWrites:pV.readBackWrites},hr={subtype:"text",pdfSubtypeCode:1,dtoSchema:pq.readSchema,draftSchema:pq.createSchema,patchSchema:pq.updateSchema,readBackWrites:pq.readBackWrites},hi={subtype:"underline",pdfSubtypeCode:10,dtoSchema:pH.readSchema,draftSchema:pH.createSchema,patchSchema:pH.updateSchema,readBackWrites:pH.readBackWrites},ho={subtype:"unsupported",pdfSubtypeCode:0,dtoSchema:pK.readSchema,draftSchema:fe(),patchSchema:fe(),readBackWrites:pK.readBackWrites},ha=fj(e=>"object"!=typeof e||null===e||Array.isArray(e)?e:Q(e),pJ.readSchema),hs=pJ.createSchema,hl=pJ.updateSchema,hu={subtype:"widget",pdfSubtypeCode:20,dtoSchema:pJ.readSchema,draftSchema:hs,patchSchema:hl,readBackWrites:pJ.readBackWrites},hd=Object.fromEntries(rM.map(e=>[e,pJ.shapes.update[e]]));fM(hd).strict();var hc=[p1,hi,he,hn,pE,p9,p5,p4,p2,p6,p3,p0,py,hr,ht,pY,hu,p7,p8,ho],hf=Object.freeze(Object.fromEntries(hc.map(e=>[e.subtype,e])));fL(fu("subtype",[p1.dtoSchema,hi.dtoSchema,he.dtoSchema,hn.dtoSchema,pE.dtoSchema,p9.dtoSchema,p5.dtoSchema,p4.dtoSchema,p2.dtoSchema,p6.dtoSchema,p3.dtoSchema,p0.dtoSchema,py.dtoSchema,hr.dtoSchema,ht.dtoSchema,pY.dtoSchema,hu.dtoSchema,p7.dtoSchema,p8.dtoSchema,ho.dtoSchema]),"unsupported",e=>({...e,rawSubtypeCode:Number.isInteger(e.rawSubtypeCode)?e.rawSubtypeCode:0,rawSubtypeName:"string"==typeof e.rawSubtypeName?e.rawSubtypeName:null}),e=>"widget"===e.subtype?Q(e):e).describe("An annotation, by its `subtype`. A newer server can add subtypes: read one your client doesn\'t know as `unsupported`, keeping the fields every annotation has, with `rawSubtypeCode` 0 and `rawSubtypeName` null when the body has neither.");var hm=fu("subtype",[p1.draftSchema,hi.draftSchema,he.draftSchema,hn.draftSchema,pE.draftSchema,p9.draftSchema,p5.draftSchema,p4.draftSchema,p2.draftSchema,p6.draftSchema,p3.draftSchema,p0.draftSchema,py.draftSchema,hr.draftSchema,ht.draftSchema,pY.draftSchema,hu.draftSchema,p7.draftSchema,p8.draftSchema]);fs(hc.filter(e=>"unsupported"!==e.subtype).map(e=>e.patchSchema));var hp=fu("subtype",pQ.filter(e=>"unsupported"!==e.subtype).map(e=>e.fileSchemas.create)),hh={ref:f5.nullable(),objectNumber:c3().int().nonnegative(),page:f$.nullable()},hF=fM(hh),hg=fM({...hh,onState:cG(),exportValue:cG(),checked:c4()}),h_=fM({label:cG(),value:cG(),selected:c4()}),hP=fL(fu("kind",[fM({kind:fF("none")}),fM({kind:fF("scalar"),value:cG()}),fM({kind:fF("array"),values:fr(cG())}),fM({kind:fF("unsupported")})]),"unsupported").describe("A field\'s stored value, by its `kind`. A newer server can add kinds: read one your client doesn\'t know as `unsupported`."),hD=fL(fu("kind",[fM({kind:fF("date"),pattern:cG()}),fM({kind:fF("time"),pattern:cG()}),fM({kind:fF("other")})]),"other").describe("The shape a text field\'s or a dropdown\'s value has, by its `kind`: a date or a time with the pattern it is shown in, or `other` for a format script the engine does not recognise. A newer server can add kinds: read one your client doesn\'t know as `other`."),hb=cG().min(1).max(64).refine(ep,{message:"a date pattern is made of the groups yyyy yy mmmm mmm mm m dd d, at least one of them and the year, the month and the day each once at most, with spaces and / - . , between them, and at most one time such as HH:MM or h:MM:ss tt"}),hy=cG().min(1).max(64).refine(eF,{message:"a time pattern is a time and nothing else: HH, H, hh or h, then :MM, then :ss when it has seconds, then tt when it has one"}),hw=fu("kind",[fM({kind:fF("date"),pattern:hb}).strict(),fM({kind:fF("time"),pattern:hy}).strict()]),hE=cG().min(1).max(256).refine(rC,{message:"a purpose has no space at its start or its end, and no NUL character"}),hA=cG().min(1).max(256).refine(eN,{message:"a placeholder has no space at its start or its end, and no NUL character"}),hv=fB(fu("kind",[fM({kind:fF("group"),groupId:cG()}),fM({kind:fF("anyone")}),fM({kind:fF("unassigned")})])),hS=fM({signatureIndex:c3().int().nonnegative(),source:fB(fp(["fieldmdp","lock"]))}),hk={ref:pZ,name:cG(),origin:fB(fp(["acroform","recovered"])),readOnly:c4(),required:c4(),noExport:c4(),alternateName:cG().nullable(),mappingName:cG().nullable(),valueEntry:hP,defaultValueEntry:hP,actions:mg.optional(),groupId:cG().nullable(),assignment:hv,lockedBy:hS.nullable(),purpose:cG().nullable(),placeholder:cG().nullable(),createdBy:cG().nullable(),createdAt:mB.nullable(),filledBy:cG().nullable(),filledByName:cG().nullable(),filledAt:mB.nullable(),importedBy:cG().nullable(),widgets:fr(hF)},hx=fL(fu("kind",[fM({...hk,kind:fF("text"),value:cG(),defaultValue:cG(),maxLength:c3().int().positive().nullable(),multiline:c4(),password:c4(),comb:c4(),format:hD.nullable()}),fM({...hk,kind:fF("checkbox"),checked:c4(),exportValue:cG(),hasValuesList:c4().describe("Whether the field names its widgets\' values in a list (`/Opt`), as Acrobat does for values that repeat or aren\'t plain names: each widget\'s `exportValue` is then the list\'s entry at its place, and its `onState` only a key."),widgets:fr(hg)}),fM({...hk,kind:fF("radio"),value:cG(),radiosInUnison:c4(),noToggleToOff:c4(),hasValuesList:c4().describe("Whether the field names its widgets\' values in a list (`/Opt`), as Acrobat does for values that repeat or aren\'t plain names: each widget\'s `exportValue` is then the list\'s entry at its place, and its `onState` only a key."),widgets:fr(hg)}),fM({...hk,kind:fF("combobox"),value:cG(),defaultValue:cG(),edit:c4(),options:fr(h_),format:hD.nullable()}),fM({...hk,kind:fF("listbox"),selectedValues:fr(cG()),defaultValue:fr(cG()),multiSelect:c4(),options:fr(h_),topIndex:c3().int().nonnegative()}),fM({...hk,kind:fF("pushbutton"),hasImage:c4(),takesImage:c4().describe("Whether the push button is an image field, which a person fills with a picture: it has a widget, and every widget\'s press runs Acrobat\'s import-icon script (`event.target.buttonImportIcon()`) and nothing else.")}),fM({...hk,kind:fF("signature")}),fM({...hk,kind:fF("unknown"),rawValue:cG()})]),"unknown",e=>({...e,rawValue:"string"==typeof e.rawValue?e.rawValue:""}),e=>{var t;return"checkbox"!==(t=es(ej(en(el(ey(e)))))).kind&&"radio"!==t.kind||void 0!==t.hasValuesList?t:{...t,hasValuesList:!1}}).describe("A form field, by its `family`. A newer server can add families: read one your client doesn\'t know as `unknown`, keeping the fields every field has, with `rawValue` an empty string when the body has none.");fM({formKind:fB(fp(["none","acroform","xfa"])),needsAppearances:c4(),fields:fr(hx),widgets:fr(ha),calculationOrder:fr(pZ.nullable())}),fM({value:cG().nullable().optional(),checked:c4().optional(),selectedValues:fr(cG()).optional()}).strict().refine(e=>1===[e.value,e.checked,e.selectedValues].filter(e=>void 0!==e).length,{message:"exactly one of value, checked or selectedValues"});var hG=fM({page:f$,rect:mG.optional(),box:mG.optional(),rotation:mk.optional(),exportValue:cG().min(1).optional(),actions:mh.optional(),...hd}).strict(),hO=fM({label:cG(),value:cG()}),hI={name:cG().min(1),readOnly:c4().optional(),required:c4().optional(),noExport:c4().optional(),alternateName:cG().optional(),mappingName:cG().optional(),groupId:cG().min(1).max(256).nullable().optional(),assignment:hv.optional(),purpose:hE.nullable().optional(),placeholder:hA.nullable().optional(),actions:mb.optional(),widgets:fr(hG).optional()},hN=fu("kind",[fM({...hI,kind:fF("text"),defaultValue:cG().optional(),maxLength:c3().int().positive().optional(),multiline:c4().optional(),password:c4().optional(),comb:c4().optional(),format:hw.nullable().optional()}).strict(),fM({...hI,kind:fF("checkbox")}).strict(),fM({...hI,kind:fF("radio"),radiosInUnison:c4().optional(),noToggleToOff:c4().optional()}).strict(),fM({...hI,kind:fF("combobox"),edit:c4().optional(),options:fr(hO).optional(),defaultValue:cG().optional(),format:hw.nullable().optional()}).strict(),fM({...hI,kind:fF("listbox"),multiSelect:c4().optional(),options:fr(hO).optional(),defaultValue:fr(cG()).optional()}).strict(),fM({...hI,kind:fF("pushbutton"),takesImage:c4().optional().describe("Make the push button an image field: the engine writes Acrobat\'s import-icon script as each widget\'s activation action. It needs a widget, and can\'t go beside a widget\'s `actions.activate` or `actions.mouseUp`.")}).strict(),fM({...hI,kind:fF("signature")}).strict()]);function hC(e,t){let n=e.issues[0],r=n.path.join(".");return new N(G.InvalidArg,`${t}${r?` field \'${r}\'`:""}: ${n.message}`,{details:r?{field:r}:{}})}function hj(e){let{ref:t,reply:n,popup:r,...i}=e,o={...i};return"popup"===e.subtype&&delete o.parent,[t.page,...rB(o)]}function hM(e){let t=[],n=pX(e.subtype);for(let[r,i]of Object.entries(n?.fields??{})){let{owner:n,readBack:o,required:a}=i.traits;if("data"!==n||!o||"target"===r)continue;let s=e[r];if(null!=s&&!i.write.safeParse(s).success){if(a)return"item";t.push({field:r,reason:"unsupported-value"})}}return t}function hR(e,t,n,r){let i={...e};delete i.reply;let o=pX(e.subtype)?.fields??{};for(let{field:e}of t)o[e]?.traits.writeNullable?i[e]=null:delete i[e];let a=hm.safeParse(i);if("popup"===e.subtype&&delete i.parent,!a.success){let e=a.error.issues[0],t=e.path.join(".");throw new N(G.InvalidArg,`${r.label}${t?` field \'${t}\'`:""}: ${e.message}`,{details:{...r.details,...t?{field:t}:{}}})}return rL(i,n)}function hT(e,t,n){let r=hN.safeParse(e);if(!r.success){let e=r.error.issues[0],i=e.path.join(".");throw new N(G.InvalidArg,`${t}${i?` member \'${i}\'`:""}: ${e.message}`,{details:{...n,...i?{field:i}:{}}})}return e}fM({name:cG().min(1).optional(),readOnly:c4().optional(),required:c4().optional(),noExport:c4().optional(),alternateName:cG().nullable().optional(),mappingName:cG().nullable().optional(),groupId:cG().min(1).max(256).nullable().optional(),assignment:hv.optional(),purpose:hE.nullable().optional(),placeholder:hA.nullable().optional(),actions:mb.optional(),kind:fp(["text","checkbox","radio","combobox","listbox","pushbutton","signature"]).optional(),defaultValue:fs([cG(),fr(cG())]).nullable().optional(),maxLength:c3().int().positive().nullable().optional(),multiline:c4().optional(),password:c4().optional(),comb:c4().optional(),radiosInUnison:c4().optional(),noToggleToOff:c4().optional(),edit:c4().optional(),multiSelect:c4().optional(),options:fr(hO).optional(),format:hw.nullable().optional(),takesImage:c4().optional().describe("A push button\'s: `true` makes it an image field, writing Acrobat\'s import-icon script as the activation action of each widget whose press does nothing, and is refused while a widget\'s press runs another action. `false` takes the script off each widget whose press is exactly it.")}).strict();var hB=[32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,8226,8364,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,381,8216,8217,8220,8221,8211,8212,732,8482,353,8250,339,382,376,161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],hL={courier:{ascent:803,descent:-248,programHash:"955500bf0048e07e3046477b3874ef9e7653010a2bc780bbf27f837d7ca34d19",codePoints:hB,advances:[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600]},"courier-bold":{ascent:811,descent:-248,programHash:"386d8684b075c7ff4911235ae9691d5e9e924fff13fa1f17841c6d4d4f3762e6",codePoints:hB,advances:[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600]},"courier-bold-oblique":{ascent:811,descent:-248,programHash:"d1dae62980ea92bfa86f9e3961a3064e164e41a5064211f2a3a8833643a322a5",codePoints:hB,advances:[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600]},"courier-oblique":{ascent:803,descent:-248,programHash:"d790f273acf84a1afada2cf96a6eb646728a1a6e7afe961a2cc846bb3a501b0b",codePoints:hB,advances:[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600]},helvetica:{ascent:945,descent:-224,programHash:"93fe419ed14bac240018cf4506dbb64643eeeee379c0b51d3c52d239f4adbc58",codePoints:hB,advances:[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,350,667,222,556,333,1e3,556,556,333,1e3,667,333,1e3,611,222,222,333,333,556,1e3,333,1e3,500,366,944,500,667,333,556,556,556,556,260,556,333,737,370,612,584,737,333,400,584,333,333,333,556,537,278,333,333,365,612,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,584,611,556,556,556,556,500,556,500]},"helvetica-bold":{ascent:962,descent:-227,programHash:"f11bf41cf5d115966ee4d954d9d3eab4a7d1b63d371e5d655fc82d15350bc929",codePoints:hB,advances:[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,1072,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,350,722,278,556,500,1e3,556,556,333,1e3,667,333,1e3,611,278,278,500,500,556,1e3,333,1e3,556,333,944,500,667,333,556,556,556,556,280,556,333,737,370,556,584,737,333,400,584,333,333,333,611,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,584,611,611,611,611,611,556,611,556]},"helvetica-bold-oblique":{ascent:962,descent:-227,programHash:"9cd559e9d134dd6bb8bb75186d4302079e78ebee53a7c9b38dea1fba52a534d8",codePoints:hB,advances:[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,528,556,556,556,556,333,333,584,584,584,611,1072,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,350,722,278,556,500,1e3,556,556,333,1e3,667,333,1e3,611,278,278,500,500,556,1e3,333,1e3,556,333,944,500,667,333,556,556,556,556,280,556,333,737,370,556,584,737,333,400,584,333,333,333,611,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,584,519,611,611,611,611,556,611,556]},"helvetica-oblique":{ascent:951,descent:-224,programHash:"872e4efa9cc73daff4a3fffa952663f32144db19ec91a8407afc359486eae30b",codePoints:hB,advances:[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1116,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,350,667,222,556,333,1e3,556,556,333,1e3,667,350,1e3,611,222,222,333,333,556,1e3,333,1e3,500,333,944,500,667,333,556,556,556,556,260,556,333,737,370,556,584,737,333,400,584,333,333,333,556,537,278,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,584,611,556,556,556,556,500,556,500]},"times-roman":{ascent:878,descent:-249,programHash:"7be927a55309ca34d67972ccf041ff3d156d774017022b18131fa365e6dd922e",codePoints:hB,advances:[250,333,408,500,500,833,778,180,333,333,500,564,250,333,250,278,500,500,500,500,500,500,500,500,500,500,278,278,564,564,564,444,921,722,667,667,722,611,556,722,722,333,389,722,611,889,722,722,556,722,667,556,611,722,722,944,722,722,611,333,278,333,469,500,333,444,500,444,500,444,333,500,500,278,278,500,278,778,500,500,500,500,333,389,278,500,500,722,500,500,444,480,200,480,541,350,722,333,500,444,1e3,500,500,333,1e3,556,333,889,611,333,333,444,444,500,1e3,333,980,389,333,722,444,722,333,500,500,500,500,200,500,333,760,276,500,564,760,333,400,564,300,300,333,500,453,250,333,300,310,500,750,750,750,444,722,722,722,722,722,722,889,667,611,611,611,611,333,333,333,333,722,722,722,722,722,722,722,564,722,722,722,722,722,722,556,500,444,444,444,444,444,444,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,564,500,500,500,500,500,500,500,500]},"times-bold":{ascent:889,descent:-249,programHash:"f23f2efbfa079f9083d967acf695b10db7c78e39862dbeb4788a4fd0533ff29c",codePoints:hB,advances:[250,333,555,500,500,1e3,833,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,930,722,667,722,722,667,611,778,778,389,500,778,667,944,722,778,611,778,722,556,667,722,722,1e3,722,722,667,333,278,333,581,500,333,500,556,444,556,444,333,500,556,278,333,556,278,833,556,500,556,556,444,389,333,556,500,722,500,500,444,394,220,394,520,350,722,333,500,500,1e3,500,500,333,1e3,556,333,1e3,667,333,333,500,500,500,1e3,333,1e3,389,333,722,444,722,333,500,500,500,500,220,500,333,747,300,500,570,747,333,400,570,300,300,333,556,540,250,333,300,330,500,750,750,750,500,722,722,722,722,722,722,1e3,722,667,667,667,667,389,389,389,389,722,722,778,778,778,778,778,570,778,722,722,722,722,722,611,556,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,500,556,500]},"times-bold-italic":{ascent:869,descent:-249,programHash:"cf51fab68d7d965f5755218a7f99b0376bc440e1bb4e90498aef0964aac94490",codePoints:hB,advances:[250,389,555,500,500,833,778,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,832,667,667,667,722,667,667,722,778,389,500,667,611,889,722,722,611,722,667,556,611,722,667,889,667,611,611,333,278,333,570,500,333,500,500,444,500,444,333,500,556,278,278,500,278,778,556,500,500,500,389,389,278,556,444,667,500,444,389,348,220,348,570,350,667,333,500,500,1e3,500,500,333,1e3,556,333,944,611,333,333,500,500,500,1e3,333,1e3,389,333,722,389,611,389,500,500,500,500,220,500,333,747,266,500,606,747,333,400,570,300,300,333,576,500,250,333,300,300,500,750,750,750,500,667,667,667,667,667,667,944,667,667,667,667,667,389,389,389,389,722,722,722,722,722,722,722,570,722,722,722,722,722,611,611,500,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,444,500,444]},"times-italic":{ascent:868,descent:-249,programHash:"f405670768d71ff8d8a4e493cbcb9c6deff9565419bf63a38abb544789aa87b4",codePoints:hB,advances:[250,333,420,500,500,833,778,214,333,333,500,675,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,675,675,675,500,920,611,611,667,722,611,611,722,722,333,444,667,556,833,667,722,611,722,611,500,556,722,611,833,611,556,556,389,278,389,422,500,333,500,500,444,500,444,278,500,500,278,278,444,278,722,500,500,500,500,389,389,278,500,444,667,444,444,389,400,275,400,541,350,500,333,500,556,889,500,500,333,1e3,500,333,944,556,333,333,556,556,500,889,333,980,389,333,667,389,556,389,500,500,500,500,275,500,333,760,276,500,675,760,333,400,675,300,300,333,500,523,250,333,300,310,500,750,750,750,500,611,611,611,611,611,611,889,667,611,611,611,611,333,333,333,333,722,667,722,722,722,722,722,675,722,722,722,722,722,556,611,500,500,500,500,500,500,500,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,675,500,500,500,500,500,444,500,444]},symbol:{ascent:1010,descent:-293,programHash:"1f027bd5b336f563724a2cba62295329edbb3df7ca9efbe8f296d7a1e86849a1",codePoints:[32,33,8704,35,8707,37,38,8715,40,41,8727,43,44,8722,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,8773,913,914,935,916,917,934,915,919,921,977,922,923,924,925,927,928,920,929,931,932,933,962,937,926,936,918,91,8756,93,8869,95,63717,945,946,967,948,949,966,947,951,953,981,954,955,956,957,959,960,952,961,963,964,965,982,969,958,968,950,123,124,125,8764,8364,978,8242,8804,8260,8734,402,9827,9830,9829,9824,8596,8592,8593,8594,8595,176,177,8243,8805,215,8733,8706,8226,247,8800,8801,8776,8230,63718,63719,8629,8501,8465,8476,8472,8855,8853,8709,8745,8746,8835,8839,8836,8834,8838,8712,8713,8736,8711,63194,63193,63195,8719,8730,8901,172,8743,8744,8660,8656,8657,8658,8659,9674,9001,63720,63721,63722,8721,63723,63724,63725,63726,63727,63728,63729,63730,63731,63732,9002,8747,8992,63733,8993,63734,63735,63736,63737,63738,63739,63740,63741,63742],advances:[250,333,713,500,549,833,778,439,333,333,500,549,250,549,250,278,500,500,500,500,500,500,500,500,500,500,278,278,549,549,549,444,549,722,667,722,612,611,763,603,722,333,631,722,686,889,722,722,768,741,556,592,611,690,439,768,645,795,611,333,863,333,658,500,500,631,549,549,494,439,521,411,603,329,603,549,549,576,521,549,549,521,549,603,439,576,713,686,493,686,494,480,200,480,549,750,620,247,549,167,713,500,753,753,753,753,1042,987,603,987,603,400,549,411,549,549,713,494,460,549,549,549,549,1e3,603,1e3,658,823,686,795,987,768,768,823,768,768,713,713,713,713,713,713,713,768,713,790,790,890,823,549,250,713,603,603,1042,987,603,987,603,494,329,790,790,786,713,384,384,384,384,384,384,494,494,494,494,329,274,686,686,686,384,384,384,384,384,384,494,494,494]},"zapf-dingbats":{ascent:826,descent:-163,programHash:"0439c04b1c3ba23c2fd8c2f4a5f2c65b2b0f817588c45afd5c06a41eab70bfbd",codePoints:[32,9985,9986,9987,9988,9742,9990,9991,9992,9993,9755,9758,9996,9997,9998,9999,1e4,10001,10002,10003,10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10017,10018,10019,10020,10021,10022,10023,9733,10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10037,10038,10039,10040,10041,10042,10043,10044,10045,10046,10047,10048,10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,9679,10061,9632,10063,10064,10065,10066,9650,9660,9670,10070,9687,10072,10073,10074,10075,10076,10077,10078,10081,10082,10083,10084,10085,10086,10087,9827,9830,9829,9824,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,10102,10103,10104,10105,10106,10107,10108,10109,10110,10111,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,10123,10124,10125,10126,10127,10128,10129,10130,10131,10132,8594,8596,8597,10136,10137,10138,10139,10140,10141,10142,10143,10144,10145,10146,10147,10148,10149,10150,10151,10152,10153,10154,10155,10156,10157,10158,10159,10161,10162,10163,10164,10165,10166,10167,10168,10169,10170,10171,10172,10173,10174],advances:[278,974,961,974,980,719,789,790,791,690,960,939,549,855,911,933,911,945,974,755,846,762,761,571,677,763,760,759,754,494,552,537,577,692,786,788,788,790,793,794,816,823,789,841,823,833,816,831,923,744,723,749,790,792,695,776,768,792,759,707,708,682,701,826,815,789,789,707,687,696,689,786,787,713,791,785,791,873,761,762,762,759,759,892,892,788,784,438,138,277,415,392,392,668,668,732,544,544,910,667,760,760,776,595,694,626,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,894,838,1016,458,748,924,748,918,927,928,928,834,873,828,924,924,917,930,931,463,883,836,836,867,867,696,696,874,874,760,946,771,865,771,888,967,888,831,873,927,970,918]}},h$=new Uint8Array(128);for(let e=0;e<64;e+=1)h$["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(e)]=e;var hz={standardDisplayHash:e=>hL[e].programHash,lastResortDisplayHash:"e9d14973462069b4906f8d22a9aaec2d6ec9eb02ac31d697631783316d8b8768"},hU=new WeakSet;function hV(e){hU.has(e)||(e.fn.EPDF_InitThread(),hU.add(e))}function hW(e){if(e.aborted){let t=e.reason;if(t instanceof Error)throw t;throw new ns(t)}}function hq(e){let t=/^(?:D:)?(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(?:([Zz])(?:00\'?00\'?)?|([+-])(\\d{2})(?:\'?(\\d{2})\'?)?)?$/.exec(e.trim());if(!t)return null;let[,n,r="01",i="01",o="00",a="00",s="00"]=t,[,,,,,,,l,u,d,c="00"]=t;if(!hK({year:n,month:r,day:i,hour:o,minute:a,second:s}))return null;let f="";if(l)f="Z";else if(u){if(Number(d)>23||Number(c)>59)return null;f=0===Number(d)&&0===Number(c)?"Z":`${u}${d}:${c}`}return`${n}-${r}-${i}T${o}:${a}:${s}${f}`}function hH(e=new Date){if(e instanceof Date){if(Number.isNaN(e.getTime()))throw RangeError("Cannot format an invalid Date");return hH(`${e.toISOString().slice(0,19)}Z`)}let t=/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?(?:([Zz])|([+-])(\\d{2}):(\\d{2}))?$/.exec(e),n=t&&{year:t[1],month:t[2],day:t[3],hour:t[4],minute:t[5],second:t[6]??"00"};if(!t||!n||!hK(n))throw new N(G.InvalidArg,`not an ISO 8601 date and time: \'${e}\'`);let[,,,,,,,r,i,o,a]=t,s=r?"+00\'00\'":i?`${i}${o}\'${a}\'`:"",{year:l,month:u,day:d,hour:c,minute:f,second:m}=n;return`D:${l}${u}${d}${c}${f}${m}${s}`}function hK({year:e,month:t,day:n,hour:r,minute:i,second:o}){let a=Number(e),s=Number(t),l=Number(n);if(s<1||s>12||l<1)return!1;let u=new Date(Date.UTC(2e3,s,0)).getUTCDate();return!(l>(2!==s||a%4==0&&(a%100!=0||a%400==0)?u:28))&&23>=Number(r)&&59>=Number(i)&&59>=Number(o)}function hZ(e){return(hZ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function hJ(e,t,n){var r;return(r=function(e,t){if("object"!=hZ(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=hZ(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==hZ(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hQ=class{constructor(){hJ(this,"byContent",null),hJ(this,"bySource",new Map),hJ(this,"hashes",new WeakMap)}forget(){this.byContent=null,this.bySource.clear()}};function hX(e,t,n){return 4!==e.FPDF_GetLastError()?n:t?new N(G.DocPasswordIncorrect,"incorrect document password"):new N(G.DocPasswordRequired,"document requires a password")}function hY(e,t,n){let r=e.alloc(t);try{return n(r)}finally{e.free(r)}}function h0(e,t,n){let r=t.map(t=>e.alloc(t));try{return n(r)}finally{for(let t=r.length-1;t>=0;t--)e.free(r[t])}}function h1(e,t,n){return hY(e,4*Math.max(1,t.length),r=>(t.forEach((t,n)=>e.poke(r,"i32",t,4*n)),n(r,t.length)))}function h3(e,t,n=""){let r=t(0n,0);return r<=0?null:2===r?n:hY(e,r,n=>0>=t(n,r)?null:e.readU16String(n))}function h2(e,t){let n=t(0n,0);return n<=0?null:hY(e,n,r=>0>=t(r,n)?null:e.readU8String(r))}function h6(e,t,n){let r=e.writeU16String(t);try{return n(r)}finally{e.free(r)}}function h5(e,t,n){let r=e.writeU16String(t);try{return n(r)}finally{e.free(r)}}function h4(e,t,n){let r=new TextEncoder().encode(t),i=new Uint8Array(r.byteLength+1);i.set(r);let o=e.alloc(i.byteLength);try{return e.writeBytes(o,i),n(o)}finally{e.free(o)}}var h8=class{constructor(){hJ(this,"actions",[]),hJ(this,"closed",!1)}push(e){this.closed?e():this.actions.push(e)}close(){if(this.closed)return;this.closed=!0;let e=null;for(let t=this.actions.length-1;t>=0;t--)try{this.actions[t]?.()}catch(t){e??(e=t)}if(this.actions.length=0,e)throw e}};function h7(e,t,n=null){let{mem:r,fn:i}=e,o=new h8,a=r.alloc(t.byteLength);o.push(()=>r.free(a));try{r.writeBytes(a,t);let s=i.FPDF_LoadMemDocument64(a,t.byteLength,n??"");if(!s)throw hX(i,n,new N(G.DocOpenFailed,"failed to open document"));return Fe(e,s),o.push(()=>i.FPDF_CloseDocument(s)),{kind:"fat-memory",docPtr:s,source:{base:null,layer:null,password:n},close:()=>o.close()}}catch(e){throw o.close(),e}}function h9(e,t,n={kind:"fresh"},r=null){let{mem:i,fn:o}=e,a=new h8;a.push(()=>t.release());let s=null,l=i.alloc(4);try{let u;i.poke(l,"i32",-1),"fresh"===n.kind?u=o.EPDFLayer_OpenLayer(t.basePtr,0n,r??"",l):"artifact-file"===n.kind&&"native"===e.kind?u=h4(i,n.path,e=>o.EPDFLayer_OpenLayerArtifactFromPath(t.basePtr,e,r??"",l)):(s="artifact-file"===n.kind?e.fileAccess.fromNodeFile(n.path):e.fileAccess.fromMemory(n.bytes),a.push(()=>s?.close()),u="artifact"===n.kind||"artifact-file"===n.kind?o.EPDFLayer_OpenLayerArtifact(t.basePtr,s.ptr,r??"",l):o.EPDFLayer_OpenLayer(t.basePtr,s.ptr,r??"",l));let d=Number(i.peek(l,"i32"));if(!u||0!==d)throw function(e){switch(e){case 1:return new N(G.DocPasswordRequired,"layer requires a password");case 2:return new N(G.MalformedPdf,"layer delta is malformed");case 3:return new N(G.MalformedPdf,"layer artifact does not match the supplied base document");default:return new N(G.DocOpenFailed,"failed to open layer document")}}(d);Fe(e,u),a.push(()=>o.FPDF_CloseDocument(u));let c="file"===t.kind&&void 0!==t.path?{kind:"file",key:t.key,path:t.path}:{kind:"memory",key:t.key};return{kind:"layer",docPtr:u,source:{base:c,layer:n,password:r},close:()=>a.close()}}catch(e){throw a.close(),e}finally{i.free(l)}}function Fe(e,t){let{fn:n}=e;n.EPDF_IsEncrypted&&n.EPDF_SetRuntimeOwnerPermissions&&n.EPDF_IsEncrypted(t)&&n.EPDF_SetRuntimeOwnerPermissions(t,!0)}function Ft(e,t,n,r=0){let i=BigInt(n);e.poke(t,"i32",0|Number(4294967295n&i),r),e.poke(t,"i32",0|Number(i>>32n&4294967295n),r+4)}function Fn(e,t,n=0){let r=Number(e.peek(t,"i32",n))>>>0;return(Number(e.peek(t,"i32",n+4))>>>0)*0x100000000+r}var Fr={budgetBytes:0x18000000,idleMs:3e4},Fi={place:"elsewhere",pixels:0},Fo=class{constructor(e,t=Fr,n=()=>!1){this.runtime=e,this.policy=t,this.busy=n,hJ(this,"pages",new Map),hJ(this,"closedSizes",new Map),hJ(this,"workingSets",new Map),hJ(this,"totalBytes",0),hJ(this,"clock",0),hJ(this,"timer",null)}acquire(e,t,n){let r=this.take(e,n);if(!r){this.makeRoom(this.expectedBytes(e,n));let i=this.runtime.fn.EPDFDoc_LoadPageByObjectNumberNormalized(t,n);if(!i)throw Fa(n);r=this.add(e,n,i,!0)}if(r.refs++,!r.loaded){if(1!==this.runtime.fn.EPDFPage_ContinueLoad(r.ptr,0x3fffffff))throw this.drop(r),Fs(n);r.loaded=!0}return this.measure(r),this.makeRoom(0),r.ptr}async acquireInSlices(e,t,n,r,i){hW(r);let{fn:o}=this.runtime,a=this.take(e,n);if(!a){this.makeRoom(this.expectedBytes(e,n));let r=o.EPDFDoc_StartLoadPageByObjectNumber(t,n,!0);if(!r)throw Fa(n);a=this.add(e,n,r,!1)}for(a.refs++;!a.loaded;){let t=o.EPDFPage_ContinueLoad(a.ptr,i.budgetMs);if(t<0)throw this.drop(a),Fs(n);if(a.loaded=1===t,this.measure(a),this.makeRoom(0),a.loaded)break;try{await i.between(),hW(r)}catch(t){throw this.release(e,n),t}}return a.ptr}release(e,t){let n=this.pages.get(e)?.get(t);if(n&&!(n.refs<=0)&&(n.refs--,!(n.refs>0))){if(n.lastUsed=++this.clock,n.loaded&&!this.runtime.fn.EPDFPage_ResetRenderCache(n.ptr))return void this.close(n);this.armTimer(),this.makeRoom(0)}}setWorkingSet(e,t,n){let r=new Map;for(let{pageObjectNumber:e,role:t,pixels:i}of n){let n={place:t,pixels:i},o=r.get(e);(!o||aI(n,o))&&r.set(e,n)}let i=this.workingSets.get(e);r.size>0?(i||(i=new Map,this.workingSets.set(e,i)),i.set(t,r)):(i?.delete(t),i?.size===0&&this.workingSets.delete(e)),this.totalBytes>0&&this.armTimer()}isHeld(e,t){return(this.pages.get(e)?.get(t)?.refs??0)>0}isKept(e,t){return this.pages.get(e)?.has(t)??!1}closeOwner(e){for(let t of[...this.pages.get(e)?.values()??[]])this.close(t);this.pages.delete(e),this.closedSizes.delete(e),this.workingSets.delete(e)}closeIdleOf(e){for(let t of[...this.pages.get(e)?.values()??[]])0===t.refs&&this.close(t)}closeIdle(){for(let e of[...this.pages.values()])for(let t of[...e.values()])0===t.refs&&this.close(t)}closeUnshown(){for(let e of[...this.pages.values()])for(let t of[...e.values()])0===t.refs&&"visible"!==this.placeOf(t).place&&this.close(t)}get size(){let e=0;for(let t of this.pages.values())e+=t.size;return e}get bytes(){return this.totalBytes}take(e,t){let n=this.pages.get(e)?.get(t);return n?0!==n.refs||this.runtime.fn.EPDFPage_IsContentCurrent(n.ptr)?(n.lastUsed=++this.clock,n):(this.close(n),null):null}add(e,t,n,r){let i={owner:e,pageObjectNumber:t,ptr:n,refs:0,loaded:r,bytes:65536,lastUsed:++this.clock},o=this.pages.get(e);return o||(o=new Map,this.pages.set(e,o)),o.set(t,i),this.totalBytes+=i.bytes,i}measure(e){let{fn:t,mem:n}=this.runtime,r=65536+hY(n,40,r=>t.EPDFPage_GetParsedSize(e.ptr,r)?Fn(n,r,24):0);this.totalBytes+=r-e.bytes,e.bytes=r}expectedBytes(e,t){return this.closedSizes.get(e)?.get(t)??65536}makeRoom(e){let t=this.policy.budgetBytes>0?this.lastToCloseOverBudget():null;for(;this.totalBytes-(t?.bytes??0)+e>this.policy.budgetBytes;){let e=this.firstToClose(t);if(e)this.close(e);else{if(!t||0!==t.refs)return;this.close(t),t=null}}}firstToClose(e){let t=null,n=Fi;for(let r of this.pages.values())for(let i of r.values()){if(i.refs>0||i===e)continue;let r=this.placeOf(i);(!t||aI(n,r)||!aI(r,n)&&i.lastUsede.lastUsed)&&(e=r,t=n)}return e}placeOf(e){let t=Fi;for(let n of this.workingSets.get(e.owner)?.values()??[]){let r=n.get(e.pageObjectNumber);r&&aI(r,t)&&(t=r)}return t}close(e){if(e.loaded){let t=this.closedSizes.get(e.owner);t||(t=new Map,this.closedSizes.set(e.owner,t)),t.set(e.pageObjectNumber,e.bytes)}this.drop(e)}drop(e){this.runtime.fn.FPDF_ClosePage(e.ptr);let t=this.pages.get(e.owner);t?.delete(e.pageObjectNumber),t?.size===0&&this.pages.delete(e.owner),this.totalBytes-=e.bytes,this.totalBytes<=0&&this.disarmTimer()}armTimer(){this.policy.idleMs<=0||(this.disarmTimer(),this.timer=setTimeout(()=>{this.timer=null,this.busy()?this.armTimer():this.closeUnshown()},this.policy.idleMs),this.timer.unref?.())}disarmTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}};function Fa(e){return new N(G.NotFound,`no page with object number ${e}`)}function Fs(e){return new N(G.RuntimeUnavailable,`failed to load page object ${e}`)}var Fl=class{constructor(e,t,n=null){this.docPtr=t,hJ(this,"residency",void 0),this.residency=n??new Fo(e,{budgetBytes:0,idleMs:0})}acquire(e){return this.residency.acquire(this,this.docPtr,e)}acquireInSlices(e,t,n){return this.residency.acquireInSlices(this,this.docPtr,e,t,n)}isHeld(e){return this.residency.isHeld(this,e)}isKept(e){return this.residency.isKept(this,e)}release(e){this.residency.release(this,e)}setWorkingSet(e,t){this.residency.setWorkingSet(this,e,t)}closeIdle(){this.residency.closeIdleOf(this)}closeAll(){this.residency.closeOwner(this)}},Fu=class{constructor(e,t){this.runtime=e,hJ(this,"docPtr",null),hJ(this,"closeDocument",null),hJ(this,"_kind",null),hJ(this,"_source",null),hJ(this,"_sessionId",void 0),hJ(this,"recordsByObjectNumber",new Map),hJ(this,"recordsByIndex",new Map),hJ(this,"fullyEnumerated",!1),hJ(this,"cacheSeqCounter",0),hJ(this,"editsSeqCounter",0),hJ(this,"transaction",null),hJ(this,"unusableReason",null),hJ(this,"pages",null),hJ(this,"residency",null),hJ(this,"signedDocumentPolicy","protect"),hJ(this,"password",null),hJ(this,"persistLayerArtifact",!0),hJ(this,"loadedSeq",0),hJ(this,"plainSha256",null),hJ(this,"pendingSigning",null),hJ(this,"lastCompletion",null),hJ(this,"drawings",null),hJ(this,"parkedLoad",null),hJ(this,"objectNumberAuthority","session"),hJ(this,"heldObjectNumbers",new Set),hJ(this,"objectNumbersInUse",[]),hJ(this,"retained",[]),this._sessionId=t??`sess_${(++Fc).toString(36)}_${Date.now().toString(36)}`}get sessionId(){return this._sessionId}get kind(){return this._kind}get source(){if(!this._source)throw new N(G.DocNotOpen,"document is not open");return this._source}isOpen(){return null!==this.docPtr}open(e,t=null){this.openFromHandle(h7(this.runtime,e,t))}openFromHandle(e){if(this.docPtr)throw e.close(),new N(G.InvalidArg,"document already open");this.docPtr=e.docPtr,this.closeDocument=()=>e.close(),this._kind=e.kind,this._source=e.source,this.pages=new Fl(this.runtime,e.docPtr,this.residency),this.parkedLoad=null,this.drawings=null,this.loadedSeq=this.editsSeqCounter}hasUnsavedEdits(){return this.editsSeqCounter!==this.loadedSeq}cachedPlainSha256(){return this.plainSha256&&this.plainSha256.loadedSeq===this.loadedSeq?this.plainSha256.sha256:null}rememberPlainSha256(e){this.plainSha256={loadedSeq:this.loadedSeq,sha256:e}}install(e){if(!this.docPtr)throw e.close(),new N(G.DocNotOpen,"no document to replace");let t=null;try{this.pages?.closeAll()}catch(e){t=e}try{this.closeDocument?.()}catch(e){t??(t=e)}if(this.docPtr=e.docPtr,this.closeDocument=()=>e.close(),this._kind=e.kind,this._source=e.source,this.pages=new Fl(this.runtime,e.docPtr,this.residency),this.recordsByIndex.clear(),this.recordsByObjectNumber.clear(),this.fullyEnumerated=!1,this.cacheSeqCounter++,this.editsSeqCounter++,this.loadedSeq=this.editsSeqCounter,this.pendingSigning=null,this.drawings=null,this.heldObjectNumbers.clear(),this.objectNumbersInUse=[],t)throw t}versionRef(e){return{baseSha256:e,editsVersion:this.editsSeqCounter}}parkLocked(e){if(this.docPtr)throw new N(G.InvalidArg,"document already open");this.parkedLoad=e}isLocked(){return null===this.docPtr&&null!==this.parkedLoad}unlockWith(e){if(!this.parkedLoad)throw new N(G.DocNotOpen,"document session is not locked");this.parkedLoad(e),this.parkedLoad=null}pageCount(){return this.runtime.fn.FPDF_GetPageCount(this.requireDocPtr())}ensureFullPageRegistry(){if(this.fullyEnumerated)return;let{fn:e}=this.runtime,t=this.requireDocPtr(),n=e.FPDF_GetPageCount(t);for(let r=0;rthis.resolvePageRef(e).pageObjectNumber)}allRecords(){return this.ensureFullPageRegistry(),Array.from(this.recordsByIndex.entries()).sort(([e],[t])=>e-t).map(([,e])=>e)}refreshPageRegistry(){this.recordsByIndex.clear(),this.recordsByObjectNumber.clear(),this.fullyEnumerated=!1,this.ensureFullPageRegistry()}cacheSeq(){return this.cacheSeqCounter}invalidateDerived(){this.cacheSeqCounter++}editsSeq(){return this.editsSeqCounter}noteEdit(){this.editsSeqCounter++}clearMissingCharacters(){this.docPtr&&this.runtime.fn.EPDFDoc_ClearMissingCharacters(this.docPtr)}missingCharacters(){if(!this.docPtr)return[];let{fn:e,mem:t}=this.runtime,n=this.docPtr,r=[],i=e.EPDFDoc_CountMissingCharacters(n);for(let o=0;oe.EPDFDoc_GetMissingCharacter(n,o,t,r));i&&r.push(i)}return r}inTransaction(){return null!==this.transaction}beginTransaction(e){let t=this.requireDocPtr();if(this.transaction)throw new N(G.Unknown,"a transaction is already open");if(!this.runtime.fn.EPDFLayer_BeginTransaction(t))throw new N(G.Unknown,"EPDFLayer_BeginTransaction refused");this.transaction={docPtr:t,opId:e,undoable:!1}}writeStamp(){let{opId:e,undoable:t}=this.requireTransaction();return{opId:e,undoable:t}}markUndoable(){this.requireTransaction().undoable=!0}commitTransaction(){let{docPtr:e}=this.requireTransaction();if(!this.runtime.fn.EPDFLayer_IsInTransaction(e))throw new N(G.Unknown,"the layer transaction is no longer open");let t=this.runtime.fn.EPDFLayer_GetLastObjectNumber(e);if(t>8388607)throw new N(G.LayerFull,"the document would pass object number 8388607",{details:{lastObjectNumber:t}});this.transaction=null;let n=!1;try{n=this.runtime.fn.EPDFLayer_CommitTransaction(e)}finally{n||(this.unusableReason=Fd)}if(!n)throw new N(G.DocNotOpen,Fd);for(let e of this.objectNumbersInUse)this.heldObjectNumbers.delete(e);this.objectNumbersInUse=[]}abortTransaction(){let{docPtr:e}=this.requireTransaction();this.transaction=null,this.objectNumbersInUse=[];let t=!1;try{t=this.runtime.fn.EPDFLayer_AbortTransaction(e)}catch{}this.drawings?.forget(),this.recordsByIndex.clear(),this.recordsByObjectNumber.clear(),this.fullyEnumerated=!1,this.invalidateDerived(),t||(this.unusableReason="a layer transaction failed to abort")}lastObjectNumber(){return this.runtime.fn.EPDFLayer_GetLastObjectNumber(this.requireDocPtr())}raiseLastObjectNumber(e){if(!this.runtime.fn.EPDFLayer_RaiseLastObjectNumber(this.requireDocPtr(),e))throw new N(G.LayerFull,`the document would pass object number ${e}`,{details:{lastObjectNumber:this.lastObjectNumber()}})}reserveObjectNumbers(e){if("session"!==this.objectNumberAuthority)throw new N(G.InvalidArg,"object numbers are handed out by the caller, not this session");if(!Number.isInteger(e)||e<1)throw new N(G.InvalidArg,`cannot reserve ${e} object numbers`,{details:{field:"count"}});let{fn:t}=this.runtime,n=this.requireDocPtr(),r=t.EPDFLayer_GetLastObjectNumber(n);if(r+e>8e6)throw new N(G.LayerFull,"no more object numbers to hand out",{details:{lastObjectNumber:r}});if(!t.EPDFLayer_RaiseLastObjectNumber(n,r+e))throw new N(G.Unknown,"EPDFLayer_RaiseLastObjectNumber refused");let i={first:r+1,count:e};for(let t=0;t=0;t--)try{this.retained[t]()}catch(t){e??(e=t)}if(this.retained.length=0,e)throw e}},Fd="a layer transaction failed to commit",Fc=0;function Ff(e,t){return new N(G.ObjectNumberUnavailable,"not-held"===t?`object number ${e} isn\'t one this session holds`:`an object already has object number ${e}`,{details:{objectNumber:e,reason:t}})}function Fm(e,t){return hX(e.fn,t,new N(G.DocOpenFailed,"failed to open base document"))}var Fp=class{constructor(e){this.runtime=e,hJ(this,"entries",new Map)}acquireMemoryBase(e){let t=this.retain(e.key);if(t)return t;let{mem:n,fn:r}=this.runtime,i=new h8,o=n.alloc(e.bytes.byteLength);i.push(()=>n.free(o));try{n.writeBytes(o,e.bytes);let t=r.EPDF_LoadMemBaseDocument64(o,e.bytes.byteLength,e.password??"");if(!t)throw Fm(this.runtime,e.password);return Fe(this.runtime,t),i.push(()=>r.EPDF_ReleaseBaseDocument(t)),this.supplyKnownSha(t,e.knownSha256),this.insert({key:e.key,kind:"memory",basePtr:t,refs:1,close:()=>i.close()})}catch(e){throw i.close(),e}}acquireFileBase(e){let t=this.retain(e.key);if(t)return t;let{fn:n}=this.runtime,r=new h8,i=null;try{i=this.runtime.fileAccess.fromNodeFile(e.path),r.push(()=>i?.close());let t=n.EPDF_LoadBaseDocument(i.ptr,e.password??"");if(!t)throw Fm(this.runtime,e.password);return Fe(this.runtime,t),r.push(()=>n.EPDF_ReleaseBaseDocument(t)),this.supplyKnownSha(t,e.knownSha256),this.insert({key:e.key,kind:"file",path:e.path,basePtr:t,refs:1,close:()=>r.close()})}catch(e){throw r.close(),e}}retainByKey(e){return this.retain(e)}supplyKnownSha(e,t){if(!t||!/^[0-9a-fA-F]{64}$/.test(t))return;let{mem:n,fn:r}=this.runtime,i=new Uint8Array(32);for(let e=0;e<32;e++)i[e]=parseInt(t.slice(2*e,2*e+2),16);let o=n.alloc(32);try{n.writeBytes(o,i),r.EPDF_SetBaseDocumentSha256(e,o)}finally{n.free(o)}}releaseAll(){let e=Array.from(this.entries.values());this.entries.clear();let t=null;for(let n of e)try{n.close()}catch(e){t??(t=e)}if(t)throw t}getRefCountForTesting(e){return this.entries.get(e)?.refs??0}retain(e){let t=this.entries.get(e);return t?(t.refs++,this.handleFor(t)):null}insert(e){return this.entries.set(e.key,e),this.handleFor(e)}handleFor(e){let t=!1;return{key:e.key,kind:e.kind,...void 0!==e.path?{path:e.path}:{},basePtr:e.basePtr,release:()=>{if(t)return;t=!0;let n=this.entries.get(e.key);!n||(n.refs--,n.refs>0||(this.entries.delete(e.key),n.close()))}}}};function Fh(e,t,n,r){return e.EPDF_HasMetaText(n,r)?h3(t,(t,i)=>e.FPDF_GetMetaText(n,r,t,i),""):null}var FF=class{constructor(e,t){this.runtime=e,this.session=t}read(e){let t;hW(e);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=Fh(n,r,i,"Title");hW(e);let a=Fh(n,r,i,"Author");hW(e);let s=Fh(n,r,i,"Subject");hW(e);let l=Fh(n,r,i,"Keywords");hW(e);let u=Fh(n,r,i,"Producer");hW(e);let d=Fh(n,r,i,"Creator");hW(e);let c=Fh(n,r,i,"CreationDate");hW(e);let f=Fh(n,r,i,"ModDate");hW(e);let m=1===(t=Number(n.EPDF_GetMetaTrapped(i)))?"true":2===t?"false":"unknown";return{title:o,author:a,subject:s,keywords:l,producer:u,creator:d,createdAt:c?hq(c):null,modifiedAt:f?hq(f):null,trapped:m}}readCustom(e){hW(e);let{fn:t,mem:n}=this.runtime;return function(e,t,n){let r=0|Number(e.EPDF_GetMetaKeyCount(n,!0)),i={};for(let o=0;oe.EPDF_GetMetaKeyName(n,r,i,t,o))}(e,t,n,o,!0);if(!r)continue;let a=Fh(e,t,n,r);null!=a&&(i[r]=a)}return i}(t,n,this.session.requireDocPtr())}};function Fg(e,t,n,r,i){return null===i?e.EPDF_SetMetaText(n,r,0n):h6(t,i,t=>e.EPDF_SetMetaText(n,r,t))}var F_=new Set(["Title","Author","Subject","Keywords","Producer","Creator","CreationDate","ModDate","Trapped"]),FP=[["title","Title"],["author","Author"],["subject","Subject"],["keywords","Keywords"],["producer","Producer"],["creator","Creator"]],FD="http://www.w3.org/2000/xmlns/";function Fb(e){return(function(e){let t="";for(let n of e){let e=n.codePointAt(0);e<32&&9!==e&&10!==e&&13!==e||e>=55296&&e<=57343||65534===e||65535===e||(t+=n)}return t})(e).replace(/&/g,"&").replace(//g,">").replace(/\\r/g," ")}function Fy(e){return Fb(e).replace(/"/g,""").replace(/\'/g,"'").replace(/\\t/g," ").replace(/\\n/g," ")}function Fw(e,t){return e?`${e}:${t}`:t}var FE=class extends Error{},FA=/&(?:#x([0-9a-fA-F]+)|#([0-9]+)|(lt|gt|amp|quot|apos));/g,Fv={lt:"<",gt:">",amp:"&",quot:\'"\',apos:"\'"},FS=/[ \\t\\r\\n]/,Fk=/[ \\t\\r\\n/>=<"\']/;function Fx(e){if(!e.includes("&"))return e;if(e.replace(FA,"").includes("&"))throw new FE;return e.replace(FA,(e,t,n,r)=>{if(r)return Fv[r];let i=t?parseInt(t,16):Number(n);if(i>1114111)throw new FE;return String.fromCodePoint(i)})}function FG(e){let t=e.indexOf(":");return t<0?{prefix:"",local:e}:{prefix:e.slice(0,t),local:e.slice(t+1)}}var FO=class{constructor(e){this.text=e,hJ(this,"at",0),hJ(this,"open",[]),hJ(this,"root",null)}read(){let{text:e}=this;for(;this.atthis.at&&this.addText(e.slice(this.at,n)),t<0)break;e.startsWith("\\x3c!--",t)?this.at=this.after("--\\x3e",t+4):e.startsWith("",t+2):e.startsWith("0||!this.root)throw new FE;return this.root}after(e,t){let n=this.text.indexOf(e,t);if(n<0)throw new FE;return n+e.length}skipSpace(e){let t=e;for(;t",e+9);if(t<0)throw new FE;this.addText(this.text.slice(e+9,t),!0),this.at=t+3}skipDeclaration(e){let t=0;for(let n=e+2;n"===e&&t<=0){this.at=n+1;return}}throw new FE}readStartTag(e){let t,{text:n}=this,r=this.readName(e+1),i=[],o=e+1+r.length,a=!1;for(;;){let e=this.skipSpace(o);if(n.startsWith("/>",e)){t=e,a=!0;break}if(">"===n[e]){t=e;break}if(e===o||e>=n.length)throw new FE;let r=this.readName(e),s=this.skipSpace(e+r.length);if("="!==n[s])throw new FE;let l=n[s=this.skipSpace(s+1)];if(\'"\'!==l&&"\'"!==l)throw new FE;let u=n.indexOf(l,s+1);if(u<0)throw new FE;let d=n.slice(s+1,u);if(d.includes("<"))throw new FE;i.push({qname:r,...FG(r),ns:null,value:Fx(d.replace(/[\\t\\r\\n]/g," ")),start:e,end:u+1,valueStart:s+1,valueEnd:u}),o=u+1}let s=this.open[this.open.length-1]??null;if(!s&&this.root)throw new FE;let l=new Map(s?.scope??[]);for(let e of i)"xmlns"===e.qname?l.set("",e.value):"xmlns"===e.prefix&&l.set(e.local,e.value);let u=e=>"xml"===e?"http://www.w3.org/XML/1998/namespace":l.get(e)||null;for(let e of i)e.ns="xmlns"===e.qname||"xmlns"===e.prefix?FD:e.prefix?u(e.prefix):null;let d=t+(a?2:1),{prefix:c,local:f}=FG(r),m={qname:r,prefix:c,local:f,ns:u(c),attributes:i,scope:l,parent:s,children:[],text:"",start:e,startTagClose:t,startTagEnd:d,selfClosing:a,endTagStart:d,end:d};s?s.children.push(m):this.root=m,a||this.open.push(m),this.at=d}readEndTag(e){let t=this.readName(e+2),n=this.skipSpace(e+2+t.length),r=this.open.pop();if(">"!==this.text[n]||!r||r.qname!==t)throw new FE;r.endTagStart=e,r.end=n+1,this.at=n+1}};function FI(e,t){return"http://www.w3.org/1999/02/22-rdf-syntax-ns#"===e.ns&&e.local===t}function FN(e,t){return e.ns===t.ns&&e.local===t.name}var FC=class{constructor(e,t){this.packet=e,this.rdf=t,hJ(this,"splices",[]),hJ(this,"additions",new Map)}removeElement(e){this.splices.push({start:this.spaceBefore(e.start),end:e.end,text:""})}removeAttribute(e){this.splices.push({start:this.spaceBefore(e.start),end:e.end,text:""})}replaceAttributeValue(e,t){this.splices.push({start:e.valueStart,end:e.valueEnd,text:Fy(t)})}replaceElement(e,t){let n=e.attributes.filter(e=>e.ns===FD).map(e=>` ${this.packet.slice(e.start,e.end)}`).join(""),r=Fj(e.scope,"http://www.w3.org/1999/02/22-rdf-syntax-ns#")??"rdf";this.splices.push({start:e.start,end:e.end,text:FM(e.qname,n,r,t)})}addProperty(e,t,n){let r=this.additionsFor(e),i=e?.scope??this.rdf.scope,o=Fj(i,t.ns,!1)??this.declare(r,i,t),a=Fj(i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#")??"rdf";r.children.push(FM(Fw(o,t.name),"",a,n))}result(){for(let[e,t]of this.additions)this.writeAdditions(e,t);let e=this.splices.map((e,t)=>({splice:e,index:t})).sort((e,t)=>e.splice.start-t.splice.start||e.splice.end-e.splice.start-(t.splice.end-t.splice.start)||e.index-t.index),t="",n=0;for(let{splice:r}of e){if(r.start` xmlns:${e}="${Fy(t)}"`).join("");if(!e){let e=this.rdf.prefix,r=Fw(e,"Description"),i=`<${r} ${Fw(e,"about")}=""${n}>${t.children.join("")}`;this.insertInto(this.rdf,i);return}n&&this.splices.push({start:e.startTagClose,end:e.startTagClose,text:n});let r=this.childIndent(e);this.insertInto(e,t.children.map(e=>r+e).join(""))}insertInto(e,t){if(e.selfClosing)return void this.splices.push({start:e.startTagClose,end:e.startTagEnd,text:`>${t}`});let n=e.children[e.children.length-1],r=n?n.end:e.startTagEnd;this.splices.push({start:r,end:r,text:t})}childIndent(e){let[t]=e.children,n=t?this.packet.slice(e.startTagEnd,t.start):this.packet.slice(e.startTagEnd,e.endTagStart);return/^\\s*$/.test(n)?t?n:n&&`${n} `:""}spaceBefore(e){let t=e;for(;t>0&&/\\s/.test(this.packet[t-1]);)t--;return t}};function Fj(e,t,n=!0){let r;for(let[i,o]of e)if(o===t){if(i)return i;n&&(r=i)}return r}function FM(e,t,n,r){let i,o=(e,t="")=>`<${Fw(n,"li")}${t}>${Fb(e)}`,a=(e,t)=>`<${Fw(n,e)}>${t}`;switch(r.kind){case"text":i=Fb(r.text);break;case"alt":i=a("Alt",o(r.text,\' xml:lang="x-default"\'));break;case"seq":i=a("Seq",r.items.map(e=>o(e)).join(""));break;case"bag":i=a("Bag",r.items.map(e=>o(e)).join(""))}return`<${e}${t}>${i}`}function FR(e,t,n,r){if(0===r.length)return;let i=function(e,t,n){let r=e.EPDFCatalog_GetMetadata(n,0n,0);if(r<=0)return null;let i=hY(t,r,i=>e.EPDFCatalog_GetMetadata(n,i,r)===r?t.readBytes(i,r):null),o=i&&function(e){let[t=1,n=1,r=1,i=1]=e;return 254===t&&255===n?"utf-16be":255===t&&254===n?0===r&&0===i?null:"utf-16le":0===t&&0===n?null:0===t?"utf-16be":0===n?0===r?null:"utf-16le":"utf-8"}(i);if(!i||!o)return null;try{return{text:new TextDecoder(o,{fatal:!0,ignoreBOM:!0}).decode(i),encoding:o}}catch{return null}}(e,t,n);if(!i)return;let o=function(e,t){let n=function(e){try{return new FO(e).read()}catch(e){if(e instanceof FE)return null;throw e}}(e),r=n&&[...function* e(t){for(let n of(yield t,t.children))yield*e(n)}(n)].find(e=>FI(e,"RDF"));if(!r)return null;let i=r.children.filter(e=>FI(e,"Description")),o=new FC(e,r);for(let{property:e,value:n,add:r}of t){let t=i.flatMap(t=>t.children.filter(t=>FN(t,e))),a=i.flatMap(t=>t.attributes.filter(t=>FN(t,e)).map(e=>({attribute:e,description:t})));if(null===n){t.forEach(e=>o.removeElement(e)),a.forEach(({attribute:e})=>o.removeAttribute(e));continue}let[s,...l]=t,[u,...d]=a;if(s)(l.length>0||a.length>0||!function(e,t){if(e.attributes.some(e=>"http://www.w3.org/1999/02/22-rdf-syntax-ns#"===e.ns))return!1;if("text"===t.kind)return 0===e.children.length&&e.text===t.text;let[n,...r]=e.children,i={alt:"Alt",seq:"Seq",bag:"Bag"}[t.kind];if(!n||r.length>0||!FI(n,i))return!1;let o=n.children;if(!o.every(e=>FI(e,"li")&&0===e.children.length))return!1;if("alt"===t.kind){let[e]=o,n=e?.attributes.find(e=>"http://www.w3.org/XML/1998/namespace"===e.ns&&"lang"===e.local);return 1===o.length&&n?.value==="x-default"&&e.text===t.text}return o.length===t.items.length&&o.every((e,n)=>e.text===t.items[n])}(s,n))&&(o.replaceElement(s,n),l.forEach(e=>o.removeElement(e)),a.forEach(({attribute:e})=>o.removeAttribute(e)));else if(u&&"text"===n.kind)(d.length>0||u.attribute.value!==n.text)&&(o.replaceAttributeValue(u.attribute,n.text),d.forEach(({attribute:e})=>o.removeAttribute(e)));else if(u)a.forEach(({attribute:e})=>o.removeAttribute(e)),o.addProperty(u.description,e,n);else if(r){let t=i.find(t=>(function(e,t){return e.attributes.some(e=>"http://www.w3.org/2000/xmlns/"===e.ns&&e.value===t)})(t,e.ns))??i[0];o.addProperty(t??null,e,n)}}return o.result()}(i.text,r);if(null!==o&&o!==i.text){let r;if(!hY(t,Math.max((r=function({text:e,encoding:t}){if("utf-8"===t)return new TextEncoder().encode(e);let n=new Uint8Array(2*e.length),r=new DataView(n.buffer);for(let n=0;n(t.writeBytes(i,r),e.EPDFCatalog_SetMetadata(n,i,r.length))))throw new N(G.Unknown,"failed to write the XMP metadata")}}var FT="http://purl.org/dc/elements/1.1/",FB="http://ns.adobe.com/xap/1.0/",FL="http://ns.adobe.com/pdf/1.3/",F$=(e,t,n)=>({ns:e,prefix:t,name:n}),Fz={title:{property:F$(FT,"dc","title"),kind:"alt"},author:{property:F$(FT,"dc","creator"),kind:"seq"},subject:{property:F$(FT,"dc","description"),kind:"alt"},keywords:{property:F$(FL,"pdf","Keywords"),kind:"text"},creator:{property:F$(FB,"xmp","CreatorTool"),kind:"text"},producer:{property:F$(FL,"pdf","Producer"),kind:"text"}},FU=F$(FB,"xmp","CreateDate"),FV=F$(FB,"xmp","ModifyDate"),FW=F$(FL,"pdf","Trapped"),Fq=F$(FT,"dc","subject"),FH={true:"True",false:"False",unknown:"Unknown"};function FK(e){if(null===e)return null;let t=hH(e);return{kind:"text",text:hq(t)??t}}var FZ=class{constructor(e,t){this.runtime=e,this.session=t}update(e,t){hW(t);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr();return!function(e,t,n,r){var i;let o=e=>{throw new N(G.Unknown,`failed to write metadata ${e}`)};for(let[i,a]of FP){let s=r[i];void 0!==s&&(Fg(e,t,n,a,s)||o(a))}void 0===r.createdAt||Fg(e,t,n,"CreationDate",null===r.createdAt?null:hH(r.createdAt))||o("CreationDate"),void 0===r.modifiedAt||Fg(e,t,n,"ModDate",null===r.modifiedAt?null:hH(r.modifiedAt))||o("ModDate"),void 0===r.trapped||(i=r.trapped,e.EPDF_SetMetaTrapped(n,"true"===i?1:"false"===i?2:3))||o("Trapped")}(n,r,i,e),FR(n,r,i,function(e){let t=[],n=(e,n,r=!0)=>t.push({property:e,value:n,add:r});for(let[t,{property:r,kind:i}]of Object.entries(Fz)){let o=e[t];void 0!==o&&n(r,null===o?null:"seq"===i?{kind:i,items:[o]}:{kind:i,text:o})}if(void 0!==e.keywords){let t=null===e.keywords?null:e.keywords.split(/[,;]/).map(e=>e.trim()).filter(e=>""!==e);n(Fq,t&&{kind:"bag",items:t},!1)}return void 0!==e.createdAt&&n(FU,FK(e.createdAt)),void 0!==e.modifiedAt&&n(FV,FK(e.modifiedAt)),void 0!==e.trapped&&n(FW,{kind:"text",text:FH[e.trapped]}),t}(e)),hW(t),{metadata:new FF(this.runtime,this.session).read(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}updateCustom(e,t){hW(t);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=Object.entries(e);for(let[e]of o){let t=function(e){if(F_.has(e))return`\'${e}\' is a standard key; set it with metadata.update`;if(!e||e.length>127||"/"===e[0])return`\'${e}\' can\'t be a custom key: 1 to 127 characters, no leading slash`;for(let t=0;t126)return`\'${e}\' can\'t be a custom key: printable ASCII only`}return null}(e);if(t)throw new N(G.InvalidArg,t,{details:{field:e}})}for(let[e,t]of o)if(!Fg(n,r,i,e,t))throw new N(G.Unknown,`failed to write metadata ${e}`);return FR(n,r,i,Object.entries(e).filter(([e])=>/^[A-Za-z_][A-Za-z0-9._-]*$/.test(e)).map(([e,t])=>({property:F$("http://ns.adobe.com/pdfx/1.3/","pdfx",e),value:null===t?null:{kind:"text",text:t},add:!1}))),hW(t),{custom:new FF(this.runtime,this.session).readCustom(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}},FJ={bytes:124,offsets:{looseBox:0,tightBox:16,looseQuad:32,tightQuad:64,matrix:96,flags:120},flags:{hasTightBox:1,hasLooseQuad:2,hasTightQuad:4,upright:8,space:16,empty:32,synthesized:64}},FQ={bytes:132,offsets:{geometry:0,objectRun:124,fontSize:128}};function FX(e,t,n=0){return{left:F0(e,t,n),top:F0(e,t,n+4),right:F0(e,t,n+8),bottom:F0(e,t,n+12)}}function FY(e,t,n){e.poke(t,"f32",n.left,0),e.poke(t,"f32",n.top,4),e.poke(t,"f32",n.right,8),e.poke(t,"f32",n.bottom,12)}function F0(e,t,n=0){return Number(e.peek(t,"f32",n))}function F1(e,t,n=0){return Number(e.peek(t,"i32",n))}var F3={fit:2,fitH:3,fitV:4,fitR:5,fitB:6,fitBH:7,fitBV:8};function F2(e,t,n,r){let i=e.EPDFDest_GetPageObjectNumber(n,r);if(0===i)return null;let o=q(i),a=h0(t,[8,16],([n,i])=>{let o=e.FPDFDest_GetView(r,n,i),a=Math.min(F1(t,n),4),s=[];for(let e=0;eethis.limits.maxModels||this.nodes>this.limits.maxNodes||this.scriptCodeUnits>this.limits.maxScriptCodeUnits||this.targetEntries>this.limits.maxTargetEntries||this.payloadCodeUnits>this.limits.maxPayloadCodeUnits)throw new N(G.MalformedPdf,"aggregate PDF action read budget exceeded",{details:{models:this.models,nodes:this.nodes,scriptCodeUnits:this.scriptCodeUnits,targetEntries:this.targetEntries,payloadCodeUnits:this.payloadCodeUnits,limits:this.limits}})}};function F8(e,t,n,r,i){if(0n===r)return null;try{var o,a,s,l;let u,d=e.EPDFAction_GetNodeCount(r);if(!Number.isInteger(d)||d<0)throw F9("invalid node count",{nodeCount:d});i.addModel(d);let c=e.EPDFAction_GetWarningFlags(r)>>>0,f=!e.EPDFAction_IsComplete(r),m=(o=e.EPDFAction_GetRootNode(r),a=d,-1===o||0xffffffff===o||o>>>0==0xffffffff?null:F7(o,a)),p=new Set,h=!1,F=e=>{let n=e(0n,0);return n<=0?null:(i.reservePayloadBytes(n),h2(t,e))},g=e=>h0(t,[4],([n])=>e(n)?0!==F1(t,n):null),_=(n,i)=>h0(t,[4],([o])=>{if(!e.EPDFAction_GetNodeTargetObjectNumber(r,n,i,o))return null;let a=F1(t,o)>>>0;return 0===a?null:a}),P=(t,n)=>{let i=[];for(let o=0;oe.EPDFAction_GetNodeTargetName(r,t,o,n,i));if(null!==n){i.push({kind:"name",name:n});continue}let a=_(t,o);if(null===a)return null;i.push({kind:"objectNumber",objectNumber:a})}return i},D=o=>{if(p.has(o))throw F9("native action model contains a cycle",{nodeId:o});p.add(o);try{let a=F5[e.EPDFAction_GetNodeType(r,o)]??"unknown",s=h2(t,(t,n)=>e.EPDFAction_GetNodeSubtype(r,o,t,n))??"",l=e.EPDFAction_GetNextCount(r,o);if(!Number.isInteger(l)||l<0)throw F9("invalid action child count",{nodeId:o,nextCount:l});let u=[];for(let t=0;t(h=!0,{type:"unknown",subtype:s,next:u});switch(a){case"javascript":{if(!e.EPDFAction_NodeHasJavaScript(r,o))return c();let n=h3(t,(t,n)=>e.EPDFAction_GetNodeJavaScript(r,o,t,n))??"";return i.addScript(n),{type:a,subtype:s,script:n,next:u}}case"rendition":{if(!e.EPDFAction_NodeHasJavaScript(r,o))return{type:a,subtype:s,next:u};let n=h3(t,(t,n)=>e.EPDFAction_GetNodeJavaScript(r,o,t,n))??"";return i.addScript(n),{type:a,subtype:s,script:n,next:u}}case"goto":{let i=e.EPDFAction_GetNodeDest(n,r,o),l=0n!==i?F2(e,t,n,i):null;return l?{type:a,subtype:s,destination:l,next:u}:c()}case"uri":{let t=F((t,i)=>e.EPDFAction_GetNodeURI(n,r,o,t,i));if(null===t)return c();return{type:a,subtype:s,uri:t,isMap:g(t=>e.EPDFAction_GetNodeURIIsMap(r,o,t))??!1,next:u}}case"named":{let t=F((t,n)=>e.EPDFAction_GetNodeName(r,o,t,n));return null===t?c():{type:a,subtype:s,name:t,next:u}}case"hide":{let t=e.EPDFAction_GetNodeTargetCount(r,o);if(!Number.isInteger(t)||t<0)return c();i.reserveTargets(t);let n=P(o,t);if(null===n)return c();return{type:a,subtype:s,targets:n,hide:g(t=>e.EPDFAction_GetNodeHideFlag(r,o,t))??!0,next:u}}case"reset-form":{let n=h0(t,[4,4],([n,i])=>e.EPDFAction_GetNodeResetForm(r,o,n,i)?{hasFields:0!==F1(t,n),exclude:0!==F1(t,i)}:null),l=e.EPDFAction_GetNodeTargetCount(r,o);if(null===n||!Number.isInteger(l)||l<0)return c();i.reserveTargets(l);let d=n.hasFields?P(o,l):null;if(n.hasFields&&null===d)return c();return{type:a,subtype:s,fields:d,exclude:n.exclude,next:u}}case"submit-form":{if("function"!=typeof e.EPDFAction_GetNodeSubmitForm)return{type:a,subtype:s,next:u};let n=h0(t,[4,4],([n,i])=>e.EPDFAction_GetNodeSubmitForm(r,o,n,i)?{hasFields:0!==F1(t,n),flags:F1(t,i)>>>0}:null);if(null===n)return c();let l=F((t,n)=>e.EPDFAction_GetNodeSubmitFormURL(r,o,t,n));if(null===l)return c();let d=e.EPDFAction_GetNodeTargetCount(r,o);if(!Number.isInteger(d)||d<0)return c();i.reserveTargets(d);let f=n.hasFields?P(o,d):null;if(n.hasFields&&null===f)return c();let m=F((t,n)=>e.EPDFAction_GetNodeSubmitFormCharSet(r,o,t,n));return{type:a,subtype:s,payload:{url:l,fields:f,...j(n.flags),...null===m?{}:{charSet:m}},next:u}}case"goto-remote":case"goto-embedded":case"launch":{let t=F((t,n)=>e.EPDFAction_GetNodeFilePath(r,o,t,n));return null===t?c():{type:a,subtype:s,filePath:t,next:u}}default:return{type:a,subtype:s,next:u}}}finally{p.delete(o)}},b=null===m?null:D(m),y=(s=c,l=f,u=[],(1&s)!=0&&u.push("cycle-dropped"),(2&s)!=0&&u.push("malformed-next"),((4&s)!=0||l)&&u.push("incomplete"),u);return h&&y.push("payload-dropped"),{root:b,incomplete:f,warnings:y}}finally{e.EPDFAction_CloseModel(r)}}function F7(e,t){if(!Number.isInteger(e)||e<0||e>=t)throw F9("native action model returned an invalid node id",{raw:e,nodeCount:t});return e}function F9(e,t){return new N(G.MalformedPdf,e,{details:t})}var ge={x:0,y:1,distance:2,area:3,angle:4,slope:5},gt=["decimal","fraction","round","truncate"],gn=["thousands","decimal","prefixSpacing","suffixSpacing"];function gr(e){if(!e)throw new N(G.Unknown,"Measurement native write failed after preflight")}function gi(e,t,n="f32"){return hY(e,4,r=>t(r)?Number(e.peek(r,n)):void 0)}function go(e,t,n){return t?hY(e,8,r=>(e.poke(r,"f32",t.x),e.poke(r,"f32",t.y,4),n(r))):n(0n)}function ga(e,t,n){if(!n)return;let r=e.EPDFMeasure_GetSubtype(n);if(1!==r)return{subtype:2===r?"geospatial":"unknown"};let i=r=>Array.from({length:e.EPDFMeasure_CountFormats(n,r)},(i,o)=>{let a=e.EPDFMeasure_GetFormat(n,r,o),s={unit:h3(t,(t,n)=>e.EPDFNumberFormat_GetUnit(a,t,n))??""},l=gi(t,t=>e.EPDFNumberFormat_GetConversion(a,t));void 0!==l&&(s.conversion=l);let u=gi(t,t=>e.EPDFNumberFormat_GetFraction(a,t),"i32");void 0!==u&>[u]&&(s.fraction=gt[u]);let d=gi(t,t=>e.EPDFNumberFormat_GetPrecision(a,t),"i32");void 0!==d&&(s.precision=d);let c=gi(t,t=>e.EPDFNumberFormat_GetFixedDenominator(a,t),"i32");void 0!==c&&(s.fixed=!!c);let f=gi(t,t=>e.EPDFNumberFormat_GetLabelPosition(a,t),"i32");for(let[n,r]of(void 0!==f&&(s.labelPosition=1===f?"prefix":"suffix"),gn.entries())){let i=h3(t,(t,r)=>e.EPDFNumberFormat_GetText(a,n,t,r));null!==i&&(s[r]=i)}return s}),o=h3(t,(t,r)=>e.EPDFMeasure_GetRatio(n,t,r)),a=hY(t,8,r=>e.EPDFMeasure_GetOrigin(n,r)?{x:Number(t.peek(r,"f32")),y:Number(t.peek(r,"f32",4))}:void 0),s=gi(t,t=>e.EPDFMeasure_GetCYX(n,t)),l={subtype:"rectilinear",x:i(0),distance:i(2),area:i(3),...null!==o?{ratio:o}:{},...a?{origin:a}:{},...void 0!==s?{cyx:s}:{}};for(let e of["y","angle","slope"]){let t=i(ge[e]);t.length&&(l[e]=t)}return l}function gs(e,t,n,r){for(let[i,o]of(gr(n),void 0!==r.ratio&&gr(h6(t,r.ratio,t=>e.EPDFMeasure_SetRatio(n,t))),r.origin&&gr(go(t,r.origin,t=>e.EPDFMeasure_SetOrigin(n,t))),void 0!==r.cyx&&hY(t,4,i=>{t.poke(i,"f32",r.cyx),gr(e.EPDFMeasure_SetCYX(n,i))}),Object.entries(ge)))for(let a of r[i]??[]){let r,i=t.writeU16String(a.unit);try{r=e.EPDFMeasure_AddFormat(n,o,i,a.conversion)}finally{t.free(i)}for(let[n,i]of(gr(r),void 0!==a.fraction&&gr(e.EPDFNumberFormat_SetFraction(r,gt.indexOf(a.fraction))),void 0!==a.precision&&gr(e.EPDFNumberFormat_SetPrecision(r,a.precision)),void 0!==a.fixed&&gr(e.EPDFNumberFormat_SetFixedDenominator(r,a.fixed)),void 0!==a.labelPosition&&gr(e.EPDFNumberFormat_SetLabelPosition(r,+("prefix"===a.labelPosition))),gn.entries()))void 0!==a[i]&&gr(h6(t,a[i],t=>e.EPDFNumberFormat_SetText(r,n,t)))}}function gl(e,t,n,r){let i=[],o=e.EPDFPage_CountViewportsRaw(n,r);for(let a=0;ae.EPDFViewport_GetBBox(o,n)?eH(FX(t,n)):void 0);if(!n)continue;let r=h3(t,(t,n)=>e.EPDFViewport_GetName(o,t,n)),a=ga(e,t,e.EPDFViewport_GetMeasure(o));i.push({bbox:n,owned:r===nb&&(!a||"rectilinear"===a.subtype),name:r,measure:a??null})}finally{e.EPDFViewport_Close(o)}}return i}function gu(e){return"wasm"===e.kind?4:8}function gd(e,t,n,r){"wasm"===e.kind?e.mem.poke(t,"i32",Number(r),n):e.mem.poke(t,"i64",BigInt(r),n)}function gc(e,t,n){let r=gu(e);return hY(e.mem,Math.max(1,t.length*r),i=>(t.forEach((t,n)=>gd(e,i,n*r,t)),n(i,t.length)))}function gf(e,t,n){let{mem:r}=e,i=t.map(e=>r.writeU16String(e));try{return gc(e,i,n)}finally{for(let e=i.length-1;e>=0;e--)r.free(i[e])}}var gm=[null,"decimal","upperRoman","lowerRoman","upperLetters","lowerLetters"];function gp(e,t){let{fn:n,mem:r}=e,i=n.EPDFDoc_GetPageLabelSectionCount(t),o=[];return h0(r,[4,4,4],([e,a,s])=>{for(let l=0;ln.EPDFDoc_GetPageLabelSectionAt(t,l,r,i,e,a,s));o.push({firstPage:F1(r,e),style:gm[F1(r,a)]??null,firstNumber:F1(r,s),prefix:i??""})}}),o}var gh=class{constructor(e,t){this.runtime=e,this.session=t}read(e){hW(e);let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr(),i=this.session.allRecords(),o=new F4,a=gp(this.runtime,r);return h0(n,[16,4,4],([s,l,u])=>{var d,c,f;let m,p=i.map(i=>{var d,c,f,m,p,h,F,g,_,P;let D,b,y,w;hW(e);let E=i.pageIndex,A=(c=t,f=n,m=r,p=i.pageObjectNumber,h=o,D={},b=F8(c,f,m,c.EPDFDoc_GetPageActionModel(m,p,0),h),y=F8(c,f,m,c.EPDFDoc_GetPageActionModel(m,p,1),h),b&&(D.open=b),y&&(D.close=y),b||y?D:void 0),v=gl(t,n,r,E),S=gg(t,n,r,E,s);return{index:E,ref:q(i.pageObjectNumber),label:function(e,t){let n;for(let r of e){if(r.firstPage>t)break;n=r}if(!n)return null;let r=n.prefix+function(e,t){switch(e){case null:return"";case"decimal":return String(t);case"upperRoman":return r2(t).toUpperCase();case"lowerRoman":return r2(t);case"upperLetters":return r6(t).toUpperCase();case"lowerLetters":return r6(t)}}(n.style,n.firstNumber+t-n.firstPage);return""===r?null:r}(a,E),size:{width:(d=S.crop).right-d.left,height:d.top-d.bottom},rotation:gP(t,n,r,E,u),userUnit:function(e,t,n,r,i){if(!e.EPDF_GetPageUserUnitByIndex(n,r,i))return 1;let o=F0(t,i,0);return Number.isFinite(o)&&o>0?o:1}(t,n,r,E,l),tabOrder:(F=t,g=n,_=r,P=E,(w=h2(g,(e,t)=>F.EPDF_GetPageTabOrderByIndex(_,P,e,t)))?gD[w]??null:null),boxes:S,pdfCropBox:S.crop,...A?{actions:A}:{},...v.length?{viewports:v}:{}}});return{pageCount:p.length,pages:p,labels:a,namedPages:(d=t,c=n,f=r,m=[],h0(c,[4,4],([e,t])=>{for(let n of gb){let r=d.EPDFDoc_GetNamedPageCount(f,n);for(let i=0;id.EPDFDoc_GetNamedPageAt(f,n,i,r,o,e,t),"");if(null===r)continue;let o=Number(c.peek(e,"i32"))>>>0,a=Number(c.peek(t,"i32"));m.push({name:r,target:0===a?{kind:"page",page:q(o)}:1===a?{kind:"template",objectNumber:o}:{kind:"dangling"}})}}}),m)}})}};function gF(e,t){let n=new Map,r=null;return i=>{let o=n.get(i.objectNumber);if(o)return o;r??(r=new Map(t.allRecords().map(e=>[e.pageObjectNumber,e.pageIndex])));let a=r.get(i.objectNumber);if(void 0===a)throw new N(G.NotFound,`no page with object number ${i.objectNumber}`);let{fn:s,mem:l}=e,u=t.requireDocPtr(),d=hY(l,16,e=>gg(s,l,u,a,e).crop);return n.set(i.objectNumber,d),d}}function gg(e,t,n,r,i){var o;let a,s,l,u=o=>(function(e,t,n,r,i,o){if(e.EPDF_GetPageBoxByIndex(n,r,i,o))return eH(FX(t,o))})(e,t,n,r,o,i);return a=(o={media:u(0),crop:u(1),bleed:u(2),trim:u(3),art:u(4)}).media??iJ,l=(s=e=>{let t,n,r,i;return t=Math.max(e.left,a.left),n=Math.min(e.right,a.right),r=Math.max(e.bottom,a.bottom),i=Math.min(e.top,a.top),(tgP(e.fn,e.mem,t,n,r))}function gP(e,t,n,r,i){var o;return e.EPDF_GetPageRotateByIndex(n,r,i)?Number.isInteger(o=F1(t,i))&&o%90==0?(o%360+360)%360:0:0}var gD={R:"rows",C:"columns",S:"structure",A:"annotations",W:"widgets"},gb=[0,1];function gy(e,t,n){if("start"===t)return 0;if("end"===t)return n;let{pageIndex:r}=e.resolvePageRef(n_(t));return"before"in t?r:r+1}var gw=class{constructor(e,t){this.runtime=e,this.session=t}reorder(e,t,n){let r,i=this.session.resolvePageRefs(e);hW(n),this.requireUniquePageObjectNumbers("pages.reorder",i);let o=n_(t);if(o&&i.includes(o.objectNumber))throw new N(G.InvalidArg,`pages.reorder: the neighbour page ${o.objectNumber} is one of the pages that move`,{details:{field:"position"}});let{fn:a,mem:s}=this.runtime,l=this.session.requireDocPtr(),u=i.map(e=>(hW(n),this.session.recordByObjectNumber(e).pageIndex)),d=gy(this.session,t,a.FPDF_GetPageCount(l)),c=d-u.filter(e=>e=o)throw new N(G.InvalidArg,`pages.delete would remove every page (${n.length} of ${o}); a document must keep at least one`);let a=this.session.pagePool();for(let e of n)if(this.session.recordByObjectNumber(e),a.isHeld(e))throw new N(G.Unknown,`internal invariant violation: pagePtr for page ${e} is still held during pages.delete`);for(let e of n)if(!r.EPDFDoc_DeletePageByObjectNumber(i,e))throw new N(G.Unknown,`EPDFDoc_DeletePageByObjectNumber rejected page ${e} after validation`);return this.session.refreshPageRegistry(),{layout:new gh(this.runtime,this.session).read(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}setName(e,t){if(hW(t),0===e.name.length)throw new N(G.InvalidArg,"pages.setName requires a non-empty name");let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=this.session.resolvePageRef(e.page).pageObjectNumber;if(void 0!==e.replace&&e.replace!==e.name&&e.replace.length>0&&h6(r,e.replace,e=>n.EPDFDoc_RemoveNamedPage(i,e)),!h6(r,e.name,e=>n.EPDFDoc_SetNamedPage(i,e,o)))throw new N(G.Unknown,`EPDFDoc_SetNamedPage rejected \'${e.name}\' for page ${o}`);return{layout:new gh(this.runtime,this.session).read(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}removeName(e,t){if(hW(t),0===e.name.length)throw new N(G.InvalidArg,"pages.removeName requires a non-empty name");let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr();if(!h6(r,e.name,e=>n.EPDFDoc_RemoveNamedPage(i,e)))throw new N(G.NotFound,`pages.removeName: no /Names /Pages registration \'${e.name}\'`);return{layout:new gh(this.runtime,this.session).read(t),meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}requireUniquePageObjectNumbers(e,t){if(0===t.length)throw new N(G.InvalidArg,`${e} requires at least one page`);let n=new Set;for(let r of t){if(n.has(r))throw new N(G.InvalidArg,`${e} was given duplicate page object number ${r}`);n.add(r)}}},gE=class{constructor(e,t){this.runtime=e,this.session=t}extract(e,t,n){let r;if(hW(n),0===e.length)throw new N(G.InvalidArg,"pages.extract requires at least one page");let i=this.session.resolvePageRefs(e),o=new Set;for(let e of i){if(o.has(e))throw new N(G.InvalidArg,`pages.extract was given duplicate page object number ${e}`);o.add(e)}let a=i.map(e=>this.session.recordByObjectNumber(e).pageIndex),{fn:s,mem:l}=this.runtime,u=this.session.requireDocPtr(),d=l.alloc(4*a.length);for(let e=0;e(n.EPDFDoc_GetImportFieldRoots(t,0n,0,e,i),Array.from({length:i},(t,n)=>Number(r.peek(e,"i32",4*n)))))}(e,n);if(0===o.length)return;let a=o.map(e=>h3(i,(t,i)=>r.EPDFForm_GetFieldPartialName(n,e,t,i))??""),s=function(e,t){let{fn:n,mem:r}=e,i=gv(e,t),o=new Set;for(let e=0;en.EPDFForm_GetFieldName(i,e,t,r));t&&o.add(t.split(".")[0])}return o}(e,t),l=new Set([...s,...a]);o.forEach((e,t)=>{let o=a[t];if(!s.has(o))return;let u=o;for(let e=2;l.has(u);e++)u=`${o}_${e}`;if(l.add(u),!h5(i,u,t=>r.EPDFForm_SetFieldName(n,e,t)))throw new N(G.Unknown,`pages.insert could not rename the inserted field "${o}" to "${u}"`)})}function gx(e,t,n){let{pageIndex:r}=t.resolvePageRef(q(n)),i=e.fn.EPDFPage_PromoteInlineAnnotsRaw(t.requireDocPtr(),r);if(i<0)throw new N(G.Unknown,`the inline annotations of page ${n} could not be promoted`);return 0!==i&&(t.pagePool().closeIdle(),!0)}var gG=class{constructor(e,t){this.runtime=e,this.session=t}insert(e,t,n,r){if(hW(n),0===e.byteLength)throw new N(G.InvalidArg,"pages.insert requires non-empty bytes");let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s=gy(this.session,t,i.FPDF_GetPageCount(a)),l=o.alloc(e.byteLength),u=null;try{if(o.writeBytes(l,new Uint8Array(e)),!(u=i.FPDF_LoadMemDocument(l,e.byteLength,"")))throw hX(i,null,new N(G.MalformedPdf,"pages.insert source PDF could not be opened"));let t=i.FPDF_GetPageCount(u);if(t<=0)throw new N(G.InvalidArg,"pages.insert source PDF has no pages");gk(this.runtime,this.session,u);let a=this.importInto(u,s,t,r,"pages.insert",n),d=u;return this.session.retainUntilClose(()=>{i.FPDF_CloseDocument(d),o.free(l)}),a}catch(e){throw u&&i.FPDF_CloseDocument(u),o.free(l),e}}copy(e,t,n,r){if(hW(n),0===e.length)throw new N(G.InvalidArg,"pages.copy requires at least one page");let i=this.session.resolvePageRefs([...e]).map(e=>this.session.recordByObjectNumber(e).pageIndex),{fn:o}=this.runtime,a=this.session.requireDocPtr(),s=gy(this.session,t,o.FPDF_GetPageCount(a)),l=o.FPDF_CreateNewDocument();if(!l)throw new N(G.Unknown,"FPDF_CreateNewDocument failed");try{if(!h1(this.runtime.mem,i,(e,t)=>o.EPDFDoc_ImportPages(l,a,e,t,0,0n)))throw new N(G.Unknown,`EPDFDoc_ImportPages rejected copying pages [${i.join(",")}] out`);gk(this.runtime,this.session,l);let e=this.importInto(l,s,i.length,r,"pages.copy",n);return this.session.retainUntilClose(()=>o.FPDF_CloseDocument(l)),e}catch(e){throw o.FPDF_CloseDocument(l),e}}importInto(e,t,n,r,i,o){let{fn:a,mem:s}=this.runtime,l=this.session.requireDocPtr();if(r&&r.length!==n)throw new N(G.InvalidArg,`${i} needs one object number per page: ${r.length} for ${n}`,{details:{field:"objectNumbers"}});for(let e of r??[])this.session.claimObjectNumber(e);if(!(r?h1(s,r,n=>a.EPDFDoc_ImportPages(l,e,0n,0,t,n)):a.EPDFDoc_ImportPages(l,e,0n,0,t,0n)))throw new N(G.Unknown,`EPDFDoc_ImportPages rejected the ${i} at index ${t}`);this.session.refreshPageRegistry();let u=new gh(this.runtime,this.session).read(o),d=u.pages.slice(t,t+n).map(e=>e.ref);for(let e of d)gx(this.runtime,this.session,e.objectNumber);return{insertedPages:d,layout:u,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}insertBlank(e,t,n,r){hW(n);let{size:i}=e,o=e.count??1;if(!Number.isFinite(i?.width)||!Number.isFinite(i?.height)||i.width<=0||i.height<=0)throw new N(G.InvalidArg,`pages.insertBlank size must have positive finite dimensions, got ${i?.width}x${i?.height}`);if(!Number.isInteger(o)||o<1||o>100)throw new N(G.InvalidArg,`pages.insertBlank count ${o} out of range [1, 100]`);let{fn:a}=this.runtime,s=this.session.requireDocPtr(),l=gy(this.session,t,a.FPDF_GetPageCount(s));if(r&&r.length!==o)throw new N(G.InvalidArg,`pages.insertBlank needs one object number per page: ${r.length} for ${o}`,{details:{field:"objectNumbers"}});for(let e of r??[])this.session.claimObjectNumber(e);for(let e=0;ee.ref),layout:u,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}},gO=class{constructor(e,t){this.runtime=e,this.session=t}flatten(e,t,n){hW(n);let r=this.session.resolvePageRefs(e);var i=r;if(0===i.length)throw new N(G.InvalidArg,"pages.flatten requires at least one page");let o=new Set;for(let e of i){if(o.has(e))throw new N(G.InvalidArg,`pages.flatten was given duplicate page object number ${e}`);o.add(e)}let a=[],s=new Set;for(let e of r){let r;hW(n),gx(this.runtime,this.session,e)&&s.add(e);let i=this.session.pagePool(),o=i.acquire(e);try{r=this.runtime.fn.EPDFPage_Flatten(o,+("print"===t))}finally{i.release(e)}if(2===r){a.push({page:q(e),status:"unchanged"});continue}if(1!==r)throw new N(G.Unknown,0===r?"native page flatten failed after preflight":`native page flatten returned unexpected code ${r}`);s.add(e),a.push({page:q(e),status:"applied"})}return 0===s.size?{pages:e,usage:t,results:a,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}:(this.session.invalidateDerived(),{pages:e,usage:t,results:a,meta:{affectedPages:[...s].map(e=>q(e)),cacheDelta:null,...this.session.writeStamp()}})}};function gI(e,t,n,r,i,o){let a=e.EPDFAnnot_GetObjectNumber(i);return a<=0?{kind:"baseIndex",page:r,baseIndex:o}:gN(e,t,n,r,a)}function gN(e,t,n,r,i){var o,a,s,l;let u=(o=e,a=t,s=n,l=i,h0(a,[8,8],([e,t])=>(Ft(a,e,0),Ft(a,t,0),o.EPDFLayer_GetBirthName(s,l,e,t))?Fn(a,t):null));return null===u?{kind:"objectNumber",page:r,objectNumber:i}:{kind:"baseIndex",page:r,baseIndex:u}}function gC(e,t,n){let{fn:r}=e,i=t.requireDocPtr(),{pageIndex:o}=t.resolvePageRef(n.page),a=n.page.objectNumber;switch(n.kind){case"objectNumber":{let e=r.EPDFPage_GetAnnotIndexByObjectNumberRaw(i,o,n.objectNumber);if(e<0)throw new N(G.NotFound,`no annotation with object number ${n.objectNumber} on page ${a}`);return{pageIndex:o,index:e}}case"baseIndex":{let t=function(e,t,n,r,i){let{fn:o}=e;if(o.EPDFLayer_IsPagePromoted(t,n)){let e=o.EPDFLayer_GetBirthObjectNumber(t,n,i);return e<=0?-1:o.EPDFPage_GetAnnotIndexByObjectNumberRaw(t,r,e)}if(i<0||i>=o.EPDFPage_GetAnnotCountRaw(t,r))return -1;let a=o.EPDFPage_GetAnnotRaw(t,r,i);if(!a)return -1;try{return o.EPDFAnnot_GetObjectNumber(a)>0?-1:i}finally{o.FPDFPage_CloseAnnot(a)}}(e,i,a,o,n.baseIndex);if(t<0)throw new N(G.NotFound,`no annotation born at position ${n.baseIndex} of page ${a}`);return{pageIndex:o,index:t}}}}function gj(e,t,n){let{pageIndex:r,index:i}=gC(e,t,n);return gM(e,t,r,i)}function gM(e,t,n,r){let i=e.fn.EPDFPage_GetAnnotRaw(t.requireDocPtr(),n,r);if(!i)throw new N(G.Unknown,`annotation ${r} of page index ${n} could not be opened`);return i}function gR(e,t,n){let{pageIndex:r,index:i}=gC(e,t,n),o=gM(e,t,r,i),{fn:a,mem:s}=e;return{annotPtr:o,name:gI(a,s,t.requireDocPtr(),n.page,o,i)}}function gT(e,t,n,r){let{index:i}=gC(e,t,r),o=e.fn.FPDFPage_GetAnnot(n,i);if(!o)throw new N(G.Unknown,`annotation ${i} of page ${r.page.objectNumber} could not be opened`);return o}var gB=class{constructor(e,t){this.runtime=e,this.session=t}apply(e,t){hW(t);let n=this.buildPlan(e);for(let e of n.keys())this.session.recordByObjectNumber(e);this.preflight(n,t);let{fn:r}=this.runtime,i=[],o=new Set,a=0;for(let[e,s]of n){hW(t),gx(this.runtime,this.session,e)&&o.add(e);let n=this.session.pagePool(),l=n.acquire(e);try{let t=null===s?this.applyAllOnPage(l):this.applyRefsOnPage(l,s);"applied"===t.status&&(r.FPDFPage_GenerateContent(l),o.add(e),a+=t.removed),i.push({page:q(e),status:t.status,removedAnnotationCount:t.removed})}finally{n.release(e)}}return 0===o.size?{scope:e,results:i,removedAnnotationCount:a,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}:(this.session.invalidateDerived(),{scope:e,results:i,removedAnnotationCount:a,meta:{affectedPages:[...o].map(e=>q(e)),cacheDelta:null,...this.session.writeStamp()}})}buildPlan(e){let t=new Map;if("pages"in e){if(0===this.session.resolvePageRefs(e.pages).length)throw new N(G.InvalidArg,"redaction.apply requires at least one page");for(let n of this.session.resolvePageRefs(e.pages)){if(t.has(n))throw new N(G.InvalidArg,`redaction.apply was given duplicate page object number ${n}`);t.set(n,null)}return t}if(0===e.annotations.length)throw new N(G.InvalidArg,"redaction.apply requires at least one annotation ref");for(let n of e.annotations){let e=t.get(n.page.objectNumber);if(null===e)throw new N(G.InvalidArg,"mixed redaction scopes on one page");e?e.push(n):t.set(n.page.objectNumber,[n])}return t}preflight(e,t){let{fn:n}=this.runtime;for(let[r,i]of e){if(null===i)continue;hW(t);let e=this.session.pagePool(),o=e.acquire(r);try{for(let e of i){let t=gT(this.runtime,this.session,o,e);try{let e=rN(n.FPDFAnnot_GetSubtype(t));if("redact"!==e)throw new N(G.InvalidArg,`redaction.apply ref on page ${r} resolves to a \'${e}\' annotation, not a redact annotation`)}finally{n.FPDFPage_CloseAnnot(t)}}}finally{e.release(r)}}}applyAllOnPage(e){let{fn:t,mem:n}=this.runtime,r=this.pageHasRedactAnnotations(e);return hY(n,4,i=>{if(!t.EPDFPage_ApplyRedactions(e,0n,0,i)){if(r)throw new N(G.Unknown,"native page redaction apply failed");return{status:"unchanged",removed:0}}return{status:"applied",removed:F1(n,i)>>>0}})}pageHasRedactAnnotations(e){let{fn:t}=this.runtime,n=t.FPDFPage_GetAnnotCount(e);for(let r=0;rhY(r,4,a=>{let s=n.EPDFPage_ApplyRedactions(e,t,i,a);return s&&(o=F1(r,a)>>>0),s})))throw new N(G.Unknown,"native redaction apply failed after preflight")}finally{for(let e of i)n.FPDFPage_CloseAnnot(e)}return{status:"applied",removed:o}}},gL=class{constructor(e,t){this.runtime=e,this.session=t}async read(e,t,n){hW(t);let{fn:r}=this.runtime,i=this.session.pagePool(),o=await i.acquireInSlices(e,t,n);try{hW(t);let n=r.FPDFText_LoadPage(o);if(!n)throw new N(G.RuntimeUnavailable,`FPDFText_LoadPage returned null for page object ${e}`);try{hW(t);let i=Math.max(r.FPDFText_CountChars(n),0),o=function(e,t,n){if(n<=0)return"";let{fn:r,mem:i}=e,o=2*n+1;return hY(i,2*o,e=>{let n=r.EPDFText_GetTextFull(t,e,o);return n<=1?"":function(e){let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength>>1),n="";for(let e=0;e{r.EPDFText_GetCharToTextMap(t,e,o);let n=i.readBytes(e,8*o),a=new Int32Array(n.buffer,n.byteOffset,2*o),s=Array(o);for(let e=0;ee)return`anchor ${t} char ${o} outside [1, ${e}]`;let s=a-(i+(o-r-1));if(0!==s&&2!==s)return`anchor ${t} implies a character contributing ${s} text units (expected 0 or 2)`;r=o,i=a}let o=i+(e-r);return o!==t?`map projects charCount to ${o}, but text length is ${t}`:null}(i,o.length,a);if(null!==s)throw new N(G.RuntimeUnavailable,`char map invariant violated for page object ${e}: ${s}`);return function(e){let{text:t,charCount:n}=e;if(!ng.test(t))return e;let r=e.charMap??[],i=[],o=[],a=0,s=0,l=0;for(let e=0;e=64976&&n<=65007||(65534&n)==65534)?"":e}(t.slice(s,n),t[n]);i.push(u),l+=u.length,1!==u.length&&o.push([e+1,l]),s=n}let u=i.join("");return o.length>0?{text:u,charCount:n,charMap:o}:{text:u,charCount:n}}(a.length>0?{text:o,charCount:i,charMap:a}:{text:o,charCount:i})}finally{r.FPDFText_ClosePage(n)}}finally{i.release(e)}}},g$=class{constructor(e,t){this.slices=e,this.signal=t,hJ(this,"started",performance.now())}get due(){return performance.now()-this.started>=this.slices.budgetMs}async pause(){await this.slices.between(),hW(this.signal),this.started=performance.now()}},gz=class{constructor(e,t){this.runtime=e,this.session=t}async read(e,t,n){hW(t);let{fn:r,mem:i}=this.runtime,o=this.session.pagePool(),a=await o.acquireInSlices(e,t,n);try{hW(t);let o=r.FPDFText_LoadPage(a);if(!o)throw new N(G.RuntimeUnavailable,`FPDFText_LoadPage returned null for page object ${e}`);try{hW(t);let a=Math.max(r.FPDFText_CountChars(o),0);if(0===a)return{runs:[]};let s=[],l=Math.min(a,4096),u=i.alloc(l*FQ.bytes);try{let d=new g$(n,t);for(let t=0;ta.getFloat32(e,!0),l=e=>eH({left:s(e),top:s(e+4),right:s(e+8),bottom:s(e+12)}),u=e=>({upperLeft:{x:s(e),y:s(e+4)},upperRight:{x:s(e+8),y:s(e+12)},lowerLeft:{x:s(e+16),y:s(e+20)},lowerRight:{x:s(e+24),y:s(e+28)}}),d=e.length>0?e[e.length-1].objectKey:null;for(let c=0;c+n<=t.byteLength;c+=n){let t=c+r.geometry,n=a.getUint32(c+r.objectRun,!0),f={objectKey:n,...function(e){let t=a.getUint32(e+i.flags,!0);if(t&o.empty)return{flags:2,looseBox:{left:0,bottom:0,right:0,top:0},upright:!0,baselineAngle:0,ascentFlip:!1};let n=!!(t&o.upright),r={flags:t&o.space?1:0,looseBox:l(e+i.looseBox),upright:n,baselineAngle:0,ascentFlip:!1};if(t&o.hasTightBox&&(r.tightBox=l(e+i.tightBox)),t&o.hasLooseQuad&&!n){r.looseQuad=u(e+i.looseQuad),t&o.hasTightQuad&&(r.tightQuad=u(e+i.tightQuad));let n=s(e+i.matrix),a=s(e+i.matrix+4),l=s(e+i.matrix+8),d=s(e+i.matrix+12);r.baselineAngle=Math.atan2(a,n),r.ascentFlip=n*d-a*l<0}return r}(t)};n!==d&&(f.fontSize=s(c+r.fontSize),d=n),e.push(f)}}(s,i.readBytes(u,c*FQ.bytes))}}finally{i.free(u)}return{runs:function(e){let t,n,r=[],i=[],o=0,a=null,s=e=>{i.length>0&&(r.push(function(e,t,n,r){if(r&&!r.upright){let i=e.map(e=>e.looseQuad?{loose:e.looseQuad,...e.tightQuad?{tight:e.tightQuad}:{},...gU(e.flags)}:{loose:{upperLeft:{x:0,y:0},upperRight:{x:0,y:0},lowerLeft:{x:0,y:0},lowerRight:{x:0,y:0}},...gU(e.flags)});return{rect:gV(e,e=>{var t;let n,r;return e.looseQuad?(n=[(t=e.looseQuad).upperLeft.x,t.upperRight.x,t.lowerLeft.x,t.lowerRight.x],r=[t.upperLeft.y,t.upperRight.y,t.lowerLeft.y,t.lowerRight.y],{left:Math.min(...n),right:Math.max(...n),bottom:Math.min(...r),top:Math.max(...r)}):gW}),start:t,glyphs:i,rotation:(-(180*r.baselineAngle)/Math.PI%360+360)%360,ascentFlip:r.ascentFlip,...void 0!==n?{fontSize:n}:{}}}let i=e.map(e=>({loose:e.looseBox,...e.tightBox?{tight:e.tightBox}:{},...gU(e.flags)}));return{rect:gV(e,e=>e.looseBox),start:t,glyphs:i,...void 0!==n?{fontSize:n}:{}}}(i,o,t,n)),i=[],n=void 0),o=e};for(let r=0;r=Math.abs(Math.atan2(Math.sin(n),Math.cos(n)))}(n,l)&&s(r),n||(n=l)),i.push(o)}return s(e.length),r}(s)}}finally{r.FPDFText_ClosePage(o)}}finally{o.release(e)}}};function gU(e){return{...1&e?{space:!0}:{},...2&e?{empty:!0}:{}}}function gV(e,t){let n=null;for(let r of e){if(2&r.flags)continue;let e=t(r);if(!n){n={left:e.left,bottom:e.bottom,right:e.right,top:e.top};continue}n.left=Math.min(n.left,e.left),n.bottom=Math.min(n.bottom,e.bottom),n.right=Math.max(n.right,e.right),n.top=Math.max(n.top,e.top)}return n??{...gW}}var gW={left:0,bottom:0,right:0,top:0};async function gq(e,t){let n=gH(e,t);if(!n)return null;try{return await t.draw(n.bitmapPtr,n.matrixPtr,n.clipPtr)?n.read():null}finally{n.free()}}function gH(e,t){var n,r,i;let{fn:o,mem:a}=e,{rect:s,page:l,rotation:u,viewport:d,background:c}=t;if(s.right<=s.left||s.top<=s.bottom)return null;let f=(n=s,r=l,{left:n.left-r.left,right:n.right-r.left,bottom:r.top-n.top,top:r.top-n.bottom}),{width:m,height:p}=function(e,t,n){var r;let i,o=90===t||270===t,a=o?e.height:e.width,s=o?e.width:e.height;if("width"===n.kind){if(!Number.isFinite(n.width)||n.width<=0)throw new N(G.InvalidArg,"render viewport width must be positive");let e=Math.max(1,Math.round(n.width));return{width:e,height:Math.max(1,Math.round(e*s/a))}}let l="dpi"===n.kind?(r=n.dpi,i=Math.max(e.width,e.height),r/72*Math.min(1,842/i,612/Math.min(e.width,e.height))):"thumbnail"===n.kind?512/Math.max(e.width,e.height):n.scale??1;if(!Number.isFinite(l)||l<=0)throw new N(G.InvalidArg,"render viewport scale must be positive");return{width:Math.max(1,Math.round(a*l)),height:Math.max(1,Math.round(s*l))}}({width:f.right-f.left,height:f.top-f.bottom},u,d);if(void 0!==t.maxOutputPixels&&m*p>t.maxOutputPixels)throw new N(G.InvalidArg,`render output ${m}x${p} exceeds the ${t.maxOutputPixels}-pixel budget \\u2014 request a smaller width (or tiles, once available)`);let h=4*m,F=h*p,g=null,_=null,P=null,D=null,b=()=>{_&&o.FPDFBitmap_Destroy(_),D&&a.free(D),P&&a.free(P),g&&a.free(g)};try{if(g=a.alloc(F),!(_=o.FPDFBitmap_CreateEx(m,p,4,g,h)))return b(),null;o.FPDFBitmap_FillRect(_,0,0,m,p,0xffffffff*("transparent"!==c)),P=a.alloc(24),function(e,t,n){for(let r=0;r<6;r++)e.poke(t,"f32",n[r],4*r)}(a,P,function(e,t,n,r){let{x:i,y:o}=e,a=e.width,s=e.height;switch(t){case 0:return[n/a,0,0,r/s,-n/a*i,-r/s*o];case 90:return[0,r/a,-n/s,0,n/s*(o+s),-r/a*i];case 180:return[-n/a,0,0,-r/s,n/a*(i+a),r/s*(o+s)];case 270:return[0,-r/a,n/s,0,-n/s*o,r/a*(i+a)]}}({x:(i=f).left,y:i.bottom,width:i.right-i.left,height:i.top-i.bottom},u,m,p)),D=a.alloc(16),a.poke(D,"f32",0,0),a.poke(D,"f32",0,4),a.poke(D,"f32",m,8),a.poke(D,"f32",p,12)}catch(e){throw b(),e}let y=g;return{bitmapPtr:_,matrixPtr:P,clipPtr:D,read:()=>{var e;let t;return{width:m,height:p,stride:h,color:"rgba8",premultipliedAlpha:!1,data:((t=new Uint8Array((e=a.readBytes(y,F)).byteLength)).set(e),t.buffer)}},free:b}}function gK(e,t){let{fn:n,mem:r}=e,i=hY(r,16,e=>n.FPDF_GetPageBoundingBox(t,e)?FX(r,e):null);return i?eH(i):{left:0,bottom:0,right:n.FPDF_GetPageWidthF(t),top:n.FPDF_GetPageHeightF(t)}}var gZ=class{constructor(e,t){this.runtime=e,this.session=t}async render(e,t,n,r){hW(n);let{fn:i}=this.runtime,o=this.session.pagePool(),a=await o.acquireInSlices(e,n,r);try{hW(n),function(e){let{usage:t,viewport:n}=e??{};if(void 0===t||"display"===t){if(n?.kind==="dpi"&&nl("viewport",\'a dpi viewport is only for a print picture (usage: "print")\'),n?.kind==="thumbnail"){e?.target!==void 0&&"page"!==e.target.kind&&nl("target","a thumbnail is the whole page: it takes no target");}return}for(let r of("print"!==t&&nl("usage",\'usage must be "display" or "print"\'),(n?.kind!=="dpi"||150!==n.dpi&&300!==n.dpi)&&nl("viewport","a print picture needs viewport: { kind: \'dpi\', dpi: 150 or 300 }"),["target","rotation","background"]))e?.[r]!==void 0&&nl(r,`a print picture takes no ${r}: it is the whole page, upright, on white`)}(t);let o="print"===t.usage,s=gK(this.runtime,a),l=function(e,t){if(!e||"page"===e.kind)return t;let n=eH(e.rect);if(!(n.right>n.left&&n.top>n.bottom))throw new N(G.InvalidArg,"render rect must have positive area");return n}(t.target,s),u=t.rotation??0,d=t.viewport??{kind:"scale",scale:1},c=function(e,t){let{includeAnnotations:n,includeFormFields:r}=e??{};if(!0===n&&!t.annotations)throw new na("doc.annotate.read","includeAnnotations");if(!0===r&&!t.formFields)throw new na("doc.forms.read","includeFormFields");return{includeAnnotations:n??t.annotations,includeFormFields:r??(!1!==n&&t.formFields)}}(t,{annotations:!0,formFields:!0}),f=16;c.includeAnnotations&&(f|=1),c.includeFormFields&&(f|=32768),o&&(f|=2048);let m=await gq(this.runtime,{rect:l,page:s,rotation:u,viewport:d,...void 0!==t.maxOutputPixels?{maxOutputPixels:t.maxOutputPixels}:{},background:"transparent"===t.background?"transparent":"white",draw:async(e,t,o)=>{hW(n);let s=i.EPDF_RenderPageBitmapWithMatrix_Start(e,a,t,o,f,r.budgetMs);try{for(;1===s;)await r.between(),hW(n),s=i.EPDF_RenderPage_Continue(a,r.budgetMs)}finally{i.FPDF_RenderPage_Close(a)}return 2===s}});if(!m)throw new N(G.RuntimeUnavailable,`failed to render page object ${e}`);return{raster:m,area:l}}finally{o.release(e)}}};function gJ(e,t){return{docPtr:e.requireDocPtr(),...t?{fonts:t}:{}}}function gQ(e,t){if(void 0===e.family)return e;let n=t.programOf?.(e.family),r=eU(e.family,t.describe),i={...e,family:r.family};return void 0!==r.weight&&void 0===e.weight&&(i.weight=r.weight),void 0!==r.italic&&void 0===e.italic&&(i.italic=r.italic),void 0!==n&&(i.program=n),i}function gX(e,t={}){let n=e.body?gQ(e.body,t):void 0;n&&void 0!==t.bodyProgram&&(n.program=t.bodyProgram);let r=e.paragraphs.map(e=>({...e,runs:e.runs.map(e=>({...e,text:e2(e.text,`\\r`),...e.style?{style:gQ(e.style,t)}:{}}))}));return JSON.stringify(n?{body:n,paragraphs:r}:{paragraphs:r})}function gY(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||"object"!=typeof t||!t.body||!Array.isArray(t.paragraphs))return null;let{source:n,...r}=t.body,i=g0(r),o=t.paragraphs.map(e=>{let{runs:t,...n}=e;return{...n,runs:(t??[]).map(e=>{let t="string"==typeof e.text?e2(e.text,`\n`):e.text;return e.style?{...e,text:t,style:g0(e.style)}:{...e,text:t}})}});return{source:t.source,document:{body:i,paragraphs:o}}}function g0(e){return"string"==typeof e.color?{...e,color:e.color.toLowerCase()}:e}function g1(e,t,n){let r=h2(t,(t,r)=>e.EPDFAnnot_GetRichTextJSON(n,t,r)),i=r?gY(r):null;if(i?.source!=="rc")return null;let{body:o,paragraphs:a}=i.document;return{body:{...o,family:o.family||e6.family},paragraphs:a}}function g3(e){let t=Math.fround(e);if(!Number.isFinite(t))return t;for(let e=1;e<9;e++){let n=Number(t.toPrecision(e));if(Math.fround(n)===t)return n}return t}var g2={invisible:1,hidden:2,print:4,noZoom:8,noRotate:16,noView:32,readOnly:64,locked:128,toggleNoView:256,lockedContents:512},g6=Object.keys(g2);function g5(e){let t={};for(let n of g6)void 0!==e[n]&&(t[n]=e[n]);return Object.keys(t).length>0?t:null}function g4(e){switch(e){case"square":return 1;case"circle":return 2;case"diamond":return 3;case"open-arrow":return 4;case"closed-arrow":return 5;case"butt":return 6;case"r-open-arrow":return 7;case"r-closed-arrow":return 8;case"slash":return 9;default:return 0}}function g8(e){switch(e){case 1:return"square";case 2:return"circle";case 3:return"diamond";case 4:return"open-arrow";case 5:return"closed-arrow";case 6:return"butt";case 7:return"r-open-arrow";case 8:return"r-closed-arrow";case 9:return"slash";default:return"none"}}function g7(e,t,n,r){return e.FPDFAnnot_HasKey(n,r)?h3(t,(t,i)=>e.FPDFAnnot_GetStringValue(n,r,t,i),""):null}function g9(e,t,n){return hY(t,16,r=>e.FPDFAnnot_GetRect(n,r)?FX(t,r):{left:0,bottom:0,right:0,top:0})}function _e(e,t,n,r=0){return h0(t,[4,4,4],([i,o,a])=>e.EPDFAnnot_GetColor(n,r,i,o,a)?e7(255&F1(t,i),255&F1(t,o),255&F1(t,a)):null)}function _t(e,t,n,r){return hY(t,4,i=>e.EPDFAnnot_GetBooleanValue(n,r,i)?0!==F1(t,i):null)}function _n(e,t,n){return hY(t,4,r=>e.EPDFAnnot_GetOpacity(n,r)?g3(F0(t,r)):null)}function _r(e,t,n){return hY(t,4,r=>({styleCode:e.EPDFAnnot_GetBorderStyle(n,r),width:F0(t,r)}))}function _i(e,t,n){return hY(t,4,r=>{if(!e.EPDFAnnot_GetBorderEffect(n,r))return null;let i=F0(t,r);return i>0?i:null})}function _o(e,t,n){let r=e.FPDFAnnot_GetVertices(n,0n,0);return r<=0?[]:hY(t,8*r,i=>{let o=e.FPDFAnnot_GetVertices(n,i,r);if(o<=0)return[];let a=[];for(let e=0;e{let a=e.FPDFAnnot_GetInkListPath(n,o,i,r);if(a<=0)return[];let s=[];for(let e=0;e0&&i.push(a)}return i}function _s(e,t,n){return h0(t,[8,8],([r,i])=>e.FPDFAnnot_GetLine(n,r,i)?{start:{x:F0(t,r,0),y:F0(t,r,4)},end:{x:F0(t,i,0),y:F0(t,i,4)}}:null)}function _l(e,t,n){return h0(t,[4,4],([r,i])=>e.EPDFAnnot_GetLineEndings(n,r,i)?{start:g8(F1(t,r)),end:g8(F1(t,i))}:{start:"none",end:"none"})}function _u(e,t,n){return h0(t,[4,4,4,4,4],([r,i,o,a,s])=>e.EPDFAnnot_GetDefaultAppearance(n,r,i,o,a,s)?{fontCode:F1(t,r),fontSize:F0(t,i),color:e7(255&F1(t,o),255&F1(t,a),255&F1(t,s))}:null)}function _d(e,t,n){return h0(t,[4,4],([r,i])=>{let o=h3(t,(t,o)=>e.EPDFAnnot_GetDefaultAppearanceFontFace(n,t,o,r,i),null);return o?{family:o,weight:F1(t,r),italic:0!==F1(t,i)}:null})}function _c(e,t){return e.EPDFAnnot_GetTextAlignment(t)}function _f(e,t,n){let r=e.EPDFAnnot_GetIntent(n,0n,0);if(r<=0)return null;let i=(r+1)*2;return hY(t,i,r=>(e.EPDFAnnot_GetIntent(n,r,i),t.readU16String(r)))}function _m(e,t,n){let r=e.FPDFAnnot_CountAttachmentPoints(n);return r<=0?[]:hY(t,32,i=>{let o=[];for(let a=0;aF0(t,i,e);o.push(function(e){let[t,n,r,i]=e;if(eZ(e))return{upperLeft:t,upperRight:n,lowerLeft:r,lowerRight:i};if(eZ([t,n,i,r]))return{upperLeft:t,upperRight:n,lowerLeft:i,lowerRight:r};let o=e.map(e=>eK(e)?e:{x:0,y:0}),a=o.reduce((e,t)=>e+t.x,0)/4,s=o.reduce((e,t)=>e+t.y,0)/4,l=[...o].sort((e,t)=>Math.atan2(e.y-s,e.x-a)-Math.atan2(t.y-s,t.x-a)),u=0;for(let e=1;e<4;e++)l[e].y+l[(e+1)%4].y>l[u].y+l[(u+1)%4].y&&(u=e);let d=[l[u],l[(u+1)%4]],c=[l[(u+3)%4],l[(u+2)%4]];return d[0].x<=d[1].x?{upperLeft:d[0],upperRight:d[1],lowerLeft:c[0],lowerRight:c[1]}:{upperLeft:d[1],upperRight:d[0],lowerLeft:c[1],lowerRight:c[0]}}([{x:r(0),y:r(4)},{x:r(8),y:r(12)},{x:r(16),y:r(20)},{x:r(24),y:r(28)}]))}return o})}function _p(e,t,n){return h2(t,(t,r)=>e.EPDFAnnot_GetName(n,t,r))}function _h(e,t,n){return h2(t,(t,r)=>e.EPDFAnnot_GetAppearanceState(n,t,r))}function _F(e){let t=g3((-g3(e)%360+360)%360+0);return 0===t||360===t?void 0:t}function _g(e){let t=(-e%360+360)%360+0;return t>180?t-360:t}var __=new Set([5,6,3,13,14]),_P=[90,180,270],_D=e=>(e%360+360)%360;function _b(e,t){let n=Math.abs(_D(e)-_D(t));return Math.min(n,360-n)}function _y(e,t,n){if(!e.EPDFAnnot_HasEmbedMetadata(n))return;let r=hY(t,4,r=>e.EPDFAnnot_GetEmbedMetadataNumber(n,"Rotation",r)?_D(F0(t,r)):void 0);if(void 0===r||.01>_b(r,0))return;let i=hY(t,16,r=>e.EPDFAnnot_GetEmbedMetadataRect(n,"UnrotatedRect",r)?eH(FX(t,r)):void 0);if(i&&!(i.right<=i.left)&&!(i.top<=i.bottom))return{degrees:r,box:i}}function _w(e,t,n){let r=eH(g9(e,t,n)),i=h0(t,[4,4,4,4],([r,i,o,a])=>e.EPDFAnnot_GetRectangleDifferences(n,r,i,o,a)?{left:F0(t,r),bottom:F0(t,i),right:F0(t,o),top:F0(t,a)}:null);if(!i)return r;let o={left:r.left+i.left,bottom:r.bottom+i.bottom,right:r.right-i.right,top:r.top-i.top};return o.left<=o.right&&o.bottom<=o.top?o:r}function _E(e,t,n){let r=function(e,t,n){let r=e.FPDFAnnot_GetSubtype(n);if(!__.has(r))return;let i=function(e,t,n){if(e.FPDFAnnot_HasKey(n,"Rotate"))return hY(t,4,r=>e.EPDFAnnot_GetRotate(n,r)?F0(t,r):void 0)}(e,t,n),o=hY(t,16,r=>hY(t,24,o=>{if(!e.EPDFAnnot_GetAppearanceTransform(n,r,o))return;let a={a:F0(t,o,0),b:F0(t,o,4),c:F0(t,o,8),d:F0(t,o,12),e:F0(t,o,16),f:F0(t,o,20)},s=function(e){let t=Math.hypot(e.a,e.b);if(!(t>0))return;let n=.002*t;if(Math.abs(e.a-e.d)>n||Math.abs(e.b+e.c)>n)return;let r=_D(180*Math.atan2(e.b,e.a)/Math.PI);return _b(r,0)>.05?r:void 0}(a);if(void 0===s)return;let l=eH(FX(t,r)),u=Math.hypot(a.a,a.b),d=(l.left+l.right)/2,c=(l.bottom+l.top)/2,f=a.a*d+a.c*c+a.e,m=a.b*d+a.d*c+a.f,p=(l.right-l.left)*u/2,h=(l.top-l.bottom)*u/2;return{degrees:void 0!==i&&.05>=_b(i,s)?_D(i):Math.round(100*s)/100,box:{left:f-p,bottom:m-h,right:f+p,top:m+h}}})),a=_w(e,t,n),s=3===r,l=s&&void 0!==i?_P.find(e=>.05>=_b(i,e)):void 0,u=_y(e,t,n);if(u&&eY(eJ(u.box,u.degrees),a)&&(o?.05>=_b(o.degrees,u.degrees):!e.EPDFAnnot_HasAppearanceStream(n,0)||s&&(e.FPDFAnnot_HasKey(n,"CL")||void 0!==l&&.05>=_b(l,u.degrees))))return u;if(o)return o;if(void 0===l)return;if(180===l)return{degrees:l,box:a};let d=(a.left+a.right)/2,c=(a.bottom+a.top)/2,f=(a.top-a.bottom)/2,m=(a.right-a.left)/2;return{degrees:l,box:{left:d-f,bottom:c-m,right:d+f,top:c+m}}}(e,t,n);if(!r)return;let i=_F(r.degrees);return void 0===i?void 0:{rotation:i,box:r.box}}function _A(e,t,n){let r=_E(e,t,n);return r?{box:r.box,rotation:r.rotation}:{box:_w(e,t,n),rotation:null}}var _v="Replace",_S="StrikeOutTextEdit";function _k(e){if("replace"===e)return _v}function _x(e){if("strikeout-text-edit"===e)return _S}function _G(e,t,n,r){let i=t.writeU16String(r.key);try{return e.EPDFDoc_GetAttachmentIndexByKey(n,i)}finally{t.free(i)}}function _O(e,t,n,r,i,o){let a=o.bytes.byteLength;if(0===a){if(!e.FPDFAttachment_SetFile(n,r,0n,0))throw new N(G.Unknown,"FPDFAttachment_SetFile returned false")}else{let i=t.alloc(a);try{if(t.writeBytes(i,new Uint8Array(o.bytes)),!e.FPDFAttachment_SetFile(n,r,i,a))throw new N(G.Unknown,"FPDFAttachment_SetFile returned false")}finally{t.free(i)}}if(h6(t,hH(new Date),t=>e.FPDFAttachment_SetStringValue(n,"CreationDate",t)),i.mimeType&&!e.EPDFAttachment_SetSubtype(n,i.mimeType))throw new N(G.Unknown,"EPDFAttachment_SetSubtype returned false");if(void 0!==i.description&&!h6(t,i.description,t=>e.EPDFAttachment_SetDescription(n,t)))throw new N(G.Unknown,"EPDFAttachment_SetDescription returned false")}function _I(e,t,n){let r=h3(t,(t,r)=>e.FPDFAttachment_GetName(n,t,r))??"",i=h3(t,(t,r)=>e.FPDFAttachment_GetSubtype(n,t,r)),o=h3(t,(t,r)=>e.EPDFAttachment_GetDescription(n,t,r)),a=_M(e,t,n,"CreationDate"),s=_M(e,t,n,"ModDate"),l=function(e){if(!e)return null;let t=e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e;return/^[0-9a-fA-F]+$/.test(t)?t.toLowerCase():e}(_j(e,t,n,"CheckSum"));return{name:r,mimeType:i||null,description:o||null,sizeBytes:function(e,t,n){let r=t.alloc(4);try{if(!e.EPDFAttachment_GetIntegerValue(n,"Size",r))return null;let i=Number(t.peek(r,"i32"));return i>=0?i:null}finally{t.free(r)}}(e,t,n),md5:l||null,createdAt:a||null,modifiedAt:s||null}}function _N(e,t,n){let{fn:r,mem:i}=e,o=i.alloc(8),a=i.alloc(4),s=i.alloc(4),l=null;try{if(i.poke(o,"ptr",0),i.poke(a,"i32",0),i.poke(s,"i32",-1),!r.EPDFAttachment_ExtractFileToOwnedBuffer(t,BigInt(n??0),o,a,s))throw _C(Number(i.peek(s,"i32")),n);let e=Number(i.peek(a,"i32"))>>>0;if(l=i.peek(o,"ptr"),0===e||!l)return{bytes:new ArrayBuffer(0),size:0};let u=i.readBytes(l,e),d=new ArrayBuffer(u.byteLength);return new Uint8Array(d).set(u),{bytes:d,size:e}}finally{l&&r.EPDF_FreeBuffer(l),i.free(s),i.free(a),i.free(o)}}function _C(e,t){switch(e){case 1:return new N(G.InvalidArg,"attachment has no embedded file stream (missing /EF)");case 2:return new N(G.MalformedPdf,"embedded file stream failed to decode");case 3:return new N(G.PayloadTooLarge,`the embedded file decodes to more than ${t} bytes, the limit`,{details:{limit:t}});case 4:return new N(G.Unknown,"writing the extracted attachment failed");default:return new N(G.Unknown,`attachment extraction failed (status ${e})`)}}function _j(e,t,n,r){return e.FPDFAttachment_HasKey(n,r)?h3(t,(t,i)=>e.FPDFAttachment_GetStringValue(n,r,t,i),null):null}function _M(e,t,n,r){let i=_j(e,t,n,r);return i?hq(i):null}var _R=Object.freeze({comment:"Comment",key:"Key",note:"Note",help:"Help","new-paragraph":"NewParagraph",paragraph:"Paragraph",insert:"Insert"}),_T=Object.freeze(Object.fromEntries(Object.entries(_R).map(([e,t])=>[t,e]))),_B=Object.freeze({graph:"Graph","push-pin":"PushPin",paperclip:"Paperclip",tag:"Tag"}),_L=Object.freeze(Object.fromEntries(Object.entries(_B).map(([e,t])=>[t,e]))),_$={"free-text":"FreeText","free-text-callout":"FreeTextCallout","free-text-typewriter":"FreeTextTypeWriter"};function _z(e){return Object.entries(_$).find(([,t])=>t===e)?.[0]??"free-text"}var _U={courier:0,"courier-bold":1,"courier-bold-oblique":2,"courier-oblique":3,helvetica:4,"helvetica-bold":5,"helvetica-bold-oblique":6,"helvetica-oblique":7,"times-roman":8,"times-bold":9,"times-bold-italic":10,"times-italic":11,symbol:12,"zapf-dingbats":13},_V=Object.fromEntries(Object.entries(_U).map(([e,t])=>[t,e])),_W="helvetica";function _q(e){return _V[e]??"helvetica"}function _H(e){switch(e){case"center":return 1;case"right":return 2;default:return 0}}function _K(e){switch(e){case 1:return"center";case 2:return"right";default:return"left"}}var _Z=["top","middle","bottom"];function _J(e,t,n,r,i){let o=i?.keyForFace(r.family,r.weight,r.italic);if(void 0!==o)return o;let a=function(e){let t;if(void 0!==t)return t;let n=eW[eV(e.family)];if(n){let t=Object.entries(ez),r=e.weight>=600,i=t.find(([,t])=>t.family===n&&t.weight>=600===r&&t.italic===e.italic)??t.find(([,e])=>e.family===n);if(i)return i[0]}return e.family}(r);if(Z.includes(a))return a;let s=_d(e,t,n);if(s&&eV(s.family)===eV(r.family)&&s.weight===r.weight&&s.italic===r.italic){let r=h2(t,(t,r)=>e.EPDFAnnot_GetDefaultAppearanceFontPostScriptName(n,t,r));if(r)return r}return aA({familyName:r.family,weight:r.weight,italic:r.italic},null)}function _Q(e,t,n,r){let i=e.EPDFAnnot_GetEmbedMetadataString(n,r,0n,0);if(i<=2)return;let o=t.alloc(i);try{if(0>=e.EPDFAnnot_GetEmbedMetadataString(n,r,o,i))return;return t.readU16String(o)}finally{t.free(o)}}function _X(e,t,n,r){let i=t.alloc(4);try{if(!e.EPDFAnnot_GetEmbedMetadataNumber(n,r,i))return;return Number(t.peek(i,"f32"))}finally{t.free(i)}}function _Y(e){switch(e){case"dashed":return 2;case"beveled":return 3;case"inset":return 4;default:return 1}}function _0(e){switch(e){case 2:return"dashed";case 3:return"beveled";case 4:return"inset";default:return"solid"}}function _1(e){return 5===e?"underline":_0(e)}function _3(e,t,n){let r,{styleCode:i,width:o}=_r(e,t,n),a=(r=e.EPDFAnnot_GetBorderDashPatternCount(n))<=0?[]:hY(t,4*r,i=>{if(!e.EPDFAnnot_GetBorderDashPattern(n,i,r))return[];let o=[];for(let e=0;e0?a:null}}function _2(e,t,n){let r=_e(e,t,n,0),i=_n(e,t,n);return{color:r,opacity:null==i?1:Math.max(0,Math.min(1,i)),..._3(e,t,n)}}function _6(e,t,n){let r=_e(e,t,n,1);return{..._2(e,t,n),interiorColor:r??null}}function _5(e,t,n,r){let i=r.flat();if(0===i.length)return;let o=function(e,t,n){let r=function(e,t,n){if(e.EPDFAnnot_HasEmbedMetadata(n))return hY(t,4,r=>{if(e.EPDFAnnot_GetEmbedMetadataNumber(n,"Rotation",r))return _F(F0(t,r))})}(e,t,n);if(void 0===r)return;let i=hY(t,16,r=>e.EPDFAnnot_GetEmbedMetadataRect(n,"UnrotatedRect",r)?eH(FX(t,r)):void 0);return i?{rotation:r,box:i}:void 0}(e,t,n);if(!o)return;let{box:a}=o,s={degrees:o.rotation,center:{x:(a.left+a.right)/2,y:(a.bottom+a.top)/2}};return eY(e0(i.map(e=>e3(e,s))),a)?s:void 0}var _4=(e,t)=>t?e3(e,t):e;function _8(e){if("ink-highlight"===e)return"InkHighlight"}var _7={"line-arrow":"LineArrow","line-dimension":"LineDimension","polygon-cloud":"PolygonCloud","polygon-dimension":"PolygonDimension","polyline-dimension":"PolyLineDimension"};function _9(e,t,n){return{measure:ga(e,t,e.EPDFAnnot_GetMeasure(n))??null}}function Pe(e,t,n){return h0(t,[4,4,8],([r,i,o])=>{if(!e.EPDFAnnot_GetShapeCaption(n,r,i,o))return;let a=!!t.peek(r,"i32"),s=!!t.peek(i,"i32");if(e.EPDFAnnot_GetEmbedMetadataBoolean(n,"MeasurementCaption",r)||s)return{enabled:a,...s?{center:{x:Number(t.peek(o,"f32")),y:Number(t.peek(o,"f32",4))}}:{}}})}var Pt={start:{x:0,y:0},end:{x:0,y:0}};function Pn(e,t,n,r){var i,o,a,s,l;let u,d,c=r.page.objectNumber,f="xyz"===r.kind?e.EPDFDest_CreateXYZByObjectNumber(n,c,null!=r.left,r.left??0,null!=r.top,r.top??0,null!=r.zoom,r.zoom??0):(i=e,o=t,a=n,s=c,l=r,u=(()=>{switch(l.kind){case"fitH":case"fitBH":return null!=l.top?[l.top]:[];case"fitV":case"fitBV":return null!=l.left?[l.left]:[];case"fitR":return[l.left,l.bottom,l.right,l.top];default:return[]}})(),d=F3[l.kind],u.length?hY(o,4*u.length,e=>{for(let t=0;t[t,e]))}function PS(e,t,n,r="#000000"){let i=_e(e,t,n)??r,o=_n(e,t,n);return{color:i,opacity:null==o?1:Math.max(0,Math.min(1,o)),quadPoints:_m(e,t,n),richText:g1(e,t,n)}}function Pk(e,t,n){let r=_o(e,t,n),i=_5(e,t,n,[r]),o=Pe(e,t,n);return{vertices:r.map(e=>_4(e,i)),rotation:i?.degrees??null,captionEnabled:o?.enabled??null,captionCenter:o?.center?_4(o.center,i):null}}var Px=["caption","image","caption-below","caption-above","caption-right","caption-left","caption-over"];function PG(e,t,n,r){return h0(t,[4,4,4],([i,o,a])=>e.EPDFAnnot_GetMKColor(n,r,i,o,a)?e7(255&F1(t,i),255&F1(t,o),255&F1(t,a)):null)}function PO(e,t){return eQ(-e.EPDFAnnot_GetMKRotation(t))||null}var PI={highlight:function(e,t,n,r){let i=PS(e,t,n,"#ffff00");return{...r,subtype:"highlight",...i}},underline:function(e,t,n,r){let i=PS(e,t,n);return{...r,subtype:"underline",...i}},squiggly:function(e,t,n,r){let i=PS(e,t,n);return{...r,subtype:"squiggly",...i}},strikeout:function(e,t,n,r){let i=PS(e,t,n),o=_f(e,t,n)===_S?"strikeout-text-edit":null;return{...r,subtype:"strikeout",intent:o,...i}},circle:function(e,t,n,r){return{...r,subtype:"circle",...Pu(e,t,n)}},square:function(e,t,n,r){return{...r,subtype:"square",...Pu(e,t,n)}},polygon:function(e,t,n,r){let{captionEnabled:i,captionCenter:o,...a}=Pk(e,t,n),s=_f(e,t,n);return{...r,richText:g1(e,t,n),..._9(e,t,n),captionEnabled:i,captionCenter:o,intent:"PolygonCloud"===s?"polygon-cloud":"PolygonDimension"===s?"polygon-dimension":null,subtype:"polygon",..._6(e,t,n),...a,cloudyIntensity:_i(e,t,n)}},polyline:function(e,t,n,r){let{captionEnabled:i,captionCenter:o,...a}=Pk(e,t,n),s=_f(e,t,n);return{...r,richText:g1(e,t,n),..._9(e,t,n),captionEnabled:i,captionCenter:o,intent:"PolyLineDimension"===s?"polyline-dimension":null,subtype:"polyline",..._6(e,t,n),...a,lineEndings:_l(e,t,n)}},line:function(e,t,n,r){let i=_s(e,t,n)??Pt,o=_5(e,t,n,[[i.start,i.end]]),a=_f(e,t,n),s=function(e,t,n){if(["Cap","CP","CO"].some(t=>e.FPDFAnnot_HasKey(n,t)))return h0(t,[4,4,8],([r,i,o])=>{if(e.EPDFAnnot_GetLineCaption(n,r,i,o))return{enabled:!!t.peek(r,"i32"),position:1===t.peek(i,"i32")?"top":"inline",...e.FPDFAnnot_HasKey(n,"CO")?{offset:{along:Number(t.peek(o,"f32")),perpendicular:Number(t.peek(o,"f32",4))}}:{}}})}(e,t,n),l=function(e,t,n){if(["LL","LLE","LLO"].some(t=>e.FPDFAnnot_HasKey(n,t)))return h0(t,[4,4,4],([r,i,o])=>{if(e.EPDFAnnot_GetLineLeader(n,r,i,o))return{length:Number(t.peek(r,"f32")),extension:Number(t.peek(i,"f32")),offset:Number(t.peek(o,"f32"))}})}(e,t,n);return{...r,richText:g1(e,t,n),..._9(e,t,n),intent:"LineArrow"===a?"line-arrow":"LineDimension"===a?"line-dimension":null,captionEnabled:s?.enabled??!1,captionPosition:s?.position??"inline",captionOffset:s?.offset??null,leader:l??null,subtype:"line",..._6(e,t,n),linePoints:{start:_4(i.start,o),end:_4(i.end,o)},lineEndings:_l(e,t,n),rotation:o?.degrees??null}},link:function(e,t,n,r,i,o){return{...r,subtype:"link",target:function(e,t,n,r,i){let o=r.actions?.activate;if(o)return Pr(o);let a=e.FPDFAnnot_GetLink(n);if(!a)return null;let s=e.FPDFLink_GetDest(i.docPtr,a);if(!s)return null;let l=F2(e,t,i.docPtr,s);return l?{kind:"goto",destination:l}:{kind:"unsupported"}}(e,t,n,r,o)}},ink:function(e,t,n,r){let i=_a(e,t,n),o=_5(e,t,n,i),a="InkHighlight"===_f(e,t,n)?"ink-highlight":null;return{...r,richText:g1(e,t,n),subtype:"ink",..._2(e,t,n),intent:a,inkList:i.map(e=>e.map(e=>_4(e,o))),rotation:o?.degrees??null}},"free-text":function(e,t,n,r,i,o){var a;let s,l,u=_u(e,t,n),d=u?.color??"#000000",c=(s=h2(t,(t,r)=>e.EPDFAnnot_GetRichTextJSON(n,t,r)))?gY(s)?.document??null:null,f=o?.fonts,m=c?_J(e,t,n,c.body,f):u?_q(u.fontCode):_W,p=c&&c.body.size>0?c.body.size:u&&u.fontSize>0?u.fontSize:12,h=c??{body:{family:"Helvetica",weight:400,italic:!1,size:p,color:d,decoration:[],script:"normal",letterSpacing:0,horizontalScale:1,align:"left",dir:"ltr"},paragraphs:[{runs:[{text:r.contents??""}]}]},F=h.body.color.toLowerCase(),g=_e(e,t,n,0),_=_n(e,t,n),P=null==_?1:Math.max(0,Math.min(1,_)),D=c?c.body.align:_K(_c(e,n)),b=void 0!==(a=_X(e,t,n,"VerticalAlignment"))&&_Z[a]||"top",y=_z(_f(e,t,n)),w=(l=e.EPDFAnnot_GetCalloutLineCount(n))<=0?[]:hY(t,8*l,r=>{let i=e.EPDFAnnot_GetCalloutLine(n,r,l);if(i<=0)return[];let o=[];for(let e=0;ee.EPDFAnnot_GetMKText(n,0,t,r)),checkStyle:null,layout:Px[e.EPDFAnnot_GetMKTextPosition(n)]??"caption",field:null,fieldKind:"unknown",hasMark:0!==e.EPDFAnnot_GetDrawing(n)}},redact:function(e,t,n,r,i,o){let a=_e(e,t,n,0)??"#ff0000",s=_n(e,t,n),l=null==s?1:Math.max(0,Math.min(1,s)),u=_e(e,t,n,1)??null,d=_u(e,t,n),c=d?_d(e,t,n):null,f=o?.fonts,m=c?.family?_J(e,t,n,c,f):d?_q(d.fontCode):_W,p=d?d.fontSize:12,h=d?.color??"#000000";return{...r,richText:g1(e,t,n),subtype:"redact",quadPoints:_m(e,t,n),color:a,opacity:l,interiorColor:u,overlayText:e.FPDFAnnot_HasKey(n,"OverlayText")?h3(t,(t,r)=>e.EPDFAnnot_GetOverlayText(n,t,r),""):null,repeat:e.EPDFAnnot_GetOverlayTextRepeat(n),fontFamily:m,fontSize:p,fontColor:h,textAlign:_K(_c(e,n))}},popup:function(e,t,n,r,i,o){return{...r,subtype:"popup",parent:Ps(e,t,o.docPtr,n,"Parent",r.page.objectNumber),open:_t(e,t,n,"Open")??!1}},unsupported:function(e,t,n,r,i){let o=g7(e,t,n,"Subtype");return{...r,subtype:"unsupported",rawSubtypeCode:i,rawSubtypeName:o}}};function PN(e){let t=rN(e),n=PI[t];return n?{reader:n,subtype:t}:{reader:PI.unsupported,subtype:"unsupported"}}function PC(e,t,n){let r=(n.next??[]).map(n=>PC(e,t,n)),i=function(e,t,n){let{fn:r,mem:i}=e,o=(()=>{switch(n.type){case"javascript":return h5(i,n.script,e=>r.EPDFAction_CreateJavaScript(t,e));case"goto":return r.EPDFAction_CreateGoTo(t,Pn(r,i,t,n.destination));case"uri":return r.EPDFAction_CreateURI(t,n.uri);case"named":return r.EPDFAction_CreateNamed(t,n.name);case"hide":return Pj(e,n.targets,(e,i)=>r.EPDFAction_CreateHide(t,e,i,n.hide));case"reset-form":return Pj(e,n.fields??[],(e,i)=>r.EPDFAction_CreateResetForm(t,e,n.fields?i:-1,n.exclude));case"submit-form":return h5(i,n.url,i=>Pj(e,n.fields??[],(e,o)=>r.EPDFAction_CreateSubmitForm(t,i,e,n.fields?o:-1,M(n))))}})();if(!o)throw new N(G.InvalidArg,`the ${n.type} action could not be written`);return o}(e,t,n);if(r.length>0&&!gc(e,r,(n,r)=>e.fn.EPDFAction_SetNext(t,i,n,r)))throw new N(G.Unknown,`the ${n.type} action\'s next ones could not be set`);return i}function Pj(e,t,n){let{mem:r}=e,i=8+gu(e),o=t.map(e=>"name"===e.kind?r.writeU16String(e.name):null);try{return hY(r,Math.max(1,t.length*i),a=>(t.forEach((t,n)=>{let s=n*i,l=o[n];r.poke(a,"i32",+!l,s),r.poke(a,"i32","objectNumber"===t.kind?t.objectNumber:0,s+4),gd(e,a,s+8,l??0n)}),n(a,t.length)))}finally{for(let e of o)e&&r.free(e)}}function PM(e,t,n,r){z.forEach((i,o)=>{let a=null===r?null:r[i];if(void 0===a)return;let s=null===a?0n:PC(e,t,a);if(!e.fn.EPDFAnnot_SetEventAction(n,o,s))throw new N(G.Unknown,`the widget\'s ${i} action could not be written`)})}var PR=class{constructor(e,t){this.runtime=e,this.docPtr=t,hJ(this,"indexes",null)}indexOf(e){if(!this.indexes){let{fn:e}=this.runtime,t=new Map,n=e.FPDF_GetPageCount(this.docPtr);for(let r=0;r0&&!t.has(n)&&t.set(n,r)}this.indexes=t}return this.indexes.get(e)??-1}};function PT(e,t,n,r){let{fn:i}=e;return n.some(n=>PB(e,t,n,r,e=>0!==i.EPDFAnnot_GetMKIcon(e,0))??!1)}function PB(e,t,n,r,i){let{fn:o}=e;if(!n.page||n.objectNumber<=0)return null;let a=r.indexOf(n.page.objectNumber);if(a<0)return null;let s=o.EPDFPage_GetAnnotIndexByObjectNumberRaw(t,a,n.objectNumber);if(s<0)return null;let l=o.EPDFPage_GetAnnotRaw(t,a,s);if(!l)return null;try{return i(l)}finally{o.FPDFPage_CloseAnnot(l)}}var PL=e=>z.indexOf(e),P$={root:null,incomplete:!0,warnings:["incomplete"]};function Pz(e,t,n,r){let{fn:i,mem:o}=e;return n.map(n=>PB(e,t,n,r,e=>{let n=new F4,r={};for(let a of["activate","mouseUp"]){let s=i.EPDFAnnot_GetActionModel(e,PL(a));try{let e=F8(i,o,t,s,n);e&&(r[a]=e)}catch(e){if(!N.is(e)||e.code!==G.MalformedPdf)throw e;r[a]=P$}}return r}))}function PU(e,t,n,r){let{fn:i}=e,o=gj(e,t,n);try{if(i.EPDFAnnot_GetMKIcon(o,0)===r)return;if(!(0===r?i.EPDFAnnot_ClearMKIcon(o,0):i.EPDFAnnot_SetMKIcon(o,0,r)))throw new N(G.Unknown,"the push button\'s icon (/MK /I) could not be written");if(!i.EPDFAnnot_GenerateFormFieldAP(o))throw new N(G.Unknown,"the push button\'s look could not be drawn")}finally{i.FPDFPage_CloseAnnot(o)}}function PV(e,t,n){let r=gj(e,t,n);try{return e.fn.EPDFAnnot_GetMKIcon(r,0)}finally{e.fn.FPDFPage_CloseAnnot(r)}}var PW="GroupID",Pq="ForAnyone",PH="Purpose",PK="Placeholder",PZ="CreatedBy",PJ="CreatedAt",PQ="ImportedBy",PX={createdBy:null,createdAt:null,importedBy:null};function PY(e,t,n){let{fn:r,mem:i}=e;return r.EPDFForm_HasFieldEmbedMetadata(t,n)?h3(i,(e,i)=>r.EPDFForm_GetFieldEmbedMetadataString(t,n,PW,e,i),null):null}function P0(e,t,n){let r=PY(e,t,n);return null!==r?{kind:"group",groupId:r}:7!==e.fn.EPDFForm_GetFieldFamily(t,n)&&P1(e,t,n)?{kind:"anyone"}:{kind:"unassigned"}}function P1(e,t,n){let{fn:r,mem:i}=e;return!!r.EPDFForm_HasFieldEmbedMetadata(t,n)&&hY(i,4,e=>r.EPDFForm_GetFieldEmbedMetadataBoolean(t,n,Pq,e)&&0!==i.peek(e,"i32"))}function P3(e,t,n,r){if(P2(e,t,n,[]),!r)return void P6(e,t,n,Pq);if(!e.fn.EPDFForm_SetFieldEmbedMetadataBoolean(t,n,Pq,!0))throw P5(n)}function P2(e,t,n,r){let{fn:i,mem:o}=e;if(!i.EPDFForm_SetFieldEmbedMetadataNumber(t,n,"SchemaVersion",1))throw P5(n);for(let[a,s]of r){if(null===s){P6(e,t,n,a);continue}let r=o.writeU16String(s);try{if(!i.EPDFForm_SetFieldEmbedMetadataString(t,n,a,r))throw P5(n)}finally{o.free(r)}}}function P6(e,t,n,r){if(!e.fn.EPDFForm_ClearFieldEmbedMetadataKey(t,n,r))throw P5(n)}function P5(e){return new N(G.Unknown,`the metadata of field ${e} could not be written`)}var P4={0:"unknown",1:"pushbutton",2:"checkbox",3:"radio",4:"text",5:"combobox",6:"listbox",7:"signature"},P8={0:"none",1:"acroform",2:"xfa"};function P7(e,t){return h3(e.mem,t)??""}function P9(e,t){return h3(e.mem,t,null)}function De(e,t,n,r){let{fn:i}=e;return eR(i.EPDFForm_GetFieldWidgetObjNum(t,n,r),Dl(i.EPDFForm_GetFieldWidgetPageObjNum(t,n,r)))}function Dt(e,t,n){let{fn:r}=e,i=r.EPDFForm_CountFieldWidgets(t,n),o=[];for(let a=0;ar.EPDFForm_GetFieldWidgetOnState(t,n,a,e,i))??"",exportValue:P7(e,(e,i)=>r.EPDFForm_GetFieldWidgetExportValue(t,n,a,e,i)),checked:r.EPDFForm_IsFieldWidgetChecked(t,n,a)});return o}function Dn(e,t,n){let r=e.fn.EPDFForm_CountFieldWidgets(t,n),i=[];for(let o=0;or.EPDFForm_GetFieldOptionLabel(t,n,a,e,i)),value:P7(e,(e,i)=>r.EPDFForm_GetFieldOptionValue(t,n,a,e,i)),selected:r.EPDFForm_IsFieldOptionSelected(t,n,a)});return o}function Di(e,t,n,r,i,o=new F4,a=new PR(e,r)){var s,l;let{fn:u}=e,d=u.EPDFForm_GetFieldObjNum(t,n),c=P7(e,(e,r)=>u.EPDFForm_GetFieldName(t,n,e,r)),f=u.EPDFForm_GetFieldFlags(t,n),m=P4[u.EPDFForm_GetFieldFamily(t,n)]??"unknown",p=Da(e,t,n,!1),h=Da(e,t,n,!0),F=function(e,t,n,r,i){let{fn:o,mem:a}=e,s={};for(let[e,l]of[["keystroke",0],["format",1],["validate",2],["calculate",3]]){let u=F8(o,a,r,o.EPDFForm_GetFieldActionModel(t,n,l),i);u&&(s[e]=u)}return Object.keys(s).length>0?s:void 0}(e,t,n,r,o),g=P0(e,t,n),_={ref:d>0?{kind:"objectNumber",objectNumber:d}:{kind:"fqn",name:c},name:c,kind:m,origin:1===u.EPDFForm_GetFieldOrigin(t,n)?"recovered":"acroform",readOnly:(1&f)!=0,required:(2&f)!=0,noExport:(4&f)!=0,alternateName:P9(e,(e,r)=>u.EPDFForm_GetFieldAlternateName(t,n,e,r)),mappingName:P9(e,(e,r)=>u.EPDFForm_GetFieldMappingName(t,n,e,r)),valueEntry:p,defaultValueEntry:h,...F?{actions:F}:{},groupId:Y(g),assignment:g,lockedBy:null===(s=i?.(c)??null)?null:{signatureIndex:s.signatureIndex,source:s.source},purpose:function(e,t,n){let{fn:r,mem:i}=e;if(!r.EPDFForm_HasFieldEmbedMetadata(t,n))return null;let o=h3(i,(e,i)=>r.EPDFForm_GetFieldEmbedMetadataString(t,n,PH,e,i),null);return rC(o)?o:null}(e,t,n),placeholder:function(e,t,n){let{fn:r,mem:i}=e;if(!r.EPDFForm_HasFieldEmbedMetadata(t,n))return null;let o=h3(i,(e,i)=>r.EPDFForm_GetFieldEmbedMetadataString(t,n,PK,e,i),null);return eN(o)?o:null}(e,t,n),...function(e,t,n){let r,{fn:i,mem:o}=e;if(!i.EPDFForm_HasFieldEmbedMetadata(t,n))return PX;let a=e=>h3(o,(r,o)=>i.EPDFForm_GetFieldEmbedMetadataString(t,n,e,r,o),null);return{createdBy:a(PZ),createdAt:null===(r=a(PJ))?null:hq(r),importedBy:a(PQ)}}(e,t,n),filledBy:null,filledByName:null,filledAt:null,widgets:[]},P=Ds(p),D=Ds(h);switch(m){case"text":{let r=u.EPDFForm_GetFieldMaxLen(t,n);return{..._,kind:m,value:P,defaultValue:D,maxLength:r>0?r:null,multiline:(4096&f)!=0,password:(8192&f)!=0,comb:(0x1000000&f)!=0,format:eb(F),widgets:Dn(e,t,n)}}case"checkbox":{let r=Dt(e,t,n);return{..._,kind:m,checked:r.some(e=>e.checked),exportValue:r[0]?.exportValue??"Yes",hasValuesList:e.fn.EPDFForm_HasFieldValuesList(t,n),widgets:r}}case"radio":{let r=Dt(e,t,n);return{..._,kind:m,value:r.find(e=>e.checked)?.exportValue??"Off",radiosInUnison:(0x2000000&f)!=0,noToggleToOff:(16384&f)!=0,hasValuesList:e.fn.EPDFForm_HasFieldValuesList(t,n),widgets:r}}case"combobox":return{..._,kind:m,value:P,defaultValue:D,edit:(262144&f)!=0,options:Dr(e,t,n),format:eb(F),widgets:Dn(e,t,n)};case"listbox":{let r=Dr(e,t,n);return{..._,kind:m,selectedValues:r.filter(e=>e.selected).map(e=>e.value),defaultValue:"scalar"===(l=h).kind?[l.value]:"array"===l.kind?[...l.values]:[],multiSelect:(2097152&f)!=0,options:r,topIndex:iF(u.EPDFForm_GetFieldTopIndex(t,n),r),widgets:Dn(e,t,n)}}case"pushbutton":{let i=Dn(e,t,n);return{..._,kind:"pushbutton",hasImage:PT(e,r,i,a),takesImage:rW(Pz(e,r,i,a)),widgets:i}}case"signature":return{..._,kind:m,widgets:Dn(e,t,n)};default:return{..._,kind:"unknown",rawValue:"array"===p.kind?p.values.join(","):Ds(p),widgets:Dn(e,t,n)}}}function Do(e,t,n,r){let{fn:i}=e,o=i.EPDFForm_CountFields(t),a=[],s=new F4,l=new PR(e,n);for(let i=0;i=0&&nr?i.EPDFForm_GetFieldDefaultValueAt(t,n,o,e,a):i.EPDFForm_GetFieldValueAt(t,n,o,e,a)));return 1===o?{kind:"scalar",value:s[0]??""}:{kind:"array",values:s}}function Ds(e){return"scalar"===e.kind?e.value:"array"===e.kind?e.values[0]??"":""}function Dl(e){return e>0?q(e):null}var Du={check:"4",cross:"8",star:"H",circle:"l",square:"n",diamond:"u"};function Dd(e,t,n){for(let r of n){if("widget"!==r.subtype)continue;if("objectNumber"!==r.ref.kind){r.caption=null,r.layout=null,r.hasMark=!1;continue}let n=gv(e,t),i=e.fn.EPDFForm_GetFieldIndexForWidget(n,r.ref.objectNumber),o=i<0?0:e.fn.EPDFForm_GetFieldObjNum(n,i);if(o<=0){r.field=null,r.fieldKind="unknown",r.caption=null,r.layout=null,r.hasMark=!1;continue}r.field={kind:"objectNumber",objectNumber:o},r.fieldKind=P4[e.fn.EPDFForm_GetFieldFamily(n,i)]??"unknown",("checkbox"===r.fieldKind||"radio"===r.fieldKind)&&(r.checkStyle=function(e){return Object.keys(Du).find(t=>e?.[0]===Du[t])??null}(r.caption??null)),"pushbutton"!==r.fieldKind&&(r.caption=null,r.layout=null),r.hasMark="signature"===r.fieldKind&&(r.hasMark||0!==e.fn.EPDFForm_GetFieldValueKind(n,i))}}function Dc(e){return 20===e?"widgets":"annotations"}function Df(e){switch(e){case 1:return"multiply";case 2:return"screen";case 3:return"overlay";case 4:return"darken";case 5:return"lighten";case 6:return"color-dodge";case 7:return"color-burn";case 8:return"hard-light";case 9:return"soft-light";case 10:return"difference";case 11:return"exclusion";case 12:return"hue";case 13:return"saturation";case 14:return"color";case 15:return"luminosity";default:return"normal"}}function Dm(e,t,n,r,i,o,a=new F4){let s,l=q(i),u=g9(e,t,r),d=function(e,t){var n=e.FPDFAnnot_GetFlags(t);if(0===n)return{...J};let r={...J};for(let e of g6)r[e]=(n&g2[e])!=0;return r}(e,r),c=g7(e,t,r,"Contents"),f=null===c?null:e2(c,`\n`),m=g7(e,t,r,"Subj"),p=g7(e,t,r,"T"),h=g7(e,t,r,"CreationDate"),F=g7(e,t,r,"M"),g=Df(e.EPDFAnnot_GetBlendMode(r)),_=function(e,t,n){if(!e.EPDFAnnot_HasEmbedMetadata(n))return null;let r=_X(e,t,n,"SchemaVersion"),i=_Q(e,t,n,"UserID"),o=_Q(e,t,n,"GroupID"),a=_Q(e,t,n,"CreatedBy"),s=_Q(e,t,n,"UpdatedBy"),l=_Q(e,t,n,"ImportedBy"),u={};return void 0!==r&&(u.schemaVersion=r),void 0!==i&&(u.userId=i),void 0!==o&&(u.groupId=o),void 0!==a&&(u.createdBy=a),void 0!==s&&(u.modifiedBy=s),void 0!==l&&(u.importedBy=l),u}(e,t,r),P=function(e,t,n,r,i){let o=e.FPDFAnnot_GetLinkedAnnot(r,"IRT");if(!o)return Pa;try{var a;let s=Pl(e,t,n,o,i);if(!s)return Pa;return{inReplyTo:s,replyType:(a=e.EPDFAnnot_GetReplyType(r),2===a?"group":"reply")}}finally{e.FPDFPage_CloseAnnot(o)}}(e,t,n,r,i),D=Ps(e,t,n,r,"Popup",i),b=function(e,t,n,r,i){let o={};for(let[a,s]of[["activate",0],["cursorEnter",1],["cursorExit",2],["mouseDown",3],["mouseUp",4],["focus",5],["blur",6],["pageOpen",7],["pageClose",8],["pageVisible",9],["pageInvisible",10]]){let l=F8(e,t,n,e.EPDFAnnot_GetActionModel(r,s),i);l&&(o[a]=l)}return Object.keys(o).length>0?o:void 0}(e,t,n,r,a);return{ref:gI(e,t,n,l,r,o),page:l,hasAppearance:e.EPDFAnnot_HasAppearanceStream(r,0),appearanceState:_h(e,t,r),structurePosition:(s=e.EPDFAnnot_GetStructurePosition(r,0n,0))<=0?null:hY(t,4*s,n=>(e.EPDFAnnot_GetStructurePosition(r,n,s),Array.from({length:s},(e,r)=>Number(t.peek(n,"i32",4*r))>>>0))),nm:g7(e,t,r,"NM"),...d,rect:u,contents:f,subject:m,author:p,createdAt:h?hq(h):null,modifiedAt:F?hq(F):null,blendMode:g,reply:P.inReplyTo?{to:P.inReplyTo,type:P.replyType??"reply"}:null,popup:D,groupId:_?.groupId??null,userId:_?.userId??null,createdBy:_?.createdBy??null,modifiedBy:_?.modifiedBy??null,importedBy:_?.importedBy??null,actions:b??null}}function Dp(e){let{runtime:t,session:n,pageObjectNumber:r,count:i,getAnnotPtrAt:o,signal:a,fonts:s,family:l}=e,{fn:u,mem:d}=t,c=[],f=new F4,m=gJ(n,s);for(let e=0;ee.includes(t));return t.length===nu.length?void 0:t}(n.modes))?Dh.filter(e=>o.includes(e.name)):Dh,f=this.session.requireDocPtr(),m=q(e),p=[];try{let e=gK(this.runtime,u),o=function(e,t,n){if(void 0===e||"scale"===e.kind){var r;return r=e?.scale,void 0===r||!Number.isFinite(r)||r<=0?1:r}let i=90===n||270===n?t.height:t.width;if(!Number.isFinite(e.width)||e.width<=0||!(i>0))throw new N(G.InvalidArg,"render viewport width must be positive");return e.width/i}(n.viewport,{width:e.right-e.left,height:e.top-e.bottom},d),l=a.FPDFPage_GetAnnotCount(u),h=new g$(i,r);for(let i=0;ie.EPDFAnnot_GetDrawingRect(n,Dg.modeInt,r)?eH(FX(t,r)):null)}(a,s,l);if(!h&&!F)continue;let g=gI(a,s,f,m,l,i),_=eH(g9(a,s,l)),P=_E(a,s,l),D=P&&null!==function(e){let{subtype:t,rect:n,box:r,rotation:i,intent:o}=e;return nz.has(t)&&r&&i&&("free-text"!==t||"free-text-callout"!==o)&&eY(eJ(r,i),n)?i:null}({subtype:rN(r),rect:_,box:P.box,rotation:P.rotation,intent:3===r?_z(_f(a,s,l)):null})?P:void 0,b=D?eH(D.box):_;for(let t of c){let r=!!(h&t.bit),i=r?b:t===Dg?F:null;if(i)for(let c of r?function(e,t,n,r){let i=function(e,t,n,r){let i=[],o=e.EPDFAnnot_GetAppearanceStateCount(n,r);for(let a=0;ae.EPDFAnnot_GetAppearanceStateName(n,r,a,t,i));null!==o&&i.push(o)}return i}(e,t,n,r);return 0===i.length?D_:i.length>8?[{draw:"",label:_h(e,t,n)}]:i.map(e=>({draw:e,label:e}))}(a,s,l,t.modeInt):D_){let a=this.renderOne(u,l,t.modeInt,c.draw,i,e,d,o,r?D:void 0,n.maxOutputPixels);a&&p.push({ref:g,mode:t.name,state:c.label,rect:i,raster:a})}}}finally{a.FPDFPage_CloseAnnot(l)}}return{page:m,appearances:p}}finally{l.release(e)}}renderOne(e,t,n,r,i,o,a,s,l,u){let{fn:d}=this.runtime,c=Math.min(s,Math.sqrt(16e6/Math.max(1,(i.right-i.left)*(i.top-i.bottom))));return function(e,t){let n=gH(e,t);if(!n)return null;try{return t.draw(n.bitmapPtr,n.matrixPtr,n.clipPtr)?n.read():null}finally{n.free()}}(this.runtime,{rect:i,page:o,rotation:a,viewport:{kind:"scale",scale:c},...void 0!==u?{maxOutputPixels:u}:{},background:"transparent",draw:(i,o)=>l?hY(this.runtime.mem,16,a=>(FY(this.runtime.mem,a,l.box),d.EPDF_RenderAnnotBitmapUnrotated(i,e,t,n,r,_g(l.rotation),a,o,16))):d.EPDF_RenderAnnotBitmap(i,e,t,n,r,o,16)})}},Dg=Dh[0],D_=[{draw:"",label:null}],DP=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}list(e,t,n){hW(t),void 0===e&&(this.session.ensureFullPageRegistry(),e=this.session.allRecords().map(e=>e.pageObjectNumber));let r=[];for(let i of e)hW(t),r.push(this.listOne(i,t,n));return{annotations:r.flatMap(e=>e.annotations),pages:r.flatMap(e=>e.pages)}}listOne(e,t,n){hW(t);let{fn:r}=this.runtime,i=this.session.requireDocPtr(),o=this.session.recordByObjectNumber(e),a=r.EPDFPage_GetAnnotCountRaw(i,o.pageIndex);if(a<0)throw new N(G.Unknown,`EPDFPage_GetAnnotCountRaw returned ${a} for page ${e}`);return Dp({runtime:this.runtime,session:this.session,pageObjectNumber:e,count:a,getAnnotPtrAt:e=>r.EPDFPage_GetAnnotRaw(i,o.pageIndex,e),signal:t,...this.fonts?{fonts:this.fonts}:{},...n?{family:n}:{}})}};function DD(e,t,n,r){return h0(t,[32,8],([i,o])=>{if(t.poke(o,"i32",32,0),t.poke(o,"i32",0,4),!e.EPDF_DigestBuffer(n,r,1,i,o))throw new N(G.Unknown,"EPDF_DigestBuffer returned false");let a="";for(let e of t.readBytes(i,32))a+=e.toString(16).padStart(2,"0");return a})}function Db(e,t,n){let r=t.alloc(Math.max(1,n.byteLength));try{return t.writeBytes(r,n),DD(e,t,r,n.byteLength)}finally{t.free(r)}}function Dy(e,t,n,r,i,o){let a=r.hashes.get(i),s=void 0===a?void 0:r.bySource.get(a);if(void 0!==s)return s;let l=t.alloc(i.byteLength);try{t.writeBytes(l,new Uint8Array(i));let s=a??DD(e,t,l,i.byteLength);r.hashes.set(i,s);let u=r.bySource.get(s);if(void 0!==u)return u;let d=function(e,t,n,r,i,o){if("application/pdf"===i.mimeType){let t=e.FPDF_LoadMemDocument(n,r,"");if(!t)throw new N(G.MalformedPdf,"the appearance PDF could not be opened");try{return o(t)}finally{e.FPDF_CloseDocument(t)}}return function(e,t,n,r,i,o){if(!("width"in i))throw new N(G.InvalidArg,"the appearance image has no size");let a=Math.min(1,14400/Math.max(i.width,i.height)),s=i.width*a,l=i.height*a,u=e.FPDF_CreateNewDocument();if(!u)throw new N(G.Unknown,"FPDF_CreateNewDocument returned NULL");try{let a=e.FPDFPage_New(u,0,s,l);if(!a)throw new N(G.Unknown,"FPDFPage_New returned NULL");try{let o=e.FPDFPageObj_NewImageObj(u);if(!o)throw new N(G.Unknown,"FPDFPageObj_NewImageObj returned NULL");let h=!1;try{var d,c,f,m,p;if(!("image/png"===i.mimeType?e.EPDFImageObj_SetPng(0n,0,o,n,r):e.EPDFImageObj_SetJpeg(0n,0,o,n,r)))throw new N(G.InvalidArg,`${"image/png"===i.mimeType?"EPDFImageObj_SetPng":"EPDFImageObj_SetJpeg"} rejected the image data`);d=e,c=t,f=o,m=s,p=l,hY(c,24,e=>{if(c.poke(e,"f32",m,0),c.poke(e,"f32",0,4),c.poke(e,"f32",0,8),c.poke(e,"f32",p,12),c.poke(e,"f32",0,16),c.poke(e,"f32",0,20),!d.FPDFPageObj_SetMatrix(f,e))throw new N(G.Unknown,"FPDFPageObj_SetMatrix returned false")}),e.FPDFPage_InsertObject(a,o),h=!0}finally{h||e.FPDFPageObj_Destroy(o)}if(!e.FPDFPage_GenerateContent(a))throw new N(G.Unknown,"FPDFPage_GenerateContent returned false")}finally{e.FPDF_ClosePage(a)}return o(u)}finally{e.FPDF_CloseDocument(u)}}(e,t,n,r,i,o)}(e,t,l,i.byteLength,o,t=>e.EPDFDoc_CanonicalDrawing(t,0));if(!d)throw new N(G.Unknown,"EPDFDoc_CanonicalDrawing returned NULL");try{let i=Dw(e,t,d),o=function(e,t,n,r){if(r.byContent)return r.byContent;let i=new Map,o=e.EPDFDoc_GetDrawings(n,0n,0);for(let r of o>0?hY(t,4*o,r=>(e.EPDFDoc_GetDrawings(n,r,o),Array.from({length:o},(e,n)=>Number(t.peek(r,"i32",4*n))>>>0))):[]){let o=e.EPDFDoc_ExportDrawing(n,r);if(o)try{let n=Dw(e,t,o);i.has(n)||i.set(n,r)}finally{e.FPDF_CloseDocument(o)}}return r.byContent=i,i}(e,t,n,r),a=o.get(i);if(void 0===a){if(!(a=e.EPDFDoc_ImportDrawing(n,d)))throw new N(G.Unknown,"EPDFDoc_ImportDrawing returned 0");o.set(i,a)}return r.bySource.set(s,a),a}finally{e.FPDF_CloseDocument(d)}}finally{t.free(l)}}function Dw(e,t,n){return hY(t,8,r=>{t.poke(r,"i32",0,0),t.poke(r,"i32",0,4);let i=e.EPDF_SaveDocumentToOwnedBuffer(n,2,r),o=Number(t.peek(r,"i32",0));if(!i||o<=0)throw i&&e.EPDF_FreeBuffer(i),new N(G.Unknown,"failed to save a stamp drawing");try{return DD(e,t,i,o)}finally{e.EPDF_FreeBuffer(i)}})}function DE(e,t,n){let r=t.alloc(n.byteLength);try{t.writeBytes(r,new Uint8Array(n));let i=e.FPDF_LoadMemDocument(r,n.byteLength,"");if(!i)return null;try{return e.FPDF_GetPageCount(i)}finally{e.FPDF_CloseDocument(i)}}finally{t.free(r)}}function DA(e,t,n,r=0){let{r:i,g:o,b:a}=e9(n);if(!e.EPDFAnnot_SetColor(t,r,i,o,a))throw new N(G.Unknown,"EPDFAnnot_SetColor returned false")}function Dv(e,t,n){e.EPDFAnnot_ClearColor(t,n)}function DS(e,t,n){if(!e.EPDFAnnot_SetOpacity(t,n))throw new N(G.Unknown,"EPDFAnnot_SetOpacity returned false")}function Dk(e,t,n){let r=function(e,t){let n=e;for(let e of g6){let r=t[e];void 0!==r&&(r?n|=g2[e]:n&=~g2[e])}return n}(e.FPDFAnnot_GetFlags(t),n);if(!e.FPDFAnnot_SetFlags(t,r))throw new N(G.Unknown,"FPDFAnnot_SetFlags returned false")}function Dx(e,t,n,r){let i=t.alloc(16);try{if(t.poke(i,"f32",r.left,0),t.poke(i,"f32",r.top,4),t.poke(i,"f32",r.right,8),t.poke(i,"f32",r.bottom,12),!e.EPDFAnnot_SetRect(n,i))throw new N(G.Unknown,"EPDFAnnot_SetRect returned false")}finally{t.free(i)}}function DG(e,t,n,r,i){let o=t.writeU16String(i);try{e.FPDFAnnot_SetStringValue(n,r,o)}finally{t.free(o)}}function DO(e,t,n,r,i){null===i?e.EPDFAnnot_RemoveKey(n,r):DG(e,t,n,r,i)}function DI(e,t,n,r){if(!e.EPDFAnnot_SetBorderStyle(t,n,r))throw new N(G.Unknown,"EPDFAnnot_SetBorderStyle returned false")}function DN(e,t,n,r){let i=t.alloc(4*r.length);try{for(let e=0;ee.FPDFAnnot_AddInkStroke(n,r,i.length))throw new N(G.Unknown,"FPDFAnnot_AddInkStroke returned < 0")}finally{t.free(r)}}}function DL(e,t,n){if(!e.EPDFAnnot_SetLineEndings(t,g4(n.start),g4(n.end)))throw new N(G.Unknown,"EPDFAnnot_SetLineEndings returned false")}function D$(e,t,n,r,i){let{r:o,g:a,b:s}=e9(i);if(!e.EPDFAnnot_SetDefaultAppearance(t,n,r,o,a,s))throw new N(G.Unknown,"EPDFAnnot_SetDefaultAppearance returned false")}function Dz(e,t,n){if(!e.EPDFAnnot_SetTextAlignment(t,n))throw new N(G.Unknown,"EPDFAnnot_SetTextAlignment returned false")}function DU(e,t,n){if(!e.EPDFAnnot_SetIntent(t,n))throw new N(G.Unknown,"EPDFAnnot_SetIntent returned false")}function DV(e,t,n){null===n?e.EPDFAnnot_RemoveKey(t,"IT"):DU(e,t,n)}function DW(e,t,n,r){let i=t.writeU16String(r);try{if(!e.EPDFAnnot_SetOverlayText(n,i))throw new N(G.Unknown,"EPDFAnnot_SetOverlayText returned false")}finally{t.free(i)}}function Dq(e,t,n){if(!e.EPDFAnnot_SetOverlayTextRepeat(t,n))throw new N(G.Unknown,"EPDFAnnot_SetOverlayTextRepeat returned false")}function DH(e,t,n,r){let i=t.alloc(8*r.length);try{for(let e=0;etv({x:e.x+n,y:e.y+r},{x:t[i].x,y:t[i].y}))?{dx:n,dy:r}:void 0}function D1(e,t,n,{dx:r,dy:i}){let o=eH(g9(e,t,n));Dx(e,t,n,{left:o.left+r,bottom:o.bottom+i,right:o.right+r,top:o.top+i})}var D3="Rotation",D2="UnrotatedRect";function D6(e,t){e.EPDFAnnot_HasEmbedMetadata(t)||e.EPDFAnnot_SetEmbedMetadataNumber(t,"SchemaVersion",1)}function D5(e,t,n){D6(e,t),e.EPDFAnnot_SetEmbedMetadataNumber(t,D3,_g(n))}var D4=new Set([90,180,270]);function D8(e,t,n,r){D6(e,n);let i=t.alloc(16);try{t.poke(i,"f32",r.left,0),t.poke(i,"f32",r.top,4),t.poke(i,"f32",r.right,8),t.poke(i,"f32",r.bottom,12),e.EPDFAnnot_SetEmbedMetadataRect(n,D2,i)}finally{t.free(i)}}function D7(e,t,n,r){var i;let o;r?(D5(e,n,r.rotation),D8(e,t,n,r.box)):(e.EPDFAnnot_ClearEmbedMetadataKey(n,D3),e.EPDFAnnot_ClearEmbedMetadataKey(n,D2)),i=r?.rotation??null,o=e.FPDFAnnot_GetSubtype(n),null!==i&&(13===o||3===o&&D4.has(i))?e.EPDFAnnot_SetRotate(n,_g(i)):(13===o||3===o)&&e.EPDFAnnot_SetRotate(n,0)}var D9=e=>(e%360+360)%360;function be(e,t,n,r){let i=eH(r.box),o=r.rotation||null;D7(e,t,n,null===o?null:{rotation:o,box:i}),Dx(e,t,n,null===o?i:eJ(i,o)),e.EPDFAnnot_ClearRectangleDifferences(n)}function bt(e,t,n,r){var i;if(void 0===r.box&&void 0===r.rotation)return!1;let o=_A(e,t,n),a=eH(r.box??o.box),s=void 0===r.rotation?o.rotation:r.rotation||null,l=(i=o.rotation,null===s||null===i?s===i:tv(D9(s),D9(i)));if(l&&tv(a,o.box))return!1;let u=a.right-a.left,d=a.top-a.bottom;return l&&tv(u,o.box.right-o.box.left)&&tv(d,o.box.top-o.box.bottom)?(D1(e,t,n,{dx:a.left-o.box.left,dy:a.bottom-o.box.bottom}),null!==s&&D7(e,t,n,{rotation:s,box:a})):be(e,t,n,{box:a,rotation:s}),!0}var bn=t5.caret,br=t5["file-attachment"];function bi(e){return"file-attachment"===e}function bo(e,t,n){if(!e.EPDFAnnot_SetName(t,_B[n]))throw new N(G.Unknown,"EPDFAnnot_SetName returned false")}function ba(e,t,n,r){let i,o=t.writeU16String(r);try{i=e.FPDFAnnot_AddFileAttachment(n,o)}finally{t.free(o)}if(!i)throw new N(G.Unknown,"FPDFAnnot_AddFileAttachment returned NULL");return i}function bs(e){let t=e?.resources?.file;if(void 0===t)throw new N(G.InvalidArg,"creating a file-attachment annotation needs its \'file\' resource");return t}function bl(e){if(e?.docPtr===void 0)throw new N(G.Unknown,"file-attachment writer requires docPtr on the write context");return e.docPtr}function bu(e,t,n,r,i,o){if(Object.prototype.hasOwnProperty.call(_U,n))return void D$(e,t,_U[n]??_U.helvetica,r,i);if(o?.resolveRegisteredFontId&&o.describeRegisteredFont?.(n))return void function(e,t,n,r,i){let{r:o,g:a,b:s}=e9(i);if(!e.EPDFAnnot_SetDefaultAppearanceRegisteredFont(t,n,r,o,a,s))throw new N(G.Unknown,"EPDFAnnot_SetDefaultAppearanceRegisteredFont returned false")}(e,t,o.resolveRegisteredFontId(n),r,i);let a=o?.resolveDocumentFont?.(n);if(a){if(!a.choosable)throw new N(G.InvalidArg,`\'${n}\' can\'t be chosen for new text (${a.restrictions.join(", ")})`,{details:{field:"fontFamily",restrictions:a.restrictions}});!function(e,t,n,r,i){let{r:o,g:a,b:s}=e9(i);if(!e.EPDFAnnot_SetDefaultAppearanceDocumentFont(t,n,r,o,a,s))throw new N(G.InvalidArg,"EPDFAnnot_SetDefaultAppearanceDocumentFont refused the program")}(e,t,a.objectNumber,r,i);return}throw new N(G.InvalidArg,`fontFamily \'${n}\' is not a standard font, one of the engine\'s fonts or one of the document\'s`,{details:{field:"fontFamily"}})}function bd(e,t,n,r){let i=t5[r.subtype];bc(e,n,void 0===r.color?i.color:r.color),DS(e,n,r.opacity??i.opacity),bf(e,t,n,r)}function bc(e,t,n){null===n?function(e,t,n=0){if(!e.EPDFAnnot_SetNoColor(t,n))throw new N(G.Unknown,"EPDFAnnot_SetNoColor returned false")}(e,t):DA(e,t,n)}function bf(e,t,n,r){let i=t5[r.subtype];DI(e,n,_Y(r.borderStyle??i.borderStyle),r.strokeWidth??i.strokeWidth),null!=r.dashArray&&r.dashArray.length>0&&DN(e,t,n,r.dashArray)}function bm(e,t,n,r){void 0!==r.color&&bc(e,n,r.color),void 0!==r.opacity&&DS(e,n,r.opacity),bp(e,t,n,r)}function bp(e,t,n,r){if(void 0!==r.borderStyle||void 0!==r.strokeWidth){let i=_r(e,t,n),o=r.borderStyle??_0(i.styleCode),a=r.strokeWidth??i.width;DI(e,n,_Y(o),a)}null===r.dashArray||r.dashArray?.length===0?DC(e,n):void 0!==r.dashArray&&DN(e,t,n,r.dashArray)}function bh(e,t,n,r){let i=r.interiorColor??null;null===i?Dv(e,n,1):DA(e,n,i,1),bd(e,t,n,r)}function bF(e,t,n,r){void 0!==r.interiorColor&&(null===r.interiorColor?Dv(e,n,1):DA(e,n,r.interiorColor,1)),bm(e,t,n,r)}var bg=t5["free-text"];function b_(e,t,n,r,i){let o=gX(n,{describe:r?.describeFont,programOf:r?.documentProgramOf,bodyProgram:void 0===i?void 0:r?.documentProgramOf?.(i)});if(!e.EPDFAnnot_SetRichTextJSON(t,o))throw new N(G.InvalidArg,"rich text could not be written (empty rect, or a font resource could not be built)")}function bP(e,t,n){if(!e.EPDFAnnot_SetEmbedMetadataNumber(t,"VerticalAlignment",_Z.indexOf(n)))throw new N(G.Unknown,"EPDFAnnot_SetEmbedMetadataNumber returned false")}function bD(e){return"free-text"===e}var bb=e=>(e%360+360)%360;function by(e,t,n,r,i){let o,a=r.flat(),s=null===i||0===a.length?null:{degrees:i,center:{x:((o=e0(a)).left+o.right)/2,y:(o.bottom+o.top)/2}};return D7(e,t,n,s?{rotation:s.degrees,box:e0(a)}:null),{drawn:r.map(e=>e.map(e=>s?e1(e,s):e)),turn:s}}function bw(e,t,n,r,i){let o=by(e,t,n,r,i||null);return Dx(e,t,n,e0(o.drawn.flat())),o}function bE(e,t,n){let r=function(e,t,n){switch(e.FPDFAnnot_GetSubtype(n)){case 4:{let r=_s(e,t,n);return r?[[r.start,r.end]]:[]}case 7:case 8:return[_o(e,t,n)];case 15:return _a(e,t,n).map(e=>[...e]);default:return[]}}(e,t,n),i=_5(e,t,n,r);return{drawn:r,turn:i,upright:r.map(e=>e.map(e=>_4(e,i)))}}function bA(e,t,n,r,i,o){if(void 0===i&&void 0===o)return;let a=r.turn?.degrees??null,s=void 0===o?a:o||null,l=tv(bb(s??0),bb(a??0));if(void 0===i&&l)return;let u=by(e,t,n,i??r.upright,s),d=D0(r.drawn.flat(),u.drawn.flat());return d&&D1(e,t,n,d),u}function bv(e,t,n,r){if(void 0!==r.intent&&(null===r.intent?e.EPDFAnnot_RemoveKey(n,"IT"):gr(e.EPDFAnnot_SetIntent(n,_7[r.intent]))),void 0!==r.measure)if(null===r.measure)gr(e.EPDFAnnot_RemoveMeasure(n));else{let i=e.EPDFAnnot_GetMeasure(n);i&&1!==e.EPDFMeasure_GetSubtype(i)&&gr(e.EPDFAnnot_RemoveMeasure(n)),gs(e,t,e.EPDFAnnot_AddMeasure(n),r.measure)}if("line"===r.subtype){if(void 0!==r.leader&&gr(e.EPDFAnnot_SetLineLeader(n,r.leader?.length??0,r.leader?.extension??0,r.leader?.offset??0)),void 0!==r.captionEnabled){let i=r.captionOffset??null;gr(go(t,i?{x:i.along,y:i.perpendicular}:void 0,t=>e.EPDFAnnot_SetLineCaption(n,r.captionEnabled??!1,+("top"===r.captionPosition),t)))}}else if(void 0!==r.captionEnabled)if(null===r.captionEnabled)e.EPDFAnnot_ClearEmbedMetadataKey(n,"MeasurementCaption"),e.EPDFAnnot_ClearEmbedMetadataKey(n,"MeasurementCaptionCenter");else{let i=r.captionEnabled;gr(go(t,("captionCenter"in r?r.captionCenter:null)??void 0,t=>e.EPDFAnnot_SetShapeCaption(n,i,t)))}}function bS(e,t,n,r,i){let o=i?.docPtr;if(!o)throw new N(G.InvalidArg,"writing a link target requires a document pointer on the write context");let a=Pi(e,t,o,r);if(!e.EPDFAnnot_SetAction(n,a))throw new N(G.Unknown,"EPDFAnnot_SetAction failed for link")}function bk(e,t,n){if(!e.EPDFAnnot_SetBooleanValue(t,"Open",n))throw new N(G.Unknown,"EPDFAnnot_SetBooleanValue returned false")}var bx=e=>[e.upperLeft,e.upperRight,e.lowerLeft,e.lowerRight];function bG(e){return"highlight"===e||"underline"===e||"squiggly"===e||"strikeout"===e}function bO(e,t,n,r){let i=t.alloc(32);try{for(let l of r){var o,a,s;if(o=t,a=i,s=l,o.poke(a,"f32",s.upperLeft.x,0),o.poke(a,"f32",s.upperLeft.y,4),o.poke(a,"f32",s.upperRight.x,8),o.poke(a,"f32",s.upperRight.y,12),o.poke(a,"f32",s.lowerLeft.x,16),o.poke(a,"f32",s.lowerLeft.y,20),o.poke(a,"f32",s.lowerRight.x,24),o.poke(a,"f32",s.lowerRight.y,28),!e.FPDFAnnot_AppendAttachmentPoints(n,i))throw new N(G.Unknown,"FPDFAnnot_AppendAttachmentPoints returned false")}}finally{t.free(i)}}function bI(e,t,n,r){e.EPDFAnnot_RemoveKey(n,"QuadPoints"),bO(e,t,n,r)}function bN(e,t,n,r){let i=1/0,o=1/0,a=-1/0,s=-1/0;for(let e of r)for(let t of[e.upperLeft,e.upperRight,e.lowerLeft,e.lowerRight])t.xa&&(a=t.x),t.ys&&(s=t.y);Dx(e,t,n,{left:i,top:s,right:a,bottom:o})}var bC=t5.redact;function bj(e){return void 0!==e.overlayText&&null!==e.overlayText||void 0!==e.fontFamily||void 0!==e.fontSize||void 0!==e.fontColor}function bM(e){return"redact"===e}function bR(e){return"circle"===e||"square"===e}function bT(e){return"stamp"===e}function bB(e,t,n){if(!e.EPDFAnnot_SetName(t,n))throw new N(G.Unknown,"EPDFAnnot_SetName returned false")}function bL(e){if(0===e.length)throw new N(G.InvalidArg,"stamp name must be non-empty")}function b$(e){if(void 0===Pg[e])throw new N(G.InvalidArg,`unknown stamp fit \'${String(e)}\'; expected contain, cover, or fill`)}function bz(e){let t=e?.resources?.appearance;if(!t)throw new N(G.InvalidArg,"creating a stamp annotation needs its \'appearance\' resource");return t}function bU(e,t){e||bz(t);let n=e instanceof ArrayBuffer?nx(e):null;if(!n)throw new N(G.InvalidArg,"the appearance resource must be PNG, JPEG or one-page PDF bytes");if("application/pdf"===n.mimeType){let n=t?.pdfPageCount?.(e);if(null===n)throw new N(G.MalformedPdf,"the stamp\'s appearance PDF could not be opened");if(void 0!==n&&1!==n)throw new N(G.InvalidArg,`the appearance PDF has ${n} pages; a stamp takes a one-page PDF`)}bV(t)}function bV(e){if(e?.docPtr===void 0||!e.drawings)throw new N(G.Unknown,"stamp writer requires docPtr/drawings on the write context");return{docPtr:e.docPtr,drawings:e.drawings}}function bW(e,t,n,r,i,o,a){be(e,t,n,{box:a.box,rotation:null}),function(e,t,n,r,i,o){let a=nx(r);if(!a)throw new N(G.Unknown,"stamp content preflight invariant broken");let s=Dy(e,t,i.docPtr,i.drawings,r,a);if(!e.EPDFAnnot_SetDrawing(n,s,Pg[o]))throw new N(G.Unknown,"EPDFAnnot_SetDrawing returned false")}(e,t,n,r,i,o),a.rotation&&(be(e,t,n,a),Pb(e,n,o))}var bq=t5.text;function bH(e,t,n){if(!e.EPDFAnnot_SetBooleanValue(t,"Open",n))throw new N(G.Unknown,"EPDFAnnot_SetBooleanValue returned false")}function bK(e,t,n){if(!e.EPDFAnnot_SetName(t,_R[n]))throw new N(G.Unknown,"EPDFAnnot_SetName returned false")}var bZ=(e,t)=>t?e1(e,t):e;function bJ(e,t){return e.captionCenter?{...e,captionCenter:bZ(e.captionCenter,t.turn)}:e}function bQ(e,t,n,r){let i=bE(e,t,n),o=bA(e,t,n,i,r.vertices&&[r.vertices],r.rotation);bv(e,t,n,function(e,t,n,r,i,o){let a=o?o.turn:i.turn;if(r.captionCenter)return{...r,captionCenter:bZ(r.captionCenter,a)};if(!o||void 0!==r.captionEnabled)return r;let s=Pe(e,t,n);return s?.center?{...r,captionEnabled:s.enabled,captionCenter:bZ(_4(s.center,i.turn),a)}:r}(e,t,n,r,i,o)),o&&DR(e,t,n,o.drawn[0])}function bX(e){return"polygon"===e||"polyline"===e}function bY(e){return"widget"===e}function b0(e,t,n,r,i){var o,a;if(null===r.color)e.EPDFAnnot_ClearMKColor(n,0);else if(r.color){let{r:t,g:i,b:o}=e9(r.color);e.EPDFAnnot_SetMKColor(n,0,t,i,o)}if(null===r.interiorColor)e.EPDFAnnot_ClearMKColor(n,1);else if(r.interiorColor){let{r:t,g:i,b:o}=e9(r.interiorColor);e.EPDFAnnot_SetMKColor(n,1,t,i,o)}if(void 0!==r.strokeWidth||void 0!==r.borderStyle){let i=_r(e,t,n);e.EPDFAnnot_SetBorderStyle(n,"underline"===(o=r.borderStyle??_1(i.styleCode))?5:_Y(o),r.strokeWidth??i.width)}null===r.dashArray?DC(e,n):void 0!==r.dashArray&&DN(e,t,n,r.dashArray),(void 0!==r.fontFamily||void 0!==r.fontSize||void 0!==r.fontColor)&&function(e,t,n,r,i){let o=_u(e,t,n);if([r.fontFamily,r.fontSize,r.fontColor].includes(null)&&null!==o)throw new N(G.InvalidArg,"a widget\'s font can\'t be removed: send a font, or leave the font fields out",{details:{field:"fontFamily"}});let a=r.fontFamily??void 0,s=r.fontSize??void 0,l=r.fontColor??void 0;if(void 0===a&&void 0===s&&void 0===l)return;let u=s??o?.fontSize??12,d=l??o?.color??"#000000";null!==o&&(void 0===a||function(e,t,n,r,i){let o=_d(e,t,n);if(!o)return!1;if(_J(e,t,n,o)===r)return!0;let a=eU(r,i?.describeFont);return eV(a.family)===eV(o.family)&&(void 0===a.weight||a.weight===o.weight)&&(void 0===a.italic||a.italic===o.italic)}(e,t,n,a,i))?D$(e,n,-1,u,d):bu(e,n,a??"helvetica",u,d,i)}(e,t,n,r,i),void 0!==r.textAlign&&e.EPDFAnnot_SetTextAlignment(n,_H(r.textAlign));let s=void 0!==r.checkStyle?r.checkStyle&&Du[r.checkStyle]:r.caption;if(null===s?e.EPDFAnnot_SetMKText(n,0,0n):void 0!==s&&h5(t,s,t=>e.EPDFAnnot_SetMKText(n,0,t)),r.layout&&!e.EPDFAnnot_SetMKTextPosition(n,(a=r.layout,Px.indexOf(a))))throw new N(G.Unknown,"the widget\'s layout (/MK /TP) could not be written")}function b1(e,t,n){if(!e.EPDFAnnot_SetMKRotation(t,(360-(n??0))%360))throw new N(G.Unknown,"the widget\'s turn (/MK /R) could not be written")}function b3(e,t,n,r,i){let o=eH(r.box),a=r.rotation?eJ(o,r.rotation):o;i&&r.rotation===i.rotation||b1(e,n,r.rotation),i&&tv(a,i.rect)||Dx(e,t,n,a)}function b2(e,t,n,r){if("free-text"===n.subtype||void 0===n.richText)return;if(null===n.richText)return void e.EPDFAnnot_RemoveKey(t,"RC");let i=gX(function(e){if(e.body?.family!==e6.family)return e;let{family:t,...n}=e.body;return{...e,body:n}}(n.richText),{describe:r?.describeFont});if(!e.EPDFAnnot_SetRichTextJSON(t,i))throw new N(G.InvalidArg,`${n.subtype}: the comment\'s rich text could not be written`)}function b6(e){if(void 0===e.subtype)throw new N(G.InvalidArg,"a patch reached the writer without its subtype");return e.subtype}function b5(e,t,n,r){let{fn:i,mem:o}=e,a=o.writeU16String(r);try{return i.EPDFPage_GetAnnotIndexByNameRaw(t,n,a)}finally{o.free(a)}}function b4(e,t){return new N(G.InvalidArg,`nm \'${e}\' is already used on page ${t}`,{details:{field:"nm"}})}function b8(e,t,n,r,i,o){let a=Dm(e,t,o.docPtr,n,r,i),s=e.FPDFAnnot_GetSubtype(n),{reader:l}=PN(s);return l(e,t,n,a,s,o)}function b7(e,t,n){return void 0===n?e.EPDFAnnot_GenerateAppearance(t):e.EPDFAnnot_GenerateAppearanceWithBlend(t,function(e){switch(e){case"normal":return 0;case"multiply":return 1;case"screen":return 2;case"overlay":return 3;case"darken":return 4;case"lighten":return 5;case"color-dodge":return 6;case"color-burn":return 7;case"hard-light":return 8;case"soft-light":return 9;case"difference":return 10;case"exclusion":return 11;case"hue":return 12;case"saturation":return 13;case"color":return 14;case"luminosity":return 15}}(n))}function b9(e,t,n,r){let{fn:i}=e;if(!i.EPDFAnnot_SetLinkedAnnot(t,"IRT",n))throw new N(G.Unknown,"failed to set /IRT linked annotation");i.EPDFAnnot_SetReplyType(t,Po(r))}function ye(e,t,n){let{fn:r}=e;if(function(e,t,n){let{fn:r}=e,i=r.FPDFAnnot_GetLinkedAnnot(n,"Popup");if(!i)return;let o=r.EPDFAnnot_GetObjectNumber(i);if(r.FPDFPage_CloseAnnot(i),o!==r.EPDFAnnot_GetObjectNumber(t))throw new N(G.InvalidArg,`the annotation already has a popup (object ${o}); delete it first`,{details:{field:"parent",popupObjectNumber:o}})}(e,t,n),!r.EPDFAnnot_SetLinkedAnnot(t,"Parent",n)||!r.EPDFAnnot_SetLinkedAnnot(n,"Popup",t))throw new N(G.Unknown,"failed to link a popup to its parent");!function(e,t,n){let{fn:r,mem:i}=e;if(1!==r.FPDFAnnot_GetSubtype(n))return;let o=_t(r,i,t,"Open");if(null!==o)return yt(e,n,o);let a=_t(r,i,n,"Open");null!==a&&yt(e,t,a)}(e,t,n)}function yt(e,t,n){if(!e.fn.EPDFAnnot_SetBooleanValue(t,"Open",n))throw new N(G.Unknown,"EPDFAnnot_SetBooleanValue returned false")}function yn(e,t){let{mem:n}=e,r=t(0n,0);return r<=0?[]:hY(n,8*r,e=>(t(e,r),Array.from({length:r},(t,r)=>({start:Number(n.peek(e,"i32",8*r))>>>0,count:Number(n.peek(e,"i32",8*r+4))>>>0}))))}var yr={0:null,1:"truetype",2:"opentype",3:"cff",4:"type1",5:"type3"},yi={0:"none",1:"whole",2:"subset"},yo={0:"installable",1:"editable",2:"preview-and-print",3:"restricted",4:"bitmap-only"},ya={0:"standard",1:"engine",2:"document-program",3:"document-font"},ys=e=>Array.from(e,e=>e.toString(16).padStart(2,"0")).join(""),yl=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}facts(){return{faces:this.faces(),engineFonts:this.fonts.engineFontFacts(),fallbacks:this.fonts.fallbackKeys()}}faces(){return yu(this.runtime,this.session)}resolve(e,t,n){let{fn:r,mem:i}=this.runtime,o=t.map(e=>this.faceOfRun(e,n)),a=t.map(e=>i.writeU16String(e.text)),s=o.map(e=>i.writeU16String(e.family)),l=e?this.openAnnotation(e):0n;try{let e=gc(this.runtime,a,e=>gc(this.runtime,s,n=>h1(i,o.map(e=>e.weight),a=>h1(i,o.map(e=>+!!e.italic),s=>h1(i,o.map(e=>e.program),i=>r.EPDFDoc_ResolveFonts(this.session.requireDocPtr(),l,t.length,e,n,a,s,i))))));if(!e)throw new N(G.Unknown,"EPDFDoc_ResolveFonts failed");try{return this.readResolution(e,t.length)}finally{r.EPDFFontResolution_Close(e)}}finally{for(let e of(l&&r.FPDFPage_CloseAnnot(l),[...a,...s]))i.free(e)}}readResolution(e,t){let{fn:n,mem:r}=this.runtime,i=[];for(let o=0;o(n.EPDFFontResolution_GetFallbacks(e,o,t,a),Array.from({length:a},(e,n)=>Number(r.peek(t,"i32",4*n))>>>0)));i.push({source:ya[n.EPDFFontResolution_GetSource(e,o)]??"standard",engineFont:t?this.fonts.keyForId(t)??null:null,objectNumber:n.EPDFFontResolution_GetProgramObjNum(e,o),displaySha256:hY(r,32,t=>n.EPDFFontResolution_GetProgramDisplayHash(e,o,t)?ys(r.readBytes(t,32)):null),baseFontName:h2(r,(t,r)=>n.EPDFFontResolution_GetBaseFontName(e,o,t,r))||null,familyName:h3(r,(t,r)=>n.EPDFFontResolution_GetFamily(e,o,t,r))??"",weight:n.EPDFFontResolution_GetWeight(e,o),italic:n.EPDFFontResolution_IsItalic(e,o),degraded:n.EPDFFontResolution_IsDegraded(e,o),fallbacks:s.flatMap(e=>{let t=this.fonts.keyForId(e);return t?[t]:[]})})}let o=[],a=n.EPDFFontResolution_CountMissingCharacters(e);for(let t=0;tn.EPDFFontResolution_GetMissingCharacter(e,t,r,i));i&&o.push(i)}return{runs:i,missingCharacters:o}}faceOfRun(e,t){if(!("fontFamily"in e))return{family:e.family,weight:e.weight,italic:e.italic,program:0};let n=e.fontFamily;if(Z.includes(n)){let e=ez[n];return{family:e.family,weight:e.weight,italic:e.italic,program:0}}let r=this.fonts.describeOrUndefined(n);if(r){let{familyName:e,weight:t,italic:n}=r;return{family:e,weight:t,italic:n,program:0}}let i=av(t.faces).find(e=>e.name===n);if(i){let{familyName:e,weight:r,italic:o}=i.face,a=aG(t,n);return{family:e,weight:r,italic:o,program:a?.choosable?a.objectNumber:0}}let o=eU(n);return{family:o.family,weight:o.weight??400,italic:o.italic??!1,program:0}}openAnnotation(e){let{pageIndex:t,index:n}=gC(this.runtime,this.session,e),r=this.runtime.fn.EPDFPage_GetAnnotRaw(this.session.requireDocPtr(),t,n);if(!r)throw new N(G.NotFound,"annotation not found");return r}program(e,t){let n=this.fonts.programFor(e);if(n)return{...n.info(),bytes:t?n.bytes():null};let r=this.faces().flatMap(e=>e.programs).find(t=>t.displaySha256===e&&t.objectNumber>0);if(!r)throw new N(G.NotFound,`no font program ${e}`);let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr();return hY(o,32,n=>{var s;o.writeBytes(n,(s=e,Uint8Array.from({length:s.length/2},(e,t)=>parseInt(s.slice(2*t,2*t+2),16))));let l=yn(this.runtime,(e,t)=>i.EPDFDoc_GetFontDisplayProgramCoverage(a,n,e,t)),u=null;if(t){let e=i.EPDFDoc_GetFontDisplayProgramData(a,n,0n,0);u=hY(o,Math.max(1,e),t=>(i.EPDFDoc_GetFontDisplayProgramData(a,n,t,e),o.readBytes(t,e)))}return{covers:l,ascent:r.ascent,descent:r.descent,bytes:u}})}};function yu(e,t){let{fn:n,mem:r}=e,i=n.EPDFFontFaces_Load(t.requireDocPtr());if(!i)throw new N(G.Unknown,"EPDFFontFaces_Load failed");try{let t=[],o=n.EPDFFontFaces_Count(i);for(let a=0;ahY(o,32,t=>e(t)?ys(o.readBytes(t,32)):null),s=a(e=>i.EPDFFontFaces_GetProgramHash(t,n,r,e)),l=a(e=>i.EPDFFontFaces_GetProgramDisplayHash(t,n,r,e)),u=h0(o,[4,4],([e,a])=>i.EPDFFontFaces_GetProgramMetrics(t,n,r,e,a)?{ascent:Number(o.peek(e,"f32")),descent:Number(o.peek(a,"f32"))}:{ascent:0,descent:0});return{objectNumber:i.EPDFFontFaces_GetProgramObjNum(t,n,r),format:yr[i.EPDFFontFaces_GetProgramFormat(t,n,r)]??null,embedded:yi[i.EPDFFontFaces_GetProgramEmbedded(t,n,r)]??"none",postScriptName:h2(o,(e,o)=>i.EPDFFontFaces_GetProgramPostScriptName(t,n,r,e,o))||null,permission:yo[i.EPDFFontFaces_GetProgramEmbeddingPermission(t,n,r)]??null,mapsUnicode:i.EPDFFontFaces_ProgramMapsUnicode(t,n,r),sha256:s,displaySha256:l,ascent:Math.round(1e3*u.ascent),descent:-Math.round(1e3*u.descent)}}(e,i,a,t));t.push({familyName:h3(r,(e,t)=>n.EPDFFontFaces_GetFamily(i,a,e,t))??"",weight:n.EPDFFontFaces_GetWeight(i,a),italic:n.EPDFFontFaces_IsItalic(i,a),programs:o})}return t}finally{n.EPDFFontFaces_Close(i)}}var yd=new WeakMap;function yc(e,t){let{fn:n,mem:r}=e;return hY(r,32,e=>{if(!n.EPDFDoc_GetFontsFingerprint(t.requireDocPtr(),e))throw new N(G.Unknown,"EPDFDoc_GetFontsFingerprint failed");return ys(r.readBytes(e,32))})}function yf(e,t){var n;let r;return JSON.stringify((n={faces:yu(e,t),engineFonts:[],fallbacks:[]},r=av(n.faces).filter(e=>!aS(e)&&!e.programs.some(e=>e.sha256===hz.lastResortDisplayHash)).map(ak),{fonts:[...Z.map(e=>{let t;return t=ez[e],{name:e,source:"standard",builtIn:!0,familyName:t.family,weight:t.weight,italic:t.italic,postScriptName:null,canChoose:!0,restrictions:[],programs:[{displaySha256:hz.standardDisplayHash(e),sourceSha256:null,embedded:"none",format:null,embeddingPermission:null,canDownload:!0}]}}),...n.engineFonts.map(ax),...r],fallbacks:[...n.fallbacks],lastResort:{displaySha256:hz.lastResortDisplayHash,sourceSha256:null,embedded:"none",format:"truetype",embeddingPermission:"installable",canDownload:!0}}).fonts.filter(e=>"document"===e.source))}function ym(e,t){yd.has(t)||yd.set(t,{fingerprint:yc(e,t),documentFonts:yf(e,t)})}function yp(e,t,n){let r,i=n=>(r??(r=av(yu(e,t)))).find(e=>e.name===n);return{...n?{resolveRegisteredFontId:e=>n.idFor(e),describeRegisteredFont:e=>n.describeOrUndefined(e)}:{},describeFont:e=>{let t=n?.describeOrUndefined(e);if(t)return t;let r=i(e)?.face;return r&&{familyName:r.familyName,weight:r.weight,italic:r.italic}},documentProgramOf:e=>{if(Z.includes(e)||n?.describeOrUndefined(e))return;let t=i(e)?.programs[0];return t&&aP(t)&&t.objectNumber>0?t.objectNumber:void 0},resolveDocumentFont:n=>aG({faces:yu(e,t),engineFonts:[],fallbacks:[]},n)}}var yh=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}create(e,t){hW(t);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=new Set,a=e.map(t=>{let n=this.session.resolvePageRef(t.page),r=this.writeContext(t.resources),i=yg(t.label,()=>{var e,n;let i;return e=t.draft,n=t.resources,nO((i=function(e,t={}){let n=(ni(e.subtype,e),function(e){if(to[e.subtype]?.box!=="box"||void 0!==e.box)return e;if(void 0===e.rect)throw new N(G.InvalidArg,`${e.subtype} create: give its \\`box\\`, or its \\`rect\\` with a quarter turn`,{details:{field:"box"}});if(!eq(e.rect))throw new N(G.InvalidArg,`${e.subtype} create field \'rect\': not a rect of finite numbers`,{details:{field:"rect"}});let t=e.rotation??0,n=eQ(t);if(null===n)throw new N(G.InvalidArg,`${e.subtype} create field \'rect\': a rect places a box at a quarter turn; at ${t}\\xb0 give its \\`box\\``,{details:{field:"rect"}});let{rect:r,...i}=e;return{...i,box:eX(eH(e.rect),n)}}(e));return!function(e,t={}){var n;let r,i=pX(String(e.subtype)),o=t.linked??[],a=(i&&o.length>0?(n=i.fileSchemas.create,r=o.filter(e=>e in n.shape),n.omit(Object.fromEntries(r.map(e=>[e,!0])))):hp).safeParse(e);if(!a.success)throw hC(a.error,`${String(e.subtype)} create`)}(n,{linked:t.linked??[]}),function(e,t={}){var n;return tJ(e),function(e){let t;if("line"!==(t=e.subtype)&&"polygon"!==t&&"polyline"!==t)return e;if(tZ(e.subtype,e),null!=e.measure&&"rectilinear"!==e.measure.subtype)throw new N(G.InvalidArg,`A ${"geospatial"===e.measure.subtype?"geospatial":"foreign"} measure can\'t be written; leave measure out`);let n=e;tK(e)&&("line"===e.subtype?n={...e,captionEnabled:e.captionEnabled??!1,captionPosition:e.captionPosition??"inline",captionOffset:e.captionOffset??null}:("polygon"===e.subtype||"polyline"===e.subtype)&&(n={...e,captionEnabled:e.captionEnabled??(null==e.captionCenter&&null),captionCenter:e.captionCenter??null}));var r=n;let i=tU(r);return"unavailable"in i||r.contents===i.label?r:{...r,contents:i.label}}(function(e){if("redact"!==e.subtype||null!=e.rect)return e;let t=e.quadPoints??[];if(0===t.length)return e;let n=e0(t.flatMap(e=>[e.upperLeft,e.upperRight,e.lowerLeft,e.lowerRight]));return{...e,rect:n}}(function(e){if(!tQ(e.subtype))return e;let{richText:t}=e;return t?{...e,contents:e5(t)}:e}(function(e,t){if("free-text"!==e.subtype)return e;let n=e.intent??(null!=e.calloutLine?"free-text-callout":"free-text");nt(n,e.calloutLine);let r={body:ne(e.richText?.body??{},e,t),paragraphs:e.richText?.paragraphs??e4(e.contents??"")};return{...e,intent:n,richText:r,contents:e5(r)}}(t9((n=function(e){if("text"!==e.subtype||null==e.state||null!=e.stateModel)return e;let t=tN(e.state);if(!t)throw nr(e.state);return{...e,stateModel:t}}(e)).subtype)&&t7(n.borderStyle??t4(n.subtype).borderStyle,n.dashArray)?{...n,dashArray:[...t8]}:n,t.describeFont))))}(n,t)}(e,{linked:["reply","parent"],describeFont:r.describeFont})).subtype,n,"create"),bT(i.subtype)&&(null!=i.name&&bL(i.name),null!=i.fit&&b$(i.fit),bU(r?.resources?.appearance,r)),bi(i.subtype)&&function(e,t){if(bs(t),bl(t),!e.file?.name)throw new N(G.InvalidArg,"a file attachment needs the file\'s name: give file.name, or the bytes as a File",{details:{field:"file.name"}})}(i,r),bM(i.subtype)&&function(e){if(void 0===e.rect&&0===(e.quadPoints??[]).length)throw new N(G.InvalidArg,"redact create needs a rect or at least one of quadPoints",{details:{field:"rect"}})}(i),i});yg(t.label,()=>this.claimName(i.nm,n,o));let a=void 0!==i.nm||"stamp"!==t.attribution.kind?i:{...i,nm:iY()};void 0!==t.objectNumber&&yg(t.label,()=>this.session.claimObjectNumber(t.objectNumber));let s=t.replyTo&&{type:t.replyTo.type,to:yg(t.label,()=>this.linkTarget(t.replyTo.to,t.page,e.length,"reply"))};if("popup"===a.subtype&&!t.parent)throw new N(G.InvalidArg,`${t.label??"create"}: a popup needs the annotation it shows (parent)`,{details:{field:"parent"}});return{create:t,record:n,ctx:r,draft:a,replyTo:s,parent:t.parent&&yg(t.label,()=>this.linkTarget(t.parent,t.page,e.length,"popup"))}});if(hW(t),0===a.length)return{created:[],meta:yF(this.session.writeStamp(),[],[])};let s=a.map(({create:e,record:o,ctx:a,draft:s})=>{let l;hW(t);let u=n.EPDFPage_CreateAnnotRaw(i,o.pageIndex,rI[s.subtype],e.objectNumber??0);if(!u&&void 0!==e.objectNumber)throw Ff(e.objectNumber,"taken");if(!u)throw new N(G.Unknown,`${e.label??"create"}: EPDFPage_CreateAnnotRaw returned NULL`);try{if(yg(e.label,()=>{(function(e,t,n,r,i){if(bG(r.subtype)){let i,o;return DZ(e,t,n,r),i=r.quadPoints,bO(e,t,n,i),bN(e,t,n,i),o=t5[r.subtype],DA(e,n,r.color??o.color),DS(e,n,r.opacity??o.opacity),"strikeout"===r.subtype&&null!=r.intent&&DU(e,n,_x(r.intent))}if(bR(r.subtype))return DZ(e,t,n,r),be(e,t,n,{box:r.box,rotation:r.rotation??null}),bh(e,t,n,r),null!=r.cloudyIntensity&&r.cloudyIntensity>0&&Dj(e,n,r.cloudyIntensity);if(bX(r.subtype)){if("polygon"===r.subtype){let i;DZ(e,t,n,r),i=bw(e,t,n,[r.vertices],r.rotation),bv(e,t,n,bJ(r,i)),bh(e,t,n,r),DR(e,t,n,i.drawn[0]),null!=r.cloudyIntensity&&r.cloudyIntensity>0&&Dj(e,n,r.cloudyIntensity)}else{let i;DZ(e,t,n,r),i=bw(e,t,n,[r.vertices],r.rotation),bv(e,t,n,bJ(r,i)),bh(e,t,n,r),DR(e,t,n,i.drawn[0]),DL(e,n,r.lineEndings??t5.polyline.lineEndings)}return}if("line"===r.subtype)return function(e,t,n,r){DZ(e,t,n,r),bv(e,t,n,r),bh(e,t,n,r);let{start:i,end:o}=r.linePoints,[a]=bw(e,t,n,[[i,o]],r.rotation).drawn;DT(e,t,n,{start:a[0],end:a[1]}),DL(e,n,r.lineEndings??t5.line.lineEndings)}(e,t,n,r);if("link"===r.subtype){var o,a,s,l,u,d,c,f,m=e,p=t,h=n,F=r,g=i;if(DZ(m,p,h,F),Dx(m,p,h,F.rect),!m.FPDFAnnot_SetBorder(h,0,0,0))throw new N(G.Unknown,"FPDFAnnot_SetBorder returned false");F.target&&bS(m,p,h,F.target,g);return}if("ink"===r.subtype)return DZ(e,t,n,r),null!=r.intent&&DU(e,n,_8(r.intent)),bd(e,t,n,r),DB(e,t,n,bw(e,t,n,r.inkList,r.rotation).drawn);if(bD(r.subtype)){let o,a;return s=e,l=t,u=n,d=r,c=i,DZ(s,l,u,d),be(s,l,u,{box:d.box,rotation:d.rotation??null}),o=d.interiorColor??null,null===o?Dv(s,u,0):DA(s,u,o,0),DS(s,u,d.opacity??bg.opacity),bf(s,l,u,d),null!=d.cloudyIntensity&&Dj(s,u,d.cloudyIntensity),bu(s,u,d.fontFamily??bg.fontFamily,d.fontSize??bg.fontSize,d.color??bg.color,c),a=d.richText,Dz(s,u,_H(a.body?.align??bg.textAlign)),DU(s,u,_$[d.intent??bg.intent]),void 0!==d.verticalAlign&&d.verticalAlign!==bg.verticalAlign&&bP(s,u,d.verticalAlign),null!=d.calloutLine&&DH(s,l,u,d.calloutLine),null!=d.lineEnding&&DL(s,u,{start:"none",end:d.lineEnding}),b_(s,u,a,c,d.fontFamily??bg.fontFamily)}if("caret"===r.subtype)return DZ(e,t,n,r),be(e,t,n,{box:r.box,rotation:r.rotation??null}),DA(e,n,r.color??bn.color),DS(e,n,r.opacity??bn.opacity),null!=r.intent&&DU(e,n,_k(r.intent));if("text"===r.subtype)return DZ(e,t,n,r),Dx(e,t,n,r.rect),DA(e,n,r.color??bq.color),DS(e,n,r.opacity??bq.opacity),bK(e,n,r.icon??bq.icon),void 0!==r.open&&bH(e,n,r.open),null!=r.stateModel&&DG(e,t,n,"StateModel",Py[o=r.stateModel]??o),null!=r.state&&DG(e,t,n,"State",Pw[a=r.state]??a);if(bT(r.subtype)){let o;return DZ(e,t,n,r),null!=r.name&&bB(e,n,r.name),void 0!==r.opacity&&DS(e,n,r.opacity),o=null===r.fit?"fill":r.fit??t5.stamp.fit,bW(e,t,n,bz(i),bV(i),o,{box:r.box,rotation:r.rotation??null}),null!==r.fit&&PD(e,t,n,o)}if(bi(r.subtype)){let o;return DZ(e,t,n,r),Dx(e,t,n,r.rect),DA(e,n,r.color??br.color),DS(e,n,r.opacity??br.opacity),bo(e,n,r.icon??br.icon),o=r.file,_O(e,t,ba(e,t,n,o.name),bl(i),(f=o,{...null!=f.mimeType?{mimeType:f.mimeType}:{},...null!=f.description?{description:f.description}:{}}),{bytes:bs(i)})}if(bY(r.subtype))return function(e,t,n,r,i){let{actions:o,...a}=r;DZ(e,t,n,a),b3(e,t,n,{box:r.box,rotation:r.rotation??null},null),b0(e,t,n,r,i)}(e,t,n,r,i);if("popup"===r.subtype)return DZ(e,t,n,r),Dx(e,t,n,r.rect),void 0!==r.open&&bk(e,n,r.open);if(bM(r.subtype)){let o,a;return DZ(e,t,n,r),(o=r.quadPoints??[]).length>0&&bO(e,t,n,o),r.rect?Dx(e,t,n,r.rect):bN(e,t,n,o),DA(e,n,r.color??bC.color,0),DS(e,n,r.opacity??bC.opacity),a=r.interiorColor??null,null!==a&&DA(e,n,a,1),null!=r.overlayText&&r.overlayText.length>0&&DW(e,t,n,r.overlayText),r.repeat&&Dq(e,n,!0),bj(r)&&bu(e,n,r.fontFamily??bC.fontFamily,r.fontSize??bC.fontSize,r.fontColor??bC.fontColor,i),void 0!==r.textAlign&&Dz(e,n,_H(r.textAlign))}throw new N(G.NotImplemented,`no writer registered for draft.subtype=\'${r.subtype}\'`)})(n,r,u,s,a),b2(n,u,s,a)}),b7(n,u,s.blendMode),(l=n.EPDFAnnot_GetObjectNumber(u))<=0)throw new N(G.Unknown,`${e.label??"create"}: EPDFPage_CreateAnnotRaw made a direct object`)}finally{n.FPDFPage_CloseAnnot(u)}return{pageIndex:o.pageIndex,pageObjectNumber:o.pageObjectNumber,index:n.EPDFPage_GetAnnotCountRaw(i,o.pageIndex)-1,objectNumber:l}}),l=[],u=(e,t)=>"number"==typeof e?this.withOpen(s[e],t):this.withOpenExisting(e,t);a.forEach(({replyTo:e,parent:t},o)=>{e&&this.withOpen(s[o],t=>u(e.to,n=>b9(this.runtime,t,n,e.type))),void 0!==t&&this.withOpen(s[o],e=>u(t,o=>{ye(this.runtime,e,o),"number"!=typeof t&&l.push(gI(n,r,i,t.page,o,t.index))}))});let d=new Date;a.forEach(({create:{attribution:e,fileDates:t,label:i}},o)=>{this.withOpen(s[o],o=>yg(i,()=>{if("stamp"===e.kind){var i;i=e.actor,i?.displayName&&DQ(n,r,o,i.displayName),DX(n,r,o,d),DY(n,r,o,d),i&&(i.userId||i.groupId)&&(n.EPDFAnnot_SetEmbedMetadataNumber(o,Pd,1),i.userId&&(Ph(n,r,o,Pc,i.userId),Ph(n,r,o,Pm,i.userId),Ph(n,r,o,Pp,i.userId)),i.groupId&&Ph(n,r,o,Pf,i.groupId))}else!function(e,t,n,r,i){null===r.author?e.EPDFAnnot_RemoveKey(n,"T"):DQ(e,t,n,r.author),null===r.createdAt?e.EPDFAnnot_RemoveKey(n,"CreationDate"):DX(e,t,n,r.createdAt),null===r.modifiedAt?e.EPDFAnnot_RemoveKey(n,"M"):DY(e,t,n,r.modifiedAt);let o=[[Pc,r.userId],[Pm,r.createdBy],[Pp,r.modifiedBy],[Pf,r.groupId],["ImportedBy",i]];if(!o.every(([,e])=>!e))for(let[r,i]of(e.EPDFAnnot_SetEmbedMetadataNumber(n,Pd,1),o))i&&Ph(e,t,n,r,i)}(n,r,o,e.from,e.importedBy);t&&function(e,t,n,r){let i=e.EPDFAnnot_GetFileAttachmentForWrite(n);if(i)for(let[n,o]of[["CreationDate",r.createdAt],["ModDate",r.modifiedAt]]){if(!o)continue;let r=t.writeU16String(hH(o));try{e.FPDFAttachment_SetStringValue(i,n,r)}finally{t.free(r)}}}(n,r,o,t)}))});let c=gJ(this.session,this.fonts),f=s.map(e=>this.withOpen(e,t=>b8(n,r,t,e.pageObjectNumber,e.index,c)));return Dd(this.runtime,this.session,f),{created:f,meta:yF(this.session.writeStamp(),s,l)}}claimName(e,t,n){if(!e)return;let r=`${t.pageIndex}\\0${e}`,i=this.session.requireDocPtr();if(n.has(r)||b5(this.runtime,i,t.pageIndex,e)>=0)throw b4(e,t.pageObjectNumber);n.add(r)}linkTarget(e,t,n,r){if("planned"in e){if(e.planned<0||e.planned>=n)throw new N(G.InvalidArg,`no create ${e.planned} to link to`);return e.planned}let{existing:i}=e;if(i.page.objectNumber!==t.objectNumber)throw new N(G.InvalidArg,"reply"===r?`/IRT parent must be on the same page as the reply (parent page ${i.page.objectNumber}, reply page ${t.objectNumber})`:`a popup\'s parent must be on the same page (parent page ${i.page.objectNumber}, popup page ${t.objectNumber})`);return{page:i.page,...gC(this.runtime,this.session,i)}}writeContext(e){return{...yp(this.runtime,this.session,this.fonts),docPtr:this.session.requireDocPtr(),drawings:this.session.drawingIndex(),pdfPageCount:e=>DE(this.runtime.fn,this.runtime.mem,e),...e?{resources:e}:{}}}withOpen(e,t){let{fn:n}=this.runtime,r=n.EPDFPage_GetAnnotRaw(this.session.requireDocPtr(),e.pageIndex,e.index);if(!r)throw new N(G.Unknown,"a created annotation is not where it was");try{if(n.EPDFAnnot_GetObjectNumber(r)!==e.objectNumber)throw new N(G.Unknown,"a created annotation is not where it was");return t(r)}finally{n.FPDFPage_CloseAnnot(r)}}withOpenExisting(e,t){let{fn:n}=this.runtime,r=n.EPDFPage_GetAnnotRaw(this.session.requireDocPtr(),e.pageIndex,e.index);if(!r)throw new N(G.Unknown,"an annotation to link to is not where it was");try{return t(r)}finally{n.FPDFPage_CloseAnnot(r)}}};function yF(e,t,n){return{affectedPages:[...new Set(t.map(e=>e.pageObjectNumber))].map(e=>q(e)),cacheDelta:null,...e,changedRefs:[...t.map(e=>({kind:"objectNumber",page:q(e.pageObjectNumber),objectNumber:e.objectNumber})),...n]}}function yg(e,t){try{return t()}catch(t){if(!e||!N.is(t))throw t;throw new N(t.code,`${e}: ${t.message}`,{...t.details?{details:t.details}:{},cause:t})}}var y_=class{constructor(e,t){this.runtime=e,this.ids=t,hJ(this,"fileHandles",[]),hJ(this,"identities",new Map),hJ(this,"programs",new Map),hJ(this,"fallbacks",[]),hJ(this,"builtIn",new Set),this.registerLastResort()}registerLastResort(){let e=function(e){let t=e.endsWith("==")?2:+!!e.endsWith("="),n=new Uint8Array(e.length/4*3-t),r=0;for(let t=0;t>16),r>8&255),r{try{return e()}catch{return t}};return{familyName:i(()=>h2(r,(t,r)=>n.EPDFFont_GetFamilyName(e,t,r))??t.familyName,t.familyName),weight:i(()=>n.EPDFFont_GetWeight(e),t.weight||400),italic:i(()=>n.EPDFFont_IsItalic(e),1===t.italic),embeddingPermission:i(()=>(function(e){switch(e){case 1:return"editable";case 2:return"preview-and-print";default:return"installable"}})(n.EPDFFont_GetEmbeddingPermission(e)),"installable"),editingAuthorized:i(()=>n.EPDFFont_IsEditingAuthorized(e),!0),instanced:i(()=>n.EPDFFont_IsInstanced(e),!1)}}registerStartup(e){for(let t of e){let e=void 0===t.italic?-1:+!!t.italic;this.registerFromNodeFile(t.key,t.familyName??"",t.weight??0,e,t.path,t.serve??!1,t.builtIn??!1),t.fallback&&this.addFallback(t.key,t.tier)}}addFallback(e,t=0){let n=this.requireId(e);if(!this.runtime.fn.EPDFFont_AddFallbackFont(n,t))throw new N(G.InvalidArg,`addFallback failed: ${e}`);let r=this.fallbacks.find(t=>t.key===e);r?r.tier=t:this.fallbacks.push({key:e,tier:t})}clearFallbacks(){this.runtime.fn.EPDFFont_ClearFallbackFonts(),this.fallbacks=[]}fallbackKeys(){return[...this.fallbacks].sort((e,t)=>e.tier-t.tier).map(e=>e.key)}engineFontFacts(){let e=[];for(let[t,n]of this.identities){let r=this.programs.get(t);r&&e.push({key:t,identity:n,postScriptName:r.postScriptName,format:r.format,sha256:r.sha256,served:r.served,builtIn:this.builtIn.has(t)})}return e}keyForId(e){for(let[t,n]of this.ids)if(n===e)return t}programFor(e){let t=[...this.programs].find(([,t])=>t.sha256===e)?.[0];if(void 0===t)return;let n=this.requireId(t),{fn:r,mem:i}=this.runtime;return{info:()=>{let e=yn(this.runtime,(e,t)=>r.EPDFFont_GetCoverage(n,e,t)),t=h0(i,[4,4],([e,t])=>r.EPDFFont_GetMetrics(n,e,t)?{ascent:Number(i.peek(e,"f32")),descent:Number(i.peek(t,"f32"))}:{ascent:0,descent:0});return{covers:e,ascent:Math.round(1e3*t.ascent),descent:-Math.round(1e3*t.descent)}},bytes:()=>{let e=r.EPDFFont_GetProgramData(n,0n,0);return hY(i,Math.max(1,e),t=>(r.EPDFFont_GetProgramData(n,t,e),i.readBytes(t,e)))}}}readProgram(e){let{fn:t,mem:n}=this.runtime;return{sha256:hY(n,32,r=>t.EPDFFont_GetProgramHash(e,r)?Array.from(n.readBytes(r,32),e=>e.toString(16).padStart(2,"0")).join(""):""),format:2===t.EPDFFont_GetProgramFormat(e)?"opentype":"truetype",postScriptName:h2(n,(n,r)=>t.EPDFFont_GetPostScriptName(e,n,r))||null}}clear(){for(let e of(this.runtime.fn.EPDFFont_ClearRegisteredFonts(),this.registerLastResort(),this.ids.clear(),this.identities.clear(),this.programs.clear(),this.fallbacks=[],this.builtIn.clear(),this.fileHandles))e.close();this.fileHandles.length=0}idFor(e){return this.requireId(e)}requireId(e){let t=this.ids.get(e);if(void 0===t)throw new N(G.InvalidArg,`font not registered on this thread: ${e}`);return t}};function yP(e,t,n){return{affectedPages:[q(t)],cacheDelta:null,...e,changedRefs:[...n]}}var yD=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}writeContext(e){return{...yp(this.runtime,this.session,this.fonts),runtime:this.runtime,docPtr:this.session.requireDocPtr(),drawings:this.session.drawingIndex(),pdfPageCount:e=>DE(this.runtime.fn,this.runtime.mem,e),...e?{resources:e}:{}}}create(e,t,n,r={}){let{actor:i,resources:o,objectNumber:a}=r,{reply:s,...l}=t,u="popup"===t.subtype?t.parent:null;"popup"===t.subtype&&delete l.parent;let{created:d,meta:c}=new yh(this.runtime,this.session,this.fonts).create([{page:q(e),draft:l,...s?{replyTo:{to:{existing:s.to},type:s.type??"reply"}}:{},...u?{parent:{existing:u}}:{},...o?{resources:o}:{},...void 0!==a?{objectNumber:a}:{},attribution:{kind:"stamp",...i?{actor:i}:{}}}],n);return{annotation:d[0],meta:c}}update(e,t,n,r,i){hW(r);let{fn:o,mem:a}=this.runtime,{pageIndex:s,index:l}=gC(this.runtime,this.session,e),u=gM(this.runtime,this.session,s,l);try{let b,y,w;hW(r);let E=this.writeContext(i),A=Df(o.EPDFAnnot_GetBlendMode(u)),v=b8(o,a,u,e.page.objectNumber,l,gJ(this.session,this.fonts));Dd(this.runtime,this.session,[v]);let S=o6(n,v,t.groupId);var d,c,f,m,p,h,F,g,_,P=u,D=t;if(("polygon"===v.subtype||"polyline"===v.subtype)&&tK(D)&&o.FPDFAnnot_HasKey(P,"EMBD_Metadata")&&6!==o.FPDFAnnot_GetValueType(P,"EMBD_Metadata"))throw new N(G.InvalidArg,"Malformed annotation metadata cannot store a caption");t=function(e,t,n={}){var r,i;let o,a=(r=function(e,t){let{rect:n,...r}=t;if(void 0===n||!tC.has(e.subtype))return t;if(!eq(n))throw new N(G.InvalidArg,`${e.subtype} update field \'rect\': not a rect of finite numbers`,{details:{field:"rect"}});if(tv(eH(n),e.rect))return r;let i=tM(e.subtype).find(n=>{let r=t[n];return void 0!==r&&!tv(r,e[n])});if(i)throw new N(G.InvalidArg,`${e.subtype} update field \'rect\': a new rect moves the shape, so it can\'t come with a new \'${i}\'`,{details:{field:"rect"}});let{left:o,bottom:a,right:s,top:l}=n;return{...r,...function(e,t){let n=e.subtype;if(!tC.has(n))return{rect:t};let r=eH(t),i=eH(e.rect),o=r.right-r.left,a=r.top-r.bottom,s=i.right-i.left,l=i.top-i.bottom,u=tv(o,s),d=tv(a,l);if(!u&&o<=0||!d&&a<=0)throw tR(n,"a rect needs a width and a height");let c=e.rotation??0,f=to[n],m="box"===f.box?eQ(c):null;if(!tv((c%360+360)%360,0)&&null===m&&(!u||!d))throw tR(n,"a turned drawing\'s rect can only move; resize its shape instead");if(!u&&s<=0||!d&&l<=0)throw tR(n,"its rect has no width or height to stretch; it can only move");let p=u?1:o/s,h=d?1:a/l,F=e=>({x:r.left+(e.x-i.left)*p,y:r.bottom+(e.y-i.bottom)*h}),g=e=>{let t=F({x:e.left,y:e.bottom}),n=F({x:e.right,y:e.top});return eH({left:t.x,bottom:t.y,right:n.x,top:n.y})},_={box:e=>null===m||0===m||180===m?g(e):eX(g(eJ(e,m)),m),point:F,points:e=>e.map(F),strokes:e=>e.map(e=>e.map(F)),quads:e=>e.map(e=>({upperLeft:F(e.upperLeft),upperRight:F(e.upperRight),lowerLeft:F(e.lowerLeft),lowerRight:F(e.lowerRight)})),linePoints:e=>({start:F(e.start),end:F(e.end)}),calloutLine:e=>e.map(F)},P={};for(let t of tM(n)){let n=e[t],r=f[t];null!=n&&r&&(P[t]=_[r](n))}return P}(e,{left:o,bottom:a,right:s,top:l})}}(e,function(e,t){let n=function(e,t){var n;let r;if(void 0===t||t===e.subtype)return e.subtype;let i=(n=e.subtype,(r=ts.find(e=>e.includes(n)))?r.filter(e=>e!==n):[]);if(!i.includes(t))throw new N(G.InvalidArg,0===i.length?`${e.subtype} has no other kind it can become`:`${e.subtype} can become ${i.length<2?i.join(""):`${i.slice(0,-1).join(", ")} or ${i.at(-1)}`}, not ${t}`,{details:{field:"subtype"}});let o=function(e,t){let n=tn(t)?.owners??{};for(let t of Object.keys(tn(e.subtype)?.owners??{})){let r=e[t];if(!(t in n)&&null!=r)return t}return null}(e,t);if(null!==o){let n=e[o];throw new N(G.InvalidArg,`${e.subtype} field \'${o}\' holds ${"string"==typeof n?`\'${n}\'`:JSON.stringify(n)}, and ${t} has no such field: clear it first, in the same change`,{details:{field:o}})}return t}(e,t.subtype);if("unsupported"===e.subtype)throw new N(G.InvalidArg,"an annotation of a type the engine doesn\'t model can\'t be updated");return ni(n,t),{...t,subtype:n}}(e,t)),o=tn(e.subtype)?.colors??[],i=nn(r,(t,n)=>{let r=e[t];return o.includes(t)&&"string"==typeof n&&"string"==typeof r&&n.toLowerCase()===r.toLowerCase()}),nn(i,(t,n)=>void 0!==n&&tv(n,e[t])));return!function(e,t){let n=t.subtype??e.subtype;if("unsupported"===n)return;for(let[e,r]of Object.entries(hf[n].readBackWrites)){let i=t[e];if(!(void 0===i||r?.safeParse(i).success))throw new N(G.InvalidArg,r?`${n} update field \'${e}\': this value can be read but not written; send it back unchanged or replace it`:`${n} update field \'${e}\': the engine works this out; send it back unchanged or leave it out`,{details:{field:e}})}let r=pX(n).fileSchemas.update.safeParse(t);if(!r.success)throw hC(r.error,`${n} update`)}(e,a),function(e,t,n={}){var r;let i=(r=function(e,t){if("text"!==e.subtype||"text"!==t.subtype||null==t.state||void 0!==t.stateModel)return t;let n=tN(t.state);if(n)return{...t,stateModel:n};if(!e.stateModel)throw nr(t.state);return t}(e,t),t9(e.subtype)&&t7(r.borderStyle,r.dashArray)&&null==e.dashArray?{...r,dashArray:[...t8]}:r);return tJ(i),function(e,t){if("line"!==e.subtype&&"polygon"!==e.subtype&&"polyline"!==e.subtype)return t;let n=e.subtype,r={...t,subtype:n};if(tZ(n,r),null!=r.measure&&"rectilinear"!==r.measure.subtype){if(e.measure?.subtype!==r.measure.subtype)throw new N(G.InvalidArg,`A ${"geospatial"===r.measure.subtype?"geospatial":"foreign"} measure can\'t be written; leave measure out`);r={...r,measure:void 0}}if("line"===e.subtype&&"line"===r.subtype)tK(r)&&(r={...r,captionEnabled:void 0===r.captionEnabled?e.captionEnabled:r.captionEnabled,captionPosition:r.captionPosition??e.captionPosition,captionOffset:void 0===r.captionOffset?e.captionOffset:r.captionOffset});else if("line"!==e.subtype&&"line"!==r.subtype){if(r.vertices&&null!==r.captionEnabled&&void 0===r.captionCenter&&e.captionCenter){let t=function(e,t,n){if(e.length!==t.length||e.length<2)return;let r=e[0],i=t[0],o=e.findIndex(e=>Math.hypot(e.x-r.x,e.y-r.y)>1e-6);if(o<0)return;let a={x:e[o].x-r.x,y:e[o].y-r.y},s={x:t[o].x-i.x,y:t[o].y-i.y},l=a.x*a.x+a.y*a.y,u=(a.x*s.x+a.y*s.y)/l,d=(a.x*s.y-a.y*s.x)/l;if(Math.abs(u*u+d*d-1)>1e-5)return;let c=e=>({x:i.x+u*(e.x-r.x)-d*(e.y-r.y),y:i.y+d*(e.x-r.x)+u*(e.y-r.y)});if(e.every((e,n)=>{let r=c(e);return .001>=Math.hypot(r.x-t[n].x,r.y-t[n].y)}))return c(n)}(e.vertices,r.vertices,e.captionCenter);t&&(r={...r,captionCenter:t})}tK(r)&&(r=null===r.captionEnabled?{...r,captionEnabled:null,captionCenter:null}:{...r,captionEnabled:r.captionEnabled??e.captionEnabled??!1,captionCenter:void 0===r.captionCenter?e.captionCenter:r.captionCenter})}if(tq.some(e=>void 0!==r[e])){let t=tU({...e,...r});"unavailable"in t||(r={...r,contents:t.label})}return tZ(n,r),r}(e,function(e,t){var n;let r,i,o,a,s,l;if("free-text"!==e.subtype||"free-text"!==t.subtype)return t;let u=e.calloutLine;if(!u||void 0!==t.calloutLine||void 0===t.box&&void 0===t.rotation)return t;let d=t.box??e.box,c=(void 0===t.rotation?e.rotation:t.rotation)??0,f=3===u.length?u[1]:void 0,m=(n=f??u[0],r={x:(d.left+d.right)/2,y:(d.bottom+d.top)/2},i={degrees:c,center:r},a=(o=c?e3(n,i):n).x-r.x,s=o.y-r.y,l=Math.abs(a)>=Math.abs(s)?{x:a>=0?d.right:d.left,y:r.y}:{x:r.x,y:s>0?d.top:d.bottom},c?e1(l,i):l);return{...t,calloutLine:f?[u[0],f,m]:[u[0],m]}}(e,function(e,t){if(!tQ(t.subtype??e.subtype))return t;let{richText:n}=t;if(n)return{...t,contents:e5(n)};if(null===n||void 0===t.contents||!e.richText)return t;if(null===t.contents)return{...t,richText:null};let r={paragraphs:e4(t.contents)};return{...t,richText:r,contents:e5(r)}}(e,function(e,t,n){let r;if("free-text"!==e.subtype||"free-text"!==t.subtype)return t;(void 0!==t.intent||void 0!==t.calloutLine)&&nt(t.intent??e.intent,void 0!==t.calloutLine?t.calloutLine:e.calloutLine);let i=ne({},t,n),o=void 0!==t.richText||void 0!==t.contents;if(!o&&0===Object.keys(i).length)return t;let a={...t.richText?.body?{...e6,...t.richText.body}:e.richText.body,...i},s={body:a,paragraphs:t.richText?.paragraphs??(void 0!==t.contents?e4(t.contents??""):e.richText.paragraphs)};return{...t,...(r={},void 0===t.fontSize&&void 0!==a.size&&a.size!==e.fontSize&&(r.fontSize=a.size),void 0===t.fontColor&&void 0!==a.color&&a.color.toLowerCase()!==e.fontColor?.toLowerCase()&&(r.fontColor=a.color.toLowerCase()),void 0===t.textAlign&&void 0!==a.align&&a.align!==e.textAlign&&(r.textAlign=a.align),r),richText:s,...o?{contents:e5(s)}:{}}}(e,i,n.describeFont))))}(e,a,n)}(v,t,{describeFont:E.describeFont}),function(e,t){if("widget"!==e.subtype||!e.hasMark)return;let n=rM.filter(n=>void 0!==t[n]&&!tv(t[n],e[n]));if(n.length>0)throw new N(G.InvalidArg,`the widget has a mark in it, which its style doesn\'t draw: ${n.join(", ")} can\'t change`)}(v,t),nO(v.subtype,i,"update"),m=t,bT(b6(m))&&(void 0!==m.name&&null!==m.name&&bL(m.name),null!=m.fit&&b$(m.fit),y=E?.resources?.appearance,void 0!==y&&bU(y,E)),hW(r);let k=i?.appearance?"regenerate":(p=t,function(e,t){if(void 0!==t.subtype&&t.subtype!==e.subtype)return tx;let n=e.subtype,r=void 0===t.captionEnabled?e.captionEnabled:t.captionEnabled,i=tb.has(n)||["line","polygon","polyline"].includes(n)&&!0===r,o=[];for(let[n,r]of Object.entries(t))!(void 0===r||tD.has(n))&&("contents"!==n||i)&&(tv(r,e[n])||o.push(n));if(0===o.length)return tk;let a=tw[n],s=a&&("polygon"===n||"polyline"===n)&&e.captionCenter?[...a,"captionCenter"]:a;if(!s||!o.every(e=>s.includes(e)))return tx;let l=function(e,t,n,r){let[i]=r,o=tS(e[i]),a=tS(t[i]);if(!o||!a)return null;let s=a.x-o.x,l=a.y-o.y;if(ty.has(n)){let n=void 0===t.rotation?e.rotation:t.rotation;if(!tE(tA(e.rotation),tA(n)))return null}for(let n of r){let r=e[n],i=t[n];if((null!=r||null!=i)&&(null==r||null==i||!function e(t,n,r,i){if(null==t||null==n)return null==t&&null==n;if(Array.isArray(t)||Array.isArray(n))return!!Array.isArray(t)&&!!Array.isArray(n)&&t.length===n.length&&t.every((t,o)=>e(t,n[o],r,i));if("object"==typeof t&&"object"==typeof n){for(let o of new Set([...Object.keys(t),...Object.keys(n)])){let a=t[o],s=n[o];if("number"==typeof a&&"number"==typeof s){if(!tE(a+("left"===o||"right"===o||"x"===o?r:"bottom"===o||"top"===o||"y"===o?i:0),s))return!1}else if(!e(a,s,r,i))return!1}return!0}return t===n}(r,i,s,l)))return null}return{x:s,y:l}}(e,t,n,s);return l?{impact:"translation",by:l}:tx}(v,p).impact);if("inert"!==k&&function(e,t,n){var r,i;let o;if(!__.has(e.FPDFAnnot_GetSubtype(n)))return;let a=_E(e,t,n);r=a,i=function(e,t,n){let r=_y(e,t,n);if(!r)return;let i=_F(r.degrees);return void 0===i?void 0:{rotation:i,box:r.box}}(e,t,n),(r&&i?(o=r.rotation,.05>=_b(o,i.rotation)&&eY(r.box,i.box)):!r&&!i)||(a?(D5(e,n,a.rotation),D8(e,t,n,a.box)):(e.EPDFAnnot_ClearEmbedMetadataKey(n,D3),e.EPDFAnnot_ClearEmbedMetadataKey(n,D2)))}(o,a,u),void 0!==t.subtype&&t.subtype!==v.subtype&&!o.EPDFAnnot_SetSubtype(u,rI[t.subtype]))throw new N(G.Unknown,"EPDFAnnot_SetSubtype returned false");h=u,F=t,function(e,t,n,r,i){var o,a;let s=b6(r);if(bG(s)){var l=e,u=t,d=n,c=r;if(DJ(l,u,d,c),void 0!==c.color&&DA(l,d,c.color),void 0!==c.opacity&&DS(l,d,c.opacity),"strikeout"===c.subtype&&void 0!==c.intent&&DV(l,d,null===c.intent?null:_x(c.intent)),void 0!==c.quadPoints){let e=D0(_m(l,u,d).flatMap(bx),c.quadPoints.flatMap(bx));bI(l,u,d,c.quadPoints),e?D1(l,u,d,e):bN(l,u,d,c.quadPoints)}return}if(bR(s))return DJ(e,t,n,r),bt(e,t,n,r),bF(e,t,n,r),void 0!==r.cloudyIntensity&&(null!==r.cloudyIntensity&&r.cloudyIntensity>0?Dj(e,n,r.cloudyIntensity):DM(e,n));if(bX(s))return"polygon"===s?(DJ(e,t,n,r),bQ(e,t,n,r),bF(e,t,n,r),void 0!==r.cloudyIntensity&&(null!==r.cloudyIntensity&&r.cloudyIntensity>0?Dj(e,n,r.cloudyIntensity):DM(e,n))):(DJ(e,t,n,r),bQ(e,t,n,r),bF(e,t,n,r),void 0!==r.lineEndings&&DL(e,n,r.lineEndings));if("line"===s)return function(e,t,n,r){DJ(e,t,n,r),bv(e,t,n,r),bF(e,t,n,r);let i=r.linePoints&&[[r.linePoints.start,r.linePoints.end]],o=bA(e,t,n,bE(e,t,n),i,r.rotation);if(o){let[r]=o.drawn;DT(e,t,n,{start:r[0],end:r[1]})}void 0!==r.lineEndings&&DL(e,n,r.lineEndings)}(e,t,n,r);if("link"===s){var f=e,m=t,p=n,h=r,F=i;if(DJ(f,m,p,h),void 0!==h.rect&&Dx(f,m,p,h.rect),null===h.target){var g=f,_=p;if(!g.EPDFAnnot_RemoveAction(_)||!g.EPDFAnnot_RemoveDest(_))throw new N(G.Unknown,"failed to clear link target")}else if(void 0!==h.target){if("goto"!==h.target.kind&&"uri"!==h.target.kind&&"named"!==h.target.kind)throw new N(G.InvalidArg,`a \'${h.target.kind}\' link target can\'t be written`,{details:{field:"target"}});bS(f,m,p,h.target,F)}return}if("ink"===s){let i;return DJ(e,t,n,r),void 0!==r.intent&&DV(e,n,null===r.intent?null:_8(r.intent)),bm(e,t,n,r),(i=bA(e,t,n,bE(e,t,n),r.inkList,r.rotation))&&DB(e,t,n,i.drawn)}if(bD(s)){var P=e,D=t,b=n,y=r,w=i;if(DJ(P,D,b,y),bt(P,D,b,y),void 0!==y.interiorColor&&(null===y.interiorColor?Dv(P,b,0):DA(P,b,y.interiorColor,0)),void 0!==y.opacity&&DS(P,b,y.opacity),bp(P,D,b,y),void 0!==y.cloudyIntensity&&(null===y.cloudyIntensity?DM(P,b):Dj(P,b,y.cloudyIntensity)),void 0!==y.color){let e=_u(P,D,b);e?D$(P,b,-1,e.fontSize>0?e.fontSize:bg.fontSize,y.color):bu(P,b,bg.fontFamily,bg.fontSize,y.color,w)}void 0!==y.richText&&b_(P,b,y.richText,w,y.fontFamily),void 0!==y.textAlign&&Dz(P,b,_H(y.textAlign)),void 0!==y.intent&&DU(P,b,_$[y.intent]),void 0!==y.verticalAlign&&bP(P,b,y.verticalAlign),null===y.calloutLine?P.EPDFAnnot_RemoveKey(b,"CL"):void 0!==y.calloutLine&&DH(P,D,b,y.calloutLine),null===y.lineEnding?P.EPDFAnnot_RemoveKey(b,"LE"):void 0!==y.lineEnding&&DL(P,b,{start:"none",end:y.lineEnding});return}if("caret"===s)return DJ(e,t,n,r),bt(e,t,n,r),void 0!==r.color&&DA(e,n,r.color),void 0!==r.opacity&&DS(e,n,r.opacity),void 0!==r.intent&&DV(e,n,null===r.intent?null:_k(r.intent));if("text"===s)return DJ(e,t,n,r),void 0!==r.rect&&Dx(e,t,n,r.rect),void 0!==r.color&&DA(e,n,r.color),void 0!==r.opacity&&DS(e,n,r.opacity),void 0!==r.icon&&bK(e,n,r.icon),void 0!==r.open&&bH(e,n,r.open),void 0!==r.stateModel&&DO(e,t,n,"StateModel",null===r.stateModel?null:Py[o=r.stateModel]??o),void 0!==r.state&&DO(e,t,n,"State",null===r.state?null:Pw[a=r.state]??a);if(bT(s))return function(e,t,n,r,i){DJ(e,t,n,r),null===r.name?e.EPDFAnnot_RemoveKey(n,"Name"):void 0!==r.name&&bB(e,n,r.name);let o=PP(e,t,n)??"fill",a=void 0!==r.fit?r.fit??"fill":o;void 0!==r.fit&&PD(e,t,n,r.fit);let s=i?.resources?.appearance;if(void 0!==s){void 0!==r.opacity&&DS(e,n,r.opacity);let o=_A(e,t,n);bW(e,t,n,s,bV(i),a,{box:r.box??o.box,rotation:void 0===r.rotation?o.rotation:r.rotation});return}let l=bt(e,t,n,r);void 0!==r.opacity?function(e,t,n,r){if(!e.EPDFAnnot_SetStampOpacity(t,Pg[n],r))throw new N(G.Unknown,"EPDFAnnot_SetStampOpacity returned false")}(e,n,a,r.opacity):(l||void 0!==r.fit)&&Pb(e,n,a)}(e,t,n,r,i);if(bi(s))return DJ(e,t,n,r),void 0!==r.rect&&Dx(e,t,n,r.rect),void 0!==r.color&&DA(e,n,r.color),void 0!==r.opacity&&DS(e,n,r.opacity),void 0!==r.icon&&bo(e,n,r.icon),function(e,t,n,r,i){let o=i?.resources?.file;if(void 0===r&&void 0===o)return;let a=e.EPDFAnnot_GetFileAttachmentForWrite(n);if(null===r){if(a)throw new N(G.InvalidArg,"a file attachment\'s file can\'t be removed");if(void 0===o)return}let s=a?_I(e,t,a):null;if(!a){if(!r||void 0===o)throw new N(G.InvalidArg,"the file attachment has no file: send the file\'s name as `file` and its bytes as the `file` resource");a=ba(e,t,n,r.name)}let l=r?r.mimeType??null:s?.mimeType??null;if(void 0!==o?_O(e,t,a,bl(i),{mimeType:l},{bytes:o}):l!==(s?.mimeType??null)&&function(e,t,n){if(!e.EPDFAttachment_SetSubtype(t,n??""))throw new N(G.InvalidArg,"the file attachment\'s file has no embedded data to give a MIME type")}(e,a,l),r){if(null!==s&&r.name!==s.name&&!h6(t,r.name,t=>e.EPDFAttachment_SetName(a,t)))throw new N(G.Unknown,"EPDFAttachment_SetName returned false");if((r.description??null)!==(s?.description??null)&&!h6(t,r.description??"",t=>e.EPDFAttachment_SetDescription(a,t)))throw new N(G.Unknown,"EPDFAttachment_SetDescription returned false")}}(e,t,n,r.file,i);if(bY(s))return function(e,t,n,r,i){let{actions:o,...a}=r;if(DJ(e,t,n,a),!function(e,t,n,r){if(void 0===r.box&&void 0===r.rotation)return;let i=eH(g9(e,t,n)),o=PO(e,n);b3(e,t,n,{box:r.box??eX(i,o??0),rotation:void 0===r.rotation?o:r.rotation||null},{rect:i,rotation:o})}(e,t,n,r),b0(e,t,n,r,i),void 0!==r.actions){if(!i?.runtime||!i.docPtr)throw new N(G.InvalidArg,"writing a widget\'s actions requires the runtime and the document on the write context");PM(i.runtime,i.docPtr,n,r.actions)}}(e,t,n,r,i);if("popup"===s)return DJ(e,t,n,r),void 0!==r.rect&&Dx(e,t,n,r.rect),void 0!==r.open&&bk(e,n,r.open);if(bM(s)){var E=e,A=t,v=n,S=r,k=i;if(DJ(E,A,v,S),void 0!==S.rect&&Dx(E,A,v,S.rect),void 0!==S.quadPoints&&(bI(E,A,v,S.quadPoints),void 0===S.rect&&bN(E,A,v,S.quadPoints)),void 0!==S.color&&DA(E,v,S.color,0),void 0!==S.opacity&&DS(E,v,S.opacity),void 0!==S.interiorColor&&(null===S.interiorColor?Dv(E,v,1):DA(E,v,S.interiorColor,1)),void 0!==S.overlayText&&DW(E,A,v,S.overlayText??""),void 0!==S.repeat&&Dq(E,v,S.repeat),bj(S)){let e=_u(E,A,v);bu(E,v,S.fontFamily??(e?_q(e.fontCode):bC.fontFamily),S.fontSize??e?.fontSize??bC.fontSize,S.fontColor??e?.color??bC.fontColor,k)}void 0!==S.textAlign&&Dz(E,v,_H(S.textAlign));return}throw new N(G.NotImplemented,`no writer registered for subtype=\'${s}\'`)}(o,a,h,F,E),b2(o,h,{...F,subtype:b6(F)},E),void 0!==t.contents&&t.contents!==v.contents&&tz({...v,...t})&&o.EPDFAnnot_RemoveKey(u,"RC");let x=null;void 0===t.reply||(d=t.reply,c=v.reply,null===d||null===c?d===c:yb(d.to,c.to)&&(d.type??"reply")===c.type)||function(e,t,n,r,i){let{fn:o}=e;if(null===i.inReplyTo){o.EPDFAnnot_SetLinkedAnnot(n,"IRT",0n),o.EPDFAnnot_SetReplyType(n,0);return}if(i.inReplyTo){if(i.inReplyTo.page.objectNumber!==r)throw new N(G.InvalidArg,`/IRT parent must be on the same page as the reply (parent page ${i.inReplyTo.page.objectNumber}, reply page ${r})`);let a=gj(e,t,i.inReplyTo);try{b9(e,n,a,i.replyType??"reply")}finally{o.FPDFPage_CloseAnnot(a)}return}if(void 0!==i.replyType){let e=o.FPDFAnnot_GetLinkedAnnot(n,"IRT");if(e)try{o.EPDFAnnot_SetReplyType(n,Po(i.replyType))}finally{o.FPDFPage_CloseAnnot(e)}}}(this.runtime,this.session,u,e.page.objectNumber,null===t.reply?{inReplyTo:null}:{inReplyTo:t.reply.to,replyType:t.reply.type??"reply"});let O=!1;"popup"!==t.subtype||"popup"!==v.subtype||void 0===t.parent||yb(t.parent,v.parent)||(O=!0,x=function(e,t,n,r,i,o){let{fn:a}=e;if(o){let r=gj(e,t,o);try{let e=a.FPDFAnnot_GetLinkedAnnot(r,"Popup");if(e){let t=a.EPDFAnnot_GetObjectNumber(e)===a.EPDFAnnot_GetObjectNumber(n);a.FPDFPage_CloseAnnot(e),t&&a.EPDFAnnot_SetLinkedAnnot(r,"Popup",0n)}}finally{a.FPDFPage_CloseAnnot(r)}}if(null===i)return a.EPDFAnnot_SetLinkedAnnot(n,"Parent",0n),null;if(i.page.objectNumber!==r)throw new N(G.InvalidArg,`a popup\'s parent must be on the same page (parent page ${i.page.objectNumber}, popup page ${r})`);let{annotPtr:s,name:l}=gR(e,t,i);try{return ye(e,n,s),l}finally{a.FPDFPage_CloseAnnot(s)}}(this.runtime,this.session,u,e.page.objectNumber,t.parent,v.parent));let I=null,C=t.open;if(void 0!==C&&!O){let e="text"===v.subtype?v.popup:"popup"===v.subtype?v.parent:null;e&&(I=function(e,t,n,r,i){let{fn:o}=e,{annotPtr:a,name:s}=gR(e,t,n);try{if(i&&1!==o.FPDFAnnot_GetSubtype(a))return null;return yt(e,a,r),s}finally{o.FPDFPage_CloseAnnot(a)}}(this.runtime,this.session,e,C,"popup"===v.subtype))}if(DY(o,a,u),g=u,S&&(S.userId||S.groupId)&&(o.EPDFAnnot_HasEmbedMetadata(g)||o.EPDFAnnot_SetEmbedMetadataNumber(g,Pd,1),S.userId&&Ph(o,a,g,Pp,S.userId),S.groupId&&Ph(o,a,g,Pf,S.groupId)),"inert"===k||"translation"===k)b={action:"preserved",changed:!1};else{let e;"widget"!==v.subtype?e=b7(o,u,t.blendMode??A):v.hasMark?(_=u,Pb(o,_,"contain"),e=!1):e=o.EPDFAnnot_GenerateFormFieldAP(u),b=e?{action:"regenerated",changed:!0}:{action:"generation-unavailable",changed:"regenerate"===k}}o.FPDFPage_CloseAnnot(u),u=null,u=gM(this.runtime,this.session,s,l);let j=b8(o,a,u,e.page.objectNumber,l,gJ(this.session,this.fonts));Dd(this.runtime,this.session,[j]);let M=yP(this.session.writeStamp(),e.page.objectNumber,(f=[j.ref,x,I],w=new Set,f.filter(e=>!(null===e||w.has(K(e)))&&(w.add(K(e)),!0))));return{annotation:j,appearance:b,meta:M}}finally{null!==u&&o.FPDFPage_CloseAnnot(u)}}assertNotAttachedWidget(e,t){let{fn:n}=this.runtime;if(20!==n.FPDFAnnot_GetSubtype(e))return;let r=n.EPDFAnnot_GetObjectNumber(e);if(t>0&&r===t)return;let i=function(e,t,n){if(n<=0)return 0;let r=gv(e,t),i=e.fn.EPDFForm_GetFieldIndexForWidget(r,n);return i<0?0:e.fn.EPDFForm_GetFieldObjNum(r,i)}(this.runtime,this.session,r);if(0!==i)throw new N(G.InvalidArg,i===r?"widget is its form field\'s own dictionary (a merged field/widget) - delete the field with doc.forms.delete":"widget is attached to a form field - use doc.forms.removeWidget or doc.forms.delete")}delete(e,t,n){hW(n);let{fn:r}=this.runtime,i=this.session.requireDocPtr(),o=e.page.objectNumber,{pageIndex:a}=this.session.resolvePageRef(e.page),{annotations:s}=new DP(this.runtime,this.session,this.fonts).listOne(o,n),l=tG(s,e);if(0===l.length){var u;throw u=e,new N(G.NotFound,`no annotation ${K(u)} on page ${u.page.objectNumber}`)}o5(t,l);let d=e=>gC(this.runtime,this.session,e).index,c=l.map(e=>d(e.ref));for(let e of c)this.withAnnotAt(a,e,e=>this.assertNotAttachedWidget(e,0));let f=new Set(l.map(e=>K(e.ref))),m=l.flatMap(e=>{if("popup"!==e.subtype||!e.parent)return[];let t=K(e.parent),n=s.find(e=>K(e.ref)===t);return n&&!f.has(t)?[d(n.ref)]:[]});for(let e of(hW(n),gx(this.runtime,this.session,o),[...c].sort((e,t)=>t-e)))if(!r.EPDFPage_RemoveAnnotRaw(i,a,e))throw new N(G.Unknown,`failed to remove annotation ${e} on page ${o}`);for(let e of m){let t=c.filter(t=>tr.EPDFAnnot_RemoveKey(e,"Popup"))}let p=[...l].reverse().map(e=>e.ref);return{meta:yP(this.session.writeStamp(),o,p)}}deleteReleasedWidget(e,t){let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=e.page.objectNumber,{pageIndex:a,index:s}=gC(this.runtime,this.session,e),l=this.withAnnotAt(a,s,o=>(this.assertNotAttachedWidget(o,t),gI(n,r,i,e.page,o,s)));if(gx(this.runtime,this.session,o),!n.EPDFPage_RemoveAnnotRaw(i,a,s))throw new N(G.Unknown,`failed to remove annotation: ${e.kind}`);return{meta:yP(this.session.writeStamp(),o,[l])}}withAnnotAt(e,t,n){let r=gM(this.runtime,this.session,e,t);try{return n(r)}finally{this.runtime.fn.FPDFPage_CloseAnnot(r)}}},yb=(e,t)=>null===e||null===t?e===t:K(e)===K(t);function yy(e,t,n){let r=_E(e,t,n);return r?hY(t,16,i=>(FY(t,i,r.box),e.EPDFAnnot_ExportAppearance(n,_g(r.rotation),i))):e.EPDFAnnot_ExportAppearance(n,0,0n)}function yw(e,t,n,r){let i=null;try{return hY(t,8,o=>{Ft(t,o,0),i=e.EPDF_SaveDocumentToOwnedBuffer(n,2,o);let a=Number(t.peek(o,"i32"));if(!i||a<=0)throw new N(G.DocOpenFailed,`failed to save ${r}`);let s=t.readBytes(i,a),l=new ArrayBuffer(s.byteLength);return new Uint8Array(l).set(s),{bytes:l,size:a}})}finally{i&&e.EPDF_FreeBuffer(i)}}var yE=class{constructor(e,t){this.runtime=e,this.session=t}flatten(e,t,n,r){hW(r),this.requireRefs("annotations.flatten",e,t);let{fn:i,mem:o}=this.runtime,a=gx(this.runtime,this.session,e),s=this.session.pagePool(),l=s.acquire(e);try{let r,s,u=this.resolveAll(l,t);try{[r,s]=this.withHandleArray(u,e=>hY(o,4*t.length,r=>{let a=i.EPDFPage_FlattenAnnotations(l,e,t.length,+("print"===n),r),s=[];for(let e=0;e2===e);throw new N(t>=0?G.InvalidArg:G.Unknown,t>=0?`annotations.flatten: ref ${t} is not an annotation of page ${e}`:"native annotation flatten failed after preflight")}let d=t.map((e,t)=>({ref:e,status:0===s[t]?"applied":"unchanged"}));if(1!==r&&!a){let t={affectedPages:[],cacheDelta:null,...this.session.writeStamp()};return{page:q(e),usage:n,results:d,meta:t}}this.session.invalidateDerived();let c={affectedPages:[q(e)],cacheDelta:null,...this.session.writeStamp()};return{page:q(e),usage:n,results:d,meta:c}}finally{s.release(e)}}exportAppearance(e,t,n){hW(n),this.requireRefs("annotations.exportAppearance",e,t);let{fn:r}=this.runtime,i=this.session.pagePool(),o=i.acquire(e),a=null;try{let e=this.resolveAll(o,t);try{a=this.withHandleArray(e,e=>r.EPDFPage_ExportAnnotationsAsDocument(o,e,t.length))}finally{for(let t of e)r.FPDFPage_CloseAnnot(t)}if(!a)throw new N(G.InvalidArg,"annotations.exportAppearance: every ref must be a visible annotation of this page with a normal appearance");return yw(this.runtime.fn,this.runtime.mem,a,"exported appearances")}finally{a&&r.FPDF_CloseDocument(a),i.release(e)}}readAppearance(e,t,n){hW(n);let{fn:r}=this.runtime,i=this.session.pagePool(),o=i.acquire(e),a=null;try{let e=gT(this.runtime,this.session,o,t);try{let t=rN(r.FPDFAnnot_GetSubtype(e));if(ti[t]?.appearance===void 0)throw new N(G.InvalidArg,`a ${t} annotation has no \'appearance\' resource`);a=yy(r,this.runtime.mem,e)}finally{r.FPDFPage_CloseAnnot(e)}if(!a)throw new N(G.InvalidArg,"the annotation has no normal appearance to read");return yw(this.runtime.fn,this.runtime.mem,a,"the appearance")}finally{a&&r.FPDF_CloseDocument(a),i.release(e)}}resolveAll(e,t){let{fn:n}=this.runtime,r=[];try{for(let n of t)r.push(gT(this.runtime,this.session,e,n));return r}catch(e){for(let e of r)n.FPDFPage_CloseAnnot(e);throw e}}withHandleArray(e,t){let{mem:n}=this.runtime,r="wasm"===this.runtime.kind;return hY(n,Math.max(1,e.length*(r?4:8)),i=>(e.forEach((e,t)=>r?n.poke(i,"i32",Number(e),4*t):n.poke(i,"i64",e,8*t)),t(i)))}requireRefs(e,t,n){if(0===n.length)throw new N(G.InvalidArg,`${e} requires at least one ref`);for(let r of n)if(r.page.objectNumber!==t)throw new N(G.InvalidArg,`${e} refs must all target page ${t}; got ref on page ${r.page.objectNumber}`)}};function yA(e,t,n,r){let{fn:i,mem:o}=e,a=r?i.EPDFDoc_ExportDrawing(t,r):yy(i,o,n);if(!a)return null;try{return yw(i,o,a,"a drawing").bytes}finally{i.FPDF_CloseDocument(a)}}function yv(e,t,n){let r=e.fn.FPDFAnnot_GetFileAttachment(t);return r?_N(e,r,n).bytes:null}function yS(e){return N.is(e,G.PayloadTooLarge)}function yk(e,t,n){let{fn:r,mem:i}=e,o=new Set(n.flatMap(e=>rB(e).map(H))),a=t.requireDocPtr();return hY(i,16,e=>t.allRecords().filter(e=>o.has(H(q(e.pageObjectNumber)))).map(t=>{let n=gg(r,i,a,t.pageIndex,e).crop;return{page:q(t.pageObjectNumber),position:t.pageIndex,size:{width:n.right-n.left,height:n.top-n.bottom}}}))}var yx=class{constructor(e,t,n){this.runtime=e,this.kind=t,this.limits=n,hJ(this,"byId",{}),hJ(this,"totalBytes",0)}keep(e){nC(this.kind,this.limits,"resourceBytes",e.byteLength);let{fn:t,mem:n}=this.runtime,r=`sha256-${Db(t,n,new Uint8Array(e))}`;return r in this.byId||(this.byId[r]=e,this.totalBytes+=e.byteLength,nC(this.kind,this.limits,"resources",Object.keys(this.byId).length),nC(this.kind,this.limits,"bundleBytes",this.totalBytes)),r}},yG=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}export(e,t,n){hW(n);let r=this.session.allRecords(),i=new DP(this.runtime,this.session,this.fonts),o=function(e,t,n){let r=new Set(t.map(H)),i=new Map,o=new Map,a=e=>{let t=H(e);if(i.has(t)||!r.has(t))return;let a=n(e);for(let e of(i.set(t,a),a))o.set(K(e.ref),e)},s=e=>(a(e.page),o.get(K(e)));for(let t of e.pages??[])if(!r.has(H(t)))throw new N(G.NotFound,`export: the document has no page ${H(t)}`);let l=!e.refs&&!e.pages,u=(e.include??"threads")==="threads";for(let n of l?t:e.pages??[])a(n);let d=new Set,c=[],f=e=>{if(!e)return;let t=K(e.ref);d.has(t)||(d.add(t),c.push(e))};if(l)for(let e of i.values())e.forEach(f);else{for(let t of e.pages??[])i.get(H(t))?.forEach(f);for(let t of e.refs??[]){let e=s(t);if(!e)throw new N(G.NotFound,`export: the document has no annotation ${K(t)}`);f(e)}}if(u){for(let e of[...c])"popup"===e.subtype&&e.parent&&f(s(e.parent));let e=new Map;for(let t of i.values())for(let n of t){let t=n.reply?s(n.reply.to):void 0;if(!t)continue;let r=K(t.ref);e.set(r,[...e.get(r)??[],n])}for(let t=0;tq(e.pageObjectNumber)),e=>i.listOne(e.objectNumber,n,"annotations").annotations);nC("annotation",t,"items",o.length);let a=new yO(this.runtime,this.session,t),s=gF(this.runtime,this.session),l=o.map(e=>(hW(n),{data:n6(e,s(e.ref.page),s),resources:a.of(e)})),u=yk(this.runtime,this.session,l.map(e=>e.data));nC("annotation",t,"pages",u.length);let d=nN({pages:u,items:l});return nC("annotation",t,"manifestBytes",d),nC("annotation",t,"bundleBytes",d+a.totalBytes),{format:"embedpdf/annotations",version:1,pages:u,items:l,resources:a.byId}}},yO=class extends yx{constructor(e,t,n){super(e,"annotation",n),this.session=t,hJ(this,"drawings",new Map)}of(e){let t=ti[e.subtype];if(!t)return{};let{fn:n}=this.runtime,r=this.rawHandleOf(e);try{let e={};if(t.appearance){let t=this.appearanceOf(r);t&&(e.appearance=t)}if(t.file){let t=this.fileOf(r);t&&(e.file=t)}return e}finally{n.FPDFPage_CloseAnnot(r)}}rawHandleOf(e){return gj(this.runtime,this.session,e.ref)}appearanceOf(e){let t=this.runtime.fn.EPDFAnnot_GetDrawing(e),n=t?this.drawings.get(t):void 0;if(n)return n;let r=yA(this.runtime,this.session.requireDocPtr(),e,t);if(!r)return null;let i=this.keep(r);return t&&this.drawings.set(t,i),i}fileOf(e){let t;try{t=yv(this.runtime,e,this.limits.resourceBytes)}catch(e){if(!yS(e))throw e;throw new N(G.PayloadTooLarge,`the annotation bundle is past its resourceBytes limit: an attached file is larger than ${this.limits.resourceBytes}`,{details:{limit:"resourceBytes",max:this.limits.resourceBytes}})}return t?this.keep(t):null}};function yI(e,t,n,r,i){let o=new Map;for(let[e,r]of Object.entries(n.resources??{})){if(!(r instanceof ArrayBuffer))throw new N(G.InvalidArg,`${t} bundle: resource ${e} is not bytes`);o.set(e,r.byteLength)}i(n,o,r);let{fn:a,mem:s}=e,l=new Map;for(let[e,r]of Object.entries(n.resources??{})){let n=Db(a,s,new Uint8Array(r));if(`sha256-${n}`!==e)throw new N(G.InvalidArg,`${t} bundle: resource ${e} doesn\'t match its id`);l.set(r,n)}return l}var yN=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}import(e,t){var n;hW(t);let{bundle:r,limits:i}=e;this.assertBundle(r,i);let o=function(e){let{bundle:t,target:n,nameTaken:r}=e,i=t.items.map(e=>e.data),o=tP({bundlePages:t.pages,pages:e.pages??"same",target:n,named:i.flatMap(hj)}),a=new Map,s=new Map,l=new Map;i.forEach((e,t)=>{if("unsupported"===e.subtype)return void a.set(t,"unsupported-kind");if("widget"===e.subtype)return void a.set(t,"widget");if("popup"===e.subtype&&null===e.parent)return void a.set(t,"parent-missing");let n=hM(e);if("item"===n)return void a.set(t,"unsupported-value");let r=[...rR(e),...n];r.length>0&&s.set(t,r),l.set(t,hR(e,r,o,{label:`import: item ${t}`,details:{item:t}}))});let u=new Map;i.forEach((e,t)=>{let n=K(e.ref);u.has(n)||u.set(n,t)});let d=e=>H(o(i[e].ref.page)),c=(e,t)=>{let n=u.get(K(e));return void 0!==n&&d(n)===d(t)?n:void 0},f=e=>[e.reply?.to,"popup"===e.subtype?e.parent:null].filter(e=>null!=e);i.forEach((e,t)=>{!a.has(t)&&f(e).some(e=>void 0===c(e,t))&&a.set(t,"parent-missing")});let m=new Map;i.forEach((e,t)=>{if(a.has(t)||"popup"!==e.subtype||!e.parent)return;let n=c(e.parent,t);m.has(n)?a.set(t,"popup-taken"):m.set(n,t)});let p=new Set;i.forEach((e,t)=>{if(a.has(t)||!e.nm)return;let n=o(e.ref.page),i=`${H(n)}\\0${e.nm}`;p.has(i)||r(n,e.nm)?a.set(t,"name-conflict"):p.add(i)});for(let e=!0;e;)e=!1,i.forEach((t,n)=>{!a.has(n)&&f(t).some(e=>a.has(c(e,n)))&&(a.set(n,"parent-dropped"),e=!0)});let h=new Map;i.forEach((e,t)=>{a.has(t)||h.set(t,h.size)});let F=[...h.keys()].map(e=>{let t=i[e],n=t.reply?h.get(c(t.reply.to,e)):void 0,r="popup"===t.subtype&&t.parent?h.get(c(t.parent,e)):void 0;return{item:e,page:o(t.ref.page),draft:l.get(e),...void 0!==n?{replyTo:{planned:n,type:t.reply.type}}:{},...void 0!==r?{parent:r}:{}}}),g=[];return i.forEach((e,t)=>{let n=a.get(t);if(n)g.push({ref:e.ref,reason:n});else for(let n of s.get(t)??[])g.push({ref:e.ref,...n})}),{creates:F,dropped:g}}({bundle:"stamp"===e.attribution?{...n=r,items:n.items.map(({data:{nm:e,...t},...n})=>({...n,data:t}))}:r,...void 0!==e.pages?{pages:e.pages}:{},target:this.session.allRecords().map(e=>({page:q(e.pageObjectNumber),position:e.pageIndex})),nameTaken:(e,t)=>b5(this.runtime,this.session.requireDocPtr(),this.session.resolvePageRef(e).pageIndex,t)>=0}),a=gF(this.runtime,this.session),s=o.creates.map(t=>{let n=r.items[t.item],i={};for(let[e,t]of Object.entries(n.resources))i[e]=r.resources[t];return{page:t.page,draft:n5(t.draft,a(t.page),a),...t.replyTo?{replyTo:{to:{planned:t.replyTo.planned},type:t.replyTo.type}}:{},...void 0!==t.parent?{parent:{planned:t.parent}}:{},resources:i,attribution:function(e,t,n){let{actor:r}=e;if("stamp"===e.attribution){let{groupId:e}=t,n="string"==typeof e?{...r,groupId:e}:r;return{kind:"stamp",...n?{actor:n}:{}}}return{kind:"restore",from:{author:n.author,createdAt:n.createdAt,modifiedAt:n.modifiedAt,userId:n.userId,createdBy:n.createdBy,modifiedBy:n.modifiedBy,groupId:n.groupId??null},...r?.userId?{importedBy:r.userId}:{}}}(e,t.draft,n.data),..."file-attachment"===n.data.subtype&&n.data.file?{fileDates:{createdAt:n.data.file.createdAt,modifiedAt:n.data.file.modifiedAt}}:{},label:`import: item ${t.item}`}});for(let t of s)e.authorizeCreate?.(t.draft);let{created:l,meta:u}=new yh(this.runtime,this.session,this.fonts).create(s,t);return{annotations:l,refMap:o.creates.map((e,t)=>({from:r.items[e.item].data.ref,to:l[t].ref})),dropped:[...o.dropped],meta:u}}assertBundle(e,t){let n=yI(this.runtime,"annotation",e,t,nL),r=this.session.drawingIndex();for(let[e,t]of n)r.hashes.set(e,t);for(let n of e.items){let r=n.resources.appearance;r&&function(e,t,n){let r=nx(n);r&&"width"in r&&nC(e,t,"imagePixels",r.width*r.height)}("annotation",t,e.resources[r])}}};function yC(e,t,n,r){let{fn:i,mem:o}=e;return hY(o,Math.max(4,4*r.length),a=>(r.forEach((e,t)=>o.poke(a,"i32",e,4*t)),yz(e,"annotations",e=>i.EPDFPage_ExportAnnotsRawToOwnedBuffer(t,n,a,r.length,e))))}function yj(e,t,n,r){yU(e,r,i=>{if(!e.fn.EPDFPage_ImportAnnotsRaw(t,n,i,r.byteLength))throw new N(G.Unknown,"EPDFPage_ImportAnnotsRaw refused a capture")})}function yM(e,t,n,r){return yz(e,`object ${n}`,i=>e.fn.EPDFDoc_ExportDictRawToOwnedBuffer(t,n,r.join(" "),i))}function yR(e,t,n,r,i=[]){return yz(e,`object ${n}`,o=>e.fn.EPDFDoc_ExportDictCanonicalToOwnedBuffer(t,n,r.join(" "),i.join(" "),o))}function yT(e,t,n){yU(e,n,r=>{if(!e.fn.EPDFDoc_ImportDictRaw(t,r,n.byteLength))throw new N(G.Unknown,"EPDFDoc_ImportDictRaw refused a capture")})}function yB(e,t,n){return yz(e,`field ${n}`,r=>e.fn.EPDFForm_ExportFieldRawToOwnedBuffer(t,n,r))}function yL(e,t,n){yU(e,n,r=>{if(!e.fn.EPDFForm_ImportFieldRaw(t,r,n.byteLength))throw new N(G.Unknown,"EPDFForm_ImportFieldRaw refused a capture")})}function y$(e,t,n){try{return yz(e,`attachment \'${n}\'`,r=>h5(e.mem,n,n=>e.fn.EPDFAttachment_ExportCanonicalToOwnedBuffer(t,n,r)))}catch(e){if(N.is(e))return null;throw e}}function yz(e,t,n){let{fn:r,mem:i}=e;return hY(i,8,e=>{Ft(i,e,0);let o=n(e);if(!o)throw new N(G.Unknown,`the capture of ${t} failed`);try{return i.readBytes(o,Number(i.peek(e,"i32"))).slice()}finally{r.EPDF_FreeBuffer(o)}})}function yU(e,t,n){let{mem:r}=e;return hY(r,Math.max(1,t.byteLength),e=>(r.writeBytes(e,t),n(e)))}function yV(e,t,n=yW){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)||Array.isArray(t))return!!Array.isArray(e)&&!!Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>yV(e,t[n]));let r=yq(e,n),i=yq(t,n);return r.length===i.length&&r.every(n=>i.includes(n)&&yV(e[n],t[n]))}var yW=new Set;function yq(e,t){return Object.entries(e).filter(([e,n])=>void 0!==n&&!t.has(e)).map(([e])=>e)}function yH(e,t){return{item:{type:"skipped",op:t,meta:{affectedPages:[],cacheDelta:null,...e.session.writeStamp()}},reverse:[]}}function yK(e,t,n){if(!n)return;let r=Object.entries(n).filter(([e,n])=>void 0!==n&&!yV(t[e],n)).map(([e])=>e);if(r.length>0)throw new N(G.ChangeConflict,`op ${e} expected other values in ${r.join(", ")}`,{details:{opIndex:e,fields:r}})}function yZ(e,t){if(e.byteLength!==t.byteLength)return!1;for(let n=0;n({...n,after:yR(e,t.requireDocPtr(),n.objectNumber,[])}))}function yX(e,t,n){return n.every(n=>{let r=function(e,t,n){try{return yR(e,t.requireDocPtr(),n,[])}catch(e){if(N.is(e))return null;throw e}}(e,t,n.objectNumber);return null!==r&&yZ(r,n.after)})}function yY(e,t,n){let r=yJ(e,t,n),i=t.requireDocPtr();for(let t of n)t.before&&yT(e,i,t.before);return t.invalidateDerived(),yQ(e,t,r)}function y0(e,t,n){let r=e[t];if(!(n<=r))throw new N(G.PayloadTooLarge,`copy: past the ${t} limit: ${n} > ${r}`,{details:{limit:t,max:r,value:n}})}var y1=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}copy(e,t){var n,r;let i,o,a,s,l,u,d;hW(t);let{refs:c,objectNumbers:f,limits:m}=e;if(f&&f.length!==c.length)throw new N(G.InvalidArg,`copy: objectNumbers names ${f.length} copies of ${c.length}`,{details:{field:"objectNumbers"}});y0(m,"items",c.length),e.page&&this.session.resolvePageRef(e.page);let p=c.map(t=>e.read(t)),h=gF(this.runtime,this.session),F=(n=p.map(e=>n6(e,h(e.ref.page),h)),r={...e.page?{page:e.page}:{},...e.offset?{offset:e.offset}:{}},i=new Map,n.forEach((e,t)=>{if("unsupported"===e.subtype||"widget"===e.subtype)return;let n=hM(e);i.set(t,"item"===n?"item":[...rR(e),...n])}),o=e=>{let t=i.get(e);return void 0===t||"item"===t?[]:t},l=new Set((s=(a=function(e,t,n=()=>!1){let r=new Map;e.forEach((e,t)=>{"unsupported"===e.subtype?r.set(t,"unsupported-kind"):"widget"===e.subtype?r.set(t,"widget"):n(t)&&r.set(t,"unsupported-value")});let i=new Map;e.forEach((e,t)=>{let n=K(e.ref);i.has(n)||i.set(n,t)});let o=n=>t.page??e[n].ref.page,a=(e,t)=>{let n=i.get(K(e));if(!(void 0===n||r.has(n)))return H(o(n))===H(o(t))?n:void 0},s=new Set;e.forEach((e,t)=>{if(r.has(t)||"popup"!==e.subtype)return;let n=e.parent?i.get(K(e.parent)):void 0,o=e.parent?a(e.parent,t):void 0;void 0===o?r.set(t,void 0!==n&&r.has(n)?"parent-dropped":"parent-missing"):s.has(o)?r.set(t,"popup-taken"):s.add(o)});let l=new Map;e.forEach((e,t)=>{r.has(t)||l.set(t,l.size)});let u=t.offset??{x:0,y:0},d=[...l.keys()].map(t=>{let n=e[t],r=n.reply?a(n.reply.to,t):void 0,i="popup"===n.subtype&&n.parent?a(n.parent,t):void 0,{nm:s,groupId:d,reply:c,popup:f,...m}=n;for(let{field:e}of rR(n))delete m[e];return{source:t,page:o(t),data:function(e,t){if(0===t.x&&0===t.y)return e;let n=new Set(["rect","captionCenter",...tw[e.subtype]??[]]),r={...e};for(let i of n)null!=e[i]&&(r[i]=function e(t,n,r){return Array.isArray(t)?t.map(t=>e(t,n,r)):null===t||"object"!=typeof t?t:Object.fromEntries(Object.entries(t).map(([t,i])=>"number"!=typeof i?[t,e(i,n,r)]:[t,i+("left"===t||"right"===t||"x"===t?n:"bottom"===t||"top"===t||"y"===t?r:0)]))}(e[i],t.x,t.y));return r}(m,u),...void 0!==r?{replyTo:{copy:l.get(r),type:n.reply.type}}:{},...void 0!==i?{parent:l.get(i)}:{}}}),c=[];return e.forEach((e,t)=>{let n=r.get(t);n&&c.push({ref:e.ref,reason:n})}),{copies:d,dropped:c}}(n,r,e=>"item"===i.get(e))).copies.map(({data:e,...t})=>({...t,draft:hR(e,o(t.source),e=>e,{label:`copy: annotation ${t.source}`,details:{annotation:t.source}})}))).map(e=>e.source)),u=a.dropped[Symbol.iterator](),d=[],n.forEach((e,t)=>{if(l.has(t))for(let n of o(t))d.push({ref:e.ref,...n});else d.push(u.next().value)}),{creates:s,dropped:d}),g=this.resourceReader(m),_=F.creates.map(n=>{hW(t);let r=p[n.source],i=n5(n.draft,h(n.page),h),o=e.authorizeCreate(i);return{page:n.page,draft:i,...n.replyTo?{replyTo:{to:{planned:n.replyTo.copy},type:n.replyTo.type}}:{},...void 0!==n.parent?{parent:{planned:n.parent}}:{},resources:g(r),...f?{objectNumber:f[n.source]}:{},attribution:{kind:"stamp",...o?{actor:o}:{}},..."file-attachment"===r.subtype&&r.file?{fileDates:{createdAt:r.file.createdAt,modifiedAt:r.file.modifiedAt}}:{},label:`copy: annotation ${n.source}`}}),{created:P,meta:D}=new yh(this.runtime,this.session,this.fonts).create(_,t);return{annotations:P,refMap:F.creates.map((e,t)=>({from:p[e.source].ref,to:P[t].ref})),dropped:[...F.dropped],meta:D}}resourceReader(e){let{fn:t}=this.runtime,n=new Map,r=0,i=0,o=t=>(y0(e,"resourceBytes",t.byteLength),y0(e,"resources",r+=1),y0(e,"bundleBytes",i+=t.byteLength),t);return r=>{let i=ti[r.subtype];if(!i)return{};let a=gj(this.runtime,this.session,r.ref);try{let r={};if(i.appearance){let e=t.EPDFAnnot_GetDrawing(a),i=n.get(e),s=i??yA(this.runtime,this.session.requireDocPtr(),a,e);s&&(r.appearance=i??o(s)),s&&e&&n.set(e,s)}if(i.file){let t=this.fileOf(a,e.resourceBytes);t&&(r.file=o(t))}return r}finally{t.FPDFPage_CloseAnnot(a)}}}fileOf(e,t){try{return yv(this.runtime,e,t)}catch(e){if(!yS(e))throw e;throw new N(G.PayloadTooLarge,`copy: an attached file is larger than ${t} bytes`,{details:{limit:"resourceBytes",max:t}})}}};function y3(e,t,n){let{fn:r,mem:i}=e,o=t.requireDocPtr(),{pageIndex:a}=t.resolvePageRef(n),s=r.EPDFPage_GetAnnotCountRaw(o,a),l=[];for(let e=0;ee?.family===t?[e.ref]:[])}function y6(e,t,n,r){let i;if(0===n.length)throw new N(G.InvalidArg,"a reorder names at least one row",{details:{field:"refs"}});let o=new Map;e.entries.forEach((e,t)=>{e&&o.set(K(e.ref),t)});let a=n_(r);(a?[...n,a]:n).forEach((r,i)=>{let s=a&&i===n.length?"position":"refs";if(r.page.objectNumber!==e.page.objectNumber)throw new N(G.InvalidArg,`${K(r)} is on page ${r.page.objectNumber}; a reorder stays on page ${e.page.objectNumber}`,{details:{field:s}});let l=o.get(K(r)),u=void 0===l?null:e.entries[l];if(u&&u.family!==t)throw new N(G.InvalidArg,"widgets"===u.family?"widgets paint above every annotation and have an order of their own: reorder them with doc.forms.reorderWidgets":"annotations paint below every widget and have an order of their own: reorder them with page.annotations.reorder",{details:{field:s}})});let s=y2(e,t),l=nD(s,n,r,K),u=n.map(e=>o.get(K(e))),d=new Set(u),c=e=>e-u.filter(t=>to.get(K(e))).filter(e=>!d.has(e)),m=Math.min(...u);if("start"===r)i=f.length>0?c(f[0]):m;else if("end"===r)i=f.length>0?c(f.at(-1))+1:m;else{let e=c(o.get(K(a)));i="before"in r?e:e+1}return{stack:e,family:t,before:s,after:l,from:u,to:i}}function y5(e,t,n){let{fn:r,mem:i}=e;if(gx(e,t,n.stack.page.objectNumber),!hY(i,4*n.from.length,e=>(n.from.forEach((t,n)=>i.poke(e,"i32",t,4*n)),r.EPDFPage_MoveAnnotsRaw(t.requireDocPtr(),n.stack.pageIndex,e,n.from.length,n.to))))throw new N(G.Unknown,`the annotations of page ${n.stack.page.objectNumber} could not be reordered`)}function y4(e,t,n,r=n){let i=new Set;for(let e of n)e.page&&i.add(e.page.objectNumber);return{affectedPages:[...i].map(e=>q(e)),cacheDelta:null,...e,changedFields:t,changedWidgets:n,redrawnWidgets:r}}function y8(e,t){return"checkbox"===e||"radio"===e?[]:[...t]}var y7=["AP","FS"];function y9(e,t,n){let r=new Map,i=t.map(t=>{var n;let i;return{ref:t.ref,left:(n=t.ref,(i=r.get(n.page.objectNumber))||(i=wc(e,n.page.objectNumber),r.set(n.page.objectNumber,i)),tG(i,n))}}),o=new Set(i.flatMap(e=>e.left.map(e=>K(e.ref)).filter(t=>t!==K(e.ref))));return i.filter(e=>!o.has(K(e.ref))).reverse().map(e=>({kind:"annotation.remove",ref:e.ref,left:e.left,...n?{rights:n}:{}}))}function we(e){oQ(e,"doc.annotate.modify"),oQ(e,"doc.annotate.import")}function wt(e,t,n){if(!n||n===t.nm)return;let r=e.session.resolvePageRef(t.ref.page);if(b5(e.runtime,e.session.requireDocPtr(),r.pageIndex,n)>=0)throw b4(n,r.pageObjectNumber)}function wn(e,t,n){let{page:r}=t.stack;return{item:wo(e,t.family,r,t.after,n),reverse:[{kind:"annotation.reorder",page:r,family:t.family,refs:n,before:t.before,after:t.after}]}}function wr(e,t){let n=e.findIndex(e=>K(e)===K(t));if(!(n<0))return 0===n?null:K(e[n-1])}function wi(e,t,n){if("widgets"===t)return void oQ(e.authority,"doc.forms.modify");for(let t of o1(n.map(t=>wd(e,t))))oQ(e.authority,t)}function wo(e,t,n,r,i){let o=e.session.writeStamp();return"annotations"===t?{type:"annotations.reorder",page:n,order:r,meta:yP(o,n.objectNumber,i)}:{type:"forms.reorderWidgets",page:n,order:r,meta:y4(o,[],i.map(t=>({ref:t,objectNumber:wm(e,t),page:n})))}}function wa(e,t,n,r,i){var o,a;let s;gx(e.runtime,e.session,t.page.objectNumber);let l=wd(e,t),u="widget"===l.subtype?ir(l.fieldKind,n):n,d=(function(e,t){let n=[];if("open"in t&&("text"===e.subtype&&e.popup&&n.push(e.popup),"popup"===e.subtype&&e.parent&&n.push(e.parent)),"popup"===e.subtype&&"parent"in t){e.parent&&n.push(e.parent);let r=t.parent;r&&n.push(r)}return n})(l,u).map(t=>({objectNumber:wm(e,t),deep:[]})),c=yJ(e.runtime,e.session,[{objectNumber:wm(e,t),deep:y7},...d]),f=wu(e).update(t,u,e.authority,e.signal,i),m=yQ(e.runtime,e.session,c);return{item:ws(e,r,t,f),reverse:[{kind:"objects.revert",reports:r,objects:m,subject:{annotation:t},appearanceChanged:f.appearance.changed,fallback:(o=l,a=f.annotation,{kind:"annotation",restore:Object.fromEntries((s=Object.keys(u).filter(e=>!yV(o[e],a[e]))).map(e=>[e,o[e]])),left:Object.fromEntries(s.map(e=>[e,a[e]]))})}]}}function ws(e,t,n,r){if("annotations.update"===t)return{type:"annotations.update",page:n.page,...r};let i=r.annotation;if("widget"!==i.subtype)throw Error("a widget update read back no widget");let o=eR(wm(e,n),n.page);return{type:"forms.updateWidget",widget:i,appearance:r.appearance,meta:y4(e.session.writeStamp(),i.field?[i.field]:[],[o],r.appearance.changed?[o]:[])}}function wl(e,t,n){let r=t.page.objectNumber;gx(e.runtime,e.session,r);let i=tG(wc(e,r),t),o=new Set(i.map(e=>K(e.ref))),a=i.flatMap(t=>"popup"===t.subtype&&t.parent&&!o.has(K(t.parent))?[{objectNumber:wm(e,t.parent),deep:[]}]:[]),s=yJ(e.runtime,e.session,a),{pageIndex:l}=e.session.resolvePageRef(t.page),u=i.length>0?yC(e.runtime,e.session.requireDocPtr(),l,i.map(t=>gC(e.runtime,e.session,t.ref).index)):new Uint8Array,d=n?{...e.authority,grants:null}:e.authority,c=wu(e).delete(t,d,e.signal);return{item:{type:"annotations.delete",page:t.page,...c},reverse:[{kind:"annotation.restore",page:t.page,members:c.meta.changedRefs,capture:u,unlinked:yQ(e.runtime,e.session,s),...n?{rights:n}:{}}]}}function wu(e){return new yD(e.runtime,e.session,e.fonts)}function wd(e,t){gC(e.runtime,e.session,t);let n=K(t),r=wc(e,t.page.objectNumber).find(e=>K(e.ref)===n);if(!r)throw Error(`annotation ${n} is on its page but reads as none`);return r}function wc(e,t){return new DP(e.runtime,e.session,e.fonts).listOne(t,e.signal).annotations}function wf(e,t){try{return wc(e,e.session.resolvePageRef(t).pageObjectNumber)}catch{return null}}function wm(e,t){if("objectNumber"===t.kind)return t.objectNumber;let{pageIndex:n,index:r}=gC(e.runtime,e.session,t),i=gM(e.runtime,e.session,n,r);try{return e.runtime.fn.EPDFAnnot_GetObjectNumber(i)}finally{e.runtime.fn.FPDFPage_CloseAnnot(i)}}var wp=class{constructor(e,t){this.runtime=e,this.session=t}list(e){hW(e);let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr(),i=t.FPDFDoc_GetAttachmentCount(r),o=[];for(let e=0;ee.EPDFDoc_GetAttachmentKey(n,r,t,i))}(t,n,r,e)??"";o.push({..._I(t,n,i),ref:n$(a),index:e})}return o}readFile(e,t,n,r){hW(r);let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s=_G(i,o,a,e);if(s<0)throw new N(G.NotFound,`no embedded file with key \'${e.key}\' in the document`);let l=i.FPDFDoc_GetAttachment(a,s);if(!l)throw new N(G.Unknown,`embedded file with key \'${e.key}\' resolved to index ${s} but could not be opened`);let u=_I(i,o,l);return this.extract(l,u.name,u.mimeType??void 0,t,n)}async readAnnotationFile(e,t,n,r,i,o){hW(i);let{fn:a,mem:s}=this.runtime,l=this.session.pagePool(),u=await l.acquireInSlices(e,i,o),d=null;try{d=gT(this.runtime,this.session,u,t);let e=a.FPDFAnnot_GetFileAttachment(d);if(!e)throw new N(G.InvalidArg,"annotation is not a file attachment or carries no embedded file (/FS)");let i=_I(a,s,e);return this.extract(e,i.name,i.mimeType??void 0,n,r)}finally{null!==d&&a.FPDFPage_CloseAnnot(d),l.release(e)}}extract(e,t,n,r,i){if(void 0!==r){let{size:o}=function(e,t,n,r){let{fn:i,mem:o}=e,a=o.alloc(4),s=o.alloc(4),l=e.fileWrite.toNodeFile(n);try{if(o.poke(a,"i32",0),o.poke(s,"i32",-1),!i.EPDFAttachment_ExtractFile(t,l.ptr,BigInt(r??0),a,s))throw _C(Number(o.peek(s,"i32")),r);return{size:Number(o.peek(a,"i32"))>>>0}}finally{l.close(),o.free(s),o.free(a)}}(this.runtime,e,r,i);return{name:t,...n?{mimeType:n}:{},size:o,path:r}}let{bytes:o,size:a}=_N(this.runtime,e,i);return{name:t,...n?{mimeType:n}:{},size:a,bytes:o}}},wh=class{constructor(e,t){this.runtime=e,this.session=t}create(e,t,n){let r;hW(n);let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr();if(!t)throw new N(G.InvalidArg,"an attachments.create op needs its bytes as its file resource",{details:{field:"resources.file"}});if(0===e.name.length)throw new N(G.InvalidArg,"attachment file requires a name");if(-1!==_G(i,o,a,{kind:"key",key:e.name}))throw new N(G.InvalidArg,`an embedded file with key \'${e.name}\' already exists \\u2014 keys are unique; rename and retry`);hW(n);let s=o.writeU16String(e.name);try{r=i.FPDFDoc_AddAttachment(a,s)}finally{o.free(s)}if(!r)throw new N(G.Unknown,"FPDFDoc_AddAttachment returned NULL");_O(i,o,r,a,e,{bytes:t,...void 0!==e.mimeType?{mimeType:e.mimeType}:{},name:e.name});let l=n$(e.name),u=this.find(l);if(!u)throw new N(G.Unknown,"created attachment did not resolve by key after the write");return{attachment:u,meta:this.meta(l)}}find(e){let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr(),i=_G(t,n,r,e),o=i<0?null:t.FPDFDoc_GetAttachment(r,i);return o?{..._I(t,n,o),ref:e,index:i}:null}meta(e){return{affectedPages:[],cacheDelta:null,...this.session.writeStamp(),changedRefs:[e]}}delete(e,t){hW(t);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=_G(n,r,i,e);if(o<0)throw new N(G.NotFound,`no embedded file with key \'${e.key}\' in the document`);if(!n.FPDFDoc_DeleteAttachment(i,o))throw new N(G.Unknown,"FPDFDoc_DeleteAttachment returned false");return{meta:this.meta(e)}}},wF=e=>new wh(e.runtime,e.session);function wg(e,t){var n,r,i;let o=wF(e);if(!o.find(t))throw new N(G.NotFound,`no embedded file with key \'${t.key}\' in the document`,{details:{field:"ref"}});let a=(n=e.runtime,r=e.session.requireDocPtr(),i=t.key,yz(n,`attachment \'${i}\'`,e=>h5(n.mem,i,t=>n.fn.EPDFAttachment_ExportRawToOwnedBuffer(r,t,e))));return{item:{type:"attachments.delete",...o.delete(t,e.signal)},reverse:[{kind:"attachments.restore",ref:t,capture:a}]}}function w_(e,t){let n=y$(e.runtime,e.session.requireDocPtr(),t.key);if(!n)throw new N(G.Unknown,`attachment \'${t.key}\' is not there to guard`);return{kind:"attachments.remove",ref:t,left:n}}function wP(e,t,n){let{fn:r}=e;if("objectNumber"===n.kind){let e=r.EPDFForm_GetFieldIndexByObjNum(t,n.objectNumber);if(e<0)throw new N(G.NotFound,`form field not found: object ${n.objectNumber}`);return{fieldIndex:e,fieldObjectNumber:n.objectNumber}}let i=r.EPDFForm_CountFields(t);for(let o=0;or.EPDFForm_GetFieldName(t,o,e,n))??"")===n.name)return{fieldIndex:o,fieldObjectNumber:r.EPDFForm_GetFieldObjNum(t,o)};throw new N(G.NotFound,`form field not found: "${n.name}"`)}function wD(e){return"objectNumber"===e.ref.kind?e.ref.objectNumber:0}var wb={0:"whole-revision",1:"partial",2:"malformed"},wy={1:"all",2:"include",3:"exclude"};function ww(e,t){return h3(e.mem,t,"")}function wE(e){return 1===e||2===e||3===e}function wA(e,t,n){let{fn:r,mem:i}=e;return hY(i,32,e=>{for(let t=0;t<4;t++)Ft(i,e,0,8*t);return r.EPDFSig_GetByteRange(t,n,e)?[Fn(i,e,0),Fn(i,e,8),Fn(i,e,16),Fn(i,e,24)]:null})}function wv(e,t,n,r){let{fn:i}=e,o=wy[1===r?i.EPDFSig_GetLockAction(t,n):i.EPDFSig_GetFieldMDPAction(t,n)];if(!o)return null;let a=[],s=i.EPDFSig_GetFieldNameCount(t,n,r);for(let o=0;oi.EPDFSig_GetFieldNameAt(t,n,r,o,e,a))??"");let l={action:o,fields:a};if(1===r){let e=i.EPDFSig_GetLockPermission(t,n);wE(e)&&(l.permission=e)}return l}function wS(e,t){let{fn:n}=e,r=n.EPDFSig_Count(t),i=[],o=(r,i)=>ww(e,(e,o)=>n.EPDFSig_GetString(t,r,i,e,o));for(let s=0;sn.EPDFSig_GetFieldName(t,s,e,r))??"",widget:l>0?eR(l,Dl(n.EPDFSig_GetWidgetPageObjNum(t,s))):null,signed:r,kind:1===n.EPDFSig_GetKind(t,s)?"timestamp":"signature",filter:o(s,0),subFilter:o(s,1),byteRange:r?wA(e,t,s):null,contentsSizeBytes:r?Math.max(0,n.EPDFSig_GetContents(t,s,0n,0)):0,coverage:r?wb[n.EPDFSig_GetCoverage(t,s)]??"malformed":null,revisionIndex:r&&u>=0?u:null,signer:{name:o(s,2),reason:o(s,3),location:o(s,4),contactInfo:o(s,5),signedAt:(a=o(s,6))?hq(a):null},docMdp:wE(d)?d:null,catalogCertification:n.EPDFSig_IsCatalogCertification(t,s),fieldMdp:wv(e,t,s,0),lock:wv(e,t,s,1),seedValue:function(e,t,n){let{fn:r}=e;if(!r.EPDFSig_HasSeedValue(t,n))return null;let i=r.EPDFSig_GetSeedValueRequiredFlags(t,n)>>>0,o=r.EPDFSig_GetSeedValuePresentFlags(t,n)>>>0,a=r.EPDFSig_GetSeedValueVersion(t,n),s=r.EPDFSig_GetSeedValueMDP(t,n),l=i=>{let o=r.EPDFSig_GetSeedValueListCount(t,n,i),a=[];for(let s=0;sr.EPDFSig_GetSeedValueListAt(t,n,i,s,e,o))??"");return a};return{parserVersion:a>0?a:null,parserVersionRequired:(4&i)!=0,mdp:(131072&o)!=0&&s>=0&&s<=3?s:null,filter:ww(e,(e,i)=>r.EPDFSig_GetSeedValueFilter(t,n,e,i)),filterRequired:(1&i)!=0,subFilters:l(0),subFiltersRequired:(2&i)!=0,digestMethods:l(1),digestMethodsRequired:(64&i)!=0,reasons:l(2),reasonsRequired:(8&i)!=0,unsupportedRequired:(432&i)!=0||(4&i)!=0&&a>2}}(e,t,s)})}return i}function wk(e,t,n){let{fn:r,mem:i}=e,o=r.EPDFSig_GetContents(t,n,0n,0);if(o<=0)throw new N(G.NotFound,"signature has no usable /Contents (malformed encoding)");return hY(i,o,e=>{if(r.EPDFSig_GetContents(t,n,e,o)!==o)throw new N(G.Unknown,"failed to read signature contents");let a=new Uint8Array(o);return a.set(i.readBytes(e,o)),a})}function wx(e,t,n){let{fn:r,mem:i}=e,o=r.EPDFDoc_GetRevisionCount(t),a=[];return o<=0||h0(i,[8,8],([e,s])=>{for(let l=0;le.revisionIndex===l);a.push({index:l,end:Fn(i,e),xrefOffset:Fn(i,s),signatureIndex:o?o.index:null})}}),a}function wG(e,t,n){let r=e.fn.EPDFSig_LoadModel(t);if(0n===r)throw new N(G.Unknown,"failed to build signature model");try{return n(r)}finally{e.fn.EPDFSig_CloseModel(r)}}function wO(e,t){let{fn:n,mem:r}=e,[i,o,a]=h0(r,[4,4,4],([e,i,o])=>(r.poke(e,"i32",0),r.poke(i,"i32",0),r.poke(o,"i32",0),n.EPDFDoc_GetStructureObjectNumbers(t,e,i,o),[Number(r.peek(e,"i32"))>>>0,Number(r.peek(i,"i32"))>>>0,Number(r.peek(o,"i32"))>>>0])),s=[],l=n.FPDF_GetPageCount(t);for(let e=0;e{u.push({objectNumber:wD(e),name:e.name,kind:e.kind,widgets:e.widgets.map(e=>e.objectNumber),flags:n.EPDFForm_GetFieldFlags(d,t)})})}finally{n.EPDFForm_CloseModel(d)}return{root:i,acroForm:o,pagesRoot:a,pages:s,fields:u,signatures:wG(e,t,t=>wS(e,t))}}var wI=new WeakMap;function wN(e,t){let n=t.cacheSeq(),r=wI.get(t);if(r&&r.seq===n)return r.ptr;r&&(e.fn.EPDFSig_CloseModel(r.ptr),wI.delete(t));let i=e.fn.EPDFSig_LoadModel(t.requireDocPtr());if(0n===i)throw new N(G.Unknown,"failed to build signature model");return wI.set(t,{seq:n,ptr:i}),i}function wC(e,t){let n=wI.get(t);n&&(e.fn.EPDFSig_CloseModel(n.ptr),wI.delete(t))}var wj={sha1:0,sha256:1,sha384:2,sha512:3},wM={sha1:20,sha256:32,sha384:48,sha512:64},wR=class{constructor(e,t){this.runtime=e,this.session=t}readSnapshot(){let e=wN(this.runtime,this.session),t=this.runtime.fn.EPDFSig_IsRevisionChainValid(e),n=wS(this.runtime,e);return{chainValid:t,revisions:t?wx(this.runtime,this.session.requireDocPtr(),n):[],signatures:n,protection:iM(n)}}readProtection(){let e=wN(this.runtime,this.session);return iM(wS(this.runtime,e))}readContents(e){let t=wN(this.runtime,this.session),n=this.requireSignedIndex(t,e);return wk(this.runtime,t,n).buffer}digest(e,t){let n=wN(this.runtime,this.session),r=this.requireSignedIndex(n,e),i=wA(this.runtime,n,r);if(!i)throw new N(G.NotFound,"signature has no usable /ByteRange");return this.digestRange(i,t)}revisionBytes(e){let t=this.readSnapshot();if(!t.chainValid)throw new N(G.MalformedPdf,"revision chain is not valid");let n=t.revisions[e];if(!n)throw new N(G.NotFound,`no revision ${e}`);return this.readLoadedBytes(0,n.end)}resolveField(e){let{fn:t}=this.runtime,n=wN(this.runtime,this.session),r=this.indexOf(n,e);if(r<0)throw new N(G.NotFound,"objectNumber"===e.kind?`signature field not found: object ${e.objectNumber}`:`signature field not found: "${e.name}"`);let i=t.EPDFSig_GetWidgetObjNum(n,r);return{index:r,fieldObjectNumber:t.EPDFSig_GetFieldObjNum(n,r),signed:t.EPDFSig_IsSigned(n,r),widget:i>0?eR(i,Dl(t.EPDFSig_GetWidgetPageObjNum(n,r))):null,lock:wv(this.runtime,n,r,1)}}readSignatureByObjectNumber(e){let t=this.readSnapshot().signatures.find(t=>"objectNumber"===t.field.kind&&t.field.objectNumber===e);if(!t)throw new N(G.NotFound,`signature field not found: object ${e}`);return t}loadedBytes(){let e=Number(this.runtime.fn.EPDFDoc_GetLoadedBytesSize(this.session.requireDocPtr()));return this.readLoadedBytes(0,e)}version(){let{fn:e,mem:t}=this.runtime,n=this.session.requireDocPtr(),r=Number(e.EPDFDoc_GetBaseBytesSize(n));if(r<=0)throw new N(G.DocNotOpen,"document has no loaded bytes");if("layer"===this.session.kind)return{sha256:hY(t,32,r=>{if(!e.EPDFLayer_GetBaseSha256(n,r))throw new N(G.Unknown,"failed to read the base hash");return wB(t.readBytes(r,32))}),sizeBytes:r};let i=this.session.cachedPlainSha256();if(i)return{sha256:i,sizeBytes:r};let o=wB(new Uint8Array(this.digestRange([0,r,r,0],"sha256")));return this.session.rememberPlainSha256(o),{sha256:o,sizeBytes:r}}digestRange(e,t){let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=wM[t];return h0(r,[32,o,8],([a,s,l])=>{for(let t=0;t<4;t++)Ft(r,a,e[t],8*t);if(Ft(r,l,o),!n.EPDFSig_DigestByteRange(i,a,wj[t],s,l))throw new N(G.InvalidArg,"byte range is not within the loaded bytes");let u=Number(r.peek(l,"i32"));return wT(r.readBytes(s,u))})}readLoadedBytes(e,t){let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr();return 0===t?new ArrayBuffer(0):hY(r,t,o=>{if(n.EPDFDoc_ReadLoadedBytes(i,BigInt(e),o,t)!==t)throw new N(G.Unknown,"failed to read the loaded bytes");return wT(r.readBytes(o,t))})}indexOf(e,t){let{fn:n}=this.runtime;if("objectNumber"===t.kind)return n.EPDFSig_GetIndexByFieldObjNum(e,t.objectNumber);let r=n.EPDFSig_Count(e);for(let i=0;in.EPDFSig_GetFieldName(e,i,t,r))===t.name)return i;return -1}requireSignedIndex(e,t){let{fn:n}=this.runtime,r=this.indexOf(e,t);if(r<0)throw new N(G.NotFound,"objectNumber"===t.kind?`signature field not found: object ${t.objectNumber}`:`signature field not found: "${t.name}"`);if(!n.EPDFSig_IsSigned(e,r))throw new N(G.NotFound,"signature field is not signed");return r}readString(e,t,n){return this.readWide((r,i)=>this.runtime.fn.EPDFSig_GetString(e,t,n,r,i))}readWide(e){return h3(this.runtime.mem,e,"")}};function wT(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}function wB(e){let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}var wL=new WeakMap;function w$(e,t){let n=t.cacheSeq(),r=wL.get(t);if(r&&r.seq===n)return r.locks;let i=null;try{let n=new wR(e,t).readProtection();n.fieldLocks.length>0&&(i=e=>(function(e,t){for(let n of e.fieldLocks)if(ij(n.spec,t))return n;return null})(n,e))}catch{i=null}return wL.set(t,{seq:n,locks:i}),i}function wz(e,t){return"protect"!==t.signedDocumentPolicy?null:w$(e,t)}function wU(e,t,n,r){let{fn:i,mem:o}=e,a=[],s=new Set;for(let l of n){if(!l.ref||s.has(l.objectNumber))continue;s.add(l.objectNumber);let n=function(e,t,n){try{return gC(e,t,n.ref)}catch(e){if(N.is(e)&&e.code===G.NotFound)return null;throw e}}(e,t,l);if(!n)continue;let u=gM(e,t,n.pageIndex,n.index);try{let e=b8(i,o,u,l.ref.page.objectNumber,n.index,gJ(t,r));"widget"===e.subtype&&a.push(e)}finally{i.FPDFPage_CloseAnnot(u)}}return Dd(e,t,a),a}function wV(e,t,n,r){return{...n,widgets:wU(e,t,n.meta.changedWidgets,r)}}var wW=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}snapshot(e){return hW(e),function(e,t,n,r){let{formKind:i,needsAppearances:o,fields:a,calculationOrder:s}=Do(e,gv(e,t),t.requireDocPtr(),w$(e,t));return{formKind:i,needsAppearances:o,fields:a,widgets:function(e,t,n,r){let{fn:i}=e,o=t.requireDocPtr(),a=[],s=i.FPDF_GetPageCount(o);for(let l=0;li.EPDFPage_GetAnnotRaw(o,l,e),signal:n,family:"widgets",...r?{fonts:r}:{}});a.push(...d)}return a}(e,t,n,r),calculationOrder:s}}(this.runtime,this.session,e,this.fonts)}field(e,t){hW(t);let n=gv(this.runtime,this.session),{fieldIndex:r}=wP(this.runtime,n,e);return Di(this.runtime,n,r,this.session.requireDocPtr(),w$(this.runtime,this.session))}};function wq(e,t,n,r,i,o){let{fn:a,mem:s}=e,l=a.EPDFPage_CreateAnnotRaw(t,n,20,i??0);if(0n===l&&void 0!==i)throw Ff(i,"taken");if(0n===l)throw new N(G.Unknown,"failed to create widget annotation");try{DG(a,s,l,"NM",iY());let{page:n,rect:i,rotation:u,exportValue:d,actions:c,...f}=r;Dx(a,s,l,i),u&&b1(a,l,u),Object.keys(f).length>0&&b0(a,s,l,f,o),c&&PM(e,t,l,c);let m=a.EPDFAnnot_GetObjectNumber(l);if(m<=0)throw new N(G.Unknown,"widget annotation has no object number");return m}finally{a.FPDFPage_CloseAnnot(l)}}function wH(e,t,n,r){if(!n.ref)return;let i=gj(e,t,n.ref);try{Dk(e.fn,i,r)}finally{e.fn.FPDFPage_CloseAnnot(i)}}function wK(e,t){let{fn:n}=e,r=[],i=n.EPDFForm_CountCalculationOrder(t);for(let e=0;e0&&!r.includes(o)&&r.push(o)}return r}function wZ(e,t,n){let{fn:r,mem:i}=e;if(!h1(i,n,(e,n)=>r.EPDFForm_SetCalculationOrder(t,e,n)))throw new N(G.InvalidArg,"the calculation order could not be written")}function wJ(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function wQ(e,t){let n=e.indexOf(t);if(!(n<0))return 0===n?null:e[n-1]}function wX(e,t,n,r,i=!1,o="appearance"){let a=i?{mimeType:"application/pdf"}:nx(n);if(!a)throw new N(G.InvalidArg,`the ${o} resource must be PNG, JPEG or one-page PDF bytes`);if("application/pdf"!==a.mimeType)return a;let s=DE(e,t,n);if(null===s)throw new N(G.MalformedPdf,`the ${o} PDF could not be opened`);if(1!==s)throw new N(G.InvalidArg,`the ${o} PDF has ${s} pages; ${r} takes a one-page PDF`);return a}function wY(e){return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer}var w0={readOnly:1,required:2,noExport:4,multiline:4096,password:8192,noToggleToOff:16384,edit:262144,multiSelect:2097152,comb:0x1000000,radiosInUnison:0x2000000};function w1(e){let t=0,n=0;for(let[r,i]of Object.entries(w0)){let o=e[r];!0===o?t|=i:!1===o&&(n|=i)}return{setBits:t,clearBits:n}}function w3(e,t,n,r,i){let{mem:o,fn:a}=e,s=wY(i.bytes),l=wX(a,o,s,"a signature appearance",i.declaredPdf);w2(e,t,r,e=>{let r=Dy(a,o,t,n,s,l);if(!a.EPDFAnnot_SetDrawing(e,r,0))throw new N(G.InvalidArg,"the appearance page could not be drawn into the widget")})}function w2(e,t,n,r){let{fn:i}=e,o=new h8;try{let e=n.page?i.EPDFDoc_LoadPageByObjectNumber(t,n.page.objectNumber):0n;if(!e)throw new N(G.NotFound,"the widget page could not be loaded");o.push(()=>i.FPDF_ClosePage(e));let a=i.EPDFPage_GetAnnotByObjectNumber(e,n.objectNumber);if(!a)throw new N(G.NotFound,"the signature widget could not be loaded");o.push(()=>i.FPDFPage_CloseAnnot(a)),r(a)}finally{o.close()}}var w6={keystroke:0,format:1,validate:2,calculate:3};function w5(e,t,n,r,i){for(let o of Object.keys(w6)){let a=i[o];if(void 0===a)continue;if(null!==a&&!V(a))throw new N(G.InvalidArg,`a field\'s ${o} event takes JavaScript only`,{details:{field:`actions.${o}`}});let s=r?.[o];if(null===a?!s:void 0!==s&&function(e,t){if(e.incomplete||!e.root)return!1;let n=(e,t)=>{if(!e||"javascript"!==e.type||e.script!==t.script)return!1;let r=t.next??[];return e.next.length===r.length&&e.next.every((e,t)=>n(e,r[t]))};return n(e.root,t)}(s,a))continue;let l=null===a?0n:PC(e,t,a);if(!e.fn.EPDFForm_SetFieldEventAction(t,n,w6[o],l))throw new N(G.Unknown,`the field\'s ${o} script could not be written`)}}var w4={none:0,scalar:1,array:2};function w8(e,t,n,r,i){let{fn:o}=e;if("unsupported"===r.kind)return!1;let a="scalar"===r.kind?[r.value]:"array"===r.kind?r.values:[],s="value"===i?o.EPDFForm_SetFieldValue:o.EPDFForm_SetFieldDefaultValue;return gf(e,a,(e,i)=>s(t,n,w4[r.kind],e,i))}var w7={pushbutton:1,checkbox:2,radio:3,text:4,combobox:5,listbox:6,signature:7},w9={visible:0,hidden:1,noPrint:2,noView:3},Ee=new Set(["text","checkbox","radio","combobox","listbox"]),Et=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}setValue(e,t,n){hW(n);let r=gv(this.runtime,this.session),i=wP(this.runtime,r,e);this.assertWritable(i);let o=this.session.requireDocPtr(),a=Di(this.runtime,r,i.fieldIndex,o,w$(this.runtime,this.session)),s=function(e,t){let{field:n}=e,r=r4(n,t);switch(r.kind){case"text":{if("text"!==n.kind)return e;let t=function(e,t){if(!t)return e;let n=Array.from(e);return n.length>t?n.slice(0,t).join(""):e}(r.value,n.maxLength);if(t===n.value)return e;return il({...n,value:t,valueEntry:{kind:"scalar",value:t}},e)}case"toggle":{if("checkbox"!==n.kind&&"radio"!==n.kind)return e;let t=n.widgets.findIndex(e=>e.onState===r.state);return iu(e,null===r.state?-1:t)}case"choice":if("combobox"!==n.kind&&"listbox"!==n.kind)return e;return il(im(n,r.values),e)}}({field:a,widgets:[]},t).field,l=this.writeFieldAfter(i.fieldObjectNumber,a,s);return this.readBack(i.fieldObjectNumber,l??[])}setDisplay(e,t,n){hW(n);let r=wP(this.runtime,gv(this.runtime,this.session),e);this.assertWritable(r);let i=this.session.requireDocPtr(),o=this.withChangedWidgets((e,n,o)=>this.runtime.fn.EPDFForm_SetFieldDisplay(i,r.fieldObjectNumber,w9[t],e,n,o));if(null===o)throw new N(G.Unknown,"the field could not be shown or hidden");return this.readBack(r.fieldObjectNumber,o,!1)}setAppearanceText(e,t,n){hW(n);let r=gv(this.runtime,this.session),i=wP(this.runtime,r,e);this.assertWritable(i);let o=this.session.requireDocPtr(),a=Di(this.runtime,r,i.fieldIndex,o,w$(this.runtime,this.session));if("text"!==a.kind&&"combobox"!==a.kind)throw new N(G.InvalidArg,`appearance text does not apply to a ${a.kind} field`);let s=h5(this.runtime.mem,t,e=>this.withChangedWidgets((t,n,r)=>this.runtime.fn.EPDFForm_SetFieldAppearanceText(o,i.fieldObjectNumber,e,t,n,r)));if(null===s)throw new N(G.Unknown,"the appearance text could not be drawn");return this.readBack(i.fieldObjectNumber,s,!0)}emptyMeta(){return{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}reset(e,t){hW(t);let n=gv(this.runtime,this.session),r=void 0===e?this.wholeFormTargets(n):this.namedTargets(n,e);hW(t);let i=r.filter(e=>!function(e){if("unsupported"===e.valueEntry.kind||!r7(e.valueEntry,e.defaultValueEntry))return!1;if("checkbox"!==e.kind&&"radio"!==e.kind)return!0;let t=e.defaultValueEntry,n="scalar"===t.kind?t.value:null;return e.widgets.every(e=>e.checked===(e.onState===n))}(e)).flatMap(e=>{let t=function(e){let{field:t}=e,n=t.defaultValueEntry;switch(t.kind){case"text":{if("array"===n.kind||"unsupported"===n.kind)throw iw(t);let r="scalar"===n.kind?n.value:"",i="scalar"===n.kind?n:{kind:"none"};return il({...t,value:r,valueEntry:i},e)}case"checkbox":case"radio":{var r,i;let o;if("array"===n.kind||"unsupported"===n.kind)throw iw(t);let a="scalar"===n.kind?n.value:null;if(null===a||"Off"===a)return iu(e,-1);let s=(r=t.widgets,i=a,(o=r.findIndex(e=>e.onState===i))>=0||!/^\\d+$/.test(i)?o:Number(i)0&&this.session.invalidateDerived();let o=[],a=[],s=[];for(let{before:e,changed:t}of i){let n=this.readBackField(wD(e));if(0===t.length&&r7(e.valueEntry,n.valueEntry))continue;o.push(n);let r=new Set(t),i=n.widgets.filter(e=>r.has(e.objectNumber)).map(e=>eR(e.objectNumber,e.page));a.push(...i),s.push(...y8(n.kind,i))}return{fields:o,meta:y4(this.session.writeStamp(),o.map(e=>e.ref),a,s)}}wholeFormTargets(e){let t=this.session.requireDocPtr(),n=wz(this.runtime,this.session),r=[],i=this.runtime.fn.EPDFForm_CountFields(e);for(let o=0;o{if(!n.EPDFForm_Repair(this.session.requireDocPtr(),i,e))throw new N(G.Unknown,"form repair failed");return{acroformCreated:0!==Number(r.peek(e,"i32",0)),fieldsLinked:Number(r.peek(e,"i32",4)),widgetsLinked:Number(r.peek(e,"i32",8)),fieldsUnrepairable:Number(r.peek(e,"i32",12)),appearancesBaked:Number(r.peek(e,"i32",16)),needsAppearancesCleared:0!==Number(r.peek(e,"i32",20))}});return this.session.invalidateDerived(),{...o,meta:this.emptyMeta()}}createField(e,t,n,r={}){let{objectNumber:i,calculationOrder:o}=this.writeField(e,t,n,r);return{field:this.readBackField(i),calculationOrder:o}}writeField(e,t,n,r={}){hW(t);let{fn:i}=this.runtime,o=this.session.requireDocPtr(),a=(e.widgets??[]).map(t=>ot(ir(e.kind,t))),s=a.map(e=>this.preflightPlacement(e)),l=a.map(t=>Ei(e.kind,t));io(e);let u=ee(e),d=rj(e.purpose),c=eC(e.placeholder),f=ex(e,e.kind)??null,m=rK(e,e.kind);if(void 0!==m){for(let e of a)for(let t of rU)if(e.actions?.[t]!==void 0)throw new N(G.InvalidArg,`\'takesImage\' writes each widget\'s press: name it or a widget\'s actions.${t}, not both`,{details:{field:"takesImage"}});if(m&&0===a.length)throw rX()}if("maxLength"in e&&void 0!==e.maxLength&&(!Number.isInteger(e.maxLength)||e.maxLength<=0))throw new N(G.InvalidArg,`maxLength must be a positive integer, got ${e.maxLength}`,{details:{field:"maxLength"}});let{objectNumber:p,widgetObjectNumbers:h}=r;if(h&&h.length!==a.length)throw new N(G.InvalidArg,`forms.create needs one widget object number per widget: ${h.length} for ${a.length}`,{details:{field:"widgetObjectNumbers"}});for(let e of(void 0!==p&&this.session.claimObjectNumber(p),h??[]))this.session.claimObjectNumber(e);hW(t);let F=this.createFieldNode(e,p);this.configureNewField(e,F),f&&w5(this.runtime,o,F,void 0,eA(f)),function(e,t,n,r,i=new Date){r.userId&&P2(e,t,n,[[PZ,r.userId],[PJ,hH(i)]])}(this.runtime,o,F,n),"group"===u.kind&&P2(this.runtime,o,F,[[PW,u.groupId]]),"anyone"===u.kind&&P3(this.runtime,o,F,!0),null!==d&&P2(this.runtime,o,F,[[PH,d]]),null!==c&&P2(this.runtime,o,F,[[PK,c]]);let g=a.map((e,t)=>{let n=wq(this.runtime,o,s[t],m?{...e,actions:rH(e.actions)}:e,h?.[t],yp(this.runtime,this.session,this.fonts));if(!i.EPDFForm_AttachWidget(o,F,n,l[t],0n,0))throw new N(G.Unknown,"widget adoption failed");return eR(n,e.page)}),_=this.followCalculateScript(F,e.actions?.calculate);return this.session.invalidateDerived(),{objectNumber:F,widgets:g,calculationOrder:_}}nativeDeleteField(e){let{fn:t,mem:n}=this.runtime;return h0(n,[1024,8],([r,i])=>(Ft(n,i,0),t.EPDFForm_DeleteField(this.session.requireDocPtr(),e,r,256,i)))}preflightPlacement(e){let t=this.session.resolvePageRef(e.page),{left:n,bottom:r,right:i,top:o}=e.rect;if(![n,r,i,o].every(Number.isFinite))throw new N(G.InvalidArg,"widget rect must be finite numbers",{details:{field:"rect"}});return t.pageIndex}createFieldNode(e,t){let n,{fn:r,mem:i}=this.runtime,o=i.writeU16String(e.name);try{n=r.EPDFForm_CreateField(this.session.requireDocPtr(),w7[e.kind],o,t??0)}finally{i.free(o)}if(n<=0)throw new N(G.InvalidArg,`cannot create field "${e.name}" (name conflict or invalid)`);return n}configureNewField(e,t){let{fn:n}=this.runtime,r=this.session.requireDocPtr(),{setBits:i,clearBits:o}=w1(e);if((0!==i||0!==o)&&n.EPDFForm_SetFieldFlags(r,t,i,o),"options"in e&&e.options&&this.applyOptions(t,e.options),this.writeDefault(t,{kind:"none"},io(e)),"maxLength"in e&&void 0!==e.maxLength&&!n.EPDFForm_SetFieldMaxLen(r,t,e.maxLength))throw new N(G.InvalidArg,"maxLength rejected");void 0!==e.alternateName&&this.applyWideSetter(n.EPDFForm_SetFieldAlternateName,t,e.alternateName,"alternate name rejected"),void 0!==e.mappingName&&this.applyWideSetter(n.EPDFForm_SetFieldMappingName,t,e.mappingName,"mapping name rejected"),e.actions&&w5(this.runtime,r,t,void 0,e.actions)}setSignatureAppearance(e,t,n){hW(n);let r=this.session.requireDocPtr(),i=gv(this.runtime,this.session),o=wP(this.runtime,i,e);this.assertWritable(o);let a=Di(this.runtime,i,o.fieldIndex,r,w$(this.runtime,this.session));if("signature"!==a.kind)throw new N(G.InvalidArg,`\'${a.name}\' is a ${a.kind} field, not a signature field`);if(wG(this.runtime,r,e=>wS(this.runtime,e).some(e=>e.signed&&"objectNumber"===e.field.kind&&e.field.objectNumber===o.fieldObjectNumber)))throw new N(G.ProtectedDocument,`\'${a.name}\' is signed; its appearance is sealed with the signature`);if(0===a.widgets.length)throw new N(G.InvalidArg,`\'${a.name}\' has no widget to draw into`);let s=this.session.drawingIndex();for(let e of a.widgets)null===t?function(e,t,n){let{fn:r}=e;w2(e,t,n,e=>{if(0!==r.EPDFAnnot_GetDrawing(e)&&!r.EPDFAnnot_GenerateFormFieldAP(e))throw new N(G.Unknown,"the signature field\'s box could not be drawn into the widget")})}(this.runtime,r,e):w3(this.runtime,r,s,e,t);return this.session.invalidateDerived(),{field:this.readBackField(o.fieldObjectNumber)}}setButtonImage(e,t,n){hW(n);let{fn:r,mem:i}=this.runtime,o=this.session.requireDocPtr(),a=gv(this.runtime,this.session),s=wP(this.runtime,a,e);this.assertWritable(s);let l=Di(this.runtime,a,s.fieldIndex,o,w$(this.runtime,this.session));if("pushbutton"!==l.kind)throw new N(G.InvalidArg,`\'${l.name}\' is a ${l.kind} field, not a push button`);let u=l.widgets.filter(e=>null!==e.ref);if(null!==t&&0===u.length)throw new N(G.InvalidArg,`\'${l.name}\' has no widget to show an image in`);let d=0;if(null!==t){let e=wY(t),n=wX(r,i,e,"a push button\'s image",!1,"image");d=Dy(r,i,o,this.session.drawingIndex(),e,n)}for(let e of(hW(n),u))PU(this.runtime,this.session,e.ref,d);return this.session.invalidateDerived(),{field:this.readBackField(s.fieldObjectNumber)}}updateField(e,t,n){hW(n);let{fn:r}=this.runtime,i=this.session.requireDocPtr(),o=gv(this.runtime,this.session),a=wP(this.runtime,o,e);this.assertWritable(a);let s=Di(this.runtime,o,a.fieldIndex,this.session.requireDocPtr(),w$(this.runtime,this.session));var l=t,u=s.kind;if(void 0!==l.kind&&l.kind!==u)throw new N(G.InvalidArg,`patch family \'${l.kind}\' does not match field family \'${u}\'`,{details:{field:"kind"}});let d=new Set([...En,...Er[u]??[]]);for(let[e,t]of Object.entries(l))if(void 0!==t&&!d.has(e))throw new N(G.InvalidArg,`\'${e}\' does not apply to a ${u} field`,{details:{field:e}});let c="defaultValue"in l?l.defaultValue:void 0;if(null!=c&&Array.isArray(c)!==("listbox"===u))throw new N(G.InvalidArg,"listbox"===u?"a list\'s defaultValue is a list of option values":`a ${u} field\'s defaultValue is one string`,{details:{field:"defaultValue"}});let f=et(t,s),m=Y(f),p="anyone"===f.kind,h=P1(this.runtime,o,a.fieldIndex),F=void 0===t.purpose?void 0:rj(t.purpose),g=void 0===t.placeholder?void 0:eC(t.placeholder),_=ex(t,s.kind),P=rK(t,s.kind),D=void 0===P?[]:this.pressesOf(s);if(P){let e=D.filter(e=>null!==e);rJ(e,D.length-e.length)}"defaultValue"in t&&void 0!==t.defaultValue&&ia({field:s,widgets:[]},t);let b=a.fieldObjectNumber;void 0!==t.name&&this.applyWideSetter(r.EPDFForm_SetFieldName,b,t.name,`cannot rename to "${t.name}" (sibling conflict or invalid)`);let{setBits:y,clearBits:w}=w1(t);if((0!==y||0!==w)&&!r.EPDFForm_SetFieldFlags(i,b,y,w))throw new N(G.InvalidArg,"flag update rejected");if("maxLength"in t&&void 0!==t.maxLength&&!r.EPDFForm_SetFieldMaxLen(i,b,t.maxLength??0))throw new N(G.InvalidArg,"maxLength rejected (current value exceeds it)");void 0!==t.alternateName&&this.applyWideSetter(r.EPDFForm_SetFieldAlternateName,b,t.alternateName??"","alternate name rejected"),void 0!==t.mappingName&&this.applyWideSetter(r.EPDFForm_SetFieldMappingName,b,t.mappingName??"","mapping name rejected"),m!==s.groupId&&P2(this.runtime,i,b,[[PW,m]]),p!==h&&P3(this.runtime,i,b,p),void 0!==F&&F!==s.purpose&&P2(this.runtime,i,b,[[PH,F]]),void 0!==g&&g!==s.placeholder&&P2(this.runtime,i,b,[[PK,g]]),void 0===_||eS(_,"format"in s?s.format:null)||w5(this.runtime,i,b,s.actions,eA(_));let E="options"in t&&void 0!==t.options,A="defaultValue"in t&&void 0!==t.defaultValue;if(E||A){let e=ia({field:s,widgets:[]},t).field;"options"in t&&t.options&&this.applyOptions(b,t.options),this.writeDefault(b,s.defaultValueEntry,e.defaultValueEntry),E&&this.writeFieldAfter(b,s,e,!0)}t.actions&&w5(this.runtime,i,b,s.actions,t.actions),void 0!==P&&s.widgets.forEach((e,t)=>{let n=D[t];if(!n||!e.ref)return;let r=rZ(n,P);"keep"!==r.kind&&function(e,t,n,r){let i=gj(e,t,n);try{PM(e,t.requireDocPtr(),i,rQ(r))}finally{e.fn.FPDFPage_CloseAnnot(i)}}(this.runtime,this.session,e.ref,r)});let v=this.followCalculateScript(b,t.actions?.calculate);return this.session.invalidateDerived(),{field:this.readBackField(b),calculationOrder:v}}pressesOf(e){let t=this.session.requireDocPtr();return Pz(this.runtime,t,e.widgets,new PR(this.runtime,t))}reorderCalculations(e,t,n){hW(n);let r=gv(this.runtime,this.session),i=e=>wP(this.runtime,r,e).fieldObjectNumber,o=wK(this.runtime,r),a=e.map(i),s=nD(o,a,"start"===t||"end"===t?t:"before"in t?{before:i(t.before)}:{after:i(t.after)},String);return hW(n),wJ(o,s)||(wZ(this.runtime,this.session.requireDocPtr(),s),this.session.invalidateDerived()),{before:o,after:s,moved:a}}followCalculateScript(e,t){if(void 0===t)return null;let n=wK(this.runtime,gv(this.runtime,this.session)),r=n.includes(e),i=null===t?n.filter(t=>t!==e):r?n:[...n,e];return wJ(n,i)?null:(wZ(this.runtime,this.session.requireDocPtr(),i),{before:n,after:i})}deleteField(e,t){hW(t);let n=gv(this.runtime,this.session),r=wP(this.runtime,n,e);this.assertWritable(r);let i=Di(this.runtime,n,r.fieldIndex,this.session.requireDocPtr(),w$(this.runtime,this.session)),o=i.widgets.map(e=>eR(e.objectNumber,e.page));hW(t);let a=this.followCalculateScript(r.fieldObjectNumber,null);if(!this.nativeDeleteField(r.fieldObjectNumber))throw new N(G.InvalidArg,"field cannot be deleted");this.session.invalidateDerived();let s=new yD(this.runtime,this.session);for(let e of o)e.ref&&s.deleteReleasedWidget(e.ref,r.fieldObjectNumber);return this.session.invalidateDerived(),{deleted:i.ref,removedWidgets:o,calculationOrder:a}}deleteFields(e,t){hW(t);let{fn:n}=this.runtime,r=this.session.requireDocPtr(),i=gv(this.runtime,this.session),o=w$(this.runtime,this.session),a=e.map(e=>{let t=wP(this.runtime,i,e);this.assertWritable(t);let n=Di(this.runtime,i,t.fieldIndex,r,o);return{objectNumber:t.fieldObjectNumber,widgets:n.widgets.map(e=>eR(e.objectNumber,e.page))}}),s=new Set(a.map(e=>e.objectNumber)),l=wK(this.runtime,i),u=l.filter(e=>!s.has(e)),d=wJ(l,u)?null:{before:l,after:u};for(let{objectNumber:e}of(hW(t),d&&wZ(this.runtime,r,u),a))if(!this.nativeDeleteField(e))throw new N(G.InvalidArg,"field cannot be deleted");let c=a.flatMap(e=>e.widgets),f=new Map;for(let e of c){if(!e.ref||!e.page)continue;let t=f.get(e.page.objectNumber)??[];t.push(e.objectNumber),f.set(e.page.objectNumber,t)}for(let[e,t]of f){gx(this.runtime,this.session,e);let{pageIndex:i}=this.session.resolvePageRef(q(e));for(let o of t.map(e=>n.EPDFPage_GetAnnotIndexByObjectNumberRaw(r,i,e)).filter(e=>e>=0).sort((e,t)=>t-e))if(!n.EPDFPage_RemoveAnnotRaw(r,i,o))throw new N(G.Unknown,`a widget could not leave page ${e}`)}return this.session.invalidateDerived(),{removedWidgets:c,calculationOrder:d}}addWidget(e,t,n,r={}){let{objectNumber:i,splitObjectNumber:o}=r,{field:a,widgets:s}=this.addWidgets(e,[{placement:t}],n,{...void 0!==i?{objectNumbers:[i]}:{},...void 0!==o?{splitObjectNumber:o}:{}});return{field:a,widget:s[0]}}addWidgets(e,t,n,r={}){hW(n);let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s=gv(this.runtime,this.session),l=wP(this.runtime,s,e);this.assertWritable(l);let u=Di(this.runtime,s,l.fieldIndex,a,w$(this.runtime,this.session)),d="pushbutton"===u.kind&&u.takesImage,c=t.map(({placement:e})=>{let t=ot(ir(u.kind,e));return d?{...t,actions:rH(t.actions)}:t}),f=c.map(e=>this.preflightPlacement(e)),m=c.map(e=>Ei(u.kind,e)),p="checkbox"===u.kind||"radio"===u.kind,h=p?function(e,t,n=[]){let r="checkbox"===e.kind||"radio"===e.kind,i=r?e.widgets:[],o=new Map;for(let e of i)""===e.onState||o.has(e.exportValue)||o.set(e.exportValue,e.onState);let a=new Set(i.map(e=>e.onState)),s=r&&e.hasValuesList;return t.map((e,t)=>{let r=n[t]??o.get(e)??(s?(()=>{let e=0;for(;a.has(String(e));)e+=1;return String(e)})():e);return a.add(r),o.has(e)||o.set(e,r),r})}(u,m,t.map(e=>e.onState)):m,{objectNumbers:F}=r;if(F&&F.length!==t.length)throw new N(G.InvalidArg,`one widget object number per widget: ${F.length} for ${t.length}`,{details:{field:"objectNumbers"}});let g="pushbutton"===u.kind&&u.hasImage?this.imageOf(u):0,_=u.widgets.find(e=>e.objectNumber===l.fieldObjectNumber)?.page??null;for(let e of F??[])this.session.claimObjectNumber(e);let P=_?r.splitObjectNumber:void 0;if(void 0!==P&&this.session.claimObjectNumber(P),hW(n),_&&gx(this.runtime,this.session,_.objectNumber),r.radiosInUnison){let{setBits:e,clearBits:t}=w1({radiosInUnison:!0});i.EPDFForm_SetFieldFlags(a,l.fieldObjectNumber,e,t)}let D=yp(this.runtime,this.session,this.fonts),b=c.map((e,n)=>{let r,s=wq(this.runtime,a,f[n],e,F?.[n],D),u=p?o.writeU16String(m[n]):0n;try{r=i.EPDFForm_AttachWidget(a,l.fieldObjectNumber,s,h[n],u,(0===n?P:void 0)??0)}finally{0n!==u&&o.free(u)}if(!r)throw new N(G.InvalidArg,"the widget could not join the field");let d=eR(s,e.page);0!==g&&PU(this.runtime,this.session,d.ref,g);let c=t[n].flags;return c&&wH(this.runtime,this.session,d,c),d}),y=m.map(e=>(function(e,t,n=!1){return("checkbox"===e.kind||"radio"===e.kind)&&("radio"!==e.kind||!!e.radiosInUnison||!!n)&&e.widgets.some(e=>e.checked&&e.exportValue===t)})(u,e,r.radiosInUnison));if(y.some(Boolean)){let e=[...u.widgets.map(e=>e.checked),...y];if(null===this.withChangedWidgets((t,n,r)=>h1(this.runtime.mem,e.map(e=>+!!e),(e,o)=>i.EPDFForm_SetFieldWidgetsChecked(a,l.fieldObjectNumber,e,o,t,n,r))))throw new N(G.Unknown,"the new widgets could not take the field\'s value")}this.session.invalidateDerived();let w=this.readBackField(l.fieldObjectNumber);if(p){let e=new Map(w.widgets.map(e=>[e.objectNumber,"exportValue"in e?e.exportValue:null]));for(let[t,n]of b.entries()){let r=e.get(n.objectNumber);if(null!=r&&r!==m[t])throw new N(G.Unknown,`a new widget of \'${u.name}\' reads \'${r}\', not \'${m[t]}\'`)}}return{field:w,widgets:b}}imageOf(e){for(let t of e.widgets){if(null===t.ref)continue;let e=PV(this.runtime,this.session,t.ref);if(0!==e)return e}return 0}detachWidget(e,t,n){hW(n);let{fn:r}=this.runtime,i=gv(this.runtime,this.session),o=wP(this.runtime,i,e);this.assertWritable(o);let a=Eo(t);if(a===o.fieldObjectNumber)throw new N(G.InvalidArg,`widget ${a} is the field\'s own dictionary (a merged field/widget) and cannot be removed from it - delete the field with doc.forms.delete`);if(!r.EPDFForm_DetachWidget(this.session.requireDocPtr(),o.fieldObjectNumber,a))throw new N(G.InvalidArg,"widget is not attached to this field");return this.session.invalidateDerived(),{field:this.readBackField(o.fieldObjectNumber),widget:eR(Eo(t),t.page)}}applyOptions(e,t){let{fn:n}=this.runtime,r=this.session.requireDocPtr();if(!gf(this.runtime,t.map(e=>e.label),i=>gf(this.runtime,t.map(e=>e.value),(t,o)=>n.EPDFForm_SetFieldOptions(r,e,i,t,o))))throw new N(G.InvalidArg,"options rejected")}applyWideSetter(e,t,n,r){let{mem:i}=this.runtime,o=this.session.requireDocPtr(),a=i.writeU16String(n);try{if(!e(o,t,a))throw new N(G.InvalidArg,r)}finally{i.free(a)}}writeDefault(e,t,n){if(r7(t,n))return;let r=this.session.requireDocPtr();if(!w8(this.runtime,r,e,n,"default"))throw new N(G.InvalidArg,"default value rejected")}readBackField(e){let t=gv(this.runtime,this.session),n=this.runtime.fn.EPDFForm_GetFieldIndexByObjNum(t,e);if(n<0)throw new N(G.Unknown,"form field vanished after write");return Di(this.runtime,t,n,this.session.requireDocPtr(),w$(this.runtime,this.session))}assertWritable(e){if(0===e.fieldObjectNumber)throw new N(G.InvalidArg,"form field is stored as a direct object and cannot be written");this.assertNotLockedBySignature(e)}assertNotLockedBySignature(e){let t=wz(this.runtime,this.session);if(!t)return;let n=gv(this.runtime,this.session);var r=h3(this.runtime.mem,(t,r)=>this.runtime.fn.EPDFForm_GetFieldName(n,e.fieldIndex,t,r))??"";let i=t?.(r);if(i)throw new N(G.ProtectedDocument,`form field "${r}" is locked by signature ${i.signatureIndex} (${"fieldmdp"===i.source?"FieldMDP":"/Lock"})`)}writeFieldAfter(e,t,n,r=!1){let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s="checkbox"===n.kind||"radio"===n.kind?n.widgets:null,l=!r7(t.valueEntry,n.valueEntry),u=s?.some((e,n)=>e.checked!==t.widgets[n]?.checked)??!1;if(!l&&!u&&!r)return null;let d=()=>new N(G.InvalidArg,`\'${n.name}\' could not take the value`);if(l&&!w8(this.runtime,a,e,n.valueEntry,"value"))throw d();if("combobox"===n.kind||"listbox"===n.kind){var c;let t=n.options.flatMap((e,t)=>e.selected?[t]:[]);if(c=this.runtime,!h1(c.mem,t,(t,n)=>c.fn.EPDFForm_SetFieldSelectedIndices(a,e,t,n)))throw d()}if(s?.length===0)return[];let f=this.withChangedWidgets((t,n,r)=>s?h1(o,s.map(e=>+!!e.checked),(o,s)=>i.EPDFForm_SetFieldWidgetsChecked(a,e,o,s,t,n,r)):i.EPDFForm_RedrawFieldWidgets(a,e,t,n,r));if(null===f)throw d();return f}withChangedWidgets(e){let{mem:t}=this.runtime;return h0(t,[1024,8],([n,r])=>{if(Ft(t,r,0),!e(n,256,r))return null;let i=Math.min(Number(t.peek(r,"i32")),256),o=[];for(let e=0;ea.has(e.objectNumber)).map(e=>eR(e.objectNumber,e.page));return{field:o,meta:y4(this.session.writeStamp(),[o.ref],s,void 0===n?y8(o.kind,s):n?s:[])}}},En=["kind","name","readOnly","required","noExport","alternateName","mappingName","groupId","assignment","purpose","placeholder","actions"],Er={text:["defaultValue","maxLength","multiline","password","comb","format"],radio:["radiosInUnison","noToggleToOff"],combobox:["edit","defaultValue","options","format"],listbox:["multiSelect","options","defaultValue"],pushbutton:["takesImage"]};function Ei(e,t){let{exportValue:n}=t;if("checkbox"!==e&&"radio"!==e){if(void 0!==n)throw new N(G.InvalidArg,`\'exportValue\' applies to checkbox and radio widgets, not a ${e} field\'s`,{details:{field:"exportValue"}});return""}let r=n??("checkbox"===e?"Yes":void 0);if(!r||"Off"===r)throw new N(G.InvalidArg,"radio"===e?\'every radio button needs an exportValue other than "Off"\':"a checkbox\'s exportValue can\'t be \\"Off\\"",{details:{field:"exportValue"}});return r}function Eo(e){if("objectNumber"!==e.kind)throw new N(G.InvalidArg,"widget must be addressed by object number");return e.objectNumber}function Ea(e,t,n,r,i,o){let a=()=>wK(e,gv(e,t)),s=a(),l=gF(e,t),u=new Et(e,t,n),d=r.map((n,r)=>{let{groupId:i,assignment:a,...s}=i6(n.draft,l),d=o.assignmentOf(a??X(i??null)),[c,...f]=n.objectNumbers??[],{objectNumber:m,widgets:p}=u.writeField({...s,assignment:d},o.signal,o.actor,void 0===c?{}:{objectNumber:c,widgetObjectNumbers:f});return p.forEach((r,i)=>wH(e,t,r,n.flags[i])),n.images?.forEach((n,r)=>{let i=p[r];n&&i?.ref&&PU(e,t,i.ref,function(e,t,n){if("drawing"in n)return n.drawing;let{fn:r,mem:i}=e,o=wX(r,i,n.bytes,"a push button\'s image",!1,"image");return Dy(r,i,t.requireDocPtr(),t.drawingIndex(),n.bytes,o)}(e,t,n))}),t.invalidateDerived(),n.value&&u.setValue(Es(m),n.value,o.signal),o.made?.(m,r),m}),c=i.map(e=>Es(d[e]));c.length>0&&u.reorderCalculations(c,"end",o.signal),t.invalidateDerived();let f=a(),m=d.map(n=>{let r=gv(e,t);return Di(e,r,e.fn.EPDFForm_GetFieldIndexByObjNum(r,n),t.requireDocPtr(),w$(e,t))});return wV(e,t,{fields:m,...wJ(s,f)?{}:{calculationOrder:f.map(Es)},meta:y4(t.writeStamp(),m.map(e=>e.ref),m.flatMap(e=>e.widgets))},n)}function Es(e){return{kind:"objectNumber",objectNumber:e}}function El(e){let{groupOf:t,assignmentOf:n}=e;return n||(t?e=>"anyone"===e.kind?e:X(t(Y(e))):e=>e)}var Eu=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}copy(e,t){hW(t),y0(e.limits,"items",e.fields.length),e.page&&this.session.resolvePageRef(e.page);let n=i8(new wW(this.runtime,this.session,this.fonts).snapshot(t),gF(this.runtime,this.session)),r=function(e){let t=function(e){let{form:t,mayScript:n,placement:r}=e,i=new Map(t.widgets.map(e=>[K(e.ref),e])),o=e.widgets?new Set(e.widgets.map(K)):null,a=new Set(t.fields.map(e=>e.name)),s=r.offset??{x:0,y:0},l=[],u=[],d=[],c=new Set;for(let f of(e.fields.forEach((f,m)=>{let p=t.fields.find(e=>ae(e,f));if(!p)throw new N(G.NotFound,`copy: no form field ${eM(f)}`,{details:{item:m}});let h=p.widgets.flatMap(e=>{let t=e.ref?i.get(K(e.ref)):void 0;return t&&(!o||o.has(K(t.ref)))?[t]:[]}),F=aa(p,h);for(let e of h)c.add(K(e.ref));if(o&&0===h.length)throw new N(G.InvalidArg,`copy: \'widgets\' names no widget of field ${m}`,{details:{item:m,field:"widgets"}});if("unknown"===F.kind)return void l.push({ref:F.ref,reason:"unsupported-kind"});let g=af(F.name,e=>ac(a,e));a.add(g);let _=ao(F,n,l),P=h.map(e=>{let t;return{...t=as(F,e,e=>e,n,l),...r.page?{page:r.page}:{},...t.rect?{rect:{...t.rect,x:t.rect.x+s.x,y:t.rect.y+s.y}}:{}}}),D=e.values&&"signature"!==F.kind&&ar(F)?ad(F):null;d.push(p),u.push({source:m,draft:au(F,g,_,P,`copy: field ${m}`),widgets:h.map(e=>e.ref),flags:h.map(al),...D?{value:D}:{}})}),o??[]))if(!c.has(f))throw new N(G.InvalidArg,`copy: widget ${f} is a widget of none of the fields`,{details:{field:"widgets"}});return{creates:u,calculationOrder:t.calculationOrder.flatMap(e=>e?u.flatMap((t,n)=>ae(d[n],e)&&t.draft.actions?.calculate?[n]:[]):[]),dropped:l}}(e);for(let e of t.creates)hT(e.draft,`copy: field ${e.source}`,{item:e.source});return t}({form:n,fields:e.fields,...e.widgets?{widgets:e.widgets}:{},placement:{...e.page?{page:e.page}:{},...e.offset?{offset:e.offset}:{}},values:e.values,mayScript:e.mayScript}),{objectNumbers:i}=e,o=r.creates.reduce((e,t)=>e+1+t.widgets.length,0);if(i&&i.length!==o)throw new N(G.InvalidArg,`copy: objectNumbers names ${i.length} objects of ${o}`,{details:{field:"objectNumbers"}});let a=0,s=Ea(this.runtime,this.session,this.fonts,r.creates.map(t=>{let n=1+t.widgets.length,r=i?.slice(a,a+n);a+=n;let o=e.values&&"pushbutton"===t.draft.kind?t.widgets.map(e=>{let t=PV(this.runtime,this.session,e);return 0===t?null:{drawing:t}}):void 0;return{...t,...r?{objectNumbers:r}:{},...o?{images:o}:{}}}),r.calculationOrder,{actor:e.actor,assignmentOf:El(e),signal:t});return{...s,refMap:r.creates.map((t,r)=>({from:n.fields.find(n=>ae(n,e.fields[t.source])).ref,to:s.fields[r].ref})),dropped:[...r.dropped]}}},Ed=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}import(e,t){hW(t),yI(this.runtime,"form",e.bundle,e.limits,rw);let n=rb(e.bundle),r=this.fieldNames(),i=function(e){let{bundle:t,mayScript:n}=e,r=tP({bundlePages:t.pages,pages:e.pages??"same",target:e.target,named:t.widgets.flatMap(e=>rB(e.data))}),i=new Map(t.widgets.map((e,t)=>[K(e.data.ref),t])),o=new Set,a=[],s=new Set,l=[];return t.fields.forEach(({data:u},d)=>{var c,f,m,p;let h,F=u.widgets.flatMap(e=>{let t=e.ref?i.get(K(e.ref)):void 0;return void 0===t?[]:[t]});for(let e of F)o.add(e);let g=aa(u,F.map(e=>t.widgets[e].data));if("unknown"===g.kind)return void a.push({ref:g.ref,reason:"unsupported-kind"});if(s.has(g.name)||e.nameTaken(g.name))return void a.push({ref:g.ref,reason:"name-conflict"});s.add(g.name);let _=(c=g,f=ao(g,n,a),m=F.map(e=>as(g,t.widgets[e].data,r,n,a)),p=d,h=`import: field ${p}`,hT(au(c,c.name,f,m,h),h,{item:p})),P=e.values&&ar(g)?ad(g):null;l.push({field:d,draft:_,widgets:F,flags:F.map(e=>al(t.widgets[e].data)),...P?{value:P}:{}})}),t.widgets.forEach((e,t)=>{o.has(t)||a.push({ref:e.data.field,widget:e.data.ref,reason:"no-field"})}),{creates:l,calculationOrder:t.calculationOrder.flatMap(e=>{let n=l.findIndex(n=>eM(t.fields[n.field].data.ref)===eM(e)&&n.draft.actions?.calculate);return n<0?[]:[n]}),dropped:a}}({bundle:n,...void 0!==e.pages?{pages:e.pages}:{},target:this.session.allRecords().map(e=>({page:q(e.pageObjectNumber),position:e.pageIndex})),nameTaken:e=>ac(r,e),mayScript:e.mayScript,values:e.values}),o=this.session.requireDocPtr(),a=e.actor.userId??null,s="restore"===e.attribution,l=i.creates.map(t=>{if(!e.values||"pushbutton"!==t.draft.kind)return t;let r=t.widgets.map(e=>{let t=n.widgets[e]?.resources.image,r=void 0===t?void 0:n.resources[t];return r?{bytes:r}:null});return r.some(Boolean)?{...t,images:r}:t}),u=Ea(this.runtime,this.session,this.fonts,l,i.calculationOrder,{actor:e.actor,assignmentOf:El(e),signal:t,made:(e,t)=>{var r;if(!s)return;let l=n.fields[i.creates[t].field].data;r=this.runtime,P2(r,o,e,[[PZ,l.createdBy],[PJ,l.createdAt?hH(l.createdAt):null],[PQ,a]])}});return{...u,refMap:i.creates.map((e,t)=>({from:n.fields[e.field].data.ref,to:u.fields[t].ref})),dropped:[...i.dropped]}}planValues(e,t,n,r){var i;let o,a;hW(n),yI(this.runtime,"form",e,t,rw);let s=wz(this.runtime,this.session),l=(i={bundle:e,target:this.readFields(),refusal:(e,t)=>{if("objectNumber"!==e.ref.kind)return"value-not-allowed";try{r4(e,t)}catch(e){if(N.is(e))return"value-not-allowed";throw e}return s?.(e.name)?"locked":r(e)?null:"fill-not-allowed"}},o=[],a=[],i.bundle.fields.forEach(({data:e},t)=>{let n=ar(e)?ad(e):null;if(!n)return;let r=i.target.find(t=>ae(t,{kind:"fqn",name:e.name}));if(r)if(r.kind!==e.kind)a.push({ref:e.ref,reason:"wrong-kind"});else{let s=i.refusal?.(r,n);s?a.push({ref:e.ref,reason:s}):o.push({field:t,target:r,value:n})}else a.push({ref:e.ref,reason:"no-field"})}),{writes:o,dropped:a});return{writes:l.writes.filter(({target:e,value:t})=>!function(e,t){switch(t.kind){case"text":return"text"===e.kind&&e.value===t.value;case"toggle":return("checkbox"===e.kind||"radio"===e.kind)&&e.widgets.every(e=>e.checked===(e.onState===t.state));case"choice":if("combobox"===e.kind)return 0===t.values.length?""===e.value:e.value===t.values[0];return"listbox"===e.kind&&e.selectedValues.length===t.values.length&&e.selectedValues.every((e,n)=>e===t.values[n])}}(e,r4(e,t))),dropped:l.dropped}}writeValue(e,t){return new Et(this.runtime,this.session,this.fonts).setValue(e.target.ref,e.value,t),this.readField(function(e){if("objectNumber"!==e.kind)throw Error("a written field has an object number");return e.objectNumber}(e.target.ref))}fieldNames(){let{fn:e,mem:t}=this.runtime,n=gv(this.runtime,this.session),r=new Set;for(let i=0;ie.EPDFForm_GetFieldName(n,i,t,r));o&&r.add(o)}return r}readFields(){let e=gv(this.runtime,this.session),t=this.session.requireDocPtr();return Array.from({length:this.runtime.fn.EPDFForm_CountFields(e)},(n,r)=>Di(this.runtime,e,r,t,w$(this.runtime,this.session)))}readField(e){let t=gv(this.runtime,this.session),n=this.runtime.fn.EPDFForm_GetFieldIndexByObjNum(t,e);return Di(this.runtime,t,n,this.session.requireDocPtr(),w$(this.runtime,this.session))}},Ec=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}plan(e,t){hW(t);let n=this.session.requireDocPtr(),r=gF(this.runtime,this.session),i=e=>{let t=this.session.resolvePageRef(e),i=q(t.pageObjectNumber),o=r(i);return{ref:i,size:{width:o.right-o.left,height:o.top-o.bottom},rotation:g_(this.runtime,n,t.pageIndex)}},o=("all"===e.pages?this.session.allRecords().sort((e,t)=>e.pageIndex-t.pageIndex).map(e=>q(e.pageObjectNumber)):e.pages).map(i),a=function(e){let t=function(e){let{form:t,mayScript:n}=e,{as:r,field:i,template:o,from:a,targets:s}=function(e){let{form:t,limits:n}=e,r=t.fields.find(t=>ae(t,e.field));if(!r)throw new N(G.NotFound,`repeat: no form field ${eM(e.field)}`);let i=e.as??ap(r),o=function(e,t,n=ap(t)){return"signature"===t.kind?"a signature field shows in one place: a signer signs once":"unknown"===t.kind?"a field of a kind the engine does not model":am(e,t).length>0?null:"the field shows on no page"}(t,r,i);if(o)throw new N(G.InvalidArg,`repeat: ${o}`,{details:{field:"field"}});let a=am(t,r),s=a[0].page,l=e.pageOf(s);if(!l)throw new N(G.NotFound,`repeat: no page ${s.objectNumber}`);let u=new Set("boxes"===i?r.widgets.flatMap(e=>e.page?.objectNumber??[]):[s.objectNumber]),d=[];for(let t of e.pages)u.has(t.ref.objectNumber)||(u.add(t.ref.objectNumber),d.push(t));let c=d.length*("boxes"===i?a.length:1+a.length);return aF(n,"pages",d.length),aF(n,"items",c),{as:i,field:r,template:a,from:l,targets:d,count:c}}(e),l={as:r,field:i,pages:s.map(e=>e.ref)},u={widgets:[],unison:!1,splits:!1,creates:[],calculationOrder:[]};if(0===s.length)return{...l,...u,dropped:[],needs:0};let d=[],c="fields"===r?aa(i,o):i,f=o.map(e=>{let{rect:t,box:r,rotation:i,...o}=as(c,e,e=>e,n,d);return{row:e,look:o,place:{rect:e.rect,rotation:e.rotation??0}}}),m=e=>f.map(({look:t,place:n})=>{let r,i,o,{rect:s,rotation:l}=(i=Math.min((r=ah(a.rotation)===ah(e.rotation)&&a.size.width===e.size.width&&a.size.height===e.size.height?n.rect:function(e,t){let{x:n,y:r,width:i,height:o}=t,{width:a,height:s}=e.size;switch(ah(e.rotation)){case 90:return{x:r,y:s-n-i,width:o,height:i};case 180:return{x:a-n-i,y:s-r-o,width:i,height:o};case 270:return{x:a-r-o,y:n,width:o,height:i};default:return{x:n,y:r,width:i,height:o}}}(e,function(e,t){let{x:n,y:r,width:i,height:o}=t,{width:a,height:s}=e.size;switch(ah(e.rotation)){case 90:return{x:s-r-o,y:n,width:o,height:i};case 180:return{x:a-n-i,y:s-r-o,width:i,height:o};case 270:return{x:r,y:a-n-i,width:o,height:i};default:return{x:n,y:r,width:i,height:o}}}(a,n.rect))).width,e.size.width),o=Math.min(r.height,e.size.height),{rect:{x:Math.min(Math.max(r.x,0),Math.max(e.size.width-i,0)),y:Math.min(Math.max(r.y,0),Math.max(e.size.height-o,0)),width:i,height:o},rotation:ah(n.rotation+a.rotation-e.rotation)});return{...t,page:e.ref,rect:s,...l?{rotation:l}:{}}});if("boxes"===r){let e=new Map("checkbox"===i.kind||"radio"===i.kind?i.widgets.flatMap(e=>e.ref?[[K(e.ref),e.onState]]:[]):[]),t=s.flatMap(t=>m(t).map((t,n)=>{let r=f[n].row.ref,i=e.get(K(r));return{source:r,placement:t,flags:al(f[n].row),...i?{onState:i}:{}}})),n="objectNumber"===i.ref.kind&&i.widgets.some(e=>e.objectNumber===i.ref.objectNumber);return{...l,...u,widgets:t,unison:"radio"===i.kind&&!i.radiosInUnison,splits:n,dropped:d,needs:t.length+ +!!n}}let p=new Set(t.fields.map(e=>e.name)),h=ao(c,n,d),F=f.map(({row:e})=>al(e)),g=f.map(({row:e})=>e.ref),_=c.name,P=s.map(e=>(_=af(_,e=>ac(p,e)),p.add(_),{source:0,draft:au(c,_,h,m(e),"repeat: the field"),widgets:g,flags:F})),D=t.calculationOrder.some(e=>null!==e&&ae(i,e));return{...l,...u,creates:P,calculationOrder:D?P.flatMap((e,t)=>e.draft.actions?.calculate?[t]:[]):[],dropped:d,needs:P.length*(1+o.length)}}(e);for(let e of t.creates)hT(e.draft,"repeat: the field",{});return t}({form:i8(this.read(e.field),r),field:e.field,pages:o,pageOf:i,...e.as?{as:e.as}:{},mayScript:e.mayScript,limits:e.limits}),{objectNumbers:s}=e;if(s&&s.length!==a.needs)throw new N(G.InvalidArg,`repeat: objectNumbers names ${s.length} objects of ${a.needs}`,{details:{field:"objectNumbers"}});return a}read(e){let t=Do(this.runtime,gv(this.runtime,this.session),this.session.requireDocPtr(),w$(this.runtime,this.session)),n=t.fields.find(t=>ae(t,e));return{...t,widgets:n?wU(this.runtime,this.session,n.widgets,this.fonts):[]}}addBoxes(e,t,n){let r=gF(this.runtime,this.session),i=e.widgets.length,o=e.splits?t?.[i]:void 0,a=new Set(e.field.widgets.map(e=>e.objectNumber)),{field:s,widgets:l}=new Et(this.runtime,this.session,this.fonts).addWidgets(e.field.ref,e.widgets.map(({placement:e,flags:t,onState:n})=>({placement:i2(e,r),flags:t,...void 0!==n?{onState:n}:{}})),n,{...t?{objectNumbers:t.slice(0,i)}:{},...void 0!==o?{splitObjectNumber:o}:{},radiosInUnison:e.unison});for(let e of l)a.add(e.objectNumber);return{field:s,added:l,split:s.widgets.filter(e=>!a.has(e.objectNumber))}}createFields(e,t,n){let r=0;return Ea(this.runtime,this.session,this.fonts,e.creates.map(e=>{let n=1+e.widgets.length,i=t.objectNumbers?.slice(r,r+n);return r+=n,{...e,...i?{objectNumbers:i}:{}}}),e.calculationOrder,{actor:t.actor,assignmentOf:t.assignmentOf,signal:n})}},Ef=["AP","MK"],Em=new Set(["text","checkbox","radio","combobox","listbox"]),Ep=new Set(["forms.setValue","forms.setDisplay","forms.setAppearanceText","forms.reset","forms.setSignatureAppearance","forms.setButtonImage"]);function Eh(e,t){let n=t.field.widgets.find(e=>e.objectNumber===t.objectNumber&&e.page);if(!n?.page)return{split:null,mergedEntry:null};let{pageIndex:r}=e.session.resolvePageRef(n.page),i=e.session.requireDocPtr(),o=e.runtime.fn.EPDFPage_GetAnnotIndexByObjectNumberRaw(i,r,n.objectNumber);return o<0?{split:null,mergedEntry:null}:{split:n,mergedEntry:yC(e.runtime,i,r,[o])}}function EF(e,t,n,r,i,o){let a={kind:"widgets.added",reports:t,direction:"remove",fieldObjectNumber:n,added:i,split:o.merged&&o.mergedEntry&&o.widget?{merged:o.merged,mergedEntry:o.mergedEntry,widget:o.widget}:null,objects:yQ(e.runtime,e.session,r),guards:[],kids:[],states:[],values:[],widgets:[],captures:[]},{field:s}=EU(e,n),l=new Map(s.widgets.map(e=>[e.objectNumber,"onState"in e?{state:e.onState,value:e.exportValue}:null])),u=E_(a);return{...a,guards:EP(e,u),kids:s.widgets.map(e=>e.objectNumber),states:u.map(e=>l.get(e.objectNumber)?.state??""),values:u.map(e=>l.get(e.objectNumber)?.value??"")}}var Eg=e=>e.split?[e.split.merged,e.split.widget]:[],E_=e=>e.split?[e.split.widget,...e.added]:[...e.added];function EP(e,t){return yQ(e.runtime,e.session,t.map(e=>({objectNumber:e.objectNumber,deep:[],before:null})))}function ED(e,t){return EW(e,t)?.field.widgets.map(e=>e.objectNumber)??null}function Eb(e){let{fn:t,mem:n}=e.runtime,r=gv(e.runtime,e.session),i=new Set,o=t.EPDFForm_CountFields(r);for(let e=0;et.EPDFForm_GetFieldName(r,e,n,i));o&&i.add(o)}return i}function Ey(e,t,n,r=[],i=!1){let{field:o}=EU(e,t);return{type:"forms.repeat",as:"boxes",...E0(e,{fields:[o],meta:y4(e.session.writeStamp(),[o.ref],[...n])}),dropped:r,...i?{undone:!0}:{}}}function Ew(e,t,n){return{type:"forms.reorderCalculations",calculationOrder:t.map(EM),meta:y4(e.session.writeStamp(),n.map(EM),[])}}function EE(e,t){if(!o8(e.authority,t.field.assignment,"fill")){var n,r;if(n=e,r=t,r.field.actions?.calculate&&wK(n.runtime,gv(n.runtime,n.session)).includes(r.objectNumber)&&e.fillsOwnField())return void oY(e.authority,"doc.forms.fill");o4(e.authority,t.field.assignment,"fill")}}function EA(e){!function(e,t){let{grants:n,protection:r}=e;return!(r&&iR(r).has(o9(t)))&&(!n||iZ(t,n.scope,n.permissionFlags,r))}(e.authority,"fill")&&oQ(e.authority,"doc.forms.fill")}function Ev(e,t){return o7(e.authority,t),t}function ES(e,t,n){return{kind:"field.remove",objectNumber:EK(t.ref),left:t,widgets:EP(e,t.widgets),...n?{rights:n}:{}}}function Ek(e,t){let n=t.ref;gx(e.runtime,e.session,n.page.objectNumber);let r=wm(e,n),i=t.field?E$(e,t.field):null;if(i&&i.objectNumber===r)throw new N(G.InvalidArg,`widget ${r} is its field\'s own dictionary (a merged field/widget) - delete the field with doc.forms.delete`,{details:{field:"widget"}});let o=[];if(i){let t=yJ(e.runtime,e.session,[{objectNumber:i.objectNumber,deep:[]},{objectNumber:r,deep:[]}]);new Et(e.runtime,e.session,e.fonts).detachWidget({kind:"objectNumber",objectNumber:i.objectNumber},n,e.signal),o=yQ(e.runtime,e.session,t)}let{pageIndex:a,index:s}=gC(e.runtime,e.session,n),l=yC(e.runtime,e.session.requireDocPtr(),a,[s]);new yD(e.runtime,e.session,e.fonts).deleteReleasedWidget(n,0),e.session.invalidateDerived();let u=i?EU(e,i.objectNumber).field:null;return{item:{type:"forms.deleteWidget",widget:n,page:n.page,field:u,meta:y4(e.session.writeStamp(),u?[u.ref]:[],[{ref:n,objectNumber:r,page:n.page}])},reverse:[{kind:"widget.restore",page:n.page,widget:n,capture:l,fieldObjectNumber:i?.objectNumber??null,detached:o}]}}function Ex(e,t,n){let r={kind:"objectNumber",objectNumber:t.objectNumber},i=yJ(e.runtime,e.session,EH(t)),o=new Et(e.runtime,e.session,e.fonts).setValue(r,n,e.signal),a=yQ(e.runtime,e.session,i),s={type:"forms.setValue",...E0(e,o)};return 0===o.meta.changedWidgets.length&&yV(EQ(t.field),EQ(o.field))?{item:s,reverse:[]}:{item:s,reverse:[{...EL("forms.setValue",a,[t.objectNumber]),fallback:{kind:"value",fields:[{objectNumber:t.objectNumber,before:EQ(t.field),left:EQ(o.field)}]}}]}}function EG(e,t,n,r){let i=!1,o=ER(e,r,t,()=>(i=n(new Et(e.runtime,e.session,e.fonts)).meta.changedWidgets.length>0,{field:EU(e,r.objectNumber).field}));return i?o:{item:o.item,reverse:[]}}function EO(e,t,n){let r={kind:"objectNumber",objectNumber:t.objectNumber},i=null;return EN(e,ER(e,t,"forms.update",()=>{let t=new Et(e.runtime,e.session,e.fonts).updateField(r,n,e.signal);return i=t.calculationOrder,t},e=>{let r=EZ(t.field),i=EZ(e),o=[...new Set(Object.keys(n).map(EI))].filter(e=>"kind"!==e&&!yV(r[e],i[e]));return{kind:"properties",objectNumber:t.objectNumber,restore:EJ(r,o),left:EJ(i,o)}}),i)}function EI(e){return"format"===e?"actions":"groupId"===e?"assignment":e}function EN(e,t,n){return!n||iA(t.item)?t:{item:{...t.item,...EC(n)},reverse:[...t.reverse,Ej(n)]}}function EC(e){return e?{calculationOrder:e.after.map(EM)}:{}}function Ej({before:e,after:t}){return{kind:"calculations.restore",before:e,after:t}}function EM(e){return{kind:"objectNumber",objectNumber:e}}function ER(e,t,n,r,i){let o=yJ(e.runtime,e.session,EH(t)),{field:a}=r(),s=EL(n,yQ(e.runtime,e.session,o),[t.objectNumber]);return{item:E3(e,n,[a]),reverse:[i?{...s,fallback:i(a)}:s]}}function ET(e,t,n){let r=yB(e.runtime,e.session.requireDocPtr(),t.objectNumber),i={kind:"objectNumber",objectNumber:t.objectNumber},{deleted:o,removedWidgets:a,calculationOrder:s}=new Et(e.runtime,e.session).deleteField(i,e.signal);return EN(e,{item:{type:"forms.delete",meta:y4(e.session.writeStamp(),[o],a)},reverse:[{kind:"field.restore",objectNumber:t.objectNumber,name:t.field.name,pages:t.field.widgets.flatMap(e=>e.page?[e.page]:[]),capture:r,...n?{rights:n}:{}}]},s)}function EB(e){return new Set(Eq(e).map(({objectNumber:e})=>e))}function EL(e,t,n){return{kind:"objects.revert",reports:e,objects:t,subject:{fields:n}}}function E$(e,t){let n=gv(e.runtime,e.session),r=wP(e.runtime,n,t),i=Di(e.runtime,n,r.fieldIndex,e.session.requireDocPtr(),w$(e.runtime,e.session));return{objectNumber:r.fieldObjectNumber,field:i}}function Ez(e,t){try{let n=wd(e,t);return"widget"===n.subtype?n:null}catch(e){if(N.is(e))return null;throw e}}function EU(e,t){return E$(e,{kind:"objectNumber",objectNumber:t})}function EV(e,t){try{return E$(e,t)}catch{return null}}function EW(e,t){return EV(e,{kind:"objectNumber",objectNumber:t})}function Eq(e){let t=gv(e.runtime,e.session),n=e.runtime.fn.EPDFForm_CountFields(t),r=[];for(let i=0;i({objectNumber:e.objectNumber,deep:Ef}))]}function EK(e){return"objectNumber"===e.kind?e.objectNumber:0}function EZ(e){let t={name:e.name.slice(e.name.lastIndexOf(".")+1),readOnly:e.readOnly,required:e.required,noExport:e.noExport,alternateName:e.alternateName,mappingName:e.mappingName,groupId:e.groupId,assignment:e.assignment,purpose:e.purpose,placeholder:e.placeholder,actions:function(e){let t={};for(let n of["keystroke","format","validate","calculate"]){let r=e.actions?.[n];if(!r){t[n]=null;continue}let i=U(r);i&&(t[n]=i)}return t}(e)},n=e=>null===e||ev(e)?{format:e}:{},r="none"!==e.defaultValueEntry.kind,i=e=>e.map(({label:e,value:t})=>({label:e,value:t}));switch(e.kind){case"text":return{...t,defaultValue:r?e.defaultValue:null,maxLength:e.maxLength,multiline:e.multiline,password:e.password,comb:e.comb,...n(e.format)};case"radio":return{...t,radiosInUnison:e.radiosInUnison,noToggleToOff:e.noToggleToOff};case"combobox":return{...t,edit:e.edit,defaultValue:r?e.defaultValue:null,options:i(e.options),...n(e.format)};case"listbox":return{...t,multiSelect:e.multiSelect,defaultValue:r?e.defaultValue:null,options:i(e.options)};case"pushbutton":return{...t,takesImage:e.takesImage};default:return t}}function EJ(e,t){return Object.fromEntries(t.map(t=>[t,e[t]]))}function EQ(e){return ad(e)??{value:null}}function EX(e,t,n=t.widgets){return E0(e,{field:t,meta:y4(e.session.writeStamp(),[t.ref],t.widgets,n)})}function EY(e,t){let n=t.widgets;return"forms.setDisplay"===e?[]:"forms.setValue"===e||"forms.reset"===e?y8(t.kind,n):n}function E0(e,t){return wV(e.runtime,e.session,t,e.fonts)}function E1(e,t){return{type:"forms.reset",...E0(e,{fields:[...t],meta:y4(e.session.writeStamp(),t.map(e=>e.ref),t.flatMap(e=>e.widgets),t.flatMap(e=>EY("forms.reset",e)))})}}function E3(e,t,n){if("forms.reset"===t)return E1(e,n);let r=n[0];return{type:t,...EX(e,r,EY(t,r))}}function E2(e,t,n,r){let i=t.filter(e=>!yV(E6(n,e),E6(r,e)));return{kind:"metadata.revert",op:e,restore:Object.fromEntries(i.map(e=>[e,E6(n,e)])),left:Object.fromEntries(i.map(e=>[e,E6(r,e)]))}}function E6(e,t){return e[t]??null}function E5(e,t){return Object.fromEntries(t.map(t=>[t,E6(e,t)]))}var E4=class{constructor(e,t){hJ(this,"childrenByParent",new Map),hJ(this,"parentByItem",new Map);let n=(r,i,o)=>{if(o>=128)return;let a=[];this.childrenByParent.set(i,a);for(let s=e.FPDFBookmark_GetFirstChild(t,r);s;s=e.FPDFBookmark_GetNextSibling(t,s)){let t=e.EPDFOutline_GetObjectNumber(s);if(t){if(this.parentByItem.has(t))break;this.parentByItem.set(t,i),a.push(t),n(s,t,o+1)}}};n(0n,0,0)}has(e){return this.parentByItem.has(e)}parentOf(e){return this.parentByItem.get(e)}childrenOf(e){return this.childrenByParent.get(e)??[]}subtreeOf(e){let t=[e];for(let n of this.childrenOf(e))t.push(...this.subtreeOf(n));return t}levelOf(e){let t=-1;for(let n=e;n;n=this.parentOf(n))t+=1;return this.has(e)?t:void 0}isAtOrUnder(e,t){for(let n=e;n;n=this.parentOf(n))if(n===t)return!0;return!1}items(){return this.childrenOf(0).flatMap(e=>this.subtreeOf(e))}},E8={maxModels:5e4,maxNodes:2e5,maxScriptCodeUnits:16e6,maxTargetEntries:65536,maxPayloadCodeUnits:16e6};function E7(e,t,n,r,i,o){let{fn:a,mem:s}=e,l=h3(s,(e,t)=>a.FPDFBookmark_GetTitle(n,e,t))??"",u=0n!==a.FPDFBookmark_GetFirstChild(t,n),d=a.FPDFBookmark_GetStyle(n),{action:c,target:f,complete:m}=function(e,t,n,r){let{fn:i,mem:o}=e,a=i.FPDFBookmark_GetAction(n);if(a)try{let e=F8(i,o,t,i.EPDFAction_LoadModel(a),r);return{action:e,target:e?Pr(e):{kind:"unsupported"},complete:null!==e&&!e.incomplete}}catch(e){if(!N.is(e))throw e;return{action:null,target:{kind:"unsupported"},complete:!1}}let s=i.FPDFBookmark_GetDest(t,n);if(!s)return{action:null,target:null,complete:!0};let l=F2(i,o,t,s);return{action:null,target:l?{kind:"goto",destination:l}:{kind:"unsupported"},complete:!0}}(e,t,n,o);return{item:{ref:nk(r),parent:0===i?null:nk(i),title:l,target:f,action:c,open:u&&a.FPDFBookmark_GetCount(n)>0,color:function(e,t){let{fn:n,mem:r}=e;return h0(r,[4,4,4],([e,i,o])=>{if(!n.FPDFBookmark_GetColor(t,e,i,o))return null;let a=e=>Math.min(255,Math.max(0,Math.round(255*F0(r,e))));return e7(a(e),a(i),a(o))})}(e,n),bold:(2&d)!=0,italic:(1&d)!=0},complete:m}}var E9=class{constructor(e,t){this.runtime=e,this.session=t}read(e){let{fn:t}=this.runtime,n=this.session.requireDocPtr(),r=new F4(E8),i=[],o=new Set,a=!1,s=(l,u,d)=>{for(let c=t.FPDFBookmark_GetFirstChild(n,l);c;c=t.FPDFBookmark_GetNextSibling(n,c)){hW(e);let l=t.EPDFOutline_GetObjectNumber(c);if(!l){a=!0;continue}if(o.has(l)){a=!0;break}if(i.length>=5e4)return a=!0,!1;o.add(l);let f=E7(this.runtime,n,c,l,u,r);if(i.push(f.item),f.complete||(a=!0),0n!==t.FPDFBookmark_GetFirstChild(n,c)){if(d+1>=128){a=!0;continue}if(!s(c,l,d+1))return!1}}return!0};return s(0n,0,0),{items:i,incomplete:a}}readItem(e,t){let n=this.session.requireDocPtr(),r=this.runtime.fn.EPDFOutline_GetItem(n,e);if(!r)throw new N(G.NotFound,`no outline item ${e}`,{details:{field:"ref"}});return E7(this.runtime,n,r,e,t,new F4(E8)).item}},Ae=/^#[0-9a-fA-F]{6}$/;function At(e){let t=(e,t)=>{throw new N(G.InvalidArg,t,{details:{field:e}})};void 0!==e.title&&("string"!=typeof e.title&&t("title","a title is a string"),e.title.length>32767&&t("title","a title holds at most 32767 characters")),null==e.color||Ae.test(e.color)||t("color","expected a color as \'#rrggbb\'");let n=e.target;null==n||"goto"===n.kind||"uri"===n.kind||"named"===n.kind&&["NextPage","PrevPage","FirstPage","LastPage"].includes(n.name??"")||t("target",`a \'${n.kind}\' target can\'t be written`)}function An(e,t,n,r){let{fn:i,mem:o}=e,a=(e,t)=>{if(!e)throw new N(G.Unknown,`the ${t} of outline item ${n} could not be written`)};if(void 0!==r.title&&a(h5(o,r.title,e=>i.EPDFOutline_SetTitle(t,n,e)),"title"),void 0!==r.target){let e=null===r.target?0n:Pi(i,o,t,r.target);a(i.EPDFOutline_SetAction(t,n,e),"target")}if(void 0!==r.color)if(null===r.color)a(i.EPDFOutline_SetColor(t,n,!1,0,0,0),"colour");else{let{r:e,g:o,b:s}=e9(r.color);a(i.EPDFOutline_SetColor(t,n,!0,e/255,o/255,s/255),"colour")}if(void 0!==r.bold||void 0!==r.italic){let e=i.FPDFBookmark_GetStyle(i.EPDFOutline_GetItem(t,n));void 0!==r.bold&&(e=r.bold?2|e:-3&e),void 0!==r.italic&&(e=r.italic?1|e:-2&e),a(i.EPDFOutline_SetStyle(t,n,e),"style")}void 0!==r.open&&a(i.EPDFOutline_SetOpen(t,n,r.open),"open state")}var Ar=class{constructor(e,t){this.runtime=e,this.session=t,hJ(this,"reader",void 0),this.reader=new E9(e,t)}tree(){return new E4(this.runtime.fn,this.session.requireDocPtr())}create(e,t,n,r){At(n);let i=this.tree(),o=this.parentNumberOf(i,e),a=i.childrenOf(o),s=nP(a.map(nk),t,Ai),l=0===s?0:a[s-1];void 0!==r&&this.session.claimObjectNumber(r);let{fn:u,mem:d}=this.runtime,c=this.session.requireDocPtr(),f=h5(d,n.title,e=>u.EPDFOutline_CreateItem(c,r??0,o,l,e));if(!f)throw Aa("create the item");let{title:m,...p}=n;An(this.runtime,c,f,p);let h=this.reader.readItem(f,o);return{item:h,order:this.orderOf(this.tree(),o),meta:this.meta([h.ref])}}update(e,t){At(t);let n=this.tree(),r=this.requireItem(n,e,"ref");return An(this.runtime,this.session.requireDocPtr(),e.objectNumber,t),{item:this.reader.readItem(e.objectNumber,r),meta:this.meta([e])}}move(e,t,n){let r=this.tree(),i=e.map(e=>(this.requireItem(r,e,"refs"),e.objectNumber)),o=new Set(i);for(let e of(o.size!==i.length&&Ao("refs","an item is named twice"),i))i.some(t=>t!==e&&r.isAtOrUnder(e,t))&&Ao("refs",`item ${e} is under another item that moves`);let a=this.parentNumberOf(r,t);i.some(e=>r.isAtOrUnder(a,e))&&Ao("parent","an item would go under itself");let s=r.childrenOf(a).filter(e=>!o.has(e)),l="start"===n||"end"===n?null:"before"in n?n.before:n.after;l&&o.has(l.objectNumber)&&Ao("position",`the neighbour ${l.objectNumber} is one of the items that move`);let u=nP(s.map(nk),n,Ai),d=0===u?0:s[u-1];return this.place(i.map(e=>{let t={item:e,parent:a,after:d};return d=e,t}),r)}place(e,t=this.tree()){let{fn:n}=this.runtime,r=this.session.requireDocPtr(),i=new Set;for(let{item:o,parent:a,after:s}of e){i.add(t.parentOf(o)??0),i.add(a);let e=this.tree(),l=s&&e.parentOf(s)===a?s:0;if(!n.EPDFOutline_MoveItem(r,o,a,l))throw Aa(`move item ${o}`)}let o=this.tree();return{orders:[...i].map(e=>this.orderOf(o,e)),meta:this.meta(e.map(({item:e})=>nk(e)))}}placementsOf(e,t=this.tree()){let n=new Set(e);return t.items().filter(e=>n.has(e)).map(e=>{let n=t.parentOf(e),r=t.childrenOf(n),i=r.indexOf(e);return{item:e,parent:n,after:i>0?r[i-1]:0}})}delete(e){let t=this.tree();this.requireItem(t,e,"ref");let n=t.subtreeOf(e.objectNumber);if(!this.runtime.fn.EPDFOutline_DeleteItem(this.session.requireDocPtr(),e.objectNumber))throw Aa(`delete item ${e.objectNumber}`);return{meta:this.meta(n.map(nk))}}restored(e){let t=this.tree(),n=t.parentOf(e);if(void 0===n)throw Aa(`restore item ${e}`);let r=this.subtree(e,t);return{items:r,order:this.orderOf(t,n),meta:this.meta(r.map(e=>e.ref))}}find(e,t=this.tree()){let n=t.parentOf(e.objectNumber);return void 0===n?null:this.reader.readItem(e.objectNumber,n)}subtree(e,t=this.tree()){return t.subtreeOf(e).map(e=>this.reader.readItem(e,t.parentOf(e)))}updated(e){let t=this.find(e);if(!t)throw Aa(`read item ${e.objectNumber}`);return{item:t,meta:this.meta([e])}}countAgain(e){let t=this.find(e);t&&An(this.runtime,this.session.requireDocPtr(),e.objectNumber,{open:t.open})}parentNumberOf(e,t){return null===t?0:(this.requireItem(e,t,"parent"),(e.levelOf(t.objectNumber)??0)>=127&&Ao("parent",`an item under ${t.objectNumber} would be deeper than reads go`),t.objectNumber)}requireItem(e,t,n){let r=e.parentOf(t.objectNumber);if(void 0===r)throw new N(G.NotFound,`no outline item ${t.objectNumber}`,{details:{field:n}});return r}orderOf(e,t){return{parent:0===t?null:nk(t),children:e.childrenOf(t).map(nk)}}meta(e){return{affectedPages:[],cacheDelta:null,...this.session.writeStamp(),changedRefs:e}}},Ai=e=>String(e.objectNumber);function Ao(e,t){throw new N(G.InvalidArg,t,{details:{field:e}})}function Aa(e){return new N(G.MalformedPdf,`could not ${e}: the outline holds an item that isn\'t an indirect object`)}var As=["title","target","color","bold","italic","open"],Al=["A","Dest"],Au=e=>new Ar(e.runtime,e.session);function Ad(e,t,n,r){var i,o,a;let s,l=yJ(e.runtime,e.session,[{objectNumber:t.objectNumber,deep:Al}]),u=Au(e).update(t,n),d=yQ(e.runtime,e.session,l);return{item:{type:"outline.update",...u},reverse:[{kind:"objects.revert",reports:"outline.update",objects:d,subject:{outlineItem:t},fallback:(i=r,o=u.item,a=n,{kind:"outline",restore:Object.fromEntries((s=As.filter(e=>void 0!==a[e]&&!yV(i[e],o[e]))).map(e=>[e,i[e]])),left:Object.fromEntries(s.map(e=>[e,o[e]]))})}]}}function Ac(e,t){var n,r,i;let o=Au(e),a=o.tree(),s=a.parentOf(t.objectNumber),l=Af(e,a,[t.objectNumber]),u=(n=e.runtime,r=e.session.requireDocPtr(),i=t.objectNumber,yz(n,`outline item ${i}`,e=>n.fn.EPDFOutline_ExportItemRawToOwnedBuffer(r,i,e)));return{item:{type:"outline.delete",...o.delete(t)},reverse:[{kind:"outline.restore",ref:t,parent:void 0===s||0===s?null:nk(s),capture:u},...l]}}function Af(e,t,n){let r=new Set(n),i=new Set(n.map(e=>t.parentOf(e)??0));return i.delete(0),[...i].flatMap(n=>{let i=t.childrenOf(n);return i.every(e=>r.has(e))&&Au(e).find(nk(n),t)?.open?[{kind:"outline.reopen",ref:nk(n),children:i}]:[]})}function Am(e,t){return yQ(e.runtime,e.session,t.map(e=>({objectNumber:e.objectNumber,deep:[],before:null})))}function Ap(e,t){let n=Au(e).find(t);if(!n)throw new N(G.NotFound,`no outline item ${t.objectNumber}`,{details:{field:"ref"}});return n}var Ah=["Annots","Contents","Resources"],AF=["Parent","Rotate"];function Ag(e,t){let n=e.session.pagePool();n.closeIdle();try{return t()}finally{n.closeIdle()}}var A_=e=>new gw(e.runtime,e.session),AP=e=>new gG(e.runtime,e.session);function AD(e,t,n){let r="pages.insertBlank"!==t,i=Aw(e),o=r?EB(e):new Set,a=n();r&&e.session.invalidateDerived();let s=r?[...EB(e)].filter(e=>!o.has(e)):[],l=a.insertedPages.map(e=>e.objectNumber),u=AA(e,i,r0(i,AO(e).indexOf(l[0]),l.length));return{item:{type:t,...a,...AS(e,u)},reverse:[Ay(e,l,u,s)]}}function Ab(e,t,n){let r=e.session.requireDocPtr(),i=AO(e),o=Aw(e),a=t.map(t=>{var n;return{page:t,capture:(n=e.runtime,yz(n,`page ${t}`,e=>n.fn.EPDFPage_ExportRawToOwnedBuffer(r,t,e)))}}),s=t.map(q),l=A_(e).delete(s,e.signal);e.session.invalidateDerived();let u=AA(e,o,AE(o,rY(o,i.length,t.map(e=>i.indexOf(e))),n));return{item:{type:"pages.delete",pages:s,...l,...AS(e,u)},reverse:[{kind:"pages.restore",pages:a,...u?{labels:u}:{}}]}}function Ay(e,t,n,r=[]){return{kind:"pages.remove",pages:t.map(t=>({page:t,left:Ak(e,t)})),...n?{labels:n}:{},...r.length>0?{fields:r}:{}}}function Aw(e){return gp(e.runtime,e.session.requireDocPtr())}function AE(e,t,n){return n&&r1(e,n.left)?n.sections:t}function AA(e,t,n){if(!r1(t,n))return!function(e,t,n){let{fn:r,mem:i}=e;if(!h1(i,n.map(e=>e.firstPage),o=>h1(i,n.map(e=>gm.indexOf(e.style)),a=>h1(i,n.map(e=>e.firstNumber),i=>gf(e,n.map(e=>e.prefix),(e,n)=>r.EPDFDoc_SetPageLabelSections(t,o,a,i,e,n))))))throw new N(G.Unknown,"EPDFDoc_SetPageLabelSections refused",{details:{sections:n.length}})}(e.runtime,e.session.requireDocPtr(),n),{sections:t,left:n}}function Av(e,t,n,r){var i,o,a;return t.every((e,t)=>n[t]===e)?e:(i=t.length,o=r.map(e=>t.indexOf(e)),a=n.indexOf(r[0]),r0(rY(e,i,o),a,o.length))}function AS(e,t){return t?{layout:AI(e)}:{}}function Ak(e,t){let{fn:n,mem:r}=e.runtime,i=e.session.requireDocPtr(),o=yR(e.runtime,i,t,Ah,AF),a=e.session.allRecords().find(e=>e.pageObjectNumber===t),s=a?g_(e.runtime,i,a.pageIndex):0,l=new TextEncoder().encode(`\nturn ${s}`),u=new Uint8Array(o.byteLength+l.byteLength);return u.set(o),u.set(l,o.byteLength),Db(n,r,u)}function Ax(e,t){return AG(e,t).map(t=>({page:t,after:e[e.indexOf(t)-1]??0}))}function AG(e,t){return[...t].sort((t,n)=>e.indexOf(t)-e.indexOf(n))}function AO(e){return e.session.allRecords().map(e=>e.pageObjectNumber)}function AI(e){return new gh(e.runtime,e.session).read(e.signal)}function AN(e){return new Map(e.pages.map(e=>[e.ref.objectNumber,e.rotation]))}function AC(e){return{affectedPages:[],cacheDelta:null,...e.session.writeStamp()}}var Aj=class{constructor(e,t){this.runtime=e,this.session=t}setScale(e,t,n){if(hW(n),null!==t)try{tV(t)}catch(e){throw new N(G.InvalidArg,e.message)}let{fn:r,mem:i}=this.runtime,o=this.session.requireDocPtr(),a=this.session.recordByObjectNumber(e).pageIndex,s=[];for(let e=0;er.EPDFViewport_GetName(t,e,n))!==nb)continue;let n=r.EPDFViewport_GetMeasure(t);n&&1!==r.EPDFMeasure_GetSubtype(n)||s.push(e)}finally{r.EPDFViewport_Close(t)}}let l=hY(i,16,e=>gg(r,i,o,a,e).crop);if(![l.left,l.right,l.bottom,l.top].every(Number.isFinite))throw new N(G.InvalidArg,"Invalid calibration box");if(hW(n),null===t){for(let e of s.reverse())gr(r.EPDFPage_RemoveViewportRaw(o,a,e));return}hY(i,16,e=>{i.poke(e,"f32",l.left),i.poke(e,"f32",l.top,4),i.poke(e,"f32",l.right,8),i.poke(e,"f32",l.bottom,12);let n=s.length?r.EPDFPage_GetViewportRaw(o,a,s[s.length-1]):r.EPDFPage_AddViewportRaw(o,a,e);gr(n);try{gr(r.EPDFViewport_SetBBox(n,e)),gr(h6(i,nb,e=>r.EPDFViewport_SetName(n,e))),gs(r,i,r.EPDFViewport_AddMeasure(n),t)}finally{r.EPDFViewport_Close(n)}})}};function AM(e,t,n){new Aj(e.runtime,e.session).setScale(t,n,e.signal)}function AR(e,t){return{page:t,layout:new gh(e.runtime,e.session).read(e.signal),meta:{affectedPages:[],cacheDelta:null,...e.session.writeStamp()}}}function AT(e,t){let{fn:n,mem:r}=e.runtime,i=e.session.recordByObjectNumber(t).pageIndex,o=gl(n,r,e.session.requireDocPtr(),i).filter(e=>e.owned).pop();return o?.measure?.subtype==="rectilinear"?o.measure:null}function AB(e,t){let{fn:n,mem:r}=e.runtime,i=e.session.recordByObjectNumber(t).pageIndex;return hY(r,16,t=>gg(n,r,e.session.requireDocPtr(),i,t).crop)}var AL={opInFileSpace:e=>e,itemOut:e=>e},A$=class{constructor(e,t,n,r=nI){this.runtime=e,this.session=t,this.fonts=n,this.limits=r}apply(e,t,n,r){let i=this.context(t,n,t=>e.some(e=>{if("forms.setValue"!==e.type&&"forms.setAppearanceText"!==e.type)return!1;let n=EV(t,e.field);return null!==n&&o8(t.authority,n.field.assignment,"fill")}));return Az(this.session,t,e.map((e,t)=>()=>(function(e,t,n){var r,i,o,a;switch(t.type){case"annotations.create":if("widget"===t.data.subtype)throw new N(G.InvalidArg,"a widget is the form\'s: create one with doc.forms.create or doc.forms.addWidget",{details:{field:"subtype"}});oY(e.authority,o0(t.data.subtype));let s=o2(e.authority,t.data.subtype,t.data.groupId),l=e.session.resolvePageRef(t.page).pageObjectNumber,u=wu(e).create(l,t.data,e.signal,{...s?{actor:s}:{},...t.resources?{resources:t.resources}:{},...void 0!==t.objectNumber?{objectNumber:t.objectNumber}:{}});return{item:{type:"annotations.create",page:t.page,...u},reverse:[{kind:"annotation.remove",ref:u.annotation.ref,left:[u.annotation]}]};case"annotations.import":let d,c;return(d="restore"===t.attribution?"import":void 0)&&we(e.authority),{item:{type:"annotations.import",...c=new yN(e.runtime,e.session,e.fonts).import({bundle:t.bundle,...void 0!==t.pages?{pages:t.pages}:{},attribution:t.attribution,...t.actor?{actor:t.actor}:{},limits:t.limits,authorizeCreate:t=>{oY(e.authority,o0(t.subtype)),d||o2(e.authority,t.subtype,t.groupId??void 0)}},e.signal)},reverse:y9(e,c.annotations,d)};case"annotations.update":let f=wd(e,t.ref);if("widget"===f.subtype)throw new N(G.InvalidArg,"a widget is the form\'s: change its place and look with doc.forms.updateWidget");return oY(e.authority,o0(f.subtype)),yK(n,f,t.expect),wt(e,f,t.patch.nm),wa(e,t.ref,t.patch,"annotations.update",t.resources);case"annotations.delete":let m=wd(e,t.ref);if("widget"===m.subtype){let e;throw i=m,e=i.field?.kind==="objectNumber"&&"objectNumber"===i.ref.kind&&i.field.objectNumber===i.ref.objectNumber,new N(G.InvalidArg,e?"widget is its form field\'s own dictionary (a merged field/widget) - delete the field with doc.forms.delete":i.field?"widget is attached to a form field - use doc.forms.removeWidget or doc.forms.delete":"a widget is the form\'s: it isn\'t deleted as an annotation")}return oY(e.authority,o0(m.subtype)),yK(n,m,t.expect),wl(e,t.ref);case"annotations.reorder":let p;return p=y6(y3(e.runtime,e.session,t.page),"annotations",t.refs,t.position),wi(e,"annotations",t.refs),y5(e.runtime,e.session,p),wn(e,p,t.refs);case"annotations.copy":let h;return oQ(e.authority,"doc.annotate.read"),{item:{type:"annotations.copy",...h=new y1(e.runtime,e.session,e.fonts).copy({refs:t.refs,...t.page?{page:t.page}:{},...t.offset?{offset:t.offset}:{},...t.objectNumbers?{objectNumbers:t.objectNumbers}:{},read:t=>wd(e,t),authorizeCreate:t=>(oY(e.authority,o0(t.subtype)),o2(e.authority,t.subtype,void 0)),limits:e.limits},e.signal)},reverse:y9(e,h.annotations,void 0)};case"forms.setValue":let F;return F=E$(e,t.field),EE(e,F),yK(n,EQ(F.field),t.expect),Ex(e,F,t.value);case"forms.setDisplay":let g;return g=E$(e,t.field),function(e,t){if(!o8(e.authority,t.field.assignment,"fill")){if(e.fillsOwnField())return oY(e.authority,"doc.forms.fill");o4(e.authority,t.field.assignment,"fill")}}(e,g),EG(e,"forms.setDisplay",n=>n.setDisplay(t.field,t.display,e.signal),g);case"forms.setAppearanceText":let _;return _=E$(e,t.field),EE(e,_),EG(e,"forms.setAppearanceText",n=>n.setAppearanceText(t.field,t.text,e.signal),_);case"forms.reset":return function(e,t){EA(e);let n=t.fields?t.fields.map(t=>E$(e,t)):Eq(e).filter(({field:e})=>Em.has(e.kind));for(let t of n)o4(e.authority,t.field.assignment,"fill");let r=yJ(e.runtime,e.session,n.flatMap(EH)),i=new Et(e.runtime,e.session,e.fonts).reset(t.fields?[...t.fields]:void 0,e.signal),o=yQ(e.runtime,e.session,r),a=new Set(i.fields.map(e=>EK(e.ref))),s={type:"forms.reset",...E0(e,i)};return 0===a.size?{item:s,reverse:[]}:{item:s,reverse:[{kind:"objects.revert",reports:"forms.reset",objects:o,subject:{fields:[...a]},fallback:{kind:"value",fields:n.filter(({objectNumber:e})=>a.has(e)).map(({objectNumber:e,field:t})=>({objectNumber:e,before:EQ(t),left:EQ(i.fields.find(t=>EK(t.ref)===e))}))}}]}}(e,t);case"forms.create":return function(e,t){var n;oQ(e.authority,"doc.forms.modify"),(T((n=t.draft).actions)||(n.widgets??[]).some(e=>T(e.actions)))&&oQ(e.authority,"doc.forms.script"),o7(e.authority,ee(t.draft));let{field:r,calculationOrder:i}=new Et(e.runtime,e.session,e.fonts).createField(t.draft,e.signal,e.authority.identity,{...void 0!==t.objectNumber?{objectNumber:t.objectNumber}:{},...t.widgetObjectNumbers?{widgetObjectNumbers:t.widgetObjectNumbers}:{}});return{item:{type:"forms.create",...EX(e,r),...EC(i)},reverse:[ES(e,r)]}}(e,t);case"forms.copy":let P,D;return oQ(e.authority,"doc.forms.modify"),D=(P=new Eu(e.runtime,e.session,e.fonts).copy({fields:t.fields,...t.widgets?{widgets:t.widgets}:{},...t.page?{page:t.page}:{},...t.offset?{offset:t.offset}:{},values:t.values??!0,...t.objectNumbers?{objectNumbers:t.objectNumbers}:{},actor:e.authority.identity,mayScript:oX(e.authority,"doc.forms.script"),assignmentOf:t=>Ev(e,t),limits:e.limits},e.signal)).fields.map(t=>ES(e,t)),{item:{type:"forms.copy",...P},reverse:D.reverse()};case"forms.repeat":return function(e,t){oQ(e.authority,"doc.forms.modify");let n=new Ec(e.runtime,e.session,e.fonts),r=n.plan({field:t.field,pages:t.pages,...t.as?{as:t.as}:{},...t.objectNumbers?{objectNumbers:t.objectNumbers}:{},mayScript:oX(e.authority,"doc.forms.script"),limits:e.limits},e.signal),i=[...r.dropped];if(0===r.pages.length){let t=y4(e.session.writeStamp(),[],[]);return{item:{type:"forms.repeat",as:r.as,fields:[],widgets:[],dropped:i,meta:t},reverse:[]}}if("fields"===r.as){let o=n.createFields(r,{...t.objectNumbers?{objectNumbers:t.objectNumbers}:{},actor:e.authority.identity,assignmentOf:t=>Ev(e,t)},e.signal);return{item:{type:"forms.repeat",as:"fields",...o,dropped:i},reverse:[{kind:"fields.repeat",direction:"remove",left:o.fields,guards:o.fields.map(t=>EP(e,t.widgets)),captures:[]}]}}let o=E$(e,t.field),{split:a,mergedEntry:s}=Eh(e,o),l=yJ(e.runtime,e.session,[{objectNumber:o.objectNumber,deep:Ef}]),{added:u,split:d}=n.addBoxes(r,t.objectNumbers,e.signal),c=EF(e,"forms.repeat",o.objectNumber,l,u,{merged:a,mergedEntry:s,widget:d[0]??null});return{item:Ey(e,o.objectNumber,[...Eg(c),...u],i),reverse:[c]}}(e,t);case"forms.update":let b,y;return oQ(e.authority,"doc.forms.modify"),T(t.patch.actions)&&oQ(e.authority,"doc.forms.script"),b=E$(e,t.field),y=et(t.patch,b.field),r=b.field.assignment,(Y(y)!==Y(r)||y.kind!==r.kind)&&o7(e.authority,y),yK(n,EZ(b.field),t.expect),EO(e,b,t.patch);case"forms.delete":let w;return oQ(e.authority,"doc.forms.modify"),yK(n,(w=E$(e,t.field)).field,t.expect),ET(e,w);case"forms.addWidget":return function(e,t){oQ(e.authority,"doc.forms.modify"),T(t.placement.actions)&&oQ(e.authority,"doc.forms.script");let n=E$(e,t.field),{split:r,mergedEntry:i}=Eh(e,n),o=yJ(e.runtime,e.session,[{objectNumber:n.objectNumber,deep:Ef}]),{field:a,widget:s}=new Et(e.runtime,e.session,e.fonts).addWidget(t.field,t.placement,e.signal,{...void 0!==t.objectNumber?{objectNumber:t.objectNumber}:{},...void 0!==t.splitObjectNumber?{splitObjectNumber:t.splitObjectNumber}:{}}),l=new Set(n.field.widgets.map(e=>e.objectNumber)),u=a.widgets.filter(e=>!l.has(e.objectNumber)),d=u.find(e=>e.objectNumber!==s.objectNumber)??null,c=EF(e,"forms.addWidget",n.objectNumber,o,u.filter(e=>e.objectNumber===s.objectNumber),{merged:r,mergedEntry:i,widget:d});return{item:{type:"forms.addWidget",...E0(e,{field:a,meta:y4(e.session.writeStamp(),[a.ref],u)})},reverse:[c]}}(e,t);case"forms.removeWidget":let E,A,v,S,k;return oQ(e.authority,"doc.forms.modify"),E=E$(e,t.field),A="objectNumber"===t.widget.kind?t.widget.objectNumber:0,v=yJ(e.runtime,e.session,[{objectNumber:E.objectNumber,deep:[]},{objectNumber:A,deep:[]}]),S=new Et(e.runtime,e.session,e.fonts).detachWidget(t.field,t.widget,e.signal),k=yQ(e.runtime,e.session,v),{item:{type:"forms.removeWidget",...E0(e,{field:S.field,meta:y4(e.session.writeStamp(),[S.field.ref],[S.widget])})},reverse:[EL("forms.addWidget",k,[E.objectNumber])]};case"forms.deleteWidget":oQ(e.authority,"doc.forms.modify");let x=wd(e,t.widget);if("widget"!==x.subtype)throw new N(G.InvalidArg,`${x.subtype} is not a widget: delete it with page.annotations.delete`,{details:{field:"widget"}});return yK(n,x,t.expect),Ek(e,x);case"forms.updateWidget":oQ(e.authority,"doc.forms.modify"),T(t.patch.actions)&&oQ(e.authority,"doc.forms.script");let O=wd(e,t.widget);if("widget"!==O.subtype)throw new N(G.InvalidArg,`${O.subtype} is not a widget: change it with doc.annotations.update`,{details:{field:"widget"}});return yK(n,O,t.expect),wt(e,O,t.patch.nm),wa(e,t.widget,{...t.patch,subtype:"widget"},"forms.updateWidget");case"forms.reorderWidgets":let I;return oQ(e.authority,"doc.forms.modify"),I=y6(y3(e.runtime,e.session,t.page),"widgets",t.widgets,t.position),y5(e.runtime,e.session,I),wn(e,I,t.widgets);case"forms.reorderCalculations":return function(e,t){oQ(e.authority,"doc.forms.modify");let{before:n,after:r,moved:i}=new Et(e.runtime,e.session,e.fonts).reorderCalculations(t.fields,t.position,e.signal);return{item:Ew(e,r,i),reverse:[Ej({before:n,after:r})]}}(e,t);case"forms.setSignatureAppearance":let C;return C=E$(e,t.field),o4(e.authority,C.field.assignment,"sign"),ER(e,C,"forms.setSignatureAppearance",()=>new Et(e.runtime,e.session,e.fonts).setSignatureAppearance(t.field,iE(t.appearance),e.signal));case"forms.setButtonImage":let j;return j=E$(e,t.field),o4(e.authority,j.field.assignment,"fill"),ER(e,j,"forms.setButtonImage",()=>new Et(e.runtime,e.session,e.fonts).setButtonImage(t.field,function(e){if(null===e)return null;if(ArrayBuffer.isView(e))return e;throw new N(G.InvalidArg,"a push button\'s image reaches a write as bytes, never as a Blob")}(t.image),e.signal));case"forms.import":let M,R,B;return oQ(e.authority,"doc.forms.modify"),M=function(e,t){if("restore"===t.attribution)return oQ(e.authority,"doc.forms.import"),"import"}(e,t),B=(R=new Ed(e.runtime,e.session,e.fonts).import({bundle:t.bundle,...void 0!==t.pages?{pages:t.pages}:{},attribution:t.attribution,values:t.values??!0,actor:t.actor??{},limits:t.limits,mayScript:(t.mayScript??!1)&&oX(e.authority,"doc.forms.script"),assignmentOf:t=>M?t:Ev(e,t)},e.signal)).fields.map(t=>ES(e,t,M)),{item:{type:"forms.import",...R},reverse:B.reverse()};case"forms.importValues":return function(e,t){EA(e);let n=new Ed(e.runtime,e.session,e.fonts),r=n.planValues(t.bundle,t.limits,e.signal,t=>o8(e.authority,t.assignment,"fill")),i=[],o=[];for(let t of r.writes){let r={objectNumber:EK(t.target.ref),field:t.target},a=yJ(e.runtime,e.session,EH(r)),s=n.writeValue(t,e.signal),l=yQ(e.runtime,e.session,a);i.push(s),o.push({...EL("forms.setValue",l,[r.objectNumber]),fallback:{kind:"value",fields:[{objectNumber:r.objectNumber,before:EQ(t.target),left:EQ(s)}]}})}return{item:{type:"forms.importValues",...E0(e,{fields:i,dropped:[...r.dropped],meta:y4(e.session.writeStamp(),i.map(e=>e.ref),i.flatMap(e=>e.widgets))})},reverse:o.reverse()}}(e,t);case"metadata.update":let L,$;return oQ(e.authority,"doc.metadata.modify"),yK(n,L=new FF(e.runtime,e.session).read(e.signal),t.expect),{item:{type:"metadata.update",...$=new FZ(e.runtime,e.session).update(t.patch,e.signal)},reverse:[E2("metadata.update",Object.keys(t.patch),L,$.metadata)]};case"metadata.updateCustom":let z,U;return oQ(e.authority,"doc.metadata.modify"),z=new FF(e.runtime,e.session).readCustom(e.signal),{item:{type:"metadata.updateCustom",...U=new FZ(e.runtime,e.session).updateCustom(t.patch,e.signal)},reverse:[E2("metadata.updateCustom",Object.keys(t.patch),z,U.custom)]};case"outline.create":oQ(e.authority,"doc.outline.modify");let V=Au(e).create(t.parent,t.position??"end",t.data,t.objectNumber);return{item:{type:"outline.create",...V},reverse:[{kind:"outline.remove",ref:V.item.ref,left:Am(e,[V.item.ref])}]};case"outline.update":oQ(e.authority,"doc.outline.modify");let W=Ap(e,t.ref);return yK(n,W,t.expect),Ad(e,t.ref,t.patch,W);case"outline.move":let q,H,K,Z,J,Q,X;return o=e,a=t,oQ(o.authority,"doc.outline.modify"),H=(q=Au(o)).tree(),K=a.refs.map(e=>e.objectNumber),Z=q.placementsOf(K,H),J=Af(o,H,K),Q=q.move(a.refs,a.parent,a.position),X=a.parent?.objectNumber??0,{item:{type:"outline.move",...Q},reverse:[{kind:"outline.move",placements:Z,left:K.map(e=>({item:e,parent:X}))},...J]};case"outline.delete":return oQ(e.authority,"doc.outline.modify"),yK(n,Ap(e,t.ref),t.expect),Ac(e,t.ref);case"pages.rotate":return Ag(e,()=>{var n,r;let i,o,a;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),i=AN(AI(n)),o=A_(n).rotate([...r.pages],r.rotation,n.signal),a=r.pages.map(e=>e.objectNumber),{item:{type:"pages.rotate",pages:[...r.pages],rotation:r.rotation,...o},reverse:function(e,t,n){let r=new Map;for(let n of e){let e=t.get(n);r.set(e,[...r.get(e)??[],n])}return[...r].map(([e,t])=>({kind:"pages.rotate",pages:t,rotation:e,left:n}))}(a,i,r.rotation)}});case"pages.setScale":return function(e,t){oQ(e.authority,"doc.annotate.modify");let n=t.pages.map(e=>e.objectNumber);if(new Set(n).size!==n.length)throw new N(G.InvalidArg,"pages.setScale names a page twice",{details:{field:"pages"}});let r=n.map(n=>{let r=AB(e,n),i=AT(e,n);return AM(e,n,t.measure&&nY(t.measure,r)),{page:n,box:r,before:i,left:AT(e,n)}}),i=new Map;for(let{page:e,box:t,before:n,left:o}of r){let r=JSON.stringify([n,o,t]),a=i.get(r)??{pages:[],measure:n,left:o};a.pages.push(e),i.set(r,a)}return{item:{type:"pages.setScale",pages:[...t.pages],measure:t.measure,...AR(e,t.pages[0])},reverse:[...i.values()].map(e=>({kind:"pages.setScale",...e}))}}(e,t);case"pages.reorder":return Ag(e,()=>{var n,r;let i,o,a,s,l,u,d;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),i=r.pages.map(e=>e.objectNumber),o=AO(n),a=Aw(n),s=Ax(o,i),l=A_(n).reorder([...r.pages],r.position,n.signal),u=AO(n),d=AA(n,a,Av(a,o,u,i)),{item:{type:"pages.reorder",...l,...AS(n,d)},reverse:[{kind:"pages.reorder",placements:s,left:Ax(u,i),...d?{labels:d}:{}}]}});case"pages.delete":return Ag(e,()=>{var n,r;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),Ab(n,AG(AO(n),n.session.resolvePageRefs(r.pages)))});case"pages.insertBlank":return Ag(e,()=>{var n,r;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),AD(n,"pages.insertBlank",()=>AP(n).insertBlank(r.spec,r.position??"end",n.signal,r.objectNumbers))});case"pages.insert":return Ag(e,()=>{var n,r;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),AD(n,"pages.insert",()=>{var e;return AP(n).insert(0===(e=r.source).byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.slice().buffer,r.position??"end",n.signal,r.objectNumbers)})});case"pages.copy":return Ag(e,()=>{var n,r;return n=e,r=t,oQ(n.authority,"doc.pages.assemble"),AD(n,"pages.copy",()=>AP(n).copy(r.pages,r.position??"end",n.signal,r.objectNumbers))});case"attachments.create":oQ(e.authority,"doc.attachments.modify");let en=wF(e).create(t.file,t.resources.file,e.signal);return{item:{type:"attachments.create",...en},reverse:[w_(e,en.attachment.ref)]};case"attachments.delete":return oQ(e.authority,"doc.attachments.modify"),wg(e,t.ref)}})(i,r.opInFileSpace(e),t)),r,n)}undo(e,t,n,r){let i=this.context(t,n,t=>e.steps.some(e=>"objects.revert"===e.kind&&("forms.setValue"===e.reports||"forms.setAppearanceText"===e.reports)&&"fields"in e.subject&&e.subject.fields.some(e=>{let n=EW(t,e);return null!==n&&o8(t.authority,n.field.assignment,"fill")})));return Az(this.session,t,e.steps.map(e=>()=>(function(e,t){var n,r,i,o;switch(t.kind){case"objects.revert":if("annotation"in t.subject)return function(e,t){var n,r,i;let o=t.subject.annotation,a=t.reports,s=(n=e,r=o,wf(n,r.page)?.find(e=>K(e.ref)===K(r))??null);if(!s)return yH(e,a);if(oY(e.authority,o0(s.subtype)),yX(e.runtime,e.session,t.objects)){o6(e.authority,s,void 0);let n=yY(e.runtime,e.session,t.objects);return{item:ws(e,a,o,{annotation:wd(e,o),appearance:{action:"restored",changed:t.appearanceChanged??!0},meta:yP(e.session.writeStamp(),o.page.objectNumber,[o])}),reverse:[{...t,objects:n,...(i=t.fallback,i?.kind!=="annotation"?i?{fallback:i}:{}:{fallback:{kind:"annotation",restore:i.left,left:i.restore}})}]}}let l=t.fallback;if(l?.kind!=="annotation")return yH(e,a);let u=l.left,d=l.restore,c=Object.keys(u),f=c.filter(e=>yV(s[e],u[e]));if(0===f.length)return yH(e,a);let m=wa(e,o,Object.fromEntries(f.map(e=>{let t;return[e,(t=d[e],"actions"===e&&"widget"===s.subtype?function(e){let t={};for(let n of z){let r=e?.[n];if(!r){t[n]=null;continue}let i=B(r);i&&(t[n]=i)}return t}(t):t)]})),a),p=c.filter(e=>!f.includes(e)),h=m.item;return 0===p.length||iA(h)||h.type!==a?m:{...m,item:{...h,skipped:p}}}(e,{...t,subject:t.subject});if("outlineItem"in t.subject)return function(e,t){let n=t.subject.outlineItem,r=Au(e),i=r.find(n);if(!i)return yH(e,"outline.update");if(oQ(e.authority,"doc.outline.modify"),yX(e.runtime,e.session,t.objects)){var o;let i=yY(e.runtime,e.session,t.objects);r.countAgain(n);let a=yQ(e.runtime,e.session,i);return{item:{type:"outline.update",...r.updated(n)},reverse:[{...t,objects:a,...(o=t.fallback,o?.kind!=="outline"?o?{fallback:o}:{}:{fallback:{kind:"outline",restore:o.left,left:o.restore}})}]}}let a=t.fallback;if(a?.kind!=="outline")return yH(e,"outline.update");let s=a.left,l=a.restore,u=Object.keys(s),d=u.filter(t=>yV(i[t],s[t])&&function(e,t,n){if("target"!==t||null===n)return!0;if("goto"===n.kind){let t=n.destination?.page.objectNumber;return e.session.allRecords().some(e=>e.pageObjectNumber===t)}return"uri"===n.kind||"named"===n.kind&&["NextPage","PrevPage","FirstPage","LastPage"].includes(n.name??"")}(e,t,l[t]));if(0===d.length)return yH(e,"outline.update");let c=Ad(e,n,Object.fromEntries(d.map(e=>[e,l[e]])),i),f=u.filter(e=>!d.includes(e));return 0===f.length||"outline.update"!==c.item.type?c:{...c,item:{...c.item,skipped:f}}}(e,{...t,subject:t.subject});return function(e,t){if(Ep.has(t.reports)){let n="forms.setSignatureAppearance"===t.reports?"sign":"fill";for(let r of(oY(e.authority,"sign"===n?"doc.sign":"doc.forms.fill"),t.subject.fields)){let t=EW(e,r);t&&("sign"===n?o4(e.authority,t.field.assignment,"sign"):EE(e,t))}}else oQ(e.authority,"doc.forms.modify");if(t.rights&&oQ(e.authority,"doc.forms.import"),yX(e.runtime,e.session,t.objects)){let n=yY(e.runtime,e.session,t.objects),r=t.subject.fields.map(t=>EU(e,t).field);return{item:E3(e,t.reports,r),reverse:[{...t,objects:n,...function(e){switch(e?.kind){case"value":return{fallback:{kind:"value",fields:e.fields.map(({objectNumber:e,before:t,left:n})=>({objectNumber:e,before:n,left:t}))}};case"properties":return{fallback:{...e,restore:e.left,left:e.restore}};default:return{}}}(t.fallback)}]}}if(t.fallback?.kind==="properties")return function(e,t){let n=EW(e,t.objectNumber);if(!n)return yH(e,"forms.update");let r=EZ(n.field),i=t.left,o=t.restore,a=Object.keys(i),s=a.filter(t=>{var a,s,l,u;let d;return yV(r[t],i[t])&&("name"!==t||(a=e,s=n.field.name,l=String(o.name),null===EV(a,{kind:"fqn",name:s.slice(0,s.lastIndexOf(".")+1)+l})))&&("actions"!==t||(u=i.actions,d=o.actions??{},Object.keys(u??{}).every(e=>void 0!==d[e])))&&("takesImage"!==t||!0!==o.takesImage||function(e,t){let n=e.session.requireDocPtr(),r=Pz(e.runtime,n,t.field.widgets,new PR(e.runtime,n)),i=r.filter(e=>null!==e);try{return rJ(i,r.length-i.length),!0}catch(e){if(N.is(e)&&e.code===G.InvalidArg)return!1;throw e}}(e,n))});if(0===s.length)return yH(e,"forms.update");let l=EO(e,n,EJ(o,s)),u=a.filter(e=>!s.includes(e)),d=l.item;return 0===u.length||iA(d)||"forms.update"!==d.type?l:{...l,item:{...d,skipped:u}}}(e,t.fallback);if(t.fallback?.kind!=="value")return yH(e,t.reports);let n=[],r=[];for(let{objectNumber:i,before:o,left:a}of t.fallback.fields){let t=EW(e,i);t&&yV(EQ(t.field),a)?n.push(Ex(e,t,o)):t&&r.push(t.field.name)}return 0===n.length?yH(e,t.reports):"forms.setValue"===t.reports&&1===n.length?n[0]:{item:{...E1(e,n.map(({item:e})=>e.field)),...r.length>0?{skipped:r}:{}},reverse:n.flatMap(e=>e.reverse)}}(e,{...t,subject:t.subject});case"annotation.remove":let a=wf(e,t.ref.page);if(!a)return yH(e,"annotations.delete");let s=tG(a,t.ref),l=new Map(t.left.map(e=>[K(e.ref),e]));if(!(s.length>0&&s.length===l.size&&s.every(e=>{let t=l.get(K(e.ref));return void 0!==t&&yV(e,t)})))return yH(e,"annotations.delete");for(let t of o1(s))oY(e.authority,t);return t.rights&&we(e.authority),wl(e,t.ref,t.rights);case"annotation.restore":return function(e,t){let n=wf(e,t.page),r=t.members[0];if(!n||!r||n.some(e=>K(e.ref)===K(r)))return yH(e,"annotations.restore");let{pageIndex:i,pageObjectNumber:o}=e.session.resolvePageRef(t.page);yj(e.runtime,e.session.requireDocPtr(),i,t.capture),e.session.invalidateDerived(),t.unlinked.length>0&&yX(e.runtime,e.session,t.unlinked)&&yY(e.runtime,e.session,t.unlinked);let a=wc(e,o),s=t.members.map(e=>{let t=a.find(t=>K(t.ref)===K(e));if(!t)throw Error(`a restored annotation is missing: ${K(e)}`);return t});for(let t of o1(s))oY(e.authority,t);return t.rights?we(e.authority):o5(e.authority,s),{item:{type:"annotations.restore",page:t.page,annotations:s,meta:yP(e.session.writeStamp(),o,t.members)},reverse:[{kind:"annotation.remove",ref:r,left:s,...t.rights?{rights:t.rights}:{}}]}}(e,t);case"annotation.reorder":return function(e,t){let n="annotations"===t.family?"annotations.reorder":"forms.reorderWidgets",r=function(e,t){try{return y3(e.runtime,e.session,t)}catch{return null}}(e,t.page);if(!r)return yH(e,n);let i=y2(r,t.family),o=t.refs.filter(e=>{let n=wr(i,e);return void 0!==n&&n===wr(t.after,e)});if(0===o.length)return yH(e,n);wi(e,t.family,o);let a=new Set(o.map(K)),s=new Set(i.map(K).filter(e=>!a.has(e))),l=r;for(let n of t.before.filter(e=>a.has(K(e)))){let r=t.before.findIndex(e=>K(e)===K(n)),i=t.before.slice(0,r).reverse().find(e=>s.has(K(e))),o=y6(l,t.family,[n],i?{after:i}:"start");y5(e.runtime,e.session,o),s.add(K(n)),l=y3(e.runtime,e.session,t.page)}let u=y2(l,t.family);return{item:wo(e,t.family,t.page,u,o),reverse:[{...t,refs:o,before:i,after:u}]}}(e,t);case"field.remove":let u;return oQ(e.authority,"doc.forms.modify"),t.rights&&oQ(e.authority,"doc.forms.import"),(u=EW(e,t.objectNumber))&&yV(u.field,t.left)&&yX(e.runtime,e.session,t.widgets??[])?ET(e,u,t.rights):yH(e,"forms.delete");case"field.restore":return function(e,t){if(oQ(e.authority,"doc.forms.modify"),t.rights&&oQ(e.authority,"doc.forms.import"),ac(Eb(e),t.name))return yH(e,"forms.restore");for(let n of t.pages)try{e.session.resolvePageRef(n)}catch{return yH(e,"forms.restore")}yL(e.runtime,e.session.requireDocPtr(),t.capture),e.session.invalidateDerived();let{field:n}=EU(e,t.objectNumber);return{item:{type:"forms.restore",...EX(e,n)},reverse:[ES(e,n,t.rights)]}}(e,t);case"widget.restore":let d;oQ(e.authority,"doc.forms.modify");try{d=e.session.resolvePageRef(t.page).pageIndex}catch{return yH(e,"forms.restoreWidget")}if(Ez(e,t.widget))return yH(e,"forms.restoreWidget");let c=t.detached.filter(e=>e.objectNumber===t.fieldObjectNumber);if(!yX(e.runtime,e.session,c))return yH(e,"forms.restoreWidget");yj(e.runtime,e.session.requireDocPtr(),d,t.capture),e.session.invalidateDerived(),t.detached.length>0&&yY(e.runtime,e.session,t.detached);let f=function(e,t){let n=wd(e,t);if("widget"!==n.subtype)throw Error(`${K(t)} reads as no widget`);return n}(e,t.widget),m=null===t.fieldObjectNumber?null:EU(e,t.fieldObjectNumber).field;return{item:{type:"forms.restoreWidget",field:m,widgets:[f],meta:y4(e.session.writeStamp(),m?[m.ref]:[],[(n=e,{ref:r=t.widget,objectNumber:wm(n,r),page:r.page})])},reverse:[{kind:"widget.delete",widget:t.widget,left:f}]};case"widget.delete":let p;return oQ(e.authority,"doc.forms.modify"),(p=Ez(e,t.widget))&&yV(p,t.left)?Ek(e,p):yH(e,"forms.deleteWidget");case"widgets.added":return function(e,t){let n,r,i,o;oQ(e.authority,"doc.forms.modify");let a="remove"===t.direction,s="forms.addWidget"===t.reports?"forms.removeWidget":"forms.repeat",l=a?s:t.reports;if(!yX(e.runtime,e.session,t.objects)||!yX(e.runtime,e.session,t.guards)||(i=ED(e,t.fieldObjectNumber),o=t.kids,!(null!==i&&i.length===o.length&&i.every((e,t)=>e===o[t]))))return yH(e,l);let{fn:u,mem:d}=e.runtime,c=e.session.requireDocPtr(),f=t=>{try{return e.session.resolvePageRef(t).pageIndex}catch{return null}},m=(e,t)=>u.EPDFPage_GetAnnotIndexByObjectNumberRaw(c,e,t),p=(e,t,n)=>{if(!u.EPDFPage_RemoveAnnotRaw(c,e,t))throw new N(G.Unknown,`${n} could not leave its page`)},h=(e,t,n)=>{let r=m(e,t);if(!(r<0)&&!(n<0)&&r!==n&&!hY(d,4,t=>(d.poke(t,"i32",r,0),u.EPDFPage_MoveAnnotsRaw(c,e,t,1,n))))throw new N(G.Unknown,"an annotation could not move")},F=t.fieldObjectNumber,{split:g}=t,_=E_(t),P=g?.merged.page?f(g.merged.page):null,D=[],b=[];if(a){for(let t of(b=_.map(t=>({objectNumber:t.objectNumber,capture:yM(e.runtime,c,t.objectNumber,Ef)})),_))if(!u.EPDFForm_DetachWidget(c,F,t.objectNumber))throw new N(G.Unknown,"a widget could not leave its field");let i=new Map;for(let e of t.added){if(!e.page)continue;let t=i.get(e.page.objectNumber)??[];t.push(e),i.set(e.page.objectNumber,t)}for(let[t,n]of i){let r=n[0].page;if(null===f(r))continue;gx(e.runtime,e.session,t);let i=f(r),o=n.map(e=>m(i,e.objectNumber)).filter(e=>e>=0).sort((e,t)=>e-t);if(0!==o.length)for(let t of(D.push({page:r,capture:yC(e.runtime,c,i,o)}),[...o].reverse()))p(i,t,"a widget")}if(g&&null!==P){let t=m(P,g.widget.objectNumber);t>=0&&(n=yC(e.runtime,c,P,[t]),p(P,t,"the split widget")),yj(e.runtime,c,P,g.mergedEntry),h(P,g.merged.objectNumber,t)}e.session.invalidateDerived(),r=yY(e.runtime,e.session,t.objects)}else{let n=t.captures.map(({page:e,capture:t})=>({pageIndex:f(e),capture:t}));if(n.some(({pageIndex:e})=>null===e)||g&&(null===P||!g.widgetEntry))return yH(e,l);if(g&&null!==P&&g.widgetEntry){let t=m(P,g.merged.objectNumber);t>=0&&(p(P,t,"the field"),function(e,t){try{yR(e.runtime,e.session.requireDocPtr(),t,[])}catch{throw new N(G.Unknown,`object ${t} went with its entry on the page`)}}(e,g.merged.objectNumber)),yj(e.runtime,c,P,g.widgetEntry),h(P,g.widget.objectNumber,t)}for(let{pageIndex:t,capture:r}of n)yj(e.runtime,c,t,r);e.session.invalidateDerived();let i=yY(e.runtime,e.session,t.objects);for(let{capture:n}of(_.forEach((e,n)=>{let r,i=t.values[n]??"",o=""!==i?d.writeU16String(i):0n;try{r=u.EPDFForm_AttachWidget(c,F,e.objectNumber,t.states[n]??"",o,0)}finally{0n!==o&&d.free(o)}if(!r)throw new N(G.Unknown,"a widget could not join its field again")}),t.widgets))yT(e.runtime,c,n);e.session.invalidateDerived(),r=i.map(t=>({...t,after:yR(e.runtime,c,t.objectNumber,[])}))}let y=[...Eg(t),...t.added];return{item:"forms.repeat"===t.reports?Ey(e,F,y,[],a):function(e,t,n,r){let{field:i}=EU(e,n);return{type:t,...E0(e,{field:i,meta:y4(e.session.writeStamp(),[i.ref],[...r])})}}(e,l,F,y),reverse:[{...t,direction:a?"restore":"remove",objects:r,guards:a?[]:EP(e,_),kids:ED(e,F)??[],widgets:a?b:[],captures:a?D:[],split:g?{merged:g.merged,mergedEntry:g.mergedEntry,widget:g.widget,...a&&n?{widgetEntry:n}:{}}:null}]}}(e,t);case"fields.repeat":return function(e,t){oQ(e.authority,"doc.forms.modify");let n=e.session.requireDocPtr();if("remove"===t.direction){let r=t.left.flatMap((n,r)=>{let i=EW(e,EK(n.ref));return i&&yV(i.field,n)&&yX(e.runtime,e.session,t.guards[r]??[])?[i]:[]});if(0===r.length)return yH(e,"forms.repeat");let i=r.map(({objectNumber:t,field:r})=>({objectNumber:t,name:r.name,pages:r.widgets.flatMap(e=>e.page?[e.page]:[]),capture:yB(e.runtime,n,t)})),{removedWidgets:o,calculationOrder:a}=new Et(e.runtime,e.session).deleteFields(r.map(({objectNumber:e})=>EM(e)),e.signal),s=r.map(({field:e})=>e);return{item:{type:"forms.repeat",as:"fields",undone:!0,fields:s,widgets:[],dropped:[],...EC(a),meta:y4(e.session.writeStamp(),s.map(e=>e.ref),o,[])},reverse:[{kind:"fields.repeat",direction:"restore",left:[],guards:[],captures:i},...a?[Ej(a)]:[]]}}let r=Eb(e),i=t.captures.filter(({name:t,pages:n})=>{if(ac(r,t))return!1;try{for(let t of n)e.session.resolvePageRef(t)}catch{return!1}return r.add(t),!0});if(0===i.length)return yH(e,"forms.repeat");for(let{capture:t}of i)yL(e.runtime,n,t);e.session.invalidateDerived();let o=i.map(({objectNumber:t})=>EU(e,t).field);return{item:{type:"forms.repeat",as:"fields",...E0(e,{fields:o,meta:y4(e.session.writeStamp(),o.map(e=>e.ref),o.flatMap(e=>e.widgets))}),dropped:[]},reverse:[{kind:"fields.repeat",direction:"remove",left:o,guards:o.map(t=>EP(e,t.widgets)),captures:[]}]}}(e,t);case"calculations.restore":let h,F;return oQ(e.authority,"doc.forms.modify"),F=function(e,{before:t,after:n},r){let i=n.filter(e=>!t.includes(e)),o=e.filter(e=>!i.includes(e));for(let i of t){if(n.includes(i)){if(wQ(t,i)===wQ(n,i)||wQ(e,i)!==wQ(n,i))continue;o=o.filter(e=>e!==i)}else if(o.includes(i)||!r(i))continue;let a=t.indexOf(i),s=t.slice(0,a).reverse().find(e=>o.includes(e)),l=void 0===s?0:o.indexOf(s)+1;o=[...o.slice(0,l),i,...o.slice(l)]}return o}(h=wK(e.runtime,gv(e.runtime,e.session)),t,t=>null!==EW(e,t)),wJ(h,F)?yH(e,"forms.reorderCalculations"):(wZ(e.runtime,e.session.requireDocPtr(),F),e.session.invalidateDerived(),{item:Ew(e,F,[...new Set([...h,...F])].filter(e=>h.indexOf(e)!==F.indexOf(e))),reverse:[Ej({before:h,after:F})]});case"metadata.revert":return function(e,t){oQ(e.authority,"doc.metadata.modify");let n=new FF(e.runtime,e.session),r="metadata.update"===t.op?n.read(e.signal):n.readCustom(e.signal),i=t.left,o=Object.keys(i),a=o.filter(e=>yV(E6(r,e),i[e]));if(0===a.length)return yH(e,t.op);let s=E5(t.restore,a),l=new FZ(e.runtime,e.session),u=o.filter(e=>!a.includes(e)),d={kind:"metadata.revert",op:t.op,restore:E5(t.left,a),left:s};return"metadata.update"===t.op?{item:{type:"metadata.update",...l.update(s,e.signal),...u.length>0?{skipped:u}:{}},reverse:[d]}:{item:{type:"metadata.updateCustom",...l.updateCustom(s,e.signal),...u.length>0?{skipped:u}:{}},reverse:[d]}}(e,t);case"outline.remove":let g=Au(e).tree();if(!g.has(t.ref.objectNumber))return yH(e,"outline.delete");return(oQ(e.authority,"doc.outline.modify"),yV(g.subtreeOf(t.ref.objectNumber),t.left.map(e=>e.objectNumber))&&yX(e.runtime,e.session,t.left))?Ac(e,t.ref):yH(e,"outline.delete");case"outline.restore":return function(e,t){var n,r,i;let o=Au(e),a=o.tree();if(a.has(t.ref.objectNumber)||t.parent&&!a.has(t.parent.objectNumber))return yH(e,"outline.restore");oQ(e.authority,"doc.outline.modify"),n=e.runtime,r=e.session.requireDocPtr(),yU(n,i=t.capture,e=>{if(!n.fn.EPDFOutline_ImportItemRaw(r,e,i.byteLength))throw new N(G.Unknown,"EPDFOutline_ImportItemRaw refused a capture")});let s=o.restored(t.ref.objectNumber);return{item:{type:"outline.restore",...s},reverse:[{kind:"outline.remove",ref:t.ref,left:Am(e,s.items.map(e=>e.ref))}]}}(e,t);case"outline.move":return function(e,t){let n=Au(e),r=n.tree(),i=new Map(t.left.map(({item:e,parent:t})=>[e,t])),o=t.placements.filter(({item:e,parent:t})=>r.parentOf(e)===i.get(e)&&(0===t||r.has(t))&&!r.isAtOrUnder(t,e));if(0===o.length)return yH(e,"outline.move");oQ(e.authority,"doc.outline.modify");let a=o.map(({item:e})=>e),s=n.placementsOf(a,r),l=Af(e,r,a);return{item:{type:"outline.move",...n.place(o,r)},reverse:[{kind:"outline.move",placements:s,left:o.map(({item:e,parent:t})=>({item:e,parent:t}))},...l]}}(e,t);case"outline.reopen":let _,P,D,b,y;return i=e,o=t,P=(_=Au(i)).tree(),D=_.find(o.ref,P),y=(b=P.childrenOf(o.ref.objectNumber)).length===o.children.length&&b.every(e=>o.children.includes(e)),D&&!D.open&&y?(oQ(i.authority,"doc.outline.modify"),{item:{type:"outline.update",..._.update(o.ref,{open:!0})},reverse:[]}):yH(i,"outline.update");case"pages.rotate":return Ag(e,()=>(function(e,t){let n=AN(AI(e)),r=t.pages.filter(e=>n.get(e)===t.left);if(0===r.length)return yH(e,"pages.rotate");oQ(e.authority,"doc.pages.assemble");let i=r.map(q),o=A_(e).rotate(i,t.rotation,e.signal);return{item:{type:"pages.rotate",pages:i,rotation:t.rotation,...o},reverse:[{kind:"pages.rotate",pages:r,rotation:t.left,left:t.rotation}]}})(e,t));case"pages.setScale":let w=t.pages.filter(n=>{let r,i;return r=AT(e,n),i=t.left,JSON.stringify(r)===JSON.stringify(i)});if(0===w.length)return yH(e,"pages.setScale");for(let n of(oQ(e.authority,"doc.annotate.modify"),w))AM(e,n,t.measure);let E=w.map(q);return{item:{type:"pages.setScale",pages:E,measure:t.measure&&nX(t.measure,AB(e,w[0])),...AR(e,E[0])},reverse:[{kind:"pages.setScale",pages:w,measure:t.left,left:t.measure}]};case"pages.reorder":return Ag(e,()=>(function(e,t){let n=AO(e),r=new Map(t.left.map(({page:e,after:t})=>[e,t])),i=t.placements.filter(({page:e,after:t})=>{let i=n.indexOf(e);return i>=0&&(n[i-1]??0)===r.get(e)&&(0===t||n.includes(t))});if(0===i.length)return yH(e,"pages.reorder");oQ(e.authority,"doc.pages.assemble");let o=i.map(({page:e})=>e),a=Ax(n,o),s=Aw(e),l=A_(e),u=null,d=s,c=n;for(let{page:t,after:n}of i){let r=0===n?"start":{after:q(n)};({layout:u}=l.reorder([q(t)],r,e.signal));let i=AO(e);d=Av(d,c,i,[t]),c=i}let f=AA(e,s,AE(s,d,t.labels));return{item:{type:"pages.reorder",pages:o.map(q),layout:f?AI(e):u,meta:AC(e)},reverse:[{kind:"pages.reorder",placements:a,left:Ax(AO(e),o),...f?{labels:f}:{}}]}})(e,t));case"pages.restore":return Ag(e,()=>(function(e,t){let n=AO(e),r=t.pages.filter(({page:e})=>!n.includes(e));if(0===r.length)return yH(e,"pages.restore");oQ(e.authority,"doc.pages.assemble");let i=Aw(e),o=e.session.requireDocPtr();for(let{capture:t}of r)!function(e,t,n){yU(e,n,r=>{if(!e.fn.EPDFPage_ImportRaw(t,r,n.byteLength))throw new N(G.Unknown,"EPDFPage_ImportRaw refused a capture")})}(e.runtime,o,t);e.session.refreshPageRegistry(),e.session.invalidateDerived();let a=AO(e),s=AG(a,r.map(({page:e})=>e)),l=AA(e,i,AE(i,s.reduce((e,t)=>r0(e,a.indexOf(t),1),i),t.labels));return{item:{type:"pages.restore",pages:s.map(q),layout:AI(e),meta:AC(e)},reverse:[Ay(e,s,l)]}})(e,t));case"pages.remove":return Ag(e,()=>(function(e,t){let n=AO(e),r=t.pages.filter(({page:t,left:r})=>n.includes(t)&&Ak(e,t)===r).map(({page:e})=>e);if(0===r.length||r.length>=n.length)return yH(e,"pages.delete");oQ(e.authority,"doc.pages.assemble");let i=function(e,t,n){let r=[];for(let i of t){let t=EW(e,i);t&&t.field.widgets.every(e=>e.page&&n.has(e.page.objectNumber))&&r.push(...ET(e,t).reverse)}return r}(e,t.fields??[],new Set(r)),o=Ab(e,AG(n,r),t.labels);return{item:o.item,reverse:[...o.reverse,...i]}})(e,t));case"attachments.remove":let A=y$(e.runtime,e.session.requireDocPtr(),t.ref.key);if(!A||!yZ(A,t.left))return yH(e,"attachments.delete");return oQ(e.authority,"doc.attachments.modify"),wg(e,t.ref);case"attachments.restore":return function(e,t){var n,r,i;let o=wF(e);if(o.find(t.ref))return yH(e,"attachments.restore");oQ(e.authority,"doc.attachments.modify"),n=e.runtime,r=e.session.requireDocPtr(),yU(n,i=t.capture,e=>{if(!n.fn.EPDFAttachment_ImportRaw(r,e,i.byteLength))throw new N(G.Unknown,"EPDFAttachment_ImportRaw refused a capture")});let a=o.find(t.ref);if(!a)throw new N(G.Unknown,`attachment \'${t.ref.key}\' did not come back`);return{item:{type:"attachments.restore",attachment:a,meta:o.meta(t.ref)},reverse:[w_(e,t.ref)]}}(e,t)}})(i,e)),r,n)}context(e,t,n){let r,i={runtime:this.runtime,session:this.session,...this.fonts?{fonts:this.fonts}:{},authority:e,signal:t,limits:this.limits,fillsOwnField:()=>r??(r=n(i))};return i}};function Az(e,t,n,r,i){let o=[],a=[];for(let t of n){hW(i),e.clearMissingCharacters();let n=t(),s=e.missingCharacters(),l=0===s.length?n.item:{...n.item,meta:{...n.item.meta,missingCharacters:s}};o.push(r.itemOut(l)),a.push(n.reverse)}return{items:o,record:{userId:t.identity.userId??null,steps:a.reverse().flat()}}}var AU=class{constructor(){hJ(this,"entries",new Map),hJ(this,"bytes",0)}outcome(e){return this.entries.get(e)?.outcome}record(e){let t=this.entries.get(e);if(t)return t.unavailable?{unavailable:t.unavailable}:{record:t.record}}keepApplied(e,t,n,r){let i=r?function(e){let t=0,n=e=>{for(let n of e)t+=(n.before?.byteLength??0)+n.after.byteLength};for(let r of e.steps)switch(r.kind){case"objects.revert":n(r.objects);break;case"annotation.restore":t+=r.capture.byteLength,n(r.unlinked);break;case"field.restore":case"outline.restore":case"attachments.restore":t+=r.capture.byteLength;break;case"widgets.added":for(let{capture:e}of(n(r.objects),n(r.guards),r.widgets))t+=e.byteLength;for(let{capture:e}of r.captures)t+=e.byteLength;t+=(r.split?.mergedEntry.byteLength??0)+(r.split?.widgetEntry?.byteLength??0);break;case"fields.repeat":for(let e of r.guards)n(e);for(let{capture:e}of r.captures)t+=e.byteLength;break;case"field.remove":n(r.widgets??[]);break;case"outline.remove":n(r.left);break;case"pages.restore":for(let{capture:e}of r.pages)t+=e.byteLength;break;case"attachments.remove":t+=r.left.byteLength}return t}(r):0;this.add(e,{outcome:{kind:"applied",fingerprint:t,result:n},record:r,bytes:i}),this.bytes+=i,this.trimCaptures()}keepRefused(e,t,n){this.add(e,{outcome:{kind:"refused",fingerprint:t,error:n},record:null,bytes:0})}endUndo(){for(let e of this.entries.values())"applied"!==e.outcome.kind||e.unavailable||this.drop(e,"final-change")}add(e,t){for(let[n,r]of(this.entries.set(e,t),this.entries)){if(this.entries.size<=4096)break;this.drop(r,"expired"),this.entries.delete(n)}}trimCaptures(){for(let e of this.entries.values()){if(this.bytes<=0x4000000)break;e.bytes>0&&this.drop(e,"expired")}}drop(e,t){this.bytes-=e.bytes,e.record=null,e.bytes=0,e.unavailable=t}},AV=new WeakMap;function AW(e){let t=AV.get(e);return t||(t=new AU,AV.set(e,t)),t}function Aq(e){let t="none"!==e.openedAs;return{encryptionState:t?"encrypted":"none",encryptionRequiresPassword:!1,securityHandlerRevision:t?e.securityHandlerRevision:null,pdfPermissionsBits:e.permissionsBits,pdfPermissionsAllAllowed:(0xfffffffc&e.permissionsBits>>>0)>>>0==0xfffffffc,pdfOpenedAs:e.openedAs,securityProbedAt:e.probedAt}}var AH=class{constructor(e){this.runtime=e,hV(this.runtime)}probeFile(e,t=null){let n=Date.now(),r=null,i=null;try{if(r=this.runtime.fileAccess.fromNodeFile(e),!(i=this.runtime.fn.FPDF_LoadCustomDocument(r.ptr,t??""))){var o;let e=this.runtime.fn.FPDF_GetLastError();if(4===e)return{encryptionState:"encrypted",encryptionRequiresPassword:!0,securityHandlerRevision:null,pdfPermissionsBits:null,pdfPermissionsAllAllowed:null,pdfOpenedAs:null,securityProbedAt:n};if(5===e)return{encryptionState:"unsupported",encryptionRequiresPassword:null,securityHandlerRevision:null,pdfPermissionsBits:null,pdfPermissionsAllAllowed:null,pdfOpenedAs:null,securityProbedAt:n};return o=n,{encryptionState:"unknown",encryptionRequiresPassword:null,securityHandlerRevision:null,pdfPermissionsBits:null,pdfPermissionsAllAllowed:null,pdfOpenedAs:null,securityProbedAt:o}}let a=this.runtime.fn.EPDF_IsEncrypted(i),s=this.runtime.fn.FPDF_GetDocPermissions(i)>>>0;return Aq({openedAs:a?this.runtime.fn.EPDF_IsOwnerUnlocked(i)?"owner":"user":"none",permissionsBits:s,securityHandlerRevision:a?this.runtime.fn.FPDF_GetSecurityHandlerRevision(i):null,probedAt:n})}finally{i&&this.runtime.fn.FPDF_CloseDocument(i),r?.close()}}readLiveSecurityInfo(e){let{fn:t}=this.runtime,n=e.requireDocPtr(),r=t.EPDF_IsEncrypted(n),i=t.FPDF_GetDocUserPermissions(n)>>>0;return Aq({openedAs:r?t.EPDF_IsOwnerUnlocked(n)?"owner":"user":"none",permissionsBits:i,securityHandlerRevision:r?t.FPDF_GetSecurityHandlerRevision(n):null,probedAt:Date.now()})}checkPasswordPermissions(e,t,n="any"){let r=e.requireDocPtr(),{mem:i,fn:o}=this.runtime,a=i.alloc(4),s=i.alloc(4),l=i.alloc(4),u=i.alloc(4);try{var d;if(i.poke(a,"i32",0),i.poke(s,"i32",0),i.poke(l,"i32",0),i.poke(u,"i32",0),!o.EPDF_CheckPasswordPermissions(r,t,a,s,l,u))throw new N(G.DocPasswordIncorrect,"incorrect document password");let e=(d=Number(i.peek(a,"i32")),3===d?"owner":2===d?"user":"none");if("owner"===n&&"owner"!==e)throw new N(G.DocPasswordIncorrect,"owner password required");return Aq({openedAs:e,permissionsBits:Number(i.peek(l,"i32"))>>>0,securityHandlerRevision:Number(i.peek(u,"i32")),probedAt:Date.now()})}finally{i.free(u),i.free(l),i.free(s),i.free(a)}}};function AK(e){return"incremental"===e?1:2}function AZ(e){return 1===e?new N(G.DocOpenFailed,"layer artifact cannot be saved because append-only offsets exceed the supported range"):new N(G.DocOpenFailed,"failed to save layer artifact")}function AJ(e,t,n){let r=e.readBytes(t,n);return r.buffer instanceof ArrayBuffer&&0===r.byteOffset&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer}var AQ=class{constructor(e,t){this.runtime=e,this.session=t}snapshot(){if(!this.session.hasUnsavedEdits())return{bytes:this.loadedBytes(),source:"loaded"};let e=this.saveStandaloneToBufferEx("incremental");return e.unchangedSinceLoad?{bytes:this.loadedBytes(),source:"loaded"}:{bytes:e.bytes,source:"working-copy"}}loadedBytes(){return new wR(this.runtime,this.session).loadedBytes()}copyLoadedBytesToFile(e){let t=new wR(this.runtime,this.session),n=Number(this.runtime.fn.EPDFDoc_GetLoadedBytesSize(this.session.requireDocPtr()));this.runtime.fileWrite.removeFile(e);for(let r=0;r{Ft(n,i,0),Ft(n,o,0),Ft(n,a,0);let s=r.EPDFSig_SaveCandidateToOwnedBuffer(e,t,i,o,a);if(!s)throw new N(G.Unknown,"failed to save the signing candidate");try{let e=Fn(n,i);return{kind:"memory",bytes:AX(n.readBytes(s,e)),size:e,objectOffset:Fn(n,o),objectLength:Fn(n,a)}}finally{r.EPDF_FreeBuffer(s)}})}seal(e,t){if("memory"!==e.kind)throw new N(G.InvalidArg,"not a memory candidate");let{mem:n,fn:r}=this.runtime,i=n.alloc(e.bytes.byteLength);try{return n.writeBytes(i,e.bytes),h0(n,[32,8,8,64,8],([o,a,s,l,u])=>{for(let e=0;e<4;e++)Ft(n,o,0,8*e);if(Ft(n,a,0),Ft(n,s,0),Ft(n,u,64),!r.EPDFSig_Seal(i,BigInt(e.bytes.byteLength),BigInt(e.objectOffset),BigInt(e.objectLength),wj[t],o,a,s,l,u))throw new N(G.Unknown,"failed to seal the signing candidate");e.bytes=AX(n.readBytes(i,e.bytes.byteLength));let d=Number(n.peek(u,"i32"));return{byteRange:[Fn(n,o,0),Fn(n,o,8),Fn(n,o,16),Fn(n,o,24)],contentsOffset:Fn(n,a),contentsHexLength:Fn(n,s),digest:AX(n.readBytes(l,d))}})}finally{n.free(i)}}writeContents(e,t,n){if("memory"!==e.kind)throw new N(G.InvalidArg,"not a memory candidate");let{mem:r}=this.runtime,i=r.alloc(e.bytes.byteLength);try{r.writeBytes(i,e.bytes),AY(this.runtime,i,e.bytes.byteLength,0,t,n),e.bytes=AX(r.readBytes(i,e.bytes.byteLength))}finally{r.free(i)}}openSealed(e,t){if("memory"!==e.kind)throw new N(G.InvalidArg,"not a memory candidate");let n=this.baseDocuments.acquireMemoryBase({key:`signed:${iX()}`,bytes:e.bytes,password:t});return h9(this.runtime,n,{kind:"fresh"},t)}discard(){}},A1=class{constructor(e,t,n,r=A3){this.runtime=e,this.baseDocuments=t,this.basePath=n,this.candidatePath=r}save(e,t,n){let{mem:r,fn:i}=this.runtime,o=this.candidatePath(this.basePath,n);this.runtime.fileWrite.removeFile(o);let a=this.runtime.fileWrite.toNodeFile(o);try{return h0(r,[8,8,8],([n,s,l])=>{if(Ft(r,n,0),Ft(r,s,0),Ft(r,l,0),!i.EPDFSig_SaveCandidate(e,t,a.ptr,n,s,l))throw new N(G.Unknown,"failed to save the signing candidate");return{kind:"file",path:o,size:Fn(r,n),objectOffset:Fn(r,s),objectLength:Fn(r,l)}})}catch(e){throw a.close(),this.runtime.fileWrite.removeFile(o),e}finally{a.close()}}seal(e,t){let n;if("file"!==e.kind)throw new N(G.InvalidArg,"not a file candidate");let{mem:r,fn:i}=this.runtime,o=this.runtime.fileAccess.readRange(e.path,e.objectOffset,e.objectLength);if(o.byteLength!==e.objectLength)throw new N(G.Unknown,"the signing candidate file is shorter than its object span");let a=r.alloc(o.byteLength);try{r.writeBytes(a,o),n=function(e,t,n,r,i){let{fn:o,mem:a}=e;return h0(a,[32,8,8],([e,s,l])=>{for(let t=0;t<4;t++)Ft(a,e,0,8*t);if(Ft(a,s,0),Ft(a,l,0),!o.EPDFSig_SealSpan(t,BigInt(n),BigInt(r),BigInt(i),e,s,l))throw new N(G.Unknown,"failed to seal the signing candidate");return{byteRange:[Fn(a,e,0),Fn(a,e,8),Fn(a,e,16),Fn(a,e,24)],contentsOffset:Fn(a,s),contentsHexLength:Fn(a,l)}})}(this.runtime,a,o.byteLength,e.objectOffset,e.size),this.runtime.fileWrite.writeRange(e.path,e.objectOffset,r.readBytes(a,o.byteLength))}finally{r.free(a)}let s=this.runtime.fileAccess.fromNodeFile(e.path);try{let e=h0(r,[32,64,8],([e,o,a])=>{for(let t=0;t<4;t++)Ft(r,e,n.byteRange[t],8*t);if(Ft(r,a,64),!i.EPDFSig_DigestFileRange(s.ptr,e,wj[t],o,a))throw new N(G.Unknown,"failed to digest the signing candidate file");return AX(r.readBytes(o,Number(r.peek(a,"i32"))))});return{...n,digest:e}}finally{s.close()}}writeContents(e,t,n){if("file"!==e.kind)throw new N(G.InvalidArg,"not a file candidate");let{mem:r}=this.runtime,i=this.runtime.fileAccess.readRange(e.path,e.objectOffset,e.objectLength),o=r.alloc(i.byteLength);try{r.writeBytes(o,i),AY(this.runtime,o,i.byteLength,e.objectOffset,t,n),this.runtime.fileWrite.writeRange(e.path,e.objectOffset,r.readBytes(o,i.byteLength))}finally{r.free(o)}}openSealed(e,t){if("file"!==e.kind)throw new N(G.InvalidArg,"not a file candidate");let n=this.baseDocuments.acquireFileBase({key:`signed:${e.path}`,path:e.path,password:t});return h9(this.runtime,n,{kind:"fresh"},t)}discard(e){"file"===e.kind&&this.runtime.fileWrite.removeFile(e.path)}};function A3(e,t){return`${e}.signing-${t}.pdf`}function A2(e,t,n,r){return`${e}.${t}-${n}.${r}`}function A6(e,t,n,r){var i,o;let a=e=>new N(G.SignatureRefused,`the sealed bytes ${e}`),s=wS(e,n),l=s.find(e=>"objectNumber"===e.field.kind&&e.field.objectNumber===r.fieldObjectNumber);if(!l)throw a("lost the signature field");if(!l.signed||"whole-revision"!==l.coverage||!l.byteRange)throw a("do not carry a whole-revision signature on the field");if(i=l.byteRange,o=r.byteRange,i[0]!==o[0]||i[1]!==o[1]||i[2]!==o[2]||i[3]!==o[3])throw a(`carry /ByteRange [${l.byteRange.join(" ")}] where [${r.byteRange.join(" ")}] was sealed`);if(!e.fn.EPDFSig_IsRevisionChainValid(n))throw a("have a broken cross-reference chain");let u=wx(e,t,s);if(l.revisionIndex!==u.length-1)throw a("seal an earlier revision than the candidate");if(!yZ(wk(e,n,l.index),r.cms))throw a("carry /Contents that are not the CMS installed");return l}function A5(e,t,n){let r=gv(e,t),i=e.fn.EPDFForm_GetFieldIndexByObjNum(r,n);return i<0?null:PY(e,r,i)}var A4={"adbe.pkcs7.detached":0,"ETSI.CAdES.detached":1,"ETSI.RFC3161":2},A8={all:1,include:2,exclude:3},A7={bytes:52,ptrBytes:4,subfilter:0,digest:4,contentsSize:8,name:12,reason:16,location:20,contactInfo:24,signingTime:28,docmdpPermission:32,fieldmdpAction:36,fieldmdpFields:40,fieldmdpFieldCount:44,lockPermission:48},A9={bytes:80,ptrBytes:8,subfilter:0,digest:4,contentsSize:8,name:16,reason:24,location:32,contactInfo:40,signingTime:48,docmdpPermission:56,fieldmdpAction:60,fieldmdpFields:64,fieldmdpFieldCount:72,lockPermission:76},ve=class{constructor(e,t,n,r){this.runtime=e,this.session=t,this.baseDocuments=n,this.candidatePath=r}prepare(e,t){if(this.session.pendingSigning)throw new N(G.SigningPending,`a signing is pending (${this.session.pendingSigning.prepared.signingId}); complete or cancel it first`);if(!e.field&&(e.kind??"signature")!=="timestamp")throw new N(G.InvalidArg,"a signature needs a `field`: only a document timestamp (`kind: \'timestamp\'`) can be given one by the engine",{details:{field:"field"}});let n=new wR(this.runtime,this.session),r=e.field?n.resolveField(e.field):null,i=r?A5(this.runtime,this.session,r.fieldObjectNumber):null;r?o4(t,i,"sign"):oQ(t,"doc.sign");let o=e.lock??this.defaultLock(i,(e.kind??"signature")==="signature",r?.lock??null);if(r?.signed)throw new N(G.SignatureRefused,"the signature field is already signed");if(e.appearance&&!r?.widget)throw new N(G.SignatureRefused,r?"the signature field has no widget to carry an appearance":"a timestamp with a field of its own shows nowhere, so it carries no appearance");let a=e.digest??"sha256";if(!(a in wj)||"sha1"===a)throw new N(G.SignatureRefused,`unsupported digest \'${a}\'`);let s=(e.kind??"signature")==="timestamp"?"ETSI.RFC3161":e.subFilter??"ETSI.CAdES.detached";if(!(s in A4))throw new N(G.SignatureRefused,`unsupported subFilter \'${s}\'`);let l=e.contentsSizeBytes??8192;if(!Number.isInteger(l)||l<256||l>4194304)throw new N(G.SignatureRefused,"contentsSize must be an integer in [256, 4194304]");let u=this.session.versionRef(n.version().sha256),d=iX(),c=new h8;try{let t,n=this.openCandidate(d,c);c.push(()=>n.close());let i=r?null:function(e,t){let{fn:n,mem:r}=e;for(let i=1;i<=64;i++){let o,a,s=`Timestamp${i}`,l=r.writeU16String(s);try{o=n.EPDFForm_CreateField(t,7,l,0)}finally{r.free(l)}if(o<=0)continue;let u=n.EPDFPage_CreateAnnotRaw(t,0,20,0);if(0n===u)throw new N(G.SignatureRefused,"the document has no first page to put the timestamp field on");try{Dx(n,r,u,{left:0,top:0,right:0,bottom:0}),Dk(n,u,{print:!0,locked:!0}),a=n.EPDFAnnot_GetObjectNumber(u)}finally{n.FPDFPage_CloseAnnot(u)}if(a<=0||!n.EPDFForm_AttachWidget(t,o,a,"",0n,0))throw new N(G.Unknown,"the timestamp field could not be given its widget");return function(e,t,n){let{fn:r}=e,i=r.EPDFPage_GetAnnotIndexByObjectNumberRaw(t,0,n),o=i<0?0n:r.EPDFPage_GetAnnotRaw(t,0,i);if(0n===o)throw new N(G.Unknown,"the timestamp widget is not on its page");try{if(!r.FPDFAnnot_SetAP(o,0,0n))throw new N(G.Unknown,"the timestamp widget kept its appearance")}finally{r.FPDFPage_CloseAnnot(o)}}(e,t,a),{fieldObjectNumber:o,name:s}}throw new N(G.SignatureRefused,"the engine could not make a field for the timestamp: no name from Timestamp1 to Timestamp64 could be used")}(this.runtime,n.docPtr),f=r?r.fieldObjectNumber:i.fieldObjectNumber,m=e.signer,p=this.callPrepare(n.docPtr,f,{subfilter:A4[s],digest:wj[a],contentsSize:l,name:m?.name??null,reason:m?.reason??null,location:m?.location??null,contactInfo:m?.contactInfo??null,signingTime:m?.signedAt!==void 0?hH(m.signedAt):null,docmdpPermission:e.certify?.permission??0,fieldmdpAction:o?A8[o.action]:0,fieldmdpFields:o?.action==="all"?[]:o?.fields??[],lockPermission:o?.permission??0});if(0===p)throw new N(G.SignatureRefused,"the engine refused to author the signature (the field is signed, read-only or locked, a certification is not allowed here, the seed value requires what is not implemented, or the request is inconsistent)");let h=iE(e.appearance??null);h&&r?.widget&&w3(this.runtime,n.docPtr,new hQ,r.widget,h);let F=this.storeFor(),g=F.save(n.docPtr,p,d);try{t=F.seal(g,a)}catch(e){throw F.discard(g),e}let _={signingId:d,digest:t.digest,algorithm:a,byteRange:t.byteRange,contentsSizeBytes:l,subFilter:s,expectedVersion:u,expiresAt:null,...i?{field:{kind:"fqn",name:i.name}}:{}};return this.session.pendingSigning={prepared:_,fieldObjectNumber:f,madeField:null!==i,saved:g,contentsOffset:t.contentsOffset,contentsHexLength:t.contentsHexLength},_}finally{c.close()}}complete(e,t,n){var r,i;let o=this.session.pendingSigning;if(!o||o.prepared.signingId!==e.signingId){let t=this.session.lastCompletion;if(t&&t.signingId===e.signingId){if(!yZ(t.cms,e.cms))throw new N(G.SignatureRefused,"this signing already completed with a different CMS");return{...t.result,status:"already-completed"}}throw new N(G.NotFound,`no pending signing \'${e.signingId}\'`)}if(o.madeField?oQ(n,"doc.sign"):o4(n,A5(this.runtime,this.session,o.fieldObjectNumber),"sign"),r=o.prepared.expectedVersion,i=e.expectedVersion,r.baseSha256!==i.baseSha256||r.editsVersion!==i.editsVersion)throw new N(G.SigningVersionMismatch,"expectedVersion is not the version the candidate was prepared on");if(0===e.cms.byteLength||48!==e.cms[0])throw new N(G.SignatureRefused,"the CMS is not a DER SEQUENCE");if(e.cms.byteLength>o.prepared.contentsSizeBytes)throw new N(G.SignatureRefused,`the CMS (${e.cms.byteLength} bytes) does not fit the reserved ${o.prepared.contentsSizeBytes} bytes`);let a=this.storeFor(),s={byteRange:o.prepared.byteRange,contentsOffset:o.contentsOffset,contentsHexLength:o.contentsHexLength,digest:o.prepared.digest};a.writeContents(o.saved,s,e.cms);let l=a.openSealed(o.saved,this.session.password);this.verifySealed(l,{fieldObjectNumber:o.fieldObjectNumber,byteRange:o.prepared.byteRange,cms:e.cms}),this.session.install(l),gS(this.runtime,this.session),wC(this.runtime,this.session);let u=new wR(this.runtime,this.session),d=u.readSnapshot(),c=d.signatures.find(e=>"objectNumber"===e.field.kind&&e.field.objectNumber===o.fieldObjectNumber);if(!c)throw new N(G.Unknown,"the installed document lost the signature field");let f={status:"completed",signature:c,version:u.version(),previous:o.prepared.expectedVersion,protection:d.protection,meta:{affectedPages:this.session.allRecords().map(e=>q(e.pageObjectNumber)),cacheDelta:null,opId:t,undoable:!1}};return this.session.lastCompletion={signingId:e.signingId,cms:e.cms.slice(),result:f},f}cancel(e){let t=this.session.pendingSigning;return t&&t.prepared.signingId===e?(this.session.pendingSigning=null,this.storeFor().discard(t.saved),{status:"cancelled"}):this.session.lastCompletion?.signingId===e?{status:"already-completed"}:{status:"unknown"}}defaultLock(e,t,n){if(n)return;let r=t?function(e,t){let{fn:n,mem:r}=e,i=gv(e,t),o=t.requireDocPtr(),a=new PR(e,o),s=[],l=n.EPDFForm_CountFields(i);for(let t=0;tn.EPDFForm_GetFieldName(i,t,e,r));l&&s.push(l)}return s}(this.runtime,this.session):[];if(null!==e||0!==r.length)return{action:"include",fields:[...null===e?[]:function(e,t,n){let{fn:r,mem:i}=e,o=gv(e,t),a=[],s=r.EPDFForm_CountFields(o);for(let t=0;tr.EPDFForm_GetFieldName(o,t,e,n));s&&a.push(s)}return a}(this.runtime,this.session,e),...r]}}callPrepare(e,t,n){let{mem:r,fn:i}=this.runtime,o="wasm"===this.runtime.kind?A7:A9,a=[],s=e=>{if(null===e)return 0n;let t=r.writeU16String(e);return a.push(t),t};try{return gf(this.runtime,n.fieldmdpFields,(l,u)=>hY(r,o.bytes,d=>{for(let e=0;e{4===o.ptrBytes?r.poke(d,"i32",Number(t),e):r.poke(d,"i64",t,e)};return r.poke(d,"i32",n.subfilter,o.subfilter),r.poke(d,"i32",n.digest,o.digest),r.poke(d,"i32",n.contentsSize,o.contentsSize),c(o.name,s(n.name)),c(o.reason,s(n.reason)),c(o.location,s(n.location)),c(o.contactInfo,s(n.contactInfo)),c(o.signingTime,(e=>{if(null===e)return 0n;let t=r.writeU8String(e);return a.push(t),t})(n.signingTime)),r.poke(d,"i32",n.docmdpPermission,o.docmdpPermission),r.poke(d,"i32",n.fieldmdpAction,o.fieldmdpAction),c(o.fieldmdpFields,u>0?l:0n),r.poke(d,"i32",u,o.fieldmdpFieldCount),r.poke(d,"i32",n.lockPermission,o.lockPermission),i.EPDFSig_Prepare(e,t,d)}))}finally{for(let e=a.length-1;e>=0;e--)r.free(a[e])}}storeFor(){let e=this.session.source.base;return e?.kind==="file"?new A1(this.runtime,this.baseDocuments,e.path,this.candidatePath):new A0(this.runtime,this.baseDocuments)}verifySealed(e,t){let{fn:n}=this.runtime;try{let r=n.EPDFSig_LoadModel(e.docPtr);if(!r)throw new N(G.Unknown,"the sealed bytes have no signature model");try{A6(this.runtime,e.docPtr,r,t)}finally{n.EPDFSig_CloseModel(r)}"layer"!==this.session.kind&&(this.session.persistLayerArtifact=!1)}catch(t){throw e.close(),t}}openCandidate(e,t){let n=this.session.password,r=this.session.source,i=new AQ(this.runtime,this.session),o=i.canWriteScratchFiles()&&r.base?.kind==="file"?r.base.path:null;if("layer"===this.session.kind&&r.base&&!this.loadedDeltaHoldsSignedBytes()){let a=this.baseDocuments.retainByKey(r.base.key);if(a){let s=r.layer??{kind:"fresh"};if(this.session.hasUnsavedEdits())if(o){let n=A2(o,"signing",e,"layer");t.push(()=>this.runtime.fileWrite.removeFile(n)),i.saveLayerArtifactToFileEx(n).changedSinceLoad&&(s={kind:"artifact-file",path:n})}else{let e=i.saveLayerArtifactEx();e.changedSinceLoad&&(s={kind:"artifact",bytes:e.bytes})}return h9(this.runtime,a,s,n)}}if(o){let r=A2(o,"signing",e,"base.pdf");t.push(()=>this.runtime.fileWrite.removeFile(r)),i.snapshotToFile(r);let a=this.baseDocuments.acquireFileBase({key:`candidate:${e}`,path:r,password:n});return h9(this.runtime,a,{kind:"fresh"},n)}let a=i.snapshot().bytes,s=this.baseDocuments.acquireMemoryBase({key:`candidate:${e}`,bytes:new Uint8Array(a),password:n});return h9(this.runtime,s,{kind:"fresh"},n)}loadedDeltaHoldsSignedBytes(){let e=this.session.source.layer;if(!e||"fresh"===e.kind)return!1;let t=Number(this.runtime.fn.EPDFDoc_GetBaseBytesSize(this.session.requireDocPtr()));return new wR(this.runtime,this.session).readSnapshot().signatures.some(e=>e.signed&&null!==e.byteRange&&e.byteRange[2]+e.byteRange[3]>t)}},vt={0:"added",1:"modified",2:"freed"},vn={0:"dictionary",1:"stream",2:"array",3:"scalar",4:"xref",5:"objstm",6:"trailer"},vr={0:"ok",1:"failed",2:"absent"};function vi(e,t){let n=new Set([0,e.root,e.pagesRoot,...e.pages,...t]);for(let t of(e.acroForm&&n.add(e.acroForm),e.fields))for(let e of(n.add(t.objectNumber),t.widgets))n.add(e);return n}var vo=class{constructor(e,t){this.runtime=e,this.session=t}readWorkingCopySnapshot(){let e=new h8;try{let t=this.openWorkingCopy(e);if("loaded"===t.source)return new wR(this.runtime,this.session).readSnapshot();let n=t.target;return wG(this.runtime,n,e=>{let t=this.runtime.fn.EPDFSig_IsRevisionChainValid(e),r=wS(this.runtime,e);return{chainValid:t,revisions:t?wx(this.runtime,n,r):[],signatures:r,protection:iM(r)}})}finally{e.close()}}analyze(e){let t,n=new wR(this.runtime,this.session),r=n.readSnapshot(),i=n.version(),o=e.exploratoryLevel?"exploratory":"authoritative",a=e.detail??"summary",s="persisted",l=this.session.editsSeq(),u=null;if("signatureIndex"in e.since){let n=r.signatures[e.since.signatureIndex];if(!n)throw new N(G.NotFound,`no signature ${e.since.signatureIndex}`);if(!n.signed||null===n.revisionIndex)throw new N(G.InvalidArg,`signature ${e.since.signatureIndex} seals no whole revision; nothing to analyze from`);t=n.revisionIndex,u=n.index}else t=e.since.revisionIndex;if(!r.chainValid){let e={verdict:"indeterminate",complete:!1,findings:[{rule:"revision-chain",verdict:"incomplete",objectNumber:0,detail:"the cross-reference chain is broken or was rebuilt: no revision can be told from another"}],method:"net-state"};return{mode:o,policyVersion:6,basis:{version:i,editsVersion:l,source:"persisted"},since:{revisionIndex:t,signatureIndex:u},until:{revisionIndex:t},restrictions:[],current:{...e,primary:e.findings[0]},later:{revisionCount:0,undoneObjectNumbers:[]},verdict:"indeterminate",steps:[]}}if(!Number.isInteger(t)||t<0||t>=r.revisions.length)throw new N(G.InvalidArg,`no revision ${t}`);let d=new h8;try{let n,c,f,m,p,h=this.session.requireDocPtr(),F=r.revisions,g="working-copy"===e.until?this.openWorkingCopy(d):null;if(g&&"working-copy"===g.source){s="working-copy",h=g.target;let e=wG(this.runtime,h,e=>wS(this.runtime,e));if(F=wx(this.runtime,h,e),0===F.length)throw new N(G.MalformedPdf,"the working copy has no valid revision chain")}let _=F.length-1;if("object"==typeof e.until&&(_=e.until.revisionIndex,!Number.isInteger(_)||_=F.length))throw new N(G.InvalidArg,`no revision ${_} at or after ${t}`);let P=new h8,D=[],b=[];try{let e=this.openPrefix(h,F,t,P),n=_===F.length-1?h:this.openPrefix(h,F,_,P);c=wO(this.runtime,e),f=_===t?c:wO(this.runtime,n),_>t&&({changes:D,unwritten:b,health:m}=this.compare(e,n,c,f))}finally{P.close()}let y=null===u?null:c.signatures[u]??null,w=function(e,t){let n=[],r=[],i=null,o=!1;for(let a of e.signatures){if(!a.signed||null===a.revisionIndex)continue;o=!0;let e=null!==t&&a.index===t.index,s=null!==t&&!e&&"timestamp"===t.kind&&1===a.docMdp;a.catalogCertification&&null!==a.docMdp&&!s&&(n.push({signatureIndex:a.index,revisionIndex:a.revisionIndex,source:"docmdp",own:e,permission:a.docMdp}),i=iI(i??"annotate",iO(a.docMdp))),a.lock?.permission!==void 0&&(i=iI(i??"annotate",iO(a.lock.permission))),(null===t||e)&&(a.fieldMdp&&(n.push({signatureIndex:a.index,revisionIndex:a.revisionIndex,source:"fieldmdp",own:e,fields:a.fieldMdp}),r.push({signatureIndex:a.index,source:"fieldmdp",spec:a.fieldMdp})),a.lock&&(n.push({signatureIndex:a.index,revisionIndex:a.revisionIndex,source:"lock",own:e,fields:a.lock}),r.push({signatureIndex:a.index,source:"lock",spec:a.lock})))}return{anchors:n,level:o?i??"annotate":"annotate",locks:r}}(c,y),E=e.exploratoryLevel,A=ow({older:t,newer:_,changes:D,unwritten:b,before:c,after:f,health:m,restrictions:{level:w.level,locks:w.locks},levelOverride:E}),v=w.anchors.some(e=>"docmdp"===e.source&&e.own),S=_-t;p=S<=1?1===S?[A]:[]:v||"full"===a?this.walkSteps(h,F,t,_,c,{level:w.level,locks:w.locks,levelOverride:E}):[];let k=v?{...function(e,t){let n=[...e.findings];for(let r of t)if(r!==e)for(let e of r.findings)"permitted"!==e.verdict&&n.push({...e,detail:`revision ${r.newer}: ${e.detail??e.rule}`});let r=oc(n,"unchanged"!==e.verdict||t.some(e=>"unchanged"!==e.verdict)),i=of(n);return{verdict:r,complete:!n.some(e=>"incomplete"===e.verdict),...i?{primary:i}:{},findings:n}}(A,p),method:"net-state+replay"}:{...(n=of(A.findings),{verdict:A.verdict,complete:!A.findings.some(e=>"incomplete"===e.verdict),...n?{primary:n}:{},findings:A.findings}),method:"net-state"};return{mode:o,policyVersion:6,basis:{version:i,editsVersion:l,source:s},since:{revisionIndex:t,signatureIndex:u},until:{revisionIndex:_},restrictions:w.anchors,current:k,later:{revisionCount:S,undoneObjectNumbers:D.filter(oE).map(e=>e.objectNumber)},verdict:k.verdict,steps:p}}finally{d.close()}}openPrefix(e,t,n,r){let i=this.runtime.fn.EPDFDoc_OpenRevision(e,BigInt(t[n].end));if(0n===i)throw new N(G.MalformedPdf,`revision ${n} does not open as a document`);return r.push(()=>this.runtime.fn.FPDF_CloseDocument(i)),i}walkSteps(e,t,n,r,i,o){let{fn:a}=this.runtime,s=[],l=this.openPrefix(e,t,n,new h8),u=i;try{for(let i=n+1;i<=r;i++){let n=i===t.length-1?e:this.openPrefix(e,t,i,new h8);try{let e=wO(this.runtime,n),{changes:t,unwritten:r,health:a}=this.compare(l,n,u,e);s.push(ow({older:i-1,newer:i,changes:t,unwritten:r,before:u,after:e,health:a,restrictions:{level:o.level,locks:o.locks},levelOverride:o.levelOverride})),u=e}finally{a.FPDF_CloseDocument(l),l=n}}}finally{l!==e&&a.FPDF_CloseDocument(l)}return s}openWorkingCopy(e){let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr();if(!this.session.hasUnsavedEdits())return{target:r,source:"loaded"};let i=new AQ(this.runtime,this.session);if("layer"===this.session.kind){let o=this.session.source.base;if(i.canWriteScratchFiles()&&o?.kind==="file"){let a=A2(o.path,"working-copy",iX(),"delta");if(e.push(()=>this.runtime.fileWrite.removeFile(a)),!i.saveLayerDeltaToFileEx(a).changedSinceLoad)return{target:r,source:"loaded"};if(0===this.runtime.fileAccess.sizeOf(a))return this.freshLayerOverBase(e);let s=h4(n,a,e=>t.EPDFDoc_OpenBaseOverlayFromPath(r,e));if(0n===s)throw new N(G.MalformedPdf,"the working copy does not compose with its base");return e.push(()=>t.FPDF_CloseDocument(s)),{target:s,source:"working-copy"}}let a=i.saveLayerDeltaEx();if(!a.changedSinceLoad)return{target:r,source:"loaded"};if(0===a.size)return this.freshLayerOverBase(e);let s=new Uint8Array(a.bytes),l=n.alloc(s.byteLength);try{n.writeBytes(l,s);let i=t.EPDFDoc_OpenBaseOverlay(r,l,s.byteLength);if(0n===i)throw new N(G.MalformedPdf,"the working copy does not compose with its base");return e.push(()=>t.FPDF_CloseDocument(i)),{target:i,source:"working-copy"}}finally{n.free(l)}}let o=i.saveStandaloneToBufferEx("incremental");if(o.unchangedSinceLoad)return{target:r,source:"loaded"};let a=h7(this.runtime,new Uint8Array(o.bytes),this.session.password);return e.push(()=>a.close()),{target:a.docPtr,source:"working-copy"}}freshLayerOverBase(e){let{fn:t,mem:n}=this.runtime,r=t.EPDFLayer_GetBaseDocument(this.session.requireDocPtr()),i=n.alloc(4);try{n.poke(i,"i32",-1);let o=t.EPDFLayer_OpenLayer(r,0n,this.session.password??"",i);if(0n===o||0!==Number(n.peek(i,"i32")))throw new N(G.MalformedPdf,"the working copy could not be opened over its base");return e.push(()=>t.FPDF_CloseDocument(o)),{target:o,source:"working-copy"}}finally{n.free(i)}}compare(e,t,n,r){let{fn:i,mem:o}=this.runtime,a=i.EPDFDoc_CompareRevisions(e,t);if(0n===a)throw new N(G.MalformedPdf,"the revisions do not share a byte history");try{let t=i.EPDFObjectDiff_GetCount(a),s=[];return h0(o,[4,4,4,4,4,4],([e,n,r,l,u,d])=>{for(let c=0;c>>0,f=Number(o.peek(l,"i32")),m=Number(o.peek(u,"i32")),p=this.readValue(a,c,0),h=this.readValue(a,c,1),F=p.truncated||h.truncated,g=null,_=null;try{g=null===p.text||p.truncated?null:oi(p.text),_=null===h.text||h.truncated?null:oi(h.text)}catch{F=!0}let P=vt[Number(o.peek(n,"i32"))]??"modified";s.push({objectNumber:t,change:P,kind:vn[Number(o.peek(r,"i32"))]??"scalar",present:{old:"added"!==P,new:"freed"!==P},generation:{old:f<0?null:f,new:m<0?null:m},value:{old:g,new:_,truncated:F},raw:{old:p.text,new:h.text},read:{old:vr[i.EPDFObjectDiff_GetReadStatus(a,c,0)]??"failed",new:vr[i.EPDFObjectDiff_GetReadStatus(a,c,1)]??"failed"},streamDataChanged:0!==Number(o.peek(d,"i32")),usage:{old:[],new:[]}})}}),{changes:this.withAnchoredUsage(a,s,n,r),unwritten:(function(e){let t=new Set([...e.before.pages,...e.after.pages]),n=new Set(e.changes.map(e=>e.objectNumber)),r=new Set;for(let i of e.changes)if(t.has(i.objectNumber))for(let e of om){let t=ol(i.value[e])?.Annots;t?.t!=="ref"||n.has(t.num)||r.add(t.num)}return[...r].sort((e,t)=>e-t)})({changes:s,before:n,after:r}).map(t=>this.readUnwritten(e,t)),health:{old:this.readHealth(a,0),new:this.readHealth(a,1)}}}finally{i.EPDFObjectDiff_Close(a)}}readHealth(e,t){let{fn:n,mem:r}=this.runtime;return h0(r,[4,4,4],([i,o,a])=>{for(let e of[i,o,a])r.poke(e,"i32",0);if(!n.EPDFObjectDiff_GetRevisionHealth(e,t,i,o,a))throw new N(G.Unknown,"failed to read revision health");return{sparseXref:0!==Number(r.peek(i,"i32")),bareReferences:Number(r.peek(o,"i32"))>>>0,referrersComplete:0!==Number(r.peek(a,"i32"))}})}withAnchoredUsage(e,t,n,r){let i=new Set(t.map(e=>e.objectNumber)),o={old:new o$(t=>this.readReferrers(e,0,t),vi(n,i)),new:new o$(t=>this.readReferrers(e,1,t),vi(r,i))};return t.map(e=>{let t=e.present.old?o.old.resolve(e.objectNumber):[],n=e.present.new?o.new.resolve(e.objectNumber):[];return{...e,usage:{old:t===oL?[]:t,new:n===oL?[]:n},...t===oL||n===oL?{usageIncomplete:!0}:{}}})}readUnwritten(e,t){let{fn:n,mem:r}=this.runtime;return h0(r,[4,4],([i,o])=>{let a=(a,s)=>(r.poke(i,"i32",-1),r.poke(o,"i32",0),n.EPDFDoc_GetLoadedObjectValue(e,t,a,s,i,o)),s=e=>({objectNumber:t,value:null,read:e}),l=a(0n,0),u=vr[Number(r.peek(i,"i32"))]??"failed",d=0!==Number(r.peek(o,"i32"));return"ok"!==u||d||l<=0?s(u):hY(r,l,e=>{let n=a(e,l);if(n<=0||0!==Number(r.peek(o,"i32")))return s(u);let i=r.readBytes(e,n-1),d="";for(let e of i)d+=String.fromCharCode(e);try{return{objectNumber:t,value:oi(d),read:u}}catch{return s(u)}})})}readValue(e,t,n){let{fn:r,mem:i}=this.runtime;return hY(i,4,o=>{i.poke(o,"i32",0);let a=r.EPDFObjectDiff_GetValue(e,t,n,0n,0,o),s=0!==Number(i.peek(o,"i32"));return a<=0?{text:null,truncated:s}:hY(i,a,s=>{i.poke(o,"i32",0);let l=r.EPDFObjectDiff_GetValue(e,t,n,s,a,o),u=0!==Number(i.peek(o,"i32"));if(l<=0)return{text:null,truncated:u};let d=i.readBytes(s,l-1),c="";for(let e of d)c+=String.fromCharCode(e);return{text:c,truncated:u}})})}readReferrers(e,t,n){let{fn:r,mem:i}=this.runtime,o=r.EPDFObjectDiff_GetReferrerCount(e,t,n),a=[];return o<=0||hY(i,4,s=>{for(let l=0;l{let u=r.EPDFObjectDiff_GetReferrer(e,t,n,l,s,a,o);if(u<=0)return"";let d=i.readBytes(a,u-1),c="";for(let e of d)c+=String.fromCharCode(e);return c});a.push({parent:Number(i.peek(s,"i32"))>>>0,label:u})}}),a}},va={certificates:0,ocspResponses:1,crls:2};function vs(e,t){let n={certificates:[],ocspResponses:[],crls:[]};for(let r of on)n[r]=function(e,t,n){let{fn:r,mem:i}=e,o=r.EPDFDss_GetCount(t,va[n]),a=[];for(let e=0;e{if(r.EPDFDss_GetData(t,va[n],e,a,o)!==o)throw new N(G.Unknown,`failed to read entry ${e} of the document\'s ${n}`);return new Uint8Array(i.readBytes(a,o))}))}return a}(e,t,r);return n}var vl=class{constructor(e,t){this.runtime=e,this.session=t}read(){return vs(this.runtime,this.session.requireDocPtr())}},vu=class{constructor(e,t){this.runtime=e,this.session=t}add(e,t){for(let n of(hW(t),on))(e[n]??[]).forEach((e,t)=>{let r=function(e){if(0===e.length)return"it is empty";if(e.length>0x1000000)return"it is larger than 16777216 bytes";if(48!==e[0])return"it is not a DER SEQUENCE";let t=or(e,0,e.length);return t?t.end!==e.length?"bytes follow the object":!function e(t,n,r,i){if(i>64)return!1;let o=n;for(;oyZ(e,n))}(r,o,a)&&(!function(e,t,n,r){let{fn:i,mem:o}=e;if(0===hY(o,r.byteLength,e=>(o.writeBytes(e,r),i.EPDFDss_Add(t,va[n],e,r.byteLength))))throw new N(G.MalformedPdf,`the document\'s security store can\'t be extended: its /DSS or its list of ${n} is not what the PDF standard says it is`)}(this.runtime,n,o,a),r[o].push(a),i[o]+=1);return{added:i,meta:{affectedPages:[],cacheDelta:null,...this.session.writeStamp()}}}},vd=class{constructor(e,t){this.runtime=e,this.baseDocuments=t}finalize(e){let[t,n,r,i]=e.byteRange,o=this.runtime.fileAccess.sizeOf(e.path);if(!e.byteRange.every(e=>Number.isSafeInteger(e)&&e>=0)||0!==t||n>=r||r+i!==o)throw new N(G.InvalidArg,`byteRange [${e.byteRange.join(" ")}] does not span a ${o}-byte candidate`);let a=r-n-2;if(!Number.isSafeInteger(e.contentsSizeBytes)||a!==2*e.contentsSizeBytes)throw new N(G.InvalidArg,`the /Contents hole holds ${a} hex digits, not the ${2*e.contentsSizeBytes} of contentsSize`);if(0===e.cms.byteLength||48!==e.cms[0])throw new N(G.SignatureRefused,"the CMS is not a DER SEQUENCE");if(e.cms.byteLength>e.contentsSizeBytes)throw new N(G.SignatureRefused,`the CMS (${e.cms.byteLength} bytes) does not fit the reserved ${e.contentsSizeBytes} bytes`);!function(e,t,n,r){let{mem:i}=e,o=e.fileAccess.readRange(t,n.holeOffset,n.hexLength+2);if(o.byteLength!==n.hexLength+2||60!==o[0]||62!==o[o.byteLength-1])throw new N(G.InvalidArg,"the byteRange gap is not a <\\u2026> /Contents hole of the candidate");let a=i.alloc(o.byteLength);try{i.writeBytes(a,o),AY(e,a,o.byteLength,n.holeOffset,{byteRange:[0,0,0,0],contentsOffset:n.holeOffset+1,contentsHexLength:n.hexLength,digest:new Uint8Array},r),e.fileWrite.writeRange(t,n.holeOffset,i.readBytes(a,o.byteLength))}finally{i.free(a)}}(this.runtime,e.path,{holeOffset:n,hexLength:a},e.cms);let s=new Fu(this.runtime),l=this.baseDocuments.acquireFileBase({key:`finalize:${iX()}`,path:e.path,password:e.password});try{s.openFromHandle(h9(this.runtime,l,{kind:"fresh"},e.password));let t=wN(this.runtime,s);A6(this.runtime,s.requireDocPtr(),t,{fieldObjectNumber:e.fieldObjectNumber,byteRange:e.byteRange,cms:e.cms});let n=new wR(this.runtime,s),r=n.readSnapshot();return{signature:r.signatures.find(t=>"objectNumber"===t.field.kind&&t.field.objectNumber===e.fieldObjectNumber),protection:r.protection,version:n.version(),lastObjectNumber:s.lastObjectNumber()}}finally{s.close()}}},vc=class{constructor(e,t,n){this.runtime=e,this.session=t,this.fonts=n}export(e,t,n){hW(n);let{fields:r,widgets:i,calculationOrder:o}=function(e,t,n){let r=new Set;for(let n of t.fields??[]){let t=e.fields.find(e=>ae(e,n));if(!t)throw new N(G.NotFound,`export: the form has no field ${"fqn"===n.kind?n.name:eM(n)}`);r.add(t)}let i=new Set(n.map(H)),o=new Set;for(let e of t.pages??[]){if(!i.has(H(e)))throw new N(G.NotFound,`export: the document has no page ${H(e)}`);o.add(H(e))}for(let t of e.fields)t.widgets.some(e=>e.page&&o.has(H(e.page)))&&r.add(t);let a=!t.fields&&!t.pages,s=e.fields.filter(e=>a||r.has(e)),l=new Map(e.widgets.map(e=>[K(e.ref),e])),u=s.flatMap(e=>e.widgets.flatMap(e=>{let t=e.ref?l.get(K(e.ref)):void 0;return t?[t]:[]})),d=new Set(s.map(e=>eM(e.ref))),c=e.calculationOrder.filter(e=>null!==e&&d.has(eM(e)));return{fields:s.map(at),widgets:u,calculationOrder:c}}(i8(new wW(this.runtime,this.session,this.fonts).snapshot(n),gF(this.runtime,this.session)),e,this.session.allRecords().map(e=>q(e.pageObjectNumber)));nC("form",t,"items",r.length+i.length);let a=new vf(this.runtime,this.session,t),s=new Set(r.flatMap(e=>"pushbutton"!==e.kind||e.hasImage?[]:e.widgets.flatMap(e=>e.ref?[K(e.ref)]:[]))),l={pages:yk(this.runtime,this.session,i),fields:r.map(e=>({data:e})),widgets:i.map(e=>({data:e,resources:s.has(K(e.ref))?{}:a.of(e)})),calculationOrder:o};nC("form",t,"pages",l.pages.length);let u=nN(l);return nC("form",t,"manifestBytes",u),nC("form",t,"bundleBytes",u+a.totalBytes),{format:"embedpdf/form",version:1,...l,resources:a.byId}}},vf=class extends yx{constructor(e,t,n){super(e,"form",n),this.session=t,hJ(this,"drawings",new Map)}of(e){let t;if("pushbutton"!==e.fieldKind)return{};let n=PV(this.runtime,this.session,e.ref);if(0===n)return{};let r=this.drawings.get(n);if(r)return{image:r};let i=gj(this.runtime,this.session,e.ref);try{t=yA(this.runtime,this.session.requireDocPtr(),i,n)}finally{this.runtime.fn.FPDFPage_CloseAnnot(i)}if(!t)return{};let o=this.keep(t);return this.drawings.set(n,o),{image:o}}},vm=new WeakMap;async function vp(e,t,n,r,i){let o=t.cacheSeq(),a=vm.get(t);a||(a=new Map,vm.set(t,a));let s=a.get(n);if(s&&s.seq===o)return s;let l=await new gL(e,t).read(n,r,i),u={seq:o,folded:rp(l.text),snapshot:l};if(a.delete(n),a.set(n,u),a.size>512){let e=a.keys().next().value;void 0!==e&&a.delete(e)}return u}var vh=class{constructor(e,t){this.runtime=e,this.session=t}async query(e,t,n){hW(t);let r={text:e.text,...e.regex?{regex:!0}:{},...e.matchCase?{matchCase:!0}:{},...e.wholeWord?{wholeWord:!0}:{},...e.matchDiacritics?{matchDiacritics:!0}:{},...e.ignoreWhitespace?{ignoreWhitespace:!0}:{}},i=e.snippets??!1,o=rG(r);if(!o.ok)throw new N(G.InvalidArg,`invalid search query (${o.issue}): ${o.message}`);let a=this.session.allRecords(),s=a.length;if(!r.regex&&0===rp(r.text).folded.trim().length)return{matches:[],nextCursor:null,pagesSearched:0,pageCount:s};let l=this.session.cacheSeq(),u=JSON.stringify([r.regex?"r":"l",r.text,+!!r.matchCase,+!!r.matchDiacritics,+!!r.wholeWord,+!!r.ignoreWhitespace,i?"snippets":"matches"]),d=0,c=0;if(void 0!==e.cursor){let t=function(e,t,n,r){let i;try{i=JSON.parse(t)}catch{throw new N(G.InvalidArg,"malformed search cursor")}if(i?.v!==1||"number"!=typeof i.scanned||"string"!=typeof i.key)throw new N(G.InvalidArg,"malformed search cursor");if(i.key!==r)throw new N(G.InvalidArg,"search cursor belongs to a different query \\u2014 restart the search");if(i.seq!==n)throw new N(G.InvalidArg,"document changed since this search cursor was issued \\u2014 restart the search",{details:{cursorSeq:i.seq,currentSeq:n}});if(void 0!==e.from&&e.from.objectNumber!==i.start)throw new N(G.InvalidArg,"`from` conflicts with the cursor \\u2014 omit it when resuming");return i}(e,e.cursor,l,u);d=t.start,c=t.scanned}else void 0!==e.from&&(d=this.session.resolvePageRef(e.from).pageObjectNumber),void 0!==e.skip&&(c=Math.min(Math.max(0,Math.floor(e.skip)),s));let f=a;if(0!==d){let e=a.findIndex(e=>e.pageObjectNumber===d);f=a.slice(e).concat(a.slice(0,e))}let m=vF(e.limit?.pages,64,256),p=vF(e.limit?.matches,256,1024),h=[],F=0,g=new g$(n,t);for(;c=55296&&t<=56319?2:1;continue}t.wholeWord&&(rS(e,n.index)||rk(e,n.index+n[0].length))||o.push({start:n.index,count:n[0].length})}return o}(s,r):r.matchCase||r.matchDiacritics||r.ignoreWhitespace?rx(rp(s,rE(r)),r):rx(a.folded,r)).length>0){let r=function(e){let t=function(e){let t=[],n=[],r=[n9];for(let i of e.runs){if(!nS(i)){for(let e of i.glyphs)t.push({loose:e.loose,tight:e.tight,space:e.space,empty:e.empty});n.push({start:i.start,count:i.glyphs.length,rect:i.rect,fontSize:i.fontSize,frame:0});continue}let e=function(e,t){let n=t.glyphs.find(e=>!n7(e));if(!n)return 0;let r=n.loose,i=r.upperRight.x-r.upperLeft.x,o=r.upperRight.y-r.upperLeft.y,a=Math.hypot(i,o);if(a<=1e-6)return 0;let s={x:i/a,y:o/a},l=r.upperLeft.x-r.lowerLeft.x,u=r.upperLeft.y-r.lowerLeft.y,d=s.x*u-s.y*l>=0?1:-1,c={x:-s.y*d,y:s.x*d};for(let t=0;t0;if(r>=.9999621552387067&&i)return t}return e.push({baseline:s,ascent:c}),e.length-1}(r,i),o=r[e],a=null;for(let e of i.glyphs){if(n7(e)){t.push({loose:rn,space:e.space,empty:!0});continue}let n=rr(o,e.loose),r=e.tight?rr(o,e.tight):void 0;t.push({loose:n,tight:r,space:e.space}),a=a?{left:Math.min(a.left,n.left),bottom:Math.min(a.bottom,n.bottom),right:Math.max(a.right,n.right),top:Math.max(a.top,n.top)}:n}n.push({start:i.start,count:i.glyphs.length,rect:a??rn,fontSize:i.fontSize,frame:e})}return{glyphs:t,runs:n,frames:r}}(e),n=t.glyphs.length,r=e=>"number"!=typeof e?ro(t,e):Number.isInteger(e)&&e>=0&&e({start:e,count:t-e+1});return{charCount:n,runs:e.runs,charAt:e=>ro(t,e),wordAt:e=>{let n=r(e);return null===n?null:i(function(e,t){let n=e.glyphs.length;if(t<0||t>=n)return[t,t];let r=t;for(;r>0&&!n8(e.glyphs[r-1]);)r--;let i=t;for(;i{let n=r(e);return null===n?null:i(function(e,t){let n=e.runs.findIndex(e=>t>=e.start&&t=0;t--){let n=e.runs[t];if(!rs(n.rect)){if(n.frame!==r.frame||!rl(n.rect.bottom,n.rect.top,i,o))break;a=n.start}}for(let t=n+1;t(function(e,t,n){if(n<=0||0===e.glyphs.length)return[];let r=Math.max(0,t),i=Math.min(e.glyphs.length-1,t+n-1);if(ii)continue;let a=Math.max(r,t.start),s=Math.min(i,n),l=1/0,u=-1/0,d=1/0,c=-1/0,f=0,m=0,p=-1/0,h=0,F=0,g=()=>{f>0&&1/0!==l&&o.push({rect:{left:l,bottom:d,right:u,top:c},charCount:f,fontSize:t.fontSize,frame:t.frame,firstX:h,lastX:F}),l=1/0,u=-1/0,d=1/0,c=-1/0,f=0,m=0,p=-1/0};for(let t=a;t<=s;t++){let n=e.glyphs[t];if(n7(n))continue;let r=n.loose;if(f>0&&p>-1/0){let e=m/f;e>0&&Math.abs(r.left-p)>2.5*e&&g()}let i=(r.left+r.right)/2;0===f&&(h=i),F=i,l=Math.min(l,r.left),u=Math.max(u,r.right),d=Math.min(d,r.bottom),c=Math.max(c,r.top),f++,m+=r.right-r.left,p=r.right}g()}return(function(e){let t=[],n=null,r=null;for(let i of e)n&&r&&n.frame===i.frame&&function(e,t){if(null!=e.fontSize&&null!=t.fontSize&&e.fontSize>0&&t.fontSize>0&&Math.max(e.fontSize,t.fontSize)/Math.min(e.fontSize,t.fontSize)>1.5||.8>function(e,t){let n=e.top-e.bottom,r=t.top-t.bottom;if(n<=0||r<=0)return 0;let i=Math.max(e.top,t.top)-Math.min(e.bottom,t.bottom);return i===n||i===r?1:Math.max(0,Math.min(e.top,t.top)-Math.max(e.bottom,t.bottom))/i}(e.rect,t.rect))return!1;let n=(e.rect.right-e.rect.left)/e.charCount,r=(t.rect.right-t.rect.left)/t.charCount,i=e.rect.left-n,o=e.rect.right+n,a=t.rect.left-r;return ia}(n,i)?r={rect:{left:Math.min(r.rect.left,i.rect.left),bottom:Math.min(r.rect.bottom,i.rect.bottom),right:Math.max(r.rect.right,i.rect.right),top:Math.max(r.rect.top,i.rect.top)},frame:r.frame,firstX:r.firstX,lastX:i.lastX}:(r&&t.push(r),r={rect:i.rect,frame:i.frame,firstX:i.firstX,lastX:i.lastX}),n=i;return r&&r.rect.right>r.rect.left&&r.rect.top>r.rect.bottom&&t.push(r),t})(o).map(t=>(function(e,t){let n=ra(e.frames[t.frame],t.frame,t.rect);return{quad:n,rect:0===t.frame?t.rect:{left:Math.min(n.upperLeft.x,n.upperRight.x,n.lowerLeft.x,n.lowerRight.x),bottom:Math.min(n.upperLeft.y,n.upperRight.y,n.lowerLeft.y,n.lowerRight.y),right:Math.max(n.upperLeft.x,n.upperRight.x,n.lowerLeft.x,n.lowerRight.x),top:Math.max(n.upperLeft.y,n.upperRight.y,n.lowerLeft.y,n.lowerRight.y)},advance:t.lastX>=t.firstX?1:-1}})(e,t))})(t,e.start,e.count),charQuad:e=>(function(e,t){let n=e.glyphs[t];if(!n||n7(n))return null;let r=n.loose;if(r.right<=r.left||r.top<=r.bottom)return null;let i=e.runs.find(e=>t>=e.start&&t0){for(let n=i;n=r;t--)if(oW.test(e[t])){o=t;break}oH(e,o)&&o--}let a=(t,n)=>e.slice(t,n).replace(oq," ");return{before:a(i,t.start),match:a(t.start,r),after:a(r,o)}}(s,t)}:{}})}}c++,F++}return{matches:h,nextCursor:ct.FPDFJavaScriptAction_GetName(l,e,n))??""}finally{t.FPDFDoc_CloseJavaScriptAction(l)}i.reservePayloadBytes(o.length);let u=function(e,t,n){if(e)return e;throw new N(G.MalformedPdf,`failed to read ${t}`,{details:{index:n}})}(F8(t,n,r,t.EPDFDoc_GetNamedJavaScriptActionModel(r,s),i),"name-tree script",s);a.push({name:o,action:u})}let s=F8(t,n,r,t.EPDFDoc_GetOpenActionModel(r),i),l=s?0n:t.EPDFDoc_GetOpenActionDest(r),u=0n!==l?F2(t,n,r,l):null,d={};for(let[o,a]of vg){hW(e);let s=F8(t,n,r,t.EPDFDoc_GetAdditionalActionModel(r,a),i);s&&(d[o]=s)}return{nameTreeScripts:a,openAction:s,openDestination:u,...d}}};function vP(e,t){var n;let{target:r,...i}=e;return r?{...i,target:"rect"===r.kind?(n=t(),"rect"===r.kind?{...r,rect:nA(r.rect,n)}:r):r}:i}function vD(e,t,n){return n4({...e,subtype:"widget"},t,n)}var vb=class{constructor(e,t=0x8000000){this.runtime=e,this.budgetBytes=t,hJ(this,"enabled",void 0),hJ(this,"on",!1),this.enabled=t>0&&"function"==typeof e.fn.EPDF_SetDecodedImageBudget}beginJob(e){this.enabled&&e!==this.on&&(this.runtime.fn.EPDF_SetDecodedImageBudget(e?this.budgetBytes:0),this.on=e)}},vy=class{constructor(e,t){this.runtime=e,this.session=t}viewports(e,t){hW(t);let n=this.session.recordByObjectNumber(e).pageIndex;return gl(this.runtime.fn,this.runtime.mem,this.session.requireDocPtr(),n)}},vw=class{constructor(e,t,n){this.runtime=e,this.session=t,this.pageObjectNumber=n,void 0!==n&&t.recordByObjectNumber(n)}read(e,t){hW(t),vE(e);let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=this.pageObjectNumber;if(!(void 0===o?n.EPDFDoc_HasPieceInfoEntry(i,e):n.EPDFDoc_HasPagePieceInfoEntry(i,o,e)))return null;let a=void 0===o?n.EPDFDoc_GetPieceInfoKeyCount(i,e):n.EPDFDoc_GetPagePieceInfoKeyCount(i,o,e),s={};for(let l=0;lvoid 0===o?n.EPDFDoc_GetPieceInfoKeyAt(i,e,l,t,r):n.EPDFDoc_GetPagePieceInfoKeyAt(i,o,e,l,t,r));null!==a&&(s[a]=this.readEntry(e,a))}let l=h3(r,(t,r)=>void 0===o?n.EPDFDoc_GetPieceInfoLastModified(i,e,t,r):n.EPDFDoc_GetPagePieceInfoLastModified(i,o,e,t,r),null);return{entries:s,modifiedAt:l?hq(l):null}}update(e,t,n){hW(n),vE(e),function(e){if("object"!=typeof e||null===e||Array.isArray(e))throw new N(G.InvalidArg,"pieceInfo patch must be an object")}(t);let r=Object.keys(t);if(0===r.length)return;(function(e,t){for(let n of t){if(0===n.length)throw new N(G.InvalidArg,"pieceInfo keys must be non-empty");!function(e,t){if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t){if("number"==typeof t){if(!Number.isFinite(t))throw new N(G.InvalidArg,`pieceInfo number for \'${e}\' must be finite`);return}if(Array.isArray(t)){if(!t.every(e=>"string"==typeof e))throw new N(G.InvalidArg,`pieceInfo string array for \'${e}\' must contain only strings`);return}if("object"==typeof t&&null!==t&&"name"in t){if("string"!=typeof t.name||0===t.name.length)throw new N(G.InvalidArg,`pieceInfo PDF name for \'${e}\' must be a non-empty string`);return}throw new N(G.InvalidArg,`unsupported pieceInfo value for \'${e}\': string | number | boolean | string[] | { name } | null`)}}(n,e[n])}})(t,r),hW(n);let{mem:i}=this.runtime,o=hH(new Date),a=i.writeU16String(o);try{for(let n of r){let r=t[n];if(!this.writeEntry(e,n,r,a))throw new N(G.Unknown,`pieceInfo write rejected for key \'${n}\' after validation`)}}finally{i.free(a)}}applications(e){hW(e);let{fn:t,mem:n}=this.runtime,r=this.session.requireDocPtr(),i=this.pageObjectNumber,o=void 0===i?t.EPDFDoc_GetPieceInfoEntryCount(r):t.EPDFDoc_GetPagePieceInfoEntryCount(r,i),a=[];for(let e=0;evoid 0===i?t.EPDFDoc_GetPieceInfoEntryAt(r,e,n,o):t.EPDFDoc_GetPagePieceInfoEntryAt(r,i,e,n,o));null!==o&&a.push(o)}return a}delete(e,t){hW(t),vE(e);let{fn:n}=this.runtime,r=this.session.requireDocPtr(),i=this.pageObjectNumber;if(!(void 0===i?n.EPDFDoc_ClearPieceInfoEntry(r,e):n.EPDFDoc_ClearPagePieceInfoEntry(r,i,e)))throw new N(G.Unknown,`pieceInfo delete rejected for application \'${e}\'`)}readEntry(e,t){let{fn:n,mem:r}=this.runtime,i=this.session.requireDocPtr(),o=this.pageObjectNumber;switch(void 0===o?n.EPDFDoc_GetPieceInfoValueType(i,e,t):n.EPDFDoc_GetPagePieceInfoValueType(i,o,e,t)){case 3:{let a=h3(r,(r,a)=>void 0===o?n.EPDFDoc_GetPieceInfoString(i,e,t,r,a):n.EPDFDoc_GetPagePieceInfoString(i,o,e,t,r,a),"");return null===a?{type:"unknown"}:{type:"string",value:a}}case 4:{let a=h2(r,(r,a)=>void 0===o?n.EPDFDoc_GetPieceInfoName(i,e,t,r,a):n.EPDFDoc_GetPagePieceInfoName(i,o,e,t,r,a));return null===a?{type:"unknown"}:{type:"name",value:a}}case 2:{let a=r.alloc(4);try{if(!(void 0===o?n.EPDFDoc_GetPieceInfoNumber(i,e,t,a):n.EPDFDoc_GetPagePieceInfoNumber(i,o,e,t,a)))return{type:"unknown"};return{type:"number",value:Number(r.peek(a,"f32"))}}finally{r.free(a)}}case 1:{let a=r.alloc(4);try{if(!(void 0===o?n.EPDFDoc_GetPieceInfoBoolean(i,e,t,a):n.EPDFDoc_GetPagePieceInfoBoolean(i,o,e,t,a)))return{type:"unknown"};return{type:"boolean",value:0!==Number(r.peek(a,"i32"))}}finally{r.free(a)}}case 5:{let a=void 0===o?n.EPDFDoc_GetPieceInfoStringArrayCount(i,e,t):n.EPDFDoc_GetPagePieceInfoStringArrayCount(i,o,e,t);if(a<0)return{type:"unknown"};let s=[];for(let l=0;lvoid 0===o?n.EPDFDoc_GetPieceInfoStringArrayAt(i,e,t,l,r,a):n.EPDFDoc_GetPagePieceInfoStringArrayAt(i,o,e,t,l,r,a),"");if(null===a)return{type:"unknown"};s.push(a)}return{type:"string-array",value:s}}default:return{type:"unknown"}}}writeEntry(e,t,n,r){let{fn:i,mem:o}=this.runtime,a=this.session.requireDocPtr(),s=this.pageObjectNumber;if(null===n)return void 0===s?i.EPDFDoc_ClearPieceInfoKey(a,e,t,r):i.EPDFDoc_ClearPagePieceInfoKey(a,s,e,t,r);if("string"==typeof n)return h6(o,n,n=>void 0===s?i.EPDFDoc_SetPieceInfoString(a,e,t,n,r):i.EPDFDoc_SetPagePieceInfoString(a,s,e,t,n,r));if("number"==typeof n)return void 0===s?i.EPDFDoc_SetPieceInfoNumber(a,e,t,n,r):i.EPDFDoc_SetPagePieceInfoNumber(a,s,e,t,n,r);if("boolean"==typeof n)return void 0===s?i.EPDFDoc_SetPieceInfoBoolean(a,e,t,n,r):i.EPDFDoc_SetPagePieceInfoBoolean(a,s,e,t,n,r);if(Array.isArray(n))return gf(this.runtime,n,(n,o)=>void 0===s?i.EPDFDoc_SetPieceInfoStringArray(a,e,t,n,o,r):i.EPDFDoc_SetPagePieceInfoStringArray(a,s,e,t,n,o,r));if("object"==typeof n&&null!==n&&"name"in n)return void 0===s?i.EPDFDoc_SetPieceInfoName(a,e,t,n.name,r):i.EPDFDoc_SetPagePieceInfoName(a,s,e,t,n.name,r);throw new N(G.Unknown,`unvalidated pieceInfo value for \'${t}\'`)}};function vE(e){if("string"!=typeof e||0===e.length)throw new N(G.InvalidArg,"pieceInfo application must be non-empty")}function vA(e){return"pages.render"===e.kind||"pages.renderEncoded"===e.kind||"document.renderPageFile"===e.kind||"document.renderPageFileEncoded"===e.kind}var vv=class{constructor(e,t,n={}){this.runtime=e,this.post=t,this.options=n,hJ(this,"sessions",new Map),hJ(this,"baseDocuments",void 0),hJ(this,"aborts",new Map),hJ(this,"fontIds",new Map),hJ(this,"fonts",void 0),hJ(this,"residency",void 0),hJ(this,"decodedImages",void 0),hJ(this,"slices",void 0),hJ(this,"busy",!1),hJ(this,"held",[]),hJ(this,"destroyed",!1),hV(this.runtime),this.baseDocuments=new Fp(this.runtime),this.fonts=new y_(this.runtime,this.fontIds),this.residency=new Fo(this.runtime,{...Fr,budgetBytes:this.options.parsedPageBudgetBytes??Fr.budgetBytes},()=>this.busy),this.decodedImages=new vb(this.runtime,this.options.decodedImageBudgetBytes),this.slices={budgetMs:this.options.sliceMs??8,between:function(){if("function"==typeof setImmediate)return()=>new Promise(e=>setImmediate(e));if("function"==typeof MessageChannel){let e=new MessageChannel,t=[];return e.port1.onmessage=()=>t.shift()?.(),()=>new Promise(n=>{t.push(n),e.port2.postMessage(null)})}return()=>new Promise(e=>setTimeout(e,0))}()}}registerStartupFonts(e){this.fonts.registerStartup(e)}receive(e){"abort"===e.kind?this.abort(e.jobId):"pages.workingSet"===e.kind?this.setWorkingSet(e):this.busy||this.held.length>0?this.held.push(e):this.run(e)}setWorkingSet(e){let t=this.sessions.get(vN(e.docId,e.layerName));t?.isOpen()&&t.pagePool().setWorkingSet(e.view,e.pages.map(({page:e,role:t,pixels:n})=>({pageObjectNumber:e.objectNumber,role:t,pixels:n})))}abort(e){let t=this.held.findIndex(t=>t.jobId===e);if(t<0)return void this.aborts.get(e)?.abort();this.held.splice(t,1);let n=C(new ns("aborted before it ran"));this.post(aC({kind:"reject",jobId:e,error:n},aN))}drain(){for(;!this.busy;){let e=this.takeHeld();if(!e)return;this.run(e)}}takeHeld(){let e=this.held[0];if(!e||!vA(e))return this.held.shift();let t=0,n=e;for(let e=1;et(e.page))}:r}(e,t)}}(e,this.visibleBoxesFor(e))}catch(t){this.post(aC({kind:"reject",jobId:e.jobId,error:C(t)},aN));return}let o=this.slicedWork(n);if(o)return void this.runSliced(e,n,i,o);let a=new AbortController;this.aborts.set(n.jobId,a);let s=this.transactedSession(n);try{if(this.assertNoPendingSigning(n),this.options.reportEveryFontChange){let e=this.sessionWrittenBy(n);e&&ym(this.runtime,e)}switch(s&&vO(n)&&s.beginTransaction(n.opId),this.writingSession(n)?.clearMissingCharacters(),s&&"objectNumberFloor"in n&&void 0!==n.objectNumberFloor&&s.raiseLastObjectNumber(n.objectNumberFloor-1),n.kind){case"open.fatMem":case"open.layerMemBase":case"open.layerFileBase":r=this.handleOpen(n);break;case"metadata.read":r=this.handleMetadataRead(n,a.signal);break;case"metadata.update":r=this.handleMetadataUpdate(n,a.signal);break;case"metadata.readCustom":r=this.handleMetadataReadCustom(n,a.signal);break;case"metadata.updateCustom":r=this.handleMetadataUpdateCustom(n,a.signal);break;case"actions.read":r=this.handleActionsRead(n,a.signal);break;case"outline.read":r=this.handleOutlineRead(n,a.signal);break;case"annotations.list":r=this.handleAnnotationsList(n,a.signal);break;case"annotations.create":r=this.handleAnnotationsCreate(n,a.signal);break;case"annotations.update":r=this.handleAnnotationsUpdate(n,a.signal);break;case"annotations.delete":r=this.handleAnnotationsDelete(n,a.signal);break;case"annotations.reorder":r=this.handleAnnotationsReorder(n,a.signal);break;case"document.apply":r=this.handleDocumentApply(n,a.signal);break;case"document.applyChanges":r=this.handleDocumentApplyChanges(n,a.signal);break;case"signatures.list":r=this.handleSignaturesList(n);break;case"signatures.contents":r=this.handleSignaturesContents(n);break;case"signatures.digest":r=this.handleSignaturesDigest(n);break;case"signatures.revisionBytes":r=this.handleSignaturesRevisionBytes(n);break;case"document.version":r=this.handleDocumentVersion(n);break;case"signatures.prepare":r=this.handleSignaturesPrepare(n);break;case"signatures.complete":r=this.handleSignaturesComplete(n);break;case"signatures.cancel":r=this.handleSignaturesCancel(n);break;case"signatures.validationInfo":r=this.handleSignaturesValidationInfo(n);break;case"signatures.addValidationInfo":r=this.handleSignaturesAddValidationInfo(n,a.signal);break;case"signatures.analyze":r=this.handleSignaturesAnalyze(n);break;case"signatures.finalizeCandidate":r=this.handleSignaturesFinalizeCandidate(n);break;case"forms.list":r=this.handleFormsList(n,a.signal);break;case"forms.setValue":r=this.handleFormsSetValue(n,a.signal);break;case"forms.reset":r=this.handleFormsReset(n,a.signal);break;case"forms.export":r=this.handleFormsExport(n,a.signal);break;case"forms.import":r=this.handleFormsImport(n,a.signal);break;case"forms.importValues":r=this.handleFormsImportValues(n,a.signal);break;case"forms.repair":r=this.handleFormsRepair(n,a.signal);break;case"forms.createField":r=this.handleFormsCreateField(n,a.signal);break;case"forms.updateField":r=this.handleFormsUpdateField(n,a.signal);break;case"forms.setSignatureAppearance":r=this.handleFormsSetSignatureAppearance(n,a.signal);break;case"forms.deleteField":r=this.handleFormsDeleteField(n,a.signal);break;case"forms.addWidget":r=this.handleFormsAddWidget(n,a.signal);break;case"forms.detachWidget":r=this.handleFormsDetachWidget(n,a.signal);break;case"forms.updateWidget":r=this.handleFormsUpdateWidget(n,a.signal);break;case"forms.deleteWidget":r=this.handleFormsDeleteWidget(n,a.signal);break;case"forms.reorderWidgets":r=this.handleFormsReorderWidgets(n,a.signal);break;case"forms.reorderCalculations":r=this.handleFormsReorderCalculations(n,a.signal);break;case"pages.list":r=this.handlePagesList(n,a.signal);break;case"pages.setName":r=this.handlePagesSetName(n,a.signal);break;case"annotations.flatten":r=this.handleAnnotationsFlatten(n,a.signal);break;case"annotations.exportAppearance":r=this.handleAnnotationsExportAppearance(n,a.signal);break;case"annotations.readAppearance":r=this.handleAnnotationsReadAppearance(n,a.signal);break;case"annotations.export":r=this.handleAnnotationsExport(n,a.signal);break;case"annotations.import":r=this.handleAnnotationsImport(n,a.signal);break;case"pages.removeName":r=this.handlePagesRemoveName(n,a.signal);break;case"pages.flatten":r=this.handlePagesFlatten(n,a.signal);break;case"redaction.apply":r=this.handleRedactionApply(n,a.signal);break;case"pages.extract":r=this.handlePagesExtract(n,a.signal);break;case"attachments.list":r=this.handleAttachmentsList(n,a.signal);break;case"attachments.readFile":r=this.handleAttachmentsReadFile(n,a.signal);break;case"measure.setScale":r=this.handleMeasureSetScale(n,a.signal);break;case"pieceInfo.read":r=this.handlePieceInfoRead(n,a.signal);break;case"pieceInfo.update":r=this.handlePieceInfoUpdate(n,a.signal);break;case"pieceInfo.applications":r=this.handlePieceInfoApplications(n,a.signal);break;case"pieceInfo.delete":r=this.handlePieceInfoDelete(n,a.signal);break;case"document.saveBuffer":r=this.handleDocumentSaveBuffer(n);break;case"document.saveLayerBuffer":r=this.handleDocumentSaveLayerBuffer(n);break;case"document.saveFile":r=this.handleDocumentSaveFile(n);break;case"document.probeSecurityFile":r=this.handleDocumentProbeSecurityFile(n);break;case"document.checkPasswordPermissions":r=this.handleDocumentCheckPasswordPermissions(n);break;case"fonts.register":r=this.handleFontsRegister(n);break;case"fonts.addFallback":r=this.handleFontsAddFallback(n);break;case"fonts.clearFallbacks":r=this.handleFontsClearFallbacks(n);break;case"fonts.clear":r=this.handleFontsClear(n);break;case"fonts.authorizeEditing":r=this.handleFontsAuthorizeEditing(n);break;case"fonts.list":r=aC({tag:"fonts.list",engineFonts:this.fonts.engineFontFacts(),fallbacks:this.fonts.fallbackKeys()});break;case"fonts.program":r=this.handleFontsProgram(n);break;case"document.setFontSettings":r=this.handleDocumentSetFontSettings(n);break;case"document.fonts.list":r=this.handleDocumentFontsList(n);break;case"document.fonts.resolve":r=this.handleDocumentFontsResolve(n);break;case"document.fonts.program":r=this.handleDocumentFontsProgram(n);break;case"objectNumbers.reserve":r=aC({tag:"objectNumbers.reserve",range:this.requireSession(n).reserveObjectNumbers(n.count)});break;case"layer.close":r=this.handleLayerClose(n);break;case"close":r=this.handleClose(n);break;case"shutdown":r=this.handleShutdown(n);break;default:throw new N(G.InvalidArg,`unknown request kind: ${n.kind}`)}s?.inTransaction()&&s.commitTransaction(),this.resolve(n,r)}catch(t){s?.inTransaction()&&s.abortTransaction();let e=C(t);this.post(aC({kind:"reject",jobId:n.jobId,error:e},aN))}finally{this.aborts.delete(n.jobId),this.closePagesChangedBy(e,i)}}writingSession(e){if(!vO(e)||!("docId"in e))return;let t="layerName"in e?e.layerName:void 0,n=this.sessions.get(vN(e.docId,t));return n?.isOpen()?n:void 0}sessionWrittenBy(e){if(!("docId"in e)||"write"!==e.effect&&"contentWrite"!==e.effect)return;let t="layerName"in e?e.layerName:void 0,n=this.sessions.get(vN(e.docId,t));return n?.isOpen()?n:void 0}transactedSession(e){if(!vO(e))return;let t="layerName"in e?e.layerName:void 0,n=this.sessions.get(vN(e.docId,t));if(n?.isOpen()&&"layer"===n.kind)return n.assertUsable(),n}closePagesChangedBy(e,t){if("runtime"===t)return void this.residency.closeIdle();if("document"!==t||!("docId"in e))return;let n="layerName"in e?e.layerName:void 0;this.sessions.get(vN(e.docId,n))?.pagePool().closeIdle()}resolve(e,t){let n=function(e,t){var n,r,i,o;let a=e=>n6(e,t(e.page),t),s=e=>e.map(e=>i4(e,t));switch(e.tag){case"pages.list":return{...e,snapshot:i1(e.snapshot)};case"pages.setName":case"pages.removeName":case"measure.setScale":return{...e,result:{...e.result,layout:i1(e.result.layout)}};case"pages.geometry":return{...e,snapshot:(n=e.snapshot,r=t(e.page),{...n,runs:n.runs.map(e=>{let t=e.glyphs.some(e=>!e.empty)?nE(e.rect,r):ru;return nS(e)?{...e,rect:t,glyphs:e.glyphs.map(({loose:e,tight:t,...n})=>({...n,loose:n.empty?rd:nv(e,r),...t?{tight:nv(t,r)}:{}}))}:{...e,rect:t,glyphs:e.glyphs.map(({loose:e,tight:t,...n})=>({...n,loose:n.empty?ru:nE(e,r),...t?{tight:nE(t,r)}:{}}))}})})};case"pages.render":return{...e,area:nE(e.area,t(e.page))};case"search.query":return{...e,slice:(i=e.slice,{...i,matches:i.matches.map(e=>{let n=t(e.page);return{...e,segments:e.segments.map(e=>({...e,quad:nv(e.quad,n),rect:nE(e.rect,n)}))}})})};case"annotations.renderAppearances":{let n=i3(e.result.appearances,t(e.page));return{...e,result:{...e.result,appearances:n}}}case"annotations.renderAppearancesEncoded":{let n=i3(e.result.appearances,t(e.page));return{...e,result:{...e.result,appearances:n}}}case"actions.read":return{...e,snapshot:function(e,t){let{nameTreeScripts:n,openAction:r,openDestination:i,...o}=e;return{...nJ(o,t),nameTreeScripts:n.map(e=>({...e,action:nK(e.action,t)})),openAction:r?nK(r,t):null,..."openDestination"in e?{openDestination:i?t(i):i}:{}}}(e.snapshot,e=>nW(e,t))};case"outline.read":return{...e,outline:(o=e.outline,{...o,items:o.items.map(e=>i9(e,t))})};case"annotations.list":return{...e,list:{...e.list,annotations:e.list.annotations.map(a)}};case"annotations.create":case"annotations.update":return{...e,result:{...e.result,annotation:a(e.result.annotation)}};case"document.apply":case"document.applyChanges":default:return e;case"annotations.import":return{...e,result:{...e.result,annotations:e.result.annotations.map(a)}};case"measure.viewports":return{...e,viewports:n0(e.viewports,t(e.page))};case"forms.list":return{...e,snapshot:i8(e.snapshot,t)};case"forms.import":return{...e,result:{...e.result,fields:e.result.fields.map(e=>i5(e,t)),widgets:s(e.result.widgets)}};case"forms.importValues":return{...e,result:{...e.result,fields:e.result.fields.map(e=>i5(e,t)),widgets:s(e.result.widgets)}};case"forms.setValue":case"forms.createField":case"forms.updateField":case"forms.setSignatureAppearance":case"forms.addWidget":case"forms.detachWidget":return{...e,result:{...e.result,field:i5(e.result.field,t),widgets:s(e.result.widgets)}};case"forms.reset":return{...e,result:{...e.result,fields:e.result.fields.map(e=>i5(e,t)),widgets:s(e.result.widgets)}};case"forms.updateWidget":return{...e,result:{...e.result,widget:i4(e.result.widget,t)}};case"forms.deleteWidget":return{...e,result:{...e.result,field:e.result.field&&i5(e.result.field,t)}}}}(t.payload,this.visibleBoxesFor(e));this.post(aC({kind:"resolve",jobId:e.jobId,result:n},t.transfer))}visibleBoxesFor(e){let t=null;return n=>{if(!("docId"in e))throw new N(G.InvalidArg,`${e.kind} has no document`);return t??(t=gF(this.runtime,this.requireSession(e))),t(n)}}handleOpen(e){let t,n=vN(e.docId,"open.fatMem"===e.kind?void 0:e.layerName);if(this.sessions.has(n))throw new N(G.InvalidArg,`document session already open: ${n}`);let r=new Fu(this.runtime);if(r.residency=this.residency,r.signedDocumentPolicy=e.signedDocumentPolicy??"protect",r.password=e.password,r.objectNumberAuthority=e.objectNumbers??"session","open.fatMem"===e.kind){let n=new Uint8Array(e.bytes);t=e=>this.openBytesAsLayer(r,n,e)}else if("open.layerMemBase"===e.kind){let n=new Uint8Array(e.baseBytes);t=t=>{let i=this.baseDocuments.acquireMemoryBase({key:e.baseKey,bytes:n,password:t,knownSha256:e.baseSha256});r.openFromHandle(h9(this.runtime,i,e.layer,t))}}else{if("native"!==this.runtime.kind)throw new N(G.NotImplemented,"\'layerFile\' needs the native Node runtime; open the file\'s bytes instead");t=t=>{let n=this.baseDocuments.acquireFileBase({key:e.baseKey,path:e.basePath,password:t,knownSha256:e.baseSha256});r.openFromHandle(h9(this.runtime,n,e.layer,t))}}try{t(e.password)}catch(o){var i;if(!((i=o)instanceof N&&(i.code===G.DocPasswordRequired||i.code===G.DocPasswordIncorrect)))throw o;return r.parkLocked(t),this.sessions.set(n,r),aC({tag:"open",docId:e.docId,security:{encryptionState:"encrypted",encryptionRequiresPassword:!0,securityHandlerRevision:null,pdfPermissionsBits:null,pdfPermissionsAllAllowed:null,pdfOpenedAs:null,securityProbedAt:Date.now()},...e.password?{passwordRejected:!0}:{}})}return this.sessions.set(n,r),aC({tag:"open",docId:e.docId,security:new AH(this.runtime).checkPasswordPermissions(r,e.password??""),protection:this.probeProtection(r),...e.reserveObjectNumbers?{objectNumbers:r.reserveObjectNumbers(e.reserveObjectNumbers)}:{},lastObjectNumber:r.lastObjectNumber()})}openBytesAsLayer(e,t,n){let r=this.baseDocuments.acquireMemoryBase({key:`bytes-open:${iX()}`,bytes:t,password:n});e.openFromHandle(h9(this.runtime,r,{kind:"fresh"},n)),e.persistLayerArtifact=!1}probeProtection(e){try{return new wR(this.runtime,e).readProtection()}catch{return null}}handleSignaturesList(e){let t=this.requireSession(e);return aC({tag:"signatures.list",snapshot:e.workingCopy?new vo(this.runtime,t).readWorkingCopySnapshot():new wR(this.runtime,t).readSnapshot()})}handleSignaturesContents(e){let t=this.requireSession(e),n=new wR(this.runtime,t).readContents(e.ref);return aC({tag:"signatures.contents",bytes:n},[n])}handleSignaturesDigest(e){let t=this.requireSession(e),n=new wR(this.runtime,t).digest(e.ref,e.algorithm);return aC({tag:"signatures.digest",digest:n},[n])}handleSignaturesRevisionBytes(e){let t=this.requireSession(e),n=new wR(this.runtime,t).revisionBytes(e.revisionIndex);return aC({tag:"signatures.revisionBytes",bytes:n,size:n.byteLength},[n])}handleDocumentVersion(e){let t=this.requireSession(e);return aC({tag:"document.version",version:new wR(this.runtime,t).version()})}handleSignaturesPrepare(e){let t=this.requireSession(e);return aC({tag:"signatures.prepare",result:new ve(this.runtime,t,this.baseDocuments,this.options.signingCandidatePath).prepare(e.input,e.authority),fieldObjectNumber:t.pendingSigning.fieldObjectNumber})}handleSignaturesComplete(e){let t=this.requireSession(e),n=new ve(this.runtime,t,this.baseDocuments,this.options.signingCandidatePath).complete(e.input,e.opId,e.authority);return"already-completed"===n.status?aC({tag:"signatures.complete",result:n}):this.finishMutation(t,{tag:"signatures.complete",result:n},e.artifactPath)}handleSignaturesValidationInfo(e){let t=this.requireSession(e),n=new vl(this.runtime,t).read(),r=e=>e.buffer,i=n.certificates.map(r),o=n.ocspResponses.map(r),a=n.crls.map(r);return aC({tag:"signatures.validationInfo",certificates:i,ocspResponses:o,crls:a},[...i,...o,...a])}handleSignaturesAddValidationInfo(e,t){let n=this.requireSession(e),r=new vu(this.runtime,n).add({certificates:e.certificates.map(e=>new Uint8Array(e)),ocspResponses:e.ocspResponses.map(e=>new Uint8Array(e)),crls:e.crls.map(e=>new Uint8Array(e))},t),i={tag:"signatures.addValidationInfo",result:r};return Object.values(r.added).some(e=>e>0)?this.finishMutation(n,i,e.artifactPath):aC(i)}handleSignaturesAnalyze(e){let t=this.requireSession(e);return aC({tag:"signatures.analyze",analysis:new vo(this.runtime,t).analyze(e.input)})}handleSignaturesFinalizeCandidate(e){return aC({tag:"signatures.finalizeCandidate",...new vd(this.runtime,this.baseDocuments).finalize({path:e.path,byteRange:e.byteRange,contentsSizeBytes:e.contentsSizeBytes,fieldObjectNumber:e.fieldObjectNumber,cms:new Uint8Array(e.cms),password:e.password??null})})}handleSignaturesCancel(e){let t=this.requireSession(e);return aC({tag:"signatures.cancel",result:new ve(this.runtime,t,this.baseDocuments,this.options.signingCandidatePath).cancel(e.signingId)})}assertNoPendingSigning(e){if(!vO(e))return;let t="layerName"in e?e.layerName:void 0,n=this.sessions.get(vN(e.docId,t));if(n?.pendingSigning)throw new N(G.SigningPending,`a signing is pending (${n.pendingSigning.prepared.signingId}); complete or cancel it before mutating the document`)}handleMetadataRead(e,t){let n=this.requireSession(e);return aC({tag:"metadata.read",metadata:new FF(this.runtime,n).read(t)})}handleMetadataUpdate(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"metadata.update",patch:e.patch},vk(),t);return this.finishMutation(n,{tag:"metadata.update",result:o},e.artifactPath)}handleMetadataReadCustom(e,t){let n=this.requireSession(e);return aC({tag:"metadata.readCustom",custom:new FF(this.runtime,n).readCustom(t)})}handleMetadataUpdateCustom(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"metadata.updateCustom",patch:e.patch},vk(),t);return this.finishMutation(n,{tag:"metadata.updateCustom",result:o},e.artifactPath)}handleActionsRead(e,t){let n=this.requireSession(e);return aC({tag:"actions.read",snapshot:new v_(this.runtime,n).read(t)})}handleOutlineRead(e,t){let n=this.requireSession(e);return aC({tag:"outline.read",outline:new E9(this.runtime,n).read(t)})}handleAnnotationsList(e,t){let n=this.requireSession(e),r=e.pages?.map(e=>n.resolvePageRef(e).pageObjectNumber);return aC({tag:"annotations.list",list:new DP(this.runtime,n,this.fonts).list(r,t,"annotations")})}async handleAnnotationsRenderAppearances(e,t){let n=this.requireSession(e),r=n.resolvePageRef(e.page).pageObjectNumber,i=await new DF(this.runtime,n).render(r,e.family,e.options??{},t,this.slices),o=i.appearances.map(e=>e.raster.data);return aC({tag:"annotations.renderAppearances",page:e.page,result:i},o)}handleAnnotationsCreate(e,t){let n=this.requireSession(e),{type:r,page:i,...o}=this.applyOne(n,e.opId,{type:"annotations.create",page:e.page,data:e.draft,...e.resources?{resources:e.resources}:{},...void 0!==e.objectNumber?{objectNumber:e.objectNumber}:{}},vk(e.actor),t);return this.finishMutation(n,{tag:"annotations.create",result:o},e.artifactPath)}handleAnnotationsUpdate(e,t){let n=this.requireSession(e),{type:r,page:i,skipped:o,...a}=this.applyOne(n,e.opId,{type:"annotations.update",ref:e.ref,patch:e.patch,...e.resources?{resources:e.resources}:{}},{...e.authority,protection:null},t);return this.finishMutation(n,{tag:"annotations.update",result:a},e.artifactPath)}handleAnnotationsDelete(e,t){let n=this.requireSession(e),{type:r,page:i,...o}=this.applyOne(n,e.opId,{type:"annotations.delete",ref:e.ref},{...e.authority,protection:null},t);return this.finishMutation(n,{tag:"annotations.delete",result:o},e.artifactPath)}handleAnnotationsFlatten(e,t){let n=this.requireSession(e),r=n.resolvePageRef(e.page).pageObjectNumber,i=new yE(this.runtime,n).flatten(r,e.refs,e.usage,t),o=i.meta.affectedPages.length>0;return o?this.finishMutation(n,{tag:"annotations.flatten",result:i,wrote:o},e.artifactPath):aC({tag:"annotations.flatten",result:i,wrote:o})}handleAnnotationsExportAppearance(e,t){let n=this.requireSession(e),r=n.resolvePageRef(e.page).pageObjectNumber,i=new yE(this.runtime,n).exportAppearance(r,e.refs,t);return aC({tag:"annotations.exportAppearance",bytes:i.bytes,size:i.size},[i.bytes])}handleAnnotationsExport(e,t){let n=this.requireSession(e),r=new yG(this.runtime,n,this.fonts).export(e.selection,e.limits??nI,t);return aC({tag:"annotations.export",bundle:r},Object.values(r.resources))}handleAnnotationsImport(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"annotations.import",bundle:e.bundle,...void 0!==e.pages?{pages:e.pages}:{},attribution:e.attribution,...e.actor?{actor:e.actor}:{},limits:e.limits??nI},vk(e.actor),t);return 0===i.annotations.length?aC({tag:"annotations.import",result:i}):this.finishMutation(n,{tag:"annotations.import",result:i},e.artifactPath)}handleAnnotationsReadAppearance(e,t){let n=this.requireSession(e),r=n.resolvePageRef(e.page).pageObjectNumber,i=new yE(this.runtime,n).readAppearance(r,e.ref,t);return aC({tag:"annotations.readAppearance",bytes:i.bytes,size:i.size},[i.bytes])}handleAnnotationsReorder(e,t){let n=this.requireSession(e),{type:r,page:i,...o}=this.applyOne(n,e.opId,{type:"annotations.reorder",page:e.page,refs:e.refs,position:e.position},{...e.authority,protection:null},t);return this.finishMutation(n,{tag:"annotations.reorder",result:o},e.artifactPath)}handleDocumentApply(e,t){let n=this.requireSession(e);!function(e){if(iS(e))return;let t={"annotations.import":"doc.annotations.import","forms.import":"doc.forms.import","forms.importValues":"doc.forms.importValues"},n=e.ops.find(({type:e})=>e in t);if(n)throw new N(G.InvalidArg,`doc.apply takes no import: import a bundle with ${t[n.type]}`)}(e.change);let r=oZ(e.change),i=AW(n).outcome(e.opId);if(i)return aC({tag:"document.apply",result:this.replayed(i,r,e.opId),replayed:!0});let o=this.recorded(n,e.opId,r,()=>this.runChange(n,e,t)),a={tag:"document.apply",result:o,replayed:!1};return o.items.some(iv)?this.finishMutation(n,a,e.artifactPath):aC(a)}applyOne(e,t,n,r,i){let o={ops:[n]},a=AW(e),s=oZ(o),l=a.outcome(t),u=(l?this.replayed(l,s,t):this.recorded(e,t,s,()=>new A$(this.runtime,e,this.fonts).apply(o.ops,r,i,AL))).items[0];if(!u||iA(u))throw new N(G.Unknown,`${n.type} wrote nothing`);return u}replayed(e,t,n){if(e.fingerprint!==t)throw new N(G.IdempotencyKeyReused,`opId ${n} already answered a different change`);if("refused"===e.kind){var r;throw new N((r=e.error).code,r.message,{details:r.details})}return e.result}recorded(e,t,n,r){let i=AW(e);try{let o=r(),a=vG(e,o);return i.keepApplied(t,n,a,a.meta.undoable?o.record:null),a}catch(e){var o;throw N.is(e)&&(o=e.code,oK.has(o))&&i.keepRefused(t,n,C(e)),e}}handleDocumentApplyChanges(e,t){let n=this.requireSession(e);n.assertUsable(),void 0!==e.objectNumberFloor&&n.raiseLastObjectNumber(e.objectNumberFloor-1);let r=new A$(this.runtime,n,this.fonts,e.limits),i=this.pageSpaceOf(n),o=new Map,a=[];for(let l of e.changes){n.beginTransaction(l.opId);try{let e=function(e,t,n,r,i){let{change:o,authority:a}=t;if(!iS(o))return e.apply(o.ops,a,r,i);let s=a.identity.userId??null,l=n.has(o.undoOf)?n.get(o.undoOf):t.record;if(void 0===l)throw new N(G.UndoUnavailable,`change ${o.undoOf} can no longer be undone`,{details:{reason:"expired"}});return l?e.undo(l,a,r,i):{items:[],record:{userId:s,steps:[]}}}(r,l,o,t,i),s=vG(n,e);n.commitTransaction();let u=s.meta.undoable?e.record:null;o.set(l.opId,u),a.push({opId:l.opId,status:"applied",result:s,record:u})}catch(e){var s;if(n.inTransaction()&&n.abortTransaction(),!N.is(e)||(s=e.code,!oK.has(s)))throw e;o.set(l.opId,null),a.push({opId:l.opId,status:"refused",error:C(e)})}}let l={tag:"document.applyChanges",outcomes:a};return a.some(e=>"applied"===e.status&&e.result.items.some(iv))?this.finishMutation(n,l,e.artifactPath):aC(l)}pageSpaceOf(e){return{opInFileSpace:t=>(function(e,t){switch(e.type){case"annotations.import":case"forms.import":case"forms.importValues":case"annotations.copy":case"forms.copy":case"forms.repeat":case"pages.setScale":default:return e;case"annotations.create":return{...e,data:n5(e.data,t(e.page),t)};case"annotations.update":{let n=t(e.ref.page),{expect:r,...i}=e;return{...i,patch:n4(e.patch,n,t),...r?{expect:n4(r,n,t)}:{}}}case"annotations.delete":{let{expect:n,...r}=e;return n?{...r,expect:n4(n,t(e.ref.page),t)}:r}case"forms.create":return{...e,draft:i6(e.draft,t)};case"forms.addWidget":return{...e,placement:i2(e.placement,t)};case"forms.updateWidget":{let n=t(e.widget.page),{expect:r,...i}=e;return{...i,patch:vD(e.patch,n,t),...r?{expect:vD(r,n,t)}:{}}}case"forms.deleteWidget":{let{expect:n,...r}=e;return n?{...r,expect:vD(n,t(e.widget.page),t)}:r}case"outline.create":var n;return{...e,data:(n=e.data,i7(n,e=>nq(e,t)))};case"outline.update":{let{expect:n,...r}=e;return{...r,patch:oe(e.patch,t),...n?{expect:oe(n,t)}:{}}}case"outline.delete":{let{expect:n,...r}=e;return n?{...r,expect:oe(n,t)}:r}}})(t,gF(this.runtime,e)),itemOut:t=>(function(e,t){if(iA(e))return e;let n=e=>n6(e,t(e.page),t),r=e=>e.map(e=>i4(e,t));switch(e.type){case"annotations.create":case"annotations.update":return{...e,annotation:n(e.annotation)};case"annotations.restore":case"annotations.import":case"annotations.copy":return{...e,annotations:e.annotations.map(n)};case"forms.setValue":case"forms.setDisplay":case"forms.setAppearanceText":case"forms.setSignatureAppearance":case"forms.setButtonImage":case"forms.create":case"forms.update":case"forms.restore":case"forms.addWidget":case"forms.removeWidget":return{...e,field:i5(e.field,t),widgets:r(e.widgets)};case"forms.reset":case"forms.import":case"forms.importValues":case"forms.copy":case"forms.repeat":return{...e,fields:e.fields.map(e=>i5(e,t)),widgets:r(e.widgets)};case"forms.updateWidget":return{...e,widget:i4(e.widget,t)};case"forms.deleteWidget":return{...e,field:e.field&&i5(e.field,t)};case"forms.restoreWidget":return{...e,field:e.field&&i5(e.field,t),widgets:r(e.widgets)};case"outline.create":case"outline.update":return{...e,item:i9(e.item,t)};case"outline.restore":return{...e,items:e.items.map(e=>i9(e,t))};case"pages.rotate":case"pages.setScale":case"pages.reorder":case"pages.delete":case"pages.insertBlank":case"pages.insert":case"pages.copy":case"pages.restore":return{...e,layout:i1(e.layout)};default:return e}})(t,gF(this.runtime,e))}}runChange(e,t,n){let r=new A$(this.runtime,e,this.fonts),i=this.pageSpaceOf(e),o=t.authority.identity.userId??null;if(!iS(t.change))return r.apply(t.change.ops,t.authority,n,i);let a=AW(e).record(t.change.undoOf);if(!a||"unavailable"in a)throw new N(G.UndoUnavailable,`change ${t.change.undoOf} can no longer be undone`,{details:{reason:a?a.unavailable:"expired"}});if(!a.record)return{items:[],record:{userId:o,steps:[]}};if(null!==a.record.userId&&a.record.userId!==o)throw new na("changes:undo","target");return r.undo(a.record,t.authority,n,i)}handlePagesList(e,t){let n=this.requireSession(e);return aC({tag:"pages.list",snapshot:new gh(this.runtime,n).read(t)})}handlePagesSetName(e,t){let n=this.requireSession(e),r=new gw(this.runtime,n).setName({name:e.name,page:e.page,...void 0!==e.replace?{replace:e.replace}:{}},t);return this.finishMutation(n,{tag:"pages.setName",result:r},e.artifactPath)}handlePagesRemoveName(e,t){let n=this.requireSession(e),r=new gw(this.runtime,n).removeName({name:e.name},t);return this.finishMutation(n,{tag:"pages.removeName",result:r},e.artifactPath)}handlePagesFlatten(e,t){let n=this.requireSession(e),r=new gO(this.runtime,n).flatten(e.pages,e.usage,t),i=r.meta.affectedPages.length>0;return i?this.finishMutation(n,{tag:"pages.flatten",result:r,wrote:i},e.artifactPath):aC({tag:"pages.flatten",result:r,wrote:i})}handleRedactionApply(e,t){let n=this.requireSession(e),r=new gB(this.runtime,n).apply(e.scope,t),i=r.meta.affectedPages.length>0;return i?this.finishMutation(n,{tag:"redaction.apply",result:r,wrote:i},e.artifactPath):aC({tag:"redaction.apply",result:r,wrote:i})}handlePagesExtract(e,t){let n=this.requireSession(e),r=new gE(this.runtime,n).extract(e.pages,e.flatten,t);return aC({tag:"pages.extract",bytes:r.bytes,size:r.size},[r.bytes])}handleDocumentFontsList(e){let t=this.requireSession(e);return ym(this.runtime,t),aC({tag:"document.fonts.list",facts:new yl(this.runtime,t,this.fonts).facts()})}handleDocumentFontsResolve(e){let t=new yl(this.runtime,this.requireSession(e),this.fonts),n=t.facts(),{runs:r,missingCharacters:i}=t.resolve(e.annotation,e.runs,n);return aC({tag:"document.fonts.resolve",runs:r,missingCharacters:i,facts:n})}handleDocumentFontsProgram(e){let t=new yl(this.runtime,this.requireSession(e),this.fonts).program(e.displaySha256,"data"===e.part),n=t.bytes?t.bytes.buffer.slice(t.bytes.byteOffset,t.bytes.byteOffset+t.bytes.byteLength):null;return aC({tag:"document.fonts.program",covers:t.covers,ascent:t.ascent,descent:t.descent,bytes:n},n?[n]:[])}handleAttachmentsList(e,t){let n=this.requireSession(e);return aC({tag:"attachments.list",attachments:new wp(this.runtime,n).list(t)})}handleAttachmentsReadFile(e,t){let n=this.requireSession(e),r=new wp(this.runtime,n).readFile(e.ref,e.path,e.maxDecodedBytes,t);return aC({tag:"attachments.readFile",content:r},void 0!==r.bytes?[r.bytes]:[])}async handleAnnotationsReadFile(e,t){let n=this.requireSession(e),r=await new wp(this.runtime,n).readAnnotationFile(n.resolvePageRef(e.page).pageObjectNumber,e.ref,e.path,e.maxDecodedBytes,t,this.slices);return aC({tag:"annotations.readFile",content:r},void 0!==r.bytes?[r.bytes]:[])}async handleMeasureViewports(e,t){let n=this.requireSession(e),r=new vy(this.runtime,n).viewports(n.resolvePageRef(e.page).pageObjectNumber,t);return aC({tag:"measure.viewports",page:e.page,viewports:r})}handleMeasureSetScale(e,t){let n=this.requireSession(e);return new Aj(this.runtime,n).setScale(n.resolvePageRef(e.page).pageObjectNumber,e.measure,t),this.finishMutation(n,{tag:"measure.setScale",result:{page:e.page,layout:new gh(this.runtime,n).read(t),meta:{affectedPages:[],cacheDelta:null,...n.writeStamp()}}},e.artifactPath)}handlePieceInfoRead(e,t){let n=this.requireSession(e);return aC({tag:"pieceInfo.read",snapshot:new vw(this.runtime,n,e.page?n.resolvePageRef(e.page).pageObjectNumber:void 0).read(e.application,t)})}handlePieceInfoUpdate(e,t){let n=this.requireSession(e),r=new vw(this.runtime,n,e.page?n.resolvePageRef(e.page).pageObjectNumber:void 0);r.update(e.application,e.patch,t);let i={pieceInfo:r.read(e.application,t),meta:{affectedPages:[],cacheDelta:null,...n.writeStamp()}};return this.finishMutation(n,{tag:"pieceInfo.update",result:i},e.artifactPath)}handlePieceInfoApplications(e,t){let n=this.requireSession(e);return aC({tag:"pieceInfo.applications",applications:new vw(this.runtime,n,e.page?n.resolvePageRef(e.page).pageObjectNumber:void 0).applications(t)})}handlePieceInfoDelete(e,t){let n=this.requireSession(e);new vw(this.runtime,n,e.page?n.resolvePageRef(e.page).pageObjectNumber:void 0).delete(e.application,t);let r={meta:{affectedPages:[],cacheDelta:null,...n.writeStamp()}};return this.finishMutation(n,{tag:"pieceInfo.delete",result:r},e.artifactPath)}async handlePagesText(e,t){let n=this.requireSession(e),r=new gL(this.runtime,n),i=n.resolvePageRef(e.page).pageObjectNumber;return aC({tag:"pages.text",snapshot:await r.read(i,t,this.slices)})}async handlePagesGeometry(e,t){let n=this.requireSession(e),r=new gz(this.runtime,n),i=n.resolvePageRef(e.page).pageObjectNumber,o=await r.read(i,t,this.slices);return aC({tag:"pages.geometry",page:e.page,snapshot:o})}async handleSearchQuery(e,t){let n=this.requireSession(e);return aC({tag:"search.query",slice:await new vh(this.runtime,n).query(e.request,t,this.slices)})}async handlePagesRender(e,t){let n=this.requireSession(e),{raster:r,area:i}=await new gZ(this.runtime,n).render(n.resolvePageRef(e.page).pageObjectNumber,e.options??{},t,this.slices);return aC({tag:"pages.render",page:e.page,area:i,raster:r},[r.data])}slicedWork(e){switch(e.kind){case"pages.render":return{pdfium:t=>this.handlePagesRender(e,t)};case"pages.renderEncoded":return{pdfium:t=>this.handlePagesRender({...e,kind:"pages.render"},t),encode:(t,n)=>this.encodeRendered(t,e.encode,n)};case"document.renderPageFile":return{pdfium:t=>this.handleDocumentRenderPageFile(e,t)};case"document.renderPageFileEncoded":return{pdfium:t=>this.handleDocumentRenderPageFile({...e,kind:"document.renderPageFile"},t),encode:(t,n)=>this.encodeRendered(t,e.encode,n)};case"annotations.renderAppearances":return{pdfium:t=>this.handleAnnotationsRenderAppearances(e,t)};case"annotations.renderAppearancesEncoded":return{pdfium:t=>this.handleAnnotationsRenderAppearances({...e,kind:"annotations.renderAppearances"},t),encode:(t,n)=>this.encodeAppearances(t,e.page,e.encode,n)};case"pages.text":return{pdfium:t=>this.handlePagesText(e,t)};case"pages.geometry":return{pdfium:t=>this.handlePagesGeometry(e,t)};case"measure.viewports":return{pdfium:t=>this.handleMeasureViewports(e,t)};case"annotations.readFile":return{pdfium:t=>this.handleAnnotationsReadFile(e,t)};case"search.query":return{pdfium:t=>this.handleSearchQuery(e,t)};default:return null}}async runSliced(e,t,n,r){if(r.encode&&!this.options.imageEncoder)return void this.post(aC({kind:"reject",jobId:t.jobId,error:C(new N(G.NotImplemented,vC))},aN));let i=new AbortController;this.aborts.set(t.jobId,i),this.busy=!0;try{let e;try{e=await r.pdfium(i.signal)}finally{this.busy=!1,queueMicrotask(()=>this.drain())}this.resolve(t,r.encode?await r.encode(e,i.signal):e)}catch(e){this.post(aC({kind:"reject",jobId:t.jobId,error:C(e)},aN))}finally{this.aborts.delete(t.jobId),this.closePagesChangedBy(e,n)}}async encodeRaster(e,t,n){let r=this.options.imageEncoder;if(!r)throw new N(G.NotImplemented,vC);let{bytes:i,mimeType:o}=await r.encode(e,t);if(n.aborted)throw new N(G.Aborted,"aborted during image encode");return{mimeType:o,width:e.width,height:e.height,bytes:i}}async encodeRendered(e,t,n){let{payload:r}=e;if("pages.render"===r.tag){let e=await this.encodeRaster(r.raster,t,n);return aC({tag:"pages.renderEncoded",image:e},[e.bytes.buffer])}if("document.renderPageFile"===r.tag){let e=await this.encodeRaster(r.raster,t,n);return aC({tag:"document.renderPageFileEncoded",page:r.page,pageCount:r.pageCount,image:e},[e.bytes.buffer])}throw new N(G.WireFormat,`unexpected ${r.tag}`)}async encodeAppearances(e,t,n,r){if("annotations.renderAppearances"!==e.payload.tag)throw new N(G.WireFormat,`unexpected ${e.payload.tag}`);let{appearances:i}=e.payload.result,o=[];for(let e of i)o.push({ref:e.ref,mode:e.mode,state:e.state,rect:e.rect,image:await this.encodeRaster(e.raster,n,r)});return aC({tag:"annotations.renderAppearancesEncoded",page:t,result:{page:e.payload.result.page,appearances:o}},o.map(e=>e.image.bytes.buffer))}assertRewriteKeepsSignatures(e,t){if("rewrite"!==t||"protect"!==e.signedDocumentPolicy)return;let n=this.probeProtection(e);if(n&&null!==n.judged)throw new N(G.ProtectedDocument,"the document is signed: a rewrite save would void every signature (use an incremental save)")}handleDocumentSaveBuffer(e){let t=this.requireSession(e);if(this.assertRewriteKeepsSignatures(t,e.mode),"incremental"===e.mode){let e=new AQ(this.runtime,t).snapshot();return aC({tag:"document.saveBuffer",bytes:e.bytes,size:e.bytes.byteLength},[e.bytes])}let n=new AQ(this.runtime,t).saveStandaloneToBuffer(e.mode);return aC({tag:"document.saveBuffer",bytes:n.bytes,size:n.size},[n.bytes])}handleDocumentSaveFile(e){let t=this.requireSession(e);return(this.assertRewriteKeepsSignatures(t,e.mode),"incremental"===e.mode&&(!t.hasUnsavedEdits()||new AQ(this.runtime,t).saveStandaloneToFileEx(e.path,e.mode).unchangedSinceLoad))?(new AQ(this.runtime,t).copyLoadedBytesToFile(e.path),aC({tag:"document.saveFile",path:e.path})):"incremental"===e.mode?aC({tag:"document.saveFile",path:e.path}):aC({tag:"document.saveFile",path:new AQ(this.runtime,t).saveStandaloneToFile(e.path,e.mode).path})}handleDocumentSaveLayerBuffer(e){let t=this.requireSession(e);if("layer"!==t.kind)throw new N(G.InvalidArg,"document has no layer to export (opened without a layer)");let n=new AQ(this.runtime,t).saveLayerArtifact();return aC({tag:"document.saveLayerBuffer",bytes:n.bytes,size:n.size},[n.bytes])}handleDocumentProbeSecurityFile(e){return aC({tag:"document.probeSecurityFile",security:new AH(this.runtime).probeFile(e.path,e.password)})}async handleDocumentRenderPageFile(e,t){let n=new Fu(this.runtime),r=this.baseDocuments.acquireFileBase({key:`adhoc-file:${e.path}`,path:e.path,password:e.password});try{n.openFromHandle(h9(this.runtime,r,{kind:"fresh"},e.password));let i=new gh(this.runtime,n).read(t),o=i.pages[e.pageIndex];if(!o)throw new N(G.NotFound,`renderPageFile: no page at index ${e.pageIndex} (pageCount=${i.pageCount})`);let{raster:a}=await new gZ(this.runtime,n).render(o.ref.objectNumber,vP(e.options??{},()=>o.pdfCropBox),t,this.slices);return aC({tag:"document.renderPageFile",page:o.ref,pageCount:i.pageCount,raster:a},[a.data])}finally{n.close()}}handleDocumentCheckPasswordPermissions(e){let t,n=this.sessions.get(vN(e.docId));return n?.isLocked()?(n.unlockWith(e.password),n.password=e.password,t=n):t=this.requireSession(e),aC({tag:"document.checkPasswordPermissions",security:new AH(this.runtime).checkPasswordPermissions(t,e.password,e.mode??"any"),protection:this.probeProtection(t)})}handleFontsRegister(e){return this.fonts.register(e.fontKey,e.familyName,e.weight,e.italic,new Uint8Array(e.data),e.builtIn??!1),aC({tag:"fonts.register",fontKey:e.fontKey,identity:this.fonts.describe(e.fontKey)})}handleFontsAuthorizeEditing(e){return aC({tag:"fonts.authorizeEditing",identity:this.fonts.authorizeEditing(e.fontKey)})}handleDocumentSetFontSettings(e){let t=this.requireSession(e).requireDocPtr(),{fn:n}=this.runtime;if(void 0!==e.embeddingPolicy){let r={default:0,subset:1,full:2}[e.embeddingPolicy];if(!n.EPDFDoc_SetFontEmbeddingPolicy(t,r))throw new N(G.InvalidArg,"EPDFDoc_SetFontEmbeddingPolicy failed")}if(void 0!==e.typographicFeatures&&!n.EPDFDoc_SetTypographicFeatures(t,e.typographicFeatures))throw new N(G.InvalidArg,"EPDFDoc_SetTypographicFeatures failed");return aC({tag:"document.setFontSettings"})}handleFontsAddFallback(e){return this.fonts.addFallback(e.fontKey,e.tier),aC({tag:"fonts.addFallback"})}handleFontsClearFallbacks(e){return this.fonts.clearFallbacks(),aC({tag:"fonts.clearFallbacks"})}handleFontsProgram(e){let t=this.fonts.engineFontFacts().some(t=>t.sha256===e.sha256&&t.served)?this.fonts.programFor(e.sha256):void 0;if(!t)throw new N(G.NotFound,`no served font has the program ${e.sha256}`);let n=t.bytes(),r=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength);return aC({tag:"fonts.program",bytes:r},[r])}handleFontsClear(e){return this.fonts.clear(),aC({tag:"fonts.clear"})}handleLayerClose(e){let t=vN(e.docId,e.layerName),n=this.sessions.get(t);return n&&(gS(this.runtime,n),wC(this.runtime,n),n.close(),this.sessions.delete(t)),aC({tag:"close"})}handleClose(e){for(let[r,i]of Array.from(this.sessions.entries())){var t,n;((t=r)===vN(n=e.docId)||t.startsWith(`${n}::layer:`))&&(gS(this.runtime,i),wC(this.runtime,i),i.close(),this.sessions.delete(r))}return aC({tag:"close"})}handleShutdown(e){if(!this.destroyed){var t;for(let e of(this.destroyed=!0,this.sessions.values()))gS(this.runtime,e),wC(this.runtime,e),e.close();this.sessions.clear(),this.residency.closeIdle(),this.baseDocuments.releaseAll(),t=this.runtime,hU.has(t)&&(t.fn.EPDF_ShutdownThread(),hU.delete(t))}return aC({tag:"shutdown"})}requireSession(e){let t=vN(e.docId,e.layerName),n=this.sessions.get(t);if(n?.isLocked())throw new N(G.DocPasswordRequired,`document session is password-locked: ${t}`);if(!n||!n.isOpen())throw new N(G.DocNotOpen,`document session not open: ${t}`);return n.assertUsable(),n}handleFormsList(e,t){let n=this.requireSession(e);return aC({tag:"forms.list",snapshot:new wW(this.runtime,n,this.fonts).snapshot(t)})}handleFormsSetValue(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.setValue",field:e.ref,value:e.value},e.authority,t);return this.finishMutation(n,{tag:"forms.setValue",result:i},e.artifactPath)}handleFormsReset(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"forms.reset",...e.refs?{fields:e.refs}:{}},e.authority,t);return this.finishMutation(n,{tag:"forms.reset",result:o},e.artifactPath)}handleFormsExport(e,t){let n=this.requireSession(e),r=new vc(this.runtime,n,this.fonts).export(e.selection,e.limits??nI,t);return aC({tag:"forms.export",bundle:r},Object.values(r.resources))}handleFormsImport(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.import",bundle:e.bundle,...void 0!==e.pages?{pages:e.pages}:{},attribution:e.attribution,values:e.values,actor:vx(e.authority),limits:e.limits??nI,mayScript:e.mayScript},e.authority,t);return 0===i.fields.length?aC({tag:"forms.import",result:i}):this.finishMutation(n,{tag:"forms.import",result:i},e.artifactPath)}handleFormsImportValues(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.importValues",bundle:e.bundle,attribution:e.attribution,actor:vx(e.authority),limits:e.limits??nI},e.authority,t);return 0===i.fields.length?aC({tag:"forms.importValues",result:i}):this.finishMutation(n,{tag:"forms.importValues",result:i},e.artifactPath)}handleFormsRepair(e,t){let n=this.requireSession(e),r=new Et(this.runtime,n,this.fonts).repair(e.bakeAppearances??!1,t);return this.finishMutation(n,{tag:"forms.repair",result:r},e.artifactPath)}handleFormsCreateField(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.create",draft:e.draft,...void 0!==e.objectNumber?{objectNumber:e.objectNumber}:{},...e.widgetObjectNumbers?{widgetObjectNumbers:e.widgetObjectNumbers}:{}},e.authority,t);return this.finishMutation(n,{tag:"forms.createField",result:i},e.artifactPath)}handleFormsUpdateField(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"forms.update",field:e.ref,patch:e.patch},e.authority,t);return this.finishMutation(n,{tag:"forms.updateField",result:o},e.artifactPath)}handleFormsSetSignatureAppearance(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.setSignatureAppearance",field:e.ref,appearance:function(e){if(void 0!==e.appearance)return e.appearance&&new Uint8Array(e.appearance);if(void 0!==e.pdf)return{pdf:new Uint8Array(e.pdf)};throw new N(G.InvalidArg,"a signature appearance request carries \'appearance\' (the mark\'s bytes, or null for no mark) or \'pdf\'")}(e)},e.authority,t);return this.finishMutation(n,{tag:"forms.setSignatureAppearance",result:i},e.artifactPath)}handleFormsDeleteField(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.delete",field:e.ref},vk(),t);return this.finishMutation(n,{tag:"forms.deleteField",result:i},e.artifactPath)}handleFormsAddWidget(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.addWidget",field:e.ref,placement:e.placement,...void 0!==e.objectNumber?{objectNumber:e.objectNumber}:{},...void 0!==e.splitObjectNumber?{splitObjectNumber:e.splitObjectNumber}:{}},vk(),t);return this.finishMutation(n,{tag:"forms.addWidget",result:i},e.artifactPath)}handleFormsDetachWidget(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.removeWidget",field:e.ref,widget:e.widget},vk(),t);return this.finishMutation(n,{tag:"forms.detachWidget",result:i},e.artifactPath)}handleFormsUpdateWidget(e,t){let n=this.requireSession(e),{type:r,skipped:i,...o}=this.applyOne(n,e.opId,{type:"forms.updateWidget",widget:e.widget,patch:e.patch},vk(),t);return this.finishMutation(n,{tag:"forms.updateWidget",result:o},e.artifactPath)}handleFormsDeleteWidget(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.deleteWidget",widget:e.widget},vk(),t);return this.finishMutation(n,{tag:"forms.deleteWidget",result:i},e.artifactPath)}handleFormsReorderCalculations(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.reorderCalculations",fields:e.fields,position:e.position},vk(),t);return this.finishMutation(n,{tag:"forms.reorderCalculations",result:i},e.artifactPath)}handleFormsReorderWidgets(e,t){let n=this.requireSession(e),{type:r,...i}=this.applyOne(n,e.opId,{type:"forms.reorderWidgets",page:e.page,widgets:e.widgets,position:e.position},vk(),t);return this.finishMutation(n,{tag:"forms.reorderWidgets",result:i},e.artifactPath)}finishMutation(e,t,n){e.inTransaction()&&e.commitTransaction(),vI.has(t.tag)&&AW(e).endUndo(),t.tag.startsWith("forms.")||"pages.flatten"===t.tag||"redaction.apply"===t.tag||"signatures.complete"===t.tag||e.invalidateDerived(),"signatures.complete"!==t.tag&&e.noteEdit();let r=function(e,t){if(0===t.length||!("result"in e))return e;let n=e.result;if("object"!=typeof n||null===n||!("meta"in n))return e;let{meta:r}=n;return"object"!=typeof r||null===r||"missingCharacters"in r?e:{...e,result:{...n,meta:{...r,missingCharacters:t}}}}(t,e.missingCharacters()),i=!function(e,t){let n=yd.get(t);if(!n)return!1;let r=yc(e,t);if(r===n.fingerprint)return!1;let i=yf(e,t);return yd.set(t,{fingerprint:r,documentFonts:i}),i!==n.documentFonts}(this.runtime,e)?r:{...r,fontsChanged:!0};if("layer"!==e.kind||!e.persistLayerArtifact)return aC(i);let o=this.saveLayerArtifact(e,n);return aC({...i,...o.payload},o.transfer)}saveLayerArtifact(e,t){let n=new AQ(this.runtime,e),r=e.lastObjectNumber();if(t)return{payload:{artifactFile:{...n.saveLayerArtifactToFile(t),lastObjectNumber:r}},transfer:[]};let i={...n.saveLayerArtifact(),lastObjectNumber:r};return{payload:{artifact:i},transfer:[i.bytes]}}},vS={read:"none",snapshot:"none",session:"none",open:"none",close:"none",write:"keepsPages",contentWrite:"document",runtimeWrite:"runtime"};function vk(e){return{identity:e??{},grants:null,protection:null}}function vx({identity:e}){return{...void 0!==e.userId?{userId:e.userId}:{},...void 0!==e.groupId?{groupId:e.groupId}:{},...void 0!==e.displayName?{displayName:e.displayName}:{}}}function vG(e,t){let n=t.record.steps.length>0;n&&e.markUndoable();let r=t.items.map(e=>({...e,meta:{...e.meta,undoable:n}})),i=[...new Set(r.flatMap(e=>e.meta.missingCharacters??[]))];return{items:r,meta:{affectedPages:function(e){let t=new Map;for(let n of e)for(let e of n.meta.affectedPages)t.set(e.objectNumber,e);return[...t.values()]}(r),cacheDelta:null,...e.writeStamp(),...i.length>0?{missingCharacters:i}:{}}}}function vO(e){return"shutdown"!==e.kind&&"signatures.complete"!==e.kind&&"document.applyChanges"!==e.kind&&("write"===e.effect||"contentWrite"===e.effect)&&"docId"in e}var vI=new Set(["redaction.apply","pages.flatten","annotations.flatten","forms.repair","signatures.complete"]);function vN(e,t){return`${e}::${t?`layer:${t}`:"__base__"}`}var vC="this engine has no image encoder (the *.renderEncoded kinds are cloud-server surface)";(g=self).onmessage=e=>{var t,n;let r=e.data;r&&"object"==typeof r&&"init"===r.kind&&(t=g,n=r,(async()=>{var e;let r={wasmUrl:(e=n).wasmUrl,wasmBinary:e.wasmBinary},i=new vv(await a$({prefer:"wasm",wasmUrl:r.wasmUrl,wasmBinary:r.wasmBinary}),e=>{t.postMessage(e.payload,e.transfer)});t.onmessage=e=>{i.receive(e.data)},t.postMessage({kind:"ready"})})().catch(e=>{t.postMessage({kind:"init-error",error:function(e,t){let n=String(e?.stack??e);if(t.wasmBinary)return n;let r=t.wasmUrl?`failed to load embedpdf.wasm from ${t.wasmUrl}`:"failed to load embedpdf.wasm (resolved relative to the worker script)";return`${r}. Your build did not ship the wasm at that location \\u2014 either import \\`localEngine\\` from \\`@embedpdf/engine/portable\\` (the wasm travels inside your build), or self-host the file and pass \\`assetsUrl\\`/\\`wasmUrl\\` to localEngine(), or provide the bytes via \\`wasmBinary\\`. See https://www.embedpdf.com/docs/viewer/self-hosting \\u2014 ${n}`}(e,n)})}))}})();'; +export { + e as default +}; +//# sourceMappingURL=embedpdf-worker.source-Z0o39l7i-qFIWKZ_I.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/form-design-panel-B4qGH4r--T0yv-8g7.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/form-design-panel-B4qGH4r--CLCbLmeD.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/form-design-panel-B4qGH4r--T0yv-8g7.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/form-design-panel-B4qGH4r--CLCbLmeD.js index 4ed3e361..251a4e0c 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/form-design-panel-B4qGH4r--T0yv-8g7.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/form-design-panel-B4qGH4r--CLCbLmeD.js @@ -1,5 +1,5 @@ -import { a4 as k, ax as g, a8 as v, h as e, u as C, j as y, av as z, n as _, C as B, ay as K, az as P, aA as I, x as G, aB as W, g as O, r as j, i as V } from "./wasm-url-asset-sqnq1cad.js"; -import { u as J } from "./labels-C6_i87Oj-BpJCC3cf.js"; +import { a4 as k, ax as g, a8 as v, h as e, u as C, j as y, av as z, n as _, C as B, ay as K, az as P, aA as I, x as G, aB as W, g as O, r as j, i as V } from "./wasm-url-asset-Dc0HnHB_.js"; +import { u as J } from "./labels-C6_i87Oj-xAdFtKWd.js"; const M = "border-border bg-surface text-fg w-full rounded-md border px-2 py-1.5 text-sm", U = Object.freeze([]), Y = /* @__PURE__ */ new Set([ "purpose", "format", @@ -489,4 +489,4 @@ function se({ field: o }) { export { ie as FormDesignPanel }; -//# sourceMappingURL=form-design-panel-B4qGH4r--T0yv-8g7.js.map +//# sourceMappingURL=form-design-panel-B4qGH4r--CLCbLmeD.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/grant-prompt-Co4bzHaR-ibAjp4kO.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/grant-prompt-Co4bzHaR-EijIs4Sr.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/grant-prompt-Co4bzHaR-ibAjp4kO.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/grant-prompt-Co4bzHaR-EijIs4Sr.js index 9d7d522f..1f3ab268 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/grant-prompt-Co4bzHaR-ibAjp4kO.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/grant-prompt-Co4bzHaR-EijIs4Sr.js @@ -1,4 +1,4 @@ -import { $ as k, aN as F, h as e, aO as T, aL as v, u as x, aB as y, g as p, Z as $, j as E } from "./wasm-url-asset-sqnq1cad.js"; +import { $ as k, aN as F, h as e, aO as T, aL as v, u as x, aB as y, g as p, Z as $, j as E } from "./wasm-url-asset-Dc0HnHB_.js"; const N = [ "displayName", "email", @@ -288,4 +288,4 @@ export { _ as GrantPrompt, M as VisitorIdentityDialog }; -//# sourceMappingURL=grant-prompt-Co4bzHaR-ibAjp4kO.js.map +//# sourceMappingURL=grant-prompt-Co4bzHaR-EijIs4Sr.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-BCXWVSWX.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-BCXWVSWX.js deleted file mode 100644 index 74aee656..00000000 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-BCXWVSWX.js +++ /dev/null @@ -1,1482 +0,0 @@ -var Te = Object.defineProperty; -var Se = (e, t, n) => t in e ? Te(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; -var j = (e, t, n) => Se(e, typeof t != "symbol" ? t + "" : t, n); -import { readCmsParts as ne, withSignerCertificate as Ie, parseCmsInternal as K, certDer as C, certificateFromDer as D } from "./parse-Cv_kCMGz.js"; -import { parseDetachedCms as Xt } from "./parse-Cv_kCMGz.js"; -import { r as Re, c as xe, v as De, a as se, b as Ee } from "./timestamp-DdhyGESj.js"; -import { aR as x, b0 as _, t as E, b8 as R, bz as I, bA as $e, aW as v, bB as k, bC as b, f as M, bD as Oe, bE as Pe, bF as Be, b5 as Ve, bG as Ne, bH as Ue, O as je, bI as Fe, b1 as Me, b2 as Le, aS as qe } from "./wasm-url-asset-sqnq1cad.js"; -import { bJ as Zt, bK as Jt, bL as Qt, bM as en, bN as tn, bO as nn, bP as sn, bQ as rn, bR as an, bS as on, bT as cn } from "./wasm-url-asset-sqnq1cad.js"; -import { C as P } from "./error-CbfoSMwv.js"; -import { certificateCommonName as U } from "./self-signed-DIdbaT2K.js"; -import { selfSignedCertificate as dn } from "./self-signed-DIdbaT2K.js"; -import { a as _e, e as X, r as ze, c as Ke } from "./splice-DZQMGiQI.js"; -function H(e) { - return new Uint8Array(e.signature.getValue()); -} -async function $(e) { - const t = x(); - let n, s; - try { - n = ne(e.token, "tst-info", { certificates: e.certificates }), s = Re(n.eContent); - } catch (h) { - return { verdict: "unsupported", problem: "unreadable", detail: h instanceof P ? h.message : String(h), info: null, token: null }; - } - const r = Ie(n), i = (h, f, u) => ({ verdict: h, problem: f, detail: u, info: s, token: r }), { stamped: a } = e; - if (a.kind === "digest" && s.imprintAlgorithm !== a.algorithm) - return i( - "invalid", - "imprint-algorithm", - `the token stamps a ${s.imprintAlgorithm} digest, not the ${a.algorithm} digest it was given` - ); - const o = a.kind === "digest" ? a.digest : a.kind === "digest-with" ? await a.digest(s.imprintAlgorithm) : new Uint8Array( - await t.digest( - _[s.imprintAlgorithm], - E(a.bytes) - ) - ); - if (!R(s.imprint, o)) - return i("invalid", "imprint", "the token's message imprint is not the stamped digest"); - const d = new Uint8Array( - await t.digest(_[n.digestAlgorithm], E(n.eContent)) - ); - if (!R(d, n.messageDigest)) - return i( - "invalid", - "message-digest", - "the token's message digest does not cover its TSTInfo" - ); - if (!r) - return i( - "unsupported", - "no-certificate", - "the token's authority certificate is not carried by the token or by the signature it is in" - ); - const c = await xe(r); - if (c === "invalid") - return i( - "invalid", - "binding", - "the token's certificate binding names another certificate than the one that signed it" - ); - const l = await De(r); - return l === "invalid" ? i("invalid", "signature", "the token signature does not verify") : l === "unsupported" ? i( - "unsupported", - "unsupported-algorithm", - "the token's signature algorithm is not supported" - ) : c === "absent" ? i( - "unsupported", - "no-binding", - "the token does not bind its authority's certificate, which RFC 3161 requires" - ) : c === "unsupported" ? i( - "unsupported", - "unsupported-algorithm", - "the token's certificate binding uses a hash that is not supported" - ) : { verdict: "valid", problem: null, detail: null, info: s, token: r }; -} -const Y = 4096, He = 4 * 1024 * 1024; -async function We(e) { - const { cms: t, prepared: n, profile: s } = e; - if (t.byteLength > n.contentsSizeBytes) - return { - ok: !1, - reason: "too-large", - detail: `the signature is ${t.byteLength} bytes and ${n.contentsSizeBytes} were reserved: ${Ge(t.byteLength)}` - }; - if (s === "timestamp") return Xe(t, n); - let r; - try { - r = K(t); - } catch (d) { - return { - ok: !1, - reason: "malformed", - detail: d instanceof P ? d.message : String(d) - }; - } - const i = r.parsed; - if (i.digestAlgorithm !== n.algorithm) - return { - ok: !1, - reason: "algorithm-mismatch", - detail: `the CMS digests with ${i.digestAlgorithm}, the document was prepared with ${n.algorithm}` - }; - if (!R(i.messageDigest, n.digest)) - return { - ok: !1, - reason: "digest-mismatch", - detail: "the CMS message digest is not the prepared digest" - }; - if (s === "cades-b") { - if (!i.signingCertificateV2) - return { - ok: !1, - reason: "profile-violation", - detail: "CAdES requires the ESS signing-certificate-v2 attribute" - }; - if (i.signingTime) - return { - ok: !1, - reason: "profile-violation", - detail: "PAdES forbids the CMS signing-time attribute" - }; - } - const a = await se(r); - if (a !== "valid") - return { - ok: !1, - reason: "signature-invalid", - detail: a === "unsupported" ? "the signature or its certificate binding uses an algorithm that is not supported" : "the signature does not verify" - }; - const o = H(r.signerInfo); - for (const d of r.timestampTokens) { - const c = await $({ - token: d, - stamped: { kind: "bytes", bytes: o }, - certificates: r.certificates - }); - if (c.verdict === "invalid") - return { - ok: !1, - reason: c.problem === "imprint" ? "digest-mismatch" : "signature-invalid", - detail: `the signature's timestamp does not belong to it: ${c.detail}` - }; - } - return { ok: !0 }; -} -function Ge(e) { - const t = Math.ceil(e / Y) * Y; - return t > He ? "that is more than a signature may reserve" : `pass \`contentsSizeBytes: ${t}\``; -} -async function Xe(e, t) { - const n = await $({ - token: e, - stamped: { kind: "digest", digest: t.digest, algorithm: t.algorithm } - }); - if (n.verdict === "valid") return { ok: !0 }; - switch (n.problem) { - case "unreadable": - return { ok: !1, reason: "malformed", detail: n.detail }; - case "no-certificate": - return { - ok: !1, - reason: "malformed", - detail: "the token does not carry its authority's certificate" - }; - case "imprint-algorithm": - return { - ok: !1, - reason: "algorithm-mismatch", - detail: `the token stamps a ${n.info.imprintAlgorithm} digest, the document was prepared with ${t.algorithm}` - }; - case "imprint": - return { - ok: !1, - reason: "digest-mismatch", - detail: "the token's message imprint is not the prepared digest" - }; - default: - return { ok: !1, reason: "signature-invalid", detail: n.detail }; - } -} -async function Lt(e, t, n = { kind: "now" }) { - return ie(e, t, n, []); -} -async function ie(e, t, n, s) { - if (!t) return { status: "unknown", reason: "no trust anchors configured" }; - const r = await t.anchors(); - if (r.length === 0) return { status: "unknown", reason: "no trust anchors configured" }; - x(); - let i; - try { - i = e instanceof Uint8Array ? K(e) : e; - } catch (a) { - return { status: "untrusted", reason: a.message }; - } - return oe({ - target: i.signerCertificate, - candidates: [...i.certificates, ...s], - anchors: r, - at: V(n) - }); -} -async function re(e) { - const { token: t, trust: n, genTime: s } = e; - if (!n) return { status: "unknown", reason: "no trust anchors configured" }; - const r = n.timestampAnchors ? await n.timestampAnchors() : await n.anchors(); - if (r.length === 0) - return { - status: "unknown", - reason: n.timestampAnchors ? "no timestamp anchors configured" : "no trust anchors configured" - }; - x(); - const i = t.signerCertificate, a = Ze(i); - if (a) return { status: "untrusted", reason: a }; - if (!Z(i, s)) - return { - status: "untrusted", - reason: "the token is dated outside its authority certificate's validity" - }; - const o = V(e.at ?? { kind: "now" }), d = C(i); - return r.some((c) => R(c, d)) ? Z(i, o) ? { status: "trusted", path: [d] } : { - status: "untrusted", - reason: "the authority's certificate is not valid at the time it is judged" - } : oe({ - target: i, - candidates: [...t.certificates, ...e.certificates ?? []], - anchors: r, - at: o - }); -} -function V(e) { - return e.kind === "now" ? /* @__PURE__ */ new Date() : new Date(ae(e)); -} -function Ye(e) { - if (e.kind === "now") return { kind: "now" }; - const t = ae(e); - return { kind: "timestamp", stampedAt: t, genTime: t, tokenVerified: !0 }; -} -function ae(e) { - return e.stampedAt === void 0 ? e.genTime : e.stampedAt; -} -function Z(e, t) { - return e.notBefore.value <= t && t <= e.notAfter.value; -} -function Ze(e) { - const t = e.extensions?.find( - (s) => s.extnID === v.extendedKeyUsage - ); - if (!t) - return "the authority's certificate has no extended key usage, so it is not made for timestamping"; - const n = t.parsedValue?.keyPurposes ?? []; - return n.includes(v.timeStamping) ? n.length > 1 ? "the authority's certificate allows other uses besides timestamping" : t.critical ? null : "the authority's certificate does not mark its timestamping purpose as critical" : "the authority's certificate does not allow timestamping"; -} -async function oe(e) { - const { target: t, at: n } = e, s = C(t), r = (d) => R(d, s), i = /* @__PURE__ */ new Map(); - for (const d of e.candidates) { - const c = C(d), l = I(c); - !r(c) && !i.has(l) && i.set(l, d); - } - const a = [...i.values()], o = e.anchors.some(r); - try { - const d = e.anchors.filter((f) => !r(f)).map(D), l = await new $e({ - certs: o ? [t] : [...a, t], - trustedCerts: o ? [...d, t] : d, - checkDate: n - }).verify(); - if (!l.result) { - const f = Je(t, [...a, ...d]); - return { - status: "untrusted", - reason: f ? `no certificate was found that issued "${Qe(f)}"` : l.resultMessage || `chain validation code ${l.resultCode}`, - ...f ? { withoutIssuer: C(f) } : {} - }; - } - const h = l.certificatePath ?? []; - return h.length === 0 || !r(C(h[0])) ? { - status: "untrusted", - reason: "the validated path does not begin with the certificate that signed" - } : { status: "trusted", path: h.map(C) }; - } catch (d) { - return { status: "untrusted", reason: d.message }; - } -} -function Je(e, t) { - const n = /* @__PURE__ */ new Set(); - let s = e; - for (; !n.has(s); ) { - if (n.add(s), s.issuer.isEqual(s.subject)) return null; - const r = t.find((i) => i.subject.isEqual(s.issuer)); - if (!r) return s; - s = r; - } - return null; -} -function Qe(e) { - return U(C(e)) ?? "a certificate without a common name"; -} -function N(e, t) { - return new k( - b.SignatureRefused, - `signing refused (${e}): ${t}`, - { details: { reason: e } } - ); -} -const et = new Uint8Array([ - 6, - 11, - 42, - 134, - 72, - 134, - 247, - 13, - 1, - 9, - 16, - 2, - 14 -]); -async function tt(e) { - const { cms: t, authority: n } = e; - let s; - try { - s = ne(t); - } catch (d) { - throw N("malformed", d instanceof P ? d.message : String(d)); - } - if (s.timestampTokens.length > 0) - throw new k( - b.InvalidArg, - "the signature already carries a timestamp, from the service that signed it; leave out `timestampAuthority`", - { details: { field: "timestampAuthority" } } - ); - const r = n.hash ?? "sha256", i = new Uint8Array( - await x().digest( - _[r], - E(H(s.signerInfo)) - ) - ), a = await n.sign({ digest: i, algorithm: r, subFilter: "ETSI.RFC3161" }), o = await $({ - token: a, - stamped: { kind: "digest", digest: i, algorithm: r }, - certificates: s.certificates - }); - if (o.verdict !== "valid") - throw N(st(o.problem), `the timestamp: ${it(o)}`); - e.trust && await ce(o, e.trust, s.certificates); - try { - return _e(t, nt(a)); - } catch (d) { - throw N("malformed", d instanceof P ? d.message : String(d)); - } -} -async function ce(e, t, n = []) { - const s = await re({ - token: e.token, - certificates: n, - trust: t, - genTime: e.info.genTime - }); - if (s.status === "trusted") return; - const r = U(e.token.parsed.signerCertificate); - throw new k( - b.SignatureRefused, - `the timestamp's authority${r ? ` ("${r}")` : ""} isn't trusted: ${s.reason ?? "no path to a timestamp anchor"}. Add its root to \`timestampAnchors\``, - { details: { trust: s.status, trustReason: s.reason ?? null } } - ); -} -function nt(e) { - return X( - 48, - new Uint8Array([...et, ...X(49, e)]) - ); -} -function st(e) { - switch (e) { - case "unreadable": - return "malformed"; - case "imprint": - return "digest-mismatch"; - case "imprint-algorithm": - return "algorithm-mismatch"; - default: - return "signature-invalid"; - } -} -function it(e) { - return e.problem === "unreadable" ? `\`timestampAuthority\` didn't return an RFC 3161 token (${e.detail}): is it a signing service?` : e.detail; -} -const rt = 16384; -function ue(e) { - switch (e) { - case "adbe.pkcs7.detached": - return "pkcs7"; - case "ETSI.CAdES.detached": - return "cades-b"; - case "ETSI.RFC3161": - return "timestamp"; - default: - throw new k( - b.InvalidArg, - `unknown subFilter '${String(e)}'`, - { - details: { field: "subFilter" } - } - ); - } -} -async function qt(e, t) { - const { key: n, timestampAuthority: s, timestampTrust: r, afterPrepare: i, ...a } = t, o = a.kind === "timestamp"; - if (o && n.kind !== "cms") - throw new k( - b.InvalidArg, - "a document timestamp needs a timestamp authority: a CMS key that returns an RFC 3161 token", - { details: { field: "key" } } - ); - de(o, s, r); - const d = o ? "ETSI.RFC3161" : a.subFilter ?? "ETSI.CAdES.detached", c = ue(d), l = await e.signatures.prepare({ - ...a, - ...o ? {} : { subFilter: d }, - digest: a.digest ?? n.hash ?? "sha256", - // A token is commonly 1.5 to 6 KB: the default reserve would fail late, after the key signed. - ...s && a.contentsSizeBytes === void 0 ? { contentsSizeBytes: rt } : {} - }); - try { - await i?.(l); - const h = await at(n, l, d, c); - return await le(e, { prepared: l, cms: h, timestampAuthority: s, timestampTrust: r }); - } catch (h) { - throw await e.signatures.cancel(l.signingId).catch(() => { - }), h; - } -} -async function _t(e, t) { - de( - t.prepared.subFilter === "ETSI.RFC3161", - t.timestampAuthority, - t.timestampTrust - ); - try { - return await le(e, t); - } catch (n) { - throw k.is(n, b.SignatureRefused) ? new k( - b.SignatureRefused, - `${n.message}. The signing stays prepared, and this CMS will be refused again: cancel it and prepare again`, - { details: n.details, cause: n } - ) : n; - } -} -function de(e, t, n) { - if (e && t) - throw new k( - b.InvalidArg, - "a document timestamp is already a timestamp; leave out `timestampAuthority`", - { details: { field: "timestampAuthority" } } - ); - if (n && !t && !e) - throw new k( - b.InvalidArg, - "`timestampTrust` judges a timestamp's authority; pass `timestampAuthority` too", - { details: { field: "timestampTrust" } } - ); -} -async function le(e, t) { - const { prepared: n, timestampAuthority: s } = t, r = ue(n.subFilter), i = async (o) => { - const d = await We({ cms: o, prepared: n, profile: r }); - if (!d.ok) throw N(d.reason, d.detail); - }; - let a = t.cms; - if (await i(a), r === "timestamp" && t.timestampTrust) { - const o = await $({ - token: a, - stamped: { kind: "digest", digest: n.digest, algorithm: n.algorithm } - }); - if (o.verdict !== "valid") throw N("malformed", "the timestamp token"); - await ce(o, t.timestampTrust); - } - return s && (a = await tt({ - cms: a, - authority: s, - trust: t.timestampTrust - }), await i(a)), e.signatures.complete({ - signingId: n.signingId, - cms: a, - expectedVersion: n.expectedVersion - }); -} -async function at(e, t, n, s) { - if (e.kind === "cms") - return e.sign({ digest: t.digest, algorithm: t.algorithm, subFilter: n }); - if (s === "timestamp") - throw new k(b.InvalidArg, "a raw key cannot make a timestamp token"); - return Ee({ - digest: t.digest, - hash: t.algorithm, - profile: s, - signer: e, - signingTime: s === "pkcs7" ? (/* @__PURE__ */ new Date()).toISOString() : void 0 - }); -} -const ot = 6; -function J(e) { - const t = { ocsp: [], crl: [], issuer: [] }, n = (i) => e.extensions?.find((a) => a.extnID === i)?.parsedValue, s = n(v.authorityInfoAccess); - for (const i of s?.accessDescriptions ?? []) { - const a = Q(i.accessLocation); - a && (i.accessMethod === v.accessOcsp && t.ocsp.push(a), i.accessMethod === v.accessIssuers && t.issuer.push(a)); - } - const r = n(v.crlDistributionPoints); - for (const i of r?.distributionPoints ?? []) { - if (i.reasons || i.cRLIssuer) continue; - const a = Array.isArray(i.distributionPoint) ? i.distributionPoint : []; - for (const o of a) { - const d = Q(o); - d && t.crl.push(d); - } - } - return t; -} -function ct(e) { - const t = (i) => e.extensions?.find((a) => a.extnID === i); - if (t(v.basicConstraints)?.parsedValue?.cA) return !1; - if (t(v.validityAssuredShortTerm)) return !0; - if (!t(v.noRevAvail)) return !1; - const s = t(v.authorityInfoAccess)?.parsedValue; - return !(t(v.crlDistributionPoints) !== void 0 || t(v.freshestCrl) !== void 0 || (s?.accessDescriptions ?? []).some( - (i) => i.accessMethod === v.accessOcsp - )); -} -function Q(e) { - return e.type !== ot || typeof e.value != "string" ? null : /^https?:\/\//i.test(e.value) ? e.value : null; -} -const fe = { - 0: "unspecified", - 1: "key-compromise", - 2: "ca-compromise", - 3: "affiliation-changed", - 4: "superseded", - 5: "cessation-of-operation", - 6: "certificate-hold", - 8: "remove-from-crl", - 9: "privilege-withdrawn", - 10: "aa-compromise" -}; -async function me(e) { - x(); - const { answer: t, certificate: n, issuer: s } = e, r = (i, a) => ({ - says: "nothing", - kind: t.kind, - problem: i, - detail: a - }); - if (!n.issuer.isEqual(s.subject)) - return r("other-certificate", "the certificate was not issued by the issuer given"); - try { - return t.kind === "ocsp" ? await dt(t.der, n, s, r) : await ht(t.der, n, s, r); - } catch (i) { - return r("unreadable", i.message); - } -} -const ut = { - 1: "malformed request", - 2: "internal error", - 3: "try later", - 5: "a signed request is required", - 6: "unauthorized" -}; -async function dt(e, t, n, s) { - const r = x(), i = M(E(e)); - if (i.offset === -1) return s("unreadable", "the OCSP response is not valid DER"); - const a = new Oe({ schema: i.result }), o = a.responseStatus.valueBlock.valueDec; - if (o !== 0) - return s( - "not-successful", - `the responder answered "${ut[o] ?? `status ${o}`}"` - ); - const d = a.responseBytes; - if (!d) return s("unreadable", "the OCSP response carries no answer"); - if (d.responseType !== v.ocspBasic) - return s("unsupported", `OCSP response type ${d.responseType}`); - const c = M(d.response.valueBlock.valueHexView); - if (c.offset === -1) return s("unreadable", "the OCSP answer is not valid DER"); - const l = new Pe({ schema: c.result }), h = l.tbsResponseData; - let f = null, u = null; - for (const w of h.responses) { - const A = r.getAlgorithmByOID(w.certID.hashAlgorithm.algorithmId, !1); - if (!("name" in A) || typeof A.name != "string") { - u = w.certID.hashAlgorithm.algorithmId; - continue; - } - const S = new Be(); - if (await S.createForCertificate(t, { - hashAlgorithm: A.name, - issuerCertificate: n - }), w.certID.isEqual(S)) { - f = w; - break; - } - } - if (!f) - return u ? s("unsupported", `the answer identifies its certificate with hash ${u}`) : s("other-certificate", "the OCSP response is about another certificate"); - const m = await lt(h.responderID, [n, ...l.certs ?? []]); - if (!m) - return s("wrong-signer", "the responder's certificate is not in the response"); - const g = ft(m, n); - if (!g) { - const w = await mt(m, n, h.producedAt); - if (w) return s("wrong-signer", w); - } - const p = await he( - h.tbsView, - l.signature, - m.subjectPublicKeyInfo, - l.signatureAlgorithm - ); - if (p === "unsupported") - return s( - "unsupported", - `signature algorithm ${l.signatureAlgorithm.algorithmId} of the OCSP response` - ); - if (p === "invalid") - return s("signature", "the OCSP response's signature does not verify"); - const y = { - kind: "ocsp", - thisUpdate: f.thisUpdate, - nextUpdate: f.nextUpdate ?? null, - responder: g ? null : C(m) - }, T = f.certStatus; - switch (T.idBlock.tagNumber) { - case 0: - return { says: "good", ...y }; - case 1: { - const [w, A] = T.valueBlock.value; - if (!(w instanceof Ve)) - return s("unreadable", "the OCSP response names no revocation time"); - const S = A?.valueBlock.value[0]?.valueBlock.valueDec; - return { - says: "revoked", - revokedAt: w.toDate(), - reason: S === void 0 ? null : fe[S] ?? null, - ...y - }; - } - default: - return s("unknown-status", "the responder does not know the certificate"); - } -} -async function lt(e, t) { - const n = x(); - for (const s of t) - if (e instanceof Ue) { - if (s.subject.isEqual(e)) return s; - } else if (e instanceof je) { - const r = s.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView, i = new Uint8Array(await n.digest("SHA-1", E(r))); - if (R(i, new Uint8Array(e.valueBlock.valueHexView))) return s; - } - return null; -} -function ft(e, t) { - return R(C(e), C(t)); -} -async function mt(e, t, n) { - if (!e.issuer.isEqual(t.subject)) - return "the responder's certificate was not issued by the certificate's issuer"; - let s = !1; - try { - s = await e.verify(t); - } catch { - s = !1; - } - return s ? (e.extensions?.find( - (a) => a.extnID === v.extendedKeyUsage - )?.parsedValue?.keyPurposes ?? []).includes(v.ocspSigning) ? n < e.notBefore.value || n > e.notAfter.value ? "the responder's certificate was outside its dates when it answered" : null : "the responder's certificate is not made for answering about certificates" : "the responder's certificate is not signed by the certificate's issuer"; -} -async function ht(e, t, n, s) { - const r = M(E(e)); - if (r.offset === -1) return s("unreadable", "the CRL is not valid DER"); - const i = new Ne({ schema: r.result }); - if (!i.issuer.isEqual(n.subject)) - return s("other-certificate", "the CRL is not from the certificate's issuer"); - for (const f of i.crlExtensions?.extensions ?? []) { - if (f.extnID === v.deltaCrlIndicator) - return s("delta-crl", "the CRL lists only what changed since another list"); - if (f.extnID === v.issuingDistributionPoint) { - const u = f.parsedValue; - if (!u) return s("unreadable", "the CRL's scope cannot be read"); - if (u.indirectCRL) - return s("indirect-crl", "the CRL lists certificates of other issuers"); - const m = pt(t); - if (u.onlyContainsAttributeCerts || u.onlyContainsUserCerts && m || u.onlyContainsCACerts && !m || u.onlySomeReasons !== void 0) - return s("out-of-scope", "the CRL does not cover this kind of certificate"); - } else if (f.critical && !gt.has(f.extnID)) - return s("unsupported", `critical CRL extension ${f.extnID}`); - } - if (!wt(n)) - return s("wrong-signer", "the issuer's certificate is not made for signing CRLs"); - const a = await he( - i.tbsView, - i.signatureValue, - n.subjectPublicKeyInfo, - i.signatureAlgorithm - ); - if (a === "unsupported") - return s("unsupported", `signature algorithm ${i.signatureAlgorithm.algorithmId}`); - if (a === "invalid") return s("signature", "the CRL's signature does not verify"); - const o = { - kind: "crl", - thisUpdate: i.thisUpdate.value, - nextUpdate: i.nextUpdate?.value ?? null, - responder: null - }, d = ee(t.serialNumber), c = (i.revokedCertificates ?? []).find( - (f) => R(ee(f.userCertificate), d) - ); - if (!c) return { says: "good", ...o }; - const h = c.crlEntryExtensions?.extensions.find( - (f) => f.extnID === v.crlReason - )?.parsedValue?.valueBlock.valueDec; - return { - says: "revoked", - revokedAt: c.revocationDate.value, - reason: h === void 0 ? null : fe[h] ?? null, - ...o - }; -} -const gt = /* @__PURE__ */ new Set([ - v.crlNumber, - v.authorityKeyIdentifier, - v.authorityInfoAccess, - v.freshestCrl -]); -function pt(e) { - return e.extensions?.find( - (n) => n.extnID === v.basicConstraints - )?.parsedValue?.cA === !0; -} -function wt(e) { - const t = e.extensions?.find((s) => s.extnID === v.keyUsage); - if (!t) return !0; - const n = t.parsedValue?.valueBlock.valueHexView; - return n !== void 0 && n.length > 0 && (n[0] & 2) !== 0; -} -function ee(e) { - const t = new Uint8Array(e.valueBlock.valueHexView); - let n = 0; - for (; n < t.length - 1 && t[n] === 0; ) n++; - return t.subarray(n); -} -async function he(e, t, n, s) { - try { - return await x().verifyWithPublicKey( - E(e), - t, - n, - s - ) ? "valid" : "invalid"; - } catch (r) { - const i = r.message ?? ""; - return /unsupported|unknown|not supported|not implemented|incorrect/i.test(i) ? "unsupported" : "invalid"; - } -} -const vt = 300 * 1e3; -function yt(e, t) { - const n = t.getTime(); - let s = null, r = null; - for (const i of e) { - if (i.says === "nothing") continue; - if (i.says === "revoked") { - i.revokedAt.getTime() <= n ? (!r || i.revokedAt < r.revokedAt) && (r = i) : s ?? (s = i); - continue; - } - const a = i.thisUpdate.getTime(), o = i.nextUpdate ? i.nextUpdate.getTime() : a + vt; - (a >= n || n <= o) && (s ?? (s = i)); - } - return r ? { status: "revoked", answer: r } : s ? { status: "good", answer: s } : { status: "unknown", answer: null }; -} -class ge { - constructor() { - j(this, "certificateByDer", /* @__PURE__ */ new Map()); - j(this, "answerByDer", /* @__PURE__ */ new Map()); - /** What each answer says about one certificate, in the order the answers were offered. */ - j(this, "checked", /* @__PURE__ */ new Map()); - } - /** Every certificate offered, each once. */ - get certificates() { - return [...this.certificateByDer.values()].map((t) => t.certificate); - } - /** - * Offer a certificate. Bytes that are not a certificate are left out, and false comes back. - * `inFile` is false for one that came from outside the file. - */ - addCertificate(t, n = !0) { - try { - const s = t instanceof Uint8Array ? t : C(t), r = I(s); - return this.certificateByDer.has(r) || this.certificateByDer.set(r, { - certificate: t instanceof Uint8Array ? D(t) : t, - inFile: n - }), !0; - } catch { - return !1; - } - } - /** - * Offer an answer as it was stored or sent. It is checked when it is asked about a - * certificate. `inFile` is false for one that came from outside the file. - */ - addAnswer(t, n, s = !0) { - const r = `${t}:${I(n)}`; - let i = this.answerByDer.get(r); - return i || (i = { kind: t, der: n, inFile: s }, this.answerByDer.set(r, i)), i; - } - /** Offer what a CMS carries itself: its certificates and its answers. */ - addCarried(t, n) { - for (const s of t) this.addCertificate(s); - for (const s of n.ocspResponses) this.addAnswer("ocsp", s); - for (const s of n.crls) this.addAnswer("crl", s); - } - /** - * What each answer says about `certificate`, which `issuer` issued. Each answer is checked - * once, also when more answers are offered between two calls. - */ - async checksFor(t, n) { - const s = `${I(C(t))}:${I(C(n))}`, r = [...this.answerByDer.values()], i = this.checked.get(s) ?? []; - for (let o = i.length; o < r.length; o++) - i.push(me({ answer: r[o], certificate: t, issuer: n })); - this.checked.set(s, i); - const a = await Promise.all(i); - return r.map((o, d) => ({ answer: o, check: a[d] })); - } -} -async function pe(e) { - const t = new ge(); - if (typeof e.signatures?.getValidationInfo != "function") return t; - try { - const n = await e.signatures.getValidationInfo(); - for (const s of n.certificates) t.addCertificate(s); - for (const s of n.ocspResponses) t.addAnswer("ocsp", s); - for (const s of n.crls) t.addAnswer("crl", s); - } catch (n) { - if (!k.is(n, b.NotImplemented)) throw n; - } - return t; -} -async function O(e, t, n, s = "anywhere") { - const r = t.filter((o, d) => d === 0 || !R(o, t[d - 1])), i = r.map(D), a = []; - for (let o = 0; o + 1 < i.length; o++) { - if (ct(i[o])) continue; - const d = (await e.checksFor(i[o], i[o + 1])).filter( - (l) => s === "anywhere" || l.answer.inFile - ), c = yt( - d.map((l) => l.check), - n - ); - a.push({ - certificate: r[o], - name: U(r[o]), - issuer: r[o + 1], - evidence: d.find((l) => l.check === c.answer)?.answer ?? null, - ...c - }); - } - return a; -} -function we(e, t) { - const n = (i) => `"${i.name ?? "a certificate without a name"}"`, s = e.find((i) => i.status === "revoked"); - if (s) { - const i = s.answer, a = i?.says === "revoked" ? ` on ${i.revokedAt.toISOString()}` : "", o = i?.says === "revoked" && i.reason ? ` (${i.reason})` : ""; - return { status: "revoked", reason: `${n(s)} was withdrawn${a}${o}` }; - } - const r = e.find((i) => i.status === "unknown"); - return r ? { status: "unknown", reason: `no answer about ${n(r)} speaks for ${t}` } : { status: "good", reason: null }; -} -const F = { kind: "now" }, B = { kind: "earliest-timestamp" }; -async function L(e, t, n, s) { - const r = s.kind === "earliest-timestamp", i = [], a = (c) => !r || c === null ? null : i.filter((l) => l.revisionIndex > c).reduce( - (l, h) => !l || h.genTime < l.genTime ? h : l, - null - ), o = /* @__PURE__ */ new Map(), d = e.filter((c) => c.kind === "timestamp").sort((c, l) => (l.signature.revisionIndex ?? -1) - (c.signature.revisionIndex ?? -1)); - for (const c of d) { - const l = a(c.signature.revisionIndex), h = l ? q(l.genTime) : F, f = c.token ? await z(c.token, t, h, n) : null, u = f?.verdict ?? null, m = c.signature.revisionIndex, g = f && c.integrity === "valid" ? te(f) : null; - g && m !== null && i.push({ ...g, revisionIndex: m }), o.set(c, { - trust: u?.trust ?? "unknown", - trustReason: u?.trustReason ?? void 0, - validationTime: h, - path: f?.path ?? null, - revocation: u?.revocation ?? "unknown", - revocationReason: u?.revocationReason ?? void 0, - timestamp: u, - reliesOn: g, - // A sound token over these bytes whose authority isn't trusted proves no time to you. - withoutTime: u && c.integrity === "valid" && u.cryptography === "valid" ? "untrusted" : "no-timestamp", - timestampPath: null, - withoutIssuer: f?.withoutIssuer ? [f.withoutIssuer] : [] - }); - } - for (const c of e) { - if (c.kind === "timestamp") continue; - const l = a(c.signature.revisionIndex), h = []; - for (const w of c.tokens) - h.push( - await z( - w, - t, - l ? q(l.genTime) : F, - n, - c.internal?.certificates - ) - ); - const f = Ct(h), u = (f ?? h[0])?.verdict ?? null, m = f ? te(f) : null, g = r ? m && l ? m.genTime <= l.genTime ? m : l : m ?? l : null, p = r ? g ? q(g.genTime) : F : Ye(s), y = c.internal ? await ie(c.internal, t, p, n.certificates) : { - status: "unknown", - reason: void 0, - path: void 0, - withoutIssuer: void 0 - }, T = y.status === "trusted" && y.path ? we(await O(n, y.path, V(p)), ye(p)) : { status: "unknown", reason: kt }; - o.set(c, { - trust: y.status, - trustReason: y.reason, - validationTime: p, - path: y.status === "trusted" ? y.path ?? null : null, - revocation: T.status, - revocationReason: T.reason ?? void 0, - timestamp: u, - reliesOn: g, - withoutTime: "no-timestamp", - timestampPath: (f ?? h[0])?.path ?? null, - withoutIssuer: [ - ...y.withoutIssuer ? [y.withoutIssuer] : [], - ...h.flatMap((w) => w.withoutIssuer ? [w.withoutIssuer] : []) - ] - }); - } - return { judgements: o, documentTimestamps: i }; -} -const kt = "the signer is not trusted, so there is no issuer to check an answer against"; -function ve(e, t, n, s, r) { - return { - kind: e.kind, - revisionIndex: e.signature.revisionIndex, - subject: e.cms ? U(e.cms.signerCertificate) : null, - reliesOn: t.reliesOn, - withoutTime: t.withoutTime, - signer: { trusted: t.trust === "trusted", path: t.path }, - documentTimestamps: n, - pool: s, - answersFrom: r - }; -} -function ye(e) { - return e.kind === "now" ? "now" : e.stampedAt; -} -function te(e) { - const { verdict: t, path: n } = e; - return t.summary !== "valid" || !n ? null : { genTime: t.stampedAt, path: n, authorityCertificate: t.authorityCertificate }; -} -async function ke(e, t, n, s) { - const r = { - signature: n, - kind: n.kind, - integrity: "indeterminate", - cryptography: "unsupported", - internal: null, - cms: null, - tokens: [], - token: null - }; - if (!t.chainValid || n.coverage === "malformed") - return r.integrity = t.chainValid ? "invalid" : "indeterminate", r; - const i = n.kind === "timestamp" ? await At(e, n, r) : await bt(e, n, r); - i.internal && s.addCarried(i.internal.certificates, i.internal.revocation); - for (const a of [...i.tokens, ...i.token ? [i.token] : []]) - a.token && s.addCarried(a.token.certificates, a.token.revocation); - return i; -} -async function bt(e, t, n) { - let s; - try { - const i = await e.signatures.getContents(t.field); - s = K(i), n.cms = s.parsed; - const a = await e.signatures.getDigest(t.field, s.digestAlgorithm), o = R(a, s.messageDigest); - n.integrity = t.coverage === "whole-revision" && o ? "valid" : "invalid"; - } catch (i) { - return n.integrity = i instanceof P && i.reason === "unsupported" ? "indeterminate" : "invalid", i instanceof P || (n.integrity = "indeterminate"), n; - } - n.internal = s, n.cryptography = await se(s); - const r = H(s.signerInfo); - for (const i of s.timestampTokens) - n.tokens.push( - await $({ - token: i, - stamped: { kind: "bytes", bytes: r }, - certificates: s.certificates - }) - ); - return n; -} -async function At(e, t, n) { - let s; - try { - s = await e.signatures.getContents(t.field); - } catch { - return n; - } - const r = await $({ - token: s, - stamped: { - kind: "digest-with", - digest: (a) => e.signatures.getDigest(t.field, a) - } - }).catch(() => null); - if (!r || (n.token = r, n.cms = r.token?.parsed ?? null, r.problem === "unreadable")) return n; - const i = r.problem !== "imprint"; - return n.integrity = t.coverage === "whole-revision" && i ? "valid" : "invalid", n.cryptography = i ? r.verdict : (await $({ - token: s, - stamped: { - kind: "digest", - digest: r.info.imprint, - algorithm: r.info.imprintAlgorithm - } - })).verdict, n; -} -async function z(e, t, n, s, r = []) { - const i = e.info ? e.info.genTime.toISOString() : null, a = e.token ? e.token.parsed.signerCertificate : null; - let o = "unknown", d = e.detail, c = null, l = null; - if (e.token && e.info) { - const m = await re({ - token: e.token, - certificates: [...r, ...s.certificates], - trust: t, - at: n, - genTime: e.info.genTime - }); - o = m.status, d = m.reason ?? null, c = m.status === "trusted" ? m.path ?? null : null, l = m.withoutIssuer ?? null; - } - const h = c ? we(await O(s, c, V(n)), ye(n)) : { - status: "unknown", - reason: "the authority is not trusted, so there is no issuer to check an answer against" - }, f = { - cryptography: e.verdict, - trust: o, - trustReason: d, - validationTime: n, - revocation: h.status, - revocationReason: h.reason, - authorityName: a ? U(a) : null - }, u = o === "trusted" && h.status === "revoked"; - return e.verdict === "valid" && !u && i !== null && a !== null ? { - verdict: { - ...f, - summary: o === "trusted" ? "valid" : "valid-untrusted", - stampedAt: i, - authorityCertificate: a - }, - path: c, - withoutIssuer: l - } : { - verdict: { - ...f, - summary: e.verdict === "invalid" || u ? "invalid" : "indeterminate", - stampedAt: i, - authorityCertificate: a - }, - path: c, - withoutIssuer: l - }; -} -function q(e) { - return { kind: "timestamp", stampedAt: e, genTime: e, tokenVerified: !0 }; -} -function Ct(e) { - let t = null; - for (const n of e) - n.verdict.summary === "valid" && (!t || n.verdict.stampedAt < t.verdict.stampedAt) && (t = n); - return t; -} -async function Tt(e) { - return (await be(e)).verdict; -} -async function be(e) { - const t = e.revisionIndex === null ? [] : e.documentTimestamps.filter((f) => f.revisionIndex > e.revisionIndex), n = (f) => f.reduce( - (u, m) => !u || m.genTime > u.genTime ? m : u, - null - ), s = n(t)?.genTime ?? null, r = (f, u, m = []) => ({ - verdict: { - enabled: !1, - provenAt: f, - expiresAt: null, - documentTimestampedAt: s, - missing: u.map(({ certificate: g, reason: p }) => ({ certificate: g, reason: p })) - }, - rows: m, - gaps: u - }), i = e.reliesOn; - if (!i) - return r(null, [{ certificate: e.subject, reason: e.withoutTime, der: null }]); - if (e.kind === "signature" && (!e.signer.trusted || !e.signer.path)) - return r(i.genTime, [ - { certificate: e.subject, reason: "untrusted", der: null } - ]); - const a = new Date(i.genTime), o = [ - ...e.kind === "signature" ? await O(e.pool, e.signer.path, a, e.answersFrom) : [], - ...await O(e.pool, i.path, a, e.answersFrom) - ], d = /* @__PURE__ */ new Set(), c = o.filter((f) => { - const u = I(f.certificate); - return d.has(u) ? !1 : (d.add(u), !0); - }), l = c.filter((f) => f.status !== "good").map((f) => ({ - certificate: f.name, - reason: f.status === "revoked" ? "revoked" : "no-answer", - der: f.certificate - })); - if (l.length > 0) return r(i.genTime, l, c); - const h = n([i, ...t]); - return { - verdict: { - enabled: !0, - provenAt: i.genTime, - expiresAt: D(h.authorityCertificate).notAfter.value.toISOString(), - documentTimestampedAt: s, - missing: [] - }, - rows: c, - gaps: [] - }; -} -async function St(e, t) { - x(); - const n = new Fe(); - return await n.createForCertificate(e, { - hashAlgorithm: "SHA-1", - issuerCertificate: t - }), new Uint8Array(n.toSchema(!0).toBER(!1)); -} -const Ae = 1024 * 1024, It = 8; -async function Ce(e) { - const { readings: t, trust: n, pool: s, source: r, maxCrlBytes: i } = e, a = /* @__PURE__ */ new Map(); - if (!n) return a; - const o = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = async (f, u) => { - try { - return await r.fetch(f); - } catch (m) { - const g = k.is(m, b.Network); - return u({ - detail: m.message, - // No answer came. Whoever reports it needs the address that was asked. - network: g ? new k(b.Network, m.message, { - details: { ...m.details, source: f.url }, - cause: m - }) : k.is(m) ? null : new k( - b.Network, - `${f.url} did not answer: ${m.message}`, - { details: { source: f.url }, cause: m } - ) - }), null; - } - }, l = async (f) => { - const u = I(f.certificate); - if (o.has(u)) return !1; - if (o.add(u), !r) - return a.set(u, { detail: "no `revocation` source was given to ask with", network: null }), !1; - const m = D(f.certificate), g = D(f.issuer), p = J(m); - let y = null; - const T = (A) => { - y?.network || (y = A); - }, w = []; - for (const A of p.ocsp) - w.push({ kind: "ocsp", url: A, body: await St(m, g) }); - for (const A of p.crl) w.push({ kind: "crl", url: A }); - if (w.length === 0) - return a.set(u, { detail: "the certificate names no address to ask at", network: null }), !1; - for (const A of w) { - const S = await c(A, T); - if (!S) continue; - if (A.kind === "crl" && S.byteLength > i) { - T({ - detail: `the list at ${A.url} is ${S.byteLength} bytes, over maxCrlBytes (${i})`, - network: null - }); - continue; - } - const W = A.kind === "ocsp" ? "ocsp" : "crl", G = await me({ answer: { kind: W, der: S }, certificate: m, issuer: g }); - if (G.says === "nothing") { - T({ - detail: `the answer from ${A.url} says nothing: ${G.detail}`, - network: null - }); - continue; - } - return s.addAnswer(W, S, !1), a.delete(u), !0; - } - return y && a.set(u, y), !1; - }, h = async (f) => { - const u = I(f); - if (d.has(u) || !r) return !1; - d.add(u); - const m = s.certificates.length; - for (const g of J(D(f)).issuer) { - const p = await c({ kind: "issuer", url: g }, () => { - }); - if (p) { - for (const y of xt(p)) s.addCertificate(y, !1); - if (s.certificates.length > m) return !0; - } - } - return !1; - }; - for (let f = 0; f < It; f++) { - let u = !1; - for (const m of e.times) { - const g = await L(t, n, s, m); - for (const p of t) { - if (e.wanted && !e.wanted(p)) continue; - const y = g.judgements.get(p); - for (const w of y.withoutIssuer) - await h(w) && (u = !0); - const T = await Rt( - p, - y, - s, - m.kind === "earliest-timestamp" - ); - for (const w of T) - w.status === "unknown" && await l(w) && (u = !0); - } - } - if (!u) break; - } - return a; -} -async function Rt(e, t, n, s) { - const r = []; - if (t.path && r.push(...await O(n, t.path, V(t.validationTime))), e.kind === "signature" && t.timestampPath && t.timestamp && r.push( - ...await O( - n, - t.timestampPath, - V(t.timestamp.validationTime) - ) - ), s && t.reliesOn) { - const i = t.reliesOn; - r.push(...await O(n, i.path, new Date(i.genTime))); - } - return r; -} -function xt(e) { - try { - return [D(e)]; - } catch { - } - try { - const t = M(E(e)); - if (t.offset === -1) return []; - const n = new Me({ schema: t.result }); - return (new Le({ schema: n.content }).certificates ?? []).filter( - (r) => r instanceof qe - ); - } catch { - return []; - } -} -async function Dt(e, t = {}) { - if (!e.signatures) throw new Error("this engine does not implement signatures"); - const n = await e.signatures.list(), s = t.trust ?? null, r = await pe(e), i = []; - for (const l of n.signatures) - l.signed && i.push(await ke(e, n, l, r)); - const a = t.validationTime ?? B; - t.revocation && s && await Ce({ - readings: i, - trust: s, - pool: r, - source: t.revocation, - maxCrlBytes: Ae, - times: a.kind === "earliest-timestamp" ? [B] : [B, a] - }); - const o = await L(i, s, r, B), d = a.kind === "earliest-timestamp" ? o : await L(i, s, r, a), c = []; - for (const l of i) { - const h = d.judgements.get(l), f = o.judgements.get(l), u = await Et( - e, - n, - l.signature, - t.until ?? "persisted" - ), m = h.trust === "trusted" && h.revocation === "revoked"; - let g; - l.integrity === "invalid" || l.cryptography === "invalid" || u.verdict === "forbidden" ? g = "invalid" : l.integrity === "indeterminate" || l.cryptography === "unsupported" || u.verdict === "indeterminate" ? g = "indeterminate" : m ? g = "invalid" : g = h.trust === "trusted" ? "valid" : "valid-untrusted", c.push({ - signature: l.signature, - integrity: l.integrity, - cryptography: l.cryptography, - trust: h.trust, - trustReason: h.trustReason, - validationTime: h.validationTime, - revocation: h.revocation, - ...h.revocationReason ? { revocationReason: h.revocationReason } : {}, - modifications: u, - summary: g, - cms: l.cms, - timestamp: h.timestamp, - longTerm: await Tt( - // What the file holds: an answer that was only asked for is not in it. - ve(l, f, o.documentTimestamps, r, "file") - ) - }); - } - return c; -} -async function zt(e) { - const t = await $({ - token: e.token, - stamped: { kind: "digest", digest: e.digest, algorithm: e.algorithm } - }), n = new ge(); - return t.token && n.addCarried(t.token.certificates, t.token.revocation), (await z(t, e.trust ?? null, F, n)).verdict; -} -async function Et(e, t, n, s) { - if (n.revisionIndex === null) - return { - verdict: "indeterminate", - detail: "the signature seals no whole revision", - basis: "persisted" - }; - if (s === "persisted" && n.revisionIndex === t.revisions.length - 1) - return { verdict: "unchanged", basis: "persisted" }; - try { - const r = await e.signatures.analyze({ - since: { signatureIndex: n.index }, - until: s - }), i = r.current.primary, a = i && i.verdict === "forbidden" ? `object ${i.objectNumber}, ${i.rule}${i.detail ? `: ${i.detail}` : ""}` : i && i.verdict === "incomplete" ? `object ${i.objectNumber}: ${i.detail ?? "incomplete evidence"}` : void 0; - return { - verdict: r.current.verdict, - detail: a, - basis: r.basis.source, - ...r.later.revisionCount > 0 ? { laterRevisions: r.later.revisionCount } : {}, - ...r.later.undoneObjectNumbers.length > 0 ? { undone: !0 } : {} - }; - } catch (r) { - return { - verdict: "indeterminate", - detail: `analysis failed: ${r.message}`, - basis: "persisted" - }; - } -} -const $t = { "P-256": 32, "P-384": 48, "P-521": 66 }; -function Kt(e, t) { - const n = $t[t], s = (a) => new k(b.InvalidArg, `not a DER ECDSA signature: ${a}`, { - details: { field: "der" } - }); - let r; - try { - const a = ze(e, 0, e.byteLength); - if (a.tag !== 48) throw s("it is not a sequence"); - r = Ke(e, a); - } catch (a) { - throw a instanceof P ? s("it does not parse") : a; - } - if (r.length !== 2 || r.some((a) => a.tag !== 2)) - throw s("it does not hold two integers"); - const i = new Uint8Array(n * 2); - return r.forEach((a, o) => { - let d = a.contentStart; - for (; d < a.contentEnd - 1 && e[d] === 0; ) d++; - const c = a.contentEnd - d; - if (c > n) throw s(`a number is ${c} bytes, ${t} takes ${n}`); - i.set(e.subarray(d, a.contentEnd), (o + 1) * n - c); - }), i; -} -async function Ht(e, t) { - if (!e.signatures) throw new Error("this engine does not implement signatures"); - if (!t?.trust) - throw new k( - b.InvalidArg, - "addValidationInfo() needs `trust`: the answers kept are the ones for paths you trust", - { details: { field: "trust" } } - ); - const { trust: n } = t; - await e.signatures.addValidationInfo({}); - const s = await e.signatures.list(), r = await pe(e), i = []; - for (const u of s.signatures) - u.signed && i.push(await ke(e, s, u, r)); - const a = Ot(i, t.fields); - for (const u of t.known?.certificates ?? []) r.addCertificate(u, !1); - for (const u of t.known?.ocspResponses ?? []) r.addAnswer("ocsp", u, !1); - for (const u of t.known?.crls ?? []) r.addAnswer("crl", u, !1); - const o = await Ce({ - readings: i, - wanted: (u) => a.has(u), - trust: n, - pool: r, - source: t.revocation ?? null, - maxCrlBytes: t.maxCrlBytes ?? Ae, - times: [B] - }), d = await L(i, n, r, B), c = { - certificates: /* @__PURE__ */ new Map(), - ocspResponses: /* @__PURE__ */ new Map(), - crls: /* @__PURE__ */ new Map() - }, l = (u, m) => u.set(I(m), m); - for (const u of i) { - if (!a.has(u)) continue; - const m = d.judgements.get(u), g = await be( - // With what is about to be stored: what a reader will find afterwards. - ve(u, m, d.documentTimestamps, r, "anywhere") - ); - if (!g.verdict.enabled && !t.partial) - throw Pt(u, g, o); - for (const p of [m.path, m.reliesOn?.path]) - for (const y of p ?? []) l(c.certificates, y); - for (const p of g.rows) - p.evidence && !p.evidence.inFile && l(p.evidence.kind === "ocsp" ? c.ocspResponses : c.crls, p.evidence.der), p.answer && p.answer.says !== "nothing" && p.answer.responder && l(c.certificates, p.answer.responder); - } - let h = { certificates: 0, ocspResponses: 0, crls: 0 }; - c.certificates.size + c.ocspResponses.size + c.crls.size > 0 && (h = (await e.signatures.addValidationInfo({ - certificates: [...c.certificates.values()], - ocspResponses: [...c.ocspResponses.values()], - crls: [...c.crls.values()] - })).added); - const f = await Dt(e, { trust: n }); - if (!t.partial) - for (const u of i) { - if (!a.has(u)) continue; - const m = f.find((g) => g.signature.index === u.signature.index); - if (!m?.longTerm.enabled) - throw new k( - b.Unknown, - `the validation data was stored, and the signature in "${u.signature.fieldName}" still does not read as complete`, - { details: { field: u.signature.fieldName, missing: m?.longTerm.missing } } - ); - } - return { added: h, verdicts: f }; -} -function Ot(e, t) { - if (!t) return new Set(e); - const n = /* @__PURE__ */ new Set(); - for (const s of t) { - const r = e.find( - ({ signature: i }) => s.kind === "fqn" ? i.fieldName === s.name : i.field.kind === "objectNumber" && i.field.objectNumber === s.objectNumber - ); - if (!r) - throw new k( - b.NotFound, - `no signature in field ${s.kind === "fqn" ? `"${s.name}"` : `object ${s.objectNumber}`}`, - { details: { field: "fields" } } - ); - n.add(r); - } - return n; -} -function Pt(e, t, n) { - const s = t.gaps[0], r = e.signature.fieldName, i = s.der ? n.get(I(s.der)) : void 0; - if (s.reason === "no-answer" && i?.network) return i.network; - const a = s.certificate ? `"${s.certificate}"` : "a certificate", o = { - "no-timestamp": `the signature in "${r}" has no timestamp you trust, so no time is proven to judge its certificates at`, - untrusted: `${a} does not lead to a certificate in \`trust\``, - revoked: `${a} was withdrawn by the time of the signature's timestamp`, - "no-answer": `no answer that checks out says ${a} was good at the signature's timestamp${i ? `: ${i.detail}` : ""}` - }; - return new k( - b.SignatureRefused, - `validation data not added: ${o[s.reason]}`, - { details: { reason: s.reason, certificate: s.certificate, field: r } } - ); -} -export { - P as CmsError, - Ht as addValidationInfo, - tt as attachSignatureTimestamp, - Ee as buildDetachedCms, - U as certificateCommonName, - _t as completeSignature, - Zt as createTestCertificateAuthority, - Jt as createTestSigner, - Qt as createTestTimestampAuthority, - Kt as ecdsaRawFromDer, - en as generateSigningKeyPair, - tn as httpRevocationSource, - nn as httpTimestampAuthority, - sn as indexedDbKeyStore, - rn as memoryKeyStore, - Xt as parseDetachedCms, - an as personalSigner, - ue as profileFor, - on as remoteSigner, - dn as selfSignedCertificate, - qt as sign, - Lt as validateChain, - Dt as validateSignatures, - se as verifyCmsSignature, - We as verifyForCompletion, - zt as verifyTimestampToken, - cn as webCryptoSigner -}; -//# sourceMappingURL=index-BCXWVSWX.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-gudfJIGx.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-CRnA8aVz.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-gudfJIGx.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-CRnA8aVz.js index 602f5fa2..2e3ac1d1 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-gudfJIGx.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-CRnA8aVz.js @@ -1,4 +1,4 @@ -import { bx as m, by as w } from "./wasm-url-asset-sqnq1cad.js"; +import { bx as m, by as w } from "./wasm-url-asset-Dc0HnHB_.js"; async function x(e) { let t = p(await e), [s, r, { QuickJSWASMModule: n }] = await Promise.all([t.importModuleLoader().then(p), t.importFFI(), import("./module-6F3E5H7Y-CZSA4oPd.js").then(p)]), o = await s(); o.type = "sync"; @@ -164,4 +164,4 @@ export { l as QuickJsSandbox, N as createQuickJsSandbox }; -//# sourceMappingURL=index-gudfJIGx.js.map +//# sourceMappingURL=index-CRnA8aVz.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-Cp6ojw-X.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-Cp6ojw-X.js new file mode 100644 index 00000000..386476f4 --- /dev/null +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/index-Cp6ojw-X.js @@ -0,0 +1,1572 @@ +var $e = Object.defineProperty; +var Ee = (t, e, n) => e in t ? $e(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; +var F = (t, e, n) => Ee(t, typeof e != "symbol" ? e + "" : e, n); +import { readCmsParts as ie, withSignerCertificate as De, parseCmsInternal as H, certDer as C, certificateFromDer as E } from "./parse-BNZey3Fv.js"; +import { parseDetachedCms as dn } from "./parse-BNZey3Fv.js"; +import { r as Oe, c as Be, v as Pe, d as Ve, a as re, b as Ne } from "./timestamp-YjVubp40.js"; +import { aR as $, b0 as K, t as x, b8 as T, bz as k, bA as b, aS as ae, bB as Ue, bC as Me, bD as Fe, bE as R, bF as je, aW as v, f as L, bG as Le, bH as ze, bI as _e, b5 as Ke, bJ as qe, bK as He, O as We, bL as Ge, b1 as Xe, b2 as Ye } from "./wasm-url-asset-Dc0HnHB_.js"; +import { bM as fn, bN as mn, bO as hn, bP as gn, bQ as pn, bR as wn, bS as vn, bT as yn, bU as kn, bV as bn, bW as An } from "./wasm-url-asset-Dc0HnHB_.js"; +import { C as P } from "./error-CbfoSMwv.js"; +import { certificateCommonName as M } from "./self-signed-BsJCIg7s.js"; +import { selfSignedCertificate as Tn } from "./self-signed-BsJCIg7s.js"; +import { a as Je, e as Y, r as Qe, c as Ze } from "./splice-DZQMGiQI.js"; +function W(t) { + return new Uint8Array(t.signature.getValue()); +} +async function D(t) { + const e = $(); + let n, s; + try { + n = ie(t.token, "tst-info", { certificates: t.certificates }), s = Oe(n.eContent); + } catch (m) { + return { verdict: "unsupported", problem: "unreadable", detail: m instanceof P ? m.message : String(m), info: null, token: null }; + } + const r = De(n), i = (m, f, d) => ({ verdict: m, problem: f, detail: d, info: s, token: r }), { stamped: a } = t; + if (a.kind === "digest" && s.imprintAlgorithm !== a.algorithm) + return i( + "invalid", + "imprint-algorithm", + `the token stamps a ${s.imprintAlgorithm} digest, not the ${a.algorithm} digest it was given` + ); + const c = a.kind === "digest" ? a.digest : a.kind === "digest-with" ? await a.digest(s.imprintAlgorithm) : new Uint8Array( + await e.digest( + K[s.imprintAlgorithm], + x(a.bytes) + ) + ); + if (!T(s.imprint, c)) + return i("invalid", "imprint", "the token's message imprint is not the stamped digest"); + const u = new Uint8Array( + await e.digest(K[n.digestAlgorithm], x(n.eContent)) + ); + if (!T(u, n.messageDigest)) + return i( + "invalid", + "message-digest", + "the token's message digest does not cover its TSTInfo" + ); + if (!r) + return i( + "unsupported", + "no-certificate", + "the token's authority certificate is not carried by the token or by the signature it is in" + ); + const o = await Be(r); + if (o === "invalid") + return i( + "invalid", + "binding", + "the token's certificate binding names another certificate than the one that signed it" + ); + const l = await Pe(r); + return l === "invalid" ? i("invalid", "signature", "the token signature does not verify") : l === "unsupported" ? i( + "unsupported", + "unsupported-algorithm", + "the token's signature algorithm is not supported" + ) : o === "absent" ? i( + "unsupported", + "no-binding", + "the token does not bind its authority's certificate, which RFC 3161 requires" + ) : o === "unsupported" ? i( + "unsupported", + "unsupported-algorithm", + "the token's certificate binding uses a hash that is not supported" + ) : { verdict: "valid", problem: null, detail: null, info: s, token: r }; +} +function O(t, e) { + return new k( + b.SignatureRefused, + `signing refused (${t}): ${e}`, + { details: { reason: t } } + ); +} +const et = 8192, tt = 16384, nt = 10240, st = 64, J = 4096, U = 4 * 1024 * 1024; +function it(t) { + const { key: e, profile: n, timestampAuthority: s } = t, r = e.kind === "cms" ? Q(e) : n === "timestamp" ? void 0 : rt(e, n), i = s ? Q(s) : void 0, a = t.contentsSizeBytes; + if (e.kind === "raw" && r !== void 0) { + const l = oe(r); + if (a !== void 0 && r > a) + throw O( + "too-large", + `the key's signature takes up to ${r} bytes and ${a} were asked for: ${l}` + ); + if (r > U) + throw O( + "too-large", + `the key's signature takes up to ${r} bytes: ${l}` + ); + } + if (a !== void 0) return a; + const c = s ? tt : void 0; + if (r === void 0) return c; + const u = s ? r + (i ?? nt) + st : r, o = Math.min(U, ce(u)); + return o > (c ?? et) ? o : c; +} +function oe(t) { + const e = ce(t); + return e > U ? "that is more than a signature may reserve" : `pass \`contentsSizeBytes: ${e}\``; +} +function ce(t) { + return Math.ceil(t / J) * J; +} +function Q(t) { + const e = t.maxCmsBytes; + if (e !== void 0) { + if (!Number.isInteger(e) || e < 1 || e > U) + throw new k( + b.InvalidArg, + `maxCmsBytes must be a whole number of bytes from 1 to ${U}`, + { details: { field: "maxCmsBytes" } } + ); + return e; + } +} +function rt(t, e) { + const n = at(t); + if (n !== void 0) + return Ve({ + hash: t.hash, + profile: e, + signer: t, + signatureLength: n, + signingTime: e === "pkcs7" ? (/* @__PURE__ */ new Date()).toISOString() : void 0 + }); +} +function at(t) { + const e = t.certificateChain[0]; + if (!e) return; + const n = ae.fromBER(x(e)).subjectPublicKeyInfo.parsedKey; + if (n instanceof Ue) { + const s = n.modulus.valueBlock.valueHexView; + return s[0] === 0 ? s.byteLength - 1 : s.byteLength; + } + if (n instanceof Me) { + const s = Fe.find(n.namedCurve); + return s ? s.size * 2 : void 0; + } +} +async function ot(t) { + const { cms: e, prepared: n, profile: s } = t; + if (e.byteLength > n.contentsSizeBytes) + return { + ok: !1, + reason: "too-large", + detail: `the signature is ${e.byteLength} bytes and ${n.contentsSizeBytes} were reserved: ${oe(e.byteLength)}` + }; + if (s === "timestamp") return ct(e, n); + let r; + try { + r = H(e); + } catch (u) { + return { + ok: !1, + reason: "malformed", + detail: u instanceof P ? u.message : String(u) + }; + } + const i = r.parsed; + if (i.digestAlgorithm !== n.algorithm) + return { + ok: !1, + reason: "algorithm-mismatch", + detail: `the CMS digests with ${i.digestAlgorithm}, the document was prepared with ${n.algorithm}` + }; + if (!T(i.messageDigest, n.digest)) + return { + ok: !1, + reason: "digest-mismatch", + detail: "the CMS message digest is not the prepared digest" + }; + if (s === "cades-b") { + if (!i.signingCertificateV2) + return { + ok: !1, + reason: "profile-violation", + detail: "CAdES requires the ESS signing-certificate-v2 attribute" + }; + if (i.signingTime) + return { + ok: !1, + reason: "profile-violation", + detail: "PAdES forbids the CMS signing-time attribute" + }; + } + const a = await re(r); + if (a !== "valid") + return { + ok: !1, + reason: "signature-invalid", + detail: a === "unsupported" ? "the signature or its certificate binding uses an algorithm that is not supported" : "the signature does not verify" + }; + const c = W(r.signerInfo); + for (const u of r.timestampTokens) { + const o = await D({ + token: u, + stamped: { kind: "bytes", bytes: c }, + certificates: r.certificates + }); + if (o.verdict === "invalid") + return { + ok: !1, + reason: o.problem === "imprint" ? "digest-mismatch" : "signature-invalid", + detail: `the signature's timestamp does not belong to it: ${o.detail}` + }; + } + return { ok: !0 }; +} +async function ct(t, e) { + const n = await D({ + token: t, + stamped: { kind: "digest", digest: e.digest, algorithm: e.algorithm } + }); + if (n.verdict === "valid") return { ok: !0 }; + switch (n.problem) { + case "unreadable": + return { ok: !1, reason: "malformed", detail: n.detail }; + case "no-certificate": + return { + ok: !1, + reason: "malformed", + detail: "the token does not carry its authority's certificate" + }; + case "imprint-algorithm": + return { + ok: !1, + reason: "algorithm-mismatch", + detail: `the token stamps a ${n.info.imprintAlgorithm} digest, the document was prepared with ${e.algorithm}` + }; + case "imprint": + return { + ok: !1, + reason: "digest-mismatch", + detail: "the token's message imprint is not the prepared digest" + }; + default: + return { ok: !1, reason: "signature-invalid", detail: n.detail }; + } +} +async function tn(t, e, n = { kind: "now" }) { + return ue(t, e, n, []); +} +async function ue(t, e, n, s) { + if (!e) return { status: "unknown", reason: "no trust anchors configured" }; + const r = await e.anchors(); + if (r.length === 0) return { status: "unknown", reason: "no trust anchors configured" }; + $(); + let i; + try { + i = t instanceof Uint8Array ? H(t) : t; + } catch (a) { + return { status: "untrusted", reason: a.message }; + } + return fe({ + target: i.signerCertificate, + candidates: [...i.certificates, ...s], + anchors: r, + at: N(n) + }); +} +async function de(t) { + const { token: e, trust: n, genTime: s } = t; + if (!n) return { status: "unknown", reason: "no trust anchors configured" }; + const r = n.timestampAnchors ? await n.timestampAnchors() : await n.anchors(); + if (r.length === 0) + return { + status: "unknown", + reason: n.timestampAnchors ? "no timestamp anchors configured" : "no trust anchors configured" + }; + $(); + const i = e.signerCertificate, a = dt(i); + if (a) return { status: "untrusted", reason: a }; + if (!Z(i, s)) + return { + status: "untrusted", + reason: "the token is dated outside its authority certificate's validity" + }; + const c = N(t.at ?? { kind: "now" }), u = C(i); + return r.some((o) => T(o, u)) ? Z(i, c) ? { status: "trusted", path: [u] } : { + status: "untrusted", + reason: "the authority's certificate is not valid at the time it is judged" + } : fe({ + target: i, + candidates: [...e.certificates, ...t.certificates ?? []], + anchors: r, + at: c + }); +} +function N(t) { + return t.kind === "now" ? /* @__PURE__ */ new Date() : new Date(le(t)); +} +function ut(t) { + if (t.kind === "now") return { kind: "now" }; + const e = le(t); + return { kind: "timestamp", stampedAt: e, genTime: e, tokenVerified: !0 }; +} +function le(t) { + return t.stampedAt === void 0 ? t.genTime : t.stampedAt; +} +function Z(t, e) { + return t.notBefore.value <= e && e <= t.notAfter.value; +} +function dt(t) { + const e = t.extensions?.find( + (s) => s.extnID === v.extendedKeyUsage + ); + if (!e) + return "the authority's certificate has no extended key usage, so it is not made for timestamping"; + const n = e.parsedValue?.keyPurposes ?? []; + return n.includes(v.timeStamping) ? n.length > 1 ? "the authority's certificate allows other uses besides timestamping" : e.critical ? null : "the authority's certificate does not mark its timestamping purpose as critical" : "the authority's certificate does not allow timestamping"; +} +async function fe(t) { + const { target: e, at: n } = t, s = C(e), r = (u) => T(u, s), i = /* @__PURE__ */ new Map(); + for (const u of t.candidates) { + const o = C(u), l = R(o); + !r(o) && !i.has(l) && i.set(l, u); + } + const a = [...i.values()], c = t.anchors.some(r); + try { + const u = t.anchors.filter((d) => !r(d)).map(E), o = c ? [...u, e] : u, m = await new je({ + certs: c ? [e] : [...a, e], + trustedCerts: o, + checkDate: n, + findIssuer: lt(e) + }).verify(); + if (!m.result) { + const d = mt(e, o, a); + return { + status: "untrusted", + reason: d ? `no certificate was found that issued "${ht(d)}"` : m.resultMessage || `chain validation code ${m.resultCode}`, + ...d ? { withoutIssuer: C(d) } : {} + }; + } + const f = m.certificatePath ?? []; + return f.length === 0 || !r(C(f[0])) ? { + status: "untrusted", + reason: "the validated path does not begin with the certificate that signed" + } : { status: "trusted", path: f.map(C) }; + } catch (u) { + return { status: "untrusted", reason: u.message }; + } +} +function lt(t) { + let e; + return async (n, s, r) => { + e ?? (e = ft(t, s, r)); + const { issuers: i, steps: a } = await e, c = a.get(n); + return c === void 0 ? [] : (i.get(n) ?? []).filter((u) => a.get(u) === c - 1); + }; +} +async function ft(t, e, n) { + const s = (u) => e.trustedCerts.some((o) => T(o.tbsView, u.tbsView)), r = /* @__PURE__ */ new Map(), i = [t]; + for (; i.length > 0; ) { + const u = i.pop(); + if (r.has(u)) continue; + const l = (s(u) ? [] : await e.defaultFindIssuer(u, e, n)).filter((m) => !T(m.tbsView, u.tbsView)); + r.set(u, l), i.push(...l); + } + const a = /* @__PURE__ */ new Map(); + let c = [...r.keys()].filter(s); + for (let u = 0; c.length > 0; u++) { + for (const o of c) a.set(o, u); + c = [...r].filter( + ([o, l]) => !a.has(o) && l.some((m) => a.has(m)) + ).map(([o]) => o); + } + return { issuers: r, steps: a }; +} +function mt(t, e, n) { + const s = [...e, ...n], r = /* @__PURE__ */ new Set(); + let i = t; + for (; !r.has(i); ) { + if (r.add(i), e.includes(i) || i.issuer.isEqual(i.subject)) return null; + const a = s.find((c) => c.subject.isEqual(i.issuer)); + if (!a) return i; + i = a; + } + return null; +} +function ht(t) { + return M(C(t)) ?? "a certificate without a common name"; +} +const gt = new Uint8Array([ + 6, + 11, + 42, + 134, + 72, + 134, + 247, + 13, + 1, + 9, + 16, + 2, + 14 +]); +async function pt(t) { + const { cms: e, authority: n } = t; + let s; + try { + s = ie(e); + } catch (u) { + throw O("malformed", u instanceof P ? u.message : String(u)); + } + if (s.timestampTokens.length > 0) + throw new k( + b.InvalidArg, + "the signature already carries a timestamp, from the service that signed it; leave out `timestampAuthority`", + { details: { field: "timestampAuthority" } } + ); + const r = n.hash ?? "sha256", i = new Uint8Array( + await $().digest( + K[r], + x(W(s.signerInfo)) + ) + ), a = await n.sign({ digest: i, algorithm: r, subFilter: "ETSI.RFC3161" }), c = await D({ + token: a, + stamped: { kind: "digest", digest: i, algorithm: r }, + certificates: s.certificates + }); + if (c.verdict !== "valid") + throw O(vt(c.problem), `the timestamp: ${yt(c)}`); + t.trust && await me(c, t.trust, s.certificates); + try { + return Je(e, wt(a)); + } catch (u) { + throw O("malformed", u instanceof P ? u.message : String(u)); + } +} +async function me(t, e, n = []) { + const s = await de({ + token: t.token, + certificates: n, + trust: e, + genTime: t.info.genTime + }); + if (s.status === "trusted") return; + const r = M(t.token.parsed.signerCertificate); + throw new k( + b.SignatureRefused, + `the timestamp's authority${r ? ` ("${r}")` : ""} isn't trusted: ${s.reason ?? "no path to a timestamp anchor"}. Add its root to \`timestampAnchors\``, + { details: { trust: s.status, trustReason: s.reason ?? null } } + ); +} +function wt(t) { + return Y( + 48, + new Uint8Array([...gt, ...Y(49, t)]) + ); +} +function vt(t) { + switch (t) { + case "unreadable": + return "malformed"; + case "imprint": + return "digest-mismatch"; + case "imprint-algorithm": + return "algorithm-mismatch"; + default: + return "signature-invalid"; + } +} +function yt(t) { + return t.problem === "unreadable" ? `\`timestampAuthority\` didn't return an RFC 3161 token (${t.detail}): is it a signing service?` : t.detail; +} +function he(t) { + switch (t) { + case "adbe.pkcs7.detached": + return "pkcs7"; + case "ETSI.CAdES.detached": + return "cades-b"; + case "ETSI.RFC3161": + return "timestamp"; + default: + throw new k( + b.InvalidArg, + `unknown subFilter '${String(t)}'`, + { + details: { field: "subFilter" } + } + ); + } +} +async function nn(t, e) { + const { key: n, timestampAuthority: s, timestampTrust: r, afterPrepare: i, ...a } = e, c = a.kind === "timestamp"; + if (c && n.kind !== "cms") + throw new k( + b.InvalidArg, + "a document timestamp needs a timestamp authority: a CMS key that returns an RFC 3161 token", + { details: { field: "key" } } + ); + ge(c, s, r); + const u = c ? "ETSI.RFC3161" : a.subFilter ?? "ETSI.CAdES.detached", o = he(u), l = it({ + key: n, + profile: o, + timestampAuthority: s, + contentsSizeBytes: a.contentsSizeBytes + }), m = await t.signatures.prepare({ + ...a, + ...c ? {} : { subFilter: u }, + digest: a.digest ?? n.hash ?? "sha256", + ...l !== void 0 ? { contentsSizeBytes: l } : {} + }); + try { + await i?.(m); + const f = await kt(n, m, u, o); + return await pe(t, { prepared: m, cms: f, timestampAuthority: s, timestampTrust: r }); + } catch (f) { + throw await t.signatures.cancel(m.signingId).catch(() => { + }), f; + } +} +async function sn(t, e) { + ge( + e.prepared.subFilter === "ETSI.RFC3161", + e.timestampAuthority, + e.timestampTrust + ); + try { + return await pe(t, e); + } catch (n) { + throw k.is(n, b.SignatureRefused) ? new k( + b.SignatureRefused, + `${n.message}. The signing stays prepared, and this CMS will be refused again: cancel it and prepare again`, + { details: n.details, cause: n } + ) : n; + } +} +function ge(t, e, n) { + if (t && e) + throw new k( + b.InvalidArg, + "a document timestamp is already a timestamp; leave out `timestampAuthority`", + { details: { field: "timestampAuthority" } } + ); + if (n && !e && !t) + throw new k( + b.InvalidArg, + "`timestampTrust` judges a timestamp's authority; pass `timestampAuthority` too", + { details: { field: "timestampTrust" } } + ); +} +async function pe(t, e) { + const { prepared: n, timestampAuthority: s } = e, r = he(n.subFilter), i = async (c) => { + const u = await ot({ cms: c, prepared: n, profile: r }); + if (!u.ok) throw O(u.reason, u.detail); + }; + let a = e.cms; + if (await i(a), r === "timestamp" && e.timestampTrust) { + const c = await D({ + token: a, + stamped: { kind: "digest", digest: n.digest, algorithm: n.algorithm } + }); + if (c.verdict !== "valid") throw O("malformed", "the timestamp token"); + await me(c, e.timestampTrust); + } + return s && (a = await pt({ + cms: a, + authority: s, + trust: e.timestampTrust + }), await i(a)), t.signatures.complete({ + signingId: n.signingId, + cms: a, + expectedVersion: n.expectedVersion + }); +} +async function kt(t, e, n, s) { + if (t.kind === "cms") + return t.sign({ digest: e.digest, algorithm: e.algorithm, subFilter: n }); + if (s === "timestamp") + throw new k(b.InvalidArg, "a raw key cannot make a timestamp token"); + return Ne({ + digest: e.digest, + hash: e.algorithm, + profile: s, + signer: t, + signingTime: s === "pkcs7" ? (/* @__PURE__ */ new Date()).toISOString() : void 0 + }); +} +const bt = 6; +function ee(t) { + const e = { ocsp: [], crl: [], issuer: [] }, n = (i) => t.extensions?.find((a) => a.extnID === i)?.parsedValue, s = n(v.authorityInfoAccess); + for (const i of s?.accessDescriptions ?? []) { + const a = te(i.accessLocation); + a && (i.accessMethod === v.accessOcsp && e.ocsp.push(a), i.accessMethod === v.accessIssuers && e.issuer.push(a)); + } + const r = n(v.crlDistributionPoints); + for (const i of r?.distributionPoints ?? []) { + if (i.reasons || i.cRLIssuer) continue; + const a = Array.isArray(i.distributionPoint) ? i.distributionPoint : []; + for (const c of a) { + const u = te(c); + u && e.crl.push(u); + } + } + return e; +} +function At(t) { + const e = (i) => t.extensions?.find((a) => a.extnID === i); + if (e(v.basicConstraints)?.parsedValue?.cA) return !1; + if (e(v.validityAssuredShortTerm)) return !0; + if (!e(v.noRevAvail)) return !1; + const s = e(v.authorityInfoAccess)?.parsedValue; + return !(e(v.crlDistributionPoints) !== void 0 || e(v.freshestCrl) !== void 0 || (s?.accessDescriptions ?? []).some( + (i) => i.accessMethod === v.accessOcsp + )); +} +function te(t) { + return t.type !== bt || typeof t.value != "string" ? null : /^https?:\/\//i.test(t.value) ? t.value : null; +} +const we = { + 0: "unspecified", + 1: "key-compromise", + 2: "ca-compromise", + 3: "affiliation-changed", + 4: "superseded", + 5: "cessation-of-operation", + 6: "certificate-hold", + 8: "remove-from-crl", + 9: "privilege-withdrawn", + 10: "aa-compromise" +}; +async function ve(t) { + $(); + const { answer: e, certificate: n, issuer: s } = t, r = (i, a) => ({ + says: "nothing", + kind: e.kind, + problem: i, + detail: a + }); + if (!n.issuer.isEqual(s.subject)) + return r("other-certificate", "the certificate was not issued by the issuer given"); + try { + return e.kind === "ocsp" ? await Tt(e.der, n, s, r) : await xt(e.der, n, s, r); + } catch (i) { + return r("unreadable", i.message); + } +} +const Ct = { + 1: "malformed request", + 2: "internal error", + 3: "try later", + 5: "a signed request is required", + 6: "unauthorized" +}; +async function Tt(t, e, n, s) { + const r = $(), i = L(x(t)); + if (i.offset === -1) return s("unreadable", "the OCSP response is not valid DER"); + const a = new Le({ schema: i.result }), c = a.responseStatus.valueBlock.valueDec; + if (c !== 0) + return s( + "not-successful", + `the responder answered "${Ct[c] ?? `status ${c}`}"` + ); + const u = a.responseBytes; + if (!u) return s("unreadable", "the OCSP response carries no answer"); + if (u.responseType !== v.ocspBasic) + return s("unsupported", `OCSP response type ${u.responseType}`); + const o = L(u.response.valueBlock.valueHexView); + if (o.offset === -1) return s("unreadable", "the OCSP answer is not valid DER"); + const l = new ze({ schema: o.result }), m = l.tbsResponseData; + let f = null, d = null; + for (const w of m.responses) { + const A = r.getAlgorithmByOID(w.certID.hashAlgorithm.algorithmId, !1); + if (!("name" in A) || typeof A.name != "string") { + d = w.certID.hashAlgorithm.algorithmId; + continue; + } + const I = new _e(); + if (await I.createForCertificate(e, { + hashAlgorithm: A.name, + issuerCertificate: n + }), w.certID.isEqual(I)) { + f = w; + break; + } + } + if (!f) + return d ? s("unsupported", `the answer identifies its certificate with hash ${d}`) : s("other-certificate", "the OCSP response is about another certificate"); + const h = await St(m.responderID, [n, ...l.certs ?? []]); + if (!h) + return s("wrong-signer", "the responder's certificate is not in the response"); + const g = It(h, n); + if (!g) { + const w = await Rt(h, n, m.producedAt); + if (w) return s("wrong-signer", w); + } + const p = await ye( + m.tbsView, + l.signature, + h.subjectPublicKeyInfo, + l.signatureAlgorithm + ); + if (p === "unsupported") + return s( + "unsupported", + `signature algorithm ${l.signatureAlgorithm.algorithmId} of the OCSP response` + ); + if (p === "invalid") + return s("signature", "the OCSP response's signature does not verify"); + const y = { + kind: "ocsp", + thisUpdate: f.thisUpdate, + nextUpdate: f.nextUpdate ?? null, + responder: g ? null : C(h) + }, S = f.certStatus; + switch (S.idBlock.tagNumber) { + case 0: + return { says: "good", ...y }; + case 1: { + const [w, A] = S.valueBlock.value; + if (!(w instanceof Ke)) + return s("unreadable", "the OCSP response names no revocation time"); + const I = A?.valueBlock.value[0]?.valueBlock.valueDec; + return { + says: "revoked", + revokedAt: w.toDate(), + reason: I === void 0 ? null : we[I] ?? null, + ...y + }; + } + default: + return s("unknown-status", "the responder does not know the certificate"); + } +} +async function St(t, e) { + const n = $(); + for (const s of e) + if (t instanceof He) { + if (s.subject.isEqual(t)) return s; + } else if (t instanceof We) { + const r = s.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView, i = new Uint8Array(await n.digest("SHA-1", x(r))); + if (T(i, new Uint8Array(t.valueBlock.valueHexView))) return s; + } + return null; +} +function It(t, e) { + return T(C(t), C(e)); +} +async function Rt(t, e, n) { + if (!t.issuer.isEqual(e.subject)) + return "the responder's certificate was not issued by the certificate's issuer"; + let s = !1; + try { + s = await t.verify(e); + } catch { + s = !1; + } + return s ? (t.extensions?.find( + (a) => a.extnID === v.extendedKeyUsage + )?.parsedValue?.keyPurposes ?? []).includes(v.ocspSigning) ? n < t.notBefore.value || n > t.notAfter.value ? "the responder's certificate was outside its dates when it answered" : null : "the responder's certificate is not made for answering about certificates" : "the responder's certificate is not signed by the certificate's issuer"; +} +async function xt(t, e, n, s) { + const r = L(x(t)); + if (r.offset === -1) return s("unreadable", "the CRL is not valid DER"); + const i = new qe({ schema: r.result }); + if (!i.issuer.isEqual(n.subject)) + return s("other-certificate", "the CRL is not from the certificate's issuer"); + for (const f of i.crlExtensions?.extensions ?? []) { + if (f.extnID === v.deltaCrlIndicator) + return s("delta-crl", "the CRL lists only what changed since another list"); + if (f.extnID === v.issuingDistributionPoint) { + const d = f.parsedValue; + if (!d) return s("unreadable", "the CRL's scope cannot be read"); + if (d.indirectCRL) + return s("indirect-crl", "the CRL lists certificates of other issuers"); + const h = Et(e); + if (d.onlyContainsAttributeCerts || d.onlyContainsUserCerts && h || d.onlyContainsCACerts && !h || d.onlySomeReasons !== void 0) + return s("out-of-scope", "the CRL does not cover this kind of certificate"); + } else if (f.critical && !$t.has(f.extnID)) + return s("unsupported", `critical CRL extension ${f.extnID}`); + } + if (!Dt(n)) + return s("wrong-signer", "the issuer's certificate is not made for signing CRLs"); + const a = await ye( + i.tbsView, + i.signatureValue, + n.subjectPublicKeyInfo, + i.signatureAlgorithm + ); + if (a === "unsupported") + return s("unsupported", `signature algorithm ${i.signatureAlgorithm.algorithmId}`); + if (a === "invalid") return s("signature", "the CRL's signature does not verify"); + const c = { + kind: "crl", + thisUpdate: i.thisUpdate.value, + nextUpdate: i.nextUpdate?.value ?? null, + responder: null + }, u = ne(e.serialNumber), o = (i.revokedCertificates ?? []).find( + (f) => T(ne(f.userCertificate), u) + ); + if (!o) return { says: "good", ...c }; + const m = o.crlEntryExtensions?.extensions.find( + (f) => f.extnID === v.crlReason + )?.parsedValue?.valueBlock.valueDec; + return { + says: "revoked", + revokedAt: o.revocationDate.value, + reason: m === void 0 ? null : we[m] ?? null, + ...c + }; +} +const $t = /* @__PURE__ */ new Set([ + v.crlNumber, + v.authorityKeyIdentifier, + v.authorityInfoAccess, + v.freshestCrl +]); +function Et(t) { + return t.extensions?.find( + (n) => n.extnID === v.basicConstraints + )?.parsedValue?.cA === !0; +} +function Dt(t) { + const e = t.extensions?.find((s) => s.extnID === v.keyUsage); + if (!e) return !0; + const n = e.parsedValue?.valueBlock.valueHexView; + return n !== void 0 && n.length > 0 && (n[0] & 2) !== 0; +} +function ne(t) { + const e = new Uint8Array(t.valueBlock.valueHexView); + let n = 0; + for (; n < e.length - 1 && e[n] === 0; ) n++; + return e.subarray(n); +} +async function ye(t, e, n, s) { + try { + return await $().verifyWithPublicKey( + x(t), + e, + n, + s + ) ? "valid" : "invalid"; + } catch (r) { + const i = r.message ?? ""; + return /unsupported|unknown|not supported|not implemented|incorrect/i.test(i) ? "unsupported" : "invalid"; + } +} +const Ot = 300 * 1e3; +function Bt(t, e) { + const n = e.getTime(); + let s = null, r = null; + for (const i of t) { + if (i.says === "nothing") continue; + if (i.says === "revoked") { + i.revokedAt.getTime() <= n ? (!r || i.revokedAt < r.revokedAt) && (r = i) : s ?? (s = i); + continue; + } + const a = i.thisUpdate.getTime(), c = i.nextUpdate ? i.nextUpdate.getTime() : a + Ot; + (a >= n || n <= c) && (s ?? (s = i)); + } + return r ? { status: "revoked", answer: r } : s ? { status: "good", answer: s } : { status: "unknown", answer: null }; +} +class ke { + constructor() { + F(this, "certificateByDer", /* @__PURE__ */ new Map()); + F(this, "answerByDer", /* @__PURE__ */ new Map()); + /** What each answer says about one certificate, in the order the answers were offered. */ + F(this, "checked", /* @__PURE__ */ new Map()); + } + /** Every certificate offered, each once. */ + get certificates() { + return [...this.certificateByDer.values()].map((e) => e.certificate); + } + /** + * Offer a certificate. Bytes that are not a certificate are left out, and false comes back. + * `inFile` is false for one that came from outside the file. + */ + addCertificate(e, n = !0) { + try { + const s = e instanceof Uint8Array ? e : C(e), r = R(s); + return this.certificateByDer.has(r) || this.certificateByDer.set(r, { + certificate: e instanceof Uint8Array ? E(e) : e, + inFile: n + }), !0; + } catch { + return !1; + } + } + /** + * Offer an answer as it was stored or sent. It is checked when it is asked about a + * certificate. `inFile` is false for one that came from outside the file. + */ + addAnswer(e, n, s = !0) { + const r = `${e}:${R(n)}`; + let i = this.answerByDer.get(r); + return i || (i = { kind: e, der: n, inFile: s }, this.answerByDer.set(r, i)), i; + } + /** Offer what a CMS carries itself: its certificates and its answers. */ + addCarried(e, n) { + for (const s of e) this.addCertificate(s); + for (const s of n.ocspResponses) this.addAnswer("ocsp", s); + for (const s of n.crls) this.addAnswer("crl", s); + } + /** + * What each answer says about `certificate`, which `issuer` issued. Each answer is checked + * once, also when more answers are offered between two calls. + */ + async checksFor(e, n) { + const s = `${R(C(e))}:${R(C(n))}`, r = [...this.answerByDer.values()], i = this.checked.get(s) ?? []; + for (let c = i.length; c < r.length; c++) + i.push(ve({ answer: r[c], certificate: e, issuer: n })); + this.checked.set(s, i); + const a = await Promise.all(i); + return r.map((c, u) => ({ answer: c, check: a[u] })); + } +} +async function be(t) { + const e = new ke(); + if (typeof t.signatures?.getValidationInfo != "function") return e; + try { + const n = await t.signatures.getValidationInfo(); + for (const s of n.certificates) e.addCertificate(s); + for (const s of n.ocspResponses) e.addAnswer("ocsp", s); + for (const s of n.crls) e.addAnswer("crl", s); + } catch (n) { + if (!k.is(n, b.NotImplemented)) throw n; + } + return e; +} +async function B(t, e, n, s = "anywhere") { + const r = e.filter((c, u) => u === 0 || !T(c, e[u - 1])), i = r.map(E), a = []; + for (let c = 0; c + 1 < i.length; c++) { + if (At(i[c])) continue; + const u = (await t.checksFor(i[c], i[c + 1])).filter( + (l) => s === "anywhere" || l.answer.inFile + ), o = Bt( + u.map((l) => l.check), + n + ); + a.push({ + certificate: r[c], + name: M(r[c]), + issuer: r[c + 1], + evidence: u.find((l) => l.check === o.answer)?.answer ?? null, + ...o + }); + } + return a; +} +function Ae(t, e) { + const n = (i) => `"${i.name ?? "a certificate without a name"}"`, s = t.find((i) => i.status === "revoked"); + if (s) { + const i = s.answer, a = i?.says === "revoked" ? ` on ${i.revokedAt.toISOString()}` : "", c = i?.says === "revoked" && i.reason ? ` (${i.reason})` : ""; + return { status: "revoked", reason: `${n(s)} was withdrawn${a}${c}` }; + } + const r = t.find((i) => i.status === "unknown"); + return r ? { status: "unknown", reason: `no answer about ${n(r)} speaks for ${e}` } : { status: "good", reason: null }; +} +const j = { kind: "now" }, V = { kind: "earliest-timestamp" }; +async function z(t, e, n, s) { + const r = s.kind === "earliest-timestamp", i = [], a = (o) => !r || o === null ? null : i.filter((l) => l.revisionIndex > o).reduce( + (l, m) => !l || m.genTime < l.genTime ? m : l, + null + ), c = /* @__PURE__ */ new Map(), u = t.filter((o) => o.kind === "timestamp").sort((o, l) => (l.signature.revisionIndex ?? -1) - (o.signature.revisionIndex ?? -1)); + for (const o of u) { + const l = a(o.signature.revisionIndex), m = l ? _(l.genTime) : j, f = o.token ? await q(o.token, e, m, n) : null, d = f?.verdict ?? null, h = o.signature.revisionIndex, g = f && o.integrity === "valid" ? se(f) : null; + g && h !== null && i.push({ ...g, revisionIndex: h }), c.set(o, { + trust: d?.trust ?? "unknown", + trustReason: d?.trustReason ?? void 0, + validationTime: m, + path: f?.path ?? null, + revocation: d?.revocation ?? "unknown", + revocationReason: d?.revocationReason ?? void 0, + timestamp: d, + reliesOn: g, + // A sound token over these bytes whose authority isn't trusted proves no time to you. + withoutTime: d && o.integrity === "valid" && d.cryptography === "valid" ? "untrusted" : "no-timestamp", + timestampPath: null, + withoutIssuer: f?.withoutIssuer ? [f.withoutIssuer] : [] + }); + } + for (const o of t) { + if (o.kind === "timestamp") continue; + const l = a(o.signature.revisionIndex), m = []; + for (const w of o.tokens) + m.push( + await q( + w, + e, + l ? _(l.genTime) : j, + n, + o.internal?.certificates + ) + ); + const f = Ut(m), d = (f ?? m[0])?.verdict ?? null, h = f ? se(f) : null, g = r ? h && l ? h.genTime <= l.genTime ? h : l : h ?? l : null, p = r ? g ? _(g.genTime) : j : ut(s), y = o.internal ? await ue(o.internal, e, p, n.certificates) : { + status: "unknown", + reason: void 0, + path: void 0, + withoutIssuer: void 0 + }, S = y.status === "trusted" && y.path ? Ae(await B(n, y.path, N(p)), Te(p)) : { status: "unknown", reason: Pt }; + c.set(o, { + trust: y.status, + trustReason: y.reason, + validationTime: p, + path: y.status === "trusted" ? y.path ?? null : null, + revocation: S.status, + revocationReason: S.reason ?? void 0, + timestamp: d, + reliesOn: g, + withoutTime: "no-timestamp", + timestampPath: (f ?? m[0])?.path ?? null, + withoutIssuer: [ + ...y.withoutIssuer ? [y.withoutIssuer] : [], + ...m.flatMap((w) => w.withoutIssuer ? [w.withoutIssuer] : []) + ] + }); + } + return { judgements: c, documentTimestamps: i }; +} +const Pt = "the signer is not trusted, so there is no issuer to check an answer against"; +function Ce(t, e, n, s, r) { + return { + kind: t.kind, + revisionIndex: t.signature.revisionIndex, + subject: t.cms ? M(t.cms.signerCertificate) : null, + reliesOn: e.reliesOn, + withoutTime: e.withoutTime, + signer: { trusted: e.trust === "trusted", path: e.path }, + documentTimestamps: n, + pool: s, + answersFrom: r + }; +} +function Te(t) { + return t.kind === "now" ? "now" : t.stampedAt; +} +function se(t) { + const { verdict: e, path: n } = t; + return e.summary !== "valid" || !n ? null : { genTime: e.stampedAt, path: n, authorityCertificate: e.authorityCertificate }; +} +async function Se(t, e, n, s) { + const r = { + signature: n, + kind: n.kind, + integrity: "indeterminate", + cryptography: "unsupported", + internal: null, + cms: null, + tokens: [], + token: null + }; + if (!e.chainValid || n.coverage === "malformed") + return r.integrity = e.chainValid ? "invalid" : "indeterminate", r; + const i = n.kind === "timestamp" ? await Nt(t, n, r) : await Vt(t, n, r); + i.internal && s.addCarried(i.internal.certificates, i.internal.revocation); + for (const a of [...i.tokens, ...i.token ? [i.token] : []]) + a.token && s.addCarried(a.token.certificates, a.token.revocation); + return i; +} +async function Vt(t, e, n) { + let s; + try { + const i = await t.signatures.getContents(e.field); + s = H(i), n.cms = s.parsed; + const a = await t.signatures.getDigest(e.field, s.digestAlgorithm), c = T(a, s.messageDigest); + n.integrity = e.coverage === "whole-revision" && c ? "valid" : "invalid"; + } catch (i) { + return n.integrity = i instanceof P && i.reason === "unsupported" ? "indeterminate" : "invalid", i instanceof P || (n.integrity = "indeterminate"), n; + } + n.internal = s, n.cryptography = await re(s); + const r = W(s.signerInfo); + for (const i of s.timestampTokens) + n.tokens.push( + await D({ + token: i, + stamped: { kind: "bytes", bytes: r }, + certificates: s.certificates + }) + ); + return n; +} +async function Nt(t, e, n) { + let s; + try { + s = await t.signatures.getContents(e.field); + } catch { + return n; + } + const r = await D({ + token: s, + stamped: { + kind: "digest-with", + digest: (a) => t.signatures.getDigest(e.field, a) + } + }).catch(() => null); + if (!r || (n.token = r, n.cms = r.token?.parsed ?? null, r.problem === "unreadable")) return n; + const i = r.problem !== "imprint"; + return n.integrity = e.coverage === "whole-revision" && i ? "valid" : "invalid", n.cryptography = i ? r.verdict : (await D({ + token: s, + stamped: { + kind: "digest", + digest: r.info.imprint, + algorithm: r.info.imprintAlgorithm + } + })).verdict, n; +} +async function q(t, e, n, s, r = []) { + const i = t.info ? t.info.genTime.toISOString() : null, a = t.token ? t.token.parsed.signerCertificate : null; + let c = "unknown", u = t.detail, o = null, l = null; + if (t.token && t.info) { + const h = await de({ + token: t.token, + certificates: [...r, ...s.certificates], + trust: e, + at: n, + genTime: t.info.genTime + }); + c = h.status, u = h.reason ?? null, o = h.status === "trusted" ? h.path ?? null : null, l = h.withoutIssuer ?? null; + } + const m = o ? Ae(await B(s, o, N(n)), Te(n)) : { + status: "unknown", + reason: "the authority is not trusted, so there is no issuer to check an answer against" + }, f = { + cryptography: t.verdict, + trust: c, + trustReason: u, + validationTime: n, + revocation: m.status, + revocationReason: m.reason, + authorityName: a ? M(a) : null + }, d = c === "trusted" && m.status === "revoked"; + return t.verdict === "valid" && !d && i !== null && a !== null ? { + verdict: { + ...f, + summary: c === "trusted" ? "valid" : "valid-untrusted", + stampedAt: i, + authorityCertificate: a + }, + path: o, + withoutIssuer: l + } : { + verdict: { + ...f, + summary: t.verdict === "invalid" || d ? "invalid" : "indeterminate", + stampedAt: i, + authorityCertificate: a + }, + path: o, + withoutIssuer: l + }; +} +function _(t) { + return { kind: "timestamp", stampedAt: t, genTime: t, tokenVerified: !0 }; +} +function Ut(t) { + let e = null; + for (const n of t) + n.verdict.summary === "valid" && (!e || n.verdict.stampedAt < e.verdict.stampedAt) && (e = n); + return e; +} +async function Mt(t) { + return (await Ie(t)).verdict; +} +async function Ie(t) { + const e = t.revisionIndex === null ? [] : t.documentTimestamps.filter((f) => f.revisionIndex > t.revisionIndex), n = (f) => f.reduce( + (d, h) => !d || h.genTime > d.genTime ? h : d, + null + ), s = n(e)?.genTime ?? null, r = (f, d, h = []) => ({ + verdict: { + enabled: !1, + provenAt: f, + expiresAt: null, + documentTimestampedAt: s, + missing: d.map(({ certificate: g, reason: p }) => ({ certificate: g, reason: p })) + }, + rows: h, + gaps: d + }), i = t.reliesOn; + if (!i) + return r(null, [{ certificate: t.subject, reason: t.withoutTime, der: null }]); + if (t.kind === "signature" && (!t.signer.trusted || !t.signer.path)) + return r(i.genTime, [ + { certificate: t.subject, reason: "untrusted", der: null } + ]); + const a = new Date(i.genTime), c = [ + ...t.kind === "signature" ? await B(t.pool, t.signer.path, a, t.answersFrom) : [], + ...await B(t.pool, i.path, a, t.answersFrom) + ], u = /* @__PURE__ */ new Set(), o = c.filter((f) => { + const d = R(f.certificate); + return u.has(d) ? !1 : (u.add(d), !0); + }), l = o.filter((f) => f.status !== "good").map((f) => ({ + certificate: f.name, + reason: f.status === "revoked" ? "revoked" : "no-answer", + der: f.certificate + })); + if (l.length > 0) return r(i.genTime, l, o); + const m = n([i, ...e]); + return { + verdict: { + enabled: !0, + provenAt: i.genTime, + expiresAt: E(m.authorityCertificate).notAfter.value.toISOString(), + documentTimestampedAt: s, + missing: [] + }, + rows: o, + gaps: [] + }; +} +async function Ft(t, e) { + $(); + const n = new Ge(); + return await n.createForCertificate(t, { + hashAlgorithm: "SHA-1", + issuerCertificate: e + }), new Uint8Array(n.toSchema(!0).toBER(!1)); +} +const Re = 1024 * 1024, jt = 8; +async function xe(t) { + const { readings: e, trust: n, pool: s, source: r, maxCrlBytes: i } = t, a = /* @__PURE__ */ new Map(); + if (!n) return a; + const c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), o = async (f, d) => { + try { + return await r.fetch(f); + } catch (h) { + const g = k.is(h, b.Network); + return d({ + detail: h.message, + // No answer came. Whoever reports it needs the address that was asked. + network: g ? new k(b.Network, h.message, { + details: { ...h.details, source: f.url }, + cause: h + }) : k.is(h) ? null : new k( + b.Network, + `${f.url} did not answer: ${h.message}`, + { details: { source: f.url }, cause: h } + ) + }), null; + } + }, l = async (f) => { + const d = R(f.certificate); + if (c.has(d)) return !1; + if (c.add(d), !r) + return a.set(d, { detail: "no `revocation` source was given to ask with", network: null }), !1; + const h = E(f.certificate), g = E(f.issuer), p = ee(h); + let y = null; + const S = (A) => { + y?.network || (y = A); + }, w = []; + for (const A of p.ocsp) + w.push({ kind: "ocsp", url: A, body: await Ft(h, g) }); + for (const A of p.crl) w.push({ kind: "crl", url: A }); + if (w.length === 0) + return a.set(d, { detail: "the certificate names no address to ask at", network: null }), !1; + for (const A of w) { + const I = await o(A, S); + if (!I) continue; + if (A.kind === "crl" && I.byteLength > i) { + S({ + detail: `the list at ${A.url} is ${I.byteLength} bytes, over maxCrlBytes (${i})`, + network: null + }); + continue; + } + const G = A.kind === "ocsp" ? "ocsp" : "crl", X = await ve({ answer: { kind: G, der: I }, certificate: h, issuer: g }); + if (X.says === "nothing") { + S({ + detail: `the answer from ${A.url} says nothing: ${X.detail}`, + network: null + }); + continue; + } + return s.addAnswer(G, I, !1), a.delete(d), !0; + } + return y && a.set(d, y), !1; + }, m = async (f) => { + const d = R(f); + if (u.has(d) || !r) return !1; + u.add(d); + const h = s.certificates.length; + for (const g of ee(E(f)).issuer) { + const p = await o({ kind: "issuer", url: g }, () => { + }); + if (p) { + for (const y of zt(p)) s.addCertificate(y, !1); + if (s.certificates.length > h) return !0; + } + } + return !1; + }; + for (let f = 0; f < jt; f++) { + let d = !1; + for (const h of t.times) { + const g = await z(e, n, s, h); + for (const p of e) { + if (t.wanted && !t.wanted(p)) continue; + const y = g.judgements.get(p); + for (const w of y.withoutIssuer) + await m(w) && (d = !0); + const S = await Lt( + p, + y, + s, + h.kind === "earliest-timestamp" + ); + for (const w of S) + w.status === "unknown" && await l(w) && (d = !0); + } + } + if (!d) break; + } + return a; +} +async function Lt(t, e, n, s) { + const r = []; + if (e.path && r.push(...await B(n, e.path, N(e.validationTime))), t.kind === "signature" && e.timestampPath && e.timestamp && r.push( + ...await B( + n, + e.timestampPath, + N(e.timestamp.validationTime) + ) + ), s && e.reliesOn) { + const i = e.reliesOn; + r.push(...await B(n, i.path, new Date(i.genTime))); + } + return r; +} +function zt(t) { + try { + return [E(t)]; + } catch { + } + try { + const e = L(x(t)); + if (e.offset === -1) return []; + const n = new Xe({ schema: e.result }); + return (new Ye({ schema: n.content }).certificates ?? []).filter( + (r) => r instanceof ae + ); + } catch { + return []; + } +} +async function _t(t, e = {}) { + if (!t.signatures) throw new Error("this engine does not implement signatures"); + const n = await t.signatures.list(), s = e.trust ?? null, r = await be(t), i = []; + for (const l of n.signatures) + l.signed && i.push(await Se(t, n, l, r)); + const a = e.validationTime ?? V; + e.revocation && s && await xe({ + readings: i, + trust: s, + pool: r, + source: e.revocation, + maxCrlBytes: Re, + times: a.kind === "earliest-timestamp" ? [V] : [V, a] + }); + const c = await z(i, s, r, V), u = a.kind === "earliest-timestamp" ? c : await z(i, s, r, a), o = []; + for (const l of i) { + const m = u.judgements.get(l), f = c.judgements.get(l), d = await Kt( + t, + n, + l.signature, + e.until ?? "persisted" + ), h = m.trust === "trusted" && m.revocation === "revoked"; + let g; + l.integrity === "invalid" || l.cryptography === "invalid" || d.verdict === "forbidden" ? g = "invalid" : l.integrity === "indeterminate" || l.cryptography === "unsupported" || d.verdict === "indeterminate" ? g = "indeterminate" : h ? g = "invalid" : g = m.trust === "trusted" ? "valid" : "valid-untrusted", o.push({ + signature: l.signature, + integrity: l.integrity, + cryptography: l.cryptography, + trust: m.trust, + trustReason: m.trustReason, + validationTime: m.validationTime, + revocation: m.revocation, + ...m.revocationReason ? { revocationReason: m.revocationReason } : {}, + modifications: d, + summary: g, + cms: l.cms, + timestamp: m.timestamp, + longTerm: await Mt( + // What the file holds: an answer that was only asked for is not in it. + Ce(l, f, c.documentTimestamps, r, "file") + ) + }); + } + return o; +} +async function rn(t) { + const e = await D({ + token: t.token, + stamped: { kind: "digest", digest: t.digest, algorithm: t.algorithm } + }), n = new ke(); + return e.token && n.addCarried(e.token.certificates, e.token.revocation), (await q(e, t.trust ?? null, j, n)).verdict; +} +async function Kt(t, e, n, s) { + if (n.revisionIndex === null) + return { + verdict: "indeterminate", + detail: "the signature seals no whole revision", + basis: "persisted" + }; + if (s === "persisted" && n.revisionIndex === e.revisions.length - 1) + return { verdict: "unchanged", basis: "persisted" }; + try { + const r = await t.signatures.analyze({ + since: { signatureIndex: n.index }, + until: s + }), i = r.current.primary, a = i && i.verdict === "forbidden" ? `object ${i.objectNumber}, ${i.rule}${i.detail ? `: ${i.detail}` : ""}` : i && i.verdict === "incomplete" ? `object ${i.objectNumber}: ${i.detail ?? "incomplete evidence"}` : void 0; + return { + verdict: r.current.verdict, + detail: a, + basis: r.basis.source, + ...r.later.revisionCount > 0 ? { laterRevisions: r.later.revisionCount } : {}, + ...r.later.undoneObjectNumbers.length > 0 ? { undone: !0 } : {} + }; + } catch (r) { + return { + verdict: "indeterminate", + detail: `analysis failed: ${r.message}`, + basis: "persisted" + }; + } +} +const qt = { "P-256": 32, "P-384": 48, "P-521": 66 }; +function an(t, e) { + const n = qt[e], s = (a) => new k(b.InvalidArg, `not a DER ECDSA signature: ${a}`, { + details: { field: "der" } + }); + let r; + try { + const a = Qe(t, 0, t.byteLength); + if (a.tag !== 48) throw s("it is not a sequence"); + r = Ze(t, a); + } catch (a) { + throw a instanceof P ? s("it does not parse") : a; + } + if (r.length !== 2 || r.some((a) => a.tag !== 2)) + throw s("it does not hold two integers"); + const i = new Uint8Array(n * 2); + return r.forEach((a, c) => { + let u = a.contentStart; + for (; u < a.contentEnd - 1 && t[u] === 0; ) u++; + const o = a.contentEnd - u; + if (o > n) throw s(`a number is ${o} bytes, ${e} takes ${n}`); + i.set(t.subarray(u, a.contentEnd), (c + 1) * n - o); + }), i; +} +async function on(t, e) { + if (!t.signatures) throw new Error("this engine does not implement signatures"); + if (!e?.trust) + throw new k( + b.InvalidArg, + "addValidationInfo() needs `trust`: the answers kept are the ones for paths you trust", + { details: { field: "trust" } } + ); + const { trust: n } = e; + await t.signatures.addValidationInfo({}); + const s = await t.signatures.list(), r = await be(t), i = []; + for (const d of s.signatures) + d.signed && i.push(await Se(t, s, d, r)); + const a = Ht(i, e.fields); + for (const d of e.known?.certificates ?? []) r.addCertificate(d, !1); + for (const d of e.known?.ocspResponses ?? []) r.addAnswer("ocsp", d, !1); + for (const d of e.known?.crls ?? []) r.addAnswer("crl", d, !1); + const c = await xe({ + readings: i, + wanted: (d) => a.has(d), + trust: n, + pool: r, + source: e.revocation ?? null, + maxCrlBytes: e.maxCrlBytes ?? Re, + times: [V] + }), u = await z(i, n, r, V), o = { + certificates: /* @__PURE__ */ new Map(), + ocspResponses: /* @__PURE__ */ new Map(), + crls: /* @__PURE__ */ new Map() + }, l = (d, h) => d.set(R(h), h); + for (const d of i) { + if (!a.has(d)) continue; + const h = u.judgements.get(d), g = await Ie( + // With what is about to be stored: what a reader will find afterwards. + Ce(d, h, u.documentTimestamps, r, "anywhere") + ); + if (!g.verdict.enabled && !e.partial) + throw Wt(d, g, c); + for (const p of [h.path, h.reliesOn?.path]) + for (const y of p ?? []) l(o.certificates, y); + for (const p of g.rows) + p.evidence && !p.evidence.inFile && l(p.evidence.kind === "ocsp" ? o.ocspResponses : o.crls, p.evidence.der), p.answer && p.answer.says !== "nothing" && p.answer.responder && l(o.certificates, p.answer.responder); + } + let m = { certificates: 0, ocspResponses: 0, crls: 0 }; + o.certificates.size + o.ocspResponses.size + o.crls.size > 0 && (m = (await t.signatures.addValidationInfo({ + certificates: [...o.certificates.values()], + ocspResponses: [...o.ocspResponses.values()], + crls: [...o.crls.values()] + })).added); + const f = await _t(t, { trust: n }); + if (!e.partial) + for (const d of i) { + if (!a.has(d)) continue; + const h = f.find((g) => g.signature.index === d.signature.index); + if (!h?.longTerm.enabled) + throw new k( + b.Unknown, + `the validation data was stored, and the signature in "${d.signature.fieldName}" still does not read as complete`, + { details: { field: d.signature.fieldName, missing: h?.longTerm.missing } } + ); + } + return { added: m, verdicts: f }; +} +function Ht(t, e) { + if (!e) return new Set(t); + const n = /* @__PURE__ */ new Set(); + for (const s of e) { + const r = t.find( + ({ signature: i }) => s.kind === "fqn" ? i.fieldName === s.name : i.field.kind === "objectNumber" && i.field.objectNumber === s.objectNumber + ); + if (!r) + throw new k( + b.NotFound, + `no signature in field ${s.kind === "fqn" ? `"${s.name}"` : `object ${s.objectNumber}`}`, + { details: { field: "fields" } } + ); + n.add(r); + } + return n; +} +function Wt(t, e, n) { + const s = e.gaps[0], r = t.signature.fieldName, i = s.der ? n.get(R(s.der)) : void 0; + if (s.reason === "no-answer" && i?.network) return i.network; + const a = s.certificate ? `"${s.certificate}"` : "a certificate", c = { + "no-timestamp": `the signature in "${r}" has no timestamp you trust, so no time is proven to judge its certificates at`, + untrusted: `${a} does not lead to a certificate in \`trust\``, + revoked: `${a} was withdrawn by the time of the signature's timestamp`, + "no-answer": `no answer that checks out says ${a} was good at the signature's timestamp${i ? `: ${i.detail}` : ""}` + }; + return new k( + b.SignatureRefused, + `validation data not added: ${c[s.reason]}`, + { details: { reason: s.reason, certificate: s.certificate, field: r } } + ); +} +export { + P as CmsError, + on as addValidationInfo, + pt as attachSignatureTimestamp, + Ne as buildDetachedCms, + M as certificateCommonName, + sn as completeSignature, + fn as createTestCertificateAuthority, + mn as createTestSigner, + hn as createTestTimestampAuthority, + an as ecdsaRawFromDer, + gn as generateSigningKeyPair, + pn as httpRevocationSource, + wn as httpTimestampAuthority, + vn as indexedDbKeyStore, + yn as memoryKeyStore, + dn as parseDetachedCms, + kn as personalSigner, + he as profileFor, + bn as remoteSigner, + Tn as selfSignedCertificate, + nn as sign, + tn as validateChain, + _t as validateSignatures, + re as verifyCmsSignature, + ot as verifyForCompletion, + rn as verifyTimestampToken, + An as webCryptoSigner +}; +//# sourceMappingURL=index-Cp6ojw-X.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/inline-transport-GZ5fBXix.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/inline-transport-DLWGAv7G.js similarity index 99% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/inline-transport-GZ5fBXix.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/inline-transport-DLWGAv7G.js index e357e23a..aa1a77c3 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/inline-transport-GZ5fBXix.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/inline-transport-DLWGAv7G.js @@ -20,7 +20,7 @@ var oA = (po = { "../runtime/npm/wasm32/lib/embedpdf.browser.js"() { var n, r, i, o, a, s, l, u, d, f, h, p, F, b, D, A, O, G, N, E, w = new Promise((m, g) => { n = m, r = g; }); - ["_EPDF_CheckPasswordPermissions", "_EPDF_DigestBuffer", "_EPDF_FreeBuffer", "_EPDF_GetDecodedImageBytes", "_EPDF_GetMetaKeyCount", "_EPDF_GetMetaKeyName", "_EPDF_GetMetaTrapped", "_EPDF_GetPageBoxByIndex", "_EPDF_GetPageRotateByIndex", "_EPDF_GetPageTabOrderByIndex", "_EPDF_GetPageUserUnitByIndex", "_EPDF_HasMetaText", "_EPDF_InitThread", "_EPDF_IsEncrypted", "_EPDF_IsOwnerUnlocked", "_EPDF_LoadBaseDocument", "_EPDF_LoadMemBaseDocument", "_EPDF_LoadMemBaseDocument64", "_EPDF_LoadPageNormalized", "_EPDF_PNG_EncodeRGBA", "_EPDF_ReleaseBaseDocument", "_EPDF_RemoveEncryption", "_EPDF_RenderAnnotBitmap", "_EPDF_RenderAnnotBitmapUnrotated", "_EPDF_RenderPage_Continue", "_EPDF_RenderPageBitmapWithMatrix_Start", "_EPDF_SaveAsCopyEx", "_EPDF_SaveDocumentToOwnedBuffer", "_EPDF_SaveDocumentToOwnedBufferEx", "_EPDF_SaveDocumentToOwnedBufferWithVersion", "_EPDF_SetBaseDocumentSha256", "_EPDF_SetDecodedImageBudget", "_EPDF_SetEncryption", "_EPDF_SetMetaText", "_EPDF_SetMetaTrapped", "_EPDF_SetRuntimeOwnerPermissions", "_EPDF_ShutdownThread", "_EPDF_UnlockOwnerPermissions", "_EPDFAction_CloseModel", "_EPDFAction_CreateGoTo", "_EPDFAction_CreateGoToNamed", "_EPDFAction_CreateHide", "_EPDFAction_CreateJavaScript", "_EPDFAction_CreateLaunch", "_EPDFAction_CreateNamed", "_EPDFAction_CreateRemoteGoToByName", "_EPDFAction_CreateRemoteGoToDest", "_EPDFAction_CreateResetForm", "_EPDFAction_CreateSubmitForm", "_EPDFAction_CreateURI", "_EPDFAction_GetNextAt", "_EPDFAction_GetNextCount", "_EPDFAction_GetNodeCount", "_EPDFAction_GetNodeDest", "_EPDFAction_GetNodeFilePath", "_EPDFAction_GetNodeHideFlag", "_EPDFAction_GetNodeJavaScript", "_EPDFAction_GetNodeName", "_EPDFAction_GetNodeResetForm", "_EPDFAction_GetNodeSubmitForm", "_EPDFAction_GetNodeSubmitFormCharSet", "_EPDFAction_GetNodeSubmitFormURL", "_EPDFAction_GetNodeSubtype", "_EPDFAction_GetNodeTargetCount", "_EPDFAction_GetNodeTargetName", "_EPDFAction_GetNodeTargetObjectNumber", "_EPDFAction_GetNodeType", "_EPDFAction_GetNodeURI", "_EPDFAction_GetNodeURIIsMap", "_EPDFAction_GetRootNode", "_EPDFAction_GetWarningFlags", "_EPDFAction_IsComplete", "_EPDFAction_LoadModel", "_EPDFAction_NodeHasJavaScript", "_EPDFAction_SetNext", "_EPDFAnnot_AddMeasure", "_EPDFAnnot_ClearBorderEffect", "_EPDFAnnot_ClearColor", "_EPDFAnnot_ClearEmbedMetadata", "_EPDFAnnot_ClearEmbedMetadataKey", "_EPDFAnnot_ClearMKColor", "_EPDFAnnot_ClearMKIcon", "_EPDFAnnot_ClearRectangleDifferences", "_EPDFAnnot_ExportAppearance", "_EPDFAnnot_GenerateAppearance", "_EPDFAnnot_GenerateAppearanceWithBlend", "_EPDFAnnot_GenerateFormFieldAP", "_EPDFAnnot_GetActionModel", "_EPDFAnnot_GetAPMatrix", "_EPDFAnnot_GetAppearanceState", "_EPDFAnnot_GetAppearanceStateCount", "_EPDFAnnot_GetAppearanceStateName", "_EPDFAnnot_GetAppearanceTransform", "_EPDFAnnot_GetAvailableAppearanceModes", "_EPDFAnnot_GetBlendMode", "_EPDFAnnot_GetBooleanValue", "_EPDFAnnot_GetBorderDashPattern", "_EPDFAnnot_GetBorderDashPatternCount", "_EPDFAnnot_GetBorderEffect", "_EPDFAnnot_GetBorderStyle", "_EPDFAnnot_GetCalloutLine", "_EPDFAnnot_GetCalloutLineCount", "_EPDFAnnot_GetColor", "_EPDFAnnot_GetDefaultAppearance", "_EPDFAnnot_GetDefaultAppearanceFontFace", "_EPDFAnnot_GetDefaultAppearanceFontPostScriptName", "_EPDFAnnot_GetDrawing", "_EPDFAnnot_GetDrawingRect", "_EPDFAnnot_GetEmbedMetadataBoolean", "_EPDFAnnot_GetEmbedMetadataJSON", "_EPDFAnnot_GetEmbedMetadataNumber", "_EPDFAnnot_GetEmbedMetadataRect", "_EPDFAnnot_GetEmbedMetadataString", "_EPDFAnnot_GetFileAttachmentForWrite", "_EPDFAnnot_GetIntent", "_EPDFAnnot_GetLineCaption", "_EPDFAnnot_GetLineEndings", "_EPDFAnnot_GetLineLeader", "_EPDFAnnot_GetMeasure", "_EPDFAnnot_GetMKColor", "_EPDFAnnot_GetMKIcon", "_EPDFAnnot_GetMKRotation", "_EPDFAnnot_GetMKText", "_EPDFAnnot_GetMKTextPosition", "_EPDFAnnot_GetName", "_EPDFAnnot_GetObjectNumber", "_EPDFAnnot_GetOpacity", "_EPDFAnnot_GetOverlayText", "_EPDFAnnot_GetOverlayTextRepeat", "_EPDFAnnot_GetRect", "_EPDFAnnot_GetRectangleDifferences", "_EPDFAnnot_GetReplyType", "_EPDFAnnot_GetRichContent", "_EPDFAnnot_GetRichTextJSON", "_EPDFAnnot_GetRotate", "_EPDFAnnot_GetShapeCaption", "_EPDFAnnot_GetStructurePosition", "_EPDFAnnot_GetTextAlignment", "_EPDFAnnot_HasAppearanceStream", "_EPDFAnnot_HasEmbedMetadata", "_EPDFAnnot_HasMKIcon", "_EPDFAnnot_IsValid", "_EPDFAnnot_RemoveAction", "_EPDFAnnot_RemoveDest", "_EPDFAnnot_RemoveKey", "_EPDFAnnot_RemoveMeasure", "_EPDFAnnot_SetAction", "_EPDFAnnot_SetAPMatrix", "_EPDFAnnot_SetAppearanceFromPage", "_EPDFAnnot_SetBooleanValue", "_EPDFAnnot_SetBorderDashPattern", "_EPDFAnnot_SetBorderEffect", "_EPDFAnnot_SetBorderStyle", "_EPDFAnnot_SetCalloutLine", "_EPDFAnnot_SetColor", "_EPDFAnnot_SetDefaultAppearance", "_EPDFAnnot_SetDefaultAppearanceDocumentFont", "_EPDFAnnot_SetDefaultAppearanceRegisteredFont", "_EPDFAnnot_SetDrawing", "_EPDFAnnot_SetEmbedMetadataBoolean", "_EPDFAnnot_SetEmbedMetadataJSON", "_EPDFAnnot_SetEmbedMetadataNumber", "_EPDFAnnot_SetEmbedMetadataRect", "_EPDFAnnot_SetEmbedMetadataString", "_EPDFAnnot_SetEventAction", "_EPDFAnnot_SetIntent", "_EPDFAnnot_SetLine", "_EPDFAnnot_SetLineCaption", "_EPDFAnnot_SetLineEndings", "_EPDFAnnot_SetLineLeader", "_EPDFAnnot_SetLinkedAnnot", "_EPDFAnnot_SetMKColor", "_EPDFAnnot_SetMKIcon", "_EPDFAnnot_SetMKRotation", "_EPDFAnnot_SetMKText", "_EPDFAnnot_SetMKTextPosition", "_EPDFAnnot_SetName", "_EPDFAnnot_SetNoColor", "_EPDFAnnot_SetNumberValue", "_EPDFAnnot_SetOpacity", "_EPDFAnnot_SetOverlayText", "_EPDFAnnot_SetOverlayTextRepeat", "_EPDFAnnot_SetRect", "_EPDFAnnot_SetReplyType", "_EPDFAnnot_SetRichTextJSON", "_EPDFAnnot_SetRichTextXHTML", "_EPDFAnnot_SetRotate", "_EPDFAnnot_SetShapeCaption", "_EPDFAnnot_SetStampOpacity", "_EPDFAnnot_SetSubtype", "_EPDFAnnot_SetTextAlignment", "_EPDFAnnot_SetVertices", "_EPDFAnnot_UpdateAppearanceToRect", "_EPDFAttachment_ExportCanonicalToOwnedBuffer", "_EPDFAttachment_ExportRawToOwnedBuffer", "_EPDFAttachment_ExtractFile", "_EPDFAttachment_ExtractFileToOwnedBuffer", "_EPDFAttachment_GetDescription", "_EPDFAttachment_GetIntegerValue", "_EPDFAttachment_ImportRaw", "_EPDFAttachment_SetDescription", "_EPDFAttachment_SetName", "_EPDFAttachment_SetSubtype", "_EPDFCatalog_GetLanguage", "_EPDFCatalog_GetMetadata", "_EPDFCatalog_SetMetadata", "_EPDFDest_CreateRemoteView", "_EPDFDest_CreateRemoteXYZ", "_EPDFDest_CreateView", "_EPDFDest_CreateViewByObjectNumber", "_EPDFDest_CreateXYZ", "_EPDFDest_CreateXYZByObjectNumber", "_EPDFDest_GetPageObjectNumber", "_EPDFDest_GetViewNullParams", "_EPDFDoc_CanonicalDrawing", "_EPDFDoc_ClearMissingCharacters", "_EPDFDoc_ClearPagePieceInfoEntry", "_EPDFDoc_ClearPagePieceInfoKey", "_EPDFDoc_ClearPieceInfoEntry", "_EPDFDoc_ClearPieceInfoKey", "_EPDFDoc_CompareRevisions", "_EPDFDoc_CountMissingCharacters", "_EPDFDoc_DeletePageByObjectNumber", "_EPDFDoc_ExportDictCanonicalToOwnedBuffer", "_EPDFDoc_ExportDictRawToOwnedBuffer", "_EPDFDoc_ExportDrawing", "_EPDFDoc_ExportPagesFlattened", "_EPDFDoc_GetAdditionalActionModel", "_EPDFDoc_GetAttachmentIndexByKey", "_EPDFDoc_GetAttachmentKey", "_EPDFDoc_GetBaseBytesSize", "_EPDFDoc_GetDrawings", "_EPDFDoc_GetFontDisplayProgramCoverage", "_EPDFDoc_GetFontDisplayProgramData", "_EPDFDoc_GetFontEmbeddingPolicy", "_EPDFDoc_GetFontProgramData", "_EPDFDoc_GetFontsFingerprint", "_EPDFDoc_GetImportFieldRoots", "_EPDFDoc_GetLastModified", "_EPDFDoc_GetLoadedBytesSize", "_EPDFDoc_GetLoadedObjectValue", "_EPDFDoc_GetMissingCharacter", "_EPDFDoc_GetNamedJavaScriptActionModel", "_EPDFDoc_GetNamedPageAt", "_EPDFDoc_GetNamedPageCount", "_EPDFDoc_GetOpenActionDest", "_EPDFDoc_GetOpenActionModel", "_EPDFDoc_GetPageActionModel", "_EPDFDoc_GetPageLabelSectionAt", "_EPDFDoc_GetPageLabelSectionCount", "_EPDFDoc_GetPageLastModified", "_EPDFDoc_GetPageObjectNumberByIndex", "_EPDFDoc_GetPagePieceInfoBoolean", "_EPDFDoc_GetPagePieceInfoEntryAt", "_EPDFDoc_GetPagePieceInfoEntryCount", "_EPDFDoc_GetPagePieceInfoKeyAt", "_EPDFDoc_GetPagePieceInfoKeyCount", "_EPDFDoc_GetPagePieceInfoLastModified", "_EPDFDoc_GetPagePieceInfoName", "_EPDFDoc_GetPagePieceInfoNumber", "_EPDFDoc_GetPagePieceInfoString", "_EPDFDoc_GetPagePieceInfoStringArrayAt", "_EPDFDoc_GetPagePieceInfoStringArrayCount", "_EPDFDoc_GetPagePieceInfoValueType", "_EPDFDoc_GetPieceInfoBoolean", "_EPDFDoc_GetPieceInfoEntryAt", "_EPDFDoc_GetPieceInfoEntryCount", "_EPDFDoc_GetPieceInfoKeyAt", "_EPDFDoc_GetPieceInfoKeyCount", "_EPDFDoc_GetPieceInfoLastModified", "_EPDFDoc_GetPieceInfoName", "_EPDFDoc_GetPieceInfoNumber", "_EPDFDoc_GetPieceInfoString", "_EPDFDoc_GetPieceInfoStringArrayAt", "_EPDFDoc_GetPieceInfoStringArrayCount", "_EPDFDoc_GetPieceInfoValueType", "_EPDFDoc_GetRevision", "_EPDFDoc_GetRevisionCount", "_EPDFDoc_GetStructureObjectNumbers", "_EPDFDoc_GetTypographicFeatures", "_EPDFDoc_HasPagePieceInfoEntry", "_EPDFDoc_HasPieceInfoEntry", "_EPDFDoc_ImportDictRaw", "_EPDFDoc_ImportDrawing", "_EPDFDoc_ImportPages", "_EPDFDoc_LoadPageByObjectNumber", "_EPDFDoc_LoadPageByObjectNumberNormalized", "_EPDFDoc_OpenBaseOverlay", "_EPDFDoc_OpenBaseOverlayFromPath", "_EPDFDoc_OpenRevision", "_EPDFDoc_ReadLoadedBytes", "_EPDFDoc_RemoveNamedPage", "_EPDFDoc_RemoveNamedPagesForPage", "_EPDFDoc_ResolveFonts", "_EPDFDoc_SetFontEmbeddingPolicy", "_EPDFDoc_SetNamedPage", "_EPDFDoc_SetPageLabelSections", "_EPDFDoc_SetPagePieceInfoBoolean", "_EPDFDoc_SetPagePieceInfoName", "_EPDFDoc_SetPagePieceInfoNumber", "_EPDFDoc_SetPagePieceInfoString", "_EPDFDoc_SetPagePieceInfoStringArray", "_EPDFDoc_SetPageRotationByObjectNumber", "_EPDFDoc_SetPieceInfoBoolean", "_EPDFDoc_SetPieceInfoName", "_EPDFDoc_SetPieceInfoNumber", "_EPDFDoc_SetPieceInfoString", "_EPDFDoc_SetPieceInfoStringArray", "_EPDFDoc_SetTypographicFeatures", "_EPDFDoc_StartLoadPageByObjectNumber", "_EPDFDocument_ClearEmbedMetadata", "_EPDFDss_Add", "_EPDFDss_GetCount", "_EPDFDss_GetData", "_EPDFFont_AddFallbackFont", "_EPDFFont_AuthorizeEditing", "_EPDFFont_ClearFallbackFonts", "_EPDFFont_ClearRegisteredFonts", "_EPDFFont_GetCoverage", "_EPDFFont_GetEmbeddingPermission", "_EPDFFont_GetFallbackOrder", "_EPDFFont_GetFamilyName", "_EPDFFont_GetLastResortFont", "_EPDFFont_GetMetrics", "_EPDFFont_GetPostScriptName", "_EPDFFont_GetProgramData", "_EPDFFont_GetProgramFormat", "_EPDFFont_GetProgramHash", "_EPDFFont_GetWeight", "_EPDFFont_IsEditingAuthorized", "_EPDFFont_IsInstanced", "_EPDFFont_IsItalic", "_EPDFFont_RegisterFont", "_EPDFFont_RegisterMemFont", "_EPDFFont_RegisterMemFont64", "_EPDFFont_SetLastResortFont", "_EPDFFontFaces_Close", "_EPDFFontFaces_Count", "_EPDFFontFaces_CountPrograms", "_EPDFFontFaces_GetFamily", "_EPDFFontFaces_GetProgramDisplayHash", "_EPDFFontFaces_GetProgramEmbedded", "_EPDFFontFaces_GetProgramEmbeddingPermission", "_EPDFFontFaces_GetProgramFormat", "_EPDFFontFaces_GetProgramHash", "_EPDFFontFaces_GetProgramMetrics", "_EPDFFontFaces_GetProgramObjNum", "_EPDFFontFaces_GetProgramPostScriptName", "_EPDFFontFaces_GetWeight", "_EPDFFontFaces_IsItalic", "_EPDFFontFaces_Load", "_EPDFFontFaces_ProgramMapsUnicode", "_EPDFFontResolution_Close", "_EPDFFontResolution_CountMissingCharacters", "_EPDFFontResolution_GetBaseFontName", "_EPDFFontResolution_GetFallbacks", "_EPDFFontResolution_GetFamily", "_EPDFFontResolution_GetMissingCharacter", "_EPDFFontResolution_GetProgramDisplayHash", "_EPDFFontResolution_GetProgramObjNum", "_EPDFFontResolution_GetRegisteredFont", "_EPDFFontResolution_GetSource", "_EPDFFontResolution_GetWeight", "_EPDFFontResolution_IsDegraded", "_EPDFFontResolution_IsItalic", "_EPDFForm_AttachWidget", "_EPDFForm_ClearFieldEmbedMetadata", "_EPDFForm_ClearFieldEmbedMetadataKey", "_EPDFForm_CloseModel", "_EPDFForm_CountCalculationOrder", "_EPDFForm_CountFieldDefaultValues", "_EPDFForm_CountFieldOptions", "_EPDFForm_CountFields", "_EPDFForm_CountFieldValues", "_EPDFForm_CountFieldWidgets", "_EPDFForm_CreateField", "_EPDFForm_DeleteField", "_EPDFForm_DetachWidget", "_EPDFForm_ExportFDF", "_EPDFForm_ExportFieldRawToOwnedBuffer", "_EPDFForm_ExportXFDF", "_EPDFForm_GetCalculationOrderFieldIndex", "_EPDFForm_GetFieldActionModel", "_EPDFForm_GetFieldAlternateName", "_EPDFForm_GetFieldDefaultValueAt", "_EPDFForm_GetFieldDefaultValueKind", "_EPDFForm_GetFieldEmbedMetadataBoolean", "_EPDFForm_GetFieldEmbedMetadataJSON", "_EPDFForm_GetFieldEmbedMetadataNumber", "_EPDFForm_GetFieldEmbedMetadataString", "_EPDFForm_GetFieldFamily", "_EPDFForm_GetFieldFlags", "_EPDFForm_GetFieldIndexByObjNum", "_EPDFForm_GetFieldIndexForWidget", "_EPDFForm_GetFieldMappingName", "_EPDFForm_GetFieldMaxLen", "_EPDFForm_GetFieldName", "_EPDFForm_GetFieldObjNum", "_EPDFForm_GetFieldOptionLabel", "_EPDFForm_GetFieldOptionValue", "_EPDFForm_GetFieldOrigin", "_EPDFForm_GetFieldPartialName", "_EPDFForm_GetFieldTopIndex", "_EPDFForm_GetFieldValueAt", "_EPDFForm_GetFieldValueKind", "_EPDFForm_GetFieldWidgetExportValue", "_EPDFForm_GetFieldWidgetObjNum", "_EPDFForm_GetFieldWidgetOnState", "_EPDFForm_GetFieldWidgetPageObjNum", "_EPDFForm_GetFieldWidgetRect", "_EPDFForm_GetFormKind", "_EPDFForm_GetNeedAppearances", "_EPDFForm_HasFieldEmbedMetadata", "_EPDFForm_HasFieldValuesList", "_EPDFForm_ImportFieldRaw", "_EPDFForm_IsFieldOptionSelected", "_EPDFForm_IsFieldWidgetChecked", "_EPDFForm_LoadModel", "_EPDFForm_RedrawFieldWidgets", "_EPDFForm_Repair", "_EPDFForm_SetCalculationOrder", "_EPDFForm_SetFieldAlternateName", "_EPDFForm_SetFieldAppearanceText", "_EPDFForm_SetFieldDefaultValue", "_EPDFForm_SetFieldDisplay", "_EPDFForm_SetFieldEmbedMetadataBoolean", "_EPDFForm_SetFieldEmbedMetadataJSON", "_EPDFForm_SetFieldEmbedMetadataNumber", "_EPDFForm_SetFieldEmbedMetadataString", "_EPDFForm_SetFieldEventAction", "_EPDFForm_SetFieldFlags", "_EPDFForm_SetFieldMappingName", "_EPDFForm_SetFieldMaxLen", "_EPDFForm_SetFieldName", "_EPDFForm_SetFieldOptions", "_EPDFForm_SetFieldSelectedIndices", "_EPDFForm_SetFieldValue", "_EPDFForm_SetFieldWidgetsChecked", "_EPDFImageObj_SetJpeg", "_EPDFImageObj_SetPng", "_EPDFLayer_AbortTransaction", "_EPDFLayer_BeginTransaction", "_EPDFLayer_CommitTransaction", "_EPDFLayer_GetBaseDocument", "_EPDFLayer_GetBaseSha256", "_EPDFLayer_GetBirthName", "_EPDFLayer_GetBirthObjectNumber", "_EPDFLayer_GetLastObjectNumber", "_EPDFLayer_GetPromotedObjectCount", "_EPDFLayer_IsInTransaction", "_EPDFLayer_IsObjectPromoted", "_EPDFLayer_IsPagePromoted", "_EPDFLayer_OpenLayer", "_EPDFLayer_OpenLayerArtifact", "_EPDFLayer_OpenLayerArtifactFromPath", "_EPDFLayer_RaiseLastObjectNumber", "_EPDFLayer_SaveDelta", "_EPDFLayer_SaveDeltaEx", "_EPDFLayer_SaveDeltaToOwnedBuffer", "_EPDFLayer_SaveDeltaToOwnedBufferEx", "_EPDFLayer_SaveLayerArtifact", "_EPDFLayer_SaveLayerArtifactEx", "_EPDFLayer_SaveLayerArtifactToOwnedBuffer", "_EPDFLayer_SaveLayerArtifactToOwnedBufferEx", "_EPDFMeasure_AddFormat", "_EPDFMeasure_CountFormats", "_EPDFMeasure_GetCYX", "_EPDFMeasure_GetFormat", "_EPDFMeasure_GetOrigin", "_EPDFMeasure_GetRatio", "_EPDFMeasure_GetSubtype", "_EPDFMeasure_RemoveFormats", "_EPDFMeasure_SetCYX", "_EPDFMeasure_SetOrigin", "_EPDFMeasure_SetRatio", "_EPDFNamedDest_Remove", "_EPDFNamedDest_SetDest", "_EPDFNumberFormat_GetConversion", "_EPDFNumberFormat_GetFixedDenominator", "_EPDFNumberFormat_GetFraction", "_EPDFNumberFormat_GetLabelPosition", "_EPDFNumberFormat_GetPrecision", "_EPDFNumberFormat_GetText", "_EPDFNumberFormat_GetUnit", "_EPDFNumberFormat_SetConversion", "_EPDFNumberFormat_SetFixedDenominator", "_EPDFNumberFormat_SetFraction", "_EPDFNumberFormat_SetLabelPosition", "_EPDFNumberFormat_SetPrecision", "_EPDFNumberFormat_SetText", "_EPDFNumberFormat_SetUnit", "_EPDFObjectDiff_Close", "_EPDFObjectDiff_GetCount", "_EPDFObjectDiff_GetEntry", "_EPDFObjectDiff_GetReadStatus", "_EPDFObjectDiff_GetReferrer", "_EPDFObjectDiff_GetReferrerCount", "_EPDFObjectDiff_GetRevisionHealth", "_EPDFObjectDiff_GetValue", "_EPDFOutline_CreateItem", "_EPDFOutline_DeleteItem", "_EPDFOutline_ExportItemRawToOwnedBuffer", "_EPDFOutline_GetItem", "_EPDFOutline_GetObjectNumber", "_EPDFOutline_ImportItemRaw", "_EPDFOutline_MoveItem", "_EPDFOutline_SetAction", "_EPDFOutline_SetColor", "_EPDFOutline_SetOpen", "_EPDFOutline_SetStyle", "_EPDFOutline_SetTitle", "_EPDFPage_AddViewport", "_EPDFPage_AddViewportRaw", "_EPDFPage_ApplyRedactions", "_EPDFPage_ContinueLoad", "_EPDFPage_CountViewports", "_EPDFPage_CountViewportsRaw", "_EPDFPage_CreateAnnot", "_EPDFPage_CreateAnnotRaw", "_EPDFPage_ExportAnnotationsAsDocument", "_EPDFPage_ExportAnnotsRawToOwnedBuffer", "_EPDFPage_ExportRawToOwnedBuffer", "_EPDFPage_FindViewport", "_EPDFPage_Flatten", "_EPDFPage_FlattenAnnotations", "_EPDFPage_GetAnnotByName", "_EPDFPage_GetAnnotByObjectNumber", "_EPDFPage_GetAnnotCountRaw", "_EPDFPage_GetAnnotIndexByNameRaw", "_EPDFPage_GetAnnotIndexByObjectNumberRaw", "_EPDFPage_GetAnnotRaw", "_EPDFPage_GetObjectNumber", "_EPDFPage_GetParsedSize", "_EPDFPage_GetViewport", "_EPDFPage_GetViewportRaw", "_EPDFPage_ImportAnnotsRaw", "_EPDFPage_ImportRaw", "_EPDFPage_InsertBlankRaw", "_EPDFPage_IsContentCurrent", "_EPDFPage_IsValid", "_EPDFPage_MoveAnnots", "_EPDFPage_MoveAnnotsRaw", "_EPDFPage_PromoteInlineAnnotsRaw", "_EPDFPage_RemoveAnnot", "_EPDFPage_RemoveAnnotByName", "_EPDFPage_RemoveAnnotByObjectNumber", "_EPDFPage_RemoveAnnotRaw", "_EPDFPage_RemoveViewport", "_EPDFPage_RemoveViewportRaw", "_EPDFPage_ResetRenderCache", "_EPDFSig_CloseModel", "_EPDFSig_Count", "_EPDFSig_DigestByteRange", "_EPDFSig_DigestFileRange", "_EPDFSig_GetByteRange", "_EPDFSig_GetContents", "_EPDFSig_GetCoverage", "_EPDFSig_GetDocMDPPermission", "_EPDFSig_GetFieldMDPAction", "_EPDFSig_GetFieldName", "_EPDFSig_GetFieldNameAt", "_EPDFSig_GetFieldNameCount", "_EPDFSig_GetFieldObjNum", "_EPDFSig_GetIndexByFieldObjNum", "_EPDFSig_GetKind", "_EPDFSig_GetLockAction", "_EPDFSig_GetLockPermission", "_EPDFSig_GetRevisionIndex", "_EPDFSig_GetSeedValueFilter", "_EPDFSig_GetSeedValueListAt", "_EPDFSig_GetSeedValueListCount", "_EPDFSig_GetSeedValueMDP", "_EPDFSig_GetSeedValuePresentFlags", "_EPDFSig_GetSeedValueRequiredFlags", "_EPDFSig_GetSeedValueVersion", "_EPDFSig_GetString", "_EPDFSig_GetValueObjNum", "_EPDFSig_GetWidgetObjNum", "_EPDFSig_GetWidgetPageObjNum", "_EPDFSig_HasSeedValue", "_EPDFSig_IsCatalogCertification", "_EPDFSig_IsRevisionChainValid", "_EPDFSig_IsSigned", "_EPDFSig_LoadModel", "_EPDFSig_Prepare", "_EPDFSig_SaveCandidate", "_EPDFSig_SaveCandidateToOwnedBuffer", "_EPDFSig_Seal", "_EPDFSig_SealSpan", "_EPDFSig_SetFieldLock", "_EPDFSig_WriteContents", "_EPDFText_GetCharGeometry", "_EPDFText_GetCharToTextMap", "_EPDFText_GetPageGeometry", "_EPDFText_GetTextFull", "_EPDFText_RedactInQuads", "_EPDFText_RedactInRect", "_EPDFViewport_AddMeasure", "_EPDFViewport_Close", "_EPDFViewport_GetBBox", "_EPDFViewport_GetMeasure", "_EPDFViewport_GetName", "_EPDFViewport_RemoveMeasure", "_EPDFViewport_SetBBox", "_EPDFViewport_SetName", "_FORM_CanRedo", "_FORM_CanUndo", "_FORM_DoDocumentAAction", "_FORM_DoDocumentJSAction", "_FORM_DoDocumentOpenAction", "_FORM_DoPageAAction", "_FORM_ForceToKillFocus", "_FORM_GetFocusedAnnot", "_FORM_GetFocusedText", "_FORM_GetSelectedText", "_FORM_GetTextDirection", "_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_SetTextDirection", "_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_GetExpansion", "_FPDF_StructElement_GetID", "_FPDF_StructElement_GetLang", "_FPDF_StructElement_GetMarkedContentID", "_FPDF_StructElement_GetMarkedContentIdAtIndex", "_FPDF_StructElement_GetMarkedContentIdCount", "_FPDF_StructElement_GetObjType", "_FPDF_StructElement_GetParent", "_FPDF_StructElement_GetRawType", "_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_SetFontColor", "_FPDFAnnot_SetFormFieldFlags", "_FPDFAnnot_SetRect", "_FPDFAnnot_SetStringValue", "_FPDFAnnot_SetURI", "_FPDFAnnot_UpdateObject", "_FPDFAttachment_GetAFRelationship", "_FPDFAttachment_GetDescription", "_FPDFAttachment_GetFile", "_FPDFAttachment_GetName", "_FPDFAttachment_GetStringValue", "_FPDFAttachment_GetSubtype", "_FPDFAttachment_GetValueType", "_FPDFAttachment_HasKey", "_FPDFAttachment_SetDescription", "_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_GetColor", "_FPDFBookmark_GetCount", "_FPDFBookmark_GetDest", "_FPDFBookmark_GetFirstChild", "_FPDFBookmark_GetNextSibling", "_FPDFBookmark_GetStyle", "_FPDFBookmark_GetTitle", "_FPDFCatalog_GetLanguage", "_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", "_FPDFFormObj_RemoveObject", "_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_InsertObjectAtIndex", "_FPDFPage_New", "_FPDFPage_RemoveAnnot", "_FPDFPage_RemoveObject", "_FPDFPage_SetArtBox", "_FPDFPage_SetBleedBox", "_FPDFPage_SetCropBox", "_FPDFPage_SetMediaBox", "_FPDFPage_SetRotation", "_FPDFPage_SetTrimBox", "_FPDFPage_TransformAnnots", "_FPDFPage_TransFormWithClip", "_FPDFPageObj_AddExistingMark", "_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_GetRenderedFillPattern", "_FPDFPageObj_GetRenderedStrokePattern", "_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_GetParamFloatValue", "_FPDFPageObjMark_GetParamIntValue", "_FPDFPageObjMark_GetParamKey", "_FPDFPageObjMark_GetParamStringValue", "_FPDFPageObjMark_GetParamValueType", "_FPDFPageObjMark_RemoveParam", "_FPDFPageObjMark_SetBlobParam", "_FPDFPageObjMark_SetFloatParam", "_FPDFPageObjMark_SetIntParam", "_FPDFPageObjMark_SetStringParam", "_FPDFPath_BezierTo", "_FPDFPath_Close", "_FPDFPath_CountSegments", "_FPDFPath_GetBezierControlPoints", "_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_SetPositions", "_FPDFText_SetText", "_FPDFTextObj_GetFont", "_FPDFTextObj_GetFontSize", "_FPDFTextObj_GetRenderedBitmap", "_FPDFTextObj_GetText", "_FPDFTextObj_GetTextRenderMode", "_FPDFTextObj_SetFontSize", "_FPDFTextObj_SetTextRenderMode", "_malloc", "_free", "_memory", "___indirect_function_table", "onRuntimeInitialized"].forEach((m) => { + ["_EPDF_CheckPasswordPermissions", "_EPDF_DigestBuffer", "_EPDF_FreeBuffer", "_EPDF_GetDecodedImageBytes", "_EPDF_GetMetaKeyCount", "_EPDF_GetMetaKeyName", "_EPDF_GetMetaTrapped", "_EPDF_GetPageBoxByIndex", "_EPDF_GetPageRotateByIndex", "_EPDF_GetPageTabOrderByIndex", "_EPDF_GetPageUserUnitByIndex", "_EPDF_HasMetaText", "_EPDF_InitThread", "_EPDF_IsEncrypted", "_EPDF_IsOwnerUnlocked", "_EPDF_LoadBaseDocument", "_EPDF_LoadMemBaseDocument", "_EPDF_LoadMemBaseDocument64", "_EPDF_LoadPageNormalized", "_EPDF_PNG_EncodeRGBA", "_EPDF_ReleaseBaseDocument", "_EPDF_RemoveEncryption", "_EPDF_RenderAnnotBitmap", "_EPDF_RenderAnnotBitmapUnrotated", "_EPDF_RenderPage_Continue", "_EPDF_RenderPageBitmapWithMatrix_Start", "_EPDF_SaveAsCopyEx", "_EPDF_SaveDocumentToOwnedBuffer", "_EPDF_SaveDocumentToOwnedBufferEx", "_EPDF_SaveDocumentToOwnedBufferWithVersion", "_EPDF_SetBaseDocumentSha256", "_EPDF_SetDecodedImageBudget", "_EPDF_SetEncryption", "_EPDF_SetMetaText", "_EPDF_SetMetaTrapped", "_EPDF_SetRuntimeOwnerPermissions", "_EPDF_ShutdownThread", "_EPDF_UnlockOwnerPermissions", "_EPDFAction_CloseModel", "_EPDFAction_CreateGoTo", "_EPDFAction_CreateGoToNamed", "_EPDFAction_CreateHide", "_EPDFAction_CreateJavaScript", "_EPDFAction_CreateLaunch", "_EPDFAction_CreateNamed", "_EPDFAction_CreateRemoteGoToByName", "_EPDFAction_CreateRemoteGoToDest", "_EPDFAction_CreateResetForm", "_EPDFAction_CreateSubmitForm", "_EPDFAction_CreateURI", "_EPDFAction_GetNextAt", "_EPDFAction_GetNextCount", "_EPDFAction_GetNodeCount", "_EPDFAction_GetNodeDest", "_EPDFAction_GetNodeFilePath", "_EPDFAction_GetNodeHideFlag", "_EPDFAction_GetNodeJavaScript", "_EPDFAction_GetNodeName", "_EPDFAction_GetNodeResetForm", "_EPDFAction_GetNodeSubmitForm", "_EPDFAction_GetNodeSubmitFormCharSet", "_EPDFAction_GetNodeSubmitFormURL", "_EPDFAction_GetNodeSubtype", "_EPDFAction_GetNodeTargetCount", "_EPDFAction_GetNodeTargetName", "_EPDFAction_GetNodeTargetObjectNumber", "_EPDFAction_GetNodeType", "_EPDFAction_GetNodeURI", "_EPDFAction_GetNodeURIIsMap", "_EPDFAction_GetRootNode", "_EPDFAction_GetWarningFlags", "_EPDFAction_IsComplete", "_EPDFAction_LoadModel", "_EPDFAction_NodeHasJavaScript", "_EPDFAction_SetNext", "_EPDFAnnot_AddMeasure", "_EPDFAnnot_ClearBorderEffect", "_EPDFAnnot_ClearColor", "_EPDFAnnot_ClearEmbedMetadata", "_EPDFAnnot_ClearEmbedMetadataKey", "_EPDFAnnot_ClearMKColor", "_EPDFAnnot_ClearMKIcon", "_EPDFAnnot_ClearRectangleDifferences", "_EPDFAnnot_ExportAppearance", "_EPDFAnnot_GenerateAppearance", "_EPDFAnnot_GenerateAppearanceWithBlend", "_EPDFAnnot_GenerateFormFieldAP", "_EPDFAnnot_GetActionModel", "_EPDFAnnot_GetAPMatrix", "_EPDFAnnot_GetAppearanceState", "_EPDFAnnot_GetAppearanceStateCount", "_EPDFAnnot_GetAppearanceStateName", "_EPDFAnnot_GetAppearanceTransform", "_EPDFAnnot_GetAvailableAppearanceModes", "_EPDFAnnot_GetBlendMode", "_EPDFAnnot_GetBooleanValue", "_EPDFAnnot_GetBorderDashPattern", "_EPDFAnnot_GetBorderDashPatternCount", "_EPDFAnnot_GetBorderEffect", "_EPDFAnnot_GetBorderStyle", "_EPDFAnnot_GetCalloutLine", "_EPDFAnnot_GetCalloutLineCount", "_EPDFAnnot_GetColor", "_EPDFAnnot_GetDefaultAppearance", "_EPDFAnnot_GetDefaultAppearanceFontFace", "_EPDFAnnot_GetDefaultAppearanceFontPostScriptName", "_EPDFAnnot_GetDrawing", "_EPDFAnnot_GetDrawingRect", "_EPDFAnnot_GetEmbedMetadataBoolean", "_EPDFAnnot_GetEmbedMetadataJSON", "_EPDFAnnot_GetEmbedMetadataNumber", "_EPDFAnnot_GetEmbedMetadataRect", "_EPDFAnnot_GetEmbedMetadataString", "_EPDFAnnot_GetFileAttachmentForWrite", "_EPDFAnnot_GetIntent", "_EPDFAnnot_GetLineCaption", "_EPDFAnnot_GetLineEndings", "_EPDFAnnot_GetLineLeader", "_EPDFAnnot_GetMeasure", "_EPDFAnnot_GetMKColor", "_EPDFAnnot_GetMKIcon", "_EPDFAnnot_GetMKRotation", "_EPDFAnnot_GetMKText", "_EPDFAnnot_GetMKTextPosition", "_EPDFAnnot_GetName", "_EPDFAnnot_GetObjectNumber", "_EPDFAnnot_GetOpacity", "_EPDFAnnot_GetOverlayText", "_EPDFAnnot_GetOverlayTextRepeat", "_EPDFAnnot_GetRect", "_EPDFAnnot_GetRectangleDifferences", "_EPDFAnnot_GetReplyType", "_EPDFAnnot_GetRichContent", "_EPDFAnnot_GetRichTextJSON", "_EPDFAnnot_GetRotate", "_EPDFAnnot_GetShapeCaption", "_EPDFAnnot_GetStructurePosition", "_EPDFAnnot_GetTextAlignment", "_EPDFAnnot_HasAppearanceStream", "_EPDFAnnot_HasEmbedMetadata", "_EPDFAnnot_HasMKIcon", "_EPDFAnnot_IsValid", "_EPDFAnnot_RemoveAction", "_EPDFAnnot_RemoveDest", "_EPDFAnnot_RemoveKey", "_EPDFAnnot_RemoveMeasure", "_EPDFAnnot_SetAction", "_EPDFAnnot_SetAPMatrix", "_EPDFAnnot_SetAppearanceFromPage", "_EPDFAnnot_SetBooleanValue", "_EPDFAnnot_SetBorderDashPattern", "_EPDFAnnot_SetBorderEffect", "_EPDFAnnot_SetBorderStyle", "_EPDFAnnot_SetCalloutLine", "_EPDFAnnot_SetColor", "_EPDFAnnot_SetDefaultAppearance", "_EPDFAnnot_SetDefaultAppearanceDocumentFont", "_EPDFAnnot_SetDefaultAppearanceRegisteredFont", "_EPDFAnnot_SetDrawing", "_EPDFAnnot_SetEmbedMetadataBoolean", "_EPDFAnnot_SetEmbedMetadataJSON", "_EPDFAnnot_SetEmbedMetadataNumber", "_EPDFAnnot_SetEmbedMetadataRect", "_EPDFAnnot_SetEmbedMetadataString", "_EPDFAnnot_SetEventAction", "_EPDFAnnot_SetIntent", "_EPDFAnnot_SetLine", "_EPDFAnnot_SetLineCaption", "_EPDFAnnot_SetLineEndings", "_EPDFAnnot_SetLineLeader", "_EPDFAnnot_SetLinkedAnnot", "_EPDFAnnot_SetMKColor", "_EPDFAnnot_SetMKIcon", "_EPDFAnnot_SetMKRotation", "_EPDFAnnot_SetMKText", "_EPDFAnnot_SetMKTextPosition", "_EPDFAnnot_SetName", "_EPDFAnnot_SetNoColor", "_EPDFAnnot_SetNumberValue", "_EPDFAnnot_SetOpacity", "_EPDFAnnot_SetOverlayText", "_EPDFAnnot_SetOverlayTextRepeat", "_EPDFAnnot_SetRect", "_EPDFAnnot_SetReplyType", "_EPDFAnnot_SetRichTextJSON", "_EPDFAnnot_SetRichTextXHTML", "_EPDFAnnot_SetRotate", "_EPDFAnnot_SetShapeCaption", "_EPDFAnnot_SetStampOpacity", "_EPDFAnnot_SetSubtype", "_EPDFAnnot_SetTextAlignment", "_EPDFAnnot_SetVertices", "_EPDFAnnot_UpdateAppearanceToRect", "_EPDFAttachment_ExportCanonicalToOwnedBuffer", "_EPDFAttachment_ExportRawToOwnedBuffer", "_EPDFAttachment_ExtractFile", "_EPDFAttachment_ExtractFileToOwnedBuffer", "_EPDFAttachment_GetDescription", "_EPDFAttachment_GetIntegerValue", "_EPDFAttachment_ImportRaw", "_EPDFAttachment_SetDescription", "_EPDFAttachment_SetName", "_EPDFAttachment_SetSubtype", "_EPDFCatalog_GetLanguage", "_EPDFCatalog_GetMetadata", "_EPDFCatalog_SetMetadata", "_EPDFDest_CreateRemoteView", "_EPDFDest_CreateRemoteXYZ", "_EPDFDest_CreateView", "_EPDFDest_CreateViewByObjectNumber", "_EPDFDest_CreateXYZ", "_EPDFDest_CreateXYZByObjectNumber", "_EPDFDest_GetPageObjectNumber", "_EPDFDest_GetViewNullParams", "_EPDFDoc_CanonicalDrawing", "_EPDFDoc_ClearMissingCharacters", "_EPDFDoc_ClearPagePieceInfoEntry", "_EPDFDoc_ClearPagePieceInfoKey", "_EPDFDoc_ClearPieceInfoEntry", "_EPDFDoc_ClearPieceInfoKey", "_EPDFDoc_CompareRevisions", "_EPDFDoc_CountMissingCharacters", "_EPDFDoc_DeletePageByObjectNumber", "_EPDFDoc_ExportDictCanonicalToOwnedBuffer", "_EPDFDoc_ExportDictRawToOwnedBuffer", "_EPDFDoc_ExportDrawing", "_EPDFDoc_ExportPagesFlattened", "_EPDFDoc_GetAdditionalActionModel", "_EPDFDoc_GetAttachmentIndexByKey", "_EPDFDoc_GetAttachmentKey", "_EPDFDoc_GetBaseBytesSize", "_EPDFDoc_GetDrawings", "_EPDFDoc_GetFontDisplayProgramCoverage", "_EPDFDoc_GetFontDisplayProgramData", "_EPDFDoc_GetFontEmbeddingPolicy", "_EPDFDoc_GetFontProgramData", "_EPDFDoc_GetFontsFingerprint", "_EPDFDoc_GetImportFieldRoots", "_EPDFDoc_GetLastModified", "_EPDFDoc_GetLoadedBytesSize", "_EPDFDoc_GetLoadedObjectValue", "_EPDFDoc_GetMissingCharacter", "_EPDFDoc_GetNamedJavaScriptActionModel", "_EPDFDoc_GetNamedPageAt", "_EPDFDoc_GetNamedPageCount", "_EPDFDoc_GetOpenActionDest", "_EPDFDoc_GetOpenActionModel", "_EPDFDoc_GetPageActionModel", "_EPDFDoc_GetPageLabelSectionAt", "_EPDFDoc_GetPageLabelSectionCount", "_EPDFDoc_GetPageLastModified", "_EPDFDoc_GetPageObjectNumberByIndex", "_EPDFDoc_GetPagePieceInfoBoolean", "_EPDFDoc_GetPagePieceInfoEntryAt", "_EPDFDoc_GetPagePieceInfoEntryCount", "_EPDFDoc_GetPagePieceInfoKeyAt", "_EPDFDoc_GetPagePieceInfoKeyCount", "_EPDFDoc_GetPagePieceInfoLastModified", "_EPDFDoc_GetPagePieceInfoName", "_EPDFDoc_GetPagePieceInfoNumber", "_EPDFDoc_GetPagePieceInfoString", "_EPDFDoc_GetPagePieceInfoStringArrayAt", "_EPDFDoc_GetPagePieceInfoStringArrayCount", "_EPDFDoc_GetPagePieceInfoValueType", "_EPDFDoc_GetPieceInfoBoolean", "_EPDFDoc_GetPieceInfoEntryAt", "_EPDFDoc_GetPieceInfoEntryCount", "_EPDFDoc_GetPieceInfoKeyAt", "_EPDFDoc_GetPieceInfoKeyCount", "_EPDFDoc_GetPieceInfoLastModified", "_EPDFDoc_GetPieceInfoName", "_EPDFDoc_GetPieceInfoNumber", "_EPDFDoc_GetPieceInfoString", "_EPDFDoc_GetPieceInfoStringArrayAt", "_EPDFDoc_GetPieceInfoStringArrayCount", "_EPDFDoc_GetPieceInfoValueType", "_EPDFDoc_GetRevision", "_EPDFDoc_GetRevisionCount", "_EPDFDoc_GetStructureObjectNumbers", "_EPDFDoc_GetTypographicFeatures", "_EPDFDoc_HasPagePieceInfoEntry", "_EPDFDoc_HasPieceInfoEntry", "_EPDFDoc_ImportDictRaw", "_EPDFDoc_ImportDrawing", "_EPDFDoc_ImportPages", "_EPDFDoc_LoadPageByObjectNumber", "_EPDFDoc_LoadPageByObjectNumberNormalized", "_EPDFDoc_OpenBaseOverlay", "_EPDFDoc_OpenBaseOverlayFromPath", "_EPDFDoc_OpenRevision", "_EPDFDoc_ReadLoadedBytes", "_EPDFDoc_RemoveNamedPage", "_EPDFDoc_RemoveNamedPagesForPage", "_EPDFDoc_ResolveFonts", "_EPDFDoc_SetFontEmbeddingPolicy", "_EPDFDoc_SetNamedPage", "_EPDFDoc_SetPageLabelSections", "_EPDFDoc_SetPagePieceInfoBoolean", "_EPDFDoc_SetPagePieceInfoName", "_EPDFDoc_SetPagePieceInfoNumber", "_EPDFDoc_SetPagePieceInfoString", "_EPDFDoc_SetPagePieceInfoStringArray", "_EPDFDoc_SetPageRotationByObjectNumber", "_EPDFDoc_SetPieceInfoBoolean", "_EPDFDoc_SetPieceInfoName", "_EPDFDoc_SetPieceInfoNumber", "_EPDFDoc_SetPieceInfoString", "_EPDFDoc_SetPieceInfoStringArray", "_EPDFDoc_SetTypographicFeatures", "_EPDFDoc_StartLoadPageByObjectNumber", "_EPDFDocument_ClearEmbedMetadata", "_EPDFDss_Add", "_EPDFDss_GetCount", "_EPDFDss_GetData", "_EPDFFont_AddFallbackFont", "_EPDFFont_AuthorizeEditing", "_EPDFFont_ClearFallbackFonts", "_EPDFFont_ClearRegisteredFonts", "_EPDFFont_GetCoverage", "_EPDFFont_GetEmbeddingPermission", "_EPDFFont_GetFallbackOrder", "_EPDFFont_GetFamilyName", "_EPDFFont_GetLastResortFont", "_EPDFFont_GetMetrics", "_EPDFFont_GetPostScriptName", "_EPDFFont_GetProgramData", "_EPDFFont_GetProgramFormat", "_EPDFFont_GetProgramHash", "_EPDFFont_GetWeight", "_EPDFFont_IsEditingAuthorized", "_EPDFFont_IsInstanced", "_EPDFFont_IsItalic", "_EPDFFont_RegisterFont", "_EPDFFont_RegisterMemFont", "_EPDFFont_RegisterMemFont64", "_EPDFFont_SetLastResortFont", "_EPDFFontFaces_Close", "_EPDFFontFaces_Count", "_EPDFFontFaces_CountPrograms", "_EPDFFontFaces_GetFamily", "_EPDFFontFaces_GetProgramDisplayHash", "_EPDFFontFaces_GetProgramEmbedded", "_EPDFFontFaces_GetProgramEmbeddingPermission", "_EPDFFontFaces_GetProgramFormat", "_EPDFFontFaces_GetProgramHash", "_EPDFFontFaces_GetProgramMetrics", "_EPDFFontFaces_GetProgramObjNum", "_EPDFFontFaces_GetProgramPostScriptName", "_EPDFFontFaces_GetWeight", "_EPDFFontFaces_IsItalic", "_EPDFFontFaces_Load", "_EPDFFontFaces_ProgramMapsUnicode", "_EPDFFontResolution_Close", "_EPDFFontResolution_CountMissingCharacters", "_EPDFFontResolution_GetBaseFontName", "_EPDFFontResolution_GetFallbacks", "_EPDFFontResolution_GetFamily", "_EPDFFontResolution_GetMissingCharacter", "_EPDFFontResolution_GetProgramDisplayHash", "_EPDFFontResolution_GetProgramObjNum", "_EPDFFontResolution_GetRegisteredFont", "_EPDFFontResolution_GetSource", "_EPDFFontResolution_GetWeight", "_EPDFFontResolution_IsDegraded", "_EPDFFontResolution_IsItalic", "_EPDFForm_AttachWidget", "_EPDFForm_ClearFieldEmbedMetadata", "_EPDFForm_ClearFieldEmbedMetadataKey", "_EPDFForm_CloseModel", "_EPDFForm_CountCalculationOrder", "_EPDFForm_CountFieldDefaultValues", "_EPDFForm_CountFieldOptions", "_EPDFForm_CountFields", "_EPDFForm_CountFieldValues", "_EPDFForm_CountFieldWidgets", "_EPDFForm_CreateField", "_EPDFForm_DeleteField", "_EPDFForm_DetachWidget", "_EPDFForm_ExportFDF", "_EPDFForm_ExportFieldRawToOwnedBuffer", "_EPDFForm_ExportXFDF", "_EPDFForm_GetCalculationOrderFieldIndex", "_EPDFForm_GetFieldActionModel", "_EPDFForm_GetFieldAlternateName", "_EPDFForm_GetFieldDefaultValueAt", "_EPDFForm_GetFieldDefaultValueKind", "_EPDFForm_GetFieldEmbedMetadataBoolean", "_EPDFForm_GetFieldEmbedMetadataJSON", "_EPDFForm_GetFieldEmbedMetadataNumber", "_EPDFForm_GetFieldEmbedMetadataString", "_EPDFForm_GetFieldFamily", "_EPDFForm_GetFieldFlags", "_EPDFForm_GetFieldIndexByObjNum", "_EPDFForm_GetFieldIndexForWidget", "_EPDFForm_GetFieldMappingName", "_EPDFForm_GetFieldMaxLen", "_EPDFForm_GetFieldName", "_EPDFForm_GetFieldObjNum", "_EPDFForm_GetFieldOptionLabel", "_EPDFForm_GetFieldOptionValue", "_EPDFForm_GetFieldOrigin", "_EPDFForm_GetFieldPartialName", "_EPDFForm_GetFieldTopIndex", "_EPDFForm_GetFieldValueAt", "_EPDFForm_GetFieldValueKind", "_EPDFForm_GetFieldWidgetExportValue", "_EPDFForm_GetFieldWidgetObjNum", "_EPDFForm_GetFieldWidgetOnState", "_EPDFForm_GetFieldWidgetPageObjNum", "_EPDFForm_GetFieldWidgetRect", "_EPDFForm_GetFormKind", "_EPDFForm_GetNeedAppearances", "_EPDFForm_HasFieldEmbedMetadata", "_EPDFForm_HasFieldValuesList", "_EPDFForm_ImportFieldRaw", "_EPDFForm_IsFieldOptionSelected", "_EPDFForm_IsFieldWidgetChecked", "_EPDFForm_LoadModel", "_EPDFForm_RedrawFieldWidgets", "_EPDFForm_Repair", "_EPDFForm_SetCalculationOrder", "_EPDFForm_SetFieldAlternateName", "_EPDFForm_SetFieldAppearanceText", "_EPDFForm_SetFieldDefaultValue", "_EPDFForm_SetFieldDisplay", "_EPDFForm_SetFieldEmbedMetadataBoolean", "_EPDFForm_SetFieldEmbedMetadataJSON", "_EPDFForm_SetFieldEmbedMetadataNumber", "_EPDFForm_SetFieldEmbedMetadataString", "_EPDFForm_SetFieldEventAction", "_EPDFForm_SetFieldFlags", "_EPDFForm_SetFieldMappingName", "_EPDFForm_SetFieldMaxLen", "_EPDFForm_SetFieldName", "_EPDFForm_SetFieldOptions", "_EPDFForm_SetFieldSelectedIndices", "_EPDFForm_SetFieldValue", "_EPDFForm_SetFieldWidgetsChecked", "_EPDFImageObj_SetJpeg", "_EPDFImageObj_SetPng", "_EPDFLayer_AbortTransaction", "_EPDFLayer_BeginTransaction", "_EPDFLayer_CommitTransaction", "_EPDFLayer_GetBaseDocument", "_EPDFLayer_GetBaseSha256", "_EPDFLayer_GetBirthName", "_EPDFLayer_GetBirthObjectNumber", "_EPDFLayer_GetLastObjectNumber", "_EPDFLayer_GetPromotedObjectCount", "_EPDFLayer_IsInTransaction", "_EPDFLayer_IsObjectPromoted", "_EPDFLayer_IsPagePromoted", "_EPDFLayer_OpenLayer", "_EPDFLayer_OpenLayerArtifact", "_EPDFLayer_OpenLayerArtifactFromPath", "_EPDFLayer_RaiseLastObjectNumber", "_EPDFLayer_SaveDelta", "_EPDFLayer_SaveDeltaEx", "_EPDFLayer_SaveDeltaToOwnedBuffer", "_EPDFLayer_SaveDeltaToOwnedBufferEx", "_EPDFLayer_SaveLayerArtifact", "_EPDFLayer_SaveLayerArtifactEx", "_EPDFLayer_SaveLayerArtifactToOwnedBuffer", "_EPDFLayer_SaveLayerArtifactToOwnedBufferEx", "_EPDFMeasure_AddFormat", "_EPDFMeasure_CountFormats", "_EPDFMeasure_GetCYX", "_EPDFMeasure_GetFormat", "_EPDFMeasure_GetOrigin", "_EPDFMeasure_GetRatio", "_EPDFMeasure_GetSubtype", "_EPDFMeasure_RemoveFormats", "_EPDFMeasure_SetCYX", "_EPDFMeasure_SetOrigin", "_EPDFMeasure_SetRatio", "_EPDFNamedDest_Remove", "_EPDFNamedDest_SetDest", "_EPDFNumberFormat_GetConversion", "_EPDFNumberFormat_GetFixedDenominator", "_EPDFNumberFormat_GetFraction", "_EPDFNumberFormat_GetLabelPosition", "_EPDFNumberFormat_GetPrecision", "_EPDFNumberFormat_GetText", "_EPDFNumberFormat_GetUnit", "_EPDFNumberFormat_SetConversion", "_EPDFNumberFormat_SetFixedDenominator", "_EPDFNumberFormat_SetFraction", "_EPDFNumberFormat_SetLabelPosition", "_EPDFNumberFormat_SetPrecision", "_EPDFNumberFormat_SetText", "_EPDFNumberFormat_SetUnit", "_EPDFObjectDiff_Close", "_EPDFObjectDiff_GetCount", "_EPDFObjectDiff_GetEntry", "_EPDFObjectDiff_GetReadStatus", "_EPDFObjectDiff_GetReferrer", "_EPDFObjectDiff_GetReferrerCount", "_EPDFObjectDiff_GetRevisionHealth", "_EPDFObjectDiff_GetValue", "_EPDFOutline_CreateItem", "_EPDFOutline_DeleteItem", "_EPDFOutline_ExportItemRawToOwnedBuffer", "_EPDFOutline_GetItem", "_EPDFOutline_GetObjectNumber", "_EPDFOutline_ImportItemRaw", "_EPDFOutline_MoveItem", "_EPDFOutline_SetAction", "_EPDFOutline_SetColor", "_EPDFOutline_SetOpen", "_EPDFOutline_SetStyle", "_EPDFOutline_SetTitle", "_EPDFPage_AddViewport", "_EPDFPage_AddViewportRaw", "_EPDFPage_ApplyRedactions", "_EPDFPage_ContinueLoad", "_EPDFPage_CountViewports", "_EPDFPage_CountViewportsRaw", "_EPDFPage_CreateAnnot", "_EPDFPage_CreateAnnotRaw", "_EPDFPage_ExportAnnotationsAsDocument", "_EPDFPage_ExportAnnotsRawToOwnedBuffer", "_EPDFPage_ExportRawToOwnedBuffer", "_EPDFPage_FindViewport", "_EPDFPage_Flatten", "_EPDFPage_FlattenAnnotations", "_EPDFPage_GetAnnotByName", "_EPDFPage_GetAnnotByObjectNumber", "_EPDFPage_GetAnnotCountRaw", "_EPDFPage_GetAnnotIndexByNameRaw", "_EPDFPage_GetAnnotIndexByObjectNumberRaw", "_EPDFPage_GetAnnotRaw", "_EPDFPage_GetObjectNumber", "_EPDFPage_GetParsedSize", "_EPDFPage_GetViewport", "_EPDFPage_GetViewportRaw", "_EPDFPage_ImportAnnotsRaw", "_EPDFPage_ImportRaw", "_EPDFPage_InsertBlankRaw", "_EPDFPage_IsContentCurrent", "_EPDFPage_IsValid", "_EPDFPage_MoveAnnots", "_EPDFPage_MoveAnnotsRaw", "_EPDFPage_PromoteInlineAnnotsRaw", "_EPDFPage_RemoveAnnot", "_EPDFPage_RemoveAnnotByName", "_EPDFPage_RemoveAnnotByObjectNumber", "_EPDFPage_RemoveAnnotRaw", "_EPDFPage_RemoveViewport", "_EPDFPage_RemoveViewportRaw", "_EPDFPage_ResetRenderCache", "_EPDFSig_CloseModel", "_EPDFSig_Count", "_EPDFSig_DigestByteRange", "_EPDFSig_DigestFileRange", "_EPDFSig_GetByteRange", "_EPDFSig_GetContents", "_EPDFSig_GetCoverage", "_EPDFSig_GetDocMDPPermission", "_EPDFSig_GetFieldMDPAction", "_EPDFSig_GetFieldName", "_EPDFSig_GetFieldNameAt", "_EPDFSig_GetFieldNameCount", "_EPDFSig_GetFieldObjNum", "_EPDFSig_GetIndexByFieldObjNum", "_EPDFSig_GetKind", "_EPDFSig_GetLockAction", "_EPDFSig_GetLockPermission", "_EPDFSig_GetRevisionIndex", "_EPDFSig_GetSeedValueFilter", "_EPDFSig_GetSeedValueListAt", "_EPDFSig_GetSeedValueListCount", "_EPDFSig_GetSeedValueMDP", "_EPDFSig_GetSeedValuePresentFlags", "_EPDFSig_GetSeedValueRequiredFlags", "_EPDFSig_GetSeedValueVersion", "_EPDFSig_GetString", "_EPDFSig_GetValueObjNum", "_EPDFSig_GetWidgetObjNum", "_EPDFSig_GetWidgetPageObjNum", "_EPDFSig_HasSeedValue", "_EPDFSig_IsCatalogCertification", "_EPDFSig_IsRevisionChainValid", "_EPDFSig_IsSigned", "_EPDFSig_LoadModel", "_EPDFSig_Prepare", "_EPDFSig_SaveCandidate", "_EPDFSig_SaveCandidateToOwnedBuffer", "_EPDFSig_Seal", "_EPDFSig_SealSpan", "_EPDFSig_SetFieldLock", "_EPDFSig_WriteContents", "_EPDFText_GetCharGeometry", "_EPDFText_GetCharToTextMap", "_EPDFText_GetPageGeometry", "_EPDFText_GetTextFull", "_EPDFText_RedactInQuads", "_EPDFText_RedactInRect", "_EPDFViewport_AddMeasure", "_EPDFViewport_Close", "_EPDFViewport_GetBBox", "_EPDFViewport_GetMeasure", "_EPDFViewport_GetName", "_EPDFViewport_RemoveMeasure", "_EPDFViewport_SetBBox", "_EPDFViewport_SetName", "_FORM_CanRedo", "_FORM_CanUndo", "_FORM_DoDocumentAAction", "_FORM_DoDocumentJSAction", "_FORM_DoDocumentOpenAction", "_FORM_DoPageAAction", "_FORM_ForceToKillFocus", "_FORM_GetFocusedAnnot", "_FORM_GetFocusedText", "_FORM_GetSelectedText", "_FORM_GetTextDirection", "_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_SetTextDirection", "_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_GetExpansion", "_FPDF_StructElement_GetID", "_FPDF_StructElement_GetLang", "_FPDF_StructElement_GetMarkedContentID", "_FPDF_StructElement_GetMarkedContentIdAtIndex", "_FPDF_StructElement_GetMarkedContentIdCount", "_FPDF_StructElement_GetObjType", "_FPDF_StructElement_GetParent", "_FPDF_StructElement_GetRawType", "_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_SetFontColor", "_FPDFAnnot_SetFormFieldFlags", "_FPDFAnnot_SetRect", "_FPDFAnnot_SetStringValue", "_FPDFAnnot_SetURI", "_FPDFAnnot_UpdateObject", "_FPDFAttachment_GetAFRelationship", "_FPDFAttachment_GetDescription", "_FPDFAttachment_GetFile", "_FPDFAttachment_GetName", "_FPDFAttachment_GetStringValue", "_FPDFAttachment_GetSubtype", "_FPDFAttachment_GetValueType", "_FPDFAttachment_HasKey", "_FPDFAttachment_SetDescription", "_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_GetColor", "_FPDFBookmark_GetCount", "_FPDFBookmark_GetDest", "_FPDFBookmark_GetFirstChild", "_FPDFBookmark_GetNextSibling", "_FPDFBookmark_GetStyle", "_FPDFBookmark_GetTitle", "_FPDFCatalog_GetLanguage", "_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", "_FPDFFormObj_RemoveObject", "_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_InsertObjectAtIndex", "_FPDFPage_New", "_FPDFPage_RemoveAnnot", "_FPDFPage_RemoveObject", "_FPDFPage_SetArtBox", "_FPDFPage_SetBleedBox", "_FPDFPage_SetCropBox", "_FPDFPage_SetMediaBox", "_FPDFPage_SetRotation", "_FPDFPage_SetTrimBox", "_FPDFPage_TransformAnnots", "_FPDFPage_TransFormWithClip", "_FPDFPageObj_AddExistingMark", "_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_GetRenderedFillPattern", "_FPDFPageObj_GetRenderedStrokePattern", "_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_GetParamFloatValue", "_FPDFPageObjMark_GetParamIntValue", "_FPDFPageObjMark_GetParamKey", "_FPDFPageObjMark_GetParamStringValue", "_FPDFPageObjMark_GetParamValueType", "_FPDFPageObjMark_RemoveParam", "_FPDFPageObjMark_SetBlobParam", "_FPDFPageObjMark_SetFloatParam", "_FPDFPageObjMark_SetIntParam", "_FPDFPageObjMark_SetStringParam", "_FPDFPath_BezierTo", "_FPDFPath_Close", "_FPDFPath_CountSegments", "_FPDFPath_GetBezierControlPoints", "_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_SetPositions", "_FPDFText_SetText", "_FPDFTextObj_GetFont", "_FPDFTextObj_GetFontSize", "_FPDFTextObj_GetRenderedBitmap", "_FPDFTextObj_GetText", "_FPDFTextObj_GetTextRenderMode", "_FPDFTextObj_SetFontSize", "_FPDFTextObj_SetTextRenderMode", "_malloc", "_free", "_memory", "_EPDF_FillFromHostCrypto", "___indirect_function_table", "onRuntimeInitialized"].forEach((m) => { Object.getOwnPropertyDescriptor(w, m) || Object.defineProperty(w, m, { get: () => te("You are getting " + m + " 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"), set: () => te("You are setting " + m + " 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") }); }); var x = typeof window == "object", j = "u" > typeof WorkerGlobalScope, R = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer", T = !x && !R && !j, $ = Object.assign({}, t), M = "./this.program", I = ""; @@ -1059,7 +1059,17 @@ var oA = (po = { "../runtime/npm/wasm32/lib/embedpdf.browser.js"() { else throw `Loading data file "${y}" failed.`; }), De && ge(De)) : qe(y); }, k.staticInit(); - var Wp = { __assert_fail: function(m, g, y, v) { + var Wp = { EPDF_FillFromHostCrypto: function(m, g) { + var y = globalThis.crypto; + if (!y || typeof y.getRandomValues != "function") return 0; + m >>>= 0, g >>>= 0; + try { + y.getRandomValues(l.subarray(m >>> 0, m + g >>> 0)); + } catch { + return 0; + } + return 1; + }, __assert_fail: function(m, g, y, v) { m >>>= 0, g >>>= 0, v >>>= 0, te(`Assertion failed: ${Xe(m)}, at: ` + [g ? Xe(g) : "unknown filename", y, v ? Xe(v) : "unknown function"]); }, __syscall_fcntl64: function(m, g, y) { st.varargs = y >>>= 0; @@ -1496,14 +1506,6 @@ var oA = (po = { "../runtime/npm/wasm32/lib/embedpdf.browser.js"() { if (Jt(De), pe !== pe + 0) throw pe; pn(1, 0); } - }, random_get: function(m, g) { - m >>>= 0, g >>>= 0; - try { - return Ke(l.subarray(m >>> 0, m + g >>> 0)), 0; - } catch (y) { - if (k === void 0 || y.name !== "ErrnoError") throw y; - return y.errno; - } } }, nn = (function() { function m(Z, J) { var X, Fe, ve, De; @@ -19241,4 +19243,4 @@ async function UG(e = {}, t) { export { UG as createInlineTransport }; -//# sourceMappingURL=inline-transport-GZ5fBXix.js.map +//# sourceMappingURL=inline-transport-DLWGAv7G.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/labels-C6_i87Oj-BpJCC3cf.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/labels-C6_i87Oj-xAdFtKWd.js similarity index 50% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/labels-C6_i87Oj-BpJCC3cf.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/labels-C6_i87Oj-xAdFtKWd.js index d09adc04..da3ac5dc 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/labels-C6_i87Oj-BpJCC3cf.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/labels-C6_i87Oj-xAdFtKWd.js @@ -1,4 +1,4 @@ -import { u as l } from "./wasm-url-asset-sqnq1cad.js"; +import { u as l } from "./wasm-url-asset-Dc0HnHB_.js"; function o() { const e = l(); return (a) => e(a.labelKey, { fallback: a.label }); @@ -6,4 +6,4 @@ function o() { export { o as u }; -//# sourceMappingURL=labels-C6_i87Oj-BpJCC3cf.js.map +//# sourceMappingURL=labels-C6_i87Oj-xAdFtKWd.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/link-editor-BQl5WwML-BMgM601I.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/link-editor-BQl5WwML-7K8D2W_R.js similarity index 96% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/link-editor-BQl5WwML-BMgM601I.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/link-editor-BQl5WwML-7K8D2W_R.js index c7c89b0d..8aee0ee6 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/link-editor-BQl5WwML-BMgM601I.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/link-editor-BQl5WwML-7K8D2W_R.js @@ -1,4 +1,4 @@ -import { u as h, c as x, d as v, e as y, g as d, h as e, i as N, j as E, k as w, S as C } from "./wasm-url-asset-sqnq1cad.js"; +import { u as h, c as x, d as v, e as y, g as d, h as e, i as N, j as E, k as w, S as C } from "./wasm-url-asset-Dc0HnHB_.js"; function b({ active: r, title: t, onClick: l, children: i }) { const o = w({ label: t }); return /* @__PURE__ */ e(C, { children: [/* @__PURE__ */ e("button", { @@ -91,4 +91,4 @@ function T({ onClose: r }) { export { T as LinkEditorCard }; -//# sourceMappingURL=link-editor-BQl5WwML-BMgM601I.js.map +//# sourceMappingURL=link-editor-BQl5WwML-7K8D2W_R.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/measurement-6M_KEsFK-ARa1M4UB.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/measurement-6M_KEsFK-DhJ1Dnhv.js similarity index 99% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/measurement-6M_KEsFK-ARa1M4UB.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/measurement-6M_KEsFK-DhJ1Dnhv.js index ee591c7c..04c3aa16 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/measurement-6M_KEsFK-ARa1M4UB.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/measurement-6M_KEsFK-DhJ1Dnhv.js @@ -1,4 +1,4 @@ -import { u as M, U as O, V as R, X as f, Y as T, s as J, g as m, r as L, h as t, Z as V, _ as j, B as F, C as D, x as X, D as Y } from "./wasm-url-asset-sqnq1cad.js"; +import { u as M, U as O, V as R, X as f, Y as T, s as J, g as m, r as L, h as t, Z as V, _ as j, B as F, C as D, x as X, D as Y } from "./wasm-url-asset-Dc0HnHB_.js"; const b = "border-border bg-surface text-fg w-full rounded-md border px-2 py-1.5 text-sm disabled:opacity-50", w = "border-border text-fg hover:bg-hover rounded-md border px-3 py-1.5 text-sm disabled:opacity-50", Z = () => f(Y, (a) => a.getCurrentPage()); function $() { const a = M(), c = Z(), n = O(), i = R((e) => e.busy), A = f(T, (e) => e.canCalibrate()), o = j(c), u = F(D), y = X((e) => e.selected), h = f(D, (e) => e.selection.getSelected().filter((s) => (s.subtype === "polygon" || s.subtype === "polyline") && s.captionCenter && e.canUpdate(s.ref) && !s.lockedContents), (e, s) => e.length === s.length && e.every((q, B) => q === s[B])), v = f(T, (e) => u.selection.getSelected().map((s) => e.getReadout(s.ref)).filter((s) => !("unavailable" in s)), (e, s) => JSON.stringify(e) === JSON.stringify(s)), d = R((e) => e.lastReports), [N, x] = m(!1), [C, k] = m(!0), [p, P] = m(null), l = !c || i || !A || !o?.ready, r = o?.measure?.subtype === "rectilinear" ? o.measure : null, S = N ? "all" : c, U = { recalculate: C }, g = async (e) => { @@ -274,4 +274,4 @@ export { z as CalibrationDialog, $ as MeasurementSection }; -//# sourceMappingURL=measurement-6M_KEsFK-ARa1M4UB.js.map +//# sourceMappingURL=measurement-6M_KEsFK-DhJ1Dnhv.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-panel-BfusJ14a-CrwTtYxN.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-panel-BfusJ14a-awUDJM2i.js similarity index 99% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-panel-BfusJ14a-CrwTtYxN.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-panel-BfusJ14a-awUDJM2i.js index d1cb1d63..f9ffae79 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-panel-BfusJ14a-CrwTtYxN.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-panel-BfusJ14a-awUDJM2i.js @@ -1,4 +1,4 @@ -import { u as G, ba as we, bb as ve, bc as ke, m as Te, P as ce, bd as Ce, g as D, n as re, ag as Se, be as Me, r as B, h as g, aB as Re, s as K, bf as ae, k as De, j as Pe, S as Oe, Q as Ke } from "./wasm-url-asset-sqnq1cad.js"; +import { u as G, ba as we, bb as ve, bc as ke, m as Te, P as ce, bd as Ce, g as D, n as re, ag as Se, be as Me, r as B, h as g, aB as Re, s as K, bf as ae, k as De, j as Pe, S as Oe, Q as Ke } from "./wasm-url-asset-Dc0HnHB_.js"; function ue(e, i) { const r = e[i].depth; for (let l = i - 1; l >= 0; l -= 1) if (e[l].depth < r) return l; @@ -508,4 +508,4 @@ function Ge() { export { Ge as OutlinePanel }; -//# sourceMappingURL=outline-panel-BfusJ14a-CrwTtYxN.js.map +//# sourceMappingURL=outline-panel-BfusJ14a-awUDJM2i.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-properties-D2EBON1r-Lwj1vkS_.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-properties-D2EBON1r-CMs5r_jq.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-properties-D2EBON1r-Lwj1vkS_.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-properties-D2EBON1r-CMs5r_jq.js index 27e14b92..de528308 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-properties-D2EBON1r-Lwj1vkS_.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/outline-properties-D2EBON1r-CMs5r_jq.js @@ -1,4 +1,4 @@ -import { ag as D, aP as K, a4 as R, h as t, u as G, c as z, aB as U, g as o, Z as W, aQ as M } from "./wasm-url-asset-sqnq1cad.js"; +import { ag as D, aP as K, a4 as R, h as t, u as G, c as z, aB as U, g as o, Z as W, aQ as M } from "./wasm-url-asset-Dc0HnHB_.js"; const Q = [ "#000000", "#c92a2a", @@ -276,4 +276,4 @@ function Z({ outline: d, item: r, hasChildren: i, onClose: l }) { export { J as OutlinePropertiesDialog }; -//# sourceMappingURL=outline-properties-D2EBON1r-Lwj1vkS_.js.map +//# sourceMappingURL=outline-properties-D2EBON1r-CMs5r_jq.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/parse-Cv_kCMGz.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/parse-BNZey3Fv.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/parse-Cv_kCMGz.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/parse-BNZey3Fv.js index d99fcc8e..1a6c126d 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/parse-Cv_kCMGz.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/parse-BNZey3Fv.js @@ -1,4 +1,4 @@ -import { aS as S, t as $, f as q, b1 as j, aW as l, b2 as G, b3 as F, O as N, b4 as L, b5 as W, b6 as P, b7 as Y, b8 as M, b9 as z } from "./wasm-url-asset-sqnq1cad.js"; +import { aS as S, t as $, f as q, b1 as j, aW as l, b2 as G, b3 as F, O as N, b4 as L, b5 as W, b6 as P, b7 as Y, b8 as M, b9 as z } from "./wasm-url-asset-Dc0HnHB_.js"; import { C as a } from "./error-CbfoSMwv.js"; function oe(e) { return K(e).parsed; @@ -201,4 +201,4 @@ export { Q as readCmsParts, J as withSignerCertificate }; -//# sourceMappingURL=parse-Cv_kCMGz.js.map +//# sourceMappingURL=parse-BNZey3Fv.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/print-dialog-DPur4IlU-0p7zQEeK.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/print-dialog-DPur4IlU-D6FsF7fz.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/print-dialog-DPur4IlU-0p7zQEeK.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/print-dialog-DPur4IlU-D6FsF7fz.js index 26190940..474e6f54 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/print-dialog-DPur4IlU-0p7zQEeK.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/print-dialog-DPur4IlU-D6FsF7fz.js @@ -1,4 +1,4 @@ -import { ag as T, aK as q, h as n, u as G, aB as P, aL as J, $ as K, av as Q, aM as Z, g as N, s as w, r as L, S as _, Z as z } from "./wasm-url-asset-sqnq1cad.js"; +import { ag as T, aK as q, h as n, u as G, aB as P, aL as J, $ as K, av as Q, aM as Z, g as N, s as w, r as L, S as _, Z as z } from "./wasm-url-asset-Dc0HnHB_.js"; function E(t, e) { const s = t.split(/[,,、،]/).map((a) => a.trim()).filter((a) => a !== ""); if (s.length === 0) return null; @@ -209,4 +209,4 @@ function I({ name: t, checked: e, onChoose: s, label: l, controls: a }) { export { X as PrintDialog }; -//# sourceMappingURL=print-dialog-DPur4IlU-0p7zQEeK.js.map +//# sourceMappingURL=print-dialog-DPur4IlU-D6FsF7fz.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redact-confirm-C0AI8Tbt-DoYTi75M.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redact-confirm-C0AI8Tbt-BhOcPITJ.js similarity index 93% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redact-confirm-C0AI8Tbt-DoYTi75M.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redact-confirm-C0AI8Tbt-BhOcPITJ.js index e32c2def..bd9687b7 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redact-confirm-C0AI8Tbt-DoYTi75M.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redact-confirm-C0AI8Tbt-BhOcPITJ.js @@ -1,5 +1,5 @@ -import { u as b, ag as g, g as p, aB as y, h as e, Z as h } from "./wasm-url-asset-sqnq1cad.js"; -import { u as x } from "./redaction-T5ICfn86.js"; +import { u as b, ag as g, g as p, aB as y, h as e, Z as h } from "./wasm-url-asset-Dc0HnHB_.js"; +import { u as x } from "./redaction-CHJXJ8Tl.js"; function v() { const t = b(), r = g("redact-confirm"), a = x(), [s, n] = p(!1), [d, c] = p(null), i = y(); if (!r.isOpen) return null; @@ -59,4 +59,4 @@ function v() { export { v as RedactConfirmModal }; -//# sourceMappingURL=redact-confirm-C0AI8Tbt-DoYTi75M.js.map +//# sourceMappingURL=redact-confirm-C0AI8Tbt-BhOcPITJ.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-T5ICfn86.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-CHJXJ8Tl.js similarity index 86% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-T5ICfn86.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-CHJXJ8Tl.js index fc10016a..b1cee639 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-T5ICfn86.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-CHJXJ8Tl.js @@ -1,4 +1,4 @@ -import { bg as s, a5 as t, B as i, bh as o, bi as u, a2 as l } from "./wasm-url-asset-sqnq1cad.js"; +import { bg as s, a5 as t, B as i, bh as o, bi as u, a2 as l } from "./wasm-url-asset-Dc0HnHB_.js"; const p = s(t, { read: (e) => ({ pendingCount: e.getPendingCount(), @@ -26,4 +26,4 @@ export { R as b, g as u }; -//# sourceMappingURL=redaction-T5ICfn86.js.map +//# sourceMappingURL=redaction-CHJXJ8Tl.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-panel-Djm12Ydh-D9gDjih9.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-panel-Djm12Ydh-BY55F6C2.js similarity index 95% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-panel-Djm12Ydh-D9gDjih9.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-panel-Djm12Ydh-BY55F6C2.js index 34a4e93d..d571aa32 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-panel-Djm12Ydh-D9gDjih9.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/redaction-panel-Djm12Ydh-BY55F6C2.js @@ -1,5 +1,5 @@ -import { u as i, B as p, C as m, ag as x, h as e, j as s, i as f, E as u } from "./wasm-url-asset-sqnq1cad.js"; -import { u as g, a as h, b } from "./redaction-T5ICfn86.js"; +import { u as i, B as p, C as m, ag as x, h as e, j as s, i as f, E as u } from "./wasm-url-asset-Dc0HnHB_.js"; +import { u as g, a as h, b } from "./redaction-CHJXJ8Tl.js"; function N() { const a = i(), d = g(), l = h((t) => t.applying), n = b(), o = p(m), c = x("redact-confirm"); return /* @__PURE__ */ e("div", { @@ -75,4 +75,4 @@ function N() { export { N as RedactionPanel }; -//# sourceMappingURL=redaction-panel-Djm12Ydh-D9gDjih9.js.map +//# sourceMappingURL=redaction-panel-Djm12Ydh-BY55F6C2.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/search-panel-BsY-2v13-ZjlYoC7t.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/search-panel-BsY-2v13-BzjGBsPo.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/search-panel-BsY-2v13-ZjlYoC7t.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/search-panel-BsY-2v13-BzjGBsPo.js index 4f40d68c..160981c4 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/search-panel-BsY-2v13-ZjlYoC7t.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/search-panel-BsY-2v13-BzjGBsPo.js @@ -1,4 +1,4 @@ -import { u as m, l as O, m as R, n as P, h as t, g as p, i as b, j as x, o as N, p as I, q as T, v as z, r as w, s as y, w as E, S as K } from "./wasm-url-asset-sqnq1cad.js"; +import { u as m, l as O, m as R, n as P, h as t, g as p, i as b, j as x, o as N, p as I, q as T, v as z, r as w, s as y, w as E, S as K } from "./wasm-url-asset-Dc0HnHB_.js"; const j = 300, B = (e, s) => e != null && e.text === s.text && !!e.regex == !!s.regex && !!e.matchCase == !!s.matchCase && !!e.wholeWord == !!s.wholeWord; function C() { const e = I(), s = T(), { query: a } = s, [n, h] = p(() => a?.text ?? ""), [r, f] = p(() => a?.matchCase ?? !1), [i, l] = p(() => a?.wholeWord ?? !1), [c, d] = p(() => a?.regex ?? !1), o = { @@ -275,4 +275,4 @@ export { $ as FindBar, q as SearchPanel }; -//# sourceMappingURL=search-panel-BsY-2v13-ZjlYoC7t.js.map +//# sourceMappingURL=search-panel-BsY-2v13-BzjGBsPo.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/self-signed-DIdbaT2K.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/self-signed-BsJCIg7s.js similarity index 95% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/self-signed-DIdbaT2K.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/self-signed-BsJCIg7s.js index 15d142a9..b0ed460e 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/self-signed-DIdbaT2K.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/self-signed-BsJCIg7s.js @@ -1,4 +1,4 @@ -import { aR as f, aS as y, I as p, t as x, aT as d, aU as b, aV as v, aW as a, aX as l, aY as A, aZ as m, a_ as c, a$ as B, b0 as h } from "./wasm-url-asset-sqnq1cad.js"; +import { aR as f, aS as y, I as p, t as x, aT as d, aU as b, aV as v, aW as a, aX as l, aY as A, aZ as m, a_ as c, a$ as B, b0 as h } from "./wasm-url-asset-Dc0HnHB_.js"; async function U(e) { return g(e, "signing"); } @@ -50,4 +50,4 @@ export { U as selfSignedCertificate, V as timestampAuthorityCertificate }; -//# sourceMappingURL=self-signed-DIdbaT2K.js.map +//# sourceMappingURL=self-signed-BsJCIg7s.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/sign-dialog-BZ-u3DaO-DUNRfJDM.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/sign-dialog-BZ-u3DaO-A_aSCrL7.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/sign-dialog-BZ-u3DaO-DUNRfJDM.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/sign-dialog-BZ-u3DaO-A_aSCrL7.js index 3a351894..d670a8e6 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/sign-dialog-BZ-u3DaO-DUNRfJDM.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/sign-dialog-BZ-u3DaO-A_aSCrL7.js @@ -1,4 +1,4 @@ -import { u as B, ag as T, an as j, g as i, aB as L, am as R, h as e, Z as w, aC as A } from "./wasm-url-asset-sqnq1cad.js"; +import { u as B, ag as T, an as j, g as i, aB as L, am as R, h as e, Z as w, aC as A } from "./wasm-url-asset-Dc0HnHB_.js"; import { l as E, v as D } from "./signature-result-CiEN5nQw-3Y00fjuW.js"; function P(t) { if (!A(t)) return null; @@ -161,4 +161,4 @@ function O() { export { O as SignDialog }; -//# sourceMappingURL=sign-dialog-BZ-u3DaO-DUNRfJDM.js.map +//# sourceMappingURL=sign-dialog-BZ-u3DaO-A_aSCrL7.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-inspector-DgkYwQHv-B4iHMa4u.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-inspector-DgkYwQHv-DecD2jME.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-inspector-DgkYwQHv-B4iHMa4u.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-inspector-DgkYwQHv-DecD2jME.js index 5c00d5dc..49b0cfe2 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-inspector-DgkYwQHv-B4iHMa4u.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-inspector-DgkYwQHv-DecD2jME.js @@ -1,4 +1,4 @@ -import { u as C, N as K, ag as P, an as j, aq as R, g as h, a4 as $, r as z, h as t, j as G, aJ as W, aC as q, al as B, ax as J } from "./wasm-url-asset-sqnq1cad.js"; +import { u as C, N as K, ag as P, an as j, aq as R, g as h, a4 as $, r as z, h as t, j as G, aJ as W, aC as q, al as B, ax as J } from "./wasm-url-asset-Dc0HnHB_.js"; const Y = (e) => e ? e.summary === "valid" ? "demo.verdictValid" : e.summary === "valid-untrusted" ? "demo.verdictValidUntrusted" : e.summary === "invalid" ? e.modifications.basis === "working-copy" ? "demo.verdictWillInvalidate" : "demo.verdictInvalid" : "demo.verdictIndeterminate" : "demo.verdictIndeterminate", _ = (e, r) => { const a = new Date(e); return Number.isNaN(a.getTime()) ? e : a.toLocaleDateString(r, { @@ -175,4 +175,4 @@ function Q({ field: e }) { export { Z as SignatureInspector }; -//# sourceMappingURL=signature-inspector-DgkYwQHv-B4iHMa4u.js.map +//# sourceMappingURL=signature-inspector-DgkYwQHv-DecD2jME.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-maker-Lp7uuutB-fK8F7XzG.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-maker-Lp7uuutB-qzUGKTPq.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-maker-Lp7uuutB-fK8F7XzG.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-maker-Lp7uuutB-qzUGKTPq.js index 4bbffee8..ae04a7a8 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-maker-Lp7uuutB-fK8F7XzG.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signature-maker-Lp7uuutB-qzUGKTPq.js @@ -1,4 +1,4 @@ -import { u as E, ag as j, ab as B, ao as U, g as s, aB as G, h as t, j as z, Z as K, s as P, r as R, aD as O, aE as H, aF as F, aG as W, aH as Y, aI as $ } from "./wasm-url-asset-sqnq1cad.js"; +import { u as E, ag as j, ab as B, ao as U, g as s, aB as G, h as t, j as z, Z as K, s as P, r as R, aD as O, aE as H, aF as F, aG as W, aH as Y, aI as $ } from "./wasm-url-asset-Dc0HnHB_.js"; const J = [], k = { width: 360, height: 120 @@ -268,4 +268,4 @@ function Z() { export { Z as SignatureMakerModal }; -//# sourceMappingURL=signature-maker-Lp7uuutB-fK8F7XzG.js.map +//# sourceMappingURL=signature-maker-Lp7uuutB-qzUGKTPq.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signatures-panel-smWbAS42-BS1McmH7.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signatures-panel-smWbAS42-C8ccrvhV.js similarity index 99% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signatures-panel-smWbAS42-BS1McmH7.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signatures-panel-smWbAS42-C8ccrvhV.js index bd6ec156..55e971b4 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signatures-panel-smWbAS42-BS1McmH7.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/signatures-panel-smWbAS42-C8ccrvhV.js @@ -1,4 +1,4 @@ -import { u as k, ab as w, an as C, ao as E, ap as L, aq as N, a0 as z, ag as P, g as y, ar as I, r as S, ah as R, h as e, j as p, i as v, X as $, as as q, al as B, am as D } from "./wasm-url-asset-sqnq1cad.js"; +import { u as k, ab as w, an as C, ao as E, ap as L, aq as N, a0 as z, ag as P, g as y, ar as I, r as S, ah as R, h as e, j as p, i as v, X as $, as as q, al as B, am as D } from "./wasm-url-asset-Dc0HnHB_.js"; import { l as M, v as U } from "./signature-result-CiEN5nQw-3Y00fjuW.js"; const F = (t) => t.kind === "fqn" ? t.name : `#${t.objectNumber}`; function X() { @@ -222,4 +222,4 @@ function O() { export { X as SignaturesPanel }; -//# sourceMappingURL=signatures-panel-smWbAS42-BS1McmH7.js.map +//# sourceMappingURL=signatures-panel-smWbAS42-C8ccrvhV.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/stamps-panel-BfRJ9uBl-Cs7BhHXt.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/stamps-panel-BfRJ9uBl-CcPfGL64.js similarity index 98% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/stamps-panel-BfRJ9uBl-Cs7BhHXt.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/stamps-panel-BfRJ9uBl-CcPfGL64.js index 8c46f1d4..d016f02a 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/stamps-panel-BfRJ9uBl-Cs7BhHXt.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/stamps-panel-BfRJ9uBl-CcPfGL64.js @@ -1,4 +1,4 @@ -import { u as B, ab as H, ac as O, ad as W, ae as q, a0 as D, af as F, ag as U, s as V, g as u, r as w, ah as G, ai as J, aj as K, ak as M, h as t, S as Q, i as b, j as d, W as X, al as Y, am as Z } from "./wasm-url-asset-sqnq1cad.js"; +import { u as B, ab as H, ac as O, ad as W, ae as q, a0 as D, af as F, ag as U, s as V, g as u, r as w, ah as G, ai as J, aj as K, ak as M, h as t, S as Q, i as b, j as d, W as X, al as Y, am as Z } from "./wasm-url-asset-Dc0HnHB_.js"; const c = "all"; function te() { const r = B(), s = H(), { standard: f, sidebar: m, libraries: S } = O(), l = W({ kind: m ?? ["stamps"] }), k = q(), { activeToolId: L } = D(), { locale: A } = F(), j = U("stamps"), I = V(null), [C, h] = u(null), [g, p] = u(null), [x, n] = u(null), [P, v] = u(c), y = j.props?.libraryId; @@ -155,4 +155,4 @@ function _({ asset: r, armed: s, onArm: f }) { export { te as StampsPanel }; -//# sourceMappingURL=stamps-panel-BfRJ9uBl-Cs7BhHXt.js.map +//# sourceMappingURL=stamps-panel-BfRJ9uBl-CcPfGL64.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-DdhyGESj.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-DdhyGESj.js deleted file mode 100644 index dafbe04f..00000000 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-DdhyGESj.js +++ /dev/null @@ -1,290 +0,0 @@ -import { bj as j, aR as v, b0 as p, t as i, b8 as V, A as o, bk as T, a as y, bl as q, bm as d, aW as a, bn as K, bo as Y, aS as E, bp as m, b6 as D, O as g, bq as z, br as H, bs as R, bt as B, b9 as u, bu as N, b7 as P, b2 as x, bv as k, b1 as O, bw as _, I as F, M as Z, aT as J, f as Q, b3 as X } from "./wasm-url-asset-sqnq1cad.js"; -import { d as ee } from "./splice-DZQMGiQI.js"; -import { parseCmsInternal as te } from "./parse-Cv_kCMGz.js"; -import { C as b } from "./error-CbfoSMwv.js"; -function C(e) { - const n = new j({ - value: (e.signedAttrs?.attributes ?? []).map((t) => t.toSchema()) - }); - return new Uint8Array(n.toBER(!1)); -} -async function ce(e) { - let n; - try { - n = e instanceof Uint8Array ? te(e) : e; - } catch (r) { - return r instanceof b && r.reason === "unsupported" ? "unsupported" : "invalid"; - } - const t = await ne(n); - if (t === "invalid") return "invalid"; - const s = await se(n); - return s !== "valid" ? s : t === "unsupported" ? "unsupported" : "valid"; -} -async function ne(e) { - if (e.bindings.length === 0) return "absent"; - const n = v(); - let t = !1; - for (const s of e.bindings) { - if (!s.algorithm) continue; - const r = new Uint8Array( - await n.digest( - p[s.algorithm], - i(e.parsed.signerCertificate) - ) - ); - if (!V(r, s.certHash)) return "invalid"; - t = !0; - } - return t ? "valid" : "unsupported"; -} -async function se(e) { - const n = v(), { signerInfo: t, signerCertificate: s, digestAlgorithm: r } = e; - try { - return await n.verifyWithPublicKey( - i(C(t)), - t.signature, - s.subjectPublicKeyInfo, - t.signatureAlgorithm, - p[r] - ) ? "valid" : "invalid"; - } catch (h) { - const c = h.message ?? ""; - return /unsupported|unknown|not supported|not implemented/i.test(c) ? "unsupported" : "invalid"; - } -} -function $(e) { - const n = e.map((t) => ({ attribute: t, der: new Uint8Array(t.toSchema().toBER(!1)) })).sort((t, s) => ee(t.der, s.der)).map(({ attribute: t }) => t); - return new K({ type: 0, attributes: n }); -} -async function le(e) { - const n = v(); - if (e.digest.byteLength !== d[e.hash]) - throw new Error( - `digest is ${e.digest.byteLength} bytes; ${e.hash} needs ${d[e.hash]}` - ); - if (e.signer.hash !== e.hash) - throw new Error( - `the signer hashes with ${e.signer.hash}, the document was prepared with ${e.hash}` - ); - if (e.signer.certificateChain.length === 0) - throw new Error("the signer carries no certificate"); - const t = e.signer.certificateChain.map( - (l) => E.fromBER(i(l)) - ), s = t[0], r = [ - new m({ - type: a.contentType, - values: [new D({ value: a.data })] - }), - new m({ - type: a.messageDigest, - values: [new g({ valueHex: i(e.digest) })] - }) - ]; - if (e.profile === "pkcs7" && e.signingTime && r.push( - new m({ - type: a.signingTime, - values: [z(new Date(e.signingTime))] - }) - ), e.profile === "cades-b") { - const l = await n.digest( - "SHA-256", - i(e.signer.certificateChain[0]) - ), A = new H({ - issuer: new R({ - names: [new B({ type: 4, value: s.issuer })] - }), - serialNumber: s.serialNumber - }), f = new u({ - value: [new g({ valueHex: l }), A.toSchema()] - }); - r.push( - new m({ - type: a.signingCertificateV2, - values: [new u({ value: [new u({ value: [f] })] })] - }) - ); - } - const h = new o({ algorithmId: y[e.hash] }), c = new N({ - version: 1, - sid: new P({ - issuer: s.issuer, - serialNumber: s.serialNumber - }), - digestAlgorithm: h, - signedAttrs: $(r), - signatureAlgorithm: L(e.signer.algorithm, e.hash) - }), S = await e.signer.sign(C(c)); - c.signature = new g({ - valueHex: U(e.signer.algorithm, S) - }); - const I = new x({ - version: 1, - digestAlgorithms: [h], - encapContentInfo: new k({ eContentType: a.data }), - certificates: t, - signerInfos: [c] - }), w = new O({ - contentType: a.signedData, - content: I.toSchema(!0) - }); - return new Uint8Array(w.toSchema().toBER(!1)); -} -function U(e, n) { - return e === "ECDSA" ? Y(i(n)) : i(n); -} -function L(e, n) { - switch (e) { - case "RSA-PKCS1-v1_5": - return new o({ - algorithmId: { - sha256: a.sha256WithRsa, - sha384: a.sha384WithRsa, - sha512: a.sha512WithRsa - }[n], - algorithmParams: new T() - }); - case "ECDSA": - return new o({ - algorithmId: { sha256: a.ecdsaSha256, sha384: a.ecdsaSha384, sha512: a.ecdsaSha512 }[n] - }); - case "RSA-PSS": { - const t = new o({ - algorithmId: y[n], - algorithmParams: new T() - }), s = new q({ - hashAlgorithm: t, - maskGenAlgorithm: new o({ - algorithmId: a.mgf1, - algorithmParams: t.toSchema() - }), - saltLength: d[n] - }); - return new o({ - algorithmId: a.rsaPss, - algorithmParams: s.toSchema() - }); - } - } -} -function ae(e) { - const n = Q(i(e)); - if (n.offset === -1) throw new b("malformed", "TSTInfo is not valid BER"); - let t; - try { - t = new _({ schema: n.result }); - } catch (r) { - throw new b("malformed", `TSTInfo does not parse: ${r.message}`); - } - const s = X[t.messageImprint.hashAlgorithm.algorithmId]; - if (!s) - throw new b( - "unsupported", - `message imprint algorithm ${t.messageImprint.hashAlgorithm.algorithmId}` - ); - return { - imprintAlgorithm: s, - imprint: new Uint8Array(t.messageImprint.hashedMessage.valueBlock.valueHexView), - genTime: t.genTime, - policy: t.policy, - nonce: t.nonce ? G(t.nonce.valueBlock.valueHexView) : null - }; -} -function G(e) { - let n = 0; - for (; n < e.byteLength - 1 && e[n] === 0; ) n++; - return new Uint8Array(e.subarray(n)); -} -async function re(e) { - const n = v(); - if (e.digest.byteLength !== d[e.hash]) - throw new Error( - `digest is ${e.digest.byteLength} bytes; ${e.hash} needs ${d[e.hash]}` - ); - const t = E.fromBER( - i(e.authority.certificateChain[0]) - ), r = new _({ - version: 1, - policy: "1.3.6.1.4.1.57264.1.1", - messageImprint: new Z({ - hashAlgorithm: new o({ algorithmId: y[e.hash] }), - hashedMessage: new g({ valueHex: i(e.digest) }) - }), - serialNumber: new F({ valueHex: i(J()) }), - genTime: e.genTime ?? /* @__PURE__ */ new Date() - }).toSchema().toBER(!1), h = await n.digest(p[e.authority.hash], r), c = await n.digest( - "SHA-256", - i(e.authority.certificateChain[0]) - ), S = new H({ - issuer: new R({ - names: [new B({ type: 4, value: t.issuer })] - }), - serialNumber: t.serialNumber - }), I = [ - new m({ - type: a.contentType, - values: [new D({ value: a.tstInfo })] - }), - new m({ - type: a.messageDigest, - values: [new g({ valueHex: h })] - }), - new m({ - type: a.signingCertificateV2, - values: [ - new u({ - value: [ - new u({ - value: [ - new u({ - value: [new g({ valueHex: c }), S.toSchema()] - }) - ] - }) - ] - }) - ] - }) - ], w = new o({ - algorithmId: y[e.authority.hash] - }), l = new N({ - version: 1, - sid: new P({ - issuer: t.issuer, - serialNumber: t.serialNumber - }), - digestAlgorithm: w, - signedAttrs: $(I), - signatureAlgorithm: L(e.authority.algorithm, e.authority.hash) - }), A = await e.authority.sign(C(l)); - l.signature = new g({ - valueHex: U(e.authority.algorithm, A) - }); - const f = new k({ eContentType: a.tstInfo }); - f.eContent = new g({ valueHex: r }); - const M = new x({ - version: 3, - digestAlgorithms: [w], - encapContentInfo: f, - certificates: [t], - signerInfos: [l] - }), W = new O({ - contentType: a.signedData, - content: M.toSchema(!0) - }); - return new Uint8Array(W.toSchema().toBER(!1)); -} -const me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - buildTimestampToken: re, - readTimestampInfo: ae, - withoutLeadingZeros: G -}, Symbol.toStringTag, { value: "Module" })); -export { - ce as a, - le as b, - ne as c, - ae as r, - me as t, - se as v -}; -//# sourceMappingURL=timestamp-DdhyGESj.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-YjVubp40.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-YjVubp40.js new file mode 100644 index 00000000..78452196 --- /dev/null +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-YjVubp40.js @@ -0,0 +1,309 @@ +import { bj as V, aR as b, b0 as v, t as i, b8 as q, A as c, bk as p, a as w, bl as K, bm as u, aW as s, bn as Y, bo as z, aS as T, bp as l, b6 as E, O as g, bq as F, br as H, bs as D, bt as R, b9 as m, bu as B, b7 as N, b2 as P, bv as U, b1 as x, bw as k, I as Z, M as J, aT as Q, f as X, b3 as ee } from "./wasm-url-asset-Dc0HnHB_.js"; +import { d as te } from "./splice-DZQMGiQI.js"; +import { parseCmsInternal as ne } from "./parse-BNZey3Fv.js"; +import { C as f } from "./error-CbfoSMwv.js"; +function I(e) { + const n = new V({ + value: (e.signedAttrs?.attributes ?? []).map((t) => t.toSchema()) + }); + return new Uint8Array(n.toBER(!1)); +} +async function le(e) { + let n; + try { + n = e instanceof Uint8Array ? ne(e) : e; + } catch (r) { + return r instanceof f && r.reason === "unsupported" ? "unsupported" : "invalid"; + } + const t = await ae(n); + if (t === "invalid") return "invalid"; + const a = await se(n); + return a !== "valid" ? a : t === "unsupported" ? "unsupported" : "valid"; +} +async function ae(e) { + if (e.bindings.length === 0) return "absent"; + const n = b(); + let t = !1; + for (const a of e.bindings) { + if (!a.algorithm) continue; + const r = new Uint8Array( + await n.digest( + v[a.algorithm], + i(e.parsed.signerCertificate) + ) + ); + if (!q(r, a.certHash)) return "invalid"; + t = !0; + } + return t ? "valid" : "unsupported"; +} +async function se(e) { + const n = b(), { signerInfo: t, signerCertificate: a, digestAlgorithm: r } = e; + try { + return await n.verifyWithPublicKey( + i(I(t)), + t.signature, + a.subjectPublicKeyInfo, + t.signatureAlgorithm, + v[r] + ) ? "valid" : "invalid"; + } catch (h) { + const o = h.message ?? ""; + return /unsupported|unknown|not supported|not implemented/i.test(o) ? "unsupported" : "invalid"; + } +} +function O(e) { + const n = e.map((t) => ({ attribute: t, der: new Uint8Array(t.toSchema().toBER(!1)) })).sort((t, a) => te(t.der, a.der)).map(({ attribute: t }) => t); + return new Y({ type: 0, attributes: n }); +} +async function me(e) { + const n = b(); + if (e.digest.byteLength !== u[e.hash]) + throw new Error( + `digest is ${e.digest.byteLength} bytes; ${e.hash} needs ${u[e.hash]}` + ); + if (e.signer.hash !== e.hash) + throw new Error( + `the signer hashes with ${e.signer.hash}, the document was prepared with ${e.hash}` + ); + const t = e.profile === "cades-b" && e.signer.certificateChain[0] ? new Uint8Array( + await n.digest("SHA-256", i(e.signer.certificateChain[0])) + ) : null, a = _({ ...e, certificateHash: t }), r = await e.signer.sign(I(a.signerInfo)); + return a.withSignature(r); +} +function ue(e) { + return _({ + ...e, + digest: new Uint8Array(u[e.hash]), + certificateHash: e.profile === "cades-b" ? new Uint8Array(32) : null + }).withSignature(new Uint8Array(e.signatureLength).fill(255)).byteLength; +} +function _(e) { + if (e.signer.certificateChain.length === 0) + throw new Error("the signer carries no certificate"); + const n = e.signer.certificateChain.map( + (o) => T.fromBER(i(o)) + ), t = n[0], a = [ + new l({ + type: s.contentType, + values: [new E({ value: s.data })] + }), + new l({ + type: s.messageDigest, + values: [new g({ valueHex: i(e.digest) })] + }) + ]; + if (e.profile === "pkcs7" && e.signingTime && a.push( + new l({ + type: s.signingTime, + values: [F(new Date(e.signingTime))] + }) + ), e.profile === "cades-b" && e.certificateHash) { + const o = new H({ + issuer: new D({ + names: [new R({ type: 4, value: t.issuer })] + }), + serialNumber: t.serialNumber + }), d = new m({ + value: [ + new g({ valueHex: i(e.certificateHash) }), + o.toSchema() + ] + }); + a.push( + new l({ + type: s.signingCertificateV2, + values: [new m({ value: [new m({ value: [d] })] })] + }) + ); + } + const r = new c({ algorithmId: w[e.hash] }), h = new B({ + version: 1, + sid: new N({ + issuer: t.issuer, + serialNumber: t.serialNumber + }), + digestAlgorithm: r, + signedAttrs: O(a), + signatureAlgorithm: $(e.signer.algorithm, e.hash) + }); + return { + signerInfo: h, + withSignature(o) { + h.signature = new g({ + valueHex: L(e.signer.algorithm, o) + }); + const d = new P({ + version: 1, + digestAlgorithms: [r], + encapContentInfo: new U({ eContentType: s.data }), + certificates: n, + signerInfos: [h] + }), y = new x({ + contentType: s.signedData, + content: d.toSchema(!0) + }); + return new Uint8Array(y.toSchema().toBER(!1)); + } + }; +} +function L(e, n) { + return e === "ECDSA" ? z(i(n)) : i(n); +} +function $(e, n) { + switch (e) { + case "RSA-PKCS1-v1_5": + return new c({ + algorithmId: { + sha256: s.sha256WithRsa, + sha384: s.sha384WithRsa, + sha512: s.sha512WithRsa + }[n], + algorithmParams: new p() + }); + case "ECDSA": + return new c({ + algorithmId: { sha256: s.ecdsaSha256, sha384: s.ecdsaSha384, sha512: s.ecdsaSha512 }[n] + }); + case "RSA-PSS": { + const t = new c({ + algorithmId: w[n], + algorithmParams: new p() + }), a = new K({ + hashAlgorithm: t, + maskGenAlgorithm: new c({ + algorithmId: s.mgf1, + algorithmParams: t.toSchema() + }), + saltLength: u[n] + }); + return new c({ + algorithmId: s.rsaPss, + algorithmParams: a.toSchema() + }); + } + } +} +function re(e) { + const n = X(i(e)); + if (n.offset === -1) throw new f("malformed", "TSTInfo is not valid BER"); + let t; + try { + t = new k({ schema: n.result }); + } catch (r) { + throw new f("malformed", `TSTInfo does not parse: ${r.message}`); + } + const a = ee[t.messageImprint.hashAlgorithm.algorithmId]; + if (!a) + throw new f( + "unsupported", + `message imprint algorithm ${t.messageImprint.hashAlgorithm.algorithmId}` + ); + return { + imprintAlgorithm: a, + imprint: new Uint8Array(t.messageImprint.hashedMessage.valueBlock.valueHexView), + genTime: t.genTime, + policy: t.policy, + nonce: t.nonce ? G(t.nonce.valueBlock.valueHexView) : null + }; +} +function G(e) { + let n = 0; + for (; n < e.byteLength - 1 && e[n] === 0; ) n++; + return new Uint8Array(e.subarray(n)); +} +async function ie(e) { + const n = b(); + if (e.digest.byteLength !== u[e.hash]) + throw new Error( + `digest is ${e.digest.byteLength} bytes; ${e.hash} needs ${u[e.hash]}` + ); + const t = T.fromBER( + i(e.authority.certificateChain[0]) + ), r = new k({ + version: 1, + policy: "1.3.6.1.4.1.57264.1.1", + messageImprint: new J({ + hashAlgorithm: new c({ algorithmId: w[e.hash] }), + hashedMessage: new g({ valueHex: i(e.digest) }) + }), + serialNumber: new Z({ valueHex: i(Q()) }), + genTime: e.genTime ?? /* @__PURE__ */ new Date() + }).toSchema().toBER(!1), h = await n.digest(v[e.authority.hash], r), o = await n.digest( + "SHA-256", + i(e.authority.certificateChain[0]) + ), d = new H({ + issuer: new D({ + names: [new R({ type: 4, value: t.issuer })] + }), + serialNumber: t.serialNumber + }), y = [ + new l({ + type: s.contentType, + values: [new E({ value: s.tstInfo })] + }), + new l({ + type: s.messageDigest, + values: [new g({ valueHex: h })] + }), + new l({ + type: s.signingCertificateV2, + values: [ + new m({ + value: [ + new m({ + value: [ + new m({ + value: [new g({ valueHex: o }), d.toSchema()] + }) + ] + }) + ] + }) + ] + }) + ], A = new c({ + algorithmId: w[e.authority.hash] + }), S = new B({ + version: 1, + sid: new N({ + issuer: t.issuer, + serialNumber: t.serialNumber + }), + digestAlgorithm: A, + signedAttrs: O(y), + signatureAlgorithm: $(e.authority.algorithm, e.authority.hash) + }), M = await e.authority.sign(I(S)); + S.signature = new g({ + valueHex: L(e.authority.algorithm, M) + }); + const C = new U({ eContentType: s.tstInfo }); + C.eContent = new g({ valueHex: r }); + const W = new P({ + version: 3, + digestAlgorithms: [A], + encapContentInfo: C, + certificates: [t], + signerInfos: [S] + }), j = new x({ + contentType: s.signedData, + content: W.toSchema(!0) + }); + return new Uint8Array(j.toSchema().toBER(!1)); +} +const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + buildTimestampToken: ie, + readTimestampInfo: re, + withoutLeadingZeros: G +}, Symbol.toStringTag, { value: "Module" })); +export { + le as a, + me as b, + ae as c, + ue as d, + re as r, + de as t, + se as v +}; +//# sourceMappingURL=timestamp-YjVubp40.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-protocol-DQ1E-rny.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-protocol-C2RoyYm6.js similarity index 93% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-protocol-DQ1E-rny.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-protocol-C2RoyYm6.js index 4a67993b..6cef7173 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-protocol-DQ1E-rny.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/timestamp-protocol-C2RoyYm6.js @@ -1,4 +1,4 @@ -import { T as c, I as u, M as f, t as o, O as d, A as h, a as p, f as g, b as w } from "./wasm-url-asset-sqnq1cad.js"; +import { T as c, I as u, M as f, t as o, O as d, A as h, a as p, f as g, b as w } from "./wasm-url-asset-Dc0HnHB_.js"; import { C as I } from "./error-CbfoSMwv.js"; import { c as v, r as A } from "./splice-DZQMGiQI.js"; function B(e) { @@ -54,4 +54,4 @@ export { B as buildTimestampRequest, S as readTimestampResponse }; -//# sourceMappingURL=timestamp-protocol-DQ1E-rny.js.map +//# sourceMappingURL=timestamp-protocol-C2RoyYm6.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/wasm-url-asset-sqnq1cad.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/wasm-url-asset-Dc0HnHB_.js similarity index 84% rename from src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/wasm-url-asset-sqnq1cad.js rename to src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/wasm-url-asset-Dc0HnHB_.js index 61409730..a29e168a 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/wasm-url-asset-sqnq1cad.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/chunks/wasm-url-asset-Dc0HnHB_.js @@ -4,7 +4,7 @@ var M3 = (e) => { }; var oY = (e, t, n) => t in e ? rY(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var et = (e, t, n) => oY(e, typeof t != "symbol" ? t + "" : t, n), TE = (e, t, n) => t.has(e) || M3("Cannot " + n); -var rt = (e, t, n) => (TE(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Vn = (e, t, n) => t.has(e) ? M3("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), gn = (e, t, n, r) => (TE(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), mn = (e, t, n) => (TE(e, t, "access private method"), n); +var ot = (e, t, n) => (TE(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Vn = (e, t, n) => t.has(e) ? M3("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), gn = (e, t, n, r) => (TE(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), mn = (e, t, n) => (TE(e, t, "access private method"), n); const q = { Unknown: "Unknown", InvalidArg: "InvalidArg", @@ -229,7 +229,7 @@ function iY(e) { var t = sY(e, "string"); return b0(t) == "symbol" ? t : t + ""; } -function fr(e, t, n) { +function hr(e, t, n) { return (t = iY(t)) in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, @@ -239,7 +239,7 @@ function fr(e, t, n) { } var J = class BF extends Error { constructor(t, n, r = {}) { - super(n ?? t, r.cause === void 0 ? void 0 : { cause: r.cause }), fr(this, "name", "EngineError"), fr(this, "code", void 0), fr(this, "details", void 0), this.code = t, this.details = r.details; + super(n ?? t, r.cause === void 0 ? void 0 : { cause: r.cause }), hr(this, "name", "EngineError"), hr(this, "code", void 0), hr(this, "details", void 0), this.code = t, this.details = r.details; } static is(t, n) { return !(t instanceof BF) && t?.name !== "EngineError" ? !1 : n === void 0 ? !0 : t.code === n; @@ -301,7 +301,7 @@ function lY(e) { function LP(e) { return e.type === "javascript" || e.type === "submit-form" || e.type === "uri" || (e.next ?? []).some(LP); } -function Fd(e) { +function $d(e) { return Object.values(e ?? {}).some((t) => t != null && !("root" in t) && LP(t)); } function LF(e) { @@ -473,16 +473,16 @@ function $F(e) { function fY(e) { return typeof e == "number" && Number.isInteger(e) && e > 0; } -function Lt(e) { +function Ft(e) { return { kind: "objectNumber", objectNumber: e }; } -function Vf(e, t) { +function Uf(e, t) { return e.kind === t.kind && e.objectNumber === t.objectNumber; } -function Gt(e) { +function Yt(e) { if (!fY(e.objectNumber)) throw new RangeError(`encodePageKey: objectNumber must be a positive integer, got ${e.objectNumber}`); return `obj:${e.objectNumber}`; } @@ -494,7 +494,7 @@ function oe(e) { return `base:${e.page.objectNumber}:${e.baseIndex}`; } } -const Om = [ +const Pm = [ "courier", "courier-bold", "courier-bold-oblique", @@ -527,11 +527,11 @@ function iv(e) { groupId: e }; } -function nm(e) { +function rm(e) { return e.kind === "group" ? e.groupId : null; } function w0(e, t) { - return nm(e) === nm(t) && e.kind === t.kind; + return rm(e) === rm(t) && e.kind === t.kind; } function KF(e) { return WF(HF(e) ?? { kind: "unassigned" }, e.kind); @@ -793,7 +793,7 @@ function RY(e, t) { page: t }; } -const Ph = (e, t) => e.replace(/\B(?=(\d{3})+(?!\d))/g, () => t), tV = (e, t) => t ? tV(t, e % t) : e; +const Th = (e, t) => e.replace(/\B(?=(\d{3})+(?!\d))/g, () => t), tV = (e, t) => t ? tV(t, e % t) : e; function nS(e) { const t = Math.fround(e.conversion ?? NaN); if (!Number.isFinite(t) || t <= 0) return !1; @@ -802,17 +802,17 @@ function nS(e) { } function TY(e, t) { const n = t.fraction ?? "decimal", r = t.thousands ?? ","; - if (n === "round") return Ph(String(Math.round(e)), r); - if (n === "truncate") return Ph(String(Math.trunc(e)), r); + if (n === "round") return Th(String(Math.round(e)), r); + if (n === "truncate") return Th(String(Math.trunc(e)), r); if (n === "fraction") { const a = t.precision ?? 16; let c = Math.floor(e), l = Math.round((e - c) * a); - if (l === a && (c++, l = 0), !l) return Ph(String(c), r); + if (l === a && (c++, l = 0), !l) return Th(String(c), r); const u = t.fixed ? 1 : tV(l, a); - return `${c ? `${Ph(String(c), r)} ` : ""}${l / u}/${a / u}`; + return `${c ? `${Th(String(c), r)} ` : ""}${l / u}/${a / u}`; } const o = Math.log10(t.precision ?? 100), [s, i = ""] = e.toFixed(o).split("."); - return Ph(s, r) + (i ? (t.decimal || ".") + i : ""); + return Th(s, r) + (i ? (t.decimal || ".") + i : ""); } function j3(e, t) { if (!Number.isFinite(e) || !t.length || !t.every(nS)) throw new J(q.InvalidArg, "Measurement requires a finite value and valid number formats"); @@ -820,8 +820,8 @@ function j3(e, t) { const r = []; for (const [o, s] of t.entries()) { if (n *= Math.fround(s.conversion), !Number.isFinite(n)) throw new J(q.InvalidArg, "Measurement overflow"); - const i = Math.floor(n), a = n - i, c = o === t.length - 1, l = c || a === 0, u = c ? TY(n, s) : Ph(String(i), s.thousands ?? ","), d = s.labelPosition === "prefix", f = s.prefixSpacing ?? (d && o === 0 ? "" : " "), h = s.suffixSpacing ?? (!d && l ? "" : " "), g = f + s.unit + h; - if (r.push(d ? g + u : u + g), l) break; + const i = Math.floor(n), a = n - i, c = o === t.length - 1, l = c || a === 0, u = c ? TY(n, s) : Th(String(i), s.thousands ?? ","), f = s.labelPosition === "prefix", d = s.prefixSpacing ?? (f && o === 0 ? "" : " "), h = s.suffixSpacing ?? (!f && l ? "" : " "), g = d + s.unit + h; + if (r.push(f ? g + u : u + g), l) break; n = a; } return (e < 0 ? "-" : "") + r.join(""); @@ -897,7 +897,7 @@ const ui = { weight: 400, italic: !1 } -}, gs = (e) => Om.includes(e); +}, gs = (e) => Pm.includes(e); function VP(e, t) { if (gs(e)) { const r = ui[e]; @@ -914,7 +914,7 @@ function VP(e, t) { italic: n.italic } : { family: e }; } -function Cf(e) { +function Nf(e) { return e.toLowerCase().replace(/[\s\-_'"]/g, ""); } const nV = { @@ -936,19 +936,19 @@ const nV = { dingbats: "ZapfDingbats" }; function $P(e) { - return nV[Cf(e)]; + return nV[Nf(e)]; } function UP(e, t) { const n = t?.(e.family, e.weight, e.italic); if (n !== void 0) return n; - const r = nV[Cf(e.family)]; + const r = nV[Nf(e.family)]; if (r) { const o = Object.entries(ui), s = e.weight >= 600, i = o.find(([, a]) => a.family === r && a.weight >= 600 === s && a.italic === e.italic) ?? o.find(([, a]) => a.family === r); if (i) return i[0]; } return e.family; } -function cl(e) { +function ll(e) { const t = UP({ family: $P(e.family) ?? "Helvetica", weight: e.weight ?? 400, @@ -996,12 +996,12 @@ function MY(e) { function oV(e, t) { const n = KP(t); if (n !== null) return HP(e, n); - const r = t * Math.PI / 180, o = Math.abs(Math.cos(r)), s = Math.abs(Math.sin(r)), i = e.right - e.left, a = e.top - e.bottom, c = (i * o + a * s) / 2, l = (i * s + a * o) / 2, u = (e.left + e.right) / 2, d = (e.bottom + e.top) / 2; + const r = t * Math.PI / 180, o = Math.abs(Math.cos(r)), s = Math.abs(Math.sin(r)), i = e.right - e.left, a = e.top - e.bottom, c = (i * o + a * s) / 2, l = (i * s + a * o) / 2, u = (e.left + e.right) / 2, f = (e.bottom + e.top) / 2; return { left: u - c, - bottom: d - l, + bottom: f - l, right: u + c, - top: d + l + top: f + l }; } function KP(e) { @@ -1094,7 +1094,7 @@ const k0 = { align: "left", dir: "ltr" }; -function rm(e) { +function om(e) { return aV(e.paragraphs.map((t) => t.runs.map((n) => n.text).join("")).join(` `), ` `); @@ -2199,9 +2199,9 @@ function qP(e) { function Ha(e) { return Object.prototype.hasOwnProperty.call(rS, e) ? rS[e] : null; } -const Pm = qP((e) => Object.keys(e.owners)); +const Rm = qP((e) => Object.keys(e.owners)); qP((e) => e.resources); -const om = qP((e) => e.spaces), VY = Object.assign({}, ...Object.values(om)), $Y = [[ +const sm = qP((e) => e.spaces), VY = Object.assign({}, ...Object.values(sm)), $Y = [[ "highlight", "underline", "squiggly", @@ -2293,14 +2293,14 @@ const uV = /* @__PURE__ */ new Set(["link", "widget"]), UY = 1e-3, KY = /* @__PU link: ["rect"], widget: ["box"] }, JP = (e, t) => Math.abs(e - t) <= UY, F3 = (e) => typeof e == "number" ? (e % 360 + 360) % 360 : 0; -function Fo(e, t) { +function Vo(e, t) { if (e == null || t == null) return e == null && t == null; if (typeof e == "number" && typeof t == "number") return JP(e, t); if (Array.isArray(e) || Array.isArray(t)) - return !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((n, r) => Fo(n, t[r])); + return !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((n, r) => Vo(n, t[r])); if (typeof e == "object" && typeof t == "object") { const n = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]); - for (const r of n) if (!Fo(e[r], t[r])) return !1; + for (const r of n) if (!Vo(e[r], t[r])) return !1; return !0; } return e === t; @@ -2342,8 +2342,8 @@ function WY(e, t, n, r) { if (!JP(F3(e.rotation), F3(l))) return null; } for (const l of r) { - const u = e[l], d = t[l]; - if (!(u == null && d == null) && (u == null || d == null || !zI(u, d, a, c))) + const u = e[l], f = t[l]; + if (!(u == null && f == null) && (u == null || f == null || !zI(u, f, a, c))) return null; } return { @@ -2372,11 +2372,11 @@ function fV(e, t) { "polygon", "polyline" ].includes(o) && s === !0, a = []; - for (const [d, f] of Object.entries(r)) - f === void 0 || KY.has(d) || d === "contents" && !i || Fo(f, n[d]) || a.push(d); + for (const [f, d] of Object.entries(r)) + d === void 0 || KY.has(f) || f === "contents" && !i || Vo(d, n[f]) || a.push(f); if (a.length === 0) return GY; const c = dV[o], l = c && (o === "polygon" || o === "polyline") && n.captionCenter ? [...c, "captionCenter"] : c; - if (!l || !a.every((d) => l.includes(d))) return a1; + if (!l || !a.every((f) => l.includes(f))) return a1; const u = WY(n, r, o, l); return u ? { impact: "translation", @@ -2389,21 +2389,21 @@ function JY(e) { function Dx(e, t) { const n = new Map(e.map((u) => [oe(u.ref), u])), r = n.get(oe(t)); if (!r) return []; - const o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = (u, d, f) => u.set(d, [...u.get(d) ?? [], f]); + const o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = (u, f, d) => u.set(f, [...u.get(f) ?? [], d]); for (const u of e) { - const d = u.reply ? n.get(oe(u.reply.to)) : void 0; - d && d !== u && i(o, d, u); - const f = u.subtype === "popup" && u.parent ? n.get(oe(u.parent)) : void 0; - f && f !== u && i(s, f, u); + const f = u.reply ? n.get(oe(u.reply.to)) : void 0; + f && f !== u && i(o, f, u); + const d = u.subtype === "popup" && u.parent ? n.get(oe(u.parent)) : void 0; + d && d !== u && i(s, d, u); const h = u.popup ? n.get(oe(u.popup)) : void 0; h && h !== u && h.subtype === "popup" && i(s, u, h); } const a = [], c = /* @__PURE__ */ new Set(), l = (u) => { if (!c.has(u)) { c.add(u); - for (const d of o.get(u) ?? []) l(d); - for (const d of s.get(u) ?? []) - c.has(d) || (c.add(d), a.push(d)); + for (const f of o.get(u) ?? []) l(f); + for (const f of s.get(u) ?? []) + c.has(f) || (c.add(f), a.push(f)); a.push(u); } }; @@ -2434,23 +2434,23 @@ function ZY(e, t = {}) { if (!l.reply) continue; const u = r.get(oe(l.reply.to)); if (!u) continue; - const d = oe(u.ref), f = s.get(d); - f ? f.push(l) : s.set(d, [l]); + const f = oe(u.ref), d = s.get(f); + d ? d.push(l) : s.set(f, [l]); } const i = /* @__PURE__ */ new Set(), a = [], c = (l) => { - const u = [], d = [], f = []; + const u = [], f = [], d = []; i.add(oe(l.ref)); const h = [...s.get(oe(l.ref)) ?? []]; for (; h.length > 0; ) { const g = h.pop(), p = oe(g.ref); - i.has(p) || (i.add(p), BE(g) ? f.push(g) : JY(g) === "grouped-subordinate" ? d.push(g) : u.push(g), h.push(...s.get(p) ?? [])); + i.has(p) || (i.add(p), BE(g) ? d.push(g) : JY(g) === "grouped-subordinate" ? f.push(g) : u.push(g), h.push(...s.get(p) ?? [])); } - u.sort(o), f.sort(o), a.push({ + u.sort(o), d.sort(o), a.push({ root: l, page: l.page, replies: u, - groupedParts: d, - review: tQ(f, t) + groupedParts: f, + review: tQ(d, t) }); }; for (const l of n) !l.reply && !BE(l) && c(l); @@ -2532,15 +2532,15 @@ const jx = /* @__PURE__ */ new Set([ "calloutLine" ]); function QP(e) { - return [...Object.entries(om[e]).filter(([t, n]) => t !== "rect" && rQ.has(n)).map(([t]) => t), "rotation"]; + return [...Object.entries(sm[e]).filter(([t, n]) => t !== "rect" && rQ.has(n)).map(([t]) => t), "rotation"]; } function oQ(e, t) { const n = e.subtype; if (!jx.has(n)) return { rect: t }; - const r = $w(t), o = $w(e.rect), s = r.right - r.left, i = r.top - r.bottom, a = o.right - o.left, c = o.top - o.bottom, l = Fo(s, a), u = Fo(i, c); + const r = $w(t), o = $w(e.rect), s = r.right - r.left, i = r.top - r.bottom, a = o.right - o.left, c = o.top - o.bottom, l = Vo(s, a), u = Vo(i, c); if (!l && s <= 0 || !u && i <= 0) throw LE(n, "a rect needs a width and a height"); - const d = e.rotation ?? 0, f = om[n], h = f.box === "box" ? KP(d) : null; - if (!Fo((d % 360 + 360) % 360, 0) && h === null && (!l || !u)) + const f = e.rotation ?? 0, d = sm[n], h = d.box === "box" ? KP(f) : null; + if (!Vo((f % 360 + 360) % 360, 0) && h === null && (!l || !u)) throw LE(n, "a turned drawing's rect can only move; resize its shape instead"); if (!l && a <= 0 || !u && c <= 0) throw LE(n, "its rect has no width or height to stretch; it can only move"); const g = l ? 1 : s / a, p = u ? 1 : i / c, m = (k) => ({ @@ -2578,7 +2578,7 @@ function oQ(e, t) { calloutLine: (k) => k.map(m) }, C = {}; for (const k of QP(n)) { - const N = e[k], w = f[k]; + const N = e[k], w = d[k]; N != null && w && (C[k] = S[w](N)); } return C; @@ -2600,13 +2600,13 @@ function sQ(e) { sy: o } : null; } -const If = (e) => ({ +const Of = (e) => ({ x: Math.fround(e.x), y: Math.fround(e.y) }); function V3(e, t, n) { let r = 0; - const o = e.map(If); + const o = e.map(Of); for (let s = 0; s < (t ? o.length : o.length - 1); s++) { const i = o[s], a = o[(s + 1) % o.length]; r += Math.hypot((a.x - i.x) * n.sx, (a.y - i.y) * n.sy); @@ -2615,7 +2615,7 @@ function V3(e, t, n) { } function hV(e, t) { if (e.length < 3) return 0; - const n = e.map(If), r = n[0]; + const n = e.map(Of), r = n[0]; let o = 0; for (let s = 1; s < n.length - 1; s++) { const i = n[s], a = n[s + 1]; @@ -2624,7 +2624,7 @@ function hV(e, t) { return Math.abs(o * t.sx * t.sy) / 2; } function iQ(e) { - const t = e.map(If), n = (s, i) => s.x === i.x && s.y === i.y; + const t = e.map(Of), n = (s, i) => s.x === i.x && s.y === i.y; if (t.length > 1 && n(t[0], t[t.length - 1]) && t.pop(), t.length < 3 || hV(t, { sx: 1, sy: 1 @@ -2637,18 +2637,18 @@ function iQ(e) { if (r(i, a, c) === 0 && l) return !1; for (let u = s + 1; u < t.length; u++) { if (u === s + 1 || s === 0 && u === t.length - 1) continue; - const d = t[u], f = t[(u + 1) % t.length]; - if (o(i, a, d) || o(i, a, f) || o(d, f, i) || o(d, f, a) || Math.sign(r(i, a, d)) !== Math.sign(r(i, a, f)) && Math.sign(r(d, f, i)) !== Math.sign(r(d, f, a))) return !1; + const f = t[u], d = t[(u + 1) % t.length]; + if (o(i, a, f) || o(i, a, d) || o(f, d, i) || o(f, d, a) || Math.sign(r(i, a, f)) !== Math.sign(r(i, a, d)) && Math.sign(r(f, d, i)) !== Math.sign(r(f, d, a))) return !1; } } return !0; } -function sm(e) { +function im(e) { return e.subtype === "line" && e.intent === "line-dimension" || e.subtype === "polyline" && e.intent === "polyline-dimension" || e.subtype === "polygon" && e.intent === "polygon-dimension"; } -const Rm = (e) => !("unavailable" in e); +const Tm = (e) => !("unavailable" in e); function Ba(e) { - if (!sm(e)) return { unavailable: "not-dimension" }; + if (!im(e)) return { unavailable: "not-dimension" }; if (!e.measure) return { unavailable: "no-measure" }; if (e.measure.subtype !== "rectilinear") return { unavailable: "foreign-measure" }; const t = e.measure, n = sQ(t); @@ -2674,7 +2674,7 @@ function Ba(e) { } function aQ(e) { const t = Ba(e); - return Rm(t) && e.contents !== t.label ? { + return Tm(t) && e.contents !== t.label ? { ...e, contents: t.label } : e; @@ -2760,7 +2760,7 @@ function GI(e, t) { } function dQ(e, t, n) { if (e.length !== t.length || e.length < 2) return; - const r = e[0], o = t[0], s = e.findIndex((f) => Math.hypot(f.x - r.x, f.y - r.y) > 1e-6); + const r = e[0], o = t[0], s = e.findIndex((d) => Math.hypot(d.x - r.x, d.y - r.y) > 1e-6); if (s < 0) return; const i = { x: e[s].x - r.x, @@ -2770,15 +2770,15 @@ function dQ(e, t, n) { y: t[s].y - o.y }, c = i.x * i.x + i.y * i.y, l = (i.x * a.x + i.y * a.y) / c, u = (i.x * a.y - i.y * a.x) / c; if (Math.abs(l * l + u * u - 1) > 1e-5) return; - const d = (f) => ({ - x: o.x + l * (f.x - r.x) - u * (f.y - r.y), - y: o.y + u * (f.x - r.x) + l * (f.y - r.y) + const f = (d) => ({ + x: o.x + l * (d.x - r.x) - u * (d.y - r.y), + y: o.y + u * (d.x - r.x) + l * (d.y - r.y) }); - if (e.every((f, h) => { - const g = d(f); + if (e.every((d, h) => { + const g = f(d); return Math.hypot(g.x - t[h].x, g.y - t[h].y) <= 1e-3; })) - return d(n); + return f(n); } function fQ(e) { if (!uQ(e.subtype)) return e; @@ -2840,7 +2840,7 @@ function hQ(e, t) { ...e, ...r }); - Rm(o) && (r = { + Tm(o) && (r = { ...r, contents: o.label }); @@ -2849,18 +2849,18 @@ function hQ(e, t) { } function pV(e) { if (!(e.richText === void 0 || e.richText === null) && !(e.contents === void 0 || e.contents === null) && aV(e.contents, ` -`) !== rm(e.richText)) +`) !== om(e.richText)) throw new J(q.InvalidArg, `${e.subtype ?? "annotation"}: \`contents\` must equal the plain projection of \`richText\` when both are given`); } function gV(e) { - return e === void 0 || e === "free-text" ? !1 : Pm[e]?.includes("richText") ?? !1; + return e === void 0 || e === "free-text" ? !1 : Rm[e]?.includes("richText") ?? !1; } function pQ(e) { if (!gV(e.subtype)) return e; const { richText: t } = e; return t ? { ...e, - contents: rm(t) + contents: om(t) } : e; } function gQ(e, t) { @@ -2868,7 +2868,7 @@ function gQ(e, t) { const { richText: n } = t; if (n) return { ...t, - contents: rm(n) + contents: om(n) }; if (n === null || t.contents === void 0 || !e.richText) return t; if (t.contents === null) return { @@ -2879,10 +2879,10 @@ function gQ(e, t) { return { ...t, richText: r, - contents: rm(r) + contents: om(r) }; } -const JI = "#ff0000", Dk = "#000000", DE = "#ffff00", Eo = { +const JI = "#ff0000", Dk = "#000000", DE = "#ffff00", Co = { invisible: !1, hidden: !1, print: !0, @@ -2894,8 +2894,8 @@ const JI = "#ff0000", Dk = "#000000", DE = "#ffff00", Eo = { toggleNoView: !1, lockedContents: !1, blendMode: "normal" -}, oh = { - ...Eo, +}, ih = { + ...Co, color: JI, opacity: 1, strokeWidth: 1, @@ -2904,26 +2904,26 @@ const JI = "#ff0000", Dk = "#000000", DE = "#ffff00", Eo = { start: "none", end: "none" }, jE = { - ...Eo, + ...Co, color: Dk, opacity: 1 }, mQ = { - square: oh, - circle: oh, + square: ih, + circle: ih, line: { - ...oh, + ...ih, lineEndings: $3, captionEnabled: !1, captionPosition: "inline" }, - polygon: oh, + polygon: ih, polyline: { - ...oh, + ...ih, lineEndings: $3 }, - ink: oh, + ink: ih, highlight: { - ...Eo, + ...Co, blendMode: "multiply", color: DE, opacity: 1 @@ -2932,12 +2932,12 @@ const JI = "#ff0000", Dk = "#000000", DE = "#ffff00", Eo = { squiggly: jE, strikeout: jE, caret: { - ...Eo, + ...Co, color: JI, opacity: 1 }, "free-text": { - ...Eo, + ...Co, contents: "", intent: "free-text", fontFamily: "helvetica", @@ -2951,21 +2951,21 @@ const JI = "#ff0000", Dk = "#000000", DE = "#ffff00", Eo = { borderStyle: "solid" }, text: { - ...Eo, + ...Co, icon: "note", open: !1, color: DE, opacity: 1 }, "file-attachment": { - ...Eo, + ...Co, icon: "paperclip", color: DE, opacity: 1 }, - link: Eo, + link: Co, redact: { - ...Eo, + ...Co, quadPoints: [], color: JI, opacity: 1, @@ -2976,18 +2976,18 @@ const JI = "#ff0000", Dk = "#000000", DE = "#ffff00", Eo = { textAlign: "left" }, stamp: { - ...Eo, + ...Co, fit: "contain", opacity: 1 }, widget: { - ...Eo, + ...Co, strokeWidth: 1, borderStyle: "solid", textAlign: "left" }, popup: { - ...Eo, + ...Co, print: !1, open: !1 } @@ -3067,7 +3067,7 @@ function kQ(e, t, n) { ...r, ...vQ(i, e, r), richText: a, - ...s ? { contents: rm(a) } : {} + ...s ? { contents: om(a) } : {} }; } function AQ(e, t) { @@ -3096,17 +3096,17 @@ function SQ(e, t) { ...e, intent: n, richText: r, - contents: rm(r) + contents: om(r) }; } function kV(e, t) { const { rect: n, ...r } = t; if (n === void 0 || !jx.has(e.subtype)) return t; if (!rV(n)) throw new J(q.InvalidArg, `${e.subtype} update field 'rect': not a rect of finite numbers`, { details: { field: "rect" } }); - if (Fo($w(n), e.rect)) return r; + if (Vo($w(n), e.rect)) return r; const o = e, s = QP(e.subtype).find((u) => { - const d = t[u]; - return d !== void 0 && !Fo(d, o[u]); + const f = t[u]; + return f !== void 0 && !Vo(f, o[u]); }); if (s) throw new J(q.InvalidArg, `${e.subtype} update field 'rect': a new rect moves the shape, so it can't come with a new '${s}'`, { details: { field: "rect" } }); const { left: i, bottom: a, right: c, top: l } = n; @@ -3133,7 +3133,7 @@ function xQ(e, t) { } function EQ(e, t) { const n = e; - return AV(t, (r, o) => o !== void 0 && Fo(o, n[r])); + return AV(t, (r, o) => o !== void 0 && Vo(o, n[r])); } function SV(e) { return new J(q.InvalidArg, `text: the custom state '${e}' needs a stateModel`, { details: { field: "stateModel" } }); @@ -3158,7 +3158,7 @@ function IQ(e, t) { return t; } function xV(e, t) { - const n = Pm[e], r = Object.keys(t).filter((o) => o !== "subtype" && !n.includes(o)); + const n = Rm[e], r = Object.keys(t).filter((o) => o !== "subtype" && !n.includes(o)); if (r.length > 0) throw new J(q.InvalidArg, `${e} has no field ${r.map((o) => `'${o}'`).join(", ")}`); } function NQ(e) { @@ -3194,7 +3194,7 @@ function MQ(e, t, n = {}) { return TQ(e, RQ(e, t), n); } function BQ(e) { - if (om[e.subtype]?.box !== "box") return e; + if (sm[e.subtype]?.box !== "box") return e; const t = e; if (t.box !== void 0) return e; if (t.rect === void 0) throw new J(q.InvalidArg, `${e.subtype} create: give its \`box\`, or its \`rect\` with a quarter turn`, { details: { field: "box" } }); @@ -3231,29 +3231,29 @@ function DQ(e, t = {}) { function jQ(e, t = {}) { return DQ(LQ(e), t); } -var Lo = class extends J { +var Do = class extends J { constructor(e, t) { super(q.InvalidArg, `invalid scope "${e}": ${t}`, { details: { scope: e, reason: t - } }), this.scope = e, fr(this, "name", "InvalidScope"); + } }), this.scope = e, hr(this, "name", "InvalidScope"); } -}, po = class extends J { +}, go = class extends J { constructor(e, t, n, r) { super(q.Forbidden, `permission denied${t ? ` (${t})` : ""}: ${n ? `one of ${n.join(", ")}` : e}${r ? ` for ${r.length} annotation${r.length === 1 ? "" : "s"}` : ""}`, { details: { required: e, ...t === void 0 ? {} : { context: t }, ...n === void 0 ? {} : { anyOf: [...n] }, ...r === void 0 ? {} : { refs: [...r] } - } }), this.required = e, this.context = t, this.anyOf = n, this.refs = r, fr(this, "name", "PermissionDenied"); + } }), this.required = e, this.context = t, this.anyOf = n, this.refs = r, hr(this, "name", "PermissionDenied"); } }, FQ = class extends J { constructor(e) { - super(q.InvalidArg, `scope "${e}" requires an identity (userId and/or groups)`, { details: { scope: e } }), this.scope = e, fr(this, "name", "MissingIdentity"); + super(q.InvalidArg, `scope "${e}" requires an identity (userId and/or groups)`, { details: { scope: e } }), this.scope = e, hr(this, "name", "MissingIdentity"); } }, Kw = class extends J { constructor(e) { - super(q.Aborted, VQ(e)), fr(this, "name", "AbortError"), fr(this, "reason", void 0), this.reason = e; + super(q.Aborted, VQ(e)), hr(this, "name", "AbortError"), hr(this, "reason", void 0), this.reason = e; } }; function VQ(e) { @@ -3276,18 +3276,18 @@ var se = class jk extends Promise { const n = new AbortController(), r = /* @__PURE__ */ new Set(), o = { settled: !1 }; let s; super((i, a) => { - s = a, t((d) => { - o.settled || (o.settled = !0, i(d)); - }, (d) => { - o.settled || (o.settled = !0, a(d)); - }, (d) => { + s = a, t((f) => { + o.settled || (o.settled = !0, i(f)); + }, (f) => { + o.settled || (o.settled = !0, a(f)); + }, (f) => { if (!o.settled) - for (const f of r) try { - f(d); + for (const d of r) try { + d(f); } catch { } }, n.signal); - }), fr(this, "signal", void 0), fr(this, "_ctrl", void 0), fr(this, "_progressCbs", void 0), fr(this, "_state", void 0), fr(this, "_internalReject", void 0), this._ctrl = n, this.signal = n.signal, this._progressCbs = r, this._state = o, this._internalReject = s; + }), hr(this, "signal", void 0), hr(this, "_ctrl", void 0), hr(this, "_progressCbs", void 0), hr(this, "_state", void 0), hr(this, "_internalReject", void 0), this._ctrl = n, this.signal = n.signal, this._progressCbs = r, this._state = o, this._internalReject = s; } /** * Abort the underlying operation. @@ -3360,8 +3360,8 @@ var se = class jk extends Promise { }; function e6(e, t) { const { includeAnnotations: n, includeFormFields: r } = e ?? {}; - if (n === !0 && !t.annotations) throw new po("doc.annotate.read", "includeAnnotations"); - if (r === !0 && !t.formFields) throw new po("doc.forms.read", "includeFormFields"); + if (n === !0 && !t.annotations) throw new go("doc.annotate.read", "includeAnnotations"); + if (r === !0 && !t.formFields) throw new go("doc.forms.read", "includeFormFields"); return { includeAnnotations: n ?? t.annotations, includeFormFields: r ?? (n === !1 ? !1 : t.formFields) @@ -3371,10 +3371,10 @@ function $Q(e, t) { const { usage: n, viewport: r } = e ?? {}; if (n === void 0 || n === "display") { if (r?.kind === "dpi" && cy("viewport", 'a dpi viewport is only for a print picture (usage: "print")'), r?.kind === "thumbnail") { - if (e?.target !== void 0 && e.target.kind !== "page" && cy("target", "a thumbnail is the whole page: it takes no target"), t !== null && !t.thumbnail) throw new po("doc.render.thumbnail", "viewport"); + if (e?.target !== void 0 && e.target.kind !== "page" && cy("target", "a thumbnail is the whole page: it takes no target"), t !== null && !t.thumbnail) throw new go("doc.render.thumbnail", "viewport"); return; } - if (t !== null && !t.render) throw new po("doc.render", "usage"); + if (t !== null && !t.render) throw new go("doc.render", "usage"); return; } n !== "print" && cy("usage", 'usage must be "display" or "print"'), (r?.kind !== "dpi" || r.dpi !== 150 && r.dpi !== 300) && cy("viewport", "a print picture needs viewport: { kind: 'dpi', dpi: 150 or 300 }"); @@ -3384,8 +3384,8 @@ function $Q(e, t) { "background" ]) e?.[o] !== void 0 && cy(o, `a print picture takes no ${o}: it is the whole page, upright, on white`); if (t !== null) { - if (!t.print) throw new po("doc.print", "usage"); - if (r.dpi === 300 && !t.printHigh) throw new po("doc.print.high", "viewport"); + if (!t.print) throw new go("doc.print", "usage"); + if (r.dpi === 300 && !t.printHigh) throw new go("doc.print.high", "viewport"); } } function cy(e, t) { @@ -3578,7 +3578,7 @@ function GQ([e, t, n, r, o, s]) { (t * o - e * s) / i ]; } -function hu(e, { x: t, y: n }) { +function pu(e, { x: t, y: n }) { return { x: e[0] * t + e[2] * n + e[4], y: e[1] * t + e[3] * n + e[5] @@ -3586,13 +3586,13 @@ function hu(e, { x: t, y: n }) { } function K3(e, t) { if ("upperLeft" in t) return { - upperLeft: hu(e, t.upperLeft), - upperRight: hu(e, t.upperRight), - lowerLeft: hu(e, t.lowerLeft), - lowerRight: hu(e, t.lowerRight) + upperLeft: pu(e, t.upperLeft), + upperRight: pu(e, t.upperRight), + lowerLeft: pu(e, t.lowerLeft), + lowerRight: pu(e, t.lowerRight) }; if ("width" in t) { - const n = hu(e, t), r = hu(e, { + const n = pu(e, t), r = pu(e, { x: t.x + t.width, y: t.y + t.height }); @@ -3603,7 +3603,7 @@ function K3(e, t) { height: Math.abs(r.y - n.y) }; } - return hu(e, t); + return pu(e, t); } function ns(e, t) { return { @@ -3653,7 +3653,7 @@ function YQ(e, t) { const ms = (e) => ({ x: e.x, y: -e.y -}), Nd = (e) => ({ +}), Pd = (e) => ({ x: e.x, y: -e.y }), Hw = (e) => ({ @@ -3672,10 +3672,10 @@ const ms = (e) => ({ lowerLeft: ms(e.lowerLeft), lowerRight: ms(e.lowerRight) }), H3 = (e) => ({ - upperLeft: Nd(e.upperLeft), - upperRight: Nd(e.upperRight), - lowerLeft: Nd(e.lowerLeft), - lowerRight: Nd(e.lowerRight) + upperLeft: Pd(e.upperLeft), + upperRight: Pd(e.upperRight), + lowerLeft: Pd(e.lowerLeft), + lowerRight: Pd(e.lowerRight) }); function LV(e) { return "rotation" in e; @@ -3693,7 +3693,7 @@ function z3(e) { const t = new ArrayBuffer(e.byteLength); return new Uint8Array(t).set(e), t; } -async function Vo(e) { +async function $o(e) { if (e instanceof Uint8Array) return { bytes: z3(e) }; if (QQ(e)) { const i = QI(e); @@ -3722,7 +3722,7 @@ function QI(e) { const t = e.name; return typeof t == "string" && t.length > 0 ? t : void 0; } -function im(e) { +function am(e) { if (e.byteLength < 4) return null; const t = new Uint8Array(e); return t[0] === 137 && t[1] === 80 && t[2] === 78 && t[3] === 71 ? XQ(e) : t[0] === 255 && t[1] === 216 && t[2] === 255 ? ZQ(e) : t[0] === 37 && t[1] === 80 && t[2] === 68 && t[3] === 70 ? { mimeType: "application/pdf" } : null; @@ -3761,7 +3761,7 @@ function ZQ(e) { return null; } const Fk = ["appearance", "file"]; -async function cg(e) { +async function lg(e) { if (!e) return {}; for (const n of Object.keys(e)) if (!Fk.includes(n)) throw new J(q.InvalidArg, `unknown annotation resource '${n}'; expected ${Fk.join(" or ")}`); const t = {}; @@ -3773,7 +3773,7 @@ async function cg(e) { } async function DV(e, t) { const n = await VV(e); - if (!im(n)) throw new J(q.InvalidArg, `${t} must be PNG, JPEG or one-page PDF bytes`); + if (!am(n)) throw new J(q.InvalidArg, `${t} must be PNG, JPEG or one-page PDF bytes`); return n; } function jV(e, t) { @@ -3927,13 +3927,13 @@ function W3(e, t) { }; } case "fitR": { - const { left: i, bottom: a, right: c, top: l, ...u } = e, d = Math.min(a, l), f = Math.max(a, l); + const { left: i, bottom: a, right: c, top: l, ...u } = e, f = Math.min(a, l), d = Math.max(a, l); return { ...u, x: Math.min(i, c) - n, - y: r - f, + y: r - d, width: Math.abs(c - i), - height: f - d + height: d - f }; } case "fit": @@ -3969,13 +3969,13 @@ function q3(e, t) { }; } case "fitR": { - const { x: i, y: a, width: c, height: l, ...u } = e, d = r - a; + const { x: i, y: a, width: c, height: l, ...u } = e, f = r - a; return { ...u, left: i + n, - bottom: d - l, + bottom: f - l, right: i + n + c, - top: d + top: f }; } case "fit": @@ -4059,7 +4059,7 @@ const QV = { measure: (e, { visible: t }) => iX(e, t), linkTarget: (e, { boxOf: t }) => WV(e, (n) => q3(n, t)), actions: (e, { boxOf: t }) => JV(e, (n) => q3(n, t)) -}, aX = (e) => e === void 0 ? VY : om[e] ?? om.unsupported; +}, aX = (e) => e === void 0 ? VY : sm[e] ?? sm.unsupported; function lv(e, t, n, r) { const o = aX(e); return Object.fromEntries(Object.entries(t).map(([s, i]) => { @@ -4107,7 +4107,7 @@ function t7(e, t, n) { boxOf: n }, QV); } -const G3 = (e) => !!(e.space || e.empty), Tm = (e) => !!e.empty, dX = 2.5, fX = 1.5, hX = 0.8, pX = 0.5, gX = Math.cos(87e-4), n7 = 1e-6; +const G3 = (e) => !!(e.space || e.empty), Mm = (e) => !!e.empty, dX = 2.5, fX = 1.5, hX = 0.8, pX = 0.5, gX = Math.cos(87e-4), n7 = 1e-6; function mX(e) { const t = wX(e), n = t.glyphs.length, r = (s) => typeof s != "number" ? X3(t, s) : Number.isInteger(s) && s >= 0 && s < n ? s : null, o = ([s, i]) => ({ start: s, @@ -4165,24 +4165,24 @@ function Y3(e, t) { }; } function bX(e, t) { - const n = t.glyphs.find((f) => !Tm(f)); + const n = t.glyphs.find((d) => !Mm(d)); if (!n) return 0; const r = n.loose, o = r.upperRight.x - r.upperLeft.x, s = r.upperRight.y - r.upperLeft.y, i = Math.hypot(o, s); if (i <= n7) return 0; const a = { x: o / i, y: s / i - }, c = r.upperLeft.x - r.lowerLeft.x, l = r.upperLeft.y - r.lowerLeft.y, u = a.x * l - a.y * c >= 0 ? 1 : -1, d = { + }, c = r.upperLeft.x - r.lowerLeft.x, l = r.upperLeft.y - r.lowerLeft.y, u = a.x * l - a.y * c >= 0 ? 1 : -1, f = { x: -a.y * u, y: a.x * u }; - for (let f = 0; f < e.length; f++) { - const h = e[f], g = h.baseline.x * a.x + h.baseline.y * a.y, p = h.ascent.x * d.x + h.ascent.y * d.y > 0; - if (g >= gX && p) return f; + for (let d = 0; d < e.length; d++) { + const h = e[d], g = h.baseline.x * a.x + h.baseline.y * a.y, p = h.ascent.x * f.x + h.ascent.y * f.y > 0; + if (g >= gX && p) return d; } return e.push({ baseline: a, - ascent: d + ascent: f }), e.length - 1; } function wX(e) { @@ -4207,7 +4207,7 @@ function wX(e) { const s = bX(r, o), i = r[s]; let a = null; for (const c of o.glyphs) { - if (Tm(c)) { + if (Mm(c)) { t.push({ loose: J3, space: c.space, @@ -4245,7 +4245,7 @@ const Q3 = (e, t) => t.x >= e.left && t.x <= e.right && t.y >= e.bottom && t.y < function vX(e) { let t = 0, n = 0; for (const r of e.glyphs) - Tm(r) || (t += r.loose.top - r.loose.bottom, n++); + Mm(r) || (t += r.loose.top - r.loose.bottom, n++); return n === 0 ? 0 : t / n; } function kX(e, t) { @@ -4268,11 +4268,11 @@ function X3(e, t, n = 1.5) { const c = r[a.frame], l = a.rect; if (!(c.x < l.left - o || c.x > l.right + o || c.y < l.bottom - o || c.y > l.top + o)) for (let u = 0; u < a.count; u++) { - const d = e.glyphs[a.start + u]; - if (Tm(d)) continue; - const f = d.tight ?? d.loose; - if (c.x < f.left - o || c.x > f.right + o || c.y < f.bottom - o || c.y > f.top + o) continue; - const h = Math.min(Math.abs(c.x - f.left), Math.abs(c.x - f.right)), g = Math.min(Math.abs(c.y - f.bottom), Math.abs(c.y - f.top)); + const f = e.glyphs[a.start + u]; + if (Mm(f)) continue; + const d = f.tight ?? f.loose; + if (c.x < d.left - o || c.x > d.right + o || c.y < d.bottom - o || c.y > d.top + o) continue; + const h = Math.min(Math.abs(c.x - d.left), Math.abs(c.x - d.right)), g = Math.min(Math.abs(c.y - d.bottom), Math.abs(c.y - d.top)); h + g < i - n7 && (i = h + g, s = a.start + u); } } @@ -4310,7 +4310,7 @@ function SX(e, t) { } function xX(e, t) { const n = e.glyphs[t]; - if (!n || Tm(n)) return null; + if (!n || Mm(n)) return null; const r = n.loose; if (r.right <= r.left || r.top <= r.bottom) return null; const o = e.runs.find((i) => t >= i.start && t < i.start + i.count), s = e.frames[o?.frame ?? 0]; @@ -4325,13 +4325,13 @@ function EX(e, t, n) { const a = i.start + i.count - 1; if (a < r || i.start > o) continue; const c = Math.max(r, i.start), l = Math.min(o, a); - let u = 1 / 0, d = -1 / 0, f = 1 / 0, h = -1 / 0, g = 0, p = 0, m = -1 / 0, v = 0, S = 0; + let u = 1 / 0, f = -1 / 0, d = 1 / 0, h = -1 / 0, g = 0, p = 0, m = -1 / 0, v = 0, S = 0; const C = () => { g > 0 && u !== 1 / 0 && s.push({ rect: { left: u, - bottom: f, - right: d, + bottom: d, + right: f, top: h }, charCount: g, @@ -4339,18 +4339,18 @@ function EX(e, t, n) { frame: i.frame, firstX: v, lastX: S - }), u = 1 / 0, d = -1 / 0, f = 1 / 0, h = -1 / 0, g = 0, p = 0, m = -1 / 0; + }), u = 1 / 0, f = -1 / 0, d = 1 / 0, h = -1 / 0, g = 0, p = 0, m = -1 / 0; }; for (let k = c; k <= l; k++) { const N = e.glyphs[k]; - if (Tm(N)) continue; + if (Mm(N)) continue; const w = N.loose; if (g > 0 && m > -1 / 0) { const x = p / g; x > 0 && Math.abs(w.left - m) > dX * x && C(); } const y = (w.left + w.right) / 2; - g === 0 && (v = y), S = y, u = Math.min(u, w.left), d = Math.max(d, w.right), f = Math.min(f, w.bottom), h = Math.max(h, w.top), g++, p += w.right - w.left, m = w.right; + g === 0 && (v = y), S = y, u = Math.min(u, w.left), f = Math.max(f, w.right), d = Math.min(d, w.bottom), h = Math.max(h, w.top), g++, p += w.right - w.left, m = w.right; } C(); } @@ -4539,8 +4539,8 @@ const s7 = (e) => ({ center: ms(e.center) }), i7 = (e) => ({ degrees: e.degrees, - center: Nd(e.center) -}), a7 = (e, t) => Nd(v0(ms(e), s7(t))), c7 = (e, t) => Nd(sV(ms(e), s7(t))), DX = (e, t) => i7(_Y(e.map(ms), t)), jX = (e, t) => i7(LY(e.map(ms), t)), FX = (e) => _V(MY(YI(e))); + center: Pd(e.center) +}), a7 = (e, t) => Pd(v0(ms(e), s7(t))), c7 = (e, t) => Pd(sV(ms(e), s7(t))), DX = (e, t) => i7(_Y(e.map(ms), t)), jX = (e, t) => i7(LY(e.map(ms), t)), FX = (e) => _V(MY(YI(e))); function VX(e) { return tX({ ...e, @@ -4559,14 +4559,14 @@ const _a = { function $X(e, t) { const n = t; if (n.rect === void 0 || !jx.has(e.subtype)) return t; - const r = e, o = QP(e.subtype), s = (d, f) => Object.fromEntries(f.filter((h) => d[h] !== void 0).map((h) => [h, d[h]])), { subtype: i, ...a } = t7(kV(ZV({ + const r = e, o = QP(e.subtype), s = (f, d) => Object.fromEntries(d.filter((h) => f[h] !== void 0).map((h) => [h, f[h]])), { subtype: i, ...a } = t7(kV(ZV({ subtype: e.subtype, ...s(r, ["rect", ...o]) }, _a, FE), e7({ subtype: e.subtype, ...s(n, ["rect", ...o]) }, _a, FE)), _a, FE), { rect: c, ...l } = n, u = { ...l }; - for (const [d, f] of Object.entries(a)) u[d] = n[d] !== void 0 && Fo(f, n[d]) ? n[d] : f; + for (const [f, d] of Object.entries(a)) u[f] = n[f] !== void 0 && Vo(d, n[f]) ? n[f] : d; return u; } const Ww = () => _a; @@ -4575,7 +4575,7 @@ function $x(e, t, n = {}) { ...t, subtype: t.subtype ?? e.subtype }, _a, Ww), n), _a, Ww), o = t; - for (const s of Object.keys(r)) o[s] !== void 0 && Fo(r[s], o[s]) && (r[s] = o[s]); + for (const s of Object.keys(r)) o[s] !== void 0 && Vo(r[s], o[s]) && (r[s] = o[s]); return r; } function l7(e, t, n = {}) { @@ -4583,13 +4583,13 @@ function l7(e, t, n = {}) { } function UX(e, t = {}) { const n = uX(jQ(lX(e, _a, Ww), t), _a, Ww), r = e; - for (const o of Object.keys(n)) r[o] !== void 0 && Fo(n[o], r[o]) && (n[o] = r[o]); + for (const o of Object.keys(n)) r[o] !== void 0 && Vo(n[o], r[o]) && (n[o] = r[o]); return n; } function u7(e, t) { return LX(UX(e, { describeFont: t.describeFont }), t); } -const Do = { +const jo = { pt: 0.0254 / 72, mm: 1e-3, cm: 0.01, @@ -4601,17 +4601,17 @@ const Do = { mi: 1609.344 }, s6 = (e) => `${e}2`; function i6(e) { - return e === "ha" ? 1e4 : e === "acre" ? 4046.8564224 : Do[e.slice(0, -1)] ** 2; + return e === "ha" ? 1e4 : e === "acre" ? 4046.8564224 : jo[e.slice(0, -1)] ** 2; } const a6 = (e) => e.endsWith("2") ? e.slice(0, -1) + "²" : e; function XI(e) { return new J(q.InvalidArg, e); } -function lg(e) { +function ug(e) { if (!Number.isFinite(e) || e <= 0) throw XI("Calibration requires finite positive lengths and scales"); } function d7(e, t, n, r) { - lg(Math.fround(e)); + ug(Math.fround(e)); const o = r.precision ?? 100; if (!Number.isInteger(Math.log10(o)) || o < 1 || o > 1e9) throw XI("Invalid decimal precision"); const s = r.areaUnit ?? s6(t), i = { @@ -4619,7 +4619,7 @@ function d7(e, t, n, r) { ...r.fixed === void 0 ? {} : { fixed: r.fixed } }, a = r.imperialFeetInches ? [{ unit: "ft", - conversion: Math.fround(Do[t] / Do.ft) + conversion: Math.fround(jo[t] / jo.ft) }, { unit: "in", conversion: 12, @@ -4643,20 +4643,20 @@ function d7(e, t, n, r) { distance: a, area: [{ unit: a6(s), - conversion: Math.fround(Do[t] ** 2 / i6(s)), + conversion: Math.fround(jo[t] ** 2 / i6(s)), ...i }] }; return XP(c), c; } function KX(e, t, n = {}) { - lg(e), lg(t.value); + ug(e), ug(t.value); const r = t.value / e; return d7(r, t.unit, `1 in = ${Number((r * 72).toPrecision(8))} ${t.unit}`, n); } function f7(e, t, n, r = {}) { const { userUnit: o = 1, ...s } = r; - return lg(e), lg(t), lg(o), d7(o / 72 * 0.0254 * (t / e) / Do[n], n, `${e}:${t}`, s); + return ug(e), ug(t), ug(o), d7(o / 72 * 0.0254 * (t / e) / jo[n], n, `${e}:${t}`, s); } function HX(e, t) { if (J.is(e, q.GrantPassphraseRequired)) return { @@ -4858,37 +4858,37 @@ function p7(e) { } function g7(e, t, n = () => !1) { const r = /* @__PURE__ */ new Map(); - e.forEach((f, h) => { - f.subtype === "unsupported" ? r.set(h, "unsupported-kind") : f.subtype === "widget" ? r.set(h, "widget") : n(h) && r.set(h, "unsupported-value"); + e.forEach((d, h) => { + d.subtype === "unsupported" ? r.set(h, "unsupported-kind") : d.subtype === "widget" ? r.set(h, "widget") : n(h) && r.set(h, "unsupported-value"); }); const o = /* @__PURE__ */ new Map(); - e.forEach((f, h) => { - const g = oe(f.ref); + e.forEach((d, h) => { + const g = oe(d.ref); o.has(g) || o.set(g, h); }); - const s = (f) => t.page ?? e[f].ref.page, i = (f, h) => { - const g = o.get(oe(f)); + const s = (d) => t.page ?? e[d].ref.page, i = (d, h) => { + const g = o.get(oe(d)); if (!(g === void 0 || r.has(g))) - return Gt(s(g)) === Gt(s(h)) ? g : void 0; + return Yt(s(g)) === Yt(s(h)) ? g : void 0; }, a = /* @__PURE__ */ new Set(); - e.forEach((f, h) => { - if (r.has(h) || f.subtype !== "popup") return; - const g = f.parent ? o.get(oe(f.parent)) : void 0, p = f.parent ? i(f.parent, h) : void 0; + e.forEach((d, h) => { + if (r.has(h) || d.subtype !== "popup") return; + const g = d.parent ? o.get(oe(d.parent)) : void 0, p = d.parent ? i(d.parent, h) : void 0; p === void 0 ? r.set(h, g !== void 0 && r.has(g) ? "parent-dropped" : "parent-missing") : a.has(p) ? r.set(h, "popup-taken") : a.add(p); }); const c = /* @__PURE__ */ new Map(); - e.forEach((f, h) => { + e.forEach((d, h) => { r.has(h) || c.set(h, c.size); }); const l = t.offset ?? { x: 0, y: 0 - }, u = [...c.keys()].map((f) => { - const h = e[f], g = h.reply ? i(h.reply.to, f) : void 0, p = h.subtype === "popup" && h.parent ? i(h.parent, f) : void 0, { nm: m, groupId: v, reply: S, popup: C, ...k } = h; + }, u = [...c.keys()].map((d) => { + const h = e[d], g = h.reply ? i(h.reply.to, d) : void 0, p = h.subtype === "popup" && h.parent ? i(h.parent, d) : void 0, { nm: m, groupId: v, reply: S, popup: C, ...k } = h; for (const { field: N } of QX(h)) delete k[N]; return { - source: f, - page: s(f), + source: d, + page: s(d), data: qY(k, l), ...g !== void 0 ? { replyTo: { copy: c.get(g), @@ -4896,16 +4896,16 @@ function g7(e, t, n = () => !1) { } } : {}, ...p !== void 0 ? { parent: c.get(p) } : {} }; - }), d = []; - return e.forEach((f, h) => { + }), f = []; + return e.forEach((d, h) => { const g = r.get(h); - g && d.push({ - ref: f.ref, + g && f.push({ + ref: d.ref, reason: g }); }), { copies: u, - dropped: d + dropped: f }; } function tZ(e, t) { @@ -4919,16 +4919,16 @@ const rZ = "event.target.buttonImportIcon();", oZ = /^\s*event\s*\.\s*target\s*\ function sZ(e) { return oZ.test(e); } -const Mm = ["activate", "mouseUp"]; +const Bm = ["activate", "mouseUp"]; function iZ(e) { const t = jP(e); return t !== null && sZ(t); } function aZ(e) { - return Mm.some((t) => e?.[t] != null); + return Bm.some((t) => e?.[t] != null); } function lS(e) { - const t = Mm.flatMap((n) => { + const t = Bm.flatMap((n) => { const r = e?.[n]; return r == null ? [] : [r]; }); @@ -4944,7 +4944,7 @@ function m7() { }; } function y7(e) { - return Mm.some((t) => e?.[t] !== void 0) ? e ?? {} : { + return Bm.some((t) => e?.[t] !== void 0) ? e ?? {} : { ...e, activate: m7() }; @@ -4959,7 +4959,7 @@ function l6(e, t) { } function cZ(e, t) { if (e !== void 0) { - for (const n of t) for (const r of Mm) if (n.actions?.[r] !== void 0) throw new J(q.InvalidArg, `'takesImage' writes each widget's press: name it or a widget's actions.${r}, not both`, { details: { field: "takesImage" } }); + for (const n of t) for (const r of Bm) if (n.actions?.[r] !== void 0) throw new J(q.InvalidArg, `'takesImage' writes each widget's press: name it or a widget's actions.${r}, not both`, { details: { field: "takesImage" } }); if (e && t.length === 0) throw w7(); } } @@ -5137,7 +5137,7 @@ function vZ(e, t) { const o = new Set(n.map(Or)); for (const { page: s, after: i } of t) { if (o.has(Or(s))) continue; - const a = i ? n.findIndex((c) => Or(c) === Gt(i)) : -1; + const a = i ? n.findIndex((c) => Or(c) === Yt(i)) : -1; n.splice(a + 1, 0, s), r = u6(r, a + 1, 1), o.add(Or(s)); } return n.length === e.pages.length ? e : uv(n, r, e); @@ -5146,7 +5146,7 @@ function kZ(e, t) { return Kx(t, e.labels) ? e : uv(e.pages, t, e); } function S7(e, t) { - const n = new Set(t.map(Gt)); + const n = new Set(t.map(Yt)); return e.flatMap((r, o) => n.has(Or(r)) ? [{ page: r, after: o > 0 ? e[o - 1].ref : null @@ -5162,7 +5162,7 @@ function AZ(e, t) { function SZ(e, t) { const n = new Map(e.map((o) => [Or(o), o.rotation])), r = /* @__PURE__ */ new Map(); for (const o of t) { - const s = n.get(Gt(o)); + const s = n.get(Yt(o)); s !== void 0 && r.set(s, [...r.get(s) ?? [], o]); } return [...r].map(([o, s]) => ({ @@ -5174,7 +5174,7 @@ function SZ(e, t) { function xZ(e, t) { const n = new Map(e.map((o) => [Or(o), EZ(o)])), r = /* @__PURE__ */ new Map(); for (const o of t) { - const s = n.get(Gt(o)); + const s = n.get(Yt(o)); if (s === void 0) continue; const i = JSON.stringify(s), a = r.get(i) ?? { measure: s, @@ -5194,7 +5194,7 @@ function EZ(e) { } function CZ(e, t, n) { if (!bZ.includes(n) || !d6(e.pages, t)) return e; - const r = new Set(t.map(Gt)); + const r = new Set(t.map(Yt)); let o = !1; const s = e.pages.map((i) => !r.has(Or(i)) || i.rotation === n ? i : (o = !0, { ...i, @@ -5207,7 +5207,7 @@ function CZ(e, t, n) { } function IZ(e, t, n) { if (!d6(e.pages, t)) return e; - const r = new Set(t.map(Gt)); + const r = new Set(t.map(Yt)); return { pages: e.pages.map((o) => { if (!r.has(Or(o))) return o; @@ -5226,19 +5226,19 @@ function NZ(e, t, n) { const o = new Map(r.map((c) => [Or(c), c])); let s; try { - s = iS(r.map((c) => c.ref), t, n, Gt); + s = iS(r.map((c) => c.ref), t, n, Yt); } catch { return e; } - const i = s.map((c) => o.get(Gt(c))); + const i = s.map((c) => o.get(Yt(c))); if (i.every((c, l) => c === r[l])) return e; - const a = Gt(t[0]); + const a = Yt(t[0]); return uv(i, gZ(e.labels, r.length, E7(r, t), i.findIndex((c) => Or(c) === a)), e); } function OZ(e, t) { const { pages: n } = e; if (!d6(n, t) || t.length >= n.length) return e; - const r = new Set(t.map(Gt)); + const r = new Set(t.map(Yt)); return uv(n.filter((o) => !r.has(Or(o))), A7(e.labels, n.length, E7(n, t)), e); } function PZ(e, t) { @@ -5246,7 +5246,7 @@ function PZ(e, t) { return !Number.isInteger(r) || r < 1 || r > 100 || !(Number.isFinite(n.width) && n.width > 0) || !(Number.isFinite(n.height) && n.height > 0) ? e : x7(e, t.position, t.objectNumbers, r, (o) => TZ(o, n.width, n.height)); } function RZ(e, t) { - const n = new Map(e.pages.map((s) => [Or(s), s])), r = t.pages.map((s) => n.get(Gt(s))); + const n = new Map(e.pages.map((s) => [Or(s), s])), r = t.pages.map((s) => n.get(Yt(s))); if (r.length === 0 || r.some((s) => !s)) return e; let o = 0; return x7(e, t.position, t.objectNumbers, r.length, (s) => ({ @@ -5261,25 +5261,25 @@ function x7(e, t, n, r, o) { if (new Set(n).size !== n.length || n.some((l) => i.has(l))) return e; let a; try { - a = n6(s.map((l) => l.ref), t ?? "end", Gt); + a = n6(s.map((l) => l.ref), t ?? "end", Yt); } catch { return e; } - const c = n.map((l) => o(Lt(l))); + const c = n.map((l) => o(Ft(l))); return uv([ ...s.slice(0, a), ...c, ...s.slice(a) ], u6(e.labels, a, r), e); } -const Or = (e) => Gt(e.ref); +const Or = (e) => Yt(e.ref); function d6(e, t) { if (t.length === 0) return !1; - const n = new Set(e.map(Or)), r = new Set(t.map(Gt)); + const n = new Set(e.map(Or)), r = new Set(t.map(Yt)); return r.size === t.length && [...r].every((o) => n.has(o)); } function E7(e, t) { - const n = new Set(t.map(Gt)); + const n = new Set(t.map(Yt)); return e.flatMap((r, o) => n.has(Or(r)) ? [o] : []); } function uv(e, t, n) { @@ -5398,7 +5398,7 @@ function C7(e, t) { state: null }; const n = e.widgets[0]; - if (!n) throw bl(`'${e.name}' has no widget to check`); + if (!n) throw wl(`'${e.name}' has no widget to check`); return { kind: "toggle", state: n.onState @@ -5412,7 +5412,7 @@ function C7(e, t) { case "radio": if ("value" in t) { const n = iM(e, t.value); - if (n === null && e.noToggleToOff) throw bl(`'${e.name}' must keep a choice: it can't be cleared`); + if (n === null && e.noToggleToOff) throw wl(`'${e.name}' must keep a choice: it can't be cleared`); return { kind: "toggle", state: n @@ -5426,9 +5426,9 @@ function C7(e, t) { if ("selectedValues" in t) return aM(e, t.selectedValues); break; default: - throw bl(`${e.kind} fields hold no value you can set`); + throw wl(`${e.kind} fields hold no value you can set`); } - throw bl(`a ${e.kind} field takes ${LZ[e.kind]}, not ${DZ(t)}`); + throw wl(`a ${e.kind} field takes ${LZ[e.kind]}, not ${DZ(t)}`); } function I7(e, t) { const n = (i) => new J(q.InvalidArg, i, { details: { field: "defaultValue" } }); @@ -5440,14 +5440,14 @@ function I7(e, t) { function iM(e, t) { if (t === null || t === "Off") return null; const n = e.widgets.find((r) => r.exportValue === t); - if (!n) throw bl(`no widget of '${e.name}' has the export value '${t}'`); + if (!n) throw wl(`no widget of '${e.name}' has the export value '${t}'`); return n.onState; } function aM(e, t) { - if (new Set(t).size !== t.length) throw bl("the values must not repeat"); - if (e.kind === "listbox" && !e.multiSelect && t.length > 1) throw bl(`'${e.name}' takes one value (it has no multiSelect)`); + if (new Set(t).size !== t.length) throw wl("the values must not repeat"); + if (e.kind === "listbox" && !e.multiSelect && t.length > 1) throw wl(`'${e.name}' takes one value (it has no multiSelect)`); const n = new Set(e.options.map((s) => s.value)), r = e.kind === "combobox" && e.edit && t.length === 1, o = t.find((s) => !n.has(s)); - if (!r && o !== void 0) throw bl(`'${o}' is not an option value of '${e.name}'`); + if (!r && o !== void 0) throw wl(`'${o}' is not an option value of '${e.name}'`); return { kind: "choice", values: t @@ -5456,7 +5456,7 @@ function aM(e, t) { function DZ(e) { return "checked" in e ? "{ checked }" : "selectedValues" in e ? "{ selectedValues }" : "{ value }"; } -function bl(e) { +function wl(e) { return new J(q.InvalidArg, e, { details: { field: "value" } }); } function jZ(e, t) { @@ -5527,7 +5527,7 @@ function FZ(e) { const { field: t } = e, n = t.defaultValueEntry; switch (t.kind) { case "text": { - if (n.kind === "array" || n.kind === "unsupported") throw sh(t); + if (n.kind === "array" || n.kind === "unsupported") throw ah(t); const r = n.kind === "scalar" ? n.value : "", o = n.kind === "scalar" ? n : { kind: "none" }; return A0({ ...t, @@ -5537,22 +5537,22 @@ function FZ(e) { } case "checkbox": case "radio": { - if (n.kind === "array" || n.kind === "unsupported") throw sh(t); + if (n.kind === "array" || n.kind === "unsupported") throw ah(t); const r = n.kind === "scalar" ? n.value : null; if (r === null || r === "Off") return ZI(e, -1); const o = WZ(t.widgets, r); - if (o < 0) throw sh(t); + if (o < 0) throw ah(t); return ZI(e, o); } case "combobox": case "listbox": { - if (n.kind === "unsupported") throw sh(t); + if (n.kind === "unsupported") throw ah(t); let r = n.kind === "scalar" ? [n.value] : n.kind === "array" ? [...n.values] : []; - if (r.length === 1 && r[0] === "" && !uS(t, r) && (r = []), !uS(t, r) && !qZ(t, r)) throw sh(t); + if (r.length === 1 && r[0] === "" && !uS(t, r) && (r = []), !uS(t, r) && !qZ(t, r)) throw ah(t); return A0(h6(t, r), e); } default: - throw sh(t); + throw ah(t); } } function VZ(e, t) { @@ -5598,7 +5598,7 @@ function $E(e) { switch (e.kind) { case "text": case "combobox": - return e.defaultValue !== void 0 ? am(e.defaultValue) : S0(); + return e.defaultValue !== void 0 ? cm(e.defaultValue) : S0(); case "listbox": return p6(g6((e.options ?? []).map(m6), e.defaultValue ?? [])); default: @@ -5608,14 +5608,14 @@ function $E(e) { function f6(e, t) { const n = e.widgets ?? [], r = l6(e, e.kind); cZ(r, n); - const o = n.map((f, h) => QZ(e, r ? { - ...f, - actions: y7(f.actions) - } : f, { + const o = n.map((d, h) => QZ(e, r ? { + ...d, + actions: y7(d.actions) + } : d, { ref: t.widgets[h], field: t.objectNumber, nm: t.widgetNames?.[h] - })), s = o.map((f) => RY(y6(f.ref), f.page)), i = (e.kind === "combobox" || e.kind === "listbox" ? e.options ?? [] : []).map(m6), a = KF(e), c = { + })), s = o.map((d) => RY(y6(d.ref), d.page)), i = (e.kind === "combobox" || e.kind === "listbox" ? e.options ?? [] : []).map(m6), a = KF(e), c = { ref: { kind: "objectNumber", objectNumber: t.objectNumber @@ -5629,7 +5629,7 @@ function f6(e, t) { mappingName: e.mappingName ?? null, valueEntry: { kind: "none" }, defaultValueEntry: { kind: "none" }, - groupId: nm(a), + groupId: rm(a), assignment: a, lockedBy: null, purpose: Ux(e.purpose), @@ -5644,17 +5644,17 @@ function f6(e, t) { format: l, ...l ? { actions: R7(void 0, l) } : {} }; - let d; + let f; switch (e.kind) { case "text": { - const f = e.defaultValue ?? ""; - d = { + const d = e.defaultValue ?? ""; + f = { ...c, ...u, kind: "text", defaultValueEntry: $E(e), value: "", - defaultValue: f, + defaultValue: d, maxLength: e.maxLength ?? null, multiline: e.multiline ?? !1, password: e.password ?? !1, @@ -5664,32 +5664,32 @@ function f6(e, t) { break; } case "checkbox": { - const f = n.map((h, g) => lM(s[g], h.exportValue ?? "Yes")); - d = { + const d = n.map((h, g) => lM(s[g], h.exportValue ?? "Yes")); + f = { ...c, kind: "checkbox", checked: !1, - exportValue: f[0]?.exportValue ?? "Yes", + exportValue: d[0]?.exportValue ?? "Yes", hasValuesList: !1, - widgets: f + widgets: d }; break; } case "radio": { - const f = n.map((h, g) => lM(s[g], h.exportValue ?? "")); - d = { + const d = n.map((h, g) => lM(s[g], h.exportValue ?? "")); + f = { ...c, kind: "radio", value: "Off", radiosInUnison: e.radiosInUnison ?? !1, noToggleToOff: e.noToggleToOff ?? !1, hasValuesList: !1, - widgets: f + widgets: d }; break; } case "combobox": - d = { + f = { ...c, ...u, kind: "combobox", @@ -5702,13 +5702,13 @@ function f6(e, t) { }; break; case "listbox": { - const f = e.defaultValue ?? []; - d = { + const d = e.defaultValue ?? []; + f = { ...c, kind: "listbox", defaultValueEntry: $E(e), selectedValues: [], - defaultValue: g6(i, f), + defaultValue: g6(i, d), multiSelect: e.multiSelect ?? !1, options: i, topIndex: 0, @@ -5717,23 +5717,23 @@ function f6(e, t) { break; } case "pushbutton": - d = { + f = { ...c, kind: "pushbutton", hasImage: !1, - takesImage: c6(o.map((f) => f.actions)), + takesImage: c6(o.map((d) => d.actions)), widgets: s }; break; default: - d = { + f = { ...c, kind: e.kind, widgets: s }; } return { - field: d, + field: f, widgets: o }; } @@ -5745,7 +5745,7 @@ function UZ(e, t) { r.name = a < 0 ? t.name : `${r.name.slice(0, a + 1)}${t.name}`; } for (const a of HZ) typeof n[a] == "boolean" && a in r && (r[a] = n[a]); - if (t.alternateName !== void 0 && (r.alternateName = t.alternateName || null), t.mappingName !== void 0 && (r.mappingName = t.mappingName || null), r.assignment = hY(t, r), r.groupId = nm(r.assignment), t.purpose !== void 0 && (r.purpose = Ux(t.purpose)), t.placeholder !== void 0 && (r.placeholder = Lx(t.placeholder)), r.kind === "text" || r.kind === "combobox") { + if (t.alternateName !== void 0 && (r.alternateName = t.alternateName || null), t.mappingName !== void 0 && (r.mappingName = t.mappingName || null), r.assignment = hY(t, r), r.groupId = rm(r.assignment), t.purpose !== void 0 && (r.purpose = Ux(t.purpose)), t.placeholder !== void 0 && (r.placeholder = Lx(t.placeholder)), r.kind === "text" || r.kind === "combobox") { const a = _x(t, r.kind); if (a !== void 0 && !EY(a, r.format)) { const c = R7(r.actions, a); @@ -5754,7 +5754,7 @@ function UZ(e, t) { } if (r.kind === "text" && ("maxLength" in t && t.maxLength !== void 0 && (r.maxLength = t.maxLength), "defaultValue" in t && t.defaultValue !== void 0)) { const a = t.defaultValue; - r.defaultValue = a ?? "", r.defaultValueEntry = a === null ? S0() : am(a); + r.defaultValue = a ?? "", r.defaultValueEntry = a === null ? S0() : cm(a); } let o = !1; if ((r.kind === "combobox" || r.kind === "listbox") && ("options" in t && t.options && (r = GZ(r, t.options.map(m6)), o = !0), "defaultValue" in t && t.defaultValue !== void 0)) { @@ -5831,12 +5831,12 @@ function ZI(e, t) { const n = e.field; if (n.kind !== "checkbox" && n.kind !== "radio") return e; const r = n.kind === "checkbox" || n.radiosInUnison, o = t >= 0 ? n.widgets[t] : null, s = n.widgets.map((l, u) => { - const d = o !== null && (r ? l.exportValue === o.exportValue && l.onState === o.onState : u === t); - return l.checked === d ? l : { + const f = o !== null && (r ? l.exportValue === o.exportValue && l.onState === o.onState : u === t); + return l.checked === f ? l : { ...l, - checked: d + checked: f }; - }), i = am(o ? o.onState : "Off"), a = n.kind === "checkbox" ? { + }), i = cm(o ? o.onState : "Off"), a = n.kind === "checkbox" ? { ...n, widgets: s, valueEntry: i, @@ -5888,7 +5888,7 @@ function h6(e, t) { }; } function p6(e) { - return e.length === 0 ? S0() : e.length === 1 ? am(e[0]) : { + return e.length === 0 ? S0() : e.length === 1 ? cm(e[0]) : { kind: "array", values: [...e] }; @@ -5919,7 +5919,7 @@ function M7(e, t, n = !1) { const i = n ? e.kind === "listbox" && e.multiSelect ? { kind: "array", values: [] - } : am("") : S0(); + } : cm("") : S0(); return e.kind === "combobox" ? { ...e, defaultValueEntry: i, @@ -5930,7 +5930,7 @@ function M7(e, t, n = !1) { defaultValue: [] }; } - const r = uS(e, t), o = r ? g6(e.options, t) : [...t], s = r ? p6(o) : am(t[0]); + const r = uS(e, t), o = r ? g6(e.options, t) : [...t], s = r ? p6(o) : cm(t[0]); return e.kind === "combobox" ? { ...e, defaultValueEntry: s, @@ -5980,11 +5980,11 @@ const m6 = (e) => ({ label: e.label, value: e.value, selected: !1 -}), y6 = (e) => e.kind === "objectNumber" ? e.objectNumber : 0, am = (e) => ({ +}), y6 = (e) => e.kind === "objectNumber" ? e.objectNumber : 0, cm = (e) => ({ kind: "scalar", value: e }), S0 = () => ({ kind: "none" }); -function sh(e) { +function ah(e) { return new J(q.Unknown, `'${e.name}' could not be reset`); } function qw(e) { @@ -6019,7 +6019,7 @@ function qw(e) { async function b6(e) { if (e === null) return null; if (B7(e)) return { pdf: e.pdf.slice() }; - const { appearance: t } = await cg({ appearance: e }); + const { appearance: t } = await lg({ appearance: e }); return new Uint8Array(t); } function w6(e) { @@ -6096,7 +6096,7 @@ async function nee(e) { const t = [], n = []; for (const r of e.ops) switch (r.type) { case "annotations.create": { - const { resources: o, ...s } = r, i = await cg(o); + const { resources: o, ...s } = r, i = await lg(o); t.push(...zw(i)), n.push({ ...s, data: jV(r.data, o), @@ -6105,7 +6105,7 @@ async function nee(e) { break; } case "annotations.update": { - const { resources: o, ...s } = r, i = await cg(o); + const { resources: o, ...s } = r, i = await lg(o); t.push(...zw(i)), n.push({ ...s, ...aS(i) ? { resources: i } : {} @@ -6137,7 +6137,7 @@ async function nee(e) { break; } case "attachments.create": { - const o = await cg(r.resources); + const o = await lg(r.resources); t.push(...zw(o)), n.push({ ...r, resources: o @@ -6278,13 +6278,13 @@ function uee(e) { } function dee(e) { const t = e.indexOf(":"), n = e.indexOf(":", t + 1); - if (t === -1 || n === -1) throw new Lo(e, "collab scope requires entity:action:filter"); + if (t === -1 || n === -1) throw new Do(e, "collab scope requires entity:action:filter"); const r = e.slice(0, t), o = e.slice(t + 1, n), s = e.slice(n + 1); if (r === "fields") return fee(e, o, s); - if (r !== "annotations") throw new Lo(e, `unknown collab entity: ${r}`); - if (o !== "create" && o !== "update" && o !== "delete" && o !== "set-group" && o !== "*") throw new Lo(e, `unknown collab action: ${o}`); + if (r !== "annotations") throw new Do(e, `unknown collab entity: ${r}`); + if (o !== "create" && o !== "update" && o !== "delete" && o !== "set-group" && o !== "*") throw new Do(e, `unknown collab action: ${o}`); const i = L7(s, e); - if (o === "set-group" && (i.kind === "self" || i.kind === "createdBy")) throw new Lo(e, `set-group only supports :all or :group= filters (got :${i.kind})`); + if (o === "set-group" && (i.kind === "self" || i.kind === "createdBy")) throw new Do(e, `set-group only supports :all or :group= filters (got :${i.kind})`); return { kind: "collab", entity: r, @@ -6293,9 +6293,9 @@ function dee(e) { }; } function fee(e, t, n) { - if (t !== "fill" && t !== "sign" && t !== "set-group" && t !== "*") throw new Lo(e, `unknown fields action: ${t}`); + if (t !== "fill" && t !== "sign" && t !== "set-group" && t !== "*") throw new Do(e, `unknown fields action: ${t}`); const r = L7(n, e); - if (r.kind !== "all" && r.kind !== "group") throw new Lo(e, `fields only support :all or :group= filters (got :${r.kind})`); + if (r.kind !== "all" && r.kind !== "group") throw new Do(e, `fields only support :all or :group= filters (got :${r.kind})`); return { kind: "collab", entity: "fields", @@ -6308,7 +6308,7 @@ function L7(e, t) { if (e === "self") return { kind: "self" }; if (e.startsWith("createdBy=")) { const n = e.slice(10); - if (!n) throw new Lo(t, "createdBy= requires a value"); + if (!n) throw new Do(t, "createdBy= requires a value"); return { kind: "createdBy", userId: n @@ -6316,17 +6316,17 @@ function L7(e, t) { } if (e.startsWith("group=")) { const n = e.slice(6); - if (!n) throw new Lo(t, "group= requires a value"); + if (!n) throw new Do(t, "group= requires a value"); return { kind: "group", groupId: n }; } - throw new Lo(t, `unknown filter: ${e}`); + throw new Do(t, `unknown filter: ${e}`); } const hee = /^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/, pee = /^[a-z][a-z0-9]*(-[a-z0-9]+)*(\.[a-z][a-z0-9]*(-[a-z0-9]+)*)+$/; function gee(e, t) { - if (!pee.test(e)) throw new Lo(e, "invalid plugin permission shape (expected .)"); + if (!pee.test(e)) throw new Do(e, "invalid plugin permission shape (expected .)"); return { kind: "plugin", name: e, @@ -6334,8 +6334,8 @@ function gee(e, t) { }; } function mee(e) { - if (!hee.test(e)) throw new Lo(e, "invalid capability name shape"); - if (!cee.has(e)) throw new Lo(e, `unknown capability: ${e}`); + if (!hee.test(e)) throw new Do(e, "invalid capability name shape"); + if (!cee.has(e)) throw new Do(e, `unknown capability: ${e}`); return { kind: "capability", name: e @@ -6350,7 +6350,7 @@ function yee(e) { function v6(e, t, n, r = null) { if (di(r).has(e)) return !1; const o = t.map(Si); - return o.some((s) => s.kind === "wildcard") ? !0 : Bm(o, n, r).has(e); + return o.some((s) => s.kind === "wildcard") ? !0 : _m(o, n, r).has(e); } function bee(e, t, n, r = null) { return e.some((o) => v6(o, t, n, r)); @@ -6359,9 +6359,9 @@ function wee(e, t, n, r, o) { const s = n.map(Si); if (s.some((a) => a.kind === "wildcard")) return !0; const i = s.filter((a) => a.kind === "collab" && a.entity === "annotations" && (a.action === e || a.action === "*")); - return i.length > 0 ? i.some((a) => Cee(a.filter, t, r)) : Bm(s, o).has("doc.annotate.modify"); + return i.length > 0 ? i.some((a) => Cee(a.filter, t, r)) : _m(s, o).has("doc.annotate.modify"); } -function Bm(e, t, n = null) { +function _m(e, t, n = null) { const r = /* @__PURE__ */ new Set(); let o = !1, s = !1; for (const i of e) i.kind === "capability" ? r.add(i.name) : i.kind === "virtual" && i.name === "pdf.permissions" ? Iee(r, t) : i.kind === "collab" && i.entity === "annotations" ? o = !0 : i.kind === "collab" && i.entity === "fields" && (s = !0); @@ -6380,7 +6380,7 @@ function kee(e, t, n = D7) { return vee(t, n).has(e); } function Aee(e, t, n = null) { - return Bm(e.map(Si), t, n); + return _m(e.map(Si), t, n); } function pM(e, t, n, r) { if (t === n) return !0; @@ -6402,25 +6402,25 @@ function xee(e, t, n, r, o = null) { const c = n.map(Si); if (c.some((u) => u.kind === "wildcard")) return !0; const l = c.filter((u) => u.kind === "collab" && u.entity === "fields" && (u.action === e || u.action === "*")); - return l.length > 0 ? l.some((u) => u.filter.kind === "all" || i !== null && u.filter.groupId === i) : Bm(c, r, o).has(a); + return l.length > 0 ? l.some((u) => u.filter.kind === "all" || i !== null && u.filter.groupId === i) : _m(c, r, o).has(a); } function Eee(e, t, n, r) { - const o = e.map(Si), s = o.some((d) => d.kind === "wildcard"), i = (d) => o.filter((f) => f.kind === "collab" && f.entity === "fields" && (f.action === d || f.action === "*")), a = (d, f = []) => { - if (d.some((g) => g.filter.kind === "all")) return { all: !0 }; - const h = d.flatMap((g) => g.filter.kind === "group" ? [g.filter.groupId] : []); + const o = e.map(Si), s = o.some((f) => f.kind === "wildcard"), i = (f) => o.filter((d) => d.kind === "collab" && d.entity === "fields" && (d.action === f || d.action === "*")), a = (f, d = []) => { + if (f.some((g) => g.filter.kind === "all")) return { all: !0 }; + const h = f.flatMap((g) => g.filter.kind === "group" ? [g.filter.groupId] : []); return { all: !1, - groups: [.../* @__PURE__ */ new Set([...h, ...f])] + groups: [.../* @__PURE__ */ new Set([...h, ...d])] }; }, c = { all: !1, groups: [] - }, l = (d) => { - const f = d === "fill" ? "doc.forms.fill" : "doc.sign"; - if (di(n).has(f)) return c; + }, l = (f) => { + const d = f === "fill" ? "doc.forms.fill" : "doc.sign"; + if (di(n).has(d)) return c; if (s) return { all: !0 }; - const h = i(d); - return h.length > 0 ? a(h) : Bm(o, t, n).has(f) ? { all: !0 } : c; + const h = i(f); + return h.length > 0 ? a(h) : _m(o, t, n).has(d) ? { all: !0 } : c; }, u = r !== void 0 ? [r] : []; return { fill: l("fill"), @@ -6432,7 +6432,7 @@ function j7(e, t, n, r = null) { const o = e === "fill" ? "doc.forms.fill" : "doc.sign"; if (di(r).has(o)) return !1; const s = t.map(Si); - return s.some((i) => i.kind === "wildcard") || s.some((i) => i.kind === "collab" && i.entity === "fields" && (i.action === e || i.action === "*")) ? !0 : Bm(s, n, r).has(o); + return s.some((i) => i.kind === "wildcard") || s.some((i) => i.kind === "collab" && i.entity === "fields" && (i.action === e || i.action === "*")) ? !0 : _m(s, n, r).has(o); } function Cee(e, t, n) { switch (e.kind) { @@ -6453,12 +6453,12 @@ function Nee(e, t) { const n = e?.flatten; if (n === void 0) { for (const o of ["includeAnnotations", "includeFormFields"]) if (e?.[o] !== void 0) throw new J(q.InvalidArg, `${o} takes flatten`, { details: { field: o } }); - if (!t.download) throw new po("doc.download"); + if (!t.download) throw new go("doc.download"); return null; } const r = n.usage ?? "display"; if (r !== "display" && r !== "print") throw new J(q.InvalidArg, 'usage must be "display" or "print"', { details: { field: "flatten.usage" } }); - if (!t.download && !t.downloadFlattened) throw new po("doc.download", "flatten", ["doc.download", "doc.download.flattened"]); + if (!t.download && !t.downloadFlattened) throw new go("doc.download", "flatten", ["doc.download", "doc.download.flattened"]); return { usage: r, ...e6(e, t) @@ -6481,7 +6481,7 @@ function F7(e) { return `${t.slice(0, 8)}-${t.slice(8, 12)}-${t.slice(12, 16)}-${t.slice(16, 20)}-${t.slice(20)}`; } async function Pee(e, t) { - const n = await Vo(e.data instanceof ArrayBuffer ? new Uint8Array(e.data) : e.data), r = e.name ?? n.name; + const n = await $o(e.data instanceof ArrayBuffer ? new Uint8Array(e.data) : e.data), r = e.name ?? n.name; if (!r) throw new J(q.InvalidArg, "attachment file requires a name — pass { data, name } or a File whose name is set"); const o = e.mimeType ?? n.mimeType; return { @@ -6523,7 +6523,7 @@ function Ree(e, t) { return HV(e, t); } function U7(e) { - return Fd(e.actions) || (e.widgets ?? []).some((t) => Fd(t.actions)); + return $d(e.actions) || (e.widgets ?? []).some((t) => $d(t.actions)); } const Tee = /^[\x21-\x7e]{1,255}$/; function Nr(e) { @@ -6535,7 +6535,7 @@ function Nr(e) { function Mee(e) { return e.meta.changedRefs; } -const lc = { +const uc = { /** Bit 3 — print the document. */ PRINT: 4, /** Bit 4 — modify content streams. */ @@ -6564,14 +6564,14 @@ function Hx(e) { assemble: !1, printHighQuality: !1 } : { - print: (e & lc.PRINT) !== 0, - modifyContents: (e & lc.MODIFY) !== 0, - copy: (e & lc.COPY) !== 0, - modifyAnnotations: (e & lc.ANNOTATE_FILL) !== 0, - fillForms: (e & lc.FILL_FORMS) !== 0, - copyForAccessibility: (e & lc.ACCESSIBILITY) !== 0, - assemble: (e & lc.ASSEMBLE) !== 0, - printHighQuality: (e & lc.PRINT_HIGH) !== 0 + print: (e & uc.PRINT) !== 0, + modifyContents: (e & uc.MODIFY) !== 0, + copy: (e & uc.COPY) !== 0, + modifyAnnotations: (e & uc.ANNOTATE_FILL) !== 0, + fillForms: (e & uc.FILL_FORMS) !== 0, + copyForAccessibility: (e & uc.ACCESSIBILITY) !== 0, + assemble: (e & uc.ASSEMBLE) !== 0, + printHighQuality: (e & uc.PRINT_HIGH) !== 0 }; } function Bee(e, t, n) { @@ -6697,14 +6697,14 @@ function q7(e, t, n, r, o) { const s = {}, i = !r && e.kind === "pushbutton" && e.takesImage && lS(t.actions); for (const l of FF) { const u = t.actions?.[l]; - if (!u || i && Mm.includes(l)) continue; - const d = LF(u), f = (h) => o.push({ + if (!u || i && Bm.includes(l)) continue; + const f = LF(u), d = (h) => o.push({ ref: e.ref, widget: t.ref, field: `actions.${l}`, reason: h }); - d ? !r && LP(d) ? f("script-not-allowed") : s[l] = tZ(d, n) : f("unsupported-action"); + f ? !r && LP(f) ? d("script-not-allowed") : s[l] = tZ(f, n) : d("unsupported-action"); } const a = e.kind === "checkbox" || e.kind === "radio" ? e.widgets.find((l) => l.ref && oe(l.ref) === oe(t.ref)) : void 0, c = { color: t.color, @@ -6745,9 +6745,9 @@ function Vee(e, t, n, r, o) { ...OY(e.placeholder) ? { placeholder: e.placeholder } : {}, ...Object.keys(n).length > 0 ? { actions: n } : {}, widgets: r - }, i = n.format === void 0 ? W7(e) : null, a = i ? { format: i } : {}, c = e.defaultValueEntry.kind !== "none", l = (u) => u.map(({ label: d, value: f }) => ({ - label: d, - value: f + }, i = n.format === void 0 ? W7(e) : null, a = i ? { format: i } : {}, c = e.defaultValueEntry.kind !== "none", l = (u) => u.map(({ label: f, value: d }) => ({ + label: f, + value: d })); switch (e.kind) { case "text": @@ -6786,11 +6786,11 @@ function Vee(e, t, n, r, o) { ...c ? { defaultValue: e.defaultValue } : {} }; case "pushbutton": { - const u = r.every((f) => Mm.every((h) => f.actions?.[h] === void 0)), d = e.takesImage && r.length > 0 && u; + const u = r.every((d) => Bm.every((h) => d.actions?.[h] === void 0)), f = e.takesImage && r.length > 0 && u; return { ...s, kind: "pushbutton", - ...d ? { takesImage: !0 } : {} + ...f ? { takesImage: !0 } : {} }; } case "checkbox": @@ -6841,7 +6841,7 @@ function A6(e) { x: h.rect.x + a.x, y: h.rect.y + a.y } } : {} - }), l = [], u = [], d = [], f = /* @__PURE__ */ new Set(); + }), l = [], u = [], f = [], d = /* @__PURE__ */ new Set(); e.fields.forEach((h, g) => { const p = t.fields.find((w) => eN(w, h)); if (!p) throw new J(q.NotFound, `copy: no form field ${eV(h)}`, { details: { item: g } }); @@ -6849,7 +6849,7 @@ function A6(e) { const y = w.ref ? o.get(oe(w.ref)) : void 0; return y && (!s || s.has(oe(y.ref))) ? [y] : []; }), v = Fee(p, m); - for (const w of m) f.add(oe(w.ref)); + for (const w of m) d.add(oe(w.ref)); if (s && m.length === 0) throw new J(q.InvalidArg, `copy: 'widgets' names no widget of field ${g}`, { details: { item: g, field: "widgets" @@ -6864,7 +6864,7 @@ function A6(e) { const S = Uee(v.name, (w) => $ee(i, w)); i.add(S); const C = jee(v, n, l), k = m.map((w) => c(q7(v, w, (y) => y, n, l))), N = e.values && v.kind !== "signature" && Dee(v) ? J7(v) : null; - d.push(p), u.push({ + f.push(p), u.push({ source: g, draft: Vee(v, S, C, k, `copy: field ${g}`), widgets: m.map((w) => w.ref), @@ -6872,10 +6872,10 @@ function A6(e) { ...N ? { value: N } : {} }); }); - for (const h of s ?? []) if (!f.has(h)) throw new J(q.InvalidArg, `copy: widget ${h} is a widget of none of the fields`, { details: { field: "widgets" } }); + for (const h of s ?? []) if (!d.has(h)) throw new J(q.InvalidArg, `copy: widget ${h} is a widget of none of the fields`, { details: { field: "widgets" } }); return { creates: u, - calculationOrder: t.calculationOrder.flatMap((h) => h ? u.flatMap((g, p) => eN(d[p], h) && g.draft.actions?.calculate ? [p] : []) : []), + calculationOrder: t.calculationOrder.flatMap((h) => h ? u.flatMap((g, p) => eN(f[p], h) && g.draft.actions?.calculate ? [p] : []) : []), dropped: l }; } @@ -6905,23 +6905,23 @@ function mM(e, t, n) { } }); } function Kee(e) { - const { form: t, limits: n } = e, r = t.fields.find((f) => eN(f, e.field)); + const { form: t, limits: n } = e, r = t.fields.find((d) => eN(d, e.field)); if (!r) throw new J(q.NotFound, `repeat: no form field ${eV(e.field)}`); const o = e.as ?? X7(r), s = Q7(t, r, o); if (s) throw new J(q.InvalidArg, `repeat: ${s}`, { details: { field: "field" } }); const i = Y7(t, r), a = i[0].page, c = e.pageOf(a); if (!c) throw new J(q.NotFound, `repeat: no page ${a.objectNumber}`); - const l = new Set(o === "boxes" ? r.widgets.flatMap((f) => f.page?.objectNumber ?? []) : [a.objectNumber]), u = []; - for (const f of e.pages) - l.has(f.ref.objectNumber) || (l.add(f.ref.objectNumber), u.push(f)); - const d = u.length * (o === "boxes" ? i.length : 1 + i.length); - return mM(n, "pages", u.length), mM(n, "items", d), { + const l = new Set(o === "boxes" ? r.widgets.flatMap((d) => d.page?.objectNumber ?? []) : [a.objectNumber]), u = []; + for (const d of e.pages) + l.has(d.ref.objectNumber) || (l.add(d.ref.objectNumber), u.push(d)); + const f = u.length * (o === "boxes" ? i.length : 1 + i.length); + return mM(n, "pages", u.length), mM(n, "items", f), { as: o, field: r, template: i, from: c, targets: u, - count: d + count: f }; } const zx = Symbol.for("@embedpdf/engine/local"); @@ -6997,7 +6997,7 @@ function qee(e) { } function Gee(e) { const t = UP(Jee(e)); - return Om.includes(t) ? t : void 0; + return Pm.includes(t) ? t : void 0; } function Jee(e) { const [t = "", n = ""] = e.split(/[-,]/, 2); @@ -7073,7 +7073,7 @@ function bM(e, t) { const n = (o) => o.programs.some((s) => s.sha256 === t.lastResortDisplayHash), r = qee(e.faces).filter((o) => !Yee(o) && !n(o)).map(Qee); return { fonts: [ - ...Om.map((o) => Zee(o, t)), + ...Pm.map((o) => Zee(o, t)), ...e.engineFonts.map(Xee), ...r ], @@ -7114,44 +7114,44 @@ function nte(e, t, n, r) { const u = l.fallbacks.flatMap((g) => { const p = o.get(g); return p ? [p] : []; - }), d = { + }), f = { weight: l.weight, italic: l.italic, substituted: l.degraded, fallbacks: u - }, f = l.baseFontName ? Gee(l.baseFontName) : void 0; - if (l.source === "standard" || l.source === "document-font" && f && !l.objectNumber) { - const g = f ?? "helvetica"; + }, d = l.baseFontName ? Gee(l.baseFontName) : void 0; + if (l.source === "standard" || l.source === "document-font" && d && !l.objectNumber) { + const g = d ?? "helvetica"; return { - ...d, + ...f, font: g, program: r.standardDisplayHash(g) }; } if (l.source === "engine" && l.engineFont) return { - ...d, + ...f, font: l.engineFont, program: o.get(l.engineFont) ?? null }; const h = i.get(s(l.objectNumber, l.displaySha256)); return h ? { - ...d, + ...f, font: n$(h.face, h.program.postScriptName), program: x6(h.program) ? h.program.displaySha256 : null } : { - ...d, + ...f, font: l.baseFontName ?? l.familyName, program: null }; }, c = (l) => { - const u = a(l), d = r.standardDisplayHash(cl({ + const u = a(l), f = r.standardDisplayHash(ll({ family: l.familyName, weight: l.weight, italic: l.italic })); - return u.program === d ? u : { + return u.program === f ? u : { ...u, - fallbacks: [...u.fallbacks, d] + fallbacks: [...u.fallbacks, f] }; }; return { @@ -7183,7 +7183,7 @@ var ite = class { throw t; }); }) { - this.onListenerError = e, fr(this, "listeners", /* @__PURE__ */ new Set()), fr(this, "latestSequence", null); + this.onListenerError = e, hr(this, "listeners", /* @__PURE__ */ new Set()), hr(this, "latestSequence", null); } subscribe(e) { return this.listeners.add(e), () => { @@ -7213,7 +7213,7 @@ var ite = class { } }, ate = class { constructor(e, t, n = null) { - this.hub = e, this.sessionId = t, this.sub = n, fr(this, "fontsChangedBy", /* @__PURE__ */ new Set()); + this.hub = e, this.sessionId = t, this.sub = n, hr(this, "fontsChangedBy", /* @__PURE__ */ new Set()); } /** * The write `opId` changed the fonts that can be named in the document (the @@ -7337,10 +7337,10 @@ function lte(e) { const c = tN({ ...s }); - return o ? c.map(({ field: l, widgets: u, ...d }) => ({ + return o ? c.map(({ field: l, widgets: u, ...f }) => ({ type: "forms.deleted", deleted: l.ref, - ...d + ...f })) : c.map((l) => ({ type: "forms.created", ...l @@ -7711,8 +7711,8 @@ function wte(e, t) { const n = (r, o) => se.run(async (s) => { const i = await t({ ops: [r] }, o?.opId === void 0 ? {} : { opId: o.opId }).abortWith(s), a = r.type, c = i.items[0]; if (!c || c.type !== a) throw new J(q.Unknown, `${a} wrote nothing`); - const { type: l, skipped: u, ...d } = c; - return d; + const { type: l, skipped: u, ...f } = c; + return f; }); return { get: e, @@ -7831,8 +7831,8 @@ function kte(e, t) { ...c === void 0 ? {} : { objectNumbers: c } }] }, s === void 0 ? {} : { opId: s }).abortWith(o)).items[0]; if (!l || l.type !== "annotations.copy") throw new J(q.Unknown, "annotations.copy wrote nothing"); - const { type: u, ...d } = l; - return d; + const { type: u, ...f } = l; + return f; }) }; } @@ -7857,7 +7857,7 @@ function Ate(e, t) { reorderCalculations: (n, r, o) => e.reorderCalculations(n, r, o), repair: (n) => e.repair(n), copy: (n, r = {}) => se.run(async (o) => { - const { opId: s, widgets: i, page: a, offset: c, values: l, objectNumbers: u } = r, d = await KE(t, { + const { opId: s, widgets: i, page: a, offset: c, values: l, objectNumbers: u } = r, f = await KE(t, { type: "forms.copy", fields: n, ...i === void 0 ? {} : { widgets: i }, @@ -7866,8 +7866,8 @@ function Ate(e, t) { ...l === void 0 ? {} : { values: l }, ...u === void 0 ? {} : { objectNumbers: u } }, s).abortWith(o); - if (d.type !== "forms.copy") throw Vk(d.type); - const { type: f, ...h } = d; + if (f.type !== "forms.copy") throw Vk(f.type); + const { type: d, ...h } = f; return h; }), repeat: (n, r) => se.run(async (o) => { @@ -7879,8 +7879,8 @@ function Ate(e, t) { ...c === void 0 ? {} : { objectNumbers: c } }, s).abortWith(o); if (l.type !== "forms.repeat") throw Vk(l.type); - const { type: u, ...d } = l; - return d; + const { type: u, ...f } = l; + return f; }), setButtonImage: (n, r, o = {}) => se.run(async (s) => { const i = await KE(t, { @@ -7985,10 +7985,10 @@ var Ite = class { } const o = this.guard.actorForCreate(), s = this.docId; return se.run(async (i) => { - const a = rN(e.resources), c = this.queue.enqueue({ buildPack: (d) => Pe({ + const a = rN(e.resources), c = this.queue.enqueue({ buildPack: (f) => Pe({ kind: "annotations.import", effect: "write", - jobId: d, + jobId: f, opId: r, docId: s, bundle: { @@ -8002,9 +8002,9 @@ var Ite = class { i.aborted ? l() : i.addEventListener("abort", l, { once: !0 }); const u = await c; if (u.tag !== "annotations.import") throw new J(q.WireFormat, `unexpected payload tag: ${u.tag}`); - return this.publisher.publishWrite(r, ...p7(u.result).map((d) => ({ + return this.publisher.publishWrite(r, ...p7(u.result).map((f) => ({ type: "annotations.created", - ...d + ...f }))), u.result; }); } @@ -8430,7 +8430,7 @@ var Tte = class { }), i.result)); } update(e, t, n) { - const r = this.beginDesign(n, Fd(t.actions)); + const r = this.beginDesign(n, $d(t.actions)); if (r.rejected) return r.rejected; const o = this.docId, s = this.queue.enqueue({ buildPack: (i) => Pe({ kind: "forms.updateField", @@ -8465,7 +8465,7 @@ var Tte = class { }), s.result)); } addWidget(e, t, n = {}) { - const r = this.beginDesign(n, Fd(t.actions)); + const r = this.beginDesign(n, $d(t.actions)); if (r.rejected) return r.rejected; const o = this.docId, s = this.queue.enqueue({ buildPack: (i) => Pe({ kind: "forms.addWidget", @@ -8517,7 +8517,7 @@ var Tte = class { }), s.result)); } updateWidget(e, t, n) { - const r = this.beginDesign(n, Fd(t.actions)); + const r = this.beginDesign(n, $d(t.actions)); if (r.rejected) return r.rejected; const o = this.docId, s = this.queue.enqueue({ buildPack: (i) => Pe({ kind: "forms.updateWidget", @@ -8890,7 +8890,7 @@ function Fte(e) { var t = jte(e, "string"); return I0(t) == "symbol" ? t : t + ""; } -function je(e, t, n) { +function Ve(e, t, n) { return (t = Fte(t)) in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, @@ -8915,7 +8915,7 @@ const Vte = { var $te = class { constructor(e, t, n, r, o = null, s = () => { }) { - this.docId = t, this.queue = n, this.view = r, this.guard = o, this.onUnlocked = s, je(this, "securityState", void 0), je(this, "passwordRejected", !1), this.securityState = wM(e); + this.docId = t, this.queue = n, this.view = r, this.guard = o, this.onUnlocked = s, Ve(this, "securityState", void 0), Ve(this, "passwordRejected", !1), this.securityState = wM(e); } get state() { return this.securityState; @@ -9282,7 +9282,7 @@ var Kte = class { } }, Hte = class { constructor(e, t, n, r, o) { - this.publisher = o, je(this, "custom", void 0), je(this, "deps", void 0), this.deps = { + this.publisher = o, Ve(this, "custom", void 0), Ve(this, "deps", void 0), this.deps = { docId: e, queue: t, view: n, @@ -9322,7 +9322,7 @@ var Kte = class { const zte = 32; var Wte = class { constructor(e, t, n, r) { - this.docId = e, this.queue = t, je(this, "numbers", []), je(this, "refilling", !1), je(this, "lostListeners", /* @__PURE__ */ new Set()), r && (this.numbers = rM([r])), n.on("document.versioned", () => { + this.docId = e, this.queue = t, Ve(this, "numbers", []), Ve(this, "refilling", !1), Ve(this, "lostListeners", /* @__PURE__ */ new Set()), r && (this.numbers = rM([r])), n.on("document.versioned", () => { const o = this.numbers; this.numbers = [], o.length > 0 && this.notifyLost({ numbers: o, @@ -9451,15 +9451,15 @@ function c$(e, t, n, r = {}) { if (o.aborted) throw new J(q.Aborted, "appearance render aborted"); const u = await t.encode(l.raster, r, o); if (u.source.kind !== "bytes") throw new J(q.WireFormat, "local appearance image handle expected a byte source"); - const d = u.source.bytes, f = IV(u, { async blob() { - return new Blob([Qte(d)], { type: u.mimeType }); + const f = u.source.bytes, d = IV(u, { async blob() { + return new Blob([Qte(f)], { type: u.mimeType }); } }); c.push({ ref: l.ref, mode: l.mode, state: l.state, rect: l.rect, - image: f + image: d }); } return { @@ -9553,8 +9553,8 @@ var Xte = class { let r; try { r = Nr(t), n !== void 0 && n !== this.guard.identity().groupId && this.guard.assertSetGroup(n), this.guard.assertCollab("create", this.guard.targetForSelfCreate(n)); - } catch (d) { - return se.rejectReason(d); + } catch (f) { + return se.rejectReason(f); } const o = this.guard.actorForCreate(n), { resources: s, objectNumber: i } = t, a = jV(e, s), c = this.docId, l = this.ref, u = this.queue.enqueue({ line: { @@ -9562,25 +9562,25 @@ var Xte = class { docId: c, page: l }, - buildPack: async (d) => { - const f = await cg(s); + buildPack: async (f) => { + const d = await lg(s); return Pe({ kind: "annotations.create", effect: "write", - jobId: d, + jobId: f, opId: r, docId: c, page: l, draft: a, ...i !== void 0 ? { objectNumber: i } : {}, - ...aS(f) ? { resources: f } : {}, + ...aS(d) ? { resources: d } : {}, ...o ? { actor: o } : {} - }, zw(f)); + }, zw(d)); } }); - return se.run(async (d) => { - const f = () => u.abort(d.reason); - d.aborted ? f() : d.addEventListener("abort", f, { once: !0 }); + return se.run(async (f) => { + const d = () => u.abort(f.reason); + f.aborted ? d() : f.addEventListener("abort", d, { once: !0 }); const h = await u; if (h.tag !== "annotations.create") throw new J(q.WireFormat, `unexpected payload tag: ${h.tag}`); return this.publisher.publishWrite(r, { @@ -9604,7 +9604,7 @@ var Xte = class { docId: i }, buildPack: async (c) => { - const l = await cg(s); + const l = await lg(s); return Pe({ kind: "annotations.update", effect: "write", @@ -9746,7 +9746,7 @@ var Xte = class { } }, Zte = class { constructor(e, t, n, r, o, s, i = za) { - this.encoder = o, je(this, "batch", void 0), this.batch = { + this.encoder = o, Ve(this, "batch", void 0), this.batch = { docId: e, page: t, queue: n, @@ -9800,10 +9800,10 @@ var Xte = class { a.aborted ? c() : a.addEventListener("abort", c, { once: !0 }); const l = await i; if (l.tag !== "pages.render") throw new J(q.WireFormat, `unexpected payload tag: ${l.tag}`); - const { raster: u, area: d } = l; + const { raster: u, area: f } = l; return { ...u, - transform: qQ(d, e?.rotation ?? 0, u.width, u.height) + transform: qQ(f, e?.rotation ?? 0, u.width, u.height) }; }); } @@ -10011,13 +10011,13 @@ var nne = class { } }, one = class { constructor(e, t, n, r, o, s, i, a, c = za) { - this.ref = e, je(this, zx, !0), je(this, "annotations", void 0), je(this, "forms", void 0), je(this, "text", void 0), je(this, "render", void 0), je(this, "pieceInfo", void 0), je(this, "measure", void 0), this.annotations = new Xte(t, e, n, r, o, s, i, c), this.forms = new Zte(t, e, n, r, o, s, c), this.text = new nne(t, e, n, r, s), this.render = new ene(t, e, n, r, o, s, c), this.pieceInfo = new l$(t, n, r, s, e), this.measure = new rne(t, e, n, r, s, a); + this.ref = e, Ve(this, zx, !0), Ve(this, "annotations", void 0), Ve(this, "forms", void 0), Ve(this, "text", void 0), Ve(this, "render", void 0), Ve(this, "pieceInfo", void 0), Ve(this, "measure", void 0), this.annotations = new Xte(t, e, n, r, o, s, i, c), this.forms = new Zte(t, e, n, r, o, s, c), this.text = new nne(t, e, n, r, s), this.render = new ene(t, e, n, r, o, s, c), this.pieceInfo = new l$(t, n, r, s, e), this.measure = new rne(t, e, n, r, s, a); } }, sne = class oN { /** A newly opened document's handle, its calls carrying no facts. */ static open(t, n, r, o, s, i, a = za, c, l) { let u = !1; - const d = () => u, f = new ite(), h = new Wte(t, n, f, c), g = new ate(f, i), p = () => g.publishFact({ type: "fonts.changed" }); + const f = () => u, d = new ite(), h = new Wte(t, n, d, c), g = new ate(d, i), p = () => g.publishFact({ type: "fonts.changed" }); l?.add(p); const m = { id: t, @@ -10026,11 +10026,11 @@ var nne = class { guard: s, renderPolicy: a, publisher: g, - events: f, - security: new $te(o, t, n, { isClosed: d }, s, () => h.topUp()), + events: d, + security: new $te(o, t, n, { isClosed: f }, s, () => h.topUp()), objectNumbers: h, render: { getPolicy: () => se.resolveValue(a) }, - isClosed: d, + isClosed: f, close: () => { u = !0, l?.delete(p); }, @@ -10039,7 +10039,7 @@ var nne = class { return new oN(m, {}); } constructor(t, n) { - this.doc = t, this.facts = n, je(this, zx, !0), je(this, "metadata", void 0), je(this, "pieceInfo", void 0), je(this, "annotations", void 0), je(this, "attachments", void 0), je(this, "actions", void 0), je(this, "outline", void 0), je(this, "forms", void 0), je(this, "fonts", void 0), je(this, "search", void 0), je(this, "pages", void 0), je(this, "redaction", void 0), je(this, "security", void 0), je(this, "signatures", void 0), je(this, "render", void 0), je(this, "events", void 0), je(this, "objectNumbers", void 0), je(this, "id", void 0), je(this, "queue", void 0), je(this, "changes", void 0); + this.doc = t, this.facts = n, Ve(this, zx, !0), Ve(this, "metadata", void 0), Ve(this, "pieceInfo", void 0), Ve(this, "annotations", void 0), Ve(this, "attachments", void 0), Ve(this, "actions", void 0), Ve(this, "outline", void 0), Ve(this, "forms", void 0), Ve(this, "fonts", void 0), Ve(this, "search", void 0), Ve(this, "pages", void 0), Ve(this, "redaction", void 0), Ve(this, "security", void 0), Ve(this, "signatures", void 0), Ve(this, "render", void 0), Ve(this, "events", void 0), Ve(this, "objectNumbers", void 0), Ve(this, "id", void 0), Ve(this, "queue", void 0), Ve(this, "changes", void 0); const { id: r, guard: o, publisher: s } = t, i = Pte(t.queue.withFacts(n), s), a = { isClosed: t.isClosed }; this.id = r, this.queue = i, this.render = t.render, this.events = t.events, this.objectNumbers = t.objectNumbers, this.security = t.security, this.metadata = new Hte(r, i, a, o, s), this.pieceInfo = new l$(r, i, a, o), this.annotations = kte(new Ite(r, i, a, o, s), (c, l) => this.apply(c, l)), this.attachments = bte(new Nte(r, i, a, o), (c, l) => this.apply(c, l)), this.actions = new Cte(r, i, a, o), this.outline = wte(() => Bte(r, i, a, o), (c, l) => this.apply(c, l)), this.forms = Ate(new Mte(r, i, a, o, s), (c, l) => this.apply(c, l)), this.fonts = new Tte(r, i, a, o), this.search = new Dte(r, i, a, o), this.pages = vte(new _te(r, i, a, o, s), (c, l) => this.apply(c, l)), this.redaction = new Lte(r, i, a, o, s), this.signatures = new Ute(r, i, a, o, s), this.changes = new Ote(r, i, a, o, s); } @@ -10189,38 +10189,38 @@ var nne = class { }, ine = class { constructor(e, t = () => { }) { - this.queue = e, this.onChange = t, je(this, "fonts", /* @__PURE__ */ new Map()), je(this, "fallbacks", []); + this.queue = e, this.onChange = t, Ve(this, "fonts", /* @__PURE__ */ new Map()), Ve(this, "fallbacks", []); } register(e) { const t = e.key; - if (!t || Om.includes(t)) return se.rejectReason(new J(q.InvalidArg, t ? `'${t}' is a standard font's name; register the font under a key of its own` : "a font needs a key", { details: { field: "key" } })); + if (!t || Pm.includes(t)) return se.rejectReason(new J(q.InvalidArg, t ? `'${t}' is a standard font's name; register the font under a key of its own` : "a font needs a key", { details: { field: "key" } })); const n = AM(e.data), r = this.fonts.get(t); if (r) return se.resolveValue(r.handle); const o = e.familyName ?? "", s = e.weight ?? 0, i = e.italic === void 0 ? -1 : e.italic ? 1 : 0; return se.run(async (a) => { - const c = n.slice(0), l = this.queue.enqueue({ buildPack: (f) => Pe({ + const c = n.slice(0), l = this.queue.enqueue({ buildPack: (d) => Pe({ kind: "fonts.register", effect: "runtimeWrite", - jobId: f, + jobId: d, fontKey: t, familyName: o, weight: s, italic: i, data: n }, [n]) }); - ih(a, l); - const u = await l, d = { + ch(a, l); + const u = await l, f = { key: t, ...u.identity }; return this.fonts.set(t, { - handle: d, + handle: f, italic: i, weight: s, familyName: o, bytes: c, builtIn: !1 - }), this.onChange(), d; + }), this.onChange(), f; }); } /** @@ -10271,7 +10271,7 @@ var nne = class { const n = []; for (const r of e) { const o = this.register(r); - ih(t, o), n.push(await o); + ch(t, o), n.push(await o); } return n; }); @@ -10288,7 +10288,7 @@ var nne = class { fontKey: t, tier: n }) }); - ih(r, o), await o, this.noteFallback(t, n), this.onChange(); + ch(r, o), await o, this.noteFallback(t, n), this.onChange(); }); } /** Record a fallback as the worker has it: adding one again changes its tier only. */ @@ -10308,7 +10308,7 @@ var nne = class { jobId: i, fontKey: t }) }); - ih(r, o); + ch(r, o); const s = await o; return n.handle = { key: t, @@ -10323,7 +10323,7 @@ var nne = class { effect: "runtimeWrite", jobId: n }) }); - ih(e, t), await t, this.fallbacks.length = 0, this.onChange(); + ch(e, t), await t, this.fallbacks.length = 0, this.onChange(); }); } clear() { @@ -10333,7 +10333,7 @@ var nne = class { effect: "runtimeWrite", jobId: n }) }); - ih(e, t), await t, this.fonts.clear(), this.fallbacks.length = 0, this.onChange(); + ch(e, t), await t, this.fonts.clear(), this.fallbacks.length = 0, this.onChange(); }); } list() { @@ -10375,7 +10375,7 @@ var nne = class { }) }); } }; -function ih(e, t) { +function ch(e, t) { const n = () => t.abort(e.reason); e.aborted ? n() : e.addEventListener("abort", n, { once: !0 }); } @@ -10395,7 +10395,7 @@ function qx(e) { function cne(e) { Wx().allowed.delete(e); } -function ug(e, t) { +function dg(e, t) { const n = lne(e); return new Worker(n, t); } @@ -10545,7 +10545,7 @@ self.onmessage = async (event) => { `, zE = { type: "module" }; var y$ = class { constructor(e = {}) { - this.options = e, je(this, "pending", /* @__PURE__ */ new Map()), je(this, "workers", []), je(this, "blob", null), je(this, "configuredUrl", void 0), je(this, "nextWorker", 0), je(this, "nextId", 1), je(this, "disabledWorkerPath", !1), je(this, "poolVerified", !1); + this.options = e, Ve(this, "pending", /* @__PURE__ */ new Map()), Ve(this, "workers", []), Ve(this, "blob", null), Ve(this, "configuredUrl", void 0), Ve(this, "nextWorker", 0), Ve(this, "nextId", 1), Ve(this, "disabledWorkerPath", !1), Ve(this, "poolVerified", !1); const t = e.worker; this.configuredUrl = typeof t == "string" && t !== "inline" ? N0(t) : null, this.configuredUrl !== null && qx(this.configuredUrl); } @@ -10603,11 +10603,11 @@ var y$ = class { c(), a(new J(q.Aborted, "image encoding aborted")); }; if (this.pending.set(s, { - resolve: (d) => { - this.poolVerified = !0, c(), i(d); + resolve: (f) => { + this.poolVerified = !0, c(), i(f); }, - reject: (d) => { - c(), a(d); + reject: (f) => { + c(), a(f); } }), r.aborted) { l(); @@ -10644,9 +10644,9 @@ var y$ = class { createWorker() { const e = this.options.worker; if (typeof e == "function") return e(); - if (this.configuredUrl !== null) return ug(this.configuredUrl, zE); + if (this.configuredUrl !== null) return dg(this.configuredUrl, zE); const t = e === void 0 ? mne() : null; - return t !== null ? ug(t, zE) : (this.blob ?? (this.blob = u$(kne)), ug(this.blob.url, zE)); + return t !== null ? dg(t, zE) : (this.blob ?? (this.blob = u$(kne)), dg(this.blob.url, zE)); } }; let EM = !1; @@ -10722,12 +10722,12 @@ async function xne(e, t, n, r = t * 4) { 10, 26, 10 - ]), d = new Uint8Array(u.length + l.reduce((h, g) => h + g.length, 0)); - d.set(u, 0); - let f = u.length; + ]), f = new Uint8Array(u.length + l.reduce((h, g) => h + g.length, 0)); + f.set(u, 0); + let d = u.length; for (const h of l) - d.set(h, f), f += h.length; - return d; + f.set(h, d), d += h.length; + return f; } async function Ene(e) { const t = new Blob([e]).stream().pipeThrough(new CompressionStream("deflate")); @@ -10755,7 +10755,7 @@ function Cne(e) { } var Ine = class { constructor(e) { - this.ctx = e, je(this, "protection", void 0), je(this, "documentProtection", void 0), this.protection = e.signedDocumentPolicy === "protect" ? e.protection : null, this.documentProtection = e.protection; + this.ctx = e, Ve(this, "protection", void 0), Ve(this, "documentProtection", void 0), this.protection = e.signedDocumentPolicy === "protect" ? e.protection : null, this.documentProtection = e.protection; } /** * Replace the file's own permission bits after an unlock loaded it with @@ -10823,7 +10823,7 @@ var Ine = class { */ assertCapability(e) { if (!this.can(e)) - throw di(this.protection).has(e) ? new J(q.ProtectedDocument, hM(e, this.protection)) : new po(e, "engine-local"); + throw di(this.protection).has(e) ? new J(q.ProtectedDocument, hM(e, this.protection)) : new go(e, "engine-local"); } /** * Throws `PermissionDenied` if the scope grants none of `caps`. Used @@ -10832,7 +10832,7 @@ var Ine = class { * like `/text` which the cloud gates on `doc.text.copy OR doc.text.search`). */ assertAnyCapability(e) { - if (!bee(e, this.ctx.scope, this.ctx.permissionFlags, this.protection)) throw new po(e[0] ?? "doc.open", "engine-local", e); + if (!bee(e, this.ctx.scope, this.ctx.permissionFlags, this.protection)) throw new go(e[0] ?? "doc.open", "engine-local", e); } /** * Throws `PermissionDenied` if the scope doesn't grant the collab @@ -10873,7 +10873,7 @@ var Ine = class { _ee(this.changeAuthority(), e) || this.assertCapability(e === "fill" ? "doc.forms.fill" : "doc.sign"); } assertCollab(e, t) { - if (this.assertAnnotationsUnprotected(), !this.canCollab(e, t)) throw new po(`annotations:${e}`, "engine-local"); + if (this.assertAnnotationsUnprotected(), !this.canCollab(e, t)) throw new go(`annotations:${e}`, "engine-local"); } /** * What an annotation write carries for the worker to check against the @@ -10912,7 +10912,7 @@ var Ine = class { */ assertSetGroup(e) { if (e !== void 0 && !this.canSetGroup(e)) - throw new po(`annotations:set-group:group=${e}`, "engine-local"); + throw new go(`annotations:set-group:group=${e}`, "engine-local"); } /** * Build the actor that the worker stamps onto a newly created @@ -11040,7 +11040,7 @@ function IM(e, t) { } var Lne = class { constructor(e, t = {}) { - this.transport = e, je(this, "jobs", []), je(this, "byId", /* @__PURE__ */ new Map()), je(this, "workingSets", /* @__PURE__ */ new Map()), je(this, "unsubscribe", void 0), je(this, "maxConcurrency", void 0), je(this, "inFlight", 0), je(this, "destroyed", !1), this.maxConcurrency = Math.max(1, t.concurrency ?? 1), this.unsubscribe = e.onMessage((n) => this.handleResponse(n)); + this.transport = e, Ve(this, "jobs", []), Ve(this, "byId", /* @__PURE__ */ new Map()), Ve(this, "workingSets", /* @__PURE__ */ new Map()), Ve(this, "unsubscribe", void 0), Ve(this, "maxConcurrency", void 0), Ve(this, "inFlight", 0), Ve(this, "destroyed", !1), this.maxConcurrency = Math.max(1, t.concurrency ?? 1), this.unsubscribe = e.onMessage((n) => this.handleResponse(n)); } /** The same queue, every job queued through it carrying `facts` (see `DocumentHandle.with`). */ withFacts(e) { @@ -11061,7 +11061,7 @@ var Lne = class { } const s = o instanceof Promise ? null : o, i = s ? NM(s.payload) : t.line; return i ? new se((a, c, l, u) => { - const d = { + const f = { jobId: r, pack: s, built: s !== null, @@ -11081,20 +11081,20 @@ var Lne = class { aborted: !1, abortReason: void 0 }; - this.jobs.splice(e, 0, d), this.byId.set(r, d); - const f = () => { + this.jobs.splice(e, 0, f), this.byId.set(r, f); + const d = () => { if (this.byId.has(r)) { - if (!d.sent) { - this.remove(d), d.reject(new Kw(u.reason)), this.tick(); + if (!f.sent) { + this.remove(f), f.reject(new Kw(u.reason)), this.tick(); return; } - d.aborted = !0, d.abortReason = u.reason, this.transport.send(Pe({ + f.aborted = !0, f.abortReason = u.reason, this.transport.send(Pe({ kind: "abort", jobId: r })); } }; - u.aborted ? f() : u.addEventListener("abort", f, { once: !0 }), o instanceof Promise && o.then((h) => this.built(d, h, i), (h) => this.failedToBuild(d, h)), this.tick(); + u.aborted ? d() : u.addEventListener("abort", d, { once: !0 }), o instanceof Promise && o.then((h) => this.built(f, h, i), (h) => this.failedToBuild(f, h)), this.tick(); }) : se.rejectReason(new J(q.Unknown, "a job built later must state its line")); } /** An async request is ready: the job may be sent when its turn comes. */ @@ -11270,7 +11270,7 @@ var Fne = class k$ { return new k$(t.transport, t.concurrency ?? 1, t.imageEncoder, t.renderPolicy, t.signedDocumentPolicy ?? "protect"); } constructor(t, n, r, o, s) { - this.transport = t, this.signedDocumentPolicy = s, je(this, zx, !0), je(this, "canOpenFiles", !0), je(this, "queue", void 0), je(this, "imageEncoder", void 0), je(this, "renderPolicy", void 0), je(this, "destroyed", !1), je(this, "fonts", void 0), je(this, "engineFontListeners", /* @__PURE__ */ new Set()), this.queue = new Lne(t, { concurrency: n }), this.imageEncoder = r ?? (typeof document > "u" && typeof OffscreenCanvas > "u" ? new Sne() : new y$()), this.renderPolicy = o ?? za, this.fonts = new ine(this.queue, () => { + this.transport = t, this.signedDocumentPolicy = s, Ve(this, zx, !0), Ve(this, "canOpenFiles", !0), Ve(this, "queue", void 0), Ve(this, "imageEncoder", void 0), Ve(this, "renderPolicy", void 0), Ve(this, "destroyed", !1), Ve(this, "fonts", void 0), Ve(this, "engineFontListeners", /* @__PURE__ */ new Set()), this.queue = new Lne(t, { concurrency: n }), this.imageEncoder = r ?? (typeof document > "u" && typeof OffscreenCanvas > "u" ? new Sne() : new y$()), this.renderPolicy = o ?? za, this.fonts = new ine(this.queue, () => { for (const i of this.engineFontListeners) i(); }); } @@ -11286,7 +11286,7 @@ var Fne = class k$ { open(t, n) { if (this.destroyed) return se.rejectReason(new J(q.RuntimeUnavailable, "engine destroyed")); try { - if (n?.scope && !v6("doc.open", n.scope, Hx(null))) return se.rejectReason(new po("doc.open", "engine-local")); + if (n?.scope && !v6("doc.open", n.scope, Hx(null))) return se.rejectReason(new go("doc.open", "engine-local")); } catch (r) { return se.rejectReason(r); } @@ -11300,7 +11300,7 @@ var Fne = class k$ { } : a === void 0 ? { kind: "fresh" } : { kind: "artifact", bytes: a - }, l = a ? [a] : [], u = this.signedDocumentPolicy, d = t.baseSha256, f = r.enqueue({ buildPack: (h) => Pe({ + }, l = a ? [a] : [], u = this.signedDocumentPolicy, f = t.baseSha256, d = r.enqueue({ buildPack: (h) => Pe({ kind: "open.layerFileBase", effect: "open", jobId: h, @@ -11310,10 +11310,10 @@ var Fne = class k$ { layer: c, password: o, signedDocumentPolicy: u, - ...d ? { baseSha256: d } : {}, + ...f ? { baseSha256: f } : {}, reserveObjectNumbers: 64 }, l) }); - return this.openResult(f, n); + return this.openResult(d, n); } openBytes(t, n) { const r = this.queue, o = n?.password ?? null, s = f1(t.bytes), i = t.id ?? Dy(), a = this.signedDocumentPolicy, c = r.enqueue({ buildPack: (l) => Pe({ @@ -11332,7 +11332,7 @@ var Fne = class k$ { const r = this.queue, o = n?.password ?? null, s = t.id ?? Dy(), i = t.baseKey ?? s, a = f1(t.baseBytes), c = t.layer?.kind === "artifact" ? f1(t.layer.bytes) : void 0, l = c === void 0 ? { kind: "fresh" } : { kind: "artifact", bytes: c - }, u = c ? [a, c] : [a], d = this.signedDocumentPolicy, f = t.baseSha256, h = r.enqueue({ buildPack: (g) => Pe({ + }, u = c ? [a, c] : [a], f = this.signedDocumentPolicy, d = t.baseSha256, h = r.enqueue({ buildPack: (g) => Pe({ kind: "open.layerMemBase", effect: "open", jobId: g, @@ -11341,8 +11341,8 @@ var Fne = class k$ { baseBytes: a, layer: l, password: o, - signedDocumentPolicy: d, - ...f ? { baseSha256: f } : {}, + signedDocumentPolicy: f, + ...d ? { baseSha256: d } : {}, reserveObjectNumbers: 64 }, u) }); return this.openResult(h, n); @@ -11404,7 +11404,7 @@ var qE = class S$ { return await (n ?? sN(t)), r; } constructor(t) { - this.worker = t, je(this, "listeners", /* @__PURE__ */ new Set()), je(this, "onMessageBound", void 0), this.onMessageBound = (n) => this.handleMessage(n), t.addEventListener("message", this.onMessageBound); + this.worker = t, Ve(this, "listeners", /* @__PURE__ */ new Set()), Ve(this, "onMessageBound", void 0), this.onMessageBound = (n) => this.handleMessage(n), t.addEventListener("message", this.onMessageBound); } send(t) { this.worker.postMessage(t.payload, t.transfer); @@ -11427,7 +11427,7 @@ var qE = class S$ { } }, Vne = class { constructor(e, t = {}) { - this.boot = e, this.options = t, je(this, "listeners", /* @__PURE__ */ new Set()), je(this, "pendingPacks", []), je(this, "inner", void 0), je(this, "innerUnsubscribe", void 0), je(this, "bootPromise", void 0), je(this, "bootError", void 0), je(this, "terminated", !1); + this.boot = e, this.options = t, Ve(this, "listeners", /* @__PURE__ */ new Set()), Ve(this, "pendingPacks", []), Ve(this, "inner", void 0), Ve(this, "innerUnsubscribe", void 0), Ve(this, "bootPromise", void 0), Ve(this, "bootError", void 0), Ve(this, "terminated", !1); } /** * Trigger the boot without sending anything — used by `Engine.warmup()` so @@ -11560,7 +11560,7 @@ async function Une(e, t) { file: null }; if (t !== null) return { - worker: ug(t, { type: "module" }), + worker: dg(t, { type: "module" }), destroy: () => { }, file: null @@ -11568,21 +11568,21 @@ async function Une(e, t) { e === void 0 && await h$(); const n = e === void 0 ? gne() : null; if (n !== null) return { - worker: ug(n, { type: "module" }), + worker: dg(n, { type: "module" }), destroy: () => { }, file: n }; let r; try { - r = (await import("./embedpdf-worker.source-CCHXFWYh-CTEHza5m.js")).default; + r = (await import("./embedpdf-worker.source-Z0o39l7i-qFIWKZ_I.js")).default; } catch (s) { throw new Error("[embedpdf] could not load the inline engine worker module (@embedpdf/engine/worker-source). If your bundler cannot resolve it, pass a worker explicitly: `localEngine({ worker: () => new Worker(...) })`.", { cause: s }); } const o = u$(r); try { return { - worker: ug(o.url, { type: "module" }), + worker: dg(o.url, { type: "module" }), destroy: o.revoke, file: null }; @@ -11615,7 +11615,7 @@ function Kne(e = {}) { return r; } async function Hne(e = {}, t = {}) { - const { createInlineTransport: n } = await import("./inline-transport-GZ5fBXix.js"); + const { createInlineTransport: n } = await import("./inline-transport-DLWGAv7G.js"); return n(e, () => g$(t)); } function zne(e) { @@ -11713,7 +11713,7 @@ function Qne(e) { return new Uint8Array(t).set(e), t; } const x$ = "" + new URL("../embedpdf.wasm", import.meta.url).href; -var dv, We, E$, rl, PM, C$, I$, JE, Uk, Jw, N$, N6, iN, aN, O$, pS = {}, gS = [], Xne = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, fv = Array.isArray; +var dv, He, E$, ol, PM, C$, I$, JE, Uk, Jw, N$, N6, iN, aN, O$, pS = {}, gS = [], Xne = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, fv = Array.isArray; function ai(e, t) { for (var n in t) e[n] = t[n]; return e; @@ -11721,7 +11721,7 @@ function ai(e, t) { function O6(e) { e && e.parentNode && e.parentNode.removeChild(e); } -function mo(e, t, n) { +function yo(e, t, n) { var r, o, s, i = {}; for (s in t) s == "key" ? r = t[s] : s == "ref" ? o = t[s] : i[s] = t[s]; if (arguments.length > 2 && (i.children = arguments.length > 3 ? dv.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (s in e.defaultProps) i[s] === void 0 && (i[s] = e.defaultProps[s]); @@ -11729,7 +11729,7 @@ function mo(e, t, n) { } function Yw(e, t, n, r, o) { var s = { type: e, props: t, key: n, ref: r, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: o ?? ++E$, __i: -1, __u: 0 }; - return o == null && We.vnode != null && We.vnode(s), s; + return o == null && He.vnode != null && He.vnode(s), s; } function Zne() { return { current: null }; @@ -11740,15 +11740,15 @@ function nt(e) { function Rr(e, t) { this.props = e, this.context = t; } -function cm(e, t) { - if (t == null) return e.__ ? cm(e.__, e.__i + 1) : null; +function lm(e, t) { + if (t == null) return e.__ ? lm(e.__, e.__i + 1) : null; for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e; - return typeof e.type == "function" ? cm(e) : null; + return typeof e.type == "function" ? lm(e) : null; } function ere(e) { if (e.__P && e.__d) { var t = e.__v, n = t.__e, r = [], o = [], s = ai({}, t); - s.__v = t.__v + 1, We.vnode && We.vnode(s), P6(e.__P, s, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? cm(t), !!(32 & t.__u), o), s.__v = t.__v, s.__.__k[s.__i] = s, B$(r, s, o), t.__e = t.__ = null, s.__e != n && P$(s); + s.__v = t.__v + 1, He.vnode && He.vnode(s), P6(e.__P, s, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? lm(t), !!(32 & t.__u), o), s.__v = t.__v, s.__.__k[s.__i] = s, B$(r, s, o), t.__e = t.__ = null, s.__e != n && P$(s); } } function P$(e) { @@ -11757,24 +11757,24 @@ function P$(e) { }), P$(e); } function cN(e) { - (!e.__d && (e.__d = !0) && rl.push(e) && !mS.__r++ || PM != We.debounceRendering) && ((PM = We.debounceRendering) || C$)(mS); + (!e.__d && (e.__d = !0) && ol.push(e) && !mS.__r++ || PM != He.debounceRendering) && ((PM = He.debounceRendering) || C$)(mS); } function mS() { try { - for (var e, t = 1; rl.length; ) rl.length > t && rl.sort(I$), e = rl.shift(), t = rl.length, ere(e); + for (var e, t = 1; ol.length; ) ol.length > t && ol.sort(I$), e = ol.shift(), t = ol.length, ere(e); } finally { - rl.length = mS.__r = 0; + ol.length = mS.__r = 0; } } function R$(e, t, n, r, o, s, i, a, c, l, u) { - var d, f, h, g, p, m, v, S = r && r.__k || gS, C = t.length; - for (c = tre(n, t, S, c, C), d = 0; d < C; d++) (h = n.__k[d]) != null && (f = h.__i != -1 && S[h.__i] || pS, h.__i = d, m = P6(e, h, f, o, s, i, a, c, l, u), g = h.__e, h.ref && f.ref != h.ref && (f.ref && R6(f.ref, null, h), u.push(h.ref, h.__c || g, h)), p == null && g != null && (p = g), (v = !!(4 & h.__u)) || f.__k === h.__k ? (c = T$(h, c, e, v), v && f.__e && (f.__e = null)) : typeof h.type == "function" && m !== void 0 ? c = m : g && (c = g.nextSibling), h.__u &= -7); + var f, d, h, g, p, m, v, S = r && r.__k || gS, C = t.length; + for (c = tre(n, t, S, c, C), f = 0; f < C; f++) (h = n.__k[f]) != null && (d = h.__i != -1 && S[h.__i] || pS, h.__i = f, m = P6(e, h, d, o, s, i, a, c, l, u), g = h.__e, h.ref && d.ref != h.ref && (d.ref && R6(d.ref, null, h), u.push(h.ref, h.__c || g, h)), p == null && g != null && (p = g), (v = !!(4 & h.__u)) || d.__k === h.__k ? (c = T$(h, c, e, v), v && d.__e && (d.__e = null)) : typeof h.type == "function" && m !== void 0 ? c = m : g && (c = g.nextSibling), h.__u &= -7); return n.__e = p, c; } function tre(e, t, n, r, o) { - var s, i, a, c, l, u = n.length, d = u, f = 0; - for (e.__k = new Array(o), s = 0; s < o; s++) (i = t[s]) != null && typeof i != "boolean" && typeof i != "function" ? (typeof i == "string" || typeof i == "number" || typeof i == "bigint" || i.constructor == String ? i = e.__k[s] = Yw(null, i, null, null, null) : fv(i) ? i = e.__k[s] = Yw(nt, { children: i }, null, null, null) : i.constructor === void 0 && i.__b > 0 ? i = e.__k[s] = Yw(i.type, i.props, i.key, i.ref ? i.ref : null, i.__v) : e.__k[s] = i, c = s + f, i.__ = e, i.__b = e.__b + 1, a = null, (l = i.__i = nre(i, n, c, d)) != -1 && (d--, (a = n[l]) && (a.__u |= 2)), a == null || a.__v == null ? (l == -1 && (o > u ? f-- : o < u && f++), typeof i.type != "function" && (i.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, i.__u |= 4))) : e.__k[s] = null; - if (d) for (s = 0; s < u; s++) (a = n[s]) != null && (2 & a.__u) == 0 && (a.__e == r && (r = cm(a)), L$(a, a)); + var s, i, a, c, l, u = n.length, f = u, d = 0; + for (e.__k = new Array(o), s = 0; s < o; s++) (i = t[s]) != null && typeof i != "boolean" && typeof i != "function" ? (typeof i == "string" || typeof i == "number" || typeof i == "bigint" || i.constructor == String ? i = e.__k[s] = Yw(null, i, null, null, null) : fv(i) ? i = e.__k[s] = Yw(nt, { children: i }, null, null, null) : i.constructor === void 0 && i.__b > 0 ? i = e.__k[s] = Yw(i.type, i.props, i.key, i.ref ? i.ref : null, i.__v) : e.__k[s] = i, c = s + d, i.__ = e, i.__b = e.__b + 1, a = null, (l = i.__i = nre(i, n, c, f)) != -1 && (f--, (a = n[l]) && (a.__u |= 2)), a == null || a.__v == null ? (l == -1 && (o > u ? d-- : o < u && d++), typeof i.type != "function" && (i.__u |= 4)) : l != c && (l == c - 1 ? d-- : l == c + 1 ? d++ : (l > c ? d-- : d++, i.__u |= 4))) : e.__k[s] = null; + if (f) for (s = 0; s < u; s++) (a = n[s]) != null && (2 & a.__u) == 0 && (a.__e == r && (r = lm(a)), L$(a, a)); return r; } function T$(e, t, n, r) { @@ -11783,15 +11783,15 @@ function T$(e, t, n, r) { for (o = e.__k, s = 0; o && s < o.length; s++) o[s] && (o[s].__ = e, t = T$(o[s], t, n, r)); return t; } - e.__e != t && (r && (t && e.type && !t.parentNode && (t = cm(e)), n.insertBefore(e.__e, t || null)), t = e.__e); + e.__e != t && (r && (t && e.type && !t.parentNode && (t = lm(e)), n.insertBefore(e.__e, t || null)), t = e.__e); do t = t && t.nextSibling; while (t != null && t.nodeType == 8); return t; } -function $o(e, t) { +function Uo(e, t) { return t = t || [], e == null || typeof e == "boolean" || (fv(e) ? e.some(function(n) { - $o(n, t); + Uo(n, t); }) : t.push(e)), t; } function nre(e, t, n, r) { @@ -11829,58 +11829,58 @@ function TM(e) { var n = this.l[t.type + e]; if (t[Uk] == null) t[Uk] = N6++; else if (t[Uk] < n[Jw]) return; - return n(We.event ? We.event(t) : t); + return n(He.event ? He.event(t) : t); } }; } function P6(e, t, n, r, o, s, i, a, c, l) { - var u, d, f, h, g, p, m, v, S, C, k, N, w, y, x, A, b = t.type; + var u, f, d, h, g, p, m, v, S, C, k, N, w, y, x, A, b = t.type; if (t.constructor !== void 0) return null; - 128 & n.__u && (c = !!(32 & n.__u), s = [a = t.__e = n.__e]), (u = We.__b) && u(t); + 128 & n.__u && (c = !!(32 & n.__u), s = [a = t.__e = n.__e]), (u = He.__b) && u(t); e: if (typeof b == "function") { - d = i.length; + f = i.length; try { - if (S = t.props, C = b.prototype && b.prototype.render, k = (u = b.contextType) && r[u.__c], N = u ? k ? k.props.value : u.__ : r, n.__c ? v = (f = t.__c = n.__c).__ = f.__E : (C ? t.__c = f = new b(S, N) : (t.__c = f = new Rr(S, N), f.constructor = b, f.render = ore), k && k.sub(f), f.state || (f.state = {}), f.__n = r, h = f.__d = !0, f.__h = [], f._sb = []), C && f.__s == null && (f.__s = f.state), C && b.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = ai({}, f.__s)), ai(f.__s, b.getDerivedStateFromProps(S, f.__s))), g = f.props, p = f.state, f.__v = t, h) C && b.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), C && f.componentDidMount != null && f.__h.push(f.componentDidMount); + if (S = t.props, C = b.prototype && b.prototype.render, k = (u = b.contextType) && r[u.__c], N = u ? k ? k.props.value : u.__ : r, n.__c ? v = (d = t.__c = n.__c).__ = d.__E : (C ? t.__c = d = new b(S, N) : (t.__c = d = new Rr(S, N), d.constructor = b, d.render = ore), k && k.sub(d), d.state || (d.state = {}), d.__n = r, h = d.__d = !0, d.__h = [], d._sb = []), C && d.__s == null && (d.__s = d.state), C && b.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = ai({}, d.__s)), ai(d.__s, b.getDerivedStateFromProps(S, d.__s))), g = d.props, p = d.state, d.__v = t, h) C && b.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), C && d.componentDidMount != null && d.__h.push(d.componentDidMount); else { - if (C && b.getDerivedStateFromProps == null && S !== g && f.componentWillReceiveProps != null && f.componentWillReceiveProps(S, N), t.__v == n.__v || !f.__e && f.shouldComponentUpdate != null && f.shouldComponentUpdate(S, f.__s, N) === !1) { - t.__v != n.__v && (f.props = S, f.state = f.__s, f.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(E) { + if (C && b.getDerivedStateFromProps == null && S !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(S, N), t.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(S, d.__s, N) === !1) { + t.__v != n.__v && (d.props = S, d.state = d.__s, d.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(E) { E && (E.__ = t); - }), gS.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && i.push(f); + }), gS.push.apply(d.__h, d._sb), d._sb = [], d.__h.length && i.push(d); break e; } - f.componentWillUpdate != null && f.componentWillUpdate(S, f.__s, N), C && f.componentDidUpdate != null && f.__h.push(function() { - f.componentDidUpdate(g, p, m); + d.componentWillUpdate != null && d.componentWillUpdate(S, d.__s, N), C && d.componentDidUpdate != null && d.__h.push(function() { + d.componentDidUpdate(g, p, m); }); } - if (f.context = N, f.props = S, f.__P = e, f.__e = !1, w = We.__r, y = 0, C) f.state = f.__s, f.__d = !1, w && w(t), u = f.render(f.props, f.state, f.context), gS.push.apply(f.__h, f._sb), f._sb = []; + if (d.context = N, d.props = S, d.__P = e, d.__e = !1, w = He.__r, y = 0, C) d.state = d.__s, d.__d = !1, w && w(t), u = d.render(d.props, d.state, d.context), gS.push.apply(d.__h, d._sb), d._sb = []; else do - f.__d = !1, w && w(t), u = f.render(f.props, f.state, f.context), f.state = f.__s; - while (f.__d && ++y < 25); - f.state = f.__s, f.getChildContext != null && (r = ai(ai({}, r), f.getChildContext())), C && !h && f.getSnapshotBeforeUpdate != null && (m = f.getSnapshotBeforeUpdate(g, p)), x = u != null && u.type === nt && u.key == null ? _$(u.props.children) : u, a = R$(e, fv(x) ? x : [x], t, n, r, o, s, i, a, c, l), f.base = t.__e, t.__u &= -161, f.__h.length && i.push(f), v && (f.__E = f.__ = null); + d.__d = !1, w && w(t), u = d.render(d.props, d.state, d.context), d.state = d.__s; + while (d.__d && ++y < 25); + d.state = d.__s, d.getChildContext != null && (r = ai(ai({}, r), d.getChildContext())), C && !h && d.getSnapshotBeforeUpdate != null && (m = d.getSnapshotBeforeUpdate(g, p)), x = u != null && u.type === nt && u.key == null ? _$(u.props.children) : u, a = R$(e, fv(x) ? x : [x], t, n, r, o, s, i, a, c, l), d.base = t.__e, t.__u &= -161, d.__h.length && i.push(d), v && (d.__E = d.__ = null); } catch (E) { - if (i.length = d, t.__v = null, c || s != null) { + if (i.length = f, t.__v = null, c || s != null) { if (E.then) { for (t.__u |= c ? 160 : 128; a && a.nodeType == 8 && a.nextSibling; ) a = a.nextSibling; s != null && (s[s.indexOf(a)] = null), t.__e = a; } else if (s != null) for (A = s.length; A--; ) O6(s[A]); } else t.__e = n.__e; - t.__k == null && (t.__k = n.__k || []), E.then || M$(t), We.__e(E, t, n); + t.__k == null && (t.__k = n.__k || []), E.then || M$(t), He.__e(E, t, n); } } else s == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : a = t.__e = rre(n.__e, t, n, r, o, s, i, c, l); - return (u = We.diffed) && u(t), 128 & t.__u ? void 0 : a; + return (u = He.diffed) && u(t), 128 & t.__u ? void 0 : a; } function M$(e) { e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(M$)); } function B$(e, t, n) { for (var r = 0; r < n.length; r++) R6(n[r], n[++r], n[++r]); - We.__c && We.__c(t, e), e.some(function(o) { + He.__c && He.__c(t, e), e.some(function(o) { try { e = o.__h, o.__h = [], e.some(function(s) { s.call(o); }); } catch (s) { - We.__e(s, o.__v); + He.__e(s, o.__v); } }); } @@ -11888,7 +11888,7 @@ function _$(e) { return typeof e != "object" || e == null || e.__b > 0 ? e : fv(e) ? e.map(_$) : e.constructor !== void 0 ? null : ai({}, e); } function rre(e, t, n, r, o, s, i, a, c) { - var l, u, d, f, h, g, p, m = n.props || pS, v = t.props, S = t.type; + var l, u, f, d, h, g, p, m = n.props || pS, v = t.props, S = t.type; if (S == "svg" ? o = "http://www.w3.org/2000/svg" : S == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), s != null) { for (l = 0; l < s.length; l++) if ((h = s[l]) && "setAttribute" in h == !!S && (S ? h.localName == S : h.nodeType == 3)) { e = h, s[l] = null; @@ -11897,15 +11897,15 @@ function rre(e, t, n, r, o, s, i, a, c) { } if (e == null) { if (S == null) return document.createTextNode(v); - e = document.createElementNS(o, S, v.is && v), a && (We.__m && We.__m(t, s), a = !1), s = null; + e = document.createElementNS(o, S, v.is && v), a && (He.__m && He.__m(t, s), a = !1), s = null; } if (S == null) m === v || a && e.data == v || (e.data = v); else { if (s = S == "textarea" && v.defaultValue != null ? null : s && dv.call(e.childNodes), !a && s != null) for (m = {}, l = 0; l < e.attributes.length; l++) m[(h = e.attributes[l]).name] = h.value; - for (l in m) h = m[l], l == "dangerouslySetInnerHTML" ? d = h : l == "children" || l in v || l == "value" && "defaultValue" in v || l == "checked" && "defaultChecked" in v || h1(e, l, null, h, o); - for (l in v) h = v[l], l == "children" ? f = h : l == "dangerouslySetInnerHTML" ? u = h : l == "value" ? g = h : l == "checked" ? p = h : a && typeof h != "function" || m[l] === h || h1(e, l, h, m[l], o); - if (u) a || d && (u.__html == d.__html || u.__html == e.innerHTML) || (e.innerHTML = u.__html), t.__k = []; - else if (d && (e.innerHTML = ""), R$(t.type == "template" ? e.content : e, fv(f) ? f : [f], t, n, r, S == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, s, i, s ? s[0] : n.__k && cm(n, 0), a, c), s != null) for (l = s.length; l--; ) O6(s[l]); + for (l in m) h = m[l], l == "dangerouslySetInnerHTML" ? f = h : l == "children" || l in v || l == "value" && "defaultValue" in v || l == "checked" && "defaultChecked" in v || h1(e, l, null, h, o); + for (l in v) h = v[l], l == "children" ? d = h : l == "dangerouslySetInnerHTML" ? u = h : l == "value" ? g = h : l == "checked" ? p = h : a && typeof h != "function" || m[l] === h || h1(e, l, h, m[l], o); + if (u) a || f && (u.__html == f.__html || u.__html == e.innerHTML) || (e.innerHTML = u.__html), t.__k = []; + else if (f && (e.innerHTML = ""), R$(t.type == "template" ? e.content : e, fv(d) ? d : [d], t, n, r, S == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, s, i, s ? s[0] : n.__k && lm(n, 0), a, c), s != null) for (l = s.length; l--; ) O6(s[l]); a && S != "textarea" || (l = "value", S == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[l] || S == "progress" && !g || S == "option" && g != m[l]) && h1(e, l, g, m[l], o), l = "checked", p != null && p != e[l] && h1(e, l, p, m[l], o)); } return e; @@ -11917,16 +11917,16 @@ function R6(e, t, n) { r && e.__u(), r && t == null || (e.__u = e(t)); } else e.current = t; } catch (o) { - We.__e(o, n); + He.__e(o, n); } } function L$(e, t, n) { var r, o; - if (We.unmount && We.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || R6(r, null, t)), (r = e.__c) != null) { + if (He.unmount && He.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || R6(r, null, t)), (r = e.__c) != null) { if (r.componentWillUnmount) try { r.componentWillUnmount(); } catch (s) { - We.__e(s, t); + He.__e(s, t); } r.base = r.__P = r.__n = null; } @@ -11936,12 +11936,12 @@ function L$(e, t, n) { function ore(e, t, n) { return this.constructor(e, n); } -function Nf(e, t, n) { +function Pf(e, t, n) { var r, o, s, i; - t == document && (t = document.documentElement), We.__ && We.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, s = [], i = [], P6(t, e = (!r && n || t).__k = mo(nt, null, [e]), o || pS, pS, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? dv.call(t.childNodes) : null, s, !r && n ? n : o ? o.__e : t.firstChild, r, i), B$(s, e, i), e.props.children = null; + t == document && (t = document.documentElement), He.__ && He.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, s = [], i = [], P6(t, e = (!r && n || t).__k = yo(nt, null, [e]), o || pS, pS, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? dv.call(t.childNodes) : null, s, !r && n ? n : o ? o.__e : t.firstChild, r, i), B$(s, e, i), e.props.children = null; } function D$(e, t) { - Nf(e, t, D$); + Pf(e, t, D$); } function sre(e, t, n) { var r, o, s, i, a = ai({}, e.props); @@ -11971,7 +11971,7 @@ function Fn(e) { return n.children(r); }).contextType = t, t; } -dv = gS.slice, We = { __e: function(e, t, n, r) { +dv = gS.slice, He = { __e: function(e, t, n, r) { for (var o, s, i; t = t.__; ) if ((o = t.__c) && !o.__) try { if ((s = o.constructor) && s.getDerivedStateFromError != null && (o.setState(s.getDerivedStateFromError(e)), i = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, r || {}), i = o.__d), i) return o.__E = o; } catch (a) { @@ -11983,66 +11983,66 @@ dv = gS.slice, We = { __e: function(e, t, n, r) { n = this.__s != null && this.__s != this.state ? this.__s : this.__s = ai({}, this.state), typeof e == "function" && (e = e(ai({}, n), this.props)), e && ai(n, e), e != null && this.__v && (t && this._sb.push(t), cN(this)); }, Rr.prototype.forceUpdate = function(e) { this.__v && (this.__e = !0, e && this.__h.push(e), cN(this)); -}, Rr.prototype.render = nt, rl = [], C$ = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, I$ = function(e, t) { +}, Rr.prototype.render = nt, ol = [], C$ = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, I$ = function(e, t) { return e.__v.__b - t.__v.__b; }, mS.__r = 0, JE = Math.random().toString(8), Uk = "__d" + JE, Jw = "__a" + JE, N$ = /(PointerCapture)$|Capture$/i, N6 = 0, iN = TM(!1), aN = TM(!0), O$ = 0; -var zl, Jt, YE, MM, lm = 0, j$ = [], un = We, BM = un.__b, _M = un.__r, LM = un.diffed, DM = un.__c, jM = un.unmount, FM = un.__; -function _m(e, t) { - un.__h && un.__h(Jt, e, lm || t), lm = 0; - var n = Jt.__H || (Jt.__H = { __: [], __h: [] }); +var Wl, Qt, YE, MM, um = 0, j$ = [], dn = He, BM = dn.__b, _M = dn.__r, LM = dn.diffed, DM = dn.__c, jM = dn.unmount, FM = dn.__; +function Lm(e, t) { + dn.__h && dn.__h(Qt, e, um || t), um = 0; + var n = Qt.__H || (Qt.__H = { __: [], __h: [] }); return e >= n.__.length && n.__.push({}), n.__[e]; } -function De(e) { - return lm = 1, Wl(V$, e); +function je(e) { + return um = 1, ql(V$, e); } -function Wl(e, t, n) { - var r = _m(zl++, 2); +function ql(e, t, n) { + var r = Lm(Wl++, 2); if (r.t = e, !r.__c && (r.__ = [n ? n(t) : V$(void 0, t), function(a) { var c = r.__N ? r.__N[0] : r.__[0], l = r.t(c, a); c !== l && (r.__N = [l, r.__[1]], r.__c.setState({})); - }], r.__c = Jt, !Jt.__f)) { + }], r.__c = Qt, !Qt.__f)) { var o = function(a, c, l) { if (!r.__c.__H) return !0; - var u = !1, d = r.__c.props !== a; + var u = !1, f = r.__c.props !== a; if (r.__c.__H.__.some(function(h) { if (h.__N) { u = !0; var g = h.__[0]; - h.__ = h.__N, h.__N = void 0, g !== h.__[0] && (d = !0); + h.__ = h.__N, h.__N = void 0, g !== h.__[0] && (f = !0); } }), s) { - var f = s.call(this, a, c, l); - return u ? f || d : f; + var d = s.call(this, a, c, l); + return u ? d || f : d; } - return !u || d; + return !u || f; }; - Jt.__f = !0; - var s = Jt.shouldComponentUpdate, i = Jt.componentWillUpdate; - Jt.componentWillUpdate = function(a, c, l) { + Qt.__f = !0; + var s = Qt.shouldComponentUpdate, i = Qt.componentWillUpdate; + Qt.componentWillUpdate = function(a, c, l) { if (this.__e) { var u = s; s = void 0, o(a, c, l), s = u; } i && i.call(this, a, c, l); - }, Jt.shouldComponentUpdate = o; + }, Qt.shouldComponentUpdate = o; } return r.__N || r.__; } function Ke(e, t) { - var n = _m(zl++, 3); - !un.__s && M6(n.__H, t) && (n.__ = e, n.u = t, Jt.__H.__h.push(n)); + var n = Lm(Wl++, 3); + !dn.__s && M6(n.__H, t) && (n.__ = e, n.u = t, Qt.__H.__h.push(n)); } function Ze(e, t) { - var n = _m(zl++, 4); - !un.__s && M6(n.__H, t) && (n.__ = e, n.u = t, Jt.__h.push(n)); + var n = Lm(Wl++, 4); + !dn.__s && M6(n.__H, t) && (n.__ = e, n.u = t, Qt.__h.push(n)); } function Re(e) { - return lm = 5, ft(function() { + return um = 5, ft(function() { return { current: e }; }, []); } function T6(e, t, n) { - lm = 6, Ze(function() { + um = 6, Ze(function() { if (typeof e == "function") { var r = e(t()); return function() { @@ -12055,25 +12055,25 @@ function T6(e, t, n) { }, n == null ? n : n.concat(e)); } function ft(e, t) { - var n = _m(zl++, 7); + var n = Lm(Wl++, 7); return M6(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__; } function fi(e, t) { - return lm = 8, ft(function() { + return um = 8, ft(function() { return e; }, t); } -function Et(e) { - var t = Jt.context[e.__c], n = _m(zl++, 9); - return n.c = e, t ? (n.__ == null && (n.__ = !0, t.sub(Jt)), t.props.value) : e.__; +function Ct(e) { + var t = Qt.context[e.__c], n = Lm(Wl++, 9); + return n.c = e, t ? (n.__ == null && (n.__ = !0, t.sub(Qt)), t.props.value) : e.__; } function F$(e, t) { - un.useDebugValue && un.useDebugValue(t ? t(e) : e); + dn.useDebugValue && dn.useDebugValue(t ? t(e) : e); } function xi() { - var e = _m(zl++, 11); + var e = Lm(Wl++, 11); if (!e.__) { - for (var t = Jt.__v; t !== null && !t.__m && t.__ !== null; ) t = t.__; + for (var t = Qt.__v; t !== null && !t.__m && t.__ !== null; ) t = t.__; var n = t.__m || (t.__m = [0, 0]); e.__ = "P" + n[0] + "-" + n[1]++; } @@ -12085,27 +12085,27 @@ function ire() { if (e.__P && t) try { t.__h.some(Kk), t.__h.some(lN), t.__h = []; } catch (n) { - t.__h = [], un.__e(n, e.__v); + t.__h = [], dn.__e(n, e.__v); } } } -un.__b = function(e) { - Jt = null, BM && BM(e); -}, un.__ = function(e, t) { +dn.__b = function(e) { + Qt = null, BM && BM(e); +}, dn.__ = function(e, t) { e && t.__k && t.__k.__m && (e.__m = t.__k.__m), FM && FM(e, t); -}, un.__r = function(e) { - _M && _M(e), zl = 0; - var t = (Jt = e.__c).__H; - t && (YE === Jt ? (t.__h = [], Jt.__h = [], t.__.some(function(n) { +}, dn.__r = function(e) { + _M && _M(e), Wl = 0; + var t = (Qt = e.__c).__H; + t && (YE === Qt ? (t.__h = [], Qt.__h = [], t.__.some(function(n) { n.__N && (n.__ = n.__N), n.u = n.__N = void 0; - })) : (t.__h.some(Kk), t.__h.some(lN), t.__h = [], zl = 0)), YE = Jt; -}, un.diffed = function(e) { + })) : (t.__h.some(Kk), t.__h.some(lN), t.__h = [], Wl = 0)), YE = Qt; +}, dn.diffed = function(e) { LM && LM(e); var t = e.__c; - t && t.__H && (t.__H.__h.length && (j$.push(t) !== 1 && MM === un.requestAnimationFrame || ((MM = un.requestAnimationFrame) || are)(ire)), t.__H.__.some(function(n) { + t && t.__H && (t.__H.__h.length && (j$.push(t) !== 1 && MM === dn.requestAnimationFrame || ((MM = dn.requestAnimationFrame) || are)(ire)), t.__H.__.some(function(n) { n.u && (n.__H = n.u, n.u = void 0); - })), YE = Jt = null; -}, un.__c = function(e, t) { + })), YE = Qt = null; +}, dn.__c = function(e, t) { t.some(function(n) { try { n.__h.some(Kk), n.__h = n.__h.filter(function(r) { @@ -12114,10 +12114,10 @@ un.__b = function(e) { } catch (r) { t.some(function(o) { o.__h && (o.__h = []); - }), t = [], un.__e(r, n.__v); + }), t = [], dn.__e(r, n.__v); } }), DM && DM(e, t); -}, un.unmount = function(e) { +}, dn.unmount = function(e) { jM && jM(e); var t, n = e.__c; n && n.__H && (n.__H.__.some(function(r) { @@ -12126,7 +12126,7 @@ un.__b = function(e) { } catch (o) { t = o; } - }), n.__H = void 0, t && un.__e(t, n.__v)); + }), n.__H = void 0, t && dn.__e(t, n.__v)); }; var VM = typeof requestAnimationFrame == "function"; function are(e) { @@ -12136,12 +12136,12 @@ function are(e) { VM && (t = requestAnimationFrame(n)); } function Kk(e) { - var t = Jt, n = e.__c; - typeof n == "function" && (e.__c = void 0, n()), Jt = t; + var t = Qt, n = e.__c; + typeof n == "function" && (e.__c = void 0, n()), Qt = t; } function lN(e) { - var t = Jt; - e.__c = e.__(), Jt = t; + var t = Qt; + e.__c = e.__(), Qt = t; } function M6(e, t) { return !e || e.length !== t.length || t.some(function(n, r) { @@ -12161,7 +12161,7 @@ function uN(e, t) { return !1; } function wi(e, t) { - var n = t(), r = De({ t: { __: n, u: t } }), o = r[0].t, s = r[1]; + var n = t(), r = je({ t: { __: n, u: t } }), o = r[0].t, s = r[1]; return Ze(function() { o.__ = n, o.u = t, QE(o) && s({ t: o }); }, [e, n, t]), Ke(function() { @@ -12197,15 +12197,15 @@ function Ei(e, t) { return s != o.ref && s && (typeof s == "function" ? s(null) : s.current = null), t ? !t(this.props, o) || s != o.ref : uN(this.props, o); } function r(o) { - return this.shouldComponentUpdate = n, mo(e, o); + return this.shouldComponentUpdate = n, yo(e, o); } return r.displayName = "Memo(" + (e.displayName || e.name) + ")", r.__f = r.prototype.isReactComponent = !0, r.type = e, r; } (dN.prototype = new Rr()).isPureReactComponent = !0, dN.prototype.shouldComponentUpdate = function(e, t) { return uN(this.props, e) || uN(this.state, t); }; -var $M = We.__b; -We.__b = function(e) { +var $M = He.__b; +He.__b = function(e) { e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), $M && $M(e); }; var cre = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911; @@ -12217,21 +12217,21 @@ function z$(e) { return t.$$typeof = cre, t.render = e, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t; } var UM = function(e, t) { - return e == null ? null : $o($o(e).map(t)); + return e == null ? null : Uo(Uo(e).map(t)); }, lre = { map: UM, forEach: UM, count: function(e) { - return e ? $o(e).length : 0; + return e ? Uo(e).length : 0; }, only: function(e) { - var t = $o(e); + var t = Uo(e); if (t.length !== 1) throw "Children.only"; return t[0]; -}, toArray: $o }, ure = We.__e; -We.__e = function(e, t, n, r) { +}, toArray: Uo }, ure = He.__e; +He.__e = function(e, t, n, r) { if (e.then) { for (var o, s = t; s = s.__; ) if ((o = s.__c) && o.__c) return t.__e == null && (t.__e = n.__e, t.__k = n.__k || []), o.__c(e, t); } ure(e, t, n, r); }; -var KM = We.unmount; +var KM = He.unmount; function W$(e, t, n) { return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(r) { typeof r.__c == "function" && r.__c(); @@ -12260,14 +12260,14 @@ function J$(e) { n = a, r = !0; }), n) throw n; if (!r) throw t; - return o ? mo(o, i) : null; + return o ? yo(o, i) : null; } return s.displayName = "Lazy", s.__f = !0, s; } function jy() { this.i = null, this.l = null; } -We.unmount = function(e) { +He.unmount = function(e) { var t = e.__c; t && (t.__z = !0), t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), KM && KM(e); }, (Qw.prototype = new Rr()).__c = function(e, t) { @@ -12300,8 +12300,8 @@ We.unmount = function(e) { } this.__b = null; } - var o = t.__a && mo(nt, null, e.fallback); - return o && (o.__u &= -33), [mo(nt, null, t.__a ? null : e.children), o]; + var o = t.__a && yo(nt, null, e.fallback); + return o && (o.__u &= -33), [yo(nt, null, t.__a ? null : e.children), o]; }; var HM = function(e, t, n) { if (++n[1] === n[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (n = e.i; n; ) { @@ -12318,7 +12318,7 @@ function dre(e) { function fre(e) { var t = this, n = e.h; if (t.componentWillUnmount = function() { - Nf(null, t.v), t.v = null, t.h = null; + Pf(null, t.v), t.v = null, t.h = null; }, t.h && t.h !== n && t.componentWillUnmount(), !t.v) { for (var r = t.__v; r !== null && !r.__m && r.__ !== null; ) r = r.__; t.h = n, t.v = { nodeType: 1, parentNode: n, childNodes: [], __k: { __m: r.__m }, contains: function() { @@ -12329,10 +12329,10 @@ function fre(e) { this.childNodes.splice(this.childNodes.indexOf(o) >>> 1, 1), t.h.removeChild(o); } }; } - Nf(mo(dre, { context: t.context }, e.__v), t.v); + Pf(yo(dre, { context: t.context }, e.__v), t.v); } function _6(e, t) { - var n = mo(fre, { __v: e, h: t }); + var n = yo(fre, { __v: e, h: t }); return n.containerInfo = t, n; } (jy.prototype = new Rr()).__a = function(e) { @@ -12345,7 +12345,7 @@ function _6(e, t) { }; }, jy.prototype.render = function(e) { this.i = null, this.l = /* @__PURE__ */ new Map(); - var t = $o(e.children); + var t = Uo(e.children); e.revealOrder && e.revealOrder[0] === "b" && t.reverse(); for (var n = t.length; n--; ) this.l.set(t[n], this.i = [1, 0, this.i]); return e.children; @@ -12359,7 +12359,7 @@ var Y$ = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 601 return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e); }; function bre(e, t, n) { - return t.__k == null && (t.textContent = ""), Nf(e, t), typeof n == "function" && n(), e ? e.__c : null; + return t.__k == null && (t.textContent = ""), Pf(e, t), typeof n == "function" && n(), e ? e.__c : null; } function wre(e, t, n) { return D$(e, t), typeof n == "function" && n(), e ? e.__c : null; @@ -12371,8 +12371,8 @@ Rr.prototype.isReactComponent = !0, ["componentWillMount", "componentWillReceive Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t }); } }); }); -var zM = We.event; -We.event = function(e) { +var zM = He.event; +He.event = function(e) { return zM && (e = zM(e)), e.persist = function() { }, e.isPropagationStopped = function() { return this.cancelBubble; @@ -12382,8 +12382,8 @@ We.event = function(e) { }; var L6, vre = { configurable: !0, get: function() { return this.class; -} }, WM = We.vnode; -We.vnode = function(e) { +} }, WM = He.vnode; +He.vnode = function(e) { typeof e.type == "string" && (function(t) { var n = t.props, r = t.type, o = {}, s = r.indexOf("-") == -1; for (var i in n) { @@ -12393,28 +12393,28 @@ We.vnode = function(e) { i === "defaultValue" && "value" in n && n.value == null ? i = "value" : i === "download" && a === !0 ? a = "" : c === "translate" && a === "no" ? a = !1 : c[0] === "o" && c[1] === "n" ? c === "ondoubleclick" ? i = "ondblclick" : c !== "onchange" || r !== "input" && r !== "textarea" || yre(n.type) ? c === "onfocus" ? i = "onfocusin" : c === "onblur" ? i = "onfocusout" : pre.test(i) && (i = c) : c = i = "oninput" : s && hre.test(i) ? i = i.replace(gre, "-$&").toLowerCase() : a === null && (a = void 0), c === "oninput" && o[i = c] && (i = "oninputCapture"), o[i] = a; } } - r == "select" && (o.multiple && Array.isArray(o.value) && (o.value = $o(n.children).forEach(function(l) { + r == "select" && (o.multiple && Array.isArray(o.value) && (o.value = Uo(n.children).forEach(function(l) { l.props.selected = o.value.indexOf(l.props.value) != -1; - })), o.defaultValue != null && (o.value = $o(n.children).forEach(function(l) { + })), o.defaultValue != null && (o.value = Uo(n.children).forEach(function(l) { l.props.selected = o.multiple ? o.defaultValue.indexOf(l.props.value) != -1 : o.defaultValue == l.props.value; }))), n.class && !n.className ? (o.class = n.class, Object.defineProperty(o, "className", vre)) : n.className && (o.class = o.className = n.className), t.props = o; })(e), e.$$typeof = Y$, WM && WM(e); }; -var qM = We.__r; -We.__r = function(e) { +var qM = He.__r; +He.__r = function(e) { qM && qM(e), L6 = e.__c; }; -var GM = We.diffed; -We.diffed = function(e) { +var GM = He.diffed; +He.diffed = function(e) { GM && GM(e); var t = e.props, n = e.__e; n != null && e.type === "textarea" && "value" in t && t.value !== n.value && (n.value = t.value == null ? "" : t.value), L6 = null; }; var kre = { ReactCurrentDispatcher: { current: { readContext: function(e) { return L6.__n[e.__c].props.value; -}, useCallback: fi, useContext: Et, useDebugValue: F$, useDeferredValue: K$, useEffect: Ke, useId: xi, useImperativeHandle: T6, useInsertionEffect: B6, useLayoutEffect: Ze, useMemo: ft, useReducer: Wl, useRef: Re, useState: De, useSyncExternalStore: wi, useTransition: H$ } } }, Are = "18.3.1"; +}, useCallback: fi, useContext: Ct, useDebugValue: F$, useDeferredValue: K$, useEffect: Ke, useId: xi, useImperativeHandle: T6, useInsertionEffect: B6, useLayoutEffect: Ze, useMemo: ft, useReducer: ql, useRef: Re, useState: je, useSyncExternalStore: wi, useTransition: H$ } } }, Are = "18.3.1"; function Sre(e) { - return mo.bind(null, e); + return yo.bind(null, e); } function Gx(e) { return !!e && e.$$typeof === Y$; @@ -12429,7 +12429,7 @@ function Cre(e) { return Gx(e) ? sre.apply(null, arguments) : e; } function Ire(e) { - return !!e.__k && (Nf(null, e), !0); + return !!e.__k && (Pf(null, e), !0); } function Nre(e) { return e && (e.base || e.nodeType === 1 && e) || null; @@ -12437,13 +12437,13 @@ function Nre(e) { var Ore = function(e, t) { return e(t); }, Pre = function(e, t) { - var n = We.debounceRendering; - We.debounceRendering = function(o) { + var n = He.debounceRendering; + He.debounceRendering = function(o) { return o(); }; var r = e(t); - return We.debounceRendering = n, r; -}, Rre = Gx, Tre = { useState: De, useId: xi, useReducer: Wl, useEffect: Ke, useLayoutEffect: Ze, useInsertionEffect: B6, useTransition: H$, useDeferredValue: K$, useSyncExternalStore: wi, startTransition: U$, useRef: Re, useImperativeHandle: T6, useMemo: ft, useCallback: fi, useContext: Et, useDebugValue: F$, version: "18.3.1", Children: lre, render: bre, hydrate: wre, unmountComponentAtNode: Ire, createPortal: _6, createElement: mo, createContext: Fn, createFactory: Sre, cloneElement: Cre, createRef: Zne, Fragment: nt, isValidElement: Gx, isElement: Rre, isFragment: xre, isMemo: Ere, findDOMNode: Nre, Component: Rr, PureComponent: dN, memo: Ei, forwardRef: z$, flushSync: Pre, unstable_batchedUpdates: Ore, StrictMode: nt, Suspense: Qw, SuspenseList: jy, lazy: J$, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: kre }; + return He.debounceRendering = n, r; +}, Rre = Gx, Tre = { useState: je, useId: xi, useReducer: ql, useEffect: Ke, useLayoutEffect: Ze, useInsertionEffect: B6, useTransition: H$, useDeferredValue: K$, useSyncExternalStore: wi, startTransition: U$, useRef: Re, useImperativeHandle: T6, useMemo: ft, useCallback: fi, useContext: Ct, useDebugValue: F$, version: "18.3.1", Children: lre, render: bre, hydrate: wre, unmountComponentAtNode: Ire, createPortal: _6, createElement: yo, createContext: Fn, createFactory: Sre, cloneElement: Cre, createRef: Zne, Fragment: nt, isValidElement: Gx, isElement: Rre, isFragment: xre, isMemo: Ere, findDOMNode: Nre, Component: Rr, PureComponent: dN, memo: Ei, forwardRef: z$, flushSync: Pre, unstable_batchedUpdates: Ore, StrictMode: nt, Suspense: Qw, SuspenseList: jy, lazy: J$, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: kre }; function Mre(e, t) { for (var n in t) e[n] = t[n]; return e; @@ -12459,18 +12459,18 @@ function YM(e, t) { (YM.prototype = new Rr()).isPureReactComponent = !0, YM.prototype.shouldComponentUpdate = function(e, t) { return JM(this.props, e) || JM(this.state, t); }; -var QM = We.__b; -We.__b = function(e) { +var QM = He.__b; +He.__b = function(e) { e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), QM && QM(e); }; -var Bre = We.__e; -We.__e = function(e, t, n, r) { +var Bre = He.__e; +He.__e = function(e, t, n, r) { if (e.then) { for (var o, s = t; s = s.__; ) if ((o = s.__c) && o.__c) return t.__e == null && (t.__e = n.__e, t.__k = n.__k || []), o.__c(e, t); } Bre(e, t, n, r); }; -var XM = We.unmount; +var XM = He.unmount; function Q$(e, t, n) { return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(r) { typeof r.__c == "function" && r.__c(); @@ -12493,7 +12493,7 @@ function Z$(e) { function p1() { this.i = null, this.l = null; } -We.unmount = function(e) { +He.unmount = function(e) { var t = e.__c; t && (t.__z = !0), t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), XM && XM(e); }, (XE.prototype = new Rr()).__c = function(e, t) { @@ -12526,8 +12526,8 @@ We.unmount = function(e) { } this.__b = null; } - var o = t.__a && mo(nt, null, e.fallback); - return o && (o.__u &= -33), [mo(nt, null, t.__a ? null : e.children), o]; + var o = t.__a && yo(nt, null, e.fallback); + return o && (o.__u &= -33), [yo(nt, null, t.__a ? null : e.children), o]; }; var ZM = function(e, t, n) { if (++n[1] === n[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (n = e.i; n; ) { @@ -12546,7 +12546,7 @@ var ZM = function(e, t, n) { }; }, p1.prototype.render = function(e) { this.i = null, this.l = /* @__PURE__ */ new Map(); - var t = $o(e.children); + var t = Uo(e.children); e.revealOrder && e.revealOrder[0] === "b" && t.reverse(); for (var n = t.length; n--; ) this.l.set(t[n], this.i = [1, 0, this.i]); return e.children; @@ -12560,7 +12560,7 @@ var _re = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60 return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e); }; function $re(e, t, n) { - return t.__k == null && (t.textContent = ""), Nf(e, t), typeof n == "function" && n(), e ? e.__c : null; + return t.__k == null && (t.textContent = ""), Pf(e, t), typeof n == "function" && n(), e ? e.__c : null; } Rr.prototype.isReactComponent = !0, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) { Object.defineProperty(Rr.prototype, e, { configurable: !0, get: function() { @@ -12569,8 +12569,8 @@ Rr.prototype.isReactComponent = !0, ["componentWillMount", "componentWillReceive Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t }); } }); }); -var eB = We.event; -We.event = function(e) { +var eB = He.event; +He.event = function(e) { return eB && (e = eB(e)), e.persist = function() { }, e.isPropagationStopped = function() { return this.cancelBubble; @@ -12580,8 +12580,8 @@ We.event = function(e) { }; var Ure = { configurable: !0, get: function() { return this.class; -} }, tB = We.vnode; -We.vnode = function(e) { +} }, tB = He.vnode; +He.vnode = function(e) { typeof e.type == "string" && (function(t) { var n = t.props, r = t.type, o = {}, s = r.indexOf("-") == -1; for (var i in n) { @@ -12591,25 +12591,25 @@ We.vnode = function(e) { i === "defaultValue" && "value" in n && n.value == null ? i = "value" : i === "download" && a === !0 ? a = "" : c === "translate" && a === "no" ? a = !1 : c[0] === "o" && c[1] === "n" ? c === "ondoubleclick" ? i = "ondblclick" : c !== "onchange" || r !== "input" && r !== "textarea" || Vre(n.type) ? c === "onfocus" ? i = "onfocusin" : c === "onblur" ? i = "onfocusout" : Dre.test(i) && (i = c) : c = i = "oninput" : s && Lre.test(i) ? i = i.replace(jre, "-$&").toLowerCase() : a === null && (a = void 0), c === "oninput" && o[i = c] && (i = "oninputCapture"), o[i] = a; } } - r == "select" && (o.multiple && Array.isArray(o.value) && (o.value = $o(n.children).forEach(function(l) { + r == "select" && (o.multiple && Array.isArray(o.value) && (o.value = Uo(n.children).forEach(function(l) { l.props.selected = o.value.indexOf(l.props.value) != -1; - })), o.defaultValue != null && (o.value = $o(n.children).forEach(function(l) { + })), o.defaultValue != null && (o.value = Uo(n.children).forEach(function(l) { l.props.selected = o.multiple ? o.defaultValue.indexOf(l.props.value) != -1 : o.defaultValue == l.props.value; }))), n.class && !n.className ? (o.class = n.class, Object.defineProperty(o, "className", Ure)) : n.className && (o.class = o.className = n.className), t.props = o; })(e), e.$$typeof = _re, tB && tB(e); }; -var nB = We.__r; -We.__r = function(e) { +var nB = He.__r; +He.__r = function(e) { nB && nB(e), e.__c; }; -var rB = We.diffed; -We.diffed = function(e) { +var rB = He.diffed; +He.diffed = function(e) { rB && rB(e); var t = e.props, n = e.__e; n != null && e.type === "textarea" && "value" in t && t.value !== n.value && (n.value = t.value == null ? "" : t.value); }; function Kre(e) { - return !!e.__k && (Nf(null, e), !0); + return !!e.__k && (Pf(null, e), !0); } function Hre(e) { return { @@ -12630,9 +12630,9 @@ function P(e, t, n, r, o, s) { if ("ref" in c) for (a in c = {}, t) a == "ref" ? i = t[a] : c[a] = t[a]; var l = { type: e, props: c, key: n, ref: i, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --zre, __i: -1, __u: 0, __source: o, __self: s }; if (typeof e == "function" && (i = e.defaultProps)) for (a in i) c[a] === void 0 && (c[a] = i[a]); - return We.vnode && We.vnode(l), l; + return He.vnode && He.vnode(l), l; } -const It = { name: "documents" }, oB = (e) => "origin" in e ? e.origin.transaction : void 0; +const Pt = { name: "documents" }, oB = (e) => "origin" in e ? e.origin.transaction : void 0; function Wre(e) { let t = null; const n = () => { @@ -12651,12 +12651,12 @@ function Wre(e) { close: n }; } -class kc extends Error { +class Ac extends Error { constructor(t) { super(`[kernel] cancelled: ${t}`), this.name = "CancelledError"; } } -const Rh = (e) => e instanceof kc; +const Mh = (e) => e instanceof Ac; function sB(e) { const t = []; let n = null; @@ -12679,7 +12679,7 @@ function sB(e) { } }; } -class re extends Error { +class te extends Error { constructor(t, n, r, o = {}) { super(r), this.name = "PluginError", o.cause !== void 0 && (this.cause = o.cause), this.code = t, this.capability = n, this.permission = o.permission ?? null, this.details = o.details; } @@ -12692,8 +12692,8 @@ function Br(e) { permission: e.permission }; } -function pr(e, t) { - return e instanceof re ? t === void 0 || e.code === t : !1; +function Xn(e, t) { + return e instanceof te ? t === void 0 || e.code === t : !1; } const qre = { InvalidArg: "invalid-input", @@ -12728,24 +12728,24 @@ function Gre(e) { const t = e.details?.required; return typeof t == "string" ? t : null; } -function qe(e, t) { - if (t instanceof re) return t; - if (Rh(t) || t instanceof Error && t.name === "AbortError") - return new re("operation-cancelled", e, "operation cancelled", { +function ze(e, t) { + if (t instanceof te) return t; + if (Mh(t) || t instanceof Error && t.name === "AbortError") + return new te("operation-cancelled", e, "operation cancelled", { cause: t }); if (J.is(t)) { const r = qre[String(t.code)] ?? "operation-failed"; - return new re(r, e, t.message, { + return new te(r, e, t.message, { cause: t, details: t.details, permission: r === "permission-denied" ? Gre(t) : null }); } const n = t instanceof Error ? t.message : String(t); - return new re("operation-failed", e, n, { cause: t }); + return new te("operation-failed", e, n, { cause: t }); } -function lo(e) { +function uo(e) { let t = /* @__PURE__ */ new Set(); return { on(n, r) { @@ -12772,15 +12772,15 @@ function lo(e) { const ZE = (e) => e.undoOf !== null ? { undoOf: e.undoOf } : { ops: e.ops ?? [] }; function Jre(e) { let t = [], n = 0, r = 0, o = null, s = !1; - const i = lo(e.report), a = lo(e.report), c = (y) => { + const i = uo(e.report), a = uo(e.report), c = (y) => { const x = e.handle(); - if (!x) throw new re("not-ready", y, "the document has not opened yet"); + if (!x) throw new te("not-ready", y, "the document has not opened yet"); return x; }, l = (y) => { - if (s) throw new re("instance-closed", y, "the document closed"); + if (s) throw new te("instance-closed", y, "the document closed"); }, u = () => { n += 1, e.notify(); - }, d = (y) => { + }, f = (y) => { let x, A; const b = new Promise((E, I) => { x = E, A = I; @@ -12798,19 +12798,19 @@ function Jre(e) { resolve: x, reject: A }; - }, f = (y) => { + }, d = (y) => { t = t.filter((x) => x !== y); }, h = (y, x) => { - y.answered || (y.answered = !0, f(y), u(), y.resolve(x), a.emit({ change: y, status: "applied", result: x })); + y.answered || (y.answered = !0, d(y), u(), y.resolve(x), a.emit({ change: y, status: "applied", result: x })); }, g = (y, x) => { - y.answered || (y.answered = !0, f(y), y.reject(x), a.emit({ change: y, status: "refused", error: x }), p(y), u()); + y.answered || (y.answered = !0, d(y), y.reject(x), a.emit({ change: y, status: "refused", error: x }), p(y), u()); }, p = (y) => { const x = new Set(eee(ZE(y))); if (x.size !== 0) for (const A of t) A.seq < y.seq || A.answered || tee(ZE(A)).some((b) => x.has(b)) && (A.abort?.(), g( A, - new re( + new te( "conflict", A.capability, `a change it depends on (${y.label.key}) was refused`, @@ -12824,15 +12824,15 @@ function Jre(e) { const A = c(y.capability); x = y.verb ? y.verb(A, { opId: y.opId }) : A.apply(ZE(y), { opId: y.opId }); } catch (A) { - g(y, qe(y.capability, A)); + g(y, ze(y.capability, A)); return; } typeof x.abort == "function" && (y.abort = (A) => x.abort(A)), x.then( (A) => h(y, A), - (A) => g(y, qe(y.capability, A)) + (A) => g(y, ze(y.capability, A)) ); }, v = (y, x) => { - y.answered || (y.answered = !0, f(y), y.reject(new re("operation-cancelled", x, "the change was cancelled")), u()); + y.answered || (y.answered = !0, d(y), y.reject(new te("operation-cancelled", x, "the change was cancelled")), u()); }, S = (y = 1 / 0) => { for (const x of t) if (!(!x.held || x.seq >= y)) { @@ -12842,9 +12842,9 @@ function Jre(e) { } i.emit(x), m(x); } - }, C = (y, x) => new re("invalid-input", y, x), k = (y, x) => { + }, C = (y, x) => new te("invalid-input", y, x), k = (y, x) => { const A = y.entry; - return A ? (A.ops = [...A.ops ?? [], ...x.ops], A.shows = A.ops, A.undo = [...x.undo ?? [], ...A.undo], A.history = A.history || x.history !== !1, u(), A) : (y.entry = d({ + return A ? (A.ops = [...A.ops ?? [], ...x.ops], A.shows = A.ops, A.undo = [...x.undo ?? [], ...A.undo], A.history = A.history || x.history !== !1, u(), A) : (y.entry = f({ label: y.label, ops: x.ops, undoOf: null, @@ -12873,7 +12873,7 @@ function Jre(e) { return k(o, x); } S(); - const A = "undoOf" in x ? d({ + const A = "undoOf" in x ? f({ label: x.label, ops: null, undoOf: x.undoOf, @@ -12882,7 +12882,7 @@ function Jre(e) { history: !1, held: !1, capability: y - }) : "send" in x ? d({ + }) : "send" in x ? f({ label: x.label, ops: null, undoOf: null, @@ -12893,7 +12893,7 @@ function Jre(e) { history: x.history !== !1, held: !1, capability: y - }) : d({ + }) : f({ label: x.label, ops: x.ops, undoOf: null, @@ -12917,7 +12917,7 @@ function Jre(e) { return b; }, set(O, T = []) { - I() && (b ? (b.ops = O, b.shows = O, b.undo = T) : (b = d({ + I() && (b ? (b.ops = O, b.shows = O, b.undo = T) : (b = f({ label: x, ops: O, undoOf: null, @@ -12956,7 +12956,7 @@ function Jre(e) { try { await c(y).objectNumbers.reserve(x); } catch (A) { - throw qe(y, A); + throw ze(y, A); } }, listPending: () => t, @@ -12981,7 +12981,7 @@ function Jre(e) { const y = t; t = [], n += 1; for (const x of y) - x.answered = !0, x.reject(new re("instance-closed", x.capability, "the document closed")); + x.answered = !0, x.reject(new te("instance-closed", x.capability, "the document closed")); i.destroy(), a.destroy(); } }; @@ -12990,7 +12990,7 @@ const D6 = Symbol("mirror.reload"); function os(e) { return { [D6]: e?.pages ?? "all" }; } -const eC = (e) => typeof e == "object" && e !== null && D6 in e, eU = (e) => e.type === "stream.desynced" || e.type === "document.versioned", tU = (e) => pr(e, "permission-denied") ? "forbidden" : "error", nU = (e) => "origin" in e ? e.origin.transaction?.id ?? null : null, Yre = (e) => { +const eC = (e) => typeof e == "object" && e !== null && D6 in e, eU = (e) => e.type === "stream.desynced" || e.type === "document.versioned", tU = (e) => Xn(e, "permission-denied") ? "forbidden" : "error", nU = (e) => "origin" in e ? e.origin.transaction?.id ?? null : null, Yre = (e) => { const t = "origin" in e ? e.origin.transaction : void 0; return t && t.index === t.count - 1 ? t.id : null; }; @@ -13030,20 +13030,20 @@ function Qre(e, t) { status: "idle" }); let r = !1, o = null, s = null, i = !1, a = null, c = null, l = null, u = 0; - const d = /* @__PURE__ */ new Map(); - let f = null; + const f = /* @__PURE__ */ new Map(); + let d = null; const h = /* @__PURE__ */ new Map(); let g = 0; - const p = j6(t.changes), m = { has: (j) => p.has(j) || d.has(j) }, v = (j) => { + const p = j6(t.changes), m = { has: (j) => p.has(j) || f.has(j) }, v = (j) => { const H = nU(j); if (!(H === null || !e.predict)) - return t.changes.find(H) ?? d.get(H)?.change ?? h.get(H)?.change; + return t.changes.find(H) ?? f.get(H)?.change ?? h.get(H)?.change; }, S = (j) => { const H = v(j); - !H || d.has(H.opId) || (h.set(H.opId, { change: H, after: u - 1 }), g += 1); + !H || f.has(H.opId) || (h.set(H.opId, { change: H, after: u - 1 }), g += 1); }, C = (j) => { const H = h.size; - for (const [Y, ue] of h) ue.after < j && h.delete(Y); + for (const [Y, le] of h) le.after < j && h.delete(Y); h.size !== H && (g += 1, t.notify()); }, k = (j, H) => yS(j, [H], e.predict, t.report), N = (j, H) => { try { @@ -13057,16 +13057,16 @@ function Qre(e, t) { const y = () => { const j = n.read().value; if (!e.predict) return j; - const H = f ? f.value : j, Y = t.changes.version(); + const H = d ? d.value : j, Y = t.changes.version(); if (w && w.from === H && w.version === Y && w.kept === g) return w.view; - const ue = yS( + const le = yS( H, F6(t.changes, h.values(), m), e.predict, t.report ); - return w = { from: H, version: Y, kept: g, view: ue }, ue; + return w = { from: H, version: Y, kept: g, view: le }, le; }, x = (j) => { try { e.onChanged?.(j); @@ -13082,25 +13082,25 @@ function Qre(e, t) { }, E = (j, H) => { if (s !== "all") { s ?? (s = { pages: /* @__PURE__ */ new Map(), keptFor: [] }); - for (const Y of j) s.pages.set(Gt(Y), Y); + for (const Y of j) s.pages.set(Yt(Y), Y); H !== null && s.keptFor.push(H); } $(); }, I = (j, H) => { const Y = v(H) ?? null; - Y && (d.set(Y.opId, { change: Y, after: u }), h.delete(Y.opId), g += 1); - const ue = j[D6]; - return ue === "all" || !e.loadPages ? b() : E(ue, Y?.opId ?? null), Y; + Y && (f.set(Y.opId, { change: Y, after: u }), h.delete(Y.opId), g += 1); + const le = j[D6]; + return le === "all" || !e.loadPages ? b() : E(le, Y?.opId ?? null), Y; }, O = async (j) => { - const H = [...j.pages.values()], Y = n.read().value, le = [...d.keys()].some((he) => !j.keptFor.includes(he)) ? f : null, pe = []; + const H = [...j.pages.values()], Y = n.read().value, ie = [...f.keys()].some((he) => !j.keptFor.includes(he)) ? d : null, pe = []; l = pe; - let ge, Me; + let ve, _e; try { const he = await e.loadPages(t.doc, H, t.lifetime); if (l = null, !n.live) return; - ge = he(Y), Me = le && { value: he(le.value) }; + ve = he(Y), _e = ie && { value: he(ie.value) }; } catch (he) { - if (l = null, pr(he, "instance-closed") || !n.live) return; + if (l = null, Xn(he, "instance-closed") || !n.live) return; t.report(he), D(); return; } @@ -13108,45 +13108,45 @@ function Qre(e, t) { for (const he of pe) { let Te; try { - Te = e.fold(ge, he); - } catch (ze) { - t.report(ze), D(); + Te = e.fold(ve, he); + } catch (We) { + t.report(We), D(); continue; } if (eC(Te)) { - const ze = I(Te, he); - if (!ze) continue; - Be.add(ze.opId), Me = { value: k(Me ? Me.value : ge, ze) }; + const We = I(Te, he); + if (!We) continue; + Be.add(We.opId), _e = { value: k(_e ? _e.value : ve, We) }; continue; } - ge = Te, Me && (Me = { value: N(Me.value, he) }); + ve = Te, _e && (_e = { value: N(_e.value, he) }); } - for (const he of j.keptFor) Be.has(he) || d.delete(he); - const te = n.read().value; - f = d.size > 0 ? Me : null, g += 1, n.write({ ...n.read(), value: ge }), x({ cause: "load", event: null, pages: H, previous: te, next: ge }), t.notify(); + for (const he of j.keptFor) Be.has(he) || f.delete(he); + const ee = n.read().value; + d = f.size > 0 ? _e : null, g += 1, n.write({ ...n.read(), value: ve }), x({ cause: "load", event: null, pages: H, previous: ee, next: ve }), t.notify(); }, T = (j) => { let H; try { H = e.fold(n.read().value, j); - } catch (le) { - t.report(le), (!e.onDemand || r) && b(); + } catch (ie) { + t.report(ie), (!e.onDemand || r) && b(); return; } if (eC(H)) { if (e.onDemand && !r) return; - const le = I(H, j); - if (!le) return; - f = { value: k(f ? f.value : n.read().value, le) }, g += 1, t.notify(); + const ie = I(H, j); + if (!ie) return; + d = { value: k(d ? d.value : n.read().value, ie) }, g += 1, t.notify(); return; } e.predict && p.add(j) && (g += 1); let Y = !1; - if (f) { - const le = N(f.value, j); - Y = le !== f.value, f = { value: le }, g += 1; + if (d) { + const ie = N(d.value, j); + Y = ie !== d.value, d = { value: ie }, g += 1; } - const ue = A(H, { cause: "event", event: j, pages: null }); - Y && !ue && t.notify(); + const le = A(H, { cause: "event", event: j, pages: null }); + Y && !le && t.notify(); }; t.onDocumentEvent((j) => { if (n.live) { @@ -13161,8 +13161,8 @@ function Qre(e, t) { const H = c ?? []; try { for (let Y = 0; Y < H.length; Y += 1) { - const ue = H[Y]; - j(ue) || T(ue); + const le = H[Y]; + j(le) || T(le); } } finally { c = null; @@ -13178,23 +13178,23 @@ function Qre(e, t) { let H; try { H = await e.load(t.doc, t.lifetime); - } catch (le) { - if (!n.live || pr(le, "instance-closed")) { + } catch (ie) { + if (!n.live || Xn(ie, "instance-closed")) { c = null; return; } - throw n.write({ ...n.read(), status: tU(le) }), R(() => !1), C(j + 1), le; + throw n.write({ ...n.read(), status: tU(ie) }), R(() => !1), C(j + 1), ie; } if (!n.live) { c = null; return; } const Y = n.read().value; - d.clear(), f = null, g += 1, n.write({ value: H.value, status: "ready" }), x({ cause: "load", event: null, pages: "all", previous: Y, next: H.value }); - const ue = H.cursor ?? null; - R((le) => { - const pe = "origin" in le ? le.origin.serverSequence : null; - return ue !== null && pe !== null && pe <= ue; + f.clear(), d = null, g += 1, n.write({ value: H.value, status: "ready" }), x({ cause: "load", event: null, pages: "all", previous: Y, next: H.value }); + const le = H.cursor ?? null; + R((ie) => { + const pe = "origin" in ie ? ie.origin.serverSequence : null; + return le !== null && pe !== null && pe <= le; }), C(j); }, F = async () => { i = !0; @@ -13207,7 +13207,7 @@ function Qre(e, t) { if (i = !1, s === "all" && n.live) return; const H = a; a = null, j ? H?.reject(j.error) : H?.resolve(); - }, B = async () => { + }, _ = async () => { try { for (; s !== null; ) { const j = s; @@ -13222,21 +13222,21 @@ function Qre(e, t) { function $() { if (o) return; let j; - o = new Promise((H) => j = H), B().then(j, j); + o = new Promise((H) => j = H), _().then(j, j); } function D() { r = !0, s = "all"; } - function _() { + function B() { if (!a) { let j; - a = { promise: new Promise((Y, ue) => j = { resolve: Y, reject: ue }), ...j }; + a = { promise: new Promise((Y, le) => j = { resolve: Y, reject: le }), ...j }; } return a.promise; } function L() { D(); - const j = _(); + const j = B(); return $(), j; } return { @@ -13244,7 +13244,7 @@ function Qre(e, t) { get: () => n.read().value, view: y, getStatus: () => n.read().status, - ensureLoaded: () => i || s === "all" ? _() : n.read().status === "ready" ? Promise.resolve() : L(), + ensureLoaded: () => i || s === "all" ? B() : n.read().status === "ready" ? Promise.resolve() : L(), refresh: L, async settled() { for (; o; ) await o; @@ -13260,13 +13260,13 @@ const Wa = (e) => { const t = Object.getPrototypeOf(e); return t === Object.prototype || t === null; }, V6 = (e, t) => Object.prototype.hasOwnProperty.call(e, t); -function Of(e, t) { +function Rf(e, t) { if (Object.is(e, t)) return !0; if (Array.isArray(e) && Array.isArray(t)) - return e.length === t.length && e.every((n, r) => Of(n, t[r])); + return e.length === t.length && e.every((n, r) => Rf(n, t[r])); if (Wa(e) && Wa(t)) { const n = Object.keys(e); - return n.length === Object.keys(t).length && n.every((r) => V6(t, r) && Of(e[r], t[r])); + return n.length === Object.keys(t).length && n.every((r) => V6(t, r) && Rf(e[r], t[r])); } return !1; } @@ -13313,12 +13313,12 @@ function toe(e) { r.add(u); }, refresh: () => { - const u = c(), d = yS(s, u, eoe, n); - if (d === i) return null; - i = d; - const f = noe(a.pages, d.pages), h = Kx(a.labels, d.labels) ? a.labels : d.labels, g = roe(a.pending, ooe(f, s.pages, u)); - if (f === a.pages && h === a.labels && g === a.pending) return null; - a = { pages: f, labels: h, pending: g }; + const u = c(), f = yS(s, u, eoe, n); + if (f === i) return null; + i = f; + const d = noe(a.pages, f.pages), h = Kx(a.labels, f.labels) ? a.labels : f.labels, g = roe(a.pending, ooe(d, s.pages, u)); + if (d === a.pages && h === a.labels && g === a.pending) return null; + a = { pages: d, labels: h, pending: g }; for (const p of [...o]) try { p(); @@ -13329,7 +13329,7 @@ function toe(e) { }, current: () => a, getPending: (u) => a.pending.get(u.objectNumber) ?? null, - has: (u) => a.pages.some((d) => d.ref.objectNumber === u.objectNumber), + has: (u) => a.pages.some((f) => f.ref.objectNumber === u.objectNumber), onChange(u) { return o.add(u), () => void o.delete(u); } @@ -13339,14 +13339,14 @@ function noe(e, t) { const n = new Map(e.map((s) => [s.ref.objectNumber, s])); let r = e.length === t.length; const o = t.map((s, i) => { - const a = n.get(s.ref.objectNumber), c = a !== void 0 && Of(a, s) ? a : s; + const a = n.get(s.ref.objectNumber), c = a !== void 0 && Rf(a, s) ? a : s; return c !== e[i] && (r = !1), c; }); return r ? e : o; } function roe(e, t) { if (e.size !== t.size) return t; - for (const [n, r] of t) if (!Of(e.get(n), r)) return t; + for (const [n, r] of t) if (!Rf(e.get(n), r)) return t; return e; } function ooe(e, t, n) { @@ -13418,10 +13418,10 @@ function coe(e = console.error) { e(m); } }; - let a = 0, c = !1, l = !1, u = 0, d = !1; - const f = () => { + let a = 0, c = !1, l = !1, u = 0, f = !1; + const d = () => { if (u > 0) { - d = !0; + f = !0; return; } if (c) { @@ -13437,11 +13437,11 @@ function coe(e = console.error) { c = !1; } }, h = () => { - a += 1, f(); + a += 1, d(); }; function g(p, m, v = `${p}#${++s}`) { r.get(p)?.revoke(); - const S = { live: !0, state: m }, C = lo(e); + const S = { live: !0, state: m }, C = uo(e); n[p] = m; const k = { key: p, @@ -13476,7 +13476,7 @@ function coe(e = console.error) { u += 1; let p = !1; return () => { - p || (p = !0, u -= 1, !(u > 0 || !d) && (d = !1, f())); + p || (p = !0, u -= 1, !(u > 0 || !f) && (f = !1, d())); }; }, subscribe(p) { @@ -13499,41 +13499,41 @@ function loe() { } const rU = (e) => e !== null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function", uoe = (e) => e !== null && typeof e == "object" && !rU(e) && !(e instanceof ArrayBuffer) && !ArrayBuffer.isView(e) && !(e instanceof Date) && !(e instanceof RegExp) && !(e instanceof Map) && !(e instanceof Set) && !Array.isArray(e); function doe(e, t, n) { - const r = /* @__PURE__ */ new WeakMap(), o = () => new re( + const r = /* @__PURE__ */ new WeakMap(), o = () => new te( "instance-closed", n, `document instance ${t.instanceId} was closed` ), s = (l) => { - const u = l, d = new Promise((f, h) => { + const u = l, f = new Promise((d, h) => { const g = () => { u.abort?.(t.signal.reason), h(o()); }; t.signal.aborted ? g() : t.signal.addEventListener("abort", g, { once: !0 }), Promise.resolve(l).then( (p) => { - t.signal.removeEventListener("abort", g), t.signal.aborted || f(p); + t.signal.removeEventListener("abort", g), t.signal.aborted || d(p); }, (p) => { - t.signal.removeEventListener("abort", g), t.signal.aborted || h(qe(n, p)); + t.signal.removeEventListener("abort", g), t.signal.aborted || h(ze(n, p)); } ); }); - return typeof u.abort == "function" && Object.defineProperty(d, "abort", { - value: (f) => u.abort(f), + return typeof u.abort == "function" && Object.defineProperty(f, "abort", { + value: (d) => u.abort(d), enumerable: !1 - }), d; - }, i = (l, u) => function(...f) { + }), f; + }, i = (l, u) => function(...d) { let h; try { - h = l.apply(u, f); + h = l.apply(u, d); } catch (g) { - throw qe(n, g); + throw ze(n, g); } return rU(h) ? s(h) : a(h, u); }, a = (l, u) => typeof l == "function" ? i(l, u) : uoe(l) ? c(l) : l, c = (l) => { let u = r.get(l); return u || (u = new Proxy(l, { - get(d, f) { - return a(Reflect.get(d, f, d), d); + get(f, d) { + return a(Reflect.get(f, d, f), f); } }), r.set(l, u)), u; }; @@ -13541,7 +13541,7 @@ function doe(e, t, n) { } function foe(e, t, n) { let r = 0, o = null; - const s = () => new re("instance-closed", t, `${n}: instance closed`), i = (a, c) => new re("operation-cancelled", t, `${n}: ${c}`, { + const s = () => new te("instance-closed", t, `${n}: instance closed`), i = (a, c) => new te("operation-cancelled", t, `${n}: ${c}`, { details: { runId: a, reason: c } }); return { @@ -13555,13 +13555,13 @@ function foe(e, t, n) { if (e.aborted) throw s(); if (c?.signal?.aborted) throw i(`${n}#${r + 1}`, "cancelled before start"); - const l = ++r, u = `${n}#${l}`, d = new AbortController(), f = o; - o = d; - const h = () => d.abort("instance-closed"), g = () => d.abort("cancelled"); + const l = ++r, u = `${n}#${l}`, f = new AbortController(), d = o; + o = f; + const h = () => f.abort("instance-closed"), g = () => f.abort("cancelled"); e.addEventListener("abort", h, { once: !0 }), c?.signal?.addEventListener("abort", g, { once: !0 }); - const p = () => l === r && !d.signal.aborted, m = { + const p = () => l === r && !f.signal.aborted, m = { id: u, - signal: d.signal, + signal: f.signal, get superseded() { return l !== r; }, @@ -13570,14 +13570,14 @@ function foe(e, t, n) { } }; try { - if (f?.abort("superseded"), !p()) throw i(u, "superseded"); + if (d?.abort("superseded"), !p()) throw i(u, "superseded"); const v = await a(m); - if (!p()) throw i(u, String(d.signal.reason ?? "superseded")); + if (!p()) throw i(u, String(f.signal.reason ?? "superseded")); return v; } catch (v) { - throw e.aborted ? s() : p() ? qe(t, v) : i(u, String(d.signal.reason ?? "superseded")); + throw e.aborted ? s() : p() ? ze(t, v) : i(u, String(f.signal.reason ?? "superseded")); } finally { - e.removeEventListener("abort", h), c?.signal?.removeEventListener("abort", g), o === d && (o = null); + e.removeEventListener("abort", h), c?.signal?.removeEventListener("abort", g), o === f && (o = null); } } }; @@ -13612,10 +13612,10 @@ function poe(e, t) { const A = x.size; for (const [b, E] of x) E.epoch < y && x.delete(b); x.size === 0 && i.delete(w), x.size !== A && (a += 1, t.notify()); - }, d = /* @__PURE__ */ new Map(), f = (w) => { - const y = Gt(w), x = h(y)?.value; + }, f = /* @__PURE__ */ new Map(), d = (w) => { + const y = Yt(w), x = h(y)?.value; if (x === void 0 || !e.predict) return x; - const A = t.changes.version(), b = d.get(y); + const A = t.changes.version(), b = f.get(y); if (b && b.value === x && b.version === A && b.kept === a) return b.view; const E = e.predict, I = yS( @@ -13624,7 +13624,7 @@ function poe(e, t) { (O, T) => E(O, T, w), t.report ); - return d.set(y, { value: x, version: A, kept: a, view: I }), I; + return f.set(y, { value: x, version: A, kept: a, view: I }), I; }, h = (w) => n.get(w), g = (w, y) => r.live ? (y ? n.set(w, y) : n.delete(w), r.write(r.read() + 1)) : !1, p = (w) => { if (!(w.cause !== "load" && w.previous === w.next)) try { @@ -13642,7 +13642,7 @@ function poe(e, t) { }), v = (w) => t.pages.getPending(w) ? m(w).then( (y) => y ? e.load(t.doc, w, t.lifetime) : aB ) : e.load(t.doc, w, t.lifetime), S = (w) => { - const y = Gt(w), x = (o.get(y) ?? 0) + 1; + const y = Yt(w), x = (o.get(y) ?? 0) + 1; o.set(y, x); const A = h(y); A?.status !== "ready" && g(y, { page: w, status: "loading", value: A?.value }); @@ -13657,7 +13657,7 @@ function poe(e, t) { g(y, { page: w, status: "ready", value: I }), p({ page: w, cause: "load", event: null, previous: O, next: I }), i.has(y) && u(y, x); }, (I) => { - if (!(!b() || pr(I, "instance-closed"))) + if (!(!b() || Xn(I, "instance-closed"))) throw g(y, { page: w, status: tU(I), value: h(y)?.value }), I; } ).finally(() => { @@ -13678,8 +13678,8 @@ function poe(e, t) { } if (w.type === "pages.deleted") { for (const A of w.pages) { - const b = Gt(A), E = h(b); - E && (o.set(b, (o.get(b) ?? 0) + 1), i.delete(b), d.delete(b), g(b, null), p({ page: A, cause: "drop", event: w, previous: E.value, next: void 0 })); + const b = Yt(A), E = h(b); + E && (o.set(b, (o.get(b) ?? 0) + 1), i.delete(b), f.delete(b), g(b, null), p({ page: A, cause: "drop", event: w, previous: E.value, next: void 0 })); } return; } @@ -13687,7 +13687,7 @@ function poe(e, t) { if (y === null) return; const x = y === "all" ? k() : y; for (const A of x) { - const b = Gt(A), E = h(b); + const b = Yt(A), E = h(b); if (!E || E.status === tC) continue; if (!e.fold || E.status !== "ready") { l(b, w), C(A); @@ -13707,11 +13707,11 @@ function poe(e, t) { } } return { - get: (w) => h(Gt(w))?.value, - view: f, - getStatus: (w) => h(Gt(w))?.status ?? tC, + get: (w) => h(Yt(w))?.value, + view: d, + getStatus: (w) => h(Yt(w))?.status ?? tC, ensureLoaded(w) { - const y = Gt(w), x = s.get(y); + const y = Yt(w), x = s.get(y); return x || (h(y)?.status === "ready" ? Promise.resolve() : S(w)); }, refresh(w) { @@ -13724,7 +13724,7 @@ function goe(e) { let t = Promise.resolve(); return Object.assign((r, o) => { const s = () => o?.signal?.aborted ? Promise.reject( - new re("operation-cancelled", e, "cancelled before it started", { + new te("operation-cancelled", e, "cancelled before it started", { cause: o.signal.reason }) ) : r(), i = t.then(s, s); @@ -13736,34 +13736,50 @@ function goe(e) { ), i; }, { idle: () => t }); } -function Th(e, t, n) { - if (!t) return n; - const r = n; - return new Promise((o, s) => { - const i = () => { - r.abort?.(t.reason), s( - new re("operation-cancelled", e, "operation cancelled", { - cause: t.reason - }) - ); - }; - n.then( - (a) => { - t.removeEventListener("abort", i), o(a); +function Id(e, t, n, r) { + if (!t && !r) return n; + const o = n; + let s; + const i = new Promise((a, c) => { + let l = !1; + const u = () => { + l = !0, t?.removeEventListener("abort", d), r?.removeEventListener("abort", h); + }, f = (g, p) => { + l || (u(), o.abort?.(g), c(p)); + }, d = () => f( + t?.reason, + new te("operation-cancelled", e, "operation cancelled", { + cause: t?.reason + }) + ), h = () => f( + r?.reason, + new te("instance-closed", e, "the instance closed during the call", { + cause: r?.reason + }) + ); + s = (g) => f( + g, + new te("operation-cancelled", e, "operation cancelled", { + cause: g + }) + ), n.then( + (g) => { + u(), a(g); }, - (a) => { - t.removeEventListener("abort", i), s(qe(e, a)); + (g) => { + u(), c(ze(e, g)); } - ), t.aborted ? i() : t.addEventListener("abort", i, { once: !0 }); + ), r?.aborted ? h() : t?.aborted ? d() : (t?.addEventListener("abort", d, { once: !0 }), r?.addEventListener("abort", h, { once: !0 })); }); + return Object.assign(i, { abort: s }); } function bS(e, t) { - return typeof t == "number" ? e[t] ?? null : e.find((n) => Vf(n.ref, t)) ?? null; + return typeof t == "number" ? e[t] ?? null : e.find((n) => Uf(n.ref, t)) ?? null; } function moe(e, t, n) { const r = bS(e, t); if (r) return r; - throw new re( + throw new te( "not-found", n, typeof t == "number" ? `there is no page ${t} in this document` : `page ${t.objectNumber} is not in this document` @@ -13773,20 +13789,20 @@ function fN(e, t) { return t === "annotations:create" ? e.allowsAnnotation("create") : e.allows(t); } function hN(e, t, n) { - return new re("permission-denied", e, `${n} requires ${t}`, { + return new te("permission-denied", e, `${n} requires ${t}`, { permission: t }); } function yoe(e, t, n, r) { const o = n.assignment ?? iv(n.groupId), s = o.kind === "group" ? `fields:${t}:group=${o.groupId}` : t === "fill" ? "doc.forms.fill" : "doc.sign"; - return new re("permission-denied", e, `${r} requires ${s}`, { + return new te("permission-denied", e, `${r} requires ${s}`, { permission: s }); } const oU = (e, t) => t ? `${e}::${t}` : e, cB = (e, t) => e.reduceRight((n, r) => () => r(n), t)(); function boe(e) { const t = /* @__PURE__ */ new Set([ - It, + Pt, ...e.requires ?? [], ...e.optional ?? [] ]); @@ -13802,8 +13818,8 @@ function uB(e, t, n, r, o) { throw new Error( `[kernel] no state lease for plugin "${t.id}" (${a ?? "workspace"})` ); - const d = boe(t), f = (b) => { - if (loe() && !t.resolvesAnyCapability && !d.has(b)) + const f = boe(t), d = (b) => { + if (loe() && !t.resolvesAnyCapability && !f.has(b)) throw new Error( `[kernel] plugin "${t.id}" resolved capability "${b.name}" without declaring it; add the token to its \`requires\` or \`optional\` list.` ); @@ -13811,7 +13827,7 @@ function uB(e, t, n, r, o) { let h = !1; const g = (b) => { h || (h = !0, e.report( - new re( + new te( "instance-closed", t.id, `${b} after the instance closed (${u.instanceId}); dropped` @@ -13825,13 +13841,13 @@ function uB(e, t, n, r, o) { `[kernel] workspace plugin "${t.id}" has no bound document; use ctx.forDocument(token, documentId).` ); if (!n.handle) - throw new re( + throw new te( "not-ready", l, `document ${n.id} has no engine handle yet` ); return p ?? (p = doe(n.handle, { signal: r, instanceId: c }, l)); - }, v = () => n ? i.getCore().documents[n.id] ?? n.stagedMeta : null, S = (b) => new re("not-found", l, `page ${b.objectNumber} is not in this document`), C = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(); + }, v = () => n ? i.getCore().documents[n.id] ?? n.stagedMeta : null, S = (b) => new te("not-found", l, `page ${b.objectNumber} is not in this document`), C = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(); let N = null, w = null; const y = [], x = () => ({ doc: m(), @@ -13867,7 +13883,7 @@ function uB(e, t, n, r, o) { getPage: (b) => bS(v()?.pages ?? [], b), pageOf: (b) => moe(v()?.pages ?? [], b, l), assertPageRef: (b) => { - if (!v()?.pages.some((E) => Vf(E.ref, b))) + if (!v()?.pages.some((E) => Uf(E.ref, b))) throw S(b); }, // Both read the bound document through `doc()`, so a workspace context @@ -13882,10 +13898,10 @@ function uB(e, t, n, r, o) { if (!m().security.allowsField(b, E)) throw yoe(l, b, E, I); }, - get: (b) => (f(b), e.resolveCapability(b, a)), - tryGet: (b) => (f(b), e.tryResolveCapability(b, a)), - forDocument: (b, E) => (f(b), e.resolveCapability(b, E)), - tryForDocument: (b, E) => (f(b), e.tryResolveCapability(b, E)), + get: (b) => (d(b), e.resolveCapability(b, a)), + tryGet: (b) => (d(b), e.tryResolveCapability(b, a)), + forDocument: (b, E) => (d(b), e.resolveCapability(b, E)), + tryForDocument: (b, E) => (d(b), e.tryResolveCapability(b, E)), state: { get: () => u.read(), update: (b, ...E) => { @@ -13922,22 +13938,22 @@ function uB(e, t, n, r, o) { const R = (D) => { T || (T = !0, $(), r.removeEventListener("abort", M), E?.signal?.removeEventListener("abort", F), D()); }, M = () => R( - () => O(new re("instance-closed", l, "closed while waiting")) + () => O(new te("instance-closed", l, "closed while waiting")) ), F = () => R( - () => O(new re("operation-cancelled", l, "cancelled while waiting")) - ), B = () => { + () => O(new te("operation-cancelled", l, "cancelled while waiting")) + ), _ = () => { let D = !1; try { D = b(); - } catch (_) { - R(() => O(_)); + } catch (B) { + R(() => O(B)); return; } D && R(I); - }, $ = i.subscribe(B); + }, $ = i.subscribe(_); if (r.aborted) return M(); if (E?.signal?.aborted) return F(); - r.addEventListener("abort", M, { once: !0 }), E?.signal?.addEventListener("abort", F, { once: !0 }), B(); + r.addEventListener("abort", M, { once: !0 }), E?.signal?.addEventListener("abort", F, { once: !0 }), _(); }); }, mirror(b) { @@ -13947,7 +13963,7 @@ function uB(e, t, n, r, o) { pageMirror: (b) => poe(b, x()), events: { source() { - const b = lo(e.report); + const b = uo(e.report); return o.defer(() => b.destroy()), b; } }, @@ -13962,6 +13978,12 @@ function uB(e, t, n, r, o) { ); return w ?? (w = n.changes.forPlugin(t.id)); }, + // A document's close marks the session closing, hides the document, revokes the state lease + // and only then aborts `lifetime`, telling the store's subscribers of each step as it happens: + // one that asks in between must hear false already. The kernel's destroy aborts `lifetime` + // first for a workspace plugin. + isOpen: () => !r.aborted && u.live && n?.phase !== "closing", + whileOpen: (b) => Id(l, void 0, b, r), cleanup: (b) => o.defer(b), clock: aoe(e.clock, r), measurer: e.measurer && hoe(e.measurer, r), @@ -13997,10 +14019,10 @@ function uB(e, t, n, r, o) { async acquire(b, E) { const I = await b(r); if (r.aborted) - throw await E(I), new re("instance-closed", l, "closed while acquiring a resource"); + throw await E(I), new te("instance-closed", l, "closed while acquiring a resource"); return o.defer(() => E(I)), I; }, - cancellable: (b, E) => Th(l, b, E), + cancellable: (b, E) => Id(l, b, E), latest(b) { let E = k.get(b); return E || (E = foe(r, l, b), k.set(b, E)), E; @@ -14039,7 +14061,7 @@ async function fB(e, t, n) { async function woe(e, t) { let n; const r = new Promise((o, s) => { - n = () => s(new re("operation-cancelled", "documents", "settling was cancelled")), t.aborted ? n() : t.addEventListener("abort", n, { once: !0 }); + n = () => s(new te("operation-cancelled", "documents", "settling was cancelled")), t.aborted ? n() : t.addEventListener("abort", n, { once: !0 }); }); try { await Promise.race([e, r]); @@ -14050,9 +14072,9 @@ async function woe(e, t) { function hB({ defaults: e, registered: t, whole: n = [] }, r, o) { const s = pN(e, t, { defaults: e, whole: n }); let i = s; - const a = lo(o), c = (u) => { - const d = Aoe(i, u); - d.length !== 0 && (i = u, r(), a.emit({ settings: u, changedKeys: d })); + const a = uo(o), c = (u) => { + const f = Aoe(i, u); + f.length !== 0 && (i = u, r(), a.emit({ settings: u, changedKeys: f })); }, l = { getSettings: () => i, updateSettings: (u) => c(pN(i, u, { defaults: e, whole: n })), @@ -14062,10 +14084,10 @@ function hB({ defaults: e, registered: t, whole: n = [] }, r, o) { return { api: l, forInstance(u) { - const d = lo(o); - return u(a.on((f) => d.emit(f))), u(() => d.destroy()), { + const f = uo(o); + return u(a.on((d) => f.emit(d))), u(() => f.destroy()), { get: l.getSettings, - api: { ...l, onSettingsChanged: d.on } + api: { ...l, onSettingsChanged: f.on } }; }, destroy: () => a.destroy() @@ -14080,7 +14102,7 @@ function pN(e, t, n) { const a = Hk(t, i); if (a === void 0) continue; const c = koe(Hk(n?.defaults, i), a); - Of(Hk(s, i), c) || (s = U6(s, i, c)); + Rf(Hk(s, i), c) || (s = U6(s, i, c)); } return s; } @@ -14111,7 +14133,7 @@ function koe(e, t) { } function gN(e, t) { if (t === void 0) return e; - if (!Wa(t)) return Of(e, t) ? e : t; + if (!Wa(t)) return Rf(e, t) ? e : t; const n = Wa(e) ? e : {}; let r = null; for (const o of Object.keys(t)) { @@ -14122,11 +14144,11 @@ function gN(e, t) { } function Aoe(e, t) { const n = e, r = t; - return [.../* @__PURE__ */ new Set([...Object.keys(n), ...Object.keys(r)])].filter((s) => !Of(n[s], r[s])); + return [.../* @__PURE__ */ new Set([...Object.keys(n), ...Object.keys(r)])].filter((s) => !Rf(n[s], r[s])); } function Soe(e) { const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map([ - [It, "workspace"] + [Pt, "workspace"] ]); for (const a of e) { const c = t.get(a.id); @@ -14145,7 +14167,7 @@ function Soe(e) { } for (const a of e) for (const c of a.requires ?? []) { - if (c !== It && !n.has(c)) + if (c !== Pt && !n.has(c)) throw new Error( `Plugin "${a.id}" requires capability "${c.name}", which no plugin provides` + (c.hint ? ` — ${c.hint}.` : ".") ); @@ -14212,7 +14234,7 @@ const Coe = (e) => Object.freeze({ pageCount: 0, hasUnsavedChanges: !1, ...e.status === "locked" ? { passwordProvided: e.passwordProvided ?? !1 } : {}, - ...e.status === "error" && e.error !== void 0 ? { error: Br(qe("documents", e.error)) } : {}, + ...e.status === "error" && e.error !== void 0 ? { error: Br(ze("documents", e.error)) } : {}, ...e.openRequest ? { openRequest: e.openRequest } : {} }); function Noe(e, t) { @@ -14223,7 +14245,7 @@ function Ooe(e, t, n) { const { passphrase: r, visitorIdentity: o } = n ?? {}; if (r === void 0 && o === void 0) return e; if (!t) - throw new re( + throw new te( "invalid-input", "documents", "only a document from a grant takes its passphrase or answers" @@ -14234,20 +14256,20 @@ const Poe = (e) => e.type !== "stream.desynced" && e.type !== "document.versione async function Toe(e, t, n) { const r = n ?? globalThis.fetch; if (!r) - throw new re("unsupported", "documents", `can't download ${e.url}: no fetch()`); + throw new te("unsupported", "documents", `can't download ${e.url}: no fetch()`); const o = await r(e.url, { signal: t }); if (!o.ok) - throw new re( + throw new te( Roe(o.status), "documents", `couldn't download ${e.url} (HTTP ${o.status})` ); const s = new Uint8Array(await o.arrayBuffer()); if (!iU(s)) - throw new re("invalid-input", "documents", `${e.url} isn't a PDF`); + throw new te("invalid-input", "documents", `${e.url} isn't a PDF`); return { kind: "bytes", ...e.id !== void 0 ? { id: e.id } : {}, bytes: s }; } -const Moe = (e) => e.kind === "url", mB = () => new re("unsupported", "documents", "only the local engine gives a layer to download"), Boe = Object.freeze({ kind: "images", dpi: 150 }), m1 = Object.freeze({ +const Moe = (e) => e.kind === "url", mB = () => new te("unsupported", "documents", "only the local engine gives a layer to download"), Boe = Object.freeze({ kind: "images", dpi: 150 }), m1 = Object.freeze({ kind: "images", dpi: 300 }), _oe = Object.freeze({ kind: "pdf" }), Loe = (e, t) => ({ @@ -14268,13 +14290,13 @@ const Moe = (e) => e.kind === "url", mB = () => new re("unsupported", "documents let Doe = 0; const y1 = (e) => e instanceof Error && e.name === "AbortError"; function joe(e) { - const { engine: t, plugins: n } = e, r = e.report ?? ((V) => console.error("[kernel]", V)), o = coe(r), s = Soe(n), i = s.ordered.filter(ly), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = new AbortController(), d = sB(r), f = /* @__PURE__ */ new Map([ - [It, Loe] + const { engine: t, plugins: n } = e, r = e.report ?? ((V) => console.error("[kernel]", V)), o = coe(r), s = Soe(n), i = s.ordered.filter(ly), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = new AbortController(), f = sB(r), d = /* @__PURE__ */ new Map([ + [Pt, Loe] ]); for (const V of s.ordered) - V.token && V.inScope && !ly(V) && f.set(V.token, V.inScope); - const h = lo(r), g = lo(r), p = lo(r), m = lo(r), v = lo(r), S = lo(r), C = lo(r); - d.defer(() => { + V.token && V.inScope && !ly(V) && d.set(V.token, V.inScope); + const h = uo(r), g = uo(r), p = uo(r), m = uo(r), v = uo(r), S = uo(r), C = uo(r); + f.defer(() => { for (const V of [ h, g, @@ -14298,39 +14320,39 @@ function joe(e) { throw new Error(`[kernel] ${V} on a ${w} kernel`); }, b = (V) => { if (V.cancel.signal.aborted) - throw new kc(`closed while opening: ${V.id}`); + throw new Ac(`closed while opening: ${V.id}`); }; async function E(V, G, Q) { - const be = G; - V.engineOp = typeof be.abort == "function" ? be : null; - const we = V.cancel.signal; - let ye; - const st = new Promise((Qe, At) => { - ye = () => At(new kc(`closed while opening: ${V.id}`)), we.aborted ? ye() : we.addEventListener("abort", ye, { once: !0 }); + const ye = G; + V.engineOp = typeof ye.abort == "function" ? ye : null; + const be = V.cancel.signal; + let me; + const it = new Promise((Qe, St) => { + me = () => St(new Ac(`closed while opening: ${V.id}`)), be.aborted ? me() : be.addEventListener("abort", me, { once: !0 }); }); try { - return await Promise.race([G, st]); + return await Promise.race([G, it]); } catch (Qe) { - throw Rh(Qe) && G.then( - (At) => { - Q && V.scope.defer(() => Q(At)); + throw Mh(Qe) && G.then( + (St) => { + Q && V.scope.defer(() => Q(St)); }, () => { } // the abandoned call's own rejection is not separately actionable ), Qe; } finally { - ye && we.removeEventListener("abort", ye), V.engineOp = null; + me && be.removeEventListener("abort", me), V.engineOp = null; } } function I(V, G) { - const Q = new AbortController(), be = Jre({ - handle: () => we.handle, + const Q = new AbortController(), ye = Jre({ + handle: () => be.handle, notify: () => { - H(we), o.notify(); + H(be), o.notify(); }, report: r - }), we = { + }), be = { id: V, instanceId: `${V}#${++Doe}`, name: G, @@ -14353,13 +14375,13 @@ function joe(e) { settleFlushes: /* @__PURE__ */ new Set(), downloadWraps: [], printWraps: [], - changes: be, - pageView: toe({ changes: be, report: r }), + changes: ye, + pageView: toe({ changes: ye, report: r }), changeCount: 0, changesSeen: 0, - close: () => M(we) + close: () => M(be) }; - return we.settleFlushes.add(() => we.changes.settle()), we.scope.defer(() => we.changes.close()), we; + return be.settleFlushes.add(() => be.changes.settle()), be.scope.defer(() => be.changes.close()), be; } function O(V, G) { if (V.operation) @@ -14372,17 +14394,17 @@ function joe(e) { function T(V, G) { const Q = V.id; if (Q === G) return; - const be = o.getCore(); - if (N.has(G) || be.documents[G] || be.pending[G]) - throw new re("conflict", "documents", `duplicate document id: ${G}`); + const ye = o.getCore(); + if (N.has(G) || ye.documents[G] || ye.pending[G]) + throw new te("conflict", "documents", `duplicate document id: ${G}`); N.delete(Q), V.id = G, N.set(G, V), V.views.clear(); - const we = be.pending[Q]; - if (we) { - const { [Q]: ye, ...st } = be.pending; + const be = ye.pending[Q]; + if (be) { + const { [Q]: me, ...it } = ye.pending; k({ - pending: { ...st, [G]: { ...we, id: G } }, - order: be.order.map((Qe) => Qe === Q ? G : Qe), - activeId: be.activeId === Q ? G : be.activeId + pending: { ...it, [G]: { ...be, id: G } }, + order: ye.order.map((Qe) => Qe === Q ? G : Qe), + activeId: ye.activeId === Q ? G : ye.activeId }); } } @@ -14391,21 +14413,21 @@ function joe(e) { const G = R.get(V); if (G) return G; const Q = (async () => { - V.phase = "closing", _(V.id); - for (const we of V.leases.values()) we.revoke(); - const be = new kc(`closed while opening: ${V.id}`); - V.cancel.abort(be), V.engineOp?.abort(be), await V.operation?.catch((we) => { - !Rh(we) && !y1(we) && r(we); + V.phase = "closing", B(V.id); + for (const be of V.leases.values()) be.revoke(); + const ye = new Ac(`closed while opening: ${V.id}`); + V.cancel.abort(ye), V.engineOp?.abort(ye), await V.operation?.catch((be) => { + !Mh(be) && !y1(be) && r(be); }), await V.scope.destroy(), N.get(V.id) === V && N.delete(V.id), V.views.clear(), m.emit({ documentId: V.id }); })(); return R.set(V, Q), Q; } function F(V, G) { if (V.activeId !== G) return V.activeId; - const Q = V.order.indexOf(G), be = V.order.filter((we) => we !== G); - return be.length === 0 ? null : be[Math.max(0, Q - 1)] ?? be[0]; + const Q = V.order.indexOf(G), ye = V.order.filter((be) => be !== G); + return ye.length === 0 ? null : ye[Math.max(0, Q - 1)] ?? ye[0]; } - function B(V, G) { + function _(V, G) { const Q = o.getCore(); k({ pending: { @@ -14427,7 +14449,7 @@ function joe(e) { }), p.emit({ documentId: V.id, passwordProvided: G }); } function D(V, G) { - const Q = o.getCore(), be = Noe(G, V.grantInput); + const Q = o.getCore(), ye = Noe(G, V.grantInput); k({ pending: { ...Q.pending, @@ -14436,390 +14458,390 @@ function joe(e) { name: V.name, status: "error", error: G, - ...be ? { openRequest: be } : {} + ...ye ? { openRequest: ye } : {} } } }), g.emit({ documentId: V.id, - error: Br(qe("documents", G)) + error: Br(ze("documents", G)) }); } - function _(V) { + function B(V) { const G = o.getCore(); if (!G.pending[V] && !G.documents[V]) return; - const { [V]: Q, ...be } = G.pending, { [V]: we, ...ye } = G.documents; + const { [V]: Q, ...ye } = G.pending, { [V]: be, ...me } = G.documents; k({ - pending: be, - documents: ye, - order: G.order.filter((st) => st !== V), + pending: ye, + documents: me, + order: G.order.filter((it) => it !== V), activeId: F(G, V) }); } function L(V) { V.phase = "ready", V.pageView.refresh(); - const G = j(V.stagedMeta, V.pageView.current()), Q = o.getCore(), { [V.id]: be, ...we } = Q.pending; - k({ documents: { ...Q.documents, [V.id]: G }, pending: we }); - const ye = V.handle?.grant; - ye && (V.scope.defer( - ye.onIdentityRequested((st) => le(V, st)) - ), V.scope.defer(ye.onOpenRequested((st) => Y(V, st)))), h.emit({ documentId: V.id, info: g1(G) }); + const G = j(V.stagedMeta, V.pageView.current()), Q = o.getCore(), { [V.id]: ye, ...be } = Q.pending; + k({ documents: { ...Q.documents, [V.id]: G }, pending: be }); + const me = V.handle?.grant; + me && (V.scope.defer( + me.onIdentityRequested((it) => ie(V, it)) + ), V.scope.defer(me.onOpenRequested((it) => Y(V, it)))), h.emit({ documentId: V.id, info: g1(G) }); } function j(V, G) { - const { pages: Q, labels: be, pending: we } = G; - return V.pages === Q && V.pageLabels === be && V.pendingPages === we ? V : { + const { pages: Q, labels: ye, pending: be } = G; + return V.pages === Q && V.pageLabels === ye && V.pendingPages === be ? V : { ...V, pageCount: Q.length, pages: Q, - pageLabels: be, - pendingPages: we, + pageLabels: ye, + pendingPages: be, pagesSequence: V.pages === Q ? V.pagesSequence : V.pagesSequence + 1 }; } function H(V) { const G = V.pageView.refresh(); if (!G) return; - const Q = o.getCore(), be = Q.documents[V.id]; - if (!be) return; - const we = j(be, G); - we !== be && (k({ documents: { ...Q.documents, [V.id]: we } }), we.pages !== be.pages && S.emit({ + const Q = o.getCore(), ye = Q.documents[V.id]; + if (!ye) return; + const be = j(ye, G); + be !== ye && (k({ documents: { ...Q.documents, [V.id]: be } }), be.pages !== ye.pages && S.emit({ documentId: V.id, - pagesSequence: we.pagesSequence, - pages: we.pages + pagesSequence: be.pagesSequence, + pages: be.pages })); } function Y(V, G) { - const Q = o.getCore(), be = Q.documents[V.id]; - if (!be || (be.openRequest ?? null) === G) return; - const { openRequest: we, ...ye } = be; + const Q = o.getCore(), ye = Q.documents[V.id]; + if (!ye || (ye.openRequest ?? null) === G) return; + const { openRequest: be, ...me } = ye; k({ documents: { ...Q.documents, - [V.id]: G ? { ...ye, openRequest: G } : ye + [V.id]: G ? { ...me, openRequest: G } : me } }); } - async function ue(V, G) { - const Q = V.handle.grant, { passphrase: be, visitorIdentity: we } = G ?? {}; + async function le(V, G) { + const Q = V.handle.grant, { passphrase: ye, visitorIdentity: be } = G ?? {}; try { await Q.resume({ - ...be !== void 0 ? { passphrase: be } : {}, - ...we !== void 0 ? { visitorIdentity: we } : {} + ...ye !== void 0 ? { passphrase: ye } : {}, + ...be !== void 0 ? { visitorIdentity: be } : {} }); - } catch (ye) { - throw Y(V, Q.openRequest), qe("documents", ye); + } catch (me) { + throw Y(V, Q.openRequest), ze("documents", me); } - return Y(V, Q.openRequest), { document: fu(V.id) }; + return Y(V, Q.openRequest), { document: hu(V.id) }; } - function le(V, G) { - const Q = o.getCore(), be = Q.documents[V.id]; - if (!be || (be.identityRequest ?? null) === G) return; - const { identityRequest: we, ...ye } = be; + function ie(V, G) { + const Q = o.getCore(), ye = Q.documents[V.id]; + if (!ye || (ye.identityRequest ?? null) === G) return; + const { identityRequest: be, ...me } = ye; k({ documents: { ...Q.documents, - [V.id]: G ? { ...ye, identityRequest: G } : ye + [V.id]: G ? { ...me, identityRequest: G } : me } }); } async function pe(V, G) { - const Q = he(V, "identify"), be = Q.handle.grant; - if (!be) - throw new re("invalid-input", "documents", `${V} isn't from a grant`); + const Q = he(V, "identify"), ye = Q.handle.grant; + if (!ye) + throw new te("invalid-input", "documents", `${V} isn't from a grant`); try { - await be.identify(G); - } catch (we) { - const ye = h7(we); - throw ye && le(Q, ye), qe("documents", we); + await ye.identify(G); + } catch (be) { + const me = h7(be); + throw me && ie(Q, me), ze("documents", be); } - le(Q, be.identityRequest); + ie(Q, ye.identityRequest); } - function ge(V) { + function ve(V) { const G = he(V, "decline"); - G.handle.grant?.decline(), le(G, null); + G.handle.grant?.decline(), ie(G, null); } - function Me(V, G) { - const Q = o.getCore(), be = Q.documents[V.id]; - if (!be) { + function _e(V, G) { + const Q = o.getCore(), ye = Q.documents[V.id]; + if (!ye) { V.stagedMeta && V.stagedMeta.hasUnsavedChanges !== G && (V.stagedMeta = { ...V.stagedMeta, hasUnsavedChanges: G }); return; } - be.hasUnsavedChanges !== G && (k({ - documents: { ...Q.documents, [V.id]: { ...be, hasUnsavedChanges: G } } + ye.hasUnsavedChanges !== G && (k({ + documents: { ...Q.documents, [V.id]: { ...ye, hasUnsavedChanges: G } } }), C.emit({ documentId: V.id, hasUnsavedChanges: G })); } const Be = (V) => { const G = V ?? o.getCore().activeId; return G ? N.get(G) ?? null : null; - }, te = (V) => { + }, ee = (V) => { const G = Be(V); return G && (G.phase === "bringup" || G.phase === "ready") ? G.handle : null; }; function he(V, G) { const Q = Be(V); - if (!Q || !te(Q.id)) - throw new re("not-ready", "documents", `no open document to ${G}`); + if (!Q || !ee(Q.id)) + throw new te("not-ready", "documents", `no open document to ${G}`); return Q; } const Te = (V, G) => { - const Q = te(V); + const Q = ee(V); return Q ? fN(Q.security, G) : !1; }; - async function ze(V, G, Q, be, we) { - const ye = he(V, Q); - if (!Te(ye.id, "doc.download")) + async function We(V, G, Q, ye, be) { + const me = he(V, Q); + if (!Te(me.id, "doc.download")) throw hN("documents", "doc.download", `documents.${Q}`); - const st = we?.(ye.handle); - if (st) throw st; + const it = be?.(me.handle); + if (it) throw it; try { - await fB(ye.settleFlushes, [G, ye.signal], r); - const Qe = te(ye.id); - if (!Qe) throw new re("not-ready", "documents", `no open document to ${Q}`); - let At = -1; - const Nn = () => (At = ye.changeCount, Th("documents", G, be(Qe))), mt = await cB(ye.downloadWraps, Nn); - return At === ye.changeCount && Me(ye, !1), mt; + await fB(me.settleFlushes, [G, me.signal], r); + const Qe = ee(me.id); + if (!Qe) throw new te("not-ready", "documents", `no open document to ${Q}`); + let St = -1; + const Nn = () => (St = me.changeCount, Id("documents", G, ye(Qe))), mt = await cB(me.downloadWraps, Nn); + return St === me.changeCount && _e(me, !1), mt; } catch (Qe) { - throw qe("documents", Qe); + throw ze("documents", Qe); } } - const ae = e.printer ?? null, me = (V) => ae !== null && Te(V, "doc.print"), W = (V) => me(V) ? Te(V, "doc.print.high") ? (Te(V, "doc.download") || Te(V, "doc.download.flattened")) && ae?.stagePdf ? _oe : m1 : Boe : null; + const ae = e.printer ?? null, ge = (V) => ae !== null && Te(V, "doc.print"), W = (V) => ge(V) ? Te(V, "doc.print.high") ? (Te(V, "doc.download") || Te(V, "doc.download.flattened")) && ae?.stagePdf ? _oe : m1 : Boe : null; function Se(V, G) { - const Q = Ao(V.id)?.pages ?? nC; + const Q = So(V.id)?.pages ?? nC; if (G === void 0) return Q; if (G.length === 0) - throw new re("invalid-input", "documents", "a print needs at least one page"); - const be = G.map((we) => { - const ye = bS(Q, we); - if (!ye) - throw new re( + throw new te("invalid-input", "documents", "a print needs at least one page"); + const ye = G.map((be) => { + const me = bS(Q, be); + if (!me) + throw new te( "not-found", "documents", - `page ${we.objectNumber} is not in this document` + `page ${be.objectNumber} is not in this document` ); - return ye; + return me; }); - if (new Set(be).size !== be.length) - throw new re("invalid-input", "documents", "a print names a page twice"); - return be; + if (new Set(ye).size !== ye.length) + throw new te("invalid-input", "documents", "a print names a page twice"); + return ye; } const Ae = (V, G) => ({ includeAnnotations: G.includeAnnotations ?? Te(V, "doc.annotate.read"), includeFormFields: Te(V, "doc.forms.read") }); - async function ce(V, G, Q, be) { - const { signal: we } = be; - await fB(V.settleFlushes, [we, V.signal], r); - const ye = te(V.id); - if (!ye) throw new re("not-ready", "documents", "no open document to print"); - const st = V.changesSeen, Qe = { - handle: ye, - pages: Se(V, be.pages), - layers: Ae(V.id, be), + async function ce(V, G, Q, ye) { + const { signal: be } = ye; + await fB(V.settleFlushes, [be, V.signal], r); + const me = ee(V.id); + if (!me) throw new te("not-ready", "documents", "no open document to print"); + const it = V.changesSeen, Qe = { + handle: me, + pages: Se(V, ye.pages), + layers: Ae(V.id, ye), name: V.name ?? "document", - options: be + options: ye }; - if (be.onProgress?.({ pagesRendered: 0, pageCount: Qe.pages.length }), Q.kind === "images") - return { staged: await K(Qe, G, Q.dpi), quality: Q, changesSeen: st }; + if (ye.onProgress?.({ pagesRendered: 0, pageCount: Qe.pages.length }), Q.kind === "images") + return { staged: await K(Qe, G, Q.dpi), quality: Q, changesSeen: it }; try { - return { staged: await Ne(Qe, G), quality: Q, changesSeen: st }; - } catch (At) { - if (we?.aborted) throw At; - return { staged: await K(Qe, G, m1.dpi), quality: m1, changesSeen: st }; + return { staged: await Ne(Qe, G), quality: Q, changesSeen: it }; + } catch (St) { + if (be?.aborted) throw St; + return { staged: await K(Qe, G, m1.dpi), quality: m1, changesSeen: it }; } } async function Ne(V, G) { - const { handle: Q, pages: be, layers: we, name: ye, options: st } = V, { signal: Qe } = st; + const { handle: Q, pages: ye, layers: be, name: me, options: it } = V, { signal: Qe } = it; if (!G.stagePdf) - throw new re("unsupported", "documents", "this printer prints no PDF"); - const At = await Th( + throw new te("unsupported", "documents", "this printer prints no PDF"); + const St = await Id( "documents", Qe, Q.pages.extract( - be.map((mt) => mt.ref), - { flatten: { usage: "print" }, ...we } + ye.map((mt) => mt.ref), + { flatten: { usage: "print" }, ...be } ) - ), Nn = await G.stagePdf(At, { name: ye, ...Qe ? { signal: Qe } : {} }); - return st.onProgress?.({ pagesRendered: be.length, pageCount: be.length }), Nn; + ), Nn = await G.stagePdf(St, { name: me, ...Qe ? { signal: Qe } : {} }); + return it.onProgress?.({ pagesRendered: ye.length, pageCount: ye.length }), Nn; } async function K(V, G, Q) { - const { handle: be, pages: we, layers: ye, name: st, options: Qe } = V, { signal: At } = Qe, Nn = []; - for (const mt of we) { - const On = await Th( + const { handle: ye, pages: be, layers: me, name: it, options: Qe } = V, { signal: St } = Qe, Nn = []; + for (const mt of be) { + const On = await Id( "documents", - At, - be.page(mt.ref).render.image({ + St, + ye.page(mt.ref).render.image({ usage: "print", viewport: { kind: "dpi", dpi: Q }, format: "png", - ...ye + ...me }) - ), Zn = await Th("documents", At, On.blob()); - Nn.push({ image: Zn, widthPt: mt.size.width, heightPt: mt.size.height }), Qe.onProgress?.({ pagesRendered: Nn.length, pageCount: we.length }); + ), er = await Id("documents", St, On.blob()); + Nn.push({ image: er, widthPt: mt.size.width, heightPt: mt.size.height }), Qe.onProgress?.({ pagesRendered: Nn.length, pageCount: be.length }); } - return G.stage(Nn, { name: st, ...At ? { signal: At } : {} }); + return G.stage(Nn, { name: it, ...St ? { signal: St } : {} }); } async function U(V, G = {}) { const Q = he(V, "preparePrint"); if (!Te(Q.id, "doc.print")) throw hN("documents", "doc.print", "documents.preparePrint"); - const be = W(Q.id); - if (!ae || !be) - throw new re( + const ye = W(Q.id); + if (!ae || !ye) + throw new te( "unsupported", "documents", "no printer: pass one to createKernel({ printer }), such as browserPrinter() from @embedpdf/web" ); - const we = Se(Q, G.pages).length; + const be = Se(Q, G.pages).length; try { let { - staged: ye, - changesSeen: st, + staged: me, + changesSeen: it, quality: Qe - } = await ce(Q, ae, be, G), At = !1; + } = await ce(Q, ae, ye, G), St = !1; const Nn = () => { - At || (At = !0, ye.destroy()); + St || (St = !0, me.destroy()); }; Q.scope.defer(Nn); - const mt = async (On, Zn) => { - const sc = await ce(Q, ae, On, { + const mt = async (On, er) => { + const ic = await ce(Q, ae, On, { ...G.pages ? { pages: G.pages } : {}, ...G.includeAnnotations !== void 0 ? { includeAnnotations: G.includeAnnotations } : {}, - ...Zn ? { signal: Zn } : {} + ...er ? { signal: er } : {} }); - ye.destroy(), { staged: ye, changesSeen: st, quality: Qe } = sc; + me.destroy(), { staged: me, changesSeen: it, quality: Qe } = ic; }; return { get quality() { return Qe; }, - pageCount: we, + pageCount: be, needsTap: ae.needsTap === !0, async print(On) { - if (At) - throw new re("invalid-input", "documents", "this print was disposed"); - const Zn = On?.signal, sc = async () => { - if (Q.changesSeen !== st && await mt(be, Zn), Zn?.aborted) - throw new re("operation-cancelled", "documents", "print cancelled", { - cause: Zn.reason + if (St) + throw new te("invalid-input", "documents", "this print was disposed"); + const er = On?.signal, ic = async () => { + if (Q.changesSeen !== it && await mt(ye, er), er?.aborted) + throw new te("operation-cancelled", "documents", "print cancelled", { + cause: er.reason }); try { - await ye.print(); - } catch (ic) { - if (Qe.kind !== "pdf") throw ic; - await mt(m1, Zn), await ye.print(); + await me.print(); + } catch (ac) { + if (Qe.kind !== "pdf") throw ac; + await mt(m1, er), await me.print(); } }; try { - await cB(Q.printWraps, sc); - } catch (ic) { - throw qe("documents", ic); + await cB(Q.printWraps, ic); + } catch (ac) { + throw ze("documents", ac); } }, destroy: Nn }; - } catch (ye) { - throw qe("documents", ye); + } catch (me) { + throw ze("documents", me); } } - const Z = (V, G) => G.building.has(V) && !G.capabilities.has(V); - function ne(V, G) { + const X = (V, G) => G.building.has(V) && !G.capabilities.has(V); + function re(V, G) { let Q = G.capabilities.get(V); if (!Q) { if (G.building.has(V)) - throw new re( + throw new te( "not-ready", V.id, `"${V.id}" was asked for while it is being created` ); - const be = uB(He, V, G, G.signal, G.scope); + const ye = uB(rt, V, G, G.signal, G.scope); G.building.add(V); - let we; + let be; try { - we = V.create(be); + be = V.create(ye); } finally { G.building.delete(V); } - const { api: ye, connect: st } = we; - Q = ye, G.connectors.set(V, () => { - st?.(), lB(be); + const { api: me, connect: it } = be; + Q = me, G.connectors.set(V, () => { + it?.(), lB(ye); }), G.capabilities.set(V, Q); } return Q; } function xe(V, G, Q) { - const be = f.get(V), we = Q === void 0 ? void 0 : N.get(Q); - if (!be || !we) return G; - let ye = we.views.get(V); - return ye === void 0 && (ye = be(G, we.id), we.views.set(V, ye)), ye; + const ye = d.get(V), be = Q === void 0 ? void 0 : N.get(Q); + if (!ye || !be) return G; + let me = be.views.get(V); + return me === void 0 && (me = ye(G, be.id), be.views.set(V, me)), me; } - function _e(V, G) { + function Le(V, G) { A(`capability("${V.name}")`); const Q = a.get(V); if (Q) return xe(V, Q, G); - const be = s.providerOf(V); - if (!be) throw new Error(`No capability "${V.name}".`); - const we = G ?? o.getCore().activeId; - if (!we) throw new Error(`Capability "${V.name}" requires an active document.`); - const ye = N.get(we); - if (!ye) throw new Error(`Capability "${V.name}" unavailable: no document "${we}".`); - if (ye.phase === "bringup" || ye.phase === "ready") - return ne(be, ye); - const st = ye.phase === "opening" ? "loading" : ye.phase; - throw new Error(`Capability "${V.name}" unavailable: document "${we}" is ${st}.`); + const ye = s.providerOf(V); + if (!ye) throw new Error(`No capability "${V.name}".`); + const be = G ?? o.getCore().activeId; + if (!be) throw new Error(`Capability "${V.name}" requires an active document.`); + const me = N.get(be); + if (!me) throw new Error(`Capability "${V.name}" unavailable: no document "${be}".`); + if (me.phase === "bringup" || me.phase === "ready") + return re(ye, me); + const it = me.phase === "opening" ? "loading" : me.phase; + throw new Error(`Capability "${V.name}" unavailable: document "${be}" is ${it}.`); } function Ie(V, G) { if (w === "destroying" || w === "destroyed") return null; const Q = a.get(V); if (Q) return xe(V, Q, G); - const be = s.providerOf(V); - if (!be) return null; - const we = Be(G); - return !we || we.phase !== "bringup" && we.phase !== "ready" || Z(be, we) ? null : ne(be, we); + const ye = s.providerOf(V); + if (!ye) return null; + const be = Be(G); + return !be || be.phase !== "bringup" && be.phase !== "ready" || X(ye, be) ? null : re(ye, be); } - function Le(V, G) { + function De(V, G) { if (w === "destroying" || w === "destroyed") return null; const Q = a.get(V); if (Q) return xe(V, Q, G); - const be = s.providerOf(V); - if (!be) return null; - const we = Be(G); - return !we || we.phase !== "ready" || Z(be, we) ? null : ne(be, we); + const ye = s.providerOf(V); + if (!ye) return null; + const be = Be(G); + return !be || be.phase !== "ready" || X(ye, be) ? null : re(ye, be); } - const X = hB( + const qe = hB( { defaults: mN, registered: e.settings, whole: xoe }, o.notify, r ); - d.defer(() => X.destroy()); - const ie = /* @__PURE__ */ new Map(); + f.defer(() => qe.destroy()); + const Me = /* @__PURE__ */ new Map(); for (const V of s.ordered) - V.settings && ie.set(V, hB(V.settings, o.notify, r)); - d.defer(() => { - for (const V of ie.values()) V.destroy(); + V.settings && Me.set(V, hB(V.settings, o.notify, r)); + f.defer(() => { + for (const V of Me.values()) V.destroy(); }); - function Fe(V) { + function It(V) { const G = s.providerOf(V); if (!G) throw new Error(`No capability "${V.name}".`); - const Q = ie.get(G); + const Q = Me.get(G); if (!Q) throw new Error(`Plugin "${G.id}" has no settings.`); return Q.api; } - const He = { + const rt = { engine: t, store: o, - workspaceScope: d, + workspaceScope: f, workspaceSignal: u.signal, workspaceLeases: c, report: r, clock: e.clock ?? ioe, measurer: e.measurer ?? null, - resolveCapability: _e, + resolveCapability: Le, tryResolveCapability: Ie, - documentHandle: te, - settingsStoreOf: (V) => ie.get(V) + documentHandle: ee, + settingsStoreOf: (V) => Me.get(V) }; - let ut = 0; - const $e = () => `pending:${++ut}`; - async function gt(V, G) { + let Z = 0; + const fe = () => `pending:${++Z}`; + async function Fe(V, G) { V.phase = "bringup"; let Q = za; try { @@ -14838,25 +14860,25 @@ function joe(e) { renderPolicy: Q, hasUnsavedChanges: !1 }; - const be = UE(V.handle), we = Wre(o); - V.scope.defer(we.close); - let ye = 0, st = 0; + const ye = UE(V.handle), be = Wre(o); + V.scope.defer(be.close); + let me = 0, it = 0; const Qe = () => { - const mt = ye, On = ++st; + const mt = me, On = ++it; V.handle.pages.list().then( - (Zn) => { - V.cancel.signal.aborted || ye !== mt || st !== On || (V.pageView.setEnginePages(Zn), H(V)); + (er) => { + V.cancel.signal.aborted || me !== mt || it !== On || (V.pageView.setEnginePages(er), H(V)); }, - (Zn) => { - V.cancel.signal.aborted || r(Zn); + (er) => { + V.cancel.signal.aborted || r(er); } ); - }, At = V.handle.events.subscribe((mt) => { - we.first(mt), Poe(mt) && (V.changesSeen += 1, be && (V.changeCount += 1, Me(V, !0))); + }, St = V.handle.events.subscribe((mt) => { + be.first(mt), Poe(mt) && (V.changesSeen += 1, ye && (V.changeCount += 1, _e(V, !0))); const On = Zre(mt); - On && (ye += 1, V.pageView.setEnginePages(On)), mt.type === "stream.desynced" && Qe(), V.pageView.fold(mt), H(V); + On && (me += 1, V.pageView.setEnginePages(On)), mt.type === "stream.desynced" && Qe(), V.pageView.fold(mt), H(V); }); - V.scope.defer(At); + V.scope.defer(St); for (const mt of i) { const On = o.lease( oU(mt.id, V.id), @@ -14868,108 +14890,108 @@ function joe(e) { const Nn = o.hold(); try { for (const mt of i) - ne(mt, V), V.connectors.get(mt)?.(); + re(mt, V), V.connectors.get(mt)?.(); } finally { Nn(); } - V.scope.defer(V.handle.events.subscribe((mt) => we.last(mt))), b(V); + V.scope.defer(V.handle.events.subscribe((mt) => be.last(mt))), b(V); } - function qt(V) { + function ht(V) { const G = o.getCore(), Q = G.documents[V.id] ?? G.pending[V.id]; - if (!Q) throw new re("instance-closed", "documents", `${V.id} was closed`); + if (!Q) throw new te("instance-closed", "documents", `${V.id} was closed`); return { document: g1(Q) }; } - async function $t(V, G, Q) { - const be = G?.signal; - if (be?.aborted) - throw new re("operation-cancelled", "documents", "the open was cancelled"); + async function At(V, G, Q) { + const ye = G?.signal; + if (ye?.aborted) + throw new te("operation-cancelled", "documents", "the open was cancelled"); try { - const { session: we, done: ye } = pn(V, G, Q), st = () => void we.close(); - be?.addEventListener("abort", st, { once: !0 }); + const { session: be, done: me } = $t(V, G, Q), it = () => void be.close(); + ye?.addEventListener("abort", it, { once: !0 }); try { - return qt(await ye); + return ht(await me); } finally { - be?.removeEventListener("abort", st); + ye?.removeEventListener("abort", it); } - } catch (we) { - throw qe("documents", we); + } catch (be) { + throw ze("documents", be); } } - function nn(V) { - const { activate: G, name: Q, signal: be, ...we } = V ?? {}, ye = X.api.getSettings(), st = we.scope ?? ye.scope ?? void 0, Qe = we.identity ?? ye.identity ?? void 0; + function Nt(V) { + const { activate: G, name: Q, signal: ye, ...be } = V ?? {}, me = qe.api.getSettings(), it = be.scope ?? me.scope ?? void 0, Qe = be.identity ?? me.identity ?? void 0; return { - ...we, - ...st !== void 0 ? { scope: st } : {}, + ...be, + ...it !== void 0 ? { scope: it } : {}, ...Qe !== void 0 ? { identity: Qe } : {} }; } - function pn(V, G, Q) { + function $t(V, G, Q) { A("documents.open()"); - const be = nn(G), we = Q ?? (typeof V == "function" ? $e() : rC(V) ?? $e()); - if (N.has(we)) - throw new re("conflict", "documents", `document already open: ${we}`); - const ye = I(we, G?.name); - ye.source = V, ye.openOptions = G, N.set(ye.id, ye), B(ye, G?.activate ?? !0); - const st = O(ye, async () => { + const ye = Nt(G), be = Q ?? (typeof V == "function" ? fe() : rC(V) ?? fe()); + if (N.has(be)) + throw new te("conflict", "documents", `document already open: ${be}`); + const me = I(be, G?.name); + me.source = V, me.openOptions = G, N.set(me.id, me), _(me, G?.activate ?? !0); + const it = O(me, async () => { try { - const Qe = typeof V == "function" ? await E(ye, Promise.resolve(V(ye.cancel.signal))) : V; - b(ye); - const At = Moe(Qe) ? await E(ye, Toe(Qe, ye.cancel.signal, e.fetch)) : Qe; - b(ye), ye.grantInput = At.kind === "grant" ? At : null; - const Nn = rC(At); - Nn && T(ye, Nn); + const Qe = typeof V == "function" ? await E(me, Promise.resolve(V(me.cancel.signal))) : V; + b(me); + const St = Moe(Qe) ? await E(me, Toe(Qe, me.cancel.signal, e.fetch)) : Qe; + b(me), me.grantInput = St.kind === "grant" ? St : null; + const Nn = rC(St); + Nn && T(me, Nn); const mt = await E( - ye, - t.open(At, be), - (sc) => sc.close() + me, + t.open(St, ye), + (ic) => ic.close() ); - ye.handle = mt, ye.scope.defer(() => mt.close()), b(ye), mt.id !== ye.id && T(ye, mt.id); + me.handle = mt, me.scope.defer(() => mt.close()), b(me), mt.id !== me.id && T(me, mt.id); const On = mt.security?.passwordPrompt; if (On?.state === "required") - return ye.phase = "locked", $(ye, On.incorrect), ye; - const Zn = await E(ye, mt.pages.list()); - return b(ye), await gt(ye, Zn), L(ye), ye; + return me.phase = "locked", $(me, On.incorrect), me; + const er = await E(me, mt.pages.list()); + return b(me), await Fe(me, er), L(me), me; } catch (Qe) { - throw Rh(Qe) ? Qe : ye.phase === "closing" || y1(Qe) ? new kc(`closed while opening: ${ye.id}`) : (await ye.scope.destroy(), ye.phase = "error", D(ye, Qe), Qe); + throw Mh(Qe) ? Qe : me.phase === "closing" || y1(Qe) ? new Ac(`closed while opening: ${me.id}`) : (await me.scope.destroy(), me.phase = "error", D(me, Qe), Qe); } }); - return { session: ye, done: st }; + return { session: me, done: it }; } - async function Jo(V, G) { + async function Fr(V, G) { A("documents.unlock()"); const Q = N.get(V); if (!Q || Q.phase !== "locked" || !Q.handle) - throw new re("invalid-input", "documents", `document is not locked: ${V}`); - const be = Q.handle; + throw new te("invalid-input", "documents", `document is not locked: ${V}`); + const ye = Q.handle; return O(Q, async () => { try { - await Th( + await Id( "documents", G.signal, - E(Q, be.security.unlock({ password: G.password })) + E(Q, ye.security.unlock({ password: G.password })) ); - } catch (we) { - throw Q.phase === "closing" || y1(we) ? new kc(`closed while opening: ${Q.id}`) : we; + } catch (be) { + throw Q.phase === "closing" || y1(be) ? new Ac(`closed while opening: ${Q.id}`) : be; } b(Q); try { - const we = await E(Q, be.pages.list()); - b(Q), await gt(Q, we), L(Q); - } catch (we) { - throw Rh(we) ? we : Q.phase === "closing" || y1(we) ? new kc(`closed while opening: ${Q.id}`) : (await Q.scope.destroy(), Q.phase = "error", D(Q, we), we); + const be = await E(Q, ye.pages.list()); + b(Q), await Fe(Q, be), L(Q); + } catch (be) { + throw Mh(be) ? be : Q.phase === "closing" || y1(be) ? new Ac(`closed while opening: ${Q.id}`) : (await Q.scope.destroy(), Q.phase = "error", D(Q, be), be); } - }).catch((we) => { - throw qe("documents", we); + }).catch((be) => { + throw ze("documents", be); }); } - async function Ym(V) { + async function sc(V) { const G = N.get(V); G && await G.close(); } - function du(V) { + function fu(V) { k({ order: V }); } - const Ao = (V) => { + const So = (V) => { const G = o.getCore(), Q = V ?? G.activeId; return Q ? G.documents[Q] ?? null : null; }; @@ -14977,30 +14999,30 @@ function joe(e) { const Mi = () => { const V = o.getCore(); if (kr?.core === V) return kr.value; - const G = V.order.map((ye) => g1(V.documents[ye] ?? V.pending[ye])), Q = kr?.value, we = Q !== void 0 && Q.length === G.length && Q.every((ye, st) => ye === G[st]) ? Q : Object.freeze(G); - return kr = { core: V, value: we }, we; - }, fu = (V) => { - const G = o.getCore(), Q = V ?? G.activeId, be = Q ? G.documents[Q] ?? G.pending[Q] : void 0; - return be ? g1(be) : null; + const G = V.order.map((me) => g1(V.documents[me] ?? V.pending[me])), Q = kr?.value, be = Q !== void 0 && Q.length === G.length && Q.every((me, it) => me === G[it]) ? Q : Object.freeze(G); + return kr = { core: V, value: be }, be; + }, hu = (V) => { + const G = o.getCore(), Q = V ?? G.activeId, ye = Q ? G.documents[Q] ?? G.pending[Q] : void 0; + return ye ? g1(ye) : null; }, Qm = { - open: $t, + open: At, // A file's bytes are the engine's to take or refuse: it says which. canOpenFiles: () => t.canOpenFiles, retry: async (V, G) => { const Q = N.get(V); if (Q?.phase === "ready" && Q.handle?.grant?.openRequest) - return ue(Q, G); + return le(Q, G); if (!Q || Q.phase !== "error" || Q.source === null) - throw new re( + throw new te( "invalid-input", "documents", `${V} didn't fail to open; nothing to retry` ); - const { source: be, grantInput: we, openOptions: ye } = Q, st = Ooe(be, we, G), Qe = G?.visitorIdentity !== void 0 ? { ...nn(ye).identity, ...G.visitorIdentity } : void 0; - return N.delete(V), $t( - st, + const { source: ye, grantInput: be, openOptions: me } = Q, it = Ooe(ye, be, G), Qe = G?.visitorIdentity !== void 0 ? { ...Nt(me).identity, ...G.visitorIdentity } : void 0; + return N.delete(V), At( + it, { - ...ye, + ...me, ...Qe !== void 0 ? { identity: Qe } : {}, activate: !1, signal: G?.signal @@ -15009,12 +15031,12 @@ function joe(e) { ); }, identify: pe, - declineIdentity: ge, + declineIdentity: ve, rename: (V, G) => { const Q = o.getCore(); Q.documents[V] ? k({ documents: { ...Q.documents, [V]: { ...Q.documents[V], name: G } } }) : Q.pending[V] && k({ pending: { ...Q.pending, [V]: { ...Q.pending[V], name: G } } }); - const be = N.get(V); - be && (be.name = G); + const ye = N.get(V); + ye && (ye.name = G); }, openAll: (V) => { A("documents.openAll()"); @@ -15022,32 +15044,32 @@ function joe(e) { 0, V.findIndex((Q) => Q.active) ); - return V.map(({ source: Q, active: be, ...we }, ye) => { + return V.map(({ source: Q, active: ye, ...be }, me) => { try { - const { session: st, done: Qe } = pn(Q, { - ...we, - activate: ye === G + const { session: it, done: Qe } = $t(Q, { + ...be, + activate: me === G }); return Qe.catch(() => { - }), st.id; + }), it.id; } catch { return typeof Q == "function" ? "" : rC(Q) ?? ""; } }); }, - unlock: Jo, - close: Ym, + unlock: Fr, + close: sc, closeAll: async () => { - for (const V of [...o.getCore().order]) await Ym(V); + for (const V of [...o.getCore().order]) await sc(V); }, setActive: (V) => { const G = o.getCore(); (G.documents[V] || G.pending[V]) && k({ activeId: V }); }, getActiveId: () => o.getCore().activeId, - getActive: () => fu(), + getActive: () => hu(), list: Mi, - get: fu, + get: hu, has: (V) => { const G = o.getCore(); return G.documents[V] !== void 0 || G.pending[V] !== void 0; @@ -15057,33 +15079,33 @@ function joe(e) { setOrder: (V) => { const G = o.getCore().order; if (!(V.length === G.length && [...V].sort().join("\0") === [...G].sort().join("\0"))) - throw new re( + throw new te( "invalid-input", "documents", "setOrder() needs a permutation of the current order" ); - du([...V]); + fu([...V]); }, move: (V, G) => { const Q = o.getCore(); if (!Q.documents[V] && !Q.pending[V]) return; - const be = Q.order.filter((ye) => ye !== V), we = Math.max(0, Math.min(G, be.length)); - be.splice(we, 0, V), du(be); + const ye = Q.order.filter((me) => me !== V), be = Math.max(0, Math.min(G, ye.length)); + ye.splice(be, 0, V), fu(ye); }, swap: (V, G) => { - const Q = o.getCore(), be = Q.order.indexOf(V), we = Q.order.indexOf(G); - if (be < 0 || we < 0) return; - const ye = [...Q.order]; - ye[be] = G, ye[we] = V, du(ye); + const Q = o.getCore(), ye = Q.order.indexOf(V), be = Q.order.indexOf(G); + if (ye < 0 || be < 0) return; + const me = [...Q.order]; + me[ye] = G, me[be] = V, fu(me); }, // Reading the file: download() and downloadLayer() (downloadFile above). - download: (V, G) => ze( + download: (V, G) => We( V, G?.signal, "download", (Q) => Q.download(G?.mode !== void 0 ? { mode: G.mode } : void 0) ), - downloadLayer: (V, G) => ze( + downloadLayer: (V, G) => We( V, G?.signal, "downloadLayer", @@ -15104,12 +15126,12 @@ function joe(e) { getPrintQuality: (V) => W(V), // The verbs that need them live here, so their checks do too (permissions.md). canDownload: (V) => Te(V, "doc.download"), - canPrint: (V) => me(V), + canPrint: (V) => ge(V), // The page registry, addressed by PageRef (durable) or display index. - listPages: (V) => Ao(V)?.pages ?? nC, - getPage: (V, G) => bS(Ao(G)?.pages ?? nC, V), - getPageIndex: (V, G) => Ao(G)?.pages.findIndex((Q) => Vf(Q.ref, V)) ?? -1, - getRevision: (V) => Ao(V)?.pagesSequence ?? -1, + listPages: (V) => So(V)?.pages ?? nC, + getPage: (V, G) => bS(So(G)?.pages ?? nC, V), + getPageIndex: (V, G) => So(G)?.pages.findIndex((Q) => Uf(Q.ref, V)) ?? -1, + getRevision: (V) => So(V)?.pagesSequence ?? -1, onOpened: h.on, onOpenFailed: g.on, onLocked: p.on, @@ -15118,30 +15140,30 @@ function joe(e) { onPagesChanged: S.on, onUnsavedChangesChanged: C.on }; - a.set(It, Qm); + a.set(Pt, Qm); for (const V of s.ordered) ly(V) || c.set(V, o.lease(V.id, pB(V))); for (const V of s.ordered) { if (ly(V)) continue; const G = uB( - He, + rt, V, void 0, u.signal, - d - ), { api: Q, connect: be } = V.create(G); + f + ), { api: Q, connect: ye } = V.create(G); V.token && a.set(V.token, Q), l.set(V, () => { - be?.(), lB(G); + ye?.(), lB(G); }); } return { - ...X.api, + ...qe.api, engine: t, documents: Qm, - capability: _e, - tryCapability: Le, + capability: Le, + tryCapability: De, scopeOf: s.scopeOf, - settingsOf: Fe, + settingsOf: It, subscribe: o.subscribe, getState: o.getState, getStatus: () => w, @@ -15154,18 +15176,18 @@ function joe(e) { } w = "started"; } catch (V) { - throw w = "failed", await d.destroy(), a.clear(), V; + throw w = "failed", await f.destroy(), a.clear(), V; } })()), destroy: () => x ?? (x = (async () => { const V = w === "failed"; - w = "destroying", u.abort(new kc("kernel destroyed")), await y?.catch((G) => { - !Rh(G) && !V && r(G); - }), await Promise.allSettled([...N.values()].map((G) => G.close())), N.clear(), await d.destroy(), a.clear(), o.destroy(), w = "destroyed"; + w = "destroying", u.abort(new Ac("kernel destroyed")), await y?.catch((G) => { + !Mh(G) && !V && r(G); + }), await Promise.allSettled([...N.values()].map((G) => G.close())), N.clear(), await f.destroy(), a.clear(), o.destroy(), w = "destroyed"; })()) }; } -function tu(e, t) { +function nu(e, t) { const n = /* @__PURE__ */ new Set(), r = {}; for (const o of t) for (const s of Object.keys(o)) { @@ -15227,10 +15249,10 @@ const yB = Object.freeze({ error: void 0, openRequest: void 0, identityRequest: void 0 -}), bB = wr(It, { +}), bB = wr(Pt, { read: (e) => e.get() ?? yB, empty: yB -}), wB = wr(It, { +}), wB = wr(Pt, { read: (e) => ({ documents: e.list(), activeId: e.getActiveId() @@ -15256,7 +15278,7 @@ function Koe(e, t) { return r || (r = Hoe(t, () => e.settingsOf(t)), n.set(t, r)), r; } function Hoe(e, t) { - const n = () => new re("not-ready", e.name, "no document is open"), r = (a) => () => { + const n = () => new te("not-ready", e.name, "no document is open"), r = (a) => () => { if ($oe(e, a)) return Promise.reject(n()); throw n(); }, o = (a) => (...c) => { @@ -15271,11 +15293,11 @@ function Hoe(e, t) { if (typeof c == "symbol" || c === "then" || c.startsWith("__")) return; const l = a ? `${a}.${c}` : c; let u = s.get(l); - return u || (u = !a && Uoe.has(c) ? o(c) : new Proxy(r(l), { get: (d, f) => i(l, f) }), s.set(l, u)), u; + return u || (u = !a && Uoe.has(c) ? o(c) : new Proxy(r(l), { get: (f, d) => i(l, d) }), s.set(l, u)), u; }; return new Proxy({}, { get: (a, c) => i("", c) }); } -function sn(e, t) { +function an(e, t) { return { name: e, hint: t?.hint, @@ -15423,9 +15445,9 @@ async function ese(e, t, n, r, o) { const l = a.contentWindow, u = a.contentDocument; if (!l || !u) throw new Error("the print frame did not load"); u.title = n; - const d = u.createElement("style"); - return d.textContent = `html, body { margin: 0; padding: 0; height: 100%; } -${s}`, u.head.append(d), u.body.append(...lU(u, t, i)), await fU(Array.from(u.querySelectorAll("img")), o), { + const f = u.createElement("style"); + return f.textContent = `html, body { margin: 0; padding: 0; height: 100%; } +${s}`, u.head.append(f), u.body.append(...lU(u, t, i)), await fU(Array.from(u.querySelectorAll("img")), o), { print: () => dU(l), destroy: () => { a.remove(), r(); @@ -15655,20 +15677,20 @@ function H6(e) { function bN(e) { return H6(e).filter((t) => t.tabIndex >= 0); } -function Gr(e) { +function Jr(e) { let t = e.activeElement; for (; t?.shadowRoot?.activeElement; ) t = t.shadowRoot.activeElement; return t === e.body ? null : t; } -function dg(e) { - let t = Gr(e.ownerDocument); +function fg(e) { + let t = Jr(e.ownerDocument); for (; t; ) { if (t === e) return !0; t = t.assignedSlot ?? t.parentNode ?? t.host ?? null; } return !1; } -function fg(e) { +function hg(e) { return bU.has(e.tagName) && e.disabled ? !0 : e.getAttribute("aria-disabled") === "true"; } const dse = /* @__PURE__ */ new Set(["", "text", "search", "url", "tel", "email", "password"]), fse = /* @__PURE__ */ new Set([ @@ -15707,7 +15729,7 @@ function wS(e) { } const gse = 150; function mse(e, t = {}) { - const n = t.target ?? document, r = n.ownerDocument ?? n, o = () => n === r || dg(n), s = t.prefetch ?? !0; + const n = t.target ?? document, r = n.ownerDocument ?? n, o = () => n === r || fg(n), s = t.prefetch ?? !0; let i = null, a = 0, c = null; const l = () => { if (i = null, !s || !e.hasSelection() || !e.canCopy()) return; @@ -15722,26 +15744,26 @@ function mse(e, t = {}) { ); }, u = e.onCommitted(() => { c && clearTimeout(c), c = null, l(); - }), d = e.onChanged(() => { + }), f = e.onChanged(() => { a++, i = null, c && clearTimeout(c), c = setTimeout(l, gse); - }), f = () => e.hasSelection() && !e.canCopy(), h = (m) => { + }), d = () => e.hasSelection() && !e.canCopy(), h = (m) => { m.preventDefault(), t.onRefused?.(); }, g = (m) => { if (!(!o() || wS(m))) { - if (f()) return h(m); + if (d()) return h(m); i == null || i === "" || !e.hasSelection() || (m.clipboardData?.setData("text/plain", i), m.preventDefault()); } }, p = (m) => { if (!(m.metaKey || m.ctrlKey) || m.key.toLowerCase() !== "c" || m.shiftKey || m.altKey || // A command shortcut for the same key took it already. m.defaultPrevented || !o() || wS(m)) return; - if (f()) return h(m); + if (d()) return h(m); if (!e.hasSelection() || !e.canCopy()) return; const v = yse(n); v && !v.isCollapsed || z6(e); }; return r.addEventListener("copy", g), r.addEventListener("keydown", p), () => { - u(), d(), c && clearTimeout(c), r.removeEventListener("copy", g), r.removeEventListener("keydown", p); + u(), f(), c && clearTimeout(c), r.removeEventListener("copy", g), r.removeEventListener("keydown", p); }; } function yse(e) { @@ -15780,8 +15802,8 @@ function bse(e, t, { placement: n, gap: r, pinned: o = !1 }, s) { if (!c) return null; const l = e.view(), u = Math.abs(r) + (s ? Math.max(s.size.width, s.size.height) : 0); if (l && !wse(c, l, u)) return null; - const d = t.avoid?.length ? e.toScreenPoint(t.page, t.avoid[0]) : null; - return s && !o ? kU(c, n, r, s, d) : Ase(c, n, r, d); + const f = t.avoid?.length ? e.toScreenPoint(t.page, t.avoid[0]) : null; + return s && !o ? kU(c, n, r, s, f) : Ase(c, n, r, f); } function wse(e, t, n) { return e.x - n < t.x + t.width && e.x + e.width + n > t.x && e.y - n < t.y + t.height && e.y + e.height + n > t.y; @@ -15870,19 +15892,19 @@ function kU(e, t, n, r, o) { const { side: p } = vS(g); return p === "top" ? e.y - i.y : p === "bottom" ? i.y + i.height - (e.y + e.height) : p === "left" ? e.x - i.x : i.x + i.width - (e.x + e.width); }; - let d = t, f = c(d); - if (!l(d, f)) { - const g = xse(d), p = c(g); - (l(g, p) || u(g) > u(d)) && (d = g, f = p); + let f = t, d = c(f); + if (!l(f, d)) { + const g = xse(f), p = c(g); + (l(g, p) || u(g) > u(f)) && (f = g, d = p); } if (e.x < i.x + i.width && e.x + e.width > i.x && e.y < i.y + i.height && e.y + e.height > i.y) { const g = (p, m, v) => Math.max(m, Math.min(p, v)); - f = { - x: g(f.x, a.left, a.right - s.width), - y: g(f.y, a.top, a.bottom - s.height) + d = { + x: g(d.x, a.left, a.right - s.width), + y: g(d.y, a.top, a.bottom - s.height) }; } - return { left: f.x, top: f.y, transform: "none", placement: d }; + return { left: d.x, top: d.y, transform: "none", placement: f }; } const AU = (e) => e ? `rotate(${e}deg)` : void 0; function kS(e, t) { @@ -16047,228 +16069,234 @@ function zk(e, t, n = 100) { return i < 10 ? null : { vx: (s.x - o.x) / i * 1e3, vy: (s.y - o.y) / i * 1e3 }; } function Dse(e, t, n) { - const r = n.zoomGestures ?? !0, o = n.wheelZoomFactor ?? Lse, s = n.sink ?? null, i = n.longPressMs ?? 450, a = n.tapSlopPx ?? 10, c = n.doubleTapMs ?? 300, l = 25, u = n.flingMinVelocity ?? 50, d = 20, f = 160, h = 0.12, g = /* @__PURE__ */ new Map(); - let p = "idle", m = !1, v = !1, S = !1, C = null, k = null, N = -1, w = !0, y = 0, x = { t: 0, x: 0, y: 0 }, A = -1 / 0, b = 0, E = !1, I = { x: 0, y: 0 }, O = 0, T = [], R = [], M = 0, F = 0, B = 0, $ = 0, D = 0, _ = 0, L = 0; - const j = (X) => { - const ie = Date.now(); - return L = ie - $ <= 400 && Math.hypot(X.clientX - D, X.clientY - _) <= 6 ? L + 1 : 1, $ = ie, D = X.clientX, _ = X.clientY, L; - }, H = (X, ie) => { + const r = n.zoomGestures ?? !0, o = n.wheelZoomFactor ?? Lse, s = n.sink ?? null, i = n.longPressMs ?? 450, a = n.tapSlopPx ?? 10, c = n.doubleTapMs ?? 300, l = 25, u = n.flingMinVelocity ?? 50, f = 20, d = 160, h = 0.12, g = /* @__PURE__ */ new Map(); + let p = "idle", m = !1, v = !1, S = !1, C = null, k = null, N = -1, w = !0, y = 0, x = { t: 0, x: 0, y: 0 }, A = -1 / 0, b = !1, E = 0, I = !1, O = { x: 0, y: 0 }, T = 0, R = [], M = [], F = 0, _ = 0, $ = 0, D = 0, B = 0, L = 0, j = 0; + const H = (Z) => { + const fe = Date.now(); + return j = fe - D <= 400 && Math.hypot(Z.clientX - B, Z.clientY - L) <= 6 ? j + 1 : 1, D = fe, B = Z.clientX, L = Z.clientY, j; + }, Y = (Z, fe) => { const Fe = e.getBoundingClientRect(); - return { x: X - Fe.left, y: ie - Fe.top }; - }, Y = () => { - const X = []; - return g.forEach((ie) => { - ie.kind === "touch" && X.push(ie); - }), X; - }, ue = () => { - k !== null && (clearTimeout(k), k = null); + return { x: Z - Fe.left, y: fe - Fe.top }; }, le = () => { - b && (cancelAnimationFrame(b), b = 0); - }, pe = (X = !1) => { - m || (m = !0, t.beginGesture(X ? { elastic: !0 } : void 0)); - }, ge = () => { + const Z = []; + return g.forEach((fe) => { + fe.kind === "touch" && Z.push(fe); + }), Z; + }, ie = () => { + k !== null && (clearTimeout(k), k = null); + }, pe = () => { + E && (cancelAnimationFrame(E), E = 0); + }, ve = (Z = !1) => { + m || (m = !0, t.beginGesture(Z ? { elastic: !0 } : void 0)); + }, _e = () => { m && (m = !1, t.endGesture()); - }, Me = () => { - p = "idle", C = null, S = !1, T = [], R = [], E = !1, N = -1, w = !0, y = 0, ue(), le(); - }, Be = (X, ie) => { - T.push({ t: performance.now(), x: X, y: ie }), T.length > 16 && T.shift(); - }, te = () => { - const X = zk(T, performance.now()); - X && Math.hypot(X.vx, X.vy) >= u && t.fling(X.vx, X.vy); - }, he = (X, ie) => { - const Fe = X - I.x, He = ie - I.y; - (Fe !== 0 || He !== 0) && t.panBy(Fe, He), I = { x: X, y: ie }, E = !1; - }, Te = (X, ie, Fe, He) => { - const ut = (X + Fe) / 2, $e = (ie + He) / 2, gt = Math.hypot(X - Fe, ie - He), qt = ut - I.x, $t = $e - I.y; - (qt !== 0 || $t !== 0) && t.panBy(qt, $t), r && gt > d && O > d && gt !== O && t.zoomAround(H(ut, $e), gt / O), Be(ut, $e), R.push({ t: performance.now(), x: gt, y: 0 }), R.length > 16 && R.shift(), I = { x: ut, y: $e }, O = gt, E = !1; - }, ze = () => { - if (b = 0, p === "pan" || p === "mousedrag") { - const X = g.get(N); - X && E && he(X.x, X.y), b = requestAnimationFrame(ze); + }, Be = () => { + p = "idle", C = null, S = !1, R = [], M = [], I = !1, N = -1, w = !0, y = 0, ie(), pe(); + }, ee = (Z, fe) => { + R.push({ t: performance.now(), x: Z, y: fe }), R.length > 16 && R.shift(); + }, he = () => { + const Z = zk(R, performance.now()); + Z && Math.hypot(Z.vx, Z.vy) >= u && t.fling(Z.vx, Z.vy); + }, Te = (Z, fe) => { + const Fe = Z - O.x, ht = fe - O.y; + (Fe !== 0 || ht !== 0) && t.panBy(Fe, ht), O = { x: Z, y: fe }, I = !1; + }, We = (Z, fe, Fe, ht) => { + const At = (Z + Fe) / 2, Nt = (fe + ht) / 2, $t = Math.hypot(Z - Fe, fe - ht), Fr = At - O.x, sc = Nt - O.y; + (Fr !== 0 || sc !== 0) && t.panBy(Fr, sc), r && $t > f && T > f && $t !== T && t.zoomAround(Y(At, Nt), $t / T), ee(At, Nt), M.push({ t: performance.now(), x: $t, y: 0 }), M.length > 16 && M.shift(), O = { x: At, y: Nt }, T = $t, I = !1; + }, ae = () => { + if (E = 0, p === "pan" || p === "mousedrag") { + const Z = g.get(N); + Z && I && Te(Z.x, Z.y), E = requestAnimationFrame(ae); } else if (p === "pinch") { - const [X, ie] = Y(); - X && ie && E && Te(X.x, X.y, ie.x, ie.y), b = requestAnimationFrame(ze); + const [Z, fe] = le(); + Z && fe && I && We(Z.x, Z.y, fe.x, fe.y), E = requestAnimationFrame(ae); } - }, ae = () => { - b || (b = requestAnimationFrame(ze)); - }, me = () => { - const [X, ie] = Y(); - !X || !ie || (p = "pinch", I = { x: (X.x + ie.x) / 2, y: (X.y + ie.y) / 2 }, O = Math.hypot(X.x - ie.x, X.y - ie.y), T = [], E = !1, ae()); + }, ge = () => { + E || (E = requestAnimationFrame(ae)); }, W = () => { - k = null, !(p !== "pending" || !C || !s) && (ge(), p = "tool", S = !0, s.longPress(C)); - }, Se = (X) => { - const ie = X.pointerType || "mouse"; - if (ie === "touch" && (A = performance.now()), ie !== "touch") { - if (ie === "mouse" && X.button !== 0 || p !== "idle") return; - g.set(X.pointerId, { - id: X.pointerId, - kind: ie, - x: X.clientX, - y: X.clientY, - downX: X.clientX, - downY: X.clientY - }), s ? (p = "tool", s.down(X, j(X))) : (p = "mousedrag", pe(), N = X.pointerId, I = { x: X.clientX, y: X.clientY }, ae()); + const [Z, fe] = le(); + !Z || !fe || (p = "pinch", O = { x: (Z.x + fe.x) / 2, y: (Z.y + fe.y) / 2 }, T = Math.hypot(Z.x - fe.x, Z.y - fe.y), R = [], I = !1, ge()); + }, Se = () => { + k = null, !(p !== "pending" || !C || !s) && (_e(), p = "tool", S = !0, s.longPress(C)); + }, Ae = (Z) => { + const fe = Z.pointerType || "mouse"; + if (fe === "touch" && (A = performance.now()), fe !== "touch") { + if (fe === "mouse" && Z.button !== 0 || p !== "idle") return; + g.set(Z.pointerId, { + id: Z.pointerId, + kind: fe, + x: Z.clientX, + y: Z.clientY, + downX: Z.clientX, + downY: Z.clientY + }), s ? (p = "tool", b = !1, s.down(Z, H(Z))) : (p = "mousedrag", ve(), N = Z.pointerId, O = { x: Z.clientX, y: Z.clientY }, ge()); return; } switch (p) { case "idle": { - g.set(X.pointerId, { - id: X.pointerId, - kind: ie, - x: X.clientX, - y: X.clientY, - downX: X.clientX, - downY: X.clientY + g.set(Z.pointerId, { + id: Z.pointerId, + kind: fe, + x: Z.clientX, + y: Z.clientY, + downX: Z.clientX, + downY: Z.clientY }); const Fe = t.isMoving(); - if (!Fe && s?.claimsPoint?.(X)) { - p = "tool", S = !0, s.down(X, 1); + if (!Fe && s?.claimsPoint?.(Z)) { + p = "tool", S = !0, s.down(Z, 1); break; } - p = "pending", C = X, v = Fe, pe(!0), T = [], Be(X.clientX, X.clientY), ue(), s && !v && (k = setTimeout(W, i)); + p = "pending", C = Z, v = Fe, ve(!0), R = [], ee(Z.clientX, Z.clientY), ie(), s && !v && (k = setTimeout(Se, i)); break; } case "pending": case "pan": { - g.set(X.pointerId, { - id: X.pointerId, - kind: ie, - x: X.clientX, - y: X.clientY, - downX: X.clientX, - downY: X.clientY - }), ue(), me(); + g.set(Z.pointerId, { + id: Z.pointerId, + kind: fe, + x: Z.clientX, + y: Z.clientY, + downX: Z.clientX, + downY: Z.clientY + }), ie(), W(); break; } case "tool": { if (!S) return; - s?.cancel(X), S = !1, g.set(X.pointerId, { - id: X.pointerId, - kind: ie, - x: X.clientX, - y: X.clientY, - downX: X.clientX, - downY: X.clientY - }), pe(!0), me(); + s?.cancel(Z), S = !1, g.set(Z.pointerId, { + id: Z.pointerId, + kind: fe, + x: Z.clientX, + y: Z.clientY, + downX: Z.clientX, + downY: Z.clientY + }), ve(!0), W(); break; } case "pinch": case "mousedrag": return; } - }, Ae = (X) => { - const ie = g.get(X.pointerId); - if (ie) - switch (ie.kind === "touch" && (A = performance.now()), ie.x = X.clientX, ie.y = X.clientY, p) { + }, ce = (Z) => { + const fe = g.get(Z.pointerId); + if (fe) + switch (fe.kind === "touch" && (A = performance.now()), fe.x = Z.clientX, fe.y = Z.clientY, p) { case "pending": { - Be(ie.x, ie.y), Math.hypot(ie.x - ie.downX, ie.y - ie.downY) > a && (ue(), p = "pan", N = ie.id, I = { x: ie.x, y: ie.y }, ae()); + ee(fe.x, fe.y), Math.hypot(fe.x - fe.downX, fe.y - fe.downY) > a && (ie(), p = "pan", N = fe.id, O = { x: fe.x, y: fe.y }, ge()); break; } case "pan": - if (ie.id !== N) break; + if (fe.id !== N) break; if (!w) { const Fe = performance.now(); if (Fe < y) { - const He = Fe - x.t; - if (He >= 8) { - const ut = Math.hypot(ie.x - x.x, ie.y - x.y) / He; - x = { t: Fe, x: ie.x, y: ie.y }, ut < h && (y = 0); + const ht = Fe - x.t; + if (ht >= 8) { + const At = Math.hypot(fe.x - x.x, fe.y - x.y) / ht; + x = { t: Fe, x: fe.x, y: fe.y }, At < h && (y = 0); } - ie.downX = ie.x, ie.downY = ie.y; + fe.downX = fe.x, fe.downY = fe.y; break; } - if (Math.hypot(ie.x - ie.downX, ie.y - ie.downY) <= a) break; - w = !0, I = { x: ie.x, y: ie.y }, T = [], R = []; + if (Math.hypot(fe.x - fe.downX, fe.y - fe.downY) <= a) break; + w = !0, O = { x: fe.x, y: fe.y }, R = [], M = []; } - Be(ie.x, ie.y), E = !0; + ee(fe.x, fe.y), I = !0; break; case "pinch": - E = !0; + I = !0; break; case "tool": - s?.move(X); + s?.move(Z); break; case "mousedrag": - ie.id === N && (E = !0); + fe.id === N && (I = !0); break; } - }, ce = (X) => { - p === "idle" && s && s.hover(X); - }, Ne = () => { - const X = Y(); - return X.length !== 1 ? !1 : (p = "pan", N = X[0].id, w = !1, y = performance.now() + f, x = { t: performance.now(), x: X[0].x, y: X[0].y }, X[0].downX = X[0].x, X[0].downY = X[0].y, I = { x: X[0].x, y: X[0].y }, T = [], E = !1, !0); - }, K = (X) => { - const ie = g.get(X.pointerId); - if (ie) - switch (ie.kind === "touch" && (A = performance.now()), g.delete(X.pointerId), p) { + }, Ne = (Z) => { + p === "idle" && s && s.hover(Z); + }, K = (Z) => { + Z.pointerType !== "touch" && (p === "idle" ? s?.leave?.(Z) : p === "tool" && g.has(Z.pointerId) && (b = !0)); + }, U = (Z) => { + p === "tool" && g.has(Z.pointerId) && (b = !1); + }, X = (Z) => { + b && (b = !1, s?.leave?.(Z)); + }, re = () => { + const Z = le(); + return Z.length !== 1 ? !1 : (p = "pan", N = Z[0].id, w = !1, y = performance.now() + d, x = { t: performance.now(), x: Z[0].x, y: Z[0].y }, Z[0].downX = Z[0].x, Z[0].downY = Z[0].y, O = { x: Z[0].x, y: Z[0].y }, R = [], I = !1, !0); + }, xe = (Z) => { + const fe = g.get(Z.pointerId); + if (fe) + switch (fe.kind === "touch" && (A = performance.now()), g.delete(Z.pointerId), p) { case "pending": { - ue(), ge(); - const Fe = performance.now(), He = Fe - M <= c && Math.hypot(X.clientX - F, X.clientY - B) <= l; - v ? M = 0 : r && He ? (M = 0, t.doubleTapZoom(H(X.clientX, X.clientY))) : (M = Fe, F = X.clientX, B = X.clientY, s && C && (s.down(C, 1), s.up(X))), Me(); + ie(), _e(); + const Fe = performance.now(), ht = Fe - F <= c && Math.hypot(Z.clientX - _, Z.clientY - $) <= l; + v ? F = 0 : r && ht ? (F = 0, t.doubleTapZoom(Y(Z.clientX, Z.clientY))) : (F = Fe, _ = Z.clientX, $ = Z.clientY, s && C && (s.down(C, 1), s.up(Z))), Be(); break; } case "pan": { if (!w) { - const Fe = performance.now(), He = zk(T, Fe), ut = zk(R, Fe); - if (ge(), He) { - const $e = Math.hypot(He.vx, He.vy); - $e >= u && $e > Math.abs(ut?.vx ?? 0) && t.fling(He.vx, He.vy); + const Fe = performance.now(), ht = zk(R, Fe), At = zk(M, Fe); + if (_e(), ht) { + const Nt = Math.hypot(ht.vx, ht.vy); + Nt >= u && Nt > Math.abs(At?.vx ?? 0) && t.fling(ht.vx, ht.vy); } - Me(); + Be(); break; } - he(X.clientX, X.clientY), Be(X.clientX, X.clientY), ge(), te(), Me(); + Te(Z.clientX, Z.clientY), ee(Z.clientX, Z.clientY), _e(), he(), Be(); break; } case "pinch": { - const Fe = Y(); + const Fe = le(); if (Fe.length === 1) { - p = "pan", N = Fe[0].id, w = !1, y = performance.now() + f, x = { t: performance.now(), x: Fe[0].x, y: Fe[0].y }, Fe[0].downX = Fe[0].x, Fe[0].downY = Fe[0].y, I = { x: Fe[0].x, y: Fe[0].y }, E = !1; + p = "pan", N = Fe[0].id, w = !1, y = performance.now() + d, x = { t: performance.now(), x: Fe[0].x, y: Fe[0].y }, Fe[0].downX = Fe[0].x, Fe[0].downY = Fe[0].y, O = { x: Fe[0].x, y: Fe[0].y }, I = !1; break; } - ge(), te(), Me(); + _e(), he(), Be(); break; } case "tool": { - s?.up(X), Me(); + s?.up(Z), Be(), X(Z); break; } case "mousedrag": { - if (ie.id !== N) break; - he(X.clientX, X.clientY), ge(), Me(); + if (fe.id !== N) break; + Te(Z.clientX, Z.clientY), _e(), Be(); break; } } - }, U = (X) => { - if (g.get(X.pointerId)) { - if (g.delete(X.pointerId), p === "tool") { - s?.cancel(X), Me(); + }, Le = (Z) => { + if (g.get(Z.pointerId)) { + if (g.delete(Z.pointerId), p === "tool") { + s?.cancel(Z), Be(), X(Z); return; } - p === "pinch" && Ne() || (ge(), Me()); + p === "pinch" && re() || (_e(), Be()); } - }, Z = (X, ie, Fe) => t.wheelBy ? t.wheelBy(X, ie, Fe) : (t.panBy(X, ie), !0), ne = (X) => { - if (!X.cancelable) return; - const ie = X.ctrlKey || X.metaKey; - if (ie && r) { - X.preventDefault(), t.zoomAround(H(X.clientX, X.clientY), o(X)); + }, Ie = (Z, fe, Fe) => t.wheelBy ? t.wheelBy(Z, fe, Fe) : (t.panBy(Z, fe), !0), De = (Z) => { + if (!Z.cancelable) return; + const fe = Z.ctrlKey || Z.metaKey; + if (fe && r) { + Z.preventDefault(), t.zoomAround(Y(Z.clientX, Z.clientY), o(Z)); return; } - const Fe = X.shiftKey ? X.deltaY : X.deltaX, He = X.shiftKey ? X.deltaX : X.deltaY; - (Z(-Fe, -He, X.timeStamp) || ie) && X.preventDefault(); + const Fe = Z.shiftKey ? Z.deltaY : Z.deltaX, ht = Z.shiftKey ? Z.deltaX : Z.deltaY; + (Ie(-Fe, -ht, Z.timeStamp) || fe) && Z.preventDefault(); }; - let xe = 1; - const _e = (X) => { - X.preventDefault(), xe = X.scale ?? 1; - }, Ie = (X) => { - if (X.preventDefault(), Y().length > 0 || performance.now() - A < 500) return; - const ie = X, Fe = ie.scale ?? 1; - r && Fe > 0 && t.zoomAround(H(ie.clientX, ie.clientY), Fe / xe), xe = Fe; + let qe = 1; + const Me = (Z) => { + Z.preventDefault(), qe = Z.scale ?? 1; + }, It = (Z) => { + if (Z.preventDefault(), le().length > 0 || performance.now() - A < 500) return; + const fe = Z, Fe = fe.scale ?? 1; + r && Fe > 0 && t.zoomAround(Y(fe.clientX, fe.clientY), Fe / qe), qe = Fe; }; - e.addEventListener("pointerdown", Se), e.addEventListener("pointermove", ce), window.addEventListener("pointermove", Ae), window.addEventListener("pointerup", K), window.addEventListener("pointercancel", U), e.addEventListener("wheel", ne, { passive: !1 }); - const Le = "GestureEvent" in window; - return Le && (e.addEventListener("gesturestart", _e), e.addEventListener("gesturechange", Ie), e.addEventListener("gestureend", _e)), () => { - e.removeEventListener("pointerdown", Se), e.removeEventListener("pointermove", ce), window.removeEventListener("pointermove", Ae), window.removeEventListener("pointerup", K), window.removeEventListener("pointercancel", U), e.removeEventListener("wheel", ne), Le && (e.removeEventListener("gesturestart", _e), e.removeEventListener("gesturechange", Ie), e.removeEventListener("gestureend", _e)), ue(), le(), ge(); + e.addEventListener("pointerdown", Ae), e.addEventListener("pointermove", Ne), e.addEventListener("pointerleave", K), e.addEventListener("pointerenter", U), window.addEventListener("pointermove", ce), window.addEventListener("pointerup", xe), window.addEventListener("pointercancel", Le), e.addEventListener("wheel", De, { passive: !1 }); + const rt = "GestureEvent" in window; + return rt && (e.addEventListener("gesturestart", Me), e.addEventListener("gesturechange", It), e.addEventListener("gestureend", Me)), () => { + e.removeEventListener("pointerdown", Ae), e.removeEventListener("pointermove", Ne), e.removeEventListener("pointerleave", K), e.removeEventListener("pointerenter", U), window.removeEventListener("pointermove", ce), window.removeEventListener("pointerup", xe), window.removeEventListener("pointercancel", Le), e.removeEventListener("wheel", De), rt && (e.removeEventListener("gesturestart", Me), e.removeEventListener("gesturechange", It), e.removeEventListener("gestureend", Me)), ie(), pe(), _e(); }; } function jse(e, t) { @@ -16336,19 +16364,22 @@ function Fse(e, t, n = {}) { ...m ? { gesture: m } : {}, ...n.source ? { source: n.source } : {} }; - }, d = (h, g, p = 1, m) => { + }, f = (h, g, p = 1, m) => { r?.dispatchPointer(u(h, g, p, m)); - }, f = r ? { - down: (h, g) => d("down", h, g), - move: (h) => d("move", h), - up: (h) => d("up", h), - cancel: (h) => d("cancel", h), - hover: (h) => d("move", h), + }, d = r ? { + down: (h, g) => f("down", h, g), + move: (h) => f("move", h), + up: (h) => f("up", h), + cancel: (h) => f("cancel", h), + hover: (h) => f("move", h), // no owner → the hub routes to onHover + // A hover over no page, whatever a hit test where the pointer left finds: + // a page can reach past the surface's edge, clipped from view. + leave: (h) => r.dispatchPointer({ ...u("move", h), page: void 0 }), // Touch long-press = a word-select down (clickCount 2 keeps the // word-selection contract; the `gesture` marker is the honest // long-press signal for haptics/pickup handlers). - longPress: (h) => d("down", h, 2, "long-press"), + longPress: (h) => f("down", h, 2, "long-press"), // Touch consent: an armed drawing/markup tool takes fingers wholesale; // otherwise per-point claims (a selected annotation's body or handles) // decide. A pure pre-flight — nothing captures. @@ -16358,7 +16389,7 @@ function Fse(e, t, n = {}) { Dse(e, t, { zoomGestures: n.zoomGestures, wheelZoomFactor: n.wheelZoomFactor, - sink: f + sink: d }) ), () => { for (const h of o) h(); @@ -16516,7 +16547,7 @@ function Yse(e, t, n, r) { } t.color !== void 0 && (e.color = t.color), t.script !== void 0 && t.script !== "normal" ? (e.verticalAlign = t.script, e.fontSize = "0.66em") : t.size !== void 0 && (e.fontSize = `${t.size * n}px`), PU(t) && (e.fontFamily = r.cssFontFamily(OU(t, r.body))), t.letterSpacing !== void 0 && (e.letterSpacing = `${t.letterSpacing * n}px`); } -function pu(e, t) { +function gu(e, t) { return { ...e, ...t }; } function RU(e, t) { @@ -16540,13 +16571,13 @@ function Qse(e, t, n) { a.align && (c.style.textAlign = a.align), a.dir && (c.style.direction = a.dir); let l = !1; for (const u of a.runs) { - let d = c; - u.style && Object.keys(u.style).length && (d = o.createElement("span"), Yse(d.style, u.style, n.scale, r), d.dataset && (d.dataset.family = u.style.family ?? ""), c.appendChild(d)); - const f = u.text.split(/\r\n|\r|\n/); - for (let h = 0; h < f.length; h++) { - h > 0 && (d.appendChild(o.createElement("br")), l = !0); - const g = f[h]; - g && (d.appendChild(o.createTextNode(g)), l = !1); + let f = c; + u.style && Object.keys(u.style).length && (f = o.createElement("span"), Yse(f.style, u.style, n.scale, r), f.dataset && (f.dataset.family = u.style.family ?? ""), c.appendChild(f)); + const d = u.text.split(/\r\n|\r|\n/); + for (let h = 0; h < d.length; h++) { + h > 0 && (f.appendChild(o.createElement("br")), l = !0); + const g = d[h]; + g && (f.appendChild(o.createTextNode(g)), l = !1); } } (l || !CU(c)) && c.appendChild(o.createElement("br")), s.push(c); @@ -16609,13 +16640,13 @@ function vN(e, t, n) { } const r = e.nodeName.toUpperCase(); let o = t; - (r === "B" || r === "STRONG") && (o = pu(o, { weight: 700 })), (r === "I" || r === "EM") && (o = pu(o, { italic: !0 })), r === "U" && (o = pu(o, { decoration: ["underline"] })), r === "SUB" && (o = pu(o, { script: "sub" })), r === "SUP" && (o = pu(o, { script: "super" })); + (r === "B" || r === "STRONG") && (o = gu(o, { weight: 700 })), (r === "I" || r === "EM") && (o = gu(o, { italic: !0 })), r === "U" && (o = gu(o, { decoration: ["underline"] })), r === "SUB" && (o = gu(o, { script: "sub" })), r === "SUP" && (o = gu(o, { script: "super" })); const s = e.dataset?.family, i = s !== void 0; - if (o = pu( + if (o = gu( o, NU(e.style, n.scale, i ? () => { } : n.familyOfCss) - ), s && (o = pu(o, { family: s })), Xx(e)) { + ), s && (o = gu(o, { family: s })), Xx(e)) { const a = { runs: [] }, c = e.style?.textAlign; (c === "left" || c === "center" || c === "right" || c === "justify") && (a.align = c), e.style?.direction === "rtl" && (a.dir = "rtl"), n.paragraphs.push(a), n.current = a; for (let l = 0; l < e.childNodes.length; l++) vN(e.childNodes[l], o, n); @@ -16741,8 +16772,8 @@ function oie(e, t, n) { } return A.rangeCount > 0 ? A.getRangeAt(0) : null; }; - let c = n, l = null, u = !1, d = []; - const f = 64, h = () => { + let c = n, l = null, u = !1, f = []; + const d = 64, h = () => { const A = a(); if (!A) return null; const b = A.startContainer, E = A.endContainer; @@ -16771,24 +16802,24 @@ function oie(e, t, n) { weight: A.fontWeight || "400", style: A.fontStyle || "normal" }, E = parseFloat(A.fontSize || "16") || 16, I = /* @__PURE__ */ new Map(), O = ($) => t.familyOfCss?.($) ?? $, T = ($) => (D) => { - const _ = JSON.stringify([D, $.weight, $.style]); - return I.has(_) || I.set(_, G6(D, o, $)), I.get(_); + const B = JSON.stringify([D, $.weight, $.style]); + return I.has(B) || I.set(B, G6(D, o, $)), I.get(B); }, R = Array.from(e.querySelectorAll("span, b, strong, i, em")).map( ($) => { - const D = o.defaultView?.getComputedStyle($) ?? $.style, _ = { + const D = o.defaultView?.getComputedStyle($) ?? $.style, B = { family: D.fontFamily || b.family, weight: D.fontWeight || b.weight, style: D.fontStyle || b.style }; return { node: $, - lineHeight: wN(_.family, T(_), O).lineHeight + lineHeight: wN(B.family, T(B), O).lineHeight }; } - ), M = T(b), F = wN(b.family, M, O).lineHeight, B = zse(b.family, E, M, O); + ), M = T(b), F = wN(b.family, M, O).lineHeight, _ = zse(b.family, E, M, O); e.style.lineHeight = String(F); for (const $ of R) $.node.style.lineHeight = String($.lineHeight); - Xse(r, B); + Xse(r, _); }, m = (A, b) => { const E = b ? h() : null; Qse(r, A, { @@ -16805,7 +16836,7 @@ function oie(e, t, n) { ); l = A; const b = t.onInput(A); - b && !sC(b, A) && m(b, !0), d.push(l), d.length > f && d.shift(); + b && !sC(b, A) && m(b, !0), f.push(l), f.length > d && f.shift(); }, S = () => { u || v(); }, C = () => { @@ -16829,11 +16860,11 @@ function oie(e, t, n) { update(A) { const b = A.scale !== c.scale; if (c = A, u) return; - const E = d.findIndex((O) => sC(A.document, O)); - E >= 0 && (d = d.slice(E + 1)); + const E = f.findIndex((O) => sC(A.document, O)); + E >= 0 && (f = f.slice(E + 1)); const I = E < 0 && (!l || !sC(A.document, l)); if (I || b) { - I && (d = []), m(I ? A.document : l, i() === e); + I && (f = []), m(I ? A.document : l, i() === e); return; } Zse(r, c.body ?? EU, (O) => t.cssFontFamily(O)), p(); @@ -16994,9 +17025,9 @@ const TB = { solid: "none", dashed: "4 3" }, mv = { "toolbar-active": { default: "rgb(0 0 0 / 0.12)" }, "font-mono": { default: "ui-monospace, monospace" } }; -function pt(e, t) { +function gt(e, t) { const n = mv[e], r = String(t), o = n.keywords?.[r] ?? r, s = n.accentPercent === void 0 ? n.follows : void 0; - return `var(--epdf-${e}, ${s ? pt(s, o) : o})`; + return `var(--epdf-${e}, ${s ? gt(s, o) : o})`; } const sie = new Map( Object.entries(mv).flatMap( @@ -17005,11 +17036,11 @@ const sie = new Map( ); function iie(e, t) { const n = e === void 0 ? void 0 : sie.get(e); - return n === void 0 ? String(t) : pt(n, t); + return n === void 0 ? String(t) : gt(n, t); } -function Lm(e, t) { +function Dm(e, t) { const { follows: n, accentPercent: r } = mv[e]; - return `color-mix(in srgb, ${pt(n, t)} ${r}%, transparent)`; + return `color-mix(in srgb, ${gt(n, t)} ${r}%, transparent)`; } function yv(e) { return `var(--epdf-${e}, ${mv[e].default})`; @@ -17017,18 +17048,18 @@ function yv(e) { const BU = "4 3"; function aie(e, t) { return { - fill: pt("zoom-box-fill", e.fill ?? Lm("zoom-box-fill", t)), - stroke: pt("zoom-box-stroke", e.stroke ?? t) + fill: gt("zoom-box-fill", e.fill ?? Dm("zoom-box-fill", t)), + stroke: gt("zoom-box-stroke", e.stroke ?? t) }; } const cie = BU; function lie(e, t) { return { - fill: pt("snapshot-box-fill", e.fill ?? Lm("snapshot-box-fill", t)), - stroke: pt("snapshot-box-stroke", e.stroke ?? t) + fill: gt("snapshot-box-fill", e.fill ?? Dm("snapshot-box-fill", t)), + stroke: gt("snapshot-box-stroke", e.stroke ?? t) }; } -function zo(e, t) { +function Wo(e, t) { const n = t.toPixels({ x: e.x, y: e.y }), r = t.toPixels({ x: e.x + e.width, y: e.y + e.height }); return { left: n.x, @@ -17204,7 +17235,7 @@ function vie(e) { return e.width <= 0 || e.height <= 0 ? null : `${e.x} ${e.y} ${e.width} ${e.height}`; } function Z6(e) { - return pt("ghost-opacity", e); + return gt("ghost-opacity", e); } const jU = 1; function kie(e) { @@ -17212,42 +17243,42 @@ function kie(e) { } function Aie(e, t) { const n = e.accent ?? t, r = { - strokeWidth: pt("annotation-guide-width", e.guides.width), - strokeDasharray: pt("annotation-guide-dash", e.guides.style) + strokeWidth: gt("annotation-guide-width", e.guides.width), + strokeDasharray: gt("annotation-guide-dash", e.guides.style) }; return { outline: { - stroke: pt("annotation-outline", e.outline.color ?? n), - strokeWidth: pt("annotation-outline-width", e.outline.width), - strokeDasharray: pt("annotation-outline-dash", e.outline.style) + stroke: gt("annotation-outline", e.outline.color ?? n), + strokeWidth: gt("annotation-outline-width", e.outline.width), + strokeDasharray: gt("annotation-outline-dash", e.outline.style) }, handle: { - fill: pt("annotation-handle-fill", e.handles.fill), - stroke: pt("annotation-handle-stroke", e.handles.stroke ?? n) + fill: gt("annotation-handle-fill", e.handles.fill), + stroke: gt("annotation-handle-stroke", e.handles.stroke ?? n) }, rotationHandle: { - fill: pt( + fill: gt( "annotation-rotation-handle-fill", e.rotationHandle.fill ?? e.handles.fill ), - stroke: pt( + stroke: gt( "annotation-rotation-handle-stroke", e.rotationHandle.stroke ?? e.handles.stroke ?? n ) }, - guide: { stroke: pt("annotation-guide", e.guides.color), ...r }, + guide: { stroke: gt("annotation-guide", e.guides.color), ...r }, rotationGuide: { - stroke: pt("annotation-rotation-guide", e.guides.rotationColor ?? n), + stroke: gt("annotation-rotation-guide", e.guides.rotationColor ?? n), ...r }, marquee: { - fill: pt( + fill: gt( "annotation-marquee-fill", - e.marquee.fill ?? Lm("annotation-marquee-fill", n) + e.marquee.fill ?? Dm("annotation-marquee-fill", n) ), - stroke: pt("annotation-marquee-stroke", e.marquee.stroke ?? n) + stroke: gt("annotation-marquee-stroke", e.marquee.stroke ?? n) }, - textOutline: pt("annotation-text-outline", e.textOutline ?? n) + textOutline: gt("annotation-text-outline", e.textOutline ?? n) }; } function Sie(e, t) { @@ -17286,9 +17317,9 @@ function Sie(e, t) { from: t.toPixels(n.from) }; case "marquee": - return { kind: "marquee", box: zo(n.rect, t) }; + return { kind: "marquee", box: Wo(n.rect, t) }; case "outline": - return { kind: "outline", box: zo(n.rect, t) }; + return { kind: "outline", box: Wo(n.rect, t) }; } }); } @@ -17352,7 +17383,7 @@ function Cie(e, t) { }; } function Iie(e, t, n) { - const r = zo(e.box, t), o = e.box.width > 0 ? r.width / e.box.width : 1, s = e.css.padding * o, i = Math.max(0, r.width - 2 * s), a = Math.max(0, r.height - 2 * s), c = FU(e.css.fontSize * o), l = o * c, u = e.rot ? `translate(${i / 2}px, ${a / 2}px) rotate(${e.rot}deg) translate(${-i / 2}px, ${-a / 2}px)` : null; + const r = Wo(e.box, t), o = e.box.width > 0 ? r.width / e.box.width : 1, s = e.css.padding * o, i = Math.max(0, r.width - 2 * s), a = Math.max(0, r.height - 2 * s), c = FU(e.css.fontSize * o), l = o * c, u = e.rot ? `translate(${i / 2}px, ${a / 2}px) rotate(${e.rot}deg) translate(${-i / 2}px, ${-a / 2}px)` : null; return { scale: l, style: { @@ -17386,7 +17417,7 @@ function Oie(e, t, n) { s || Wk.set(e, s = /* @__PURE__ */ new Map()); let i = s.get(o); if (!i) { - const c = o.id ?? `renderer:${++Nie}`, l = o.interactive, u = typeof l == "function" ? (d) => l({ annotation: d, toolId: n() }) : () => !0; + const c = o.id ?? `renderer:${++Nie}`, l = o.interactive, u = typeof l == "function" ? (f) => l({ annotation: f, toolId: n() }) : () => !0; i = { id: c, count: 0, @@ -17495,8 +17526,8 @@ function Lie(e, t, n, r) { const c = await t(o.signal), l = await Promise.all(c.map(a)); if (o.signal.aborted) return; const u = {}; - c.forEach((d, f) => { - u[n(d)] = { url: l[f], box: d.rect, version: d.version }; + c.forEach((f, d) => { + u[n(f)] = { url: l[d], box: f.rect, version: f.version }; }), r(u), e.replace(s), s = []; } catch { o.abort(), i(); @@ -17519,14 +17550,14 @@ function Die(e, t) { function jie(e, t) { const n = e.fields.required ?? null; return { - focus: pt("form-focus", e.focus.color ?? t), - border: pt( + focus: gt("form-focus", e.focus.color ?? t), + border: gt( "form-field-border", - e.fields.border ?? Lm("form-field-border", t) + e.fields.border ?? Dm("form-field-border", t) ), - background: pt("form-field-background", e.fields.background), - text: pt("form-field-color", e.fields.color), - required: n === null ? null : pt("form-field-required", n) + background: gt("form-field-background", e.fields.background), + text: gt("form-field-color", e.fields.color), + required: n === null ? null : gt("form-field-required", n) }; } function zU(e, t) { @@ -17540,7 +17571,7 @@ function Fie(e) { return e.required && e.kind === "checkbox"; } function nR(e) { - const t = pt("form-field-tint", e.strength), n = iie(e.setting, e.color); + const t = gt("form-field-tint", e.strength), n = iie(e.setting, e.color); return { fill: `color-mix(in srgb, ${n} calc(${t} * 100%), transparent)`, edge: n @@ -17551,7 +17582,7 @@ function Vie(e, t) { position: "absolute", inset: "0", boxSizing: "border-box", - boxShadow: `inset 0 0 0 1px ${pt("form-field-border", e.color ?? Lm("form-field-border", t))}`, + boxShadow: `inset 0 0 0 1px ${gt("form-field-border", e.color ?? Dm("form-field-border", t))}`, pointerEvents: "none" }; } @@ -17608,7 +17639,7 @@ function qU(e, t, n, r) { padding: e.multiline ? `${2 * n}px` : `0 ${2 * n}px`, overflow: "hidden", whiteSpace: "nowrap", - color: pt( + color: gt( "form-field-placeholder", r ?? mv["form-field-placeholder"].default ), @@ -17667,41 +17698,41 @@ function Gie(e, t, n) { } function Jie(e, t, n) { let r = { focused: !1, draft: n }, o = n, s = !1, i = !1, a = null; - const c = /* @__PURE__ */ new Set(), l = (d) => { - const f = { ...r, ...d }; - f.focused === r.focused && f.draft === r.draft || (r = f, c.forEach((h) => h())); - }, u = (d) => { - a = d; - const f = (h) => { - a === d && (a = null, r.focused || l({ draft: h ? d : o })); + const c = /* @__PURE__ */ new Set(), l = (f) => { + const d = { ...r, ...f }; + d.focused === r.focused && d.draft === r.draft || (r = d, c.forEach((h) => h())); + }, u = (f) => { + a = f; + const d = (h) => { + a === f && (a = null, r.focused || l({ draft: h ? f : o })); }; e.commitDraftText(t).then( - (h) => f(h?.status === "rejected"), - () => f(!1) + (h) => d(h?.status === "rejected"), + () => d(!1) ); }; return { getState: () => r, - subscribe(d) { - return c.add(d), () => c.delete(d); + subscribe(f) { + return c.add(f), () => c.delete(f); }, - setValue(d) { - o = d, !(r.focused || a !== null && d !== a) && (a = null, l({ draft: d })); + setValue(f) { + o = f, !(r.focused || a !== null && f !== a) && (a = null, l({ draft: f })); }, focus: () => l({ focused: !0 }), - input(d) { - i = !0, l({ draft: d }), e.draftText(t, d); + input(f) { + i = !0, l({ draft: f }), e.draftText(t, f); }, - keyDown(d, f) { - return d === "Escape" ? (s = !0, !0) : d === "Enter" && !f; + keyDown(f, d) { + return f === "Escape" ? (s = !0, !0) : f === "Enter" && !d; }, blur() { - const d = r.draft; - if (s || !i && d === o) { + const f = r.draft; + if (s || !i && f === o) { s = !1, i = !1, e.discardDraftText(t), l({ focused: !1, draft: o }); return; } - i = !1, u(d), l({ focused: !1, draft: d }); + i = !1, u(f), l({ focused: !1, draft: f }); } }; } @@ -17834,7 +17865,7 @@ function tae(e) { function nae(e, t, n) { return { link: e, - box: zo(e.bounds, t), + box: Wo(e.bounds, t), href: tae(e), label: n(e) }; @@ -17865,13 +17896,13 @@ function iae(e, t) { const i = r === t.active, a = i ? t.activeColor : t.color, c = `${r.start}:${s}`; if (!uie(o)) return { key: c, hit: r, active: i, fill: a, box: null, points: Q6(_U(o, n)) }; - const l = n.toPixels(o.upperLeft), u = n.toPixels(o.lowerRight), d = { + const l = n.toPixels(o.upperLeft), u = n.toPixels(o.lowerRight), f = { left: l.x, top: l.y, width: u.x - l.x, height: u.y - l.y }; - return { key: c, hit: r, active: i, fill: a, box: d, points: null }; + return { key: c, hit: r, active: i, fill: a, box: f, points: null }; }) ); } @@ -18042,10 +18073,10 @@ function gae(e) { pressTrack(i, a, c) { if (i.button !== 0 || i.target !== i.currentTarget) return; i.preventDefault(), i.stopPropagation(), UB(i.currentTarget, i.pointerId); - const l = r = A1(i, a), { layout: u, stage: d, vertical: f } = a; + const l = r = A1(i, a), { layout: u, stage: f, vertical: d } = a; if (c === "jump") { const m = u.travel > 0 ? $B((l - u.thumbLength / 2) / u.travel) * u.maxOffset : 0; - d.scrollTo(f ? { top: m } : { left: m }), s(u.thumbLength / 2, m, u); + f.scrollTo(d ? { top: m } : { left: m }), s(u.thumbLength / 2, m, u); return; } const h = l < u.thumbPosition ? -1 : 1, g = () => { @@ -18055,7 +18086,7 @@ function gae(e) { return; } const S = h * m.client * 0.9; - d.scrollBy(f ? { top: S } : { left: S }); + f.scrollBy(d ? { top: S } : { left: S }); }; g(), n = { timer: window.setTimeout(() => { n && (n.timer = window.setInterval(g, 80)); @@ -18081,7 +18112,7 @@ function mae(e, t) { o(), e.removeEventListener("pointermove", s), e.removeEventListener("pointerup", i), e.removeEventListener("pointercancel", i), n.release(); }; } -const ng = { +const rg = { /** A unit (`NormalizedUnit.key`) at one variant. */ unit: (e, t) => `u:${e}@${t}`, /** A group in its collapsed form. */ @@ -18104,10 +18135,10 @@ function yae() { metrics(t, n, r) { const o = e[t]; return { - unit: (s, i) => o.get(ng.unit(s, i)), - groupCollapsed: (s) => o.get(ng.group(s)), - groupTrigger: (s) => o.get(ng.groupTrigger(s)), - overflowTrigger: o.get(ng.overflowTrigger) ?? 32, + unit: (s, i) => o.get(rg.unit(s, i)), + groupCollapsed: (s) => o.get(rg.group(s)), + groupTrigger: (s) => o.get(rg.groupTrigger(s)), + overflowTrigger: o.get(rg.overflowTrigger) ?? 32, gap: n, separator: r + n }; @@ -18187,23 +18218,23 @@ function Aae(e, t) { const n = t.direction ?? (() => r2(e)), r = t.loop ?? !0; let o = null; const s = (l) => { - const d = o !== null && l.includes(o) && !fg(o) ? o : l.find((f) => !fg(f)) ?? null; - for (const f of l) { - const h = f === d ? 0 : -1; - f.tabIndex !== h && (f.tabIndex = h); + const f = o !== null && l.includes(o) && !hg(o) ? o : l.find((d) => !hg(d)) ?? null; + for (const d of l) { + const h = d === f ? 0 : -1; + d.tabIndex !== h && (d.tabIndex = h); } }, i = () => s(t.stops()), a = (l) => { if (l.defaultPrevented || l.altKey || l.ctrlKey || l.metaKey || l.shiftKey) return; - const u = t.stops(), d = l.target, f = u.indexOf(d); - if (f < 0 || pse(d, l.key)) return; + const u = t.stops(), f = l.target, d = u.indexOf(f); + if (d < 0 || pse(f, l.key)) return; const h = QU(l.key, t.orientation, n()); if (!h) return; const g = AN( h, - f, + d, u.length, - (m) => !fg(u[m]), + (m) => !hg(u[m]), r ); if (g < 0) return; @@ -18211,8 +18242,8 @@ function Aae(e, t) { const p = u[g]; o = p, s(u), p.focus(); }, c = (l) => { - const u = t.stops(), d = l.target; - u.includes(d) && (o = d, s(u)); + const u = t.stops(), f = l.target; + u.includes(f) && (o = f, s(u)); }; return e.addEventListener("keydown", a), e.addEventListener("focusin", c), i(), { refresh: i, @@ -18252,53 +18283,53 @@ function cR(e, t) { const { trigger: n, close: r } = t, o = t.items ?? (() => [...e.querySelectorAll(Cae)]); let s = "", i = Number.NEGATIVE_INFINITY; const a = () => { - const f = o(); - for (const h of f) h.tabIndex !== -1 && (h.tabIndex = -1); - return f; - }, c = (f) => (h) => !fg(f[h]), l = (f) => { - if (f.defaultPrevented || f.altKey || f.ctrlKey || f.metaKey) return; - const h = a(), g = h.indexOf(f.target); - if (f.key === "Escape") { - f.preventDefault(), f.stopPropagation(), r(), n?.focus(); + const d = o(); + for (const h of d) h.tabIndex !== -1 && (h.tabIndex = -1); + return d; + }, c = (d) => (h) => !hg(d[h]), l = (d) => { + if (d.defaultPrevented || d.altKey || d.ctrlKey || d.metaKey) return; + const h = a(), g = h.indexOf(d.target); + if (d.key === "Escape") { + d.preventDefault(), d.stopPropagation(), r(), n?.focus(); return; } - if (f.key === "Tab") { + if (d.key === "Tab") { r(), n?.focus(); return; } - if ((f.key === "Enter" || f.key === " " && s === "") && g >= 0) { - f.preventDefault(), fg(h[g]) || h[g].click(); + if ((d.key === "Enter" || d.key === " " && s === "") && g >= 0) { + d.preventDefault(), hg(h[g]) || h[g].click(); return; } - const p = f.shiftKey ? null : QU(f.key, "vertical", "ltr"); + const p = d.shiftKey ? null : QU(d.key, "vertical", "ltr"); if (p) { - f.preventDefault(); + d.preventDefault(); const m = AN(p, g, h.length, c(h), !0); m >= 0 && h[m].focus(); return; } - if (f.key.length === 1) { - f.timeStamp - i > Eae && (s = ""), s += f.key, i = f.timeStamp; + if (d.key.length === 1) { + d.timeStamp - i > Eae && (s = ""), s += d.key, i = d.timeStamp; const m = h.map(Nae), v = Iae(m, g, s, c(h)); - v >= 0 && (f.preventDefault(), h[v].focus()); + v >= 0 && (d.preventDefault(), h[v].focus()); } - }, u = (f) => { - f.key === " " && !f.defaultPrevented && f.preventDefault(); + }, u = (d) => { + d.key === " " && !d.defaultPrevented && d.preventDefault(); }; e.addEventListener("keydown", l), e.addEventListener("keyup", u), n?.setAttribute("aria-expanded", "true"); - const d = t.initialFocus ?? "first"; - if (d !== "none") { - const f = a(), h = AN(d, -1, f.length, c(f), !1); - h >= 0 && f[h].focus(); + const f = t.initialFocus ?? "first"; + if (f !== "none") { + const d = a(), h = AN(f, -1, d.length, c(d), !1); + h >= 0 && d[h].focus(); } return () => { e.removeEventListener("keydown", l), e.removeEventListener("keyup", u), n?.setAttribute("aria-expanded", "false"); - const f = Gr(e.ownerDocument); - n && (f === null || e.contains(f)) && n.focus(); + const d = Jr(e.ownerDocument); + n && (d === null || e.contains(d)) && n.focus(); }; } function XU(e, t) { - if (dg(e)) return; + if (fg(e)) return; if (t) { t.focus(); return; @@ -18312,35 +18343,35 @@ function XU(e, t) { } const uy = []; function Oae(e, t = {}) { - const n = e.ownerDocument, r = Gr(n), o = () => uy[uy.length - 1] === e; + const n = e.ownerDocument, r = Jr(n), o = () => uy[uy.length - 1] === e; let s = null, i = !1; const a = (u) => { - const d = bN(e), f = u === "first" ? d[0] : d[d.length - 1]; - if (f) { - f.focus(); + const f = bN(e), d = u === "first" ? f[0] : f[f.length - 1]; + if (d) { + d.focus(); return; } e.hasAttribute("tabindex") || (e.tabIndex = -1), e.focus(); }, c = (u) => { if (u.key !== "Tab" || u.defaultPrevented || !o()) return; - const d = bN(e), f = Gr(n), h = d[0], g = d[d.length - 1], p = f === e || f === h || !h, m = f === g || !g; + const f = bN(e), d = Jr(n), h = f[0], g = f[f.length - 1], p = d === e || d === h || !h, m = d === g || !g; (u.shiftKey ? p : m) && (u.preventDefault(), a(u.shiftKey ? "last" : "first")); }, l = (u) => { if (!o()) return; - const d = u.composedPath(); - if (d.includes(e)) { - s = d[0]; + const f = u.composedPath(); + if (f.includes(e)) { + s = f[0]; return; } queueMicrotask(() => { - i || !o() || dg(e) || (s?.isConnected && e.contains(s) ? s.focus() : a("first")); + i || !o() || fg(e) || (s?.isConnected && e.contains(s) ? s.focus() : a("first")); }); }; - return uy.push(e), e.addEventListener("keydown", c), n.addEventListener("focusin", l, !0), XU(e, t.initialFocus), s === null && dg(e) && (s = Gr(n)), () => { + return uy.push(e), e.addEventListener("keydown", c), n.addEventListener("focusin", l, !0), XU(e, t.initialFocus), s === null && fg(e) && (s = Jr(n)), () => { i = !0; const u = uy.lastIndexOf(e); if (u >= 0 && uy.splice(u, 1), e.removeEventListener("keydown", c), n.removeEventListener("focusin", l, !0), t.returnFocus === !1 || !r?.isConnected) return; - (Gr(n) === null || dg(e)) && r.focus(); + (Jr(n) === null || fg(e)) && r.focus(); }; } const Pae = (e) => e.tagName === "INPUT" || e.tagName === "TEXTAREA", Rae = /* @__PURE__ */ new Set(["ArrowUp", "ArrowLeft"]), Tae = /* @__PURE__ */ new Set(["ArrowDown", "ArrowRight"]), Mae = (e) => e.tabIndex >= 0 ? e : e.querySelector("input, textarea, select, button") ?? e, Bae = "input, textarea, select, button, a[href], [tabindex], [contenteditable]", _ae = (e) => typeof e.checkVisibility != "function" || e.checkVisibility({ checkVisibilityCSS: !0, visibilityProperty: !0 }), Lae = (e) => { @@ -18357,15 +18388,15 @@ function Fae(e) { if (!n.isTrusted || n.detail === 0) return; const r = e.hasAttribute("tabindex") ? e : e.querySelector("input, textarea, select, button"); if (!r || !r.contains(n.target)) return; - const o = Gr(e.ownerDocument); + const o = Jr(e.ownerDocument); o !== r && (o === null || jae(e, o)) && r.focus({ preventScroll: !0 }); }; return e.addEventListener("click", t), () => e.removeEventListener("click", t); } function Vae(e, t, n, r = {}) { const o = () => r.focusable === !1 ? [] : r.custom ? Dae(e) : [Mae(e)], s = (c) => { - const l = Gr(e.ownerDocument); - return c.focus({ preventScroll: !0 }), r.custom ? dg(e) || Gr(e.ownerDocument) !== l : !0; + const l = Jr(e.ownerDocument); + return c.focus({ preventScroll: !0 }), r.custom ? fg(e) || Jr(e.ownerDocument) !== l : !0; }, i = t.attachFocusTarget(n, { takesCursor: () => o().length > 0, focus: ({ select: c }) => { @@ -18390,7 +18421,7 @@ function $ae(e, t) { return t?.find((n) => n.for(e)) ?? null; } function Uae(e, t) { - const n = e.rotation ?? 0, r = kS({ box: e.box, rotation: n, scale: 1 }, t), o = zo(e.rect, t), s = { position: "absolute", left: "0", top: "0", transformOrigin: "0 0" }; + const n = e.rotation ?? 0, r = kS({ box: e.box, rotation: n, scale: 1 }, t), o = Wo(e.rect, t), s = { position: "absolute", left: "0", top: "0", transformOrigin: "0 0" }; return { frame: SU(r, !0), frameStyle: { @@ -18470,10 +18501,10 @@ function Jae(e) { icon: "download", shortcut: "Mod+S", categories: ["document"], - allowed: (t) => t.tryGet(It)?.canDownload() ?? !0, + allowed: (t) => t.tryGet(Pt)?.canDownload() ?? !0, notAllowedKey: "commands.notAllowed.doc-download", run: async (t) => { - const n = t.get(It), r = t.documentId ?? void 0, o = await n.download(r, { signal: t.signal }); + const n = t.get(Pt), r = t.documentId ?? void 0, o = await n.download(r, { signal: t.signal }); e.saveFile(o, Yae(n.get(r)?.name), "application/pdf"); }, enabled: (t) => t.documentId !== null @@ -18485,12 +18516,12 @@ function Jae(e) { icon: "print", shortcut: "Mod+P", categories: ["document"], - allowed: (t) => t.tryGet(It)?.canPrint() ?? !0, + allowed: (t) => t.tryGet(Pt)?.canPrint() ?? !0, notAllowedKey: "commands.notAllowed.doc-print", // The kernel prints the document's pages, and runs the document's own // print actions around the dialog when the actions plugin is there. run: async (t) => { - await t.get(It).print(t.documentId ?? void 0, { signal: t.signal }); + await t.get(Pt).print(t.documentId ?? void 0, { signal: t.signal }); }, enabled: (t) => t.documentId !== null } @@ -18499,7 +18530,7 @@ function Jae(e) { function Yae(e) { return e ? /\.pdf$/i.test(e) ? e : `${e}.pdf` : "document.pdf"; } -const vt = sn("annotation", { +const vt = an("annotation", { hint: "add annotationPlugin() from '@embedpdf/plugin-annotation' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -18544,7 +18575,7 @@ const vt = sn("annotation", { editing: e.text.getEditing() }), empty: { status: "loading", selected: [], hovered: null, editing: null } -}), Vd = "stamp", Xae = 0.5, Zae = (e) => e === !0 ? { opacity: Xae } : e, ece = [ +}), Ud = "stamp", Xae = 0.5, Zae = (e) => e === !0 ? { opacity: Xae } : e, ece = [ "ref", "page", "index", @@ -18578,7 +18609,7 @@ const vt = sn("annotation", { "fontSize", "fontColor", "textAlign" -], tce = [...SN, "layout"], Jn = (e) => Pm[e].filter( +], tce = [...SN, "layout"], Jn = (e) => Rm[e].filter( (t) => !ece.includes(t) ), nce = { square: Jn("square"), @@ -18610,7 +18641,7 @@ const vt = sn("annotation", { // The bare box every other widget family ingests as (a signature field's // widget among them): box styling only, no text to style. "widget-box": qk -}, rce = /* @__PURE__ */ new Set(["calibrate"]), Bi = ["annotation-draw", "annotation-edit"], gu = "#e5484d", ah = ["text-select", "annotation-edit"], e9 = (e) => e.has("annotation-draw") || e.has("text-select") ? "draw" : "tap", oce = [ +}, rce = /* @__PURE__ */ new Set(["calibrate"]), Bi = ["annotation-draw", "annotation-edit"], mu = "#e5484d", lh = ["text-select", "annotation-edit"], e9 = (e) => e.has("annotation-draw") || e.has("text-select") ? "draw" : "tap", oce = [ // shapes / lines / ink / free text — the `annotation-draw` gesture. // Draw tools carry click-create defaults (a bare click places a // default-size annotation). Their ghost is off: they are drag-first, so the @@ -18620,7 +18651,7 @@ const vt = sn("annotation", { subtype: "square", cursor: "crosshair", enables: Bi, - defaults: { color: gu, strokeWidth: 6 }, + defaults: { color: mu, strokeWidth: 6 }, // A click shows 80 wide and 60 tall as the page is seen, turned or not. clickCreate: { width: 80, height: 60 }, upright: !0 @@ -18630,7 +18661,7 @@ const vt = sn("annotation", { subtype: "circle", cursor: "crosshair", enables: Bi, - defaults: { color: gu, strokeWidth: 6 }, + defaults: { color: mu, strokeWidth: 6 }, // A click shows 80 wide and 60 tall as the page is seen, turned or not. clickCreate: { width: 80, height: 60 }, upright: !0 @@ -18640,7 +18671,7 @@ const vt = sn("annotation", { subtype: "line", cursor: "crosshair", enables: Bi, - defaults: { color: gu, strokeWidth: 6 }, + defaults: { color: mu, strokeWidth: 6 }, // A click lays it centred on the point, pointing right as the page shows. clickCreate: { length: 80 }, upright: !0 @@ -18670,14 +18701,14 @@ const vt = sn("annotation", { subtype: "polygon", cursor: "crosshair", enables: Bi, - defaults: { color: gu, strokeWidth: 6 } + defaults: { color: mu, strokeWidth: 6 } }, { id: "polyline", subtype: "polyline", cursor: "crosshair", enables: Bi, - defaults: { color: gu, strokeWidth: 6 } + defaults: { color: mu, strokeWidth: 6 } }, { id: "perimeter", @@ -18715,7 +18746,7 @@ const vt = sn("annotation", { subtype: "free-text", cursor: "crosshair", enables: Bi, - defaults: { color: gu, strokeWidth: 2, fontColor: "#ef4444" }, + defaults: { color: mu, strokeWidth: 2, fontColor: "#ef4444" }, upright: !0, // Top-left anchored: the box hangs where you'll type (the kind's reading // feel); shapes default to `center`. Anchoring is explicit policy data. @@ -18731,7 +18762,7 @@ const vt = sn("annotation", { subtype: "free-text-callout", cursor: "crosshair", enables: Bi, - defaults: { color: gu, strokeWidth: 6, lineEnding: "open-arrow" }, + defaults: { color: mu, strokeWidth: 6, lineEnding: "open-arrow" }, upright: !0 }, // text markup — the `text-select` gesture (inert without a selection plugin). @@ -18742,7 +18773,7 @@ const vt = sn("annotation", { id: "highlight", subtype: "highlight", cursor: "default", - enables: ah, + enables: lh, defaults: { color: "#ffe16a", blendMode: "multiply" }, selection: { kind: "markup" } }, @@ -18768,7 +18799,7 @@ const vt = sn("annotation", { id: "underline", subtype: "underline", cursor: "default", - enables: ah, + enables: lh, defaults: { color: "#ef4444" }, selection: { kind: "markup" } }, @@ -18776,7 +18807,7 @@ const vt = sn("annotation", { id: "strikeout", subtype: "strikeout", cursor: "default", - enables: ah, + enables: lh, defaults: { color: "#ef4444" }, selection: { kind: "markup" } }, @@ -18784,7 +18815,7 @@ const vt = sn("annotation", { id: "squiggly", subtype: "squiggly", cursor: "default", - enables: ah, + enables: lh, defaults: { color: "#ef4444" }, selection: { kind: "markup" } }, @@ -18796,7 +18827,7 @@ const vt = sn("annotation", { fieldsKind: "caret", preset: "caret", cursor: "default", - enables: ah, + enables: lh, defaults: { color: "#ef4444" }, selection: { kind: "text-edit", operation: "insert" } }, @@ -18805,7 +18836,7 @@ const vt = sn("annotation", { subtype: "strikeout", fieldsKind: "strikeout", cursor: "default", - enables: ah, + enables: lh, defaults: { color: "#ef4444" }, selection: { kind: "text-edit", operation: "replace" } }, @@ -18814,7 +18845,7 @@ const vt = sn("annotation", { // embedder can pass fixed bytes instead). `accept` narrows the dialog to // what the engine's stamp sniffer takes anyway. { - id: Vd, + id: Ud, subtype: "stamp", cursor: "copy", enables: ["annotation-place", "annotation-edit"], @@ -18988,9 +19019,9 @@ function uce() { } ]; } -const rg = sn("history", { +const og = an("history", { hint: "add historyPlugin() from '@embedpdf/plugin-history' to your plugins list" -}), dce = { limit: 100 }, S1 = (e) => e.tryGet(rg); +}), dce = { limit: 100 }, S1 = (e) => e.tryGet(og); function fce() { return [ { @@ -19015,7 +19046,7 @@ function fce() { } ]; } -const uR = sn("feedback"), yr = sn("interaction", { +const uR = an("feedback"), yr = an("interaction", { hint: "add interactionPlugin() from '@embedpdf/plugin-interaction' to your plugins list" }), hce = { defaultTool: "pointer", tools: [] }, Fy = (e) => e.tryGet(yr), KB = /* @__PURE__ */ new WeakMap(), pce = (e) => { let t = KB.get(e); @@ -19078,7 +19109,7 @@ function bce(e) { debug: e.debug ?? !1 }; } -const Wo = sn("render", { +const qo = an("render", { hint: "add renderPlugin() from '@embedpdf/plugin-render' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -19102,14 +19133,14 @@ const Wo = sn("render", { slowAfterMs: 400, debug: !1, snapshot: { scale: 2, box: { fill: null, stroke: null } } -}, hg = "snapshot", dy = (e) => e.tryGet(Wo)?.getSnapshot() ?? null; +}, pg = "snapshot", dy = (e) => e.tryGet(qo)?.getSnapshot() ?? null; function kce(e) { return [ // The snapshot tool, for a user who may take snapshots. { - ...Xw(hg), + ...Xw(pg), id: "tool:snapshot", - allowed: (t) => t.tryGet(Wo)?.canSnapshot() ?? !0, + allowed: (t) => t.tryGet(qo)?.canSnapshot() ?? !0, notAllowedKey: "commands.notAllowed.doc-content-copy" }, // ── the snapshot the snapshot tool holds ── @@ -19136,7 +19167,7 @@ function kce(e) { run: async (t) => { const n = dy(t); if (!n) return; - const r = t.get(It), o = t.documentId ?? void 0, s = await (await n.image).blob(), i = r.listPages(o).findIndex((a) => a.ref.objectNumber === n.page.objectNumber) + 1; + const r = t.get(Pt), o = t.documentId ?? void 0, s = await (await n.image).blob(), i = r.listPages(o).findIndex((a) => a.ref.objectNumber === n.page.objectNumber) + 1; e.saveFile(s, Ace(r.get(o)?.name, i), "image/png"); }, enabled: (t) => dy(t) !== null @@ -19147,7 +19178,7 @@ function kce(e) { label: "Clear snapshot", shortcut: "Escape", categories: ["snapshot"], - run: (t) => t.get(Wo).clearSnapshot(), + run: (t) => t.get(qo).clearSnapshot(), enabled: (t) => dy(t) !== null } ]; @@ -19155,7 +19186,7 @@ function kce(e) { function Ace(e, t) { return `${(e ?? "document").replace(/\.pdf$/i, "")} p${t}.png`; } -const _r = sn("selection", { +const _r = an("selection", { hint: "add selectionPlugin() from '@embedpdf/plugin-selection' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -19188,7 +19219,7 @@ function Sce(e) { } ]; } -const Zt = sn("stage", { +const tn = an("stage", { hint: "add stagePlugin() from '@embedpdf/plugin-stage' to your plugins list" }); function r9(e) { @@ -19239,18 +19270,18 @@ function s9(e, t) { function zB(e, t) { return Math.round(e * t) / t; } -function pg(e, t) { +function gg(e, t) { return o9(t) ? { width: e.height, height: e.width } : { width: e.width, height: e.height }; } function Ice(e, t) { return Math.max(1, Math.round(t * e.height / e.width)); } function Nce(e) { - const { pageSize: t, rotation: n, scale: r, dpr: o } = e, s = Math.max(1, Math.round(t.width * r * o)), i = Ice(t, s), a = s / t.width, c = { width: s / o, height: i / o }, l = c.width / t.width, u = e.baseScale ?? r, d = u > 0 ? l / u : 1, f = pg(c, n), h = [l, 0, 0, l, 0, 0], g = xS(l, c.width, c.height, n), p = qB(g), m = (x) => ci(h, x), v = qB(h), S = (x) => ci(v, x), C = (x) => ci(g, x), k = (x) => ci(p, x), N = (x) => SS(g, x), w = (x) => SS(p, x), y = Oce(g); + const { pageSize: t, rotation: n, scale: r, dpr: o } = e, s = Math.max(1, Math.round(t.width * r * o)), i = Ice(t, s), a = s / t.width, c = { width: s / o, height: i / o }, l = c.width / t.width, u = e.baseScale ?? r, f = u > 0 ? l / u : 1, d = gg(c, n), h = [l, 0, 0, l, 0, 0], g = xS(l, c.width, c.height, n), p = qB(g), m = (x) => ci(h, x), v = qB(h), S = (x) => ci(v, x), C = (x) => ci(g, x), k = (x) => ci(p, x), N = (x) => SS(g, x), w = (x) => SS(p, x), y = Oce(g); return { rotation: n, - viewWidth: f.width, - viewHeight: f.height, + viewWidth: d.width, + viewHeight: d.height, contentWidth: c.width, contentHeight: c.height, deviceWidth: s, @@ -19258,7 +19289,7 @@ function Nce(e) { renderScale: a, viewScale: l, baseScale: u, - zoom: d, + zoom: f, toPixels: m, fromPixels: S, pageToView: C, @@ -19269,21 +19300,21 @@ function Nce(e) { }; } function WB(e, t) { - const [n, r, o, s, i, a] = e, [c, l, u, d, f, h] = t; + const [n, r, o, s, i, a] = e, [c, l, u, f, d, h] = t; return [ n * c + o * l, r * c + s * l, - n * u + o * d, - r * u + s * d, - n * f + o * h + i, - r * f + s * h + a + n * u + o * f, + r * u + s * f, + n * d + o * h + i, + r * d + s * h + a ]; } function qB(e) { const [t, n, r, o, s, i] = e, a = t * o - n * r; if (a === 0) throw new Error("Mat2D.invert: non-invertible matrix (det = 0)"); - const c = o / a, l = -n / a, u = -r / a, d = t / a; - return [c, l, u, d, -(c * s + u * i), -(l * s + d * i)]; + const c = o / a, l = -n / a, u = -r / a, f = t / a; + return [c, l, u, f, -(c * s + u * i), -(l * s + f * i)]; } function ci(e, t) { const [n, r, o, s, i, a] = e; @@ -19341,19 +19372,19 @@ function fR(e) { return { x: r, y: o, width: Math.max(...t) - r, height: Math.max(...n) - o }; } function EN(e) { - const t = e.userUnit ?? 1, n = pg(e.size, e.rotation ?? 0); + const t = e.userUnit ?? 1, n = gg(e.size, e.rotation ?? 0); return t === 1 ? n : { width: n.width * t, height: n.height * t }; } -const $f = (e) => typeof e == "number" ? { top: e, right: e, bottom: e, left: e } : e, P0 = 0.05, s2 = 64, Mce = { min: P0, max: s2 }, Bce = (e, t) => { - const n = Uo(t, P0, s2); - return { min: Uo(e, P0, n), max: n }; -}, ho = (e, t = Mce) => Uo(e, t.min, t.max), dr = { +const Kf = (e) => typeof e == "number" ? { top: e, right: e, bottom: e, left: e } : e, P0 = 0.05, s2 = 64, Mce = { min: P0, max: s2 }, Bce = (e, t) => { + const n = Ko(t, P0, s2); + return { min: Ko(e, P0, n), max: n }; +}, po = (e, t = Mce) => Ko(e, t.min, t.max), fr = { Automatic: "automatic", FitPage: "fit-page", FitWidth: "fit-width", /** Fit the whole scene (every page) in view — the construction overview. */ FitAll: "fit-all" -}, Uo = (e, t, n) => Math.min(Math.max(e, t), n), Vy = (e, t) => ({ +}, Ko = (e, t, n) => Math.min(Math.max(e, t), n), Vy = (e, t) => ({ x: (t.x - e.x) * e.zoom, y: (t.y - e.y) * e.zoom }), i2 = (e, t) => ({ @@ -19365,7 +19396,7 @@ const $f = (e) => typeof e == "number" ? { top: e, right: e, bottom: e, left: e width: t.width / e.zoom, height: t.height / e.zoom }), Lce = (e, t, n, r) => { - const o = ho(e.zoom * n, r); + const o = po(e.zoom * n, r); return { x: e.x + t.x / e.zoom - t.x / o, y: e.y + t.y / e.zoom - t.y / o, @@ -19381,9 +19412,9 @@ const $f = (e) => typeof e == "number" ? { top: e, right: e, bottom: e, left: e fits: t * r <= n - o - s }), hi = (e, t, n, r) => { if (!r.bounded) return e; - const o = $f(r.padding), s = r.fitAlign ?? { x: "center", y: "center" }, i = (c, l, u, d, f, h, g) => { - const p = a9(l, u, d, e.zoom, h, g); - return p.fits ? f === "start" ? p.near : f === "end" ? p.far : (p.near + p.far) / 2 : Uo(c, p.near, p.far); + const o = Kf(r.padding), s = r.fitAlign ?? { x: "center", y: "center" }, i = (c, l, u, f, d, h, g) => { + const p = a9(l, u, f, e.zoom, h, g); + return p.fits ? d === "start" ? p.near : d === "end" ? p.far : (p.near + p.far) / 2 : Ko(c, p.near, p.far); }, a = r.direction === "rtl" && s.x !== "center" ? s.x === "start" ? "end" : "start" : s.x; return { zoom: e.zoom, @@ -19391,9 +19422,9 @@ const $f = (e) => typeof e == "number" ? { top: e, right: e, bottom: e, left: e y: i(e.y, t.y, t.height, n.height, s.y, o.top, o.bottom) }; }, Dce = (e, t, n, r) => { - const o = $f(r), s = (c, l, u, d, f, h) => { - const g = Math.min(l - f / e.zoom, c), m = (Math.max(l + u + h / e.zoom, c + d / e.zoom) - g) * e.zoom; - return { offset: (c - g) * e.zoom, total: m, scrollable: m > d + 0.5 }; + const o = Kf(r), s = (c, l, u, f, d, h) => { + const g = Math.min(l - d / e.zoom, c), m = (Math.max(l + u + h / e.zoom, c + f / e.zoom) - g) * e.zoom; + return { offset: (c - g) * e.zoom, total: m, scrollable: m > f + 0.5 }; }, i = s(e.x, t.x, t.width, n.width, o.left, o.right), a = s(e.y, t.y, t.height, n.height, o.top, o.bottom); return { scrollLeft: i.offset, @@ -19406,10 +19437,10 @@ const $f = (e) => typeof e == "number" ? { top: e, right: e, bottom: e, left: e scrollableY: a.scrollable }; }, jce = (e, t, n, r, o) => { - const s = $f(r), i = (a, c, l, u, d, f, h) => { + const s = Kf(r), i = (a, c, l, u, f, d, h) => { if (a === void 0) return c; - const g = Math.min(l - f / e.zoom, c), p = Math.max(l + u + h / e.zoom, c + d / e.zoom), m = Math.max(0, (p - g) * e.zoom - d); - return g + Uo(a, 0, m) / e.zoom; + const g = Math.min(l - d / e.zoom, c), p = Math.max(l + u + h / e.zoom, c + f / e.zoom), m = Math.max(0, (p - g) * e.zoom - f); + return g + Ko(a, 0, m) / e.zoom; }; return { zoom: e.zoom, @@ -19418,11 +19449,11 @@ const $f = (e) => typeof e == "number" ? { top: e, right: e, bottom: e, left: e }; }; function Fce(e, t, n, r = 0, o = { x: "start", y: "start" }, s = "ltr") { - const i = $f(r), a = (l, u, d, f, h, g) => { + const i = Kf(r), a = (l, u, f, d, h, g) => { if (l === "start") return u - h / n; - if (l === "end") return u + d - (f - g) / n; - const p = l === "center" ? 0.5 : Uo(l, 0, 1); - return u + d / 2 - (f * p + (h - g) / 2) / n; + if (l === "end") return u + f - (d - g) / n; + const p = l === "center" ? 0.5 : Ko(l, 0, 1); + return u + f / 2 - (d * p + (h - g) / 2) / n; }, c = s === "rtl" && o.x === "start" ? "end" : s === "rtl" && o.x === "end" ? "start" : o.x; return { zoom: n, @@ -19431,9 +19462,9 @@ function Fce(e, t, n, r = 0, o = { x: "start", y: "start" }, s = "ltr") { }; } function Vce(e, t, n, r = 0) { - const o = $f(r), s = (i, a, c, l, u, d) => { - const f = a + c - (l - d) / e.zoom, h = a - u / e.zoom; - return f > h ? h : Uo(i, f, h); + const o = Kf(r), s = (i, a, c, l, u, f) => { + const d = a + c - (l - f) / e.zoom, h = a - u / e.zoom; + return d > h ? h : Ko(i, d, h); }; return { zoom: e.zoom, @@ -19442,19 +19473,19 @@ function Vce(e, t, n, r = 0) { }; } function ES(e, t, n, r = 0, o) { - if ("level" in e) return ho(e.level, o); - if ("pageWidth" in e) return ho(e.pageWidth / t.width, o); - if ("pageHeight" in e) return ho(e.pageHeight / t.height, o); - const s = $f(r), i = Math.max(1, n.width - s.left - s.right) / t.width, a = Math.max(1, n.height - s.top - s.bottom) / t.height; + if ("level" in e) return po(e.level, o); + if ("pageWidth" in e) return po(e.pageWidth / t.width, o); + if ("pageHeight" in e) return po(e.pageHeight / t.height, o); + const s = Kf(r), i = Math.max(1, n.width - s.left - s.right) / t.width, a = Math.max(1, n.height - s.top - s.bottom) / t.height; switch (e.mode) { - case dr.FitWidth: - return ho(i, o); - case dr.FitPage: - case dr.FitAll: - return ho(Math.min(i, a), o); - case dr.Automatic: + case fr.FitWidth: + return po(i, o); + case fr.FitPage: + case fr.FitAll: + return po(Math.min(i, a), o); + case fr.Automatic: default: - return ho(Math.min(i, 1), o); + return po(Math.min(i, 1), o); } } function a2(e, t) { @@ -19509,7 +19540,7 @@ function u9(e, t) { const r = e.map((o) => o.pageIndexes[0]); return (o) => { const s = n[o] ?? -1; - return s >= 0 ? s : Uo(R0(r, o) - 1, 0, e.length - 1); + return s >= 0 ? s : Ko(R0(r, o) - 1, 0, e.length - 1); }; } const YB = 2; @@ -19523,26 +19554,26 @@ function d9(e, t, n) { } function f9(e, t, n, r, o, s) { let i = 0; - for (let d = 0; d < t.length; d++) - i = Math.max(i, EN(e[t[d]]).height * n); + for (let f = 0; f < t.length; f++) + i = Math.max(i, EN(e[t[f]]).height * n); const a = []; let c = 0; - for (let d = 0; d < t.length; d++) { - const f = EN(e[t[d]]), h = f.width * n, g = f.height * n; + for (let f = 0; f < t.length; f++) { + const d = EN(e[t[f]]), h = d.width * n, g = d.height * n; a.push({ - pageIndex: t[d], + pageIndex: t[f], lx: c + o.left, ly: o.top + (i - g) / 2, // page centers within the inner band w: h, h: g, - rotation: e[t[d]].rotation ?? 0, - userUnit: e[t[d]].userUnit ?? 1 + rotation: e[t[f]].rotation ?? 0, + userUnit: e[t[f]].userUnit ?? 1 }), c += o.left + h + o.right + r * n; } const l = Math.max(0, c - r * n), u = o.top + i + o.bottom; if (s === "rtl") - for (const d of a) d.lx = l - d.lx - d.w + (o.left - o.right); + for (const f of a) f.lx = l - f.lx - f.w + (o.left - o.right); return { local: a, width: l, height: u }; } function h9(e, t, n) { @@ -19561,10 +19592,10 @@ function h9(e, t, n) { } const p9 = (e, t, n, r = 1) => (n === "uniform" && e > 0 ? t / e : 1) * r; function Uce(e, t, n = {}) { - const r = n.gap ?? 16, o = (n.axis ?? "y") === "y", s = n.align ?? "center", i = n.sizing ?? "intrinsic", a = n.direction ?? "ltr", c = !o && a === "rtl", l = n.pageFrame ?? dR, u = t.map((A) => d9(e, A, r)), d = (A) => o ? A.width : A.height, f = u.reduce((A, b) => Math.max(A, d(b)), 0), h = new Array(t.length), g = new Array(t.length), p = new Array(t.length); + const r = n.gap ?? 16, o = (n.axis ?? "y") === "y", s = n.align ?? "center", i = n.sizing ?? "intrinsic", a = n.direction ?? "ltr", c = !o && a === "rtl", l = n.pageFrame ?? dR, u = t.map((A) => d9(e, A, r)), f = (A) => o ? A.width : A.height, d = u.reduce((A, b) => Math.max(A, f(b)), 0), h = new Array(t.length), g = new Array(t.length), p = new Array(t.length); let m = 0, v = 0, S = 0, C = 0; for (let A = 0; A < t.length; A++) { - const b = p9(d(u[A]), f, i, n.viewUnitsPerPoint), E = f9(e, t[A], b, r, l, a), { width: I, height: O } = E; + const b = p9(f(u[A]), d, i, n.viewUnitsPerPoint), E = f9(e, t[A], b, r, l, a), { width: I, height: O } = E; p[A] = b, g[A] = E.local; const T = { index: A, @@ -19601,23 +19632,23 @@ function Uce(e, t, n = {}) { return T; }, nearestItem(A) { - const b = Uo(R0(y, o ? A.y : A.x) - 1, 0, h.length - 1); + const b = Ko(R0(y, o ? A.y : A.x) - 1, 0, h.length - 1); return h[w(b)]; }, itemOfPage: u9(h, e.length) }; } function Kce(e, t, n = {}) { - const r = n.gap ?? 48, o = t.length, s = n.sizing ?? "intrinsic", i = n.direction ?? "ltr", a = n.pageFrame ?? dR, c = t.map((b) => d9(e, b, r)), l = c.reduce((b, E) => Math.max(b, E.width), 0), u = new Array(o), d = new Array(o), f = new Array(o); + const r = n.gap ?? 48, o = t.length, s = n.sizing ?? "intrinsic", i = n.direction ?? "ltr", a = n.pageFrame ?? dR, c = t.map((b) => d9(e, b, r)), l = c.reduce((b, E) => Math.max(b, E.width), 0), u = new Array(o), f = new Array(o), d = new Array(o); let h = 1, g = 1; for (let b = 0; b < o; b++) { const E = p9(c[b].width, l, s, n.viewUnitsPerPoint), I = f9(e, t[b], E, r, a, i); - f[b] = E, u[b] = I.local, d[b] = { width: I.width, height: I.height }, h = Math.max(h, d[b].width), g = Math.max(g, d[b].height); + d[b] = E, u[b] = I.local, f[b] = { width: I.width, height: I.height }, h = Math.max(h, f[b].width), g = Math.max(g, f[b].height); } const p = n.lineWidth !== void 0 ? Math.floor((n.lineWidth + r) / (h + r)) : n.columns ?? Math.ceil(Math.sqrt(o)), m = Math.max(1, Math.min(p, Math.max(1, o))), v = (b) => i === "rtl" ? m - 1 - b : b, S = h + r, C = Math.max(1, Math.ceil(o / m)), k = new Array(C).fill(1); for (let b = 0; b < o; b++) { const E = Math.floor(b / m); - k[E] = Math.max(k[E], d[b].height); + k[E] = Math.max(k[E], f[b].height); } const N = new Array(C); let w = 0; @@ -19627,14 +19658,14 @@ function Kce(e, t, n = {}) { for (let b = 0; b < o; b++) { const E = v(b % m), I = Math.floor(b / m), O = { index: b, - x: E * S + (h - d[b].width) / 2, - y: N[I] + (k[I] - d[b].height) / 2, - width: d[b].width, - height: d[b].height, + x: E * S + (h - f[b].width) / 2, + y: N[I] + (k[I] - f[b].height) / 2, + width: f[b].width, + height: f[b].height, pageIndexes: t[b], pages: [] }; - O.pages = h9(O, u[b], f[b]), x[b] = O; + O.pages = h9(O, u[b], d[b]), x[b] = O; } return { size: { width: m * S - r, height: Math.max(1, w - r) }, @@ -19646,14 +19677,14 @@ function Kce(e, t, n = {}) { const E = Math.max(0, Math.floor(b.x / S)), I = Math.min(m - 1, Math.floor((b.x + b.width) / S)), O = Math.max(0, l9(y, b.y)), T = Math.min(C - 1, R0(N, b.y + b.height) - 1), R = []; for (let M = O; M <= T; M++) for (let F = E; F <= I; F++) { - const B = M * m + v(F); - B < o && R.push(x[B]); + const _ = M * m + v(F); + _ < o && R.push(x[_]); } return R; }, nearestItem(b) { - const E = Uo(Math.floor(b.x / S), 0, m - 1), I = Uo(R0(N, b.y) - 1, 0, C - 1); - return x[Uo(I * m + v(E), 0, o - 1)]; + const E = Ko(Math.floor(b.x / S), 0, m - 1), I = Ko(R0(N, b.y) - 1, 0, C - 1); + return x[Ko(I * m + v(E), 0, o - 1)]; }, itemOfPage: u9(x, e.length) }; @@ -19668,7 +19699,7 @@ function Hce(e, t = "none") { for (t === "even" && e > 0 && n.push([r++]); r < e; r += 2) n.push(r + 1 < e ? [r, r + 1] : [r]); return n; } -const $n = (e) => e.tryGet(Zt), x1 = (e) => $n(e) !== null; +const $n = (e) => e.tryGet(tn), x1 = (e) => $n(e) !== null; function zce() { return [ // ── zoom ── @@ -19795,12 +19826,12 @@ function bv(e, t) { } const m9 = Fn(null), tle = Fn(null); function Qa() { - const e = Et(m9); + const e = Ct(m9); if (!e) throw new Error("useKernel must be used within /"); return e; } const pi = (e, t) => e === t || e.length === t.length && e.every((n, r) => n === t[r]); -function en(e, t = Object.is) { +function nn(e, t = Object.is) { const n = Qa(), r = Re(null), o = () => { const s = e(n); return r.current && t(r.current.v, s) ? r.current.v : (r.current = { v: s }, s); @@ -19808,36 +19839,36 @@ function en(e, t = Object.is) { return wi(n.subscribe, o); } function nle() { - return en((e) => e.documents.getActiveId()); + return nn((e) => e.documents.getActiveId()); } -function ar() { +function cr() { const e = vi(), t = nle(); return e ?? t; } function vi() { - return Et(tle); + return Ct(tle); } function rle({ fallback: e = null, locked: t, error: n, children: r }) { const o = IS(); return o.status === "ready" ? /* @__PURE__ */ P(nt, { children: r }) : o.status === "locked" && t ? /* @__PURE__ */ P(nt, { children: t(o) }) : o.status === "error" && n ? /* @__PURE__ */ P(nt, { children: n(o) }) : /* @__PURE__ */ P(nt, { children: e }); } function bt(e) { - const t = Qa(), n = Rt(e); + const t = Qa(), n = Bt(e); return n || (t.scopeOf(e) === "document" ? Koe(t, e) : t.capability(e)); } -function Rt(e) { +function Bt(e) { const t = vi(); - return en((n) => n.tryCapability(e, t ?? void 0)); + return nn((n) => n.tryCapability(e, t ?? void 0)); } function wt(e, t, n = Object.is) { - const r = Qa(), o = vi(), s = Rt(e) ?? r.capability(e, o ?? void 0), i = Re(null), a = () => { + const r = Qa(), o = vi(), s = Bt(e) ?? r.capability(e, o ?? void 0), i = Re(null), a = () => { const c = t(s); return i.current && n(i.current.v, c) ? i.current.v : (i.current = { v: c }, c); }; return wi(r.subscribe, a); } -function zt(e, t, n, r = Object.is) { - const o = Qa(), s = Rt(e), i = Re(null), a = () => { +function Gt(e, t, n, r = Object.is) { + const o = Qa(), s = Bt(e), i = Re(null), a = () => { let c; if (s === null) c = n; @@ -19852,7 +19883,7 @@ function zt(e, t, n, r = Object.is) { return wi(o.subscribe, a); } function hR(e, t, n) { - const r = Rt(e), o = Re(n); + const r = Bt(e), o = Re(n); o.current = n; const s = Re(t); s.current = t, Ke(() => { @@ -19861,30 +19892,30 @@ function hR(e, t, n) { }, [r]); } function pR() { - return bt(It); + return bt(Pt); } function y9(e, t, n, r) { const o = vi(); - return en((s) => { + return nn((s) => { const i = s.tryCapability(e, o ?? void 0), a = i ? t(i) : n; return r ? r(a) : a; }, hv); } function IS(e) { - return y9(It, bB.read, bB.empty, e); + return y9(Pt, bB.read, bB.empty, e); } function c2(e) { - return y9(It, wB.read, wB.empty, e); + return y9(Pt, wB.read, wB.empty, e); } const ole = Object.freeze([]); function sle() { - const e = ar(); - return en( + const e = cr(); + return nn( (t) => e ? t.documents.listPages(e) : ole ); } -function nu(e) { - return en((t) => { +function ru(e) { + return nn((t) => { const n = t.getSettings(); return e ? e(n) : n; }, hv); @@ -19900,8 +19931,8 @@ const ile = z$(function({ scope: c, accent: l, page: u, - fetch: d, - children: f + fetch: f, + children: d }, h) { const g = Re({ engine: t, plugins: n, initialDocuments: r }), p = Eoe({ identity: a, scope: c, accent: l, page: u }), m = Re(p); m.current = p; @@ -19909,10 +19940,10 @@ const ile = z$(function({ g9() && !v.current && (g.current.engine !== t || g.current.plugins !== n) && (v.current = !0, console.warn( "[embedpdf] engine/plugins are init-only. A changed identity is ignored — pass stable references (module scope, useState, or useMemo). An inline `plugins={[...]}` array recreates its identity every render." )); - const [S, C] = De({ phase: "booting", kernel: null }), k = Re(i); + const [S, C] = je({ phase: "booting", kernel: null }), k = Re(i); k.current = i; - const N = Re(d); - N.current = d, T6( + const N = Re(f); + N.current = f, T6( h, () => S.phase === "ready" ? S.kernel : null, [S] @@ -19951,14 +19982,14 @@ const ile = z$(function({ const w = S.phase === "error" ? null : S.kernel; return Ke(() => { w?.updateSettings(m.current); - }), S.phase === "error" ? /* @__PURE__ */ P(nt, { children: s ? s(S.error) : null }) : S.kernel ? /* @__PURE__ */ P(m9.Provider, { value: S.kernel, children: S.phase === "ready" ? f : o ?? null }) : null; + }), S.phase === "error" ? /* @__PURE__ */ P(nt, { children: s ? s(S.error) : null }) : S.kernel ? /* @__PURE__ */ P(m9.Provider, { value: S.kernel, children: S.phase === "ready" ? d : o ?? null }) : null; }), b9 = Fn(null), ale = b9.Provider; -function qo() { - const e = Et(b9); +function Go() { + const e = Ct(b9); if (!e) throw new Error("usePage must be used inside or a page"); return e; } -const Lr = sn("actions", { +const Lr = an("actions", { hint: "add actionsPlugin() from '@embedpdf/plugin-actions' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -20045,7 +20076,7 @@ const XB = (e) => { triggers: { document: !0, page: !0, annotation: !0 }, openSequence: "auto", javascript: { enabled: !1, identity: null } -}, Dm = Lr; +}, jm = Lr; function ule(e) { return e.map(({ ref: t, visibleRect: n, transform: r }) => { if (n.width <= 0 || n.height <= 0) @@ -20074,7 +20105,7 @@ function hle(e, t) { () => e.document()?.pagesSequence ?? 0, () => t.refit() ), dle(e, t), e.id !== w9) return; - const n = e.tryGet(Dm); + const n = e.tryGet(jm); n && (ple(e, t, n), gle(e, t, n)); } function ple(e, t, n) { @@ -20134,7 +20165,7 @@ const v9 = 0.55, mle = 0.998, k9 = 0.02, iC = 0.015, yle = (e, t) => (1 - 1 / (e return Math.abs(s - n) < 0.5 && Math.abs(o) < 0.01 ? { position: n, velocity: 0, done: !0 } : { position: s, velocity: o, done: !1 }; }, e_ = (e) => 1 - Math.pow(1 - e, 3), kle = (e, t, n) => e * Math.pow(t / e, n), t_ = 240, aC = (e, t, n) => e + (t - e) * n; function Ale({ events: e, clock: t, scene: n }, r) { - const { motionEnded: o } = e, { camera: s, viewport: i, buildScene: a, stayBounds: c, constraint: l } = n, { writeCamera: u, writeCameraUnclamped: d, axisTravels: f, syncCursorFromCamera: h } = r; + const { motionEnded: o } = e, { camera: s, viewport: i, buildScene: a, stayBounds: c, constraint: l } = n, { writeCamera: u, writeCameraUnclamped: f, axisTravels: d, syncCursorFromCamera: h } = r; let g = null; const p = () => { g?.(), g = null; @@ -20187,26 +20218,26 @@ function Ale({ events: e, clock: t, scene: n }, r) { return; } p(); - const w = s().zoom, y = s(), x = hi(y, c(), i(), l()), A = c(), b = i(), E = (F, B, $) => ({ + const w = s().zoom, y = s(), x = hi(y, c(), i(), l()), A = c(), b = i(), E = (F, _, $) => ({ position: F * w, velocity: -$ / 1e3, - springing: F !== B, + springing: F !== _, done: !1 }), I = E( y.x, x.x, - f("x", A.x, A.width, b.width, w) ? k : 0 + d("x", A.x, A.width, b.width, w) ? k : 0 ), O = E( y.y, x.y, - f("y", A.y, A.height, b.height, w) ? N : 0 + d("y", A.y, A.height, b.height, w) ? N : 0 ); if (!I.springing && !O.springing && Math.hypot(I.velocity, O.velocity) < k9) return; let T = !1, R = 0; const M = (F) => { g = null; - const B = T ? Math.min(64, Math.max(1, F - R)) : 16; + const _ = T ? Math.min(64, Math.max(1, F - R)) : 16; T = !0, R = F; const $ = hi( { x: I.position / w, y: O.position / w, zoom: w }, @@ -20215,11 +20246,11 @@ function Ale({ events: e, clock: t, scene: n }, r) { l() ), D = (j, H) => { if (j.done) return; - const Y = j.springing ? vle(j.position, j.velocity, H * w, B) : wle(j.position, j.velocity, B); + const Y = j.springing ? vle(j.position, j.velocity, H * w, _) : wle(j.position, j.velocity, _); j.position = Y.position, j.velocity = Y.velocity, j.done = Y.done; }; D(I, $.x), D(O, $.y); - const _ = hi( + const B = hi( { x: I.position / w, y: O.position / w, zoom: w }, c(), i(), @@ -20227,7 +20258,7 @@ function Ale({ events: e, clock: t, scene: n }, r) { ), L = (j, H) => { !j.springing && Math.abs(H * w - j.position) > 1e-6 && (j.position = H * w, j.springing = !0, j.done = !1); }; - if (L(I, _.x), L(O, _.y), d({ x: I.position / w, y: O.position / w, zoom: w }), h(), I.done && O.done) { + if (L(I, B.x), L(O, B.y), f({ x: I.position / w, y: O.position / w, zoom: w }), h(), I.done && O.done) { u(s()), o.emit({ camera: s() }); return; } @@ -20247,7 +20278,7 @@ const n_ = (e) => ({ width: e.width, height: e.height, orientation: e.height >= e.width ? "portrait" : "landscape" -}), Sle = (e, t) => (e.minWidth === void 0 || t.width >= e.minWidth) && (e.maxWidth === void 0 || t.width <= e.maxWidth) && (e.minHeight === void 0 || t.height >= e.minHeight) && (e.maxHeight === void 0 || t.height <= e.maxHeight) && (e.orientation === void 0 || t.orientation === e.orientation), xle = (e, t) => typeof e.when == "function" ? !!e.when(t) : Sle(e.when, t), og = (e, t) => { +}), Sle = (e, t) => (e.minWidth === void 0 || t.width >= e.minWidth) && (e.maxWidth === void 0 || t.width <= e.maxWidth) && (e.minHeight === void 0 || t.height >= e.minHeight) && (e.maxHeight === void 0 || t.height <= e.maxHeight) && (e.orientation === void 0 || t.orientation === e.orientation), xle = (e, t) => typeof e.when == "function" ? !!e.when(t) : Sle(e.when, t), sg = (e, t) => { const n = { ...e }; let r; for (r in t) { @@ -20267,7 +20298,7 @@ const n_ = (e) => ({ let r = e; const o = []; for (const s of t) - xle(s, n) && (s.name !== void 0 && o.push(s.name), s.settings && (r = og(r, s.settings))); + xle(s, n) && (s.name !== void 0 && o.push(s.name), s.settings && (r = sg(r, s.settings))); return { effective: r, active: o }; }, Nle = { flow: "continuous", @@ -20289,7 +20320,7 @@ const n_ = (e) => ({ zoomAlign: { x: "center", y: "center" }, anchorAlign: { x: "start", y: "start" }, viewRotation: 0, - zoom: { mode: dr.Automatic }, + zoom: { mode: fr.Automatic }, minZoom: P0, maxZoom: s2, scrollBehavior: "smooth", @@ -20354,7 +20385,7 @@ const n_ = (e) => ({ activeRules: [], zoomDrag: null, locks: {}, - ...og(Nle, n) + ...sg(Nle, n) }; }, o_ = (e, t) => e.camera === t ? e : { ...e, camera: t }, cC = (e, t) => e.cameraResting === t ? e : { ...e, cameraResting: t }, Rle = (e) => e.placed ? e : { ...e, placed: !0 }, s_ = (e, t) => e.viewport === t ? e : { ...e, viewport: t }, Tle = (e, t) => e.dpr === t ? e : { ...e, dpr: t }, l2 = (e, t) => e.pageIndex === t ? e : { ...e, pageIndex: t }, Mle = (e, t) => e.motionCause === t ? e : { ...e, motionCause: t }; function La(e, t) { @@ -20370,7 +20401,7 @@ const Ble = (e, t) => e.activeRules === t ? e : { ...e, activeRules: t }, E1 = ( y: (t.y - e.y) * e.zoom }); function Lle(e, { scene: t }, n, { cancelAnimation: r, animateTo: o, startCameraPhysics: s }, { scrollMetricsNow: i }, a) { - const { camera: c, viewport: l, padding: u, zoomLimits: d, buildScene: f, stayBounds: h, constraint: g } = t, { + const { camera: c, viewport: l, padding: u, zoomLimits: f, buildScene: d, stayBounds: h, constraint: g } = t, { gesture: p, armRest: m, writeCamera: v, @@ -20380,14 +20411,14 @@ function Lle(e, { scene: t }, n, { cancelAnimation: r, animateTo: o, startCamera syncCursorFromCamera: N, markCause: w } = n, y = (x) => { - if (w("user"), r(), !f().itemCount) return; + if (w("user"), r(), !d().itemCount) return; const A = jce(c(), h(), l(), u(), x); x.behavior === "smooth" ? o(A, h(), void 0, N) : (v(A), N()); }; return { api: { setCamera: (x) => { - w("user"), r(), v({ ...x, zoom: ho(x.zoom, d()) }), N(); + w("user"), r(), v({ ...x, zoom: po(x.zoom, f()) }), N(); }, panBy: (x, A) => { if (!a.beforePan()) { @@ -20411,9 +20442,9 @@ function Lle(e, { scene: t }, n, { cancelAnimation: r, animateTo: o, startCamera }, zoomAround: (x, A) => { r(); - const b = f(), E = b.itemCount ? a2(b, i2(c(), x)) : null; - v(Lce(c(), x, A, d())), p.depth === 0 && e.state.update(La, { zoom: { level: c().zoom } }); - const I = f(); + const b = d(), E = b.itemCount ? a2(b, i2(c(), x)) : null; + v(Lce(c(), x, A, f())), p.depth === 0 && e.state.update(La, { zoom: { level: c().zoom } }); + const I = d(); I !== b && E && I.itemCount && v(CS(E, I, x, c().zoom)), p.depth > 0 && p.elastic && (p.raw = k(c())), N(); }, beginGesture: (x) => { @@ -20444,10 +20475,10 @@ function Fle(e, { scene: t, clock: n }, { scrollMetricsNow: r }, o) { previous: { x: a() ? k : C, y: v } }; }; - let u = null, d = !1, f = null; + let u = null, f = !1, d = null; const h = () => (u ?? (u = { startedAt: l(), push: jle, spent: !1 }), u), g = () => { - f?.(), f = n.after(A9, () => { - f = null, u = null; + d?.(), d = n.after(A9, () => { + d = null, u = null; }); }, p = (m, v, S) => { for (const C of ["y", "x"]) { @@ -20466,28 +20497,28 @@ function Fle(e, { scene: t, clock: n }, { scrollMetricsNow: r }, o) { beforePan: () => { if (!i()) return !1; const m = h(); - return d || g(), m.spent; + return f || g(), m.spent; }, /** After a rigid pan: the part of it the clamp refused, in screen px. */ refused: (m) => { - !i() || !u || (u.push = c_(u.push, c(m)), d || p(u, u.push, a_)); + !i() || !u || (u.push = c_(u.push, c(m)), f || p(u, u.push, a_)); }, /** * A wheel or trackpad pushes anew while its last push still coasts: the * next stream begins here, with no pause before it. */ pushBegan: () => { - d || (u = null); + f || (u = null); }, /** A drag begins: one stream for all of it, however long it holds still. */ dragBegan: () => { - i() && (f?.(), f = null, u = null, d = !0, h()); + i() && (d?.(), d = null, u = null, f = !0, h()); }, /** * The drag ended, its finger pulled `overshoot` past the edge (screen px). * True: it turned the page, so nothing springs home. */ - dragEnded: (m, v) => (d = !1, !i() || !u ? !1 : v ? (u = null, !1) : (g(), p(u, c_(u.push, c(m)), a_))), + dragEnded: (m, v) => (f = !1, !i() || !u ? !1 : v ? (u = null, !1) : (g(), p(u, c_(u.push, c(m)), a_))), /** The release speed, right after a drag. True: no momentum, as the page turned. */ flung: (m) => !i() || !u ? !1 : u.spent || p(u, c(m), Dle), /** @@ -20535,34 +20566,34 @@ function zle(e, { clock: t }, n, { panBy: r }) { }; return { api: { - wheelBy: (l, u, d) => { - const f = e.state.get().scrollChaining; - if (l === 0 && u === 0) return !f || (o ?? !0); + wheelBy: (l, u, f) => { + const d = e.state.get().scrollChaining; + if (l === 0 && u === 0) return !d || (o ?? !0); const h = n.leadsSomewhere({ x: l, y: u }); - return i.brokenBy(Math.max(Math.abs(l), Math.abs(u)), d) && (n.pushBegan(), s || (o = null)), o ?? (o = h), s = o && h, c(), f && !o ? !1 : (r(l, u), !0); + return i.brokenBy(Math.max(Math.abs(l), Math.abs(u)), f) && (n.pushBegan(), s || (o = null)), o ?? (o = h), s = o && h, c(), d && !o ? !1 : (r(l, u), !0); } } }; } const Wle = 150; function qle(e, { clock: t, placement: n, scene: r }) { - const { camera: o, viewport: s, padding: i, paged: a, buildScene: c, stayBounds: l, constraint: u } = r, d = { depth: 0, zoomed: !1, elastic: !1, raw: null }; - let f = null; + const { camera: o, viewport: s, padding: i, paged: a, buildScene: c, stayBounds: l, constraint: u } = r, f = { depth: 0, zoomed: !1, elastic: !1, raw: null }; + let d = null; const h = () => { - f?.(), f = null; + d?.(), d = null; }, g = () => { - !t.hasFrames || !n.started || (e.state.update(cC, !1), h(), f = t.after(Wle, () => { - f = null, e.state.update(cC, !0); + !t.hasFrames || !n.started || (e.state.update(cC, !1), h(), d = t.after(Wle, () => { + d = null, e.state.update(cC, !0); })); }, p = (w, y = l()) => { const x = hi(w, y, s(), u()); - x.zoom !== o().zoom && (d.depth > 0 ? (d.zoomed = !0, e.state.update(cC, !1), h()) : g()), e.state.update(o_, x); + x.zoom !== o().zoom && (f.depth > 0 ? (f.zoomed = !0, e.state.update(cC, !1), h()) : g()), e.state.update(o_, x); }, m = (w, y, x, A, b) => { const E = i(), [I, O] = w === "x" ? [E.left, E.right] : [E.top, E.bottom]; return !a9(y, x, A, b, I, O).fits; }; return { - gesture: d, + gesture: f, armRest: g, writeCamera: p, writeCameraUnclamped: (w) => e.state.update(o_, w), @@ -20624,7 +20655,7 @@ function qle(e, { clock: t, placement: n, scene: r }) { }; } const Gle = () => ({ started: !1, pending: null }); -function Cd(e, t, n) { +function Nd(e, t, n) { if (e.started) { n(t); return; @@ -20637,8 +20668,8 @@ function Jle(e, { scene: t, placement: n }, { writeCamera: r, markCause: o }, { viewport: c, padding: l, zoomLimits: u, - paged: d, - isFitAll: f, + paged: f, + isFitAll: d, itemIndexOfPage: h, buildScene: g, sceneRect: p, @@ -20652,67 +20683,67 @@ function Jle(e, { scene: t, placement: n }, { writeCamera: r, markCause: o }, { boundsFor: y, constraint: x, indexOfTarget: A - } = t, b = () => e.state.get(), E = () => e.document()?.pageCount ?? 0, I = (B) => { + } = t, b = () => e.state.get(), E = () => e.document()?.pageCount ?? 0, I = (_) => { for (let $ = 0; $ < 3; $++) { const D = g(); - if (B(), g() === D) return; + if (_(), g() === D) return; } - }, O = (B, $) => { + }, O = (_, $) => { I(() => { const D = g(); if (!D.itemCount) return; - const _ = D.items[D.itemOfPage(B.pageIndex)], L = ES(b().zoom, w(_), c(), l(), u()), j = N($ ?? b().anchorAlign, c()); - r($ce(B, D, c(), L, j), y(_)); + const B = D.items[D.itemOfPage(_.pageIndex)], L = ES(b().zoom, w(B), c(), l(), u()), j = N($ ?? b().anchorAlign, c()); + r($ce(_, D, c(), L, j), y(B)); }); - }, T = (B, $) => { - f() ? R(b().pageIndex, { behavior: "instant" }) : O(B, $); - }, R = (B, $) => { + }, T = (_, $) => { + d() ? R(b().pageIndex, { behavior: "instant" }) : O(_, $); + }, R = (_, $) => { if (o("programmatic"), s(), E() === 0) return; - const D = Math.max(0, Math.min(B, E() - 1)); + const D = Math.max(0, Math.min(_, E() - 1)); if (e.state.update(l2, D), $?.viewpoint) { e.state.update(La, { zoom: $.viewpoint.zoom }), O($.viewpoint.anchor); return; } - const _ = () => { + const B = () => { const L = g(); if (!L.itemCount) return null; - const j = d() ? L.items[0] : L.items[h(D)], H = ES(b().zoom, w(j), c(), l(), u()), Y = f() ? p() : k(m(j), H) ? m(j) : v(j, D), ue = { ...b().arrivalAlign, ...$?.arrivalAlign }, le = Fce( + const j = f() ? L.items[0] : L.items[h(D)], H = ES(b().zoom, w(j), c(), l(), u()), Y = d() ? p() : k(m(j), H) ? m(j) : v(j, D), le = { ...b().arrivalAlign, ...$?.arrivalAlign }, ie = Fce( Y, c(), H, l(), { - x: ue.x === "keep" ? "start" : ue.x, - y: ue.y === "keep" ? "start" : ue.y + x: le.x === "keep" ? "start" : le.x, + y: le.y === "keep" ? "start" : le.y }, b().direction - ), pe = y(j), ge = hi(le, pe, c(), { ...x(), bounded: !0 }); + ), pe = y(j), ve = hi(ie, pe, c(), { ...x(), bounded: !0 }); return { camera: { zoom: H, - x: ue.x === "keep" ? a().x : ge.x, - y: ue.y === "keep" ? a().y : ge.y + x: le.x === "keep" ? a().x : ve.x, + y: le.y === "keep" ? a().y : ve.y }, bounds: pe }; }; if (($?.behavior ?? b().scrollBehavior) === "smooth") { - const L = _(); + const L = B(); L && i(L.camera, L.bounds); } else I(() => { - const L = _(); + const L = B(); L && r(L.camera, L.bounds); }); - }, M = (B, $) => { + }, M = (_, $) => { const D = S(); if (D.length) - if (B === 1) { - const _ = Math.max(...D) + 1; - _ < E() && R(_, $); + if (_ === 1) { + const B = Math.max(...D) + 1; + B < E() && R(B, $); } else { - const _ = Math.min(...D) - 1; - _ >= 0 && R(C(_), $); + const B = Math.min(...D) - 1; + B >= 0 && R(C(B), $); } }, F = () => R(0, { behavior: "instant" }); return { @@ -20722,26 +20753,26 @@ function Jle(e, { scene: t, placement: n }, { writeCamera: r, markCause: o }, { goToTarget: R, resetView: F, api: { - goToPage: (B, $) => { - const D = A(B); - D !== null && Cd(n, $, (_) => R(D, _)); + goToPage: (_, $) => { + const D = A(_); + D !== null && Nd(n, $, (B) => R(D, B)); }, - goToFirstPage: (B) => Cd(n, B, ($) => R(0, $)), - goToLastPage: (B) => Cd( + goToFirstPage: (_) => Nd(n, _, ($) => R(0, $)), + goToLastPage: (_) => Nd( n, - B, + _, ($) => R(Math.max(0, (e.document()?.pageCount ?? 1) - 1), $) ), canGoNext: () => { - const B = S(); - return B.length > 0 && Math.max(...B) < E() - 1; + const _ = S(); + return _.length > 0 && Math.max(..._) < E() - 1; }, canGoPrevious: () => { - const B = S(); - return B.length > 0 && Math.min(...B) > 0; + const _ = S(); + return _.length > 0 && Math.min(..._) > 0; }, - nextPage: (B) => Cd(n, B, ($) => M(1, $)), - previousPage: (B) => Cd(n, B, ($) => M(-1, $)), + nextPage: (_) => Nd(n, _, ($) => M(1, $)), + previousPage: (_) => Nd(n, _, ($) => M(-1, $)), resetView: F } }; @@ -20792,8 +20823,8 @@ function Qle(e, { scene: t, placement: n }, { writeCamera: r, markCause: o }, { const { camera: l, viewport: u, - padding: d, - zoomLimits: f, + padding: f, + zoomLimits: d, paged: h, itemIndexOfPage: g, worldPageFrame: p, @@ -20803,19 +20834,19 @@ function Qle(e, { scene: t, placement: n }, { writeCamera: r, markCause: o }, { worldRectForContent: C, boundsFor: k, indexOfTarget: N - } = t, w = () => e.state.get(), y = (E, I, O, T, R, M, F, B, $) => { + } = t, w = () => e.state.get(), y = (E, I, O, T, R, M, F, _, $) => { if (E === "keep") return I; if (E === void 0) { if (!F) { - const _ = I + B / M, L = I + (R - $) / M; - return O >= _ && O + T <= L ? I : T > L - _ || O < _ ? O - B / M : O + T - (R - $) / M; + const B = I + _ / M, L = I + (R - $) / M; + return O >= B && O + T <= L ? I : T > L - B || O < B ? O - _ / M : O + T - (R - $) / M; } E = "center"; } - if (E === "start") return O - B / M; + if (E === "start") return O - _ / M; if (E === "end") return O + T - (R - $) / M; const D = E === "center" ? 0.5 : Math.min(1, Math.max(0, E)); - return O + T / 2 - (R * D + (B - $) / 2) / M; + return O + T / 2 - (R * D + (_ - $) / 2) / M; }, x = (E, I) => { o("programmatic"); const O = e.document()?.pageCount ?? 0; @@ -20826,75 +20857,75 @@ function Qle(e, { scene: t, placement: n }, { writeCamera: r, markCause: o }, { c(T, I); return; } - const B = m(); - if (!B.itemCount) return; - const $ = S(B.items[g(T)], T), D = p(), _ = { + const _ = m(); + if (!_.itemCount) return; + const $ = S(_.items[g(T)], T), D = p(), B = { x: $.x - D.left, y: $.y - D.top, width: $.width + D.left + D.right, height: $.height + D.top + D.bottom - }, L = Vce(l(), _, u(), d()), j = l(); + }, L = Vce(l(), B, u(), f()), j = l(); if (L.x === j.x && L.y === j.y) return; s(), (I?.behavior ?? w().scrollBehavior) === "smooth" ? i(L, v()) : r(L, v()); return; } s(), e.state.update(l2, T); const M = () => { - const B = m(); - if (!B.itemCount) return null; - const $ = h() ? B.items[0] : B.items[g(T)], D = I.rect ? C($, T, I.rect) : S($, T), _ = I.zoom ?? "keep", L = d(), j = Math.max(1, u().width - L.left - L.right), H = Math.max(1, u().height - L.top - L.bottom); - let Y = typeof _ == "object" ? _.level : _ === "fit" ? Math.min(j / D.width, H / D.height) : _ === "fit-width" ? j / D.width : _ === "fit-height" ? H / D.height : l().zoom; - (!Number.isFinite(Y) || Y <= 0) && (Y = l().zoom), Y = ho(Y, f()); - const ue = _ !== "keep", le = I.align ?? {}; + const _ = m(); + if (!_.itemCount) return null; + const $ = h() ? _.items[0] : _.items[g(T)], D = I.rect ? C($, T, I.rect) : S($, T), B = I.zoom ?? "keep", L = f(), j = Math.max(1, u().width - L.left - L.right), H = Math.max(1, u().height - L.top - L.bottom); + let Y = typeof B == "object" ? B.level : B === "fit" ? Math.min(j / D.width, H / D.height) : B === "fit-width" ? j / D.width : B === "fit-height" ? H / D.height : l().zoom; + (!Number.isFinite(Y) || Y <= 0) && (Y = l().zoom), Y = po(Y, d()); + const le = B !== "keep", ie = I.align ?? {}; return { camera: { x: y( - le.x, + ie.x, l().x, D.x, D.width, u().width, Y, - ue, + le, L.left, L.right ), y: y( - le.y, + ie.y, l().y, D.y, D.height, u().height, Y, - ue, + le, L.top, L.bottom ), zoom: Y }, bounds: k($), - zoomChanged: ue + zoomChanged: le }; }, F = M(); if (F) if (F.zoomChanged && e.state.update(La, { zoom: { level: F.camera.zoom } }), (I.behavior ?? w().scrollBehavior) === "smooth") { - const B = M() ?? F; - i(B.camera, B.bounds); + const _ = M() ?? F; + i(_.camera, _.bounds); } else a(() => { - const B = M(); - B && r(B.camera, B.bounds); + const _ = M(); + _ && r(_.camera, _.bounds); }); }; return { api: { reveal: (E, I) => { const O = N(E); - O !== null && Cd(n, I, (T) => x(O, T)); + O !== null && Nd(n, I, (T) => x(O, T)); }, goToDestination: (E, I) => { const O = e.getPage(E.page); if (!O) return; const T = Yle(E, O.size); - Cd( + Nd( n, { ...T, behavior: I?.behavior }, (R) => x(O.index, R) @@ -20926,7 +20957,7 @@ const S9 = [ 32, 48, 64 -], Xle = [...S9].reverse(), x9 = 1.05, l_ = 1e-9, Zle = (e, t) => ho(S9.find((n) => n > e * x9) ?? t.max, t), eue = (e, t) => ho(Xle.find((n) => n < e / x9) ?? t.min, t); +], Xle = [...S9].reverse(), x9 = 1.05, l_ = 1e-9, Zle = (e, t) => po(S9.find((n) => n > e * x9) ?? t.max, t), eue = (e, t) => po(Xle.find((n) => n < e / x9) ?? t.min, t); function tue(e, { scene: t }, { syncCursorFromCamera: n }, { cancelAnimation: r, animateZoomAnchored: o @@ -20936,8 +20967,8 @@ function tue(e, { scene: t }, { syncCursorFromCamera: n }, { viewport: c, padding: l, zoomLimits: u, - paged: d, - itemIndexOfPage: f, + paged: f, + itemIndexOfPage: d, buildScene: h, alignPoint: g, fitBox: p @@ -20950,19 +20981,19 @@ function tue(e, { scene: t }, { syncCursorFromCamera: n }, { r(); const N = h(); if (!N.itemCount) return; - const w = d() ? N.items[0] : N.items[f(m().pageIndex)], y = p(w), x = u(), A = ES( - { mode: dr.Automatic }, + const w = f() ? N.items[0] : N.items[d(m().pageIndex)], y = p(w), x = u(), A = ES( + { mode: fr.Automatic }, y, c(), l(), x ), b = ES( - { mode: dr.FitWidth }, + { mode: fr.FitWidth }, y, c(), l(), x - ), E = [A, b, ho(A * 2.5, x)].sort((F, B) => F - B).filter((F, B, $) => B === 0 || F > $[B - 1] * 1.1), I = (F, B) => F > B / 1.1 && F < B * 1.1, O = E.findIndex((F) => I(a().zoom, F)), T = O >= 0 ? E[(O + 1) % E.length] : E[0]; + ), E = [A, b, po(A * 2.5, x)].sort((F, _) => F - _).filter((F, _, $) => _ === 0 || F > $[_ - 1] * 1.1), I = (F, _) => F > _ / 1.1 && F < _ * 1.1, O = E.findIndex((F) => I(a().zoom, F)), T = O >= 0 ? E[(O + 1) % E.length] : E[0]; e.state.update(La, { zoom: { level: T } }); const R = h(); if (!R.itemCount) return; @@ -20981,10 +21012,10 @@ function tue(e, { scene: t }, { syncCursorFromCamera: n }, { i.updateSettings({ zoom: k }); }, zoomBy: (k, N) => s.zoomAround(N?.around ?? v(), k), - fitWidth: () => i.updateSettings({ zoom: { mode: dr.FitWidth } }), - fitPage: () => i.updateSettings({ zoom: { mode: dr.FitPage } }), - fitAll: () => i.updateSettings({ zoom: { mode: dr.FitAll } }), - fitAutomatic: () => i.updateSettings({ zoom: { mode: dr.Automatic } }), + fitWidth: () => i.updateSettings({ zoom: { mode: fr.FitWidth } }), + fitPage: () => i.updateSettings({ zoom: { mode: fr.FitPage } }), + fitAll: () => i.updateSettings({ zoom: { mode: fr.FitAll } }), + fitAutomatic: () => i.updateSettings({ zoom: { mode: fr.Automatic } }), setViewRotation: C, rotateViewBy: (k) => C(s9(m().viewRotation, k === 90 ? 90 : 270)) } @@ -21012,17 +21043,17 @@ function nue(e, { scene: t }, { }, u = (g) => { const p = l(g.page, g.from), m = l(g.page, g.to); return p && m ? d_(p, m) : null; - }, d = tt( + }, f = tt( () => (t.buildScene(), [c().zoomDrag, t.camera(), t.cacheKey()]), (g, p, m) => { const v = g && u(g); return v && f_(v) ? v : null; } - ), f = (g) => { + ), d = (g) => { const p = a.pageToWorld(g.page, g.from), m = a.pageToWorld(g.page, g.to); return p && m ? d_(p, m) : null; }, h = (g) => { - const p = f(g); + const p = d(g); if (!p) return; const m = t.viewport(), v = t.padding(), S = Math.min( Math.max(1, m.width - v.left - v.right) / p.width, @@ -21031,7 +21062,7 @@ function nue(e, { scene: t }, { if (!Number.isFinite(S)) return; const C = Math.min(s2, Math.max(P0, S)); e.state.update(La, { zoom: { level: C } }); - const k = f(g) ?? p, N = t.camera(), w = hi( + const k = d(g) ?? p, N = t.camera(), w = hi( { zoom: C, // Centered in the padded viewport. @@ -21081,7 +21112,7 @@ function nue(e, { scene: t }, { } }, cancelZoomDrag: () => e.state.update(E1, null), - getZoomBox: d + getZoomBox: f } }; } @@ -21096,13 +21127,13 @@ function rue(e, { scene: t }) { cacheKey: c, stayBounds: l, cursorItem: u, - currentPages: d, - currentAnchor: f + currentPages: f, + currentAnchor: d } = t, h = () => e.state.get(), g = (b) => e.document()?.pages[b]?.ref.objectNumber ?? b + 1, p = (b) => { - const E = pg({ width: b.width, height: b.height }, b.rotation); + const E = gg({ width: b.width, height: b.height }, b.rotation); return { width: E.width / b.contentScale, height: E.height / b.contentScale }; }, m = (b) => { - const E = e.document()?.pages[b.pageIndex], I = E ? { width: E.size.width, height: E.size.height } : p(b), O = n(), T = o(), R = (b.x - O.x) * O.zoom, M = (b.y - O.y) * O.zoom, F = h().cameraResting, B = F ? zB(R, T) : R, $ = F ? zB(M, T) : M, D = Nce({ + const E = e.document()?.pages[b.pageIndex], I = E ? { width: E.size.width, height: E.size.height } : p(b), O = n(), T = o(), R = (b.x - O.x) * O.zoom, M = (b.y - O.y) * O.zoom, F = h().cameraResting, _ = F ? zB(R, T) : R, $ = F ? zB(M, T) : M, D = Nce({ pageSize: I, rotation: b.rotation, scale: b.contentScale * O.zoom, @@ -21111,14 +21142,14 @@ function rue(e, { scene: t }) { // independent of sizing mode or camera state. baseScale: h().viewUnitsPerPoint * (E?.userUnit ?? 1), dpr: T - }), _ = r(), L = O0( - { x: -B, y: -$, width: _.width, height: _.height }, + }), B = r(), L = O0( + { x: -_, y: -$, width: B.width, height: B.height }, { x: 0, y: 0, width: D.viewWidth, height: D.viewHeight } ), j = L.width > 0 && L.height > 0 ? D.viewToPageRect(L) : { x: 0, y: 0, width: 0, height: 0 }; return { ...b, - ref: Lt(g(b.pageIndex)), - screenX: B, + ref: Ft(g(b.pageIndex)), + screenX: _, screenY: $, transform: D, visibleRect: j @@ -21158,9 +21189,9 @@ function rue(e, { scene: t }) { h().cameraResting ]; }, - (b, E, I, O, T, R, M, F, B) => { + (b, E, I, O, T, R, M, F, _) => { const $ = a(); - return (i() ? $.items.slice(0, 1) : $.query(_ce({ x: I, y: O, zoom: T }, { width: R, height: M }))).flatMap((_) => _.pages).map(m); + return (i() ? $.items.slice(0, 1) : $.query(_ce({ x: I, y: O, zoom: T }, { width: R, height: M }))).flatMap((B) => B.pages).map(m); } ), w = () => h().placed ? N() : k, y = (b) => { if (!h().placed) return null; @@ -21175,7 +21206,7 @@ function rue(e, { scene: t }) { }, x = (b, E) => { const I = y(b); if (!I) return null; - const O = pg({ width: I.width, height: I.height }, I.rotation), T = xS( + const O = gg({ width: I.width, height: I.height }, I.rotation), T = xS( I.contentScale, O.width, O.height, @@ -21204,7 +21235,7 @@ function rue(e, { scene: t }) { }, listCurrentPages: () => { const b = e.document()?.pages ?? []; - return d().map((E) => b[E]).filter((E) => E !== void 0); + return f().map((E) => b[E]).filter((E) => E !== void 0); }, getPageBox: y, getPageAt: (b) => { @@ -21232,7 +21263,7 @@ function rue(e, { scene: t }) { pageRectToViewport: (b, E) => { const I = y(b); if (!I) return null; - const O = pg({ width: I.width, height: I.height }, I.rotation), T = xS( + const O = gg({ width: I.width, height: I.height }, I.rotation), T = xS( I.contentScale, O.width, O.height, @@ -21257,17 +21288,17 @@ function rue(e, { scene: t }) { const b = h().zoom; return "mode" in b ? b.mode : "custom"; }, - getViewpoint: () => ({ anchor: f(), zoom: h().zoom }), + getViewpoint: () => ({ anchor: d(), zoom: h().zoom }), getCurrentDestination: () => { const { left: b, top: E } = s(), I = n(), O = w().filter((F) => { - const B = Vy(I, { x: F.x + F.width, y: F.y + F.height }); - return B.x > b && B.y > E; - }).sort((F, B) => F.pageIndex - B.pageIndex)[0], T = O && e.getPage(O.ref)?.size; + const _ = Vy(I, { x: F.x + F.width, y: F.y + F.height }); + return _.x > b && _.y > E; + }).sort((F, _) => F.pageIndex - _.pageIndex)[0], T = O && e.getPage(O.ref)?.size; if (!O || !T) return null; const R = O.transform.viewToPage({ x: b - O.screenX, y: E - O.screenY - }), M = (F, B) => Math.round(Math.min(Math.max(F, 0), B) * 100) / 100; + }), M = (F, _) => Math.round(Math.min(Math.max(F, 0), _) * 100) / 100; return { kind: "xyz", page: O.ref, @@ -21296,145 +21327,145 @@ function oue(e) { }), { pageChanged: t, zoomChanged: n, cameraChanged: r, motionEnded: o, settingsChanged: s, viewportChanged: i }; } function sue(e) { - const t = () => e.state.get(), n = () => t().camera, r = () => t().viewport, o = () => t().dpr, s = () => $f(t().padding), i = () => Bce(t().minZoom, t().maxZoom), a = () => t().flow === "paged", c = () => { - const te = t().zoom; - return "mode" in te && te.mode === dr.FitAll; + const t = () => e.state.get(), n = () => t().camera, r = () => t().viewport, o = () => t().dpr, s = () => Kf(t().padding), i = () => Bce(t().minZoom, t().maxZoom), a = () => t().flow === "paged", c = () => { + const ee = t().zoom; + return "mode" in ee && ee.mode === fr.FitAll; }, l = tt( () => [e.document()?.pageCount ?? 0, t().spread], - (te, he) => { - const Te = Hce(te, he); - return { grouping: Te, firstPages: Te.map((ze) => ze[0]) }; + (ee, he) => { + const Te = Hce(ee, he); + return { grouping: Te, firstPages: Te.map((We) => We[0]) }; } - ), u = () => l().grouping.length, d = (te) => { + ), u = () => l().grouping.length, f = (ee) => { const he = l().firstPages; - let Te = 0, ze = he.length; - for (; Te < ze; ) { - const ae = Te + ze >> 1; - he[ae] <= te ? Te = ae + 1 : ze = ae; + let Te = 0, We = he.length; + for (; Te < We; ) { + const ae = Te + We >> 1; + he[ae] <= ee ? Te = ae + 1 : We = ae; } return Math.max(0, Te - 1); - }, f = () => { - const te = t().zoom; - return "level" in te ? ho(te.level, i()) : Math.max(t().camera.zoom, 1e-4); + }, d = () => { + const ee = t().zoom; + return "level" in ee ? po(ee.level, i()) : Math.max(t().camera.zoom, 1e-4); }, h = () => { - const { left: te, right: he } = s(); - return Math.max(1, (r().width - te - he) / f()); + const { left: ee, right: he } = s(); + return Math.max(1, (r().width - ee - he) / d()); }, g = () => { - const te = t().pageFrame; - if (!te.top && !te.right && !te.bottom && !te.left) return te; - const he = f(); + const ee = t().pageFrame; + if (!ee.top && !ee.right && !ee.bottom && !ee.left) return ee; + const he = d(); return { - top: te.top / he, - right: te.right / he, - bottom: te.bottom / he, - left: te.left / he + top: ee.top / he, + right: ee.right / he, + bottom: ee.bottom / he, + left: ee.left / he }; }, p = () => { - const te = t().pageFrame; - if (!te.top && !te.right && !te.bottom && !te.left) return "-"; + const ee = t().pageFrame; + if (!ee.top && !ee.right && !ee.bottom && !ee.left) return "-"; const he = g(); return `${Math.round(he.top)},${Math.round(he.right)},${Math.round(he.bottom)},${Math.round(he.left)}`; }, m = () => { - const te = t().gap; - return typeof te == "number" ? te : te.px ? te.px / f() : 0; + const ee = t().gap; + return typeof ee == "number" ? ee : ee.px ? ee.px / d() : 0; }, v = () => { - const te = t().gap; - return typeof te == "number" ? String(te) : `px:${Math.round(m())}`; - }, S = (te) => { - const he = t(), Te = e.document()?.pages ?? [], ze = he.viewRotation, ae = ze === 0 ? Te : Te.map((Ae) => ({ + const ee = t().gap; + return typeof ee == "number" ? String(ee) : `px:${Math.round(m())}`; + }, S = (ee) => { + const he = t(), Te = e.document()?.pages ?? [], We = he.viewRotation, ae = We === 0 ? Te : Te.map((Ae) => ({ ...Ae, - rotation: s9(Ae.rotation, ze) - })), me = g(), W = m(), Se = he.viewUnitsPerPoint; - return he.layout === "grid" ? Kce(ae, te, { + rotation: s9(Ae.rotation, We) + })), ge = g(), W = m(), Se = he.viewUnitsPerPoint; + return he.layout === "grid" ? Kce(ae, ee, { gap: W, sizing: he.sizing, direction: he.direction, - pageFrame: me, + pageFrame: ge, viewUnitsPerPoint: Se, columns: typeof he.columns == "number" ? he.columns : void 0, lineWidth: he.columns === "auto" ? h() : void 0 - }) : Uce(ae, te, { + }) : Uce(ae, ee, { axis: he.layout === "horizontal" ? "x" : "y", gap: W, sizing: he.sizing, direction: he.direction, - pageFrame: me, + pageFrame: ge, viewUnitsPerPoint: Se }); }, k = { columns: () => { - const te = t(); - return te.layout !== "grid" ? "-" : te.columns === "auto" ? `auto:${Math.round(h())}` : String(te.columns); + const ee = t(); + return ee.layout !== "grid" ? "-" : ee.columns === "auto" ? `auto:${Math.round(h())}` : String(ee.columns); }, gap: v, pageFrame: p - }, N = Xi.filter((te) => Zw[te] === "scene"), w = () => N.map((te) => { - const he = k[te]; + }, N = Xi.filter((ee) => Zw[ee] === "scene"), w = () => N.map((ee) => { + const he = k[ee]; if (he) return he(); - const Te = t()[te]; + const Te = t()[ee]; return typeof Te == "object" && Te !== null ? JSON.stringify(Te) : String(Te); }).join("|"); let y = null; const x = () => { - const te = e.document(); - return te ? `${te.pageCount}.${te.pagesSequence}` : "0.0"; + const ee = e.document(); + return ee ? `${ee.pageCount}.${ee.pagesSequence}` : "0.0"; }, A = () => { - const { grouping: te } = l(); + const { grouping: ee } = l(); if (t().flow === "paged") { - const ze = te.length ? Math.min(d(t().pageIndex), te.length - 1) : 0, ae = `paged|${x()}|${w()}|${ze}`; + const We = ee.length ? Math.min(f(t().pageIndex), ee.length - 1) : 0, ae = `paged|${x()}|${w()}|${We}`; if (y && y.key === ae) return y.scene; - const me = S(te.length ? [te[ze]] : []); - return y = { key: ae, scene: me }, me; + const ge = S(ee.length ? [ee[We]] : []); + return y = { key: ae, scene: ge }, ge; } const he = `continuous|${x()}|${w()}`; if (y && y.key === he) return y.scene; - const Te = S(te); + const Te = S(ee); return y = { key: he, scene: Te }, Te; }, b = () => { y = null; }, E = () => y.key, I = () => { - const { width: te, height: he } = A().size; - return { x: 0, y: 0, width: te, height: he }; - }, O = (te) => ({ - x: te.x, - y: te.y, - width: te.width, - height: te.height - }), T = (te, he) => { - const Te = te.pages.find((ze) => ze.pageIndex === he) ?? te.pages[0]; + const { width: ee, height: he } = A().size; + return { x: 0, y: 0, width: ee, height: he }; + }, O = (ee) => ({ + x: ee.x, + y: ee.y, + width: ee.width, + height: ee.height + }), T = (ee, he) => { + const Te = ee.pages.find((We) => We.pageIndex === he) ?? ee.pages[0]; return { x: Te.x, y: Te.y, width: Te.width, height: Te.height }; }, R = () => { - const te = A(); - return a() ? te.items[0] : te.items[d(t().pageIndex)]; - }, M = (te) => c() || D(O(te), n().zoom), F = () => { - const te = R(); - return te ? M(te) ? te.pageIndexes : [t().pageIndex] : []; - }, B = (te) => { - const he = l().grouping[d(te)]; - if (!he || he.length === 1) return te; - const Te = A(), ze = a() ? Te.items[0] : Te.items[d(te)]; - return ze && M(ze) ? he[0] : te; - }, $ = (te, he, Te) => { - const ze = te.pages.find((Se) => Se.pageIndex === he) ?? te.pages[0], ae = pg({ width: ze.width, height: ze.height }, ze.rotation), me = xS(ze.contentScale, ae.width, ae.height, ze.rotation), W = SS(me, Te); - return { x: ze.x + W.x, y: ze.y + W.y, width: W.width, height: W.height }; - }, D = (te, he) => { - const Te = r(), ze = s(); - return te.width * he <= Te.width - ze.left - ze.right + 0.5; - }, _ = (te) => te === "start" ? 0 : te === "center" ? 0.5 : te === "end" ? 1 : Math.min(1, Math.max(0, te)), L = (te, he) => { - const Te = t().direction === "rtl", ze = Te && te.x === "start" ? "end" : Te && te.x === "end" ? "start" : te.x, ae = s(); + const ee = A(); + return a() ? ee.items[0] : ee.items[f(t().pageIndex)]; + }, M = (ee) => c() || D(O(ee), n().zoom), F = () => { + const ee = R(); + return ee ? M(ee) ? ee.pageIndexes : [t().pageIndex] : []; + }, _ = (ee) => { + const he = l().grouping[f(ee)]; + if (!he || he.length === 1) return ee; + const Te = A(), We = a() ? Te.items[0] : Te.items[f(ee)]; + return We && M(We) ? he[0] : ee; + }, $ = (ee, he, Te) => { + const We = ee.pages.find((Se) => Se.pageIndex === he) ?? ee.pages[0], ae = gg({ width: We.width, height: We.height }, We.rotation), ge = xS(We.contentScale, ae.width, ae.height, We.rotation), W = SS(ge, Te); + return { x: We.x + W.x, y: We.y + W.y, width: W.width, height: W.height }; + }, D = (ee, he) => { + const Te = r(), We = s(); + return ee.width * he <= Te.width - We.left - We.right + 0.5; + }, B = (ee) => ee === "start" ? 0 : ee === "center" ? 0.5 : ee === "end" ? 1 : Math.min(1, Math.max(0, ee)), L = (ee, he) => { + const Te = t().direction === "rtl", We = Te && ee.x === "start" ? "end" : Te && ee.x === "end" ? "start" : ee.x, ae = s(); return { - x: ae.left + (he.width - ae.left - ae.right) * _(ze), - y: ae.top + (he.height - ae.top - ae.bottom) * _(te.y) + x: ae.left + (he.width - ae.left - ae.right) * B(We), + y: ae.top + (he.height - ae.top - ae.bottom) * B(ee.y) }; - }, j = () => L(t().anchorAlign, r()), H = (te) => c() ? A().size : a() ? { width: te.width, height: te.height } : A().maxItemSize, Y = (te) => a() ? O(te) : I(), ue = () => a() ? O(A().items[0]) : I(), le = () => ({ + }, j = () => L(t().anchorAlign, r()), H = (ee) => c() ? A().size : a() ? { width: ee.width, height: ee.height } : A().maxItemSize, Y = (ee) => a() ? O(ee) : I(), le = () => a() ? O(A().items[0]) : I(), ie = () => ({ bounded: t().bounded, padding: s(), fitAlign: t().fitAlign, direction: t().direction - }), pe = (te) => { + }), pe = (ee) => { const he = A(); - return he.itemCount ? c9(n(), he, r(), te) : { pageIndex: t().pageIndex, fractionX: 0.5, fractionY: 0 }; - }, ge = () => pe(j()), Me = (te) => e.getPage(te)?.index ?? -1; + return he.itemCount ? c9(n(), he, r(), ee) : { pageIndex: t().pageIndex, fractionX: 0.5, fractionY: 0 }; + }, ve = () => pe(j()), _e = (ee) => e.getPage(ee)?.index ?? -1; return { camera: n, viewport: r, @@ -21445,7 +21476,7 @@ function sue(e) { isFitAll: c, grouping: l, itemCountFull: u, - itemIndexOfPage: d, + itemIndexOfPage: f, worldPageFrame: g, buildScene: A, invalidate: b, @@ -21455,21 +21486,21 @@ function sue(e) { pageRectOf: T, cursorItem: R, currentPages: F, - unitStartOf: B, + unitStartOf: _, worldRectForContent: $, fitsAcross: D, alignPoint: L, anchorPoint: j, fitBox: H, boundsFor: Y, - stayBounds: ue, - constraint: le, + stayBounds: le, + constraint: ie, anchorAt: pe, - currentAnchor: ge, - indexOfPage: Me, - indexOfTarget: (te) => { - if (typeof te == "number") return Number.isInteger(te) ? te : null; - const he = Me(te); + currentAnchor: ve, + indexOfPage: _e, + indexOfTarget: (ee) => { + if (typeof ee == "number") return Number.isInteger(ee) ? ee : null; + const he = _e(ee); return he >= 0 ? he : null; } }; @@ -21494,13 +21525,13 @@ function aue(e, { scene: t }, n, { writeCamera: r }, { cancelAnimation: o }, { reapply: i, goToTarget: a }) { - const { camera: c, viewport: l, alignPoint: u, anchorAt: d } = t, f = () => e.state.get(), h = tt( - () => Xi.map((I) => f()[I]), - () => CN(f()) + const { camera: c, viewport: l, alignPoint: u, anchorAt: f } = t, d = () => e.state.get(), h = tt( + () => Xi.map((I) => d()[I]), + () => CN(d()) ), g = (I) => { o(); - const O = (M) => Xi.some((F) => I[F] !== void 0 && Zw[F] === M), T = O("refit") && !O("scene") && !O("reflow") ? f().zoomAlign : f().anchorAlign, R = d(u(T, l())); - e.state.update(La, I), O("scene") && t.invalidate(), O("reflow") ? a(f().pageIndex, { behavior: "instant" }) : O("scene") || O("refit") ? i(R, T) : O("reclamp") && r(c()); + const O = (M) => Xi.some((F) => I[F] !== void 0 && Zw[F] === M), T = O("refit") && !O("scene") && !O("reflow") ? d().zoomAlign : d().anchorAlign, R = f(u(T, l())); + e.state.update(La, I), O("scene") && t.invalidate(), O("reflow") ? a(d().pageIndex, { behavior: "instant" }) : O("scene") || O("refit") ? i(R, T) : O("reclamp") && r(c()); }; let p = h(); const m = p; @@ -21509,7 +21540,7 @@ function aue(e, { scene: t }, n, { writeCamera: r }, { cancelAnimation: o }, { const { effective: I, active: O } = r_(p, v, n_(l())); return { effective: C.reduce( - (T, R) => og(T, R.settings), + (T, R) => sg(T, R.settings), I ), active: O @@ -21522,18 +21553,18 @@ function aue(e, { scene: t }, n, { writeCamera: r }, { cancelAnimation: o }, { by: M.by, ...M.reasonKey !== void 0 ? { reasonKey: M.reasonKey } : {} }); - const O = f().locks, T = Object.keys(I); + const O = d().locks, T = Object.keys(I); T.length === Object.keys(O).length && T.every( (M) => O[M]?.by === I[M].by && O[M]?.reasonKey === I[M].reasonKey ) || e.state.update(_le, I); }, w = (I) => { - const O = f().activeRules; + const O = d().activeRules; (O.length !== I.length || I.some((T, R) => T !== O[R])) && e.state.update(Ble, I); }, y = (I, O = []) => { const { effective: T, active: R } = k(), M = {}; for (const $ of Xi) { - const D = !Jk(T[$], S[$]), _ = O.includes($) && !Jk(T[$], f()[$]); - (D || _) && Object.assign(M, { [$]: T[$] }); + const D = !Jk(T[$], S[$]), B = O.includes($) && !Jk(T[$], d()[$]); + (D || B) && Object.assign(M, { [$]: T[$] }); } S = T, w(R); const F = Object.keys(M); @@ -21541,17 +21572,17 @@ function aue(e, { scene: t }, n, { writeCamera: r }, { cancelAnimation: o }, { if (I) return g(M), "none"; e.state.update(La, M); - let B = "none"; + let _ = "none"; for (const $ of F) - h_[Zw[$]] > h_[B] && (B = Zw[$]); - return (B === "scene" || B === "reflow") && t.invalidate(), B; + h_[Zw[$]] > h_[_] && (_ = Zw[$]); + return (_ === "scene" || _ === "reflow") && t.invalidate(), _; }, x = (I) => { - p = og(p, I), y( + p = sg(p, I), y( !0, Xi.filter((O) => I[O] !== void 0) ); }, A = (I) => { - o(), p = og(p, CN(I)); + o(), p = sg(p, CN(I)); const { effective: O, active: T } = k(); S = O, w(T), e.state.update(La, O), e.state.update(l2, I.pageIndex ?? 0), t.invalidate(), s(I.anchor); }; @@ -21561,7 +21592,7 @@ function aue(e, { scene: t }, n, { writeCamera: r }, { cancelAnimation: o }, { const I = h(); if (C.length === 0) return I; const { effective: O } = r_(p, v, n_(l())), T = { ...I }; - for (const R of Object.keys(f().locks)) + for (const R of Object.keys(d().locks)) Object.assign(T, { [R]: O[R] }); return T; }, @@ -21571,7 +21602,7 @@ function aue(e, { scene: t }, n, { writeCamera: r }, { cancelAnimation: o }, { api: { getSettings: h, resetSettings: () => { - p = og(m, {}), y(!0, Xi); + p = sg(m, {}), y(!0, Xi); }, updateSettings: x, setResponsiveRules: (I) => { @@ -21581,19 +21612,19 @@ function aue(e, { scene: t }, n, { writeCamera: r }, { cancelAnimation: o }, { const O = p_(I); for (const M of O) { if (!Xi.includes(M)) - throw new re("invalid-input", "stage", `"${M}" is not a Stage setting`); + throw new te("invalid-input", "stage", `"${M}" is not a Stage setting`); if (M === "zoom") - throw new re( + throw new te( "invalid-input", "stage", "the zoom cannot be locked: gestures set it" ); - const F = C.find((B) => { - const $ = B.settings[M]; + const F = C.find((_) => { + const $ = _.settings[M]; return $ !== void 0 && !Jk($, I.settings[M]); }); if (F) - throw new re( + throw new te( "conflict", "stage", `"${M}" is locked by ${F.by} at another value` @@ -21606,9 +21637,9 @@ function aue(e, { scene: t }, n, { writeCamera: r }, { cancelAnimation: o }, { R || (R = !0, C = C.filter((M) => M !== T), N(), y(!0, O)); }; }, - getLock: (I) => f().locks[I] ?? null, - matchesRule: (I) => f().activeRules.includes(I), - listActiveRules: () => f().activeRules, + getLock: (I) => d().locks[I] ?? null, + matchesRule: (I) => d().activeRules.includes(I), + listActiveRules: () => d().activeRules, applyViewState: A } }; @@ -21617,7 +21648,7 @@ const p_ = (e) => Object.keys(e.settings).filter( (t) => e.settings[t] !== void 0 ); function cue(e, { scene: t, placement: n }, { cancelAnimation: r }, o, s) { - const { dpr: i, currentAnchor: a } = t, { goToTarget: c, reapply: l } = o, { snapshotSettings: u, viewStateSettings: d, syncResponsive: f } = s, h = () => e.state.get(), g = [], p = () => { + const { dpr: i, currentAnchor: a } = t, { goToTarget: c, reapply: l } = o, { snapshotSettings: u, viewStateSettings: f, syncResponsive: d } = s, h = () => e.state.get(), g = [], p = () => { n.started = !0; const m = [...g].sort( (C, k) => k.priority - C.priority @@ -21633,7 +21664,7 @@ function cue(e, { scene: t, placement: n }, { cancelAnimation: r }, o, s) { api: { setViewportSize: (m) => { if (!n.started) { - e.state.update(s_, m), f(!1), m.width > 0 && m.height > 0 && (e.document()?.pageCount ?? 0) > 0 && p(); + e.state.update(s_, m), d(!1), m.width > 0 && m.height > 0 && (e.document()?.pageCount ?? 0) > 0 && p(); return; } if (m.width <= 0 || m.height <= 0) return; @@ -21641,7 +21672,7 @@ function cue(e, { scene: t, placement: n }, { cancelAnimation: r }, o, s) { if (m.width === v.width && m.height === v.height) return; r(); const S = a(); - e.state.update(s_, m), f(!1) === "reflow" ? c(h().pageIndex, { behavior: "instant" }) : l(S); + e.state.update(s_, m), d(!1) === "reflow" ? c(h().pageIndex, { behavior: "instant" }) : l(S); }, setDevicePixelRatio: (m) => { m > 0 && m !== i() && e.state.update(Tle, m); @@ -21651,7 +21682,7 @@ function cue(e, { scene: t, placement: n }, { cancelAnimation: r }, o, s) { }, getViewState: () => ({ // A lock is this document's now, not the user's: the saved view keeps what's under it. - ...d(), + ...f(), pageIndex: h().pageIndex, anchor: a() }), @@ -21668,14 +21699,14 @@ function cue(e, { scene: t, placement: n }, { cancelAnimation: r }, o, s) { }; } function lue(e, t = {}) { - const n = iue(e), { events: r } = n, o = rue(e, n), s = qle(e, n), i = Ale(n, s), a = Jle(e, n, s, i), c = Fle(e, n, o, a.api), l = Lle(e, n, s, i, o, c), u = zle(e, n, c, l.api), d = Qle(e, n, s, i, a), f = aue(e, n, t, s, i, a), h = tue(e, n, s, i, l.api, f), g = nue(e, n, s, i, { ...o.api, ...h.api }), p = cue(e, n, i, a, f), m = tu("stage", [ + const n = iue(e), { events: r } = n, o = rue(e, n), s = qle(e, n), i = Ale(n, s), a = Jle(e, n, s, i), c = Fle(e, n, o, a.api), l = Lle(e, n, s, i, o, c), u = zle(e, n, c, l.api), f = Qle(e, n, s, i, a), d = aue(e, n, t, s, i, a), h = tue(e, n, s, i, l.api, d), g = nue(e, n, s, i, { ...o.api, ...h.api }), p = cue(e, n, i, a, d), m = nu("stage", [ o.api, i.api, l.api, u.api, a.api, - d.api, f.api, + d.api, h.api, g.api, p.api, @@ -21694,7 +21725,7 @@ function lue(e, t = {}) { }; } const g_ = (e = {}) => { - const { id: t = w9, token: n = Zt, ...r } = e; + const { id: t = w9, token: n = tn, ...r } = e; return { id: t, token: n, @@ -21703,7 +21734,7 @@ const g_ = (e = {}) => { state: () => Ple(r), create: (o) => lue(o, r) }; -}, m_ = wr(Zt, { +}, m_ = wr(tn, { read: (e) => ({ zoomLevel: e.getZoomLevel(), zoomMode: e.getZoomMode(), @@ -21715,7 +21746,7 @@ const g_ = (e = {}) => { }), empty: { zoomLevel: 1, - zoomMode: dr.Automatic, + zoomMode: fr.Automatic, currentPageIndex: 0, currentPage: null, pageCount: 0, @@ -21757,10 +21788,10 @@ function due(e, t) { } const Cn = yr, T0 = (e, t) => e.project?.(t) ?? (e.page?.ref.objectNumber === t.objectNumber ? e.page.point : null), mR = Fn(null), fue = mR.Provider, E9 = Fn(null), hue = E9.Provider; function pue() { - return Et(mR); + return Ct(mR); } function C9() { - const e = Et(mR); + const e = Ct(mR); if (!e) throw new Error( "No ViewProjector in scope: mount anchored UI under (overlay slot) or ." @@ -21768,7 +21799,7 @@ function C9() { return e; } function u2(e) { - const t = Et(E9); + const t = Ct(E9); return !e.anchor?.bounds || t && !t.has(e.anchor.page.objectNumber) ? null : /* @__PURE__ */ P(gue, { ...e }); } function gue({ @@ -21778,9 +21809,9 @@ function gue({ pinned: r = !1, children: o }) { - const { projector: s, subscribe: i } = C9(), [a, c] = De(null), [l, u] = De(null), [, d] = Wl((g) => g + 1, 0); - if (Ze(() => i ? i(d) : void 0, [i]), Ze(() => { - s.space === "client" && d(); + const { projector: s, subscribe: i } = C9(), [a, c] = je(null), [l, u] = je(null), [, f] = ql((g) => g + 1, 0); + if (Ze(() => i ? i(f) : void 0, [i]), Ze(() => { + s.space === "client" && f(); }, [s, e]), Ze(() => { if (a) return kse( @@ -21793,25 +21824,25 @@ function gue({ const g = (p) => p.stopPropagation(); return a.addEventListener("pointerdown", g), () => a.removeEventListener("pointerdown", g); }, [a]), !e?.bounds) return null; - const f = bse( + const d = bse( s, { ...e, bounds: e.bounds }, { placement: t, gap: n, pinned: r }, l ); - if (!f) return null; + if (!d) return null; const h = /* @__PURE__ */ P( "div", { ref: c, - "data-placement": f.placement, + "data-placement": d.placement, style: { position: s.space === "client" ? "fixed" : "absolute", - left: f.left, - top: f.top, + left: d.left, + top: d.top, // Its own width, wherever it sits: the size the placement measured. width: "max-content", - transform: f.transform, + transform: d.transform, pointerEvents: "auto" }, children: o @@ -21823,9 +21854,9 @@ const I9 = Fn(null); function mue({ token: e, children: t }) { return /* @__PURE__ */ P(I9.Provider, { value: e, children: t }); } -function Uf(e) { - const t = Et(I9); - return e ?? t ?? Zt; +function Hf(e) { + const t = Ct(I9); + return e ?? t ?? tn; } const yue = Object.freeze({ scrollLeft: 0, @@ -21838,8 +21869,8 @@ const yue = Object.freeze({ scrollableY: !1 }); function bue(e) { - const t = N9(Uf(e)), n = vi(); - return en( + const t = N9(Hf(e)), n = vi(); + return nn( (r) => r.tryCapability(t, n ?? void 0)?.getScrollMetrics() ?? yue ); } @@ -21855,33 +21886,33 @@ function IN({ thumbClassName: a, thumbStyle: c }) { - const l = Uf(t), u = bt(N9(l)), d = bue(l), f = e === "y", h = f ? d.scrollableY : d.scrollableX, g = Re(null), [p, m] = De(0), [v, S] = De(!1), [C, k] = De(!1), [N, w] = De(!0), y = VB(d, f, p, r), x = n === !1 ? 0 : n; + const l = Hf(t), u = bt(N9(l)), f = bue(l), d = e === "y", h = d ? f.scrollableY : f.scrollableX, g = Re(null), [p, m] = je(0), [v, S] = je(!1), [C, k] = je(!1), [N, w] = je(!0), y = VB(f, d, p, r), x = n === !1 ? 0 : n; Ke(() => { if (!x) return; w(!0); const T = setTimeout(() => w(!1), x); return () => clearTimeout(T); - }, [d, x]); + }, [f, x]); const A = !x || N || C || v; Ke(() => { const T = g.current; if (!T) return; - const R = () => m(f ? T.clientHeight : T.clientWidth), M = new ResizeObserver(R); + const R = () => m(d ? T.clientHeight : T.clientWidth), M = new ResizeObserver(R); return M.observe(T), R(), () => M.disconnect(); - }, [f, h]); + }, [d, h]); const b = { stage: u, - vertical: f, + vertical: d, layout: y, // Fresh geometry for paging steps — read from the capability, never a stale render. - liveLayout: () => VB(u.getScrollMetrics(), f, p, r), + liveLayout: () => VB(u.getScrollMetrics(), d, p, r), trackPress: o }, E = Re(b); if (E.current = b, Ke( () => g.current ? mae(g.current, { bar: () => E.current, onDragging: S }) : void 0, [h] ), !h) return null; - const I = f ? { position: "absolute", top: 0, right: 0, bottom: 0, width: 12 } : { position: "absolute", left: 0, right: 0, bottom: 0, height: 12 }, O = f ? { + const I = d ? { position: "absolute", top: 0, right: 0, bottom: 0, width: 12 } : { position: "absolute", left: 0, right: 0, bottom: 0, height: 12 }, O = d ? { position: "absolute", left: 2, right: 2, @@ -21899,7 +21930,7 @@ function IN({ { ref: g, role: "scrollbar", - "aria-orientation": f ? "vertical" : "horizontal", + "aria-orientation": d ? "vertical" : "horizontal", "aria-valuemin": 0, "aria-valuemax": Math.round(y.maxOffset), "aria-valuenow": Math.round(y.offset), @@ -21944,29 +21975,29 @@ function wue({ render: o, chrome: s }) { - const i = Re(null), a = t.transform, c = nu((h) => h.page), l = hae(a, n, { x: t.screenX, y: t.screenY }), u = t.ref.objectNumber, d = ft(() => Lt(u), [u]), f = ft( + const i = Re(null), a = t.transform, c = ru((h) => h.page), l = hae(a, n, { x: t.screenX, y: t.screenY }), u = t.ref.objectNumber, f = ft(() => Ft(u), [u]), d = ft( () => uae( e, // the hosting lens — per-view raster planning keys tile state by it, // so a thumbnail rail and the main view never fight over one plan r.getLensId(), - d, + f, t.pageIndex, n, a, () => i.current.getBoundingClientRect(), () => pae(r, u, a.deviceWidth) ), - [e, d, u, t.pageIndex, n, a, r] + [e, f, u, t.pageIndex, n, a, r] ); - return /* @__PURE__ */ P("div", { style: { position: "absolute", ...l.outer }, children: /* @__PURE__ */ P(ale, { value: f, children: [ + return /* @__PURE__ */ P("div", { style: { position: "absolute", ...l.outer }, children: /* @__PURE__ */ P(ale, { value: d, children: [ /* @__PURE__ */ P( "div", { style: { position: "absolute", ...l.shadow, - boxShadow: pt("page-shadow", c.shadow) + boxShadow: gt("page-shadow", c.shadow) } } ), @@ -21977,7 +22008,7 @@ function wue({ style: { position: "absolute", ...l.content, - background: pt("page-background", c.background), + background: gt("page-background", c.background), transform: l.turn ?? void 0, // A stacking context of its own: what a layer raises (a preview above the fields) // stays inside the page, under the next page and the overlays. @@ -21987,14 +22018,14 @@ function wue({ userSelect: "none", WebkitUserSelect: "none" }, - children: o(f) + children: o(d) } ), - s?.(f) + s?.(d) ] }) }); } function vue({ token: e }) { - const n = wt(e, (s) => s.getZoomBox()), r = wt(e, (s) => s.getSettings().zoomBox), o = nu((s) => s.accent); + const n = wt(e, (s) => s.getZoomBox()), r = wt(e, (s) => s.getSettings().zoomBox), o = ru((s) => s.accent); return n ? /* @__PURE__ */ P( "svg", { @@ -22031,7 +22062,7 @@ function O9({ className: i, style: a }) { - const c = Uf(s), l = bt(c), u = Rt(Cn); + const c = Hf(s), l = bt(c), u = Bt(Cn); Ke(() => { r === void 0 || !u || u.getActiveToolId() !== r && u.activateTool(r); }, [r, u]), hR( @@ -22039,7 +22070,7 @@ function O9({ (x) => x.onToolChanged, (x) => o?.(x.toolId) ); - const d = wt(c, (x) => x.getSettings().interaction), f = wt(c, (x) => x.getSettings().panFallback), h = wt(c, (x) => x.getSettings().zoomGestures), g = d && !!u, p = en(() => u?.getCursor() ?? "default"), m = Re(null), v = ar(), S = wt(c, (x) => x.listVisiblePages()), C = wt( + const f = wt(c, (x) => x.getSettings().interaction), d = wt(c, (x) => x.getSettings().panFallback), h = wt(c, (x) => x.getSettings().zoomGestures), g = f && !!u, p = nn(() => u?.getCursor() ?? "default"), m = Re(null), v = cr(), S = wt(c, (x) => x.listVisiblePages()), C = wt( c, (x) => x.getSettings().pageFrame, (x, A) => x.top === A.top && x.right === A.right && x.bottom === A.bottom && x.left === A.left @@ -22055,13 +22086,13 @@ function O9({ hub: g ? u : null, source: l.getLensId(), zoomGestures: h - }), b = g && u ? u.registerHandler(uue(l, u, { panFallback: f }), { + }), b = g && u ? u.registerHandler(uue(l, u, { panFallback: d }), { source: l.getLensId() }) : null, E = g && u ? u.registerHandler(due(l, u), { source: l.getLensId() }) : null; return () => { E?.(), b?.(), A(); }; - }, [l, u, g, h, f]), /* @__PURE__ */ P( + }, [l, u, g, h, d]), /* @__PURE__ */ P( "div", { ref: m, @@ -22093,11 +22124,11 @@ function O9({ ); } function y_(e) { - return bt(Uf(e)); + return bt(Hf(e)); } -function um(e, t) { - const n = Uf(t), r = vi(); - return en((o) => { +function dm(e, t) { + const n = Hf(t), r = vi(); + return nn((o) => { const s = o.tryCapability(n, r ?? void 0), i = s ? m_.read(s) : m_.empty; return e ? e(i) : i; }, hv); @@ -22193,7 +22224,7 @@ class xue { function lC(e) { return e.reason ?? new DOMException("aborted", "AbortError"); } -const NN = (e) => e.flatMap((t) => t.page ? [t.page.objectNumber] : []), uc = (e, t) => e.length ? { pages: [...new Set(e)], scope: t } : null; +const NN = (e) => e.flatMap((t) => t.page ? [t.page.objectNumber] : []), dc = (e, t) => e.length ? { pages: [...new Set(e)], scope: t } : null; function Eue(e) { const t = NN(e.meta.changedWidgets); return "widgets" in e && t.push(...NN(e.widgets)), "page" in e && e.page && t.push(e.page.objectNumber), t; @@ -22205,7 +22236,7 @@ function Cue(e, t) { case "annotations.deleted": case "annotations.restored": case "annotations.reordered": - return uc([e.page.objectNumber], "annotations"); + return dc([e.page.objectNumber], "annotations"); case "forms.valueSet": case "forms.created": case "forms.updated": @@ -22217,38 +22248,38 @@ function Cue(e, t) { case "forms.widgetRestored": case "forms.widgetUpdated": case "forms.widgetsReordered": - return uc(Eue(e), "fields"); + return dc(Eue(e), "fields"); // A coarse result (counts only, no per-widget detail): repaint every page. case "forms.repaired": - return uc(t(), "fields"); + return dc(t(), "fields"); // Sealing bakes the signature into its widget's appearance. case "signatures.completed": - return uc( + return dc( e.signature.widget ? NN([e.signature.widget]) : [], "fields" ); // These rewrite the page content itself. case "redaction.applied": case "pages.flattened": - return uc( + return dc( e.results.filter((n) => n.status === "applied").map((n) => n.page.objectNumber), "content" ); case "annotations.flattened": - return uc( + return dc( e.results.some((n) => n.status === "applied") ? [e.page.objectNumber] : [], "content" ); // The stream lost events that will never arrive: any page may be stale. case "stream.desynced": - return uc(t(), "content"); + return dc(t(), "content"); // The engine's own fonts changed, with no write behind it (a font // registered after the first pages were drawn): a page's text draws a // glyph its font lacks from a fallback, so any page may be stale. A // write's `fonts.changed` carries its `transaction`; that write's own events // repaint what it changed. case "fonts.changed": - return e.origin.transaction ? null : uc(t(), "content"); + return e.origin.transaction ? null : dc(t(), "content"); // pages.* replace the page registry: the kernel's `pagesSequence` bump already // re-keys every layout, and metadata never touches pixels. A new saved // version changes no pixels beyond the signature it seals. The @@ -22263,7 +22294,7 @@ const Iue = () => ({ fieldEpochs: {}, snapshot: null }); -function ch(e, t) { +function uh(e, t) { return e.snapshot === t ? e : { ...e, snapshot: t }; } const uC = (e, t) => { @@ -22286,14 +22317,14 @@ function Nue(e, t, n) { function Oue(e, t, n) { return (e.contentEpochs[t] ?? 0) + (n.includeAnnotations ? e.annotationEpochs[t] ?? 0 : 0) + (n.includeFormFields ? e.fieldEpochs[t] ?? 0 : 0); } -const ON = (e) => `a${e.includeAnnotations ? 1 : 0}f${e.includeFormFields ? 1 : 0}`, lh = (e, t = !1) => Object.freeze({ status: e, slow: t }), gg = { - idle: lh("idle"), - loading: lh("loading"), - slow: lh("loading", !0), - ready: lh("ready"), - forbidden: lh("forbidden"), - error: lh("error") -}, Pue = (e) => pr(e, "permission-denied") || typeof e == "object" && e !== null && e.code === "permission-denied"; +const ON = (e) => `a${e.includeAnnotations ? 1 : 0}f${e.includeFormFields ? 1 : 0}`, dh = (e, t = !1) => Object.freeze({ status: e, slow: t }), mg = { + idle: dh("idle"), + loading: dh("loading"), + slow: dh("loading", !0), + ready: dh("ready"), + forbidden: dh("forbidden"), + error: dh("error") +}, Pue = (e) => Xn(e, "permission-denied") || typeof e == "object" && e !== null && e.code === "permission-denied"; function Rue(e) { let t = null; for (const n of e.reports) { @@ -22303,7 +22334,7 @@ function Rue(e) { return t ?? "loading"; } function Tue(e, t) { - return e === "loading" ? t ? gg.slow : gg.loading : gg[e]; + return e === "loading" ? t ? mg.slow : mg.loading : mg[e]; } function Mue(e, t) { const n = /* @__PURE__ */ new Map(); @@ -22318,8 +22349,8 @@ function Mue(e, t) { if (l !== "loading") c.cancelSlow?.(), c.cancelSlow = null, c.slow = !1; else if (!c.slow && !c.cancelSlow) { - const d = e.settings().get().slowAfterMs; - d <= 0 ? c.slow = !0 : c.cancelSlow = e.clock.after(d, () => { + const f = e.settings().get().slowAfterMs; + f <= 0 ? c.slow = !0 : c.cancelSlow = e.clock.after(f, () => { c.cancelSlow = null, c.slow = !0, o(a, c); }); } @@ -22327,7 +22358,7 @@ function Mue(e, t) { c.state !== u && (c.state = u, e.notify(), t({ page: c.page, view: a, ...u })); } function s(a, c) { - return n.get(a)?.get(c)?.state ?? gg.idle; + return n.get(a)?.get(c)?.state ?? mg.idle; } function i(a, c) { const l = { shown: !1, failure: null }; @@ -22337,26 +22368,26 @@ function Mue(e, t) { } }; let u = n.get(a); u || n.set(a, u = /* @__PURE__ */ new Map()); - let d = u.get(c.objectNumber); - d || (d = { + let f = u.get(c.objectNumber); + f || (f = { page: c, reports: /* @__PURE__ */ new Set(), slow: !1, cancelSlow: null, - state: gg.idle - }, u.set(c.objectNumber, d)); - const f = d; - f.reports.add(l), o(a, f); + state: mg.idle + }, u.set(c.objectNumber, f)); + const d = f; + d.reports.add(l), o(a, d); let h = !0; return { shown() { - !h || r || l.shown || (l.shown = !0, l.failure = null, o(a, f)); + !h || r || l.shown || (l.shown = !0, l.failure = null, o(a, d)); }, failed(g) { - !h || r || l.shown || (l.failure = Pue(g) ? "forbidden" : "error", o(a, f)); + !h || r || l.shown || (l.failure = Pue(g) ? "forbidden" : "error", o(a, d)); }, close() { - !h || r || (h = !1, f.reports.delete(l), f.reports.size === 0 && n.get(a)?.get(c.objectNumber) === f && n.get(a).delete(c.objectNumber), o(a, f)); + !h || r || (h = !1, d.reports.delete(l), d.reports.size === 0 && n.get(a)?.get(c.objectNumber) === d && n.get(a).delete(c.objectNumber), o(a, d)); } }; } @@ -22463,7 +22494,7 @@ function Fue(e, { function l() { c?.abort(), c = null; const v = a; - a = null, e.state.update(ch, null), v && o.emit({ snapshot: null }); + a = null, e.state.update(uh, null), v && o.emit({ snapshot: null }); } function u(v, S) { const C = new AbortController(); @@ -22478,15 +22509,15 @@ function Fue(e, { }) ); N.catch(() => { - }), a = { page: v.page, rect: S, image: N }, e.state.update(ch, { + }), a = { page: v.page, rect: S, image: N }, e.state.update(uh, { ...v, from: { x: S.x, y: S.y }, to: { x: S.x + S.width, y: S.y + S.height }, held: !0 }), o.emit({ snapshot: a }); } - function d(v, S, C, k) { - return !i() || !e.getPage(v) ? !1 : (l(), e.state.update(ch, { + function f(v, S, C, k) { + return !i() || !e.getPage(v) ? !1 : (l(), e.state.update(uh, { page: v, from: S, to: S, @@ -22495,32 +22526,32 @@ function Fue(e, { held: !1 }), !0); } - function f(v) { + function d(v) { const S = s(), C = S && !S.held ? e.getPage(S.page)?.size : void 0; if (!S || !C) return; const k = { x: v_(v.x, 0, C.width), y: v_(v.y, 0, C.height) }; - e.state.update(ch, { ...S, to: k }); + e.state.update(uh, { ...S, to: k }); } function h() { const v = s(); if (!v || v.held) return; const S = e.getPage(v.page)?.size; if (!S) { - e.state.update(ch, null); + e.state.update(uh, null); return; } u(v, k_(v) ? A_(v) : { x: 0, y: 0, ...S }); } function g() { const v = s(); - v && !v.held && e.state.update(ch, null); + v && !v.held && e.state.update(uh, null); } const p = { id: "render-snapshot", priority: 10, enabledFor: (v) => v.enables.has(b_), // A press between pages does nothing: a box lives on one page. - onPointerDown: (v) => v.page ? d( + onPointerDown: (v) => v.page ? f( v.page.ref, v.page.point, v.page.scale ?? 1, @@ -22528,11 +22559,11 @@ function Fue(e, { ) : !1, onPointerMove: (v) => { const S = s(), C = S && T0(v, S.page); - C && f(C); + C && d(C); }, onPointerUp: (v) => { const S = s(), C = S && T0(v, S.page); - C && f(C), h(); + C && d(C), h(); }, onPointerCancel: g }, m = tt( @@ -22556,13 +22587,13 @@ function Fue(e, { const v = e.tryGet(Cn); v && (e.cleanup( v.registerTool({ - id: hg, + id: pg, cursor: "crosshair", touch: "draw", enables: /* @__PURE__ */ new Set([b_]) }) ), e.cleanup(v.registerHandler(p)), e.listen(v.onToolChanged, ({ toolId: S }) => { - S !== hg && l(); + S !== pg && l(); })); } }; @@ -22641,7 +22672,7 @@ function Kue(e, t) { const n = [...e].sort((r, o) => r - o); return n.find((r) => r >= t) ?? n[n.length - 1]; } -const mu = (e, t) => `${e}\0${t}`, Hue = 8, zue = 64; +const yu = (e, t) => `${e}\0${t}`, Hue = 8, zue = 64; class Wue { constructor(t) { this.deps = t, this.pages = /* @__PURE__ */ new Map(), this.strategy = tt( @@ -22656,28 +22687,28 @@ class Wue { if (!a) return Gk; const c = this.deps.getEpoch(n, o), l = this.pageState(n, t); l.epoch !== c && (this.abortAll(l), l.entries.clear(), l.failedKeys.clear(), l.epoch = c, l.wantScale = null, l.wantWidth = null, l.planCache = null); - const u = R9(i, r.desiredDeviceWidth), d = r.desiredDeviceWidth / u; - if (d <= i.engageRatio) - return (l.entries.size || l.wantScale !== null) && (this.deps.debug?.(`disengage page=${n} (deficit ${d.toFixed(2)})`), this.abortAll(l), l.entries.clear(), l.failedKeys.clear(), l.wantScale = null, l.wantWidth = null, l.planCache = null, this.pump()), Gk; - let f, h; - if (i.pyramid ? (h = Kue(i.pyramid, r.desiredDeviceWidth / a.width), f = Math.round(h * a.width)) : (f = Math.min( + const u = R9(i, r.desiredDeviceWidth), f = r.desiredDeviceWidth / u; + if (f <= i.engageRatio) + return (l.entries.size || l.wantScale !== null) && (this.deps.debug?.(`disengage page=${n} (deficit ${f.toFixed(2)})`), this.abortAll(l), l.entries.clear(), l.failedKeys.clear(), l.wantScale = null, l.wantWidth = null, l.planCache = null, this.pump()), Gk; + let d, h; + if (i.pyramid ? (h = Kue(i.pyramid, r.desiredDeviceWidth / a.width), d = Math.round(h * a.width)) : (d = Math.min( Math.max(1, Math.round(r.desiredDeviceWidth)), Math.round(i.tileMaxScale * a.width) - ), h = f / a.width), !r.visibleRect) { + ), h = d / a.width), !r.visibleRect) { const I = Math.max( i.tileSize, Math.floor(i.tileSize * Math.sqrt(zue * a.width / a.height)) ); - if (f > I) + if (d > I) if (this.warnedStageless || (this.warnedStageless = !0, console.warn( `[render] stage-less tile demand of ${Math.round(r.desiredDeviceWidth)} device px would tile the whole page — clamped to ${I}. Supply a visibleRect (host the page in a Stage) for sharp deep zoom.` )), i.pyramid) { const O = i.pyramid.filter( (T) => Math.round(T * a.width) <= I ); - h = O.length ? O[O.length - 1] : i.pyramid[0], f = Math.round(h * a.width); + h = O.length ? O[O.length - 1] : i.pyramid[0], d = Math.round(h * a.width); } else - f = I, h = f / a.width; + d = I, h = d / a.width; } const g = x_(a, h, i.tileSize), p = r.visibleRect ?? { x: 0, y: 0, width: a.width, height: a.height }; l.lastVisible = p; @@ -22694,14 +22725,14 @@ class Wue { a, g, h, - f, + d, o, c, m, C, p ), this.releaseCovered(n, l, a, o) && (l.version += 1, l.planCache = null); - const k = `w${f}|${que(p)}|e${c}`; + const k = `w${d}|${que(p)}|e${c}`; if (l.planCache && l.planCache.demandKey === k && l.planCache.version === l.version) return l.planCache.plan; const N = [], w = [], y = [], x = this.deps.getOptions().tiles.bleedPx; @@ -22744,7 +22775,7 @@ class Wue { } /** The layer's painted report: this key's pixels had a presentation opportunity. */ sourcePainted(t, n, r) { - const o = this.pages.get(mu(t, n)), s = o?.entries.get(r); + const o = this.pages.get(yu(t, n)), s = o?.entries.get(r); if (!o || !s || s.painted) return; s.painted = !0; const i = this.deps.getPageSize(n); @@ -22759,18 +22790,18 @@ class Wue { * pixels. Painted is a statement about the screen, so it follows the DOM. */ sourceUnpainted(t, n, r) { - const o = this.pages.get(mu(t, n))?.entries.get(r); + const o = this.pages.get(yu(t, n))?.entries.get(r); o && (o.painted = !1); } /** A lens stopped painting tiles for the page (it left the view, or its * layer paints none): stop fetching, drop bookkeeping. Resolved bytes stay * in the RasterStore for a re-mount. */ releasePage(t, n) { - const r = this.pages.get(mu(t, n)); - r && (this.abortAll(r), this.pages.delete(mu(t, n)), this.pump()); + const r = this.pages.get(yu(t, n)); + r && (this.abortAll(r), this.pages.delete(yu(t, n)), this.pump()); } pageState(t, n) { - let r = this.pages.get(mu(n, t)); + let r = this.pages.get(yu(n, t)); return r || (r = { view: n, pageObjectNumber: t, @@ -22785,15 +22816,15 @@ class Wue { cancelSettle: null, pendingLevel: null, lastVisible: null - }, this.pages.set(mu(n, t), r)), r; + }, this.pages.set(yu(n, t), r)), r; } - schedule(t, n, r, o, s, i, a, c, l, u, d) { - const f = this.deps.getOptions(), h = n.wantWidth === null, g = n.wantWidth !== null && n.wantWidth !== i; + schedule(t, n, r, o, s, i, a, c, l, u, f) { + const d = this.deps.getOptions(), h = n.wantWidth === null, g = n.wantWidth !== null && n.wantWidth !== i; g && n.failedKeys.clear(), n.wantScale = s, n.wantWidth = i; const p = (y) => this.tileKey(t, i, y, a, c), m = new Set([...l, ...u].map(p)); for (const [y, x] of n.entries) m.has(y) || (x.resolved ? x.scale === s && n.entries.delete(y) : (x.abort?.abort(), this.releaseSlot(x), n.entries.delete(y))); - const v = d.x + d.width / 2, S = d.y + d.height / 2, C = o.tileSize / o.scale, k = (y) => { + const v = f.x + f.width / 2, S = f.y + f.height / 2, C = o.tileSize / o.scale, k = (y) => { const x = (y.ix + 0.5) * C - v, A = (y.iy + 0.5) * C - S; return x * x + A * A; }, N = [...l].sort( @@ -22814,8 +22845,8 @@ class Wue { epoch: c }, this.pump(); }; - if (g && f.tiles.settleMs > 0) { - this.deps.debug?.(`arm settle page=${t} level=${i}`), n.queue = null, n.pendingLevel = i, n.cancelSettle?.(), n.cancelSettle = this.deps.after(f.tiles.settleMs, () => { + if (g && d.tiles.settleMs > 0) { + this.deps.debug?.(`arm settle page=${t} level=${i}`), n.queue = null, n.pendingLevel = i, n.cancelSettle?.(), n.cancelSettle = this.deps.after(d.tiles.settleMs, () => { n.cancelSettle = null, this.deps.debug?.( `settle fired page=${t} level=${i} current=${n.pendingLevel === i}` ), n.pendingLevel === i && w(); @@ -22869,15 +22900,15 @@ class Wue { start(t, n) { const { page: r, grid: o, wantWidth: s, layers: i, epoch: a } = t.queue, c = t.pageObjectNumber, l = this.tileKey(c, s, n, i, a), u = this.deps.getOptions().tiles.bleedPx / o.scale; this.inFlight += 1; - const d = new AbortController(), f = Vue(o, r, n), h = { + const f = new AbortController(), d = Vue(o, r, n), h = { key: l, scale: o.scale, coord: n, - rect: f, + rect: d, resolved: !1, painted: !1, charged: !0, - abort: d + abort: f }; t.entries.set(l, h), t.planCache = null, this.deps.store.acquire( l, @@ -22886,18 +22917,18 @@ class Wue { c, // The rendered region is the bled rect — it matches the bled // placement rect the paint list emits for this entry. - u > 0 ? E_(f, u, r) : f, + u > 0 ? E_(d, u, r) : d, o.scale, i, g ), - d.signal + f.signal ).then( () => { this.releaseSlot(h), t.entries.get(l) === h && (h.resolved = !0, t.version += 1, t.planCache = null, this.deps.onAdvance(c)), this.pump(); }, (g) => { - this.releaseSlot(h), t.entries.get(l) === h && (t.entries.delete(l), d.signal.aborted || (t.failedKeys.add(l), this.deps.debug?.(`tile failed ${l}: ${String(g)}`), t.version += 1, t.planCache = null, this.deps.onAdvance(c))), this.pump(); + this.releaseSlot(h), t.entries.get(l) === h && (t.entries.delete(l), f.signal.aborted || (t.failedKeys.add(l), this.deps.debug?.(`tile failed ${l}: ${String(g)}`), t.version += 1, t.planCache = null, this.deps.onAdvance(c))), this.pump(); } ); } @@ -22916,20 +22947,20 @@ class Wue { releaseCovered(t, n, r, o) { const { wantScale: s, wantWidth: i } = n; if (s === null || i === null) return !1; - const a = x_(r, s, this.strategy().tileSize), c = (d) => this.tileKey(t, i, d, o, n.epoch), l = (d) => n.entries.get(c(d))?.painted === !0; + const a = x_(r, s, this.strategy().tileSize), c = (f) => this.tileKey(t, i, f, o, n.epoch), l = (f) => n.entries.get(c(f))?.painted === !0; let u = !1; - for (const [d, f] of n.entries) { - if (f.scale === s || !f.resolved) continue; - const h = n.lastVisible ? O0(f.rect, n.lastVisible) : f.rect; + for (const [f, d] of n.entries) { + if (d.scale === s || !d.resolved) continue; + const h = n.lastVisible ? O0(d.rect, n.lastVisible) : d.rect; if ($ue(a, r, h, l)) - n.entries.delete(d), u = !0; + n.entries.delete(f), u = !0; else if (this.deps.debug && this.deps.getOptions().debug) { const g = Qk(a, r, h).filter((m) => !l(m)), p = g.slice(0, 3).map((m) => { const v = n.entries.get(c(m)), S = v ? v.resolved ? "RESOLVED-unpainted" : "PENDING" : "NO-ENTRY"; return `${m.ix},${m.iy}=${S}`; }); this.deps.debug( - `retained ${d} blocked by: ${p.join(" ")} (${g.length} missing)` + `retained ${f} blocked by: ${p.join(" ")} (${g.length} missing)` ); } } @@ -22938,7 +22969,7 @@ class Wue { /** Test/diagnostic introspection: bookkeeping size for one page. */ stats(t, n) { return { - entries: this.pages.get(mu(t, n))?.entries.size ?? 0, + entries: this.pages.get(yu(t, n))?.entries.size ?? 0, inFlight: this.inFlight }; } @@ -22969,67 +23000,67 @@ const C_ = (e) => `${e.ix},${e.iy}`, que = (e) => `${Math.round(e.x)},${Math.rou return { includeAnnotations: t?.[1] === "1", includeFormFields: t?.[2] === "1" }; }, fy = "doc.render", I_ = "doc.render.thumbnail", N_ = "doc.forms.read", Jue = "doc.annotate.read", Yue = [!1, !0].map( (e) => [!1, !0].map((t) => Object.freeze({ annotations: e, formFields: t })) -), dc = (e) => typeof e.reason == "string" ? e.reason : void 0, Que = 4; +), fc = (e) => typeof e.reason == "string" ? e.reason : void 0, Que = 4; function Xue(e) { const t = e.settings(), n = tt( () => [t.get()], (ae) => bce(ae) - ), r = new Bue(), o = new kue(), s = new xue(), i = e.events.source(), a = e.events.source(), c = e.events.source(), l = e.events.source(), u = Mue(e, l.emit), d = () => e.allows(fy), f = () => e.allows(I_); + ), r = new Bue(), o = new kue(), s = new xue(), i = e.events.source(), a = e.events.source(), c = e.events.source(), l = e.events.source(), u = Mue(e, l.emit), f = () => e.allows(fy), d = () => e.allows(I_); let h = null; const g = (ae) => { if (h) - throw new re("conflict", "render", "another plugin paints the pictures already"); - const me = ae; - h = me, e.notify(); + throw new te("conflict", "render", "another plugin paints the pictures already"); + const ge = ae; + h = ge, e.notify(); let W = !1; return () => { - W || (W = !0, h === me && (h = null, e.notify())); + W || (W = !0, h === ge && (h = null, e.notify())); }; }, p = () => Yue[e.allows("doc.annotate.read") ? 1 : 0][e.allows("doc.forms.read") ? 1 : 0], m = (ae) => { - const me = p(); + const ge = p(); return e6( { - ...ae.includeAnnotations !== void 0 && (me.annotations || !ae.includeAnnotations) ? { includeAnnotations: ae.includeAnnotations } : {}, - ...ae.includeFormFields !== void 0 && (me.formFields || !ae.includeFormFields) ? { includeFormFields: ae.includeFormFields } : {} + ...ae.includeAnnotations !== void 0 && (ge.annotations || !ae.includeAnnotations) ? { includeAnnotations: ae.includeAnnotations } : {}, + ...ae.includeFormFields !== void 0 && (ge.formFields || !ae.includeFormFields) ? { includeFormFields: ae.includeFormFields } : {} }, - me + ge ); - }, v = (ae, me) => (ae.includeAnnotations === !0 && e.assertAllowed("doc.annotate.read", me), ae.includeFormFields === !0 && e.assertAllowed(N_, me), m(ae)); + }, v = (ae, ge) => (ae.includeAnnotations === !0 && e.assertAllowed("doc.annotate.read", ge), ae.includeFormFields === !0 && e.assertAllowed(N_, ge), m(ae)); let S = !1; - const C = (ae, me) => { - S || me === void 0 || ae.format === me || (S = !0, console.warn( - `[render] format '${me}' is not in the deployment's formats — using '${ae.format}'.` + const C = (ae, ge) => { + S || ge === void 0 || ae.format === ge || (S = !0, console.warn( + `[render] format '${ge}' is not in the deployment's formats — using '${ae.format}'.` )); }; let k = !1; - const N = (ae, me) => { - k || n().tiles.enabled || ae <= me * 2 || (k = !0, console.warn( - `[render] demand is ${(ae / me).toFixed(1)}× over the base budget and the tile plane is disabled (tiles: false) — the page rests blurry. Raise fullPage.maxWidth or re-enable tiles.` + const N = (ae, ge) => { + k || n().tiles.enabled || ae <= ge * 2 || (k = !0, console.warn( + `[render] demand is ${(ae / ge).toFixed(1)}× over the base budget and the tile plane is disabled (tiles: false) — the page rests blurry. Raise fullPage.maxWidth or re-enable tiles.` )); }, w = () => e.document()?.renderPolicy ?? za, y = tt( () => [w(), n()], - (ae, me) => { - const W = P9(ae, me); - return C(W, me.format), W; + (ae, ge) => { + const W = P9(ae, ge); + return C(W, ge.format), W; } ), x = (ae) => { - const me = e.getPage(ae); - return me || e.assertPageRef(ae), me.size.width; + const ge = e.getPage(ae); + return ge || e.assertPageRef(ae), ge.size.width; }, A = () => (e.document()?.pages ?? []).map((ae) => ae.ref.objectNumber), b = (ae) => e.document()?.pendingPages.has(ae.objectNumber) ?? !1, E = (ae) => { - const me = e.document()?.pendingPages.get(ae.objectNumber); - return me?.kind === "copy" ? me.of : null; - }, I = async (ae, me) => { - await e.waitFor(() => !b(ae), me ? { signal: me } : void 0), e.getPage(ae) || e.assertPageRef(ae); - }, O = (ae, me) => { - const W = me * x(ae), Se = R9(y(), W); + const ge = e.document()?.pendingPages.get(ae.objectNumber); + return ge?.kind === "copy" ? ge.of : null; + }, I = async (ae, ge) => { + await e.waitFor(() => !b(ae), ge ? { signal: ge } : void 0), e.getPage(ae) || e.assertPageRef(ae); + }, O = (ae, ge) => { + const W = ge * x(ae), Se = R9(y(), W); return N(W, Se), { kind: "width", width: Se }; - }, T = (ae, me) => Oue(e.state.get(), ae, me), R = (ae, me, W, Se, Ae) => `${ae}|w${me}|${ON(W)}|e${T(ae, W)}${Se ? `|f${Se}` : ""}${Ae !== void 0 ? `|q${Ae}` : ""}`, M = (ae, me, W, Se) => `${ae}|thumbnail|${ON(me)}|e${T(ae, me)}${W ? `|f${W}` : ""}${Se !== void 0 ? `|q${Se}` : ""}`; - function F(ae, me, W, Se) { + }, T = (ae, ge) => Oue(e.state.get(), ae, ge), R = (ae, ge, W, Se, Ae) => `${ae}|w${ge}|${ON(W)}|e${T(ae, W)}${Se ? `|f${Se}` : ""}${Ae !== void 0 ? `|q${Ae}` : ""}`, M = (ae, ge, W, Se) => `${ae}|thumbnail|${ON(ge)}|e${T(ae, ge)}${W ? `|f${W}` : ""}${Se !== void 0 ? `|q${Se}` : ""}`; + function F(ae, ge, W, Se) { return r.acquire( - me, + ge, (ce) => { const Ne = (U) => { - const ne = e.doc.with({ + const re = e.doc.with({ priority: "high", ...W.view !== void 0 ? { view: W.view } : {} }).page(U).render.image({ @@ -23038,25 +23069,25 @@ function Xue(e) { ...W.format !== void 0 ? { format: W.format } : {}, ...W.quality !== void 0 ? { quality: W.quality } : {} }); - return ce.aborted ? ne.abort(dc(ce)) : ce.addEventListener("abort", () => ne.abort(dc(ce)), { + return ce.aborted ? re.abort(fc(ce)) : ce.addEventListener("abort", () => re.abort(fc(ce)), { once: !0 - }), ne; + }), re; }; return ((U) => b(U) ? I(U, ce).then(() => Ne(U)) : Ne(U))(E(ae) ?? ae); }, Se ).then( - (ce) => (a.emit({ page: ae, key: me }), ce), + (ce) => (a.emit({ page: ae, key: ge }), ce), (ce) => { - const Ne = qe("render", ce); - throw !pr(Ne, "operation-cancelled") && !pr(Ne, "instance-closed") && c.emit({ page: ae, key: me, error: Br(Ne) }), Ne; + const Ne = ze("render", ce); + throw !Xn(Ne, "operation-cancelled") && !Xn(Ne, "instance-closed") && c.emit({ page: ae, key: ge, error: Br(Ne) }), Ne; } ); } - async function B(ae, { scale: me, view: W, signal: Se, thumbnail: Ae, ...ce }) { - if (Ae) return _(ae, { ...ce, view: W, signal: Se }, "render.renderSource"); + async function _(ae, { scale: ge, view: W, signal: Se, thumbnail: Ae, ...ce }) { + if (Ae) return B(ae, { ...ce, view: W, signal: Se }, "render.renderSource"); e.assertAllowed(fy, "render.renderSource"); - const Ne = v(ce, "render.renderSource"), K = O(ae, me), U = y(), Z = R( + const Ne = v(ce, "render.renderSource"), K = O(ae, ge), U = y(), X = R( ae.objectNumber, K.kind === "width" ? K.width : 0, Ne, @@ -23065,7 +23096,7 @@ function Xue(e) { ); return F( ae, - Z, + X, { viewport: K, layers: Ne, @@ -23076,14 +23107,14 @@ function Xue(e) { Se ); } - function $(ae, me, W, Se, Ae, ce) { - const Ne = W.rect && O0(W.rect, { x: 0, y: 0, ...me }); + function $(ae, ge, W, Se, Ae, ce) { + const Ne = W.rect && O0(W.rect, { x: 0, y: 0, ...ge }); if (Ne && !(Ne.width > 0 && Ne.height > 0)) - throw new re("invalid-input", "render", "the rect misses the page", { + throw new te("invalid-input", "render", "the rect misses the page", { details: { field: "rect" } }); - const K = W.signal, U = (ne) => { - const xe = e.doc.with({ priority: "high" }).page(ne).render.image({ + const K = W.signal, U = (re) => { + const xe = e.doc.with({ priority: "high" }).page(re).render.image({ ...Ne ? { target: { kind: "rect", rect: Ne } } : {}, viewport: W.width !== void 0 ? { kind: "width", width: Math.max(1, Math.round(W.width)) } : { kind: "scale", scale: W.scale ?? 1 }, ...W.rotation ? { rotation: W.rotation } : {}, @@ -23091,24 +23122,24 @@ function Xue(e) { ...Ae !== void 0 ? { format: Ae } : {}, ...ce !== void 0 ? { quality: ce } : {} }); - return K?.aborted ? xe.abort(dc(K)) : K?.addEventListener("abort", () => xe.abort(dc(K)), { once: !0 }), xe; - }, Z = E(ae) ?? ae; - return b(Z) ? I(Z, K).then(() => U(Z)) : U(Z); + return K?.aborted ? xe.abort(fc(K)) : K?.addEventListener("abort", () => xe.abort(fc(K)), { once: !0 }), xe; + }, X = E(ae) ?? ae; + return b(X) ? I(X, K).then(() => U(X)) : U(X); } - async function D(ae, me = {}) { + async function D(ae, ge = {}) { e.assertAllowed(fy, "render.renderPage"); - const { ref: W, size: Se } = e.pageOf(ae), Ae = v(me, "render.renderPage"), ce = y(), Ne = me.format ?? ce.format, K = me.quality ?? ce.quality; - if (me.rect !== void 0 || me.rotation) + const { ref: W, size: Se } = e.pageOf(ae), Ae = v(ge, "render.renderPage"), ce = y(), Ne = ge.format ?? ce.format, K = ge.quality ?? ce.quality; + if (ge.rect !== void 0 || ge.rotation) return e.cancellable( - me.signal, - $(W, Se, me, Ae, Ne, K) + ge.signal, + $(W, Se, ge, Ae, Ne, K) ); - const U = Math.max(1, Math.round(me.width ?? (me.scale ?? 1) * Se.width)), Z = R(W.objectNumber, U, Ae, Ne, me.quality); + const U = Math.max(1, Math.round(ge.width ?? (ge.scale ?? 1) * Se.width)), X = R(W.objectNumber, U, Ae, Ne, ge.quality); return e.cancellable( - me.signal, + ge.signal, F( W, - Z, + X, { viewport: { kind: "width", width: U }, layers: Ae, @@ -23116,114 +23147,114 @@ function Xue(e) { quality: K, view: void 0 }, - me.signal + ge.signal ) ); } - async function _(ae, { - view: me, + async function B(ae, { + view: ge, signal: W, format: Se, quality: Ae, ...ce }, Ne) { e.assertAllowed(I_, Ne); - const K = v(ce, Ne), U = y(), Z = Se ?? U.format, ne = Ae ?? U.quality; + const K = v(ce, Ne), U = y(), X = Se ?? U.format, re = Ae ?? U.quality; return F( ae, - M(ae.objectNumber, K, Z, Ae), - { viewport: { kind: "thumbnail" }, layers: K, format: Z, quality: ne, view: me }, + M(ae.objectNumber, K, X, Ae), + { viewport: { kind: "thumbnail" }, layers: K, format: X, quality: re, view: ge }, W ); } - async function L(ae, me = {}) { + async function L(ae, ge = {}) { e.assertAllowed(fy, "render.renderPages"); - const W = Math.max(1, me.concurrency ?? Que), Se = [], Ae = [], ce = ae.map((Z, ne) => ({ page: Z, index: ne })), Ne = async () => { - for (let Z = ce.shift(); Z; Z = ce.shift()) { - const { page: ne, index: xe } = Z; + const W = Math.max(1, ge.concurrency ?? Que), Se = [], Ae = [], ce = ae.map((X, re) => ({ page: X, index: re })), Ne = async () => { + for (let X = ce.shift(); X; X = ce.shift()) { + const { page: re, index: xe } = X; try { - const _e = await D(ne, me); - Se.push({ index: xe, render: { page: e.pageOf(ne).ref, image: _e } }); - } catch (_e) { + const Le = await D(re, ge); + Se.push({ index: xe, render: { page: e.pageOf(re).ref, image: Le } }); + } catch (Le) { Ae.push({ index: xe, - ref: ne, - error: Br(qe("render", _e)) + ref: re, + error: Br(ze("render", Le)) }); } } }, K = Promise.all(Array.from({ length: Math.min(W, ce.length) }, Ne)); - await e.cancellable(me.signal, K); - const U = (Z, ne) => Z.index - ne.index; + await e.cancellable(ge.signal, K); + const U = (X, re) => X.index - re.index; return { - applied: Se.sort(U).map(({ render: Z }) => Z), + applied: Se.sort(U).map(({ render: X }) => X), skipped: [], - failed: Ae.sort(U).map(({ ref: Z, error: ne }) => ({ ref: Z, error: ne })) + failed: Ae.sort(U).map(({ ref: X, error: re }) => ({ ref: X, error: re })) }; } - async function j(ae, { family: me, scale: W, items: Se, signal: Ae }) { + async function j(ae, { family: ge, scale: W, items: Se, signal: Ae }) { e.assertAllowed( - me === "widgets" ? N_ : Jue, + ge === "widgets" ? N_ : Jue, "render.renderAppearances" ); - const ce = e.pageOf(ae).ref.objectNumber, Ne = new Map(Se.map((ne) => [oe(ne.ref), ne.version])), K = [...Ne].map(([ne, xe]) => `${ne}@${xe}`).sort(), U = `${me}|${ce}`, Z = o.acquire( + const ce = e.pageOf(ae).ref.objectNumber, Ne = new Map(Se.map((re) => [oe(re.ref), re.version])), K = [...Ne].map(([re, xe]) => `${re}@${xe}`).sort(), U = `${ge}|${ce}`, X = o.acquire( U, `${U}|s${W}|${K.join(",")}`, - async (ne) => { - b(ae) && await I(ae, ne); - const xe = e.doc.page(Lt(ce)), _e = { viewport: { kind: "scale", scale: W }, modes: ["normal"] }, Ie = me === "widgets" ? xe.forms.renderAppearances(_e) : xe.annotations.renderAppearances(_e); - ne.aborted ? Ie.abort(dc(ne)) : ne.addEventListener("abort", () => Ie.abort(dc(ne)), { + async (re) => { + b(ae) && await I(ae, re); + const xe = e.doc.page(Ft(ce)), Le = { viewport: { kind: "scale", scale: W }, modes: ["normal"] }, Ie = ge === "widgets" ? xe.forms.renderAppearances(Le) : xe.annotations.renderAppearances(Le); + re.aborted ? Ie.abort(fc(re)) : re.addEventListener("abort", () => Ie.abort(fc(re)), { once: !0 }); - const Le = (await Ie).appearances.flatMap((X) => { - const ie = Ne.get(oe(X.ref)); - return ie === void 0 ? [] : [{ ...X, version: ie }]; + const De = (await Ie).appearances.flatMap((qe) => { + const Me = Ne.get(oe(qe.ref)); + return Me === void 0 ? [] : [{ ...qe, version: Me }]; }); - return s.remember(me, Le, (X) => oe(X.ref)), Le; + return s.remember(ge, De, (qe) => oe(qe.ref)), De; }, Ae ); return e.cancellable( Ae, - Z.catch((ne) => { - throw qe("render", ne); + X.catch((re) => { + throw ze("render", re); }) ); } - function H(ae, me, W) { + function H(ae, ge, W) { if (ae.length !== 0) { - e.state.update(Nue, ae, me); + e.state.update(Nue, ae, ge); for (const Se of ae) Be(Se); i.emit({ - pages: ae.map((Se) => Lt(Se)), - scope: me, + pages: ae.map((Se) => Ft(Se)), + scope: ge, origin: W }); } } - function Y({ pages: ae, scope: me = "content" } = {}) { + function Y({ pages: ae, scope: ge = "content" } = {}) { const W = ae?.flatMap((Se) => e.getPage(Se)?.ref.objectNumber ?? []); - H(W ?? A(), me, null); + H(W ?? A(), ge, null); } - const ue = /* @__PURE__ */ new Set(); - let le = !1; + const le = /* @__PURE__ */ new Set(); + let ie = !1; const pe = (ae) => { - ue.add(ae), !le && (le = !0, e.clock.nextFrame(() => { - le = !1; - const me = [...ue]; - ue.clear(); - for (const W of me) Be(W); + le.add(ae), !ie && (ie = !0, e.clock.nextFrame(() => { + ie = !1; + const ge = [...le]; + le.clear(); + for (const W of ge) Be(W); })); - }, ge = new Wue({ + }, ve = new Wue({ store: r, getOptions: n, getPolicy: w, - getPageSize: (ae) => e.getPage(Lt(ae))?.size, + getPageSize: (ae) => e.getPage(Ft(ae))?.size, getEpoch: T, after: e.clock.after, - fetchTile: async (ae, me, W, Se, Ae, ce) => { + fetchTile: async (ae, ge, W, Se, Ae, ce) => { e.assertAllowed(fy, "render.tile"); - const Ne = Lt(me); + const Ne = Ft(ge); b(Ne) && await I(Ne, ce); const K = y(), U = e.doc.with({ priority: "high", view: ae }).page(Ne).render.image({ target: { kind: "rect", rect: W }, @@ -23232,48 +23263,48 @@ function Xue(e) { ...K.format !== void 0 ? { format: K.format } : {}, ...K.quality !== void 0 ? { quality: K.quality } : {} }); - return ce.aborted ? U.abort(dc(ce)) : ce.addEventListener("abort", () => U.abort(dc(ce)), { once: !0 }), U; + return ce.aborted ? U.abort(fc(ce)) : ce.addEventListener("abort", () => U.abort(fc(ce)), { once: !0 }), U; }, onAdvance: pe, debug: (ae) => { n().debug && console.debug(`[render] ${ae}`); } - }), Me = /* @__PURE__ */ new Map(); + }), _e = /* @__PURE__ */ new Map(); function Be(ae) { - let me = !1; - for (const [W, Se] of Me) { + let ge = !1; + for (const [W, Se] of _e) { const Ae = Se.pages.get(ae); if (!Ae) continue; - const ce = ge.plan(W, ae, Ae.demand, Ae.layers); - ce !== Ae.plan && (Ae.plan = ce, me = !0); + const ce = ve.plan(W, ae, Ae.demand, Ae.layers); + ce !== Ae.plan && (Ae.plan = ce, ge = !0); } - me && e.notify(); + ge && e.notify(); } - function te(ae) { - const me = Me.get(ae); - if (me) - return me.refs += 1, me.handle; + function ee(ae) { + const ge = _e.get(ae); + if (ge) + return ge.refs += 1, ge.handle; const W = /* @__PURE__ */ new Map(), Se = { setDemand: (Ae, ce, Ne) => { - const K = Ae.objectNumber, U = m(Ne ?? {}), Z = W.get(K), ne = ge.plan(ae, K, ce, U); - W.set(K, { demand: ce, layers: U, plan: ne }), ne !== Z?.plan && e.notify(); + const K = Ae.objectNumber, U = m(Ne ?? {}), X = W.get(K), re = ve.plan(ae, K, ce, U); + W.set(K, { demand: ce, layers: U, plan: re }), re !== X?.plan && e.notify(); }, getPlan: (Ae) => W.get(Ae.objectNumber)?.plan ?? Gk, - markPainted: (Ae, ce) => ge.sourcePainted(ae, Ae.objectNumber, ce), - markUnpainted: (Ae, ce) => ge.sourceUnpainted(ae, Ae.objectNumber, ce), + markPainted: (Ae, ce) => ve.sourcePainted(ae, Ae.objectNumber, ce), + markUnpainted: (Ae, ce) => ve.sourceUnpainted(ae, Ae.objectNumber, ce), release: (Ae) => { - W.delete(Ae.objectNumber), ge.releasePage(ae, Ae.objectNumber); + W.delete(Ae.objectNumber), ve.releasePage(ae, Ae.objectNumber); }, destroy: () => { - const Ae = Me.get(ae); + const Ae = _e.get(ae); if (!(!Ae || Ae.refs === 0) && (Ae.refs -= 1, !(Ae.refs > 0))) { for (const ce of [...Ae.pages.keys()]) - ge.releasePage(ae, ce); + ve.releasePage(ae, ce); Ae.pages.clear(); } } }; - return Me.set(ae, { handle: Se, refs: 1, pages: W }), Se; + return _e.set(ae, { handle: Se, refs: 1, pages: W }), Se; } const he = tt( () => [n().tiles.enabled], @@ -23281,8 +23312,8 @@ function Xue(e) { ); e.listen(t.api.onSettingsChanged, () => { const ae = /* @__PURE__ */ new Set(); - for (const me of Me.values()) for (const W of me.pages.keys()) ae.add(W); - for (const me of ae) Be(me); + for (const ge of _e.values()) for (const W of ge.pages.keys()) ae.add(W); + for (const ge of ae) Be(ge); }); const Te = Fue(e, { renderPage: D, @@ -23293,31 +23324,31 @@ function Xue(e) { api: { // ── public lens ── ...t.api, - canRender: d, - canRenderThumbnail: f, + canRender: f, + canRenderThumbnail: d, handOverPictures: g, getPicturePainter: () => h, renderPage: D, - renderThumbnail: async (ae, me = {}) => e.cancellable( - me.signal, - _(e.pageOf(ae).ref, me, "render.renderThumbnail") + renderThumbnail: async (ae, ge = {}) => e.cancellable( + ge.signal, + B(e.pageOf(ae).ref, ge, "render.renderThumbnail") ), renderPages: L, getRenderPolicy: w, - getRenderEpoch: (ae, me = {}) => { + getRenderEpoch: (ae, ge = {}) => { const W = e.getPage(ae); - return W ? T(W.ref.objectNumber, m(me)) : 0; + return W ? T(W.ref.objectNumber, m(ge)) : 0; }, invalidate: Y, onInvalidated: i.on, - getPictureState: (ae, me) => { + getPictureState: (ae, ge) => { const W = e.getPage(ae); - return W ? u.stateIn(me, W.ref.objectNumber) : gg.idle; + return W ? u.stateIn(ge, W.ref.objectNumber) : mg.idle; }, onPictureStateChanged: l.on, // ── host lens ── - renderSource: B, - getSourceKey: (ae, { scale: me, view: W, thumbnail: Se, ...Ae }) => { + renderSource: _, + getSourceKey: (ae, { scale: ge, view: W, thumbnail: Se, ...Ae }) => { if (Se) return M( ae.objectNumber, @@ -23325,7 +23356,7 @@ function Xue(e) { y().format, void 0 ); - const ce = O(ae, me); + const ce = O(ae, ge); return R( ae.objectNumber, ce.kind === "width" ? ce.width : 0, @@ -23337,10 +23368,10 @@ function Xue(e) { conformViewport: O, getPaintSettings: he, getLayerRights: p, - createViewDemand: te, + createViewDemand: ee, reportPicture: u.open, renderAppearances: j, - getKeptAppearances: (ae, me) => s.of(ae, oe(me)), + getKeptAppearances: (ae, ge) => s.of(ae, oe(ge)), getAppearanceScale: (ae) => rte(w(), ae), onRenderCompleted: a.on, onRenderFailed: c.on, @@ -23349,13 +23380,13 @@ function Xue(e) { }, connect() { e.listen(e.doc.events, (ae) => { - const me = Cue(ae, A); - me && H(me.pages, me.scope, "origin" in ae ? ae.origin : null); + const ge = Cue(ae, A); + ge && H(ge.pages, ge.scope, "origin" in ae ? ae.origin : null); }), Te.connect(); } }; } -const Pr = Wo, Zue = (e) => ({ +const Pr = qo, Zue = (e) => ({ id: "render", scope: "document", token: Pr, @@ -23371,16 +23402,16 @@ function ede(e) { const t = n2(e); return wi(t.subscribe, t.painted, t.painted); } -function wo(e) { +function vo(e) { const { ensure: t } = e, n = function(o) { const s = vi(); - return en((i) => { + return nn((i) => { const a = i.tryCapability(e.token, s ?? void 0), c = a ? e.read(a) : e.empty; return o ? o(c) : c; }, hv); }; return t ? function(o) { - const s = vi(), i = en( + const s = vi(), i = nn( (a) => a.tryCapability(e.token, s ?? void 0), Object.is ); @@ -23390,30 +23421,30 @@ function wo(e) { }, [i]), n(o); } : n; } -function jm(e) { +function Fm(e) { return function(n) { - return en((r) => { + return nn((r) => { const o = r.settingsOf(e).getSettings(); return n ? n(o) : o; }, hv); }; } -const tde = jm(Wo), nde = Object.freeze({ status: "idle", slow: !1 }); +const tde = Fm(qo), nde = Object.freeze({ status: "idle", slow: !1 }); function rde() { - const e = qo(); - return zt( - Wo, + const e = Go(); + return Gt( + qo, (t) => t.getPictureState(e.ref, e.view), nde ); } let O_ = !1; function B9(e = {}) { - const t = qo(), n = wt(Pr, (r) => r.getPicturePainter()); + const t = Go(), n = wt(Pr, (r) => r.getPicturePainter()); return n?.paints(t.view) ? /* @__PURE__ */ P(ode, { painter: n }) : /* @__PURE__ */ P(sde, { ...e }); } function ode({ painter: e }) { - const t = qo(), n = Re(null), r = bt(Pr), o = Re(null); + const t = Go(), n = Re(null), r = bt(Pr), o = Re(null); return Ze(() => { const s = r.reportPicture(t.view, t.ref); return o.current = { picture: e.paint(n.current, t, s), page: t }, () => { @@ -23442,14 +23473,14 @@ function sde({ tiles: n = !0, thumbnail: r = !1 }) { - const o = qo(), s = bt(Pr), i = wt(Pr, (p) => p.getPaintSettings()), a = Re(null), c = Re(null), l = { annotations: e, formFields: t }, u = ede(o.ref), d = wt(Pr, (p) => p.getLayerRights()), f = GU(u, l, d); + const o = Go(), s = bt(Pr), i = wt(Pr, (p) => p.getPaintSettings()), a = Re(null), c = Re(null), l = { annotations: e, formFields: t }, u = ede(o.ref), f = wt(Pr, (p) => p.getLayerRights()), d = GU(u, l, f); fae(u, l).length > 0 && bv( "render-layer-draws-what-a-layer-paints", " or draws what an or a on the page paints too, so it shows twice. Leave the prop out: the picture leaves out what a layer paints." ); const h = r ? { thumbnail: !0 } : {}, g = wt( Pr, - (p) => p.getSourceKey(o.ref, { scale: o.transform.renderScale, ...h, ...f }) + (p) => p.getSourceKey(o.ref, { scale: o.transform.renderScale, ...h, ...d }) ); return Ze(() => { const p = s.reportPicture(o.view, o.ref); @@ -23467,7 +23498,7 @@ function sde({ const S = await (await s.renderSource(o.ref, { scale: o.transform.renderScale, ...h, - ...f, + ...d, view: o.view, signal: p.signal })).objectUrl().abortWith(p.signal); @@ -23502,7 +23533,7 @@ function sde({ ] }); } function ide({ parts: e }) { - const t = qo(), n = bt(Pr), r = t.getViewDemand?.() ?? { + const t = Go(), n = bt(Pr), r = t.getViewDemand?.() ?? { desiredDeviceWidth: t.transform.deviceWidth }, o = ft(() => n.createViewDemand(t.view), [n, t.view]); Ke(() => () => o.destroy(), [o]), Ze(() => { @@ -23586,7 +23617,7 @@ function ade({ ); } function cde() { - return zt(Wo, (e) => e.getSnapshot(), null); + return Gt(qo, (e) => e.getSnapshot(), null); } function lde({ children: e, gap: t = 8, placement: n = "bottom" }) { const r = cde(), o = ft( @@ -23596,9 +23627,9 @@ function lde({ children: e, gap: t = 8, placement: n = "bottom" }) { return o ? /* @__PURE__ */ P(u2, { anchor: o, placement: n, gap: t, children: e }) : null; } function ude() { - const e = qo(), t = zt(Pr, (c) => c.getSnapshotBox(e.ref), null), n = tde((c) => c.snapshot.box), r = nu((c) => c.accent); + const e = Go(), t = Gt(Pr, (c) => c.getSnapshotBox(e.ref), null), n = tde((c) => c.snapshot.box), r = ru((c) => c.accent); if (!t) return null; - const { left: o, top: s, width: i, height: a } = zo(t, e.transform); + const { left: o, top: s, width: i, height: a } = Wo(t, e.transform); return /* @__PURE__ */ P( "svg", { @@ -23619,7 +23650,7 @@ function ude() { } ); } -const Fm = sn("page-edit", { +const Vm = an("page-edit", { hint: "add pageEditPlugin() from '@embedpdf/plugin-page-edit' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -23645,9 +23676,9 @@ function gde(e) { try { return await w(); } catch (y) { - throw qe("page-edit", y); + throw ze("page-edit", y); } - }, n = () => e.document()?.pages ?? pde, r = () => new re("invalid-input", "page-edit", "no pages given"), o = (w) => { + }, n = () => e.document()?.pages ?? pde, r = () => new te("invalid-input", "page-edit", "no pages given"), o = (w) => { if (w.length === 0) throw r(); return w.map((y) => e.pageOf(y).ref); }, s = (w) => !w || w === "start" || w === "end" ? w ?? "end" : "after" in w ? { after: e.pageOf(w.after).ref } : { before: e.pageOf(w.before).ref }, i = (w) => { @@ -23670,18 +23701,18 @@ function gde(e) { e.state.update(fde, y); }, l = (w, y, x) => { if (e.assertAllowed(w, y), x?.signal?.aborted) - throw new re("operation-cancelled", "page-edit", `${y} was cancelled`); + throw new te("operation-cancelled", "page-edit", `${y} was cancelled`); }, u = (w, y, x, A) => { const b = y === null ? { key: `pages.${w}` } : { key: `pages.${w}`, count: y }; return e.changes.stage({ label: b, ops: x, ...A ? { undo: A } : {} }); - }, d = async (w, y) => { + }, f = async (w, y) => { try { return (await e.cancellable(y?.signal, w.result)).items[0]; } catch (x) { - throw qe("page-edit", x); + throw ze("page-edit", x); } - }, f = async (w, y) => { - const x = await d(w, y); + }, d = async (w, y) => { + const x = await f(w, y); return { pages: "insertedPages" in x ? x.insertedPages : R_ }; }, h = (w, y) => { const x = /* @__PURE__ */ new Map(); @@ -23721,7 +23752,7 @@ function gde(e) { e.changes.sendHolds(), await e.cancellable(w?.signal, e.changes.whenSettled()); }, S = async (w, y) => (await v(y), e.cancellable(y?.signal, e.doc.pages.extract([...w]))), C = async (w, y, x, A) => { const b = y instanceof Uint8Array ? y : new Uint8Array(y); - return w === null ? f( + return w === null ? d( u("insert", null, [{ type: "pages.insert", source: b, position: x }]), A ) : m(w, A, (E) => { @@ -23729,9 +23760,9 @@ function gde(e) { "insert", w, [{ type: "pages.insert", source: b, position: x, objectNumbers: E }], - [{ type: "pages.delete", pages: E.map(Lt) }, ...g()] + [{ type: "pages.delete", pages: E.map(Ft) }, ...g()] ); - return f(I, A); + return d(I, A); }); }, k = async (w, y, x) => { const A = await t( @@ -23748,7 +23779,7 @@ function gde(e) { const b = await t(() => e.cancellable(x, A.pages.list())), E = y.map((I) => { const O = b.pages[I]; if (!O) - throw new re("not-found", "page-edit", `the PDF has no page ${I}`); + throw new te("not-found", "page-edit", `the PDF has no page ${I}`); return O.ref; }); return await t(() => e.cancellable(x, A.pages.extract(E))); @@ -23767,12 +23798,12 @@ function gde(e) { A, (E) => ((e.pageOf(E).rotation + y) % 360 + 360) % 360 ); - await d(b, x); + await f(b, x); }, setRotation: async (w, y, x) => { l(_i, "pageEdit.setRotation", x); const A = h(o(w), () => y); - await d(A, x); + await f(A, x); }, reorder: async (w, y, x) => { l(_i, "pageEdit.reorder", x); @@ -23782,20 +23813,20 @@ function gde(e) { [{ type: "pages.reorder", pages: A, position: s(y) }], [...AZ(n(), A), ...g()] ); - await d(b, x); + await f(b, x); }, delete: async (w, y) => { l(_i, "pageEdit.delete", y); const x = o(w), A = new Set(x.map((E) => E.objectNumber)); if (n().every((E) => A.has(E.ref.objectNumber))) - throw new re("invalid-input", "page-edit", "a document keeps at least one page"); + throw new te("invalid-input", "page-edit", "a document keeps at least one page"); const b = u( "delete", x.length, [{ type: "pages.delete", pages: x }], [{ type: "pages.restore", pages: S7(n(), x) }, ...g()] ); - await d(b, y); + await f(b, y); }, insertBlank: async (w = {}) => { l(_i, "pageEdit.insertBlank", w); @@ -23805,9 +23836,9 @@ function gde(e) { "insertBlank", x, [{ type: "pages.insertBlank", spec: { size: A, count: x }, position: y, objectNumbers: b }], - [{ type: "pages.delete", pages: b.map(Lt) }, ...g()] + [{ type: "pages.delete", pages: b.map(Ft) }, ...g()] ); - return f(E, w); + return d(E, w); }); }, insertFromBytes: async (w, y = {}) => { @@ -23821,11 +23852,11 @@ function gde(e) { if (l(_i, "pageEdit.insertFromDocument", x), y.length === 0) throw r(); const A = e.documentHandle(w); if (!A) - throw new re("not-found", "page-edit", `document '${w}' is not open`); - const b = e.get(It).listPages(w), E = y.map((T) => { + throw new te("not-found", "page-edit", `document '${w}' is not open`); + const b = e.get(Pt).listPages(w), E = y.map((T) => { const R = typeof T == "number" ? b[T] : b.find((M) => M.ref.objectNumber === T.objectNumber); if (!R) - throw new re( + throw new te( "not-found", "page-edit", `document '${w}' has no such page` @@ -23844,9 +23875,9 @@ function gde(e) { "duplicate", x.length, [{ type: "pages.copy", pages: x, position: A, objectNumbers: b }], - [{ type: "pages.delete", pages: b.map(Lt) }, ...g()] + [{ type: "pages.delete", pages: b.map(Ft) }, ...g()] ); - return f(E, y); + return d(E, y); }); }, extract: async (w, y) => (l(P_, "pageEdit.extract", y), S(o(w), y)) @@ -23855,10 +23886,10 @@ function gde(e) { const mde = () => ({ id: "page-edit", scope: "document", - token: Fm, + token: Vm, state: dde, create: gde -}), yde = wr(Fm, { +}), yde = wr(Vm, { read: (e) => ({ selected: e.getSelected(), canEdit: e.canEdit(), @@ -23871,9 +23902,9 @@ const mde = () => ({ } }); function bde() { - return bt(Fm); + return bt(Vm); } -const wde = wo(yde), vo = sn("i18n", { +const wde = vo(yde), ko = an("i18n", { hint: "add i18nPlugin() from '@embedpdf/plugin-i18n' to your plugins list" }); function PN(e, t) { @@ -23887,7 +23918,7 @@ const vde = [], kde = {}, Ade = { fallbackLocale: "en", locales: vde, loaders: kde -}, Pf = sn("link", { +}, Tf = an("link", { hint: "add linkPlugin() from '@embedpdf/plugin-link' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -23908,7 +23939,7 @@ function _9(e, t) { return { kind: "reported", target: e }; } } -const Vm = sn("outline", { +const $m = an("outline", { hint: "add outlinePlugin() from '@embedpdf/plugin-outline' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -23920,13 +23951,13 @@ const Vm = sn("outline", { move: !0, delete: !0 } -}), Kf = "top", it = (e) => e ? String(e.objectNumber) : Kf, Sde = Object.freeze([]), Tr = (e, t) => e.children[t] ?? Sde; +}), zf = "top", at = (e) => e ? String(e.objectNumber) : zf, Sde = Object.freeze([]), Tr = (e, t) => e.children[t] ?? Sde; function xde(e) { var r; const t = {}, n = {}; for (const o of e.items) { - const s = it(o.ref); - t[s] = o, (n[r = it(o.parent)] ?? (n[r] = [])).push(s); + const s = at(o.ref); + t[s] = o, (n[r = at(o.parent)] ?? (n[r] = [])).push(s); } return { items: t, children: n, incomplete: e.incomplete }; } @@ -23937,7 +23968,7 @@ function T_(e) { s && (t.push(s), n(o)); } }; - return n(Kf), t; + return n(zf), t; } function L9(e, t) { const n = [t]; @@ -23947,16 +23978,16 @@ function L9(e, t) { function NS(e, t) { const n = [], r = /* @__PURE__ */ new Set([t]); for (let o = e.items[t]?.parent ?? null; o; ) { - const s = it(o); + const s = at(o); if (r.has(s)) break; r.add(s), n.push(s), o = e.items[s]?.parent ?? null; } return n; } function Ede(e, t) { - const n = new Set(t.map(it)), r = /* @__PURE__ */ new Set(); + const n = new Set(t.map(at)), r = /* @__PURE__ */ new Set(); return t.filter((o) => { - const s = it(o); + const s = at(o); return r.has(s) ? !1 : (r.add(s), !NS(e, s).some((i) => n.has(i))); }); } @@ -23969,7 +24000,7 @@ function Cde(e, t) { n.push({ item: a, depth: s, hasChildren: c, expanded: l }), l && r(i, s + 1); } }; - return r(Kf, 0), n; + return r(zf, 0), n; } function Ide(e, t) { const n = []; @@ -23979,7 +24010,7 @@ function Ide(e, t) { const { destination: i } = s, a = t(i.page); if (a === null) return; const c = "y" in i ? i.y ?? 0 : 0; - n.push({ key: it(r.ref), pageIndex: a, y: c, order: o }); + n.push({ key: at(r.ref), pageIndex: a, y: c, order: o }); }), n.sort( (r, o) => r.pageIndex - o.pageIndex || r.y - o.y || r.order - o.order ); @@ -24019,16 +24050,16 @@ function Xk(e, t) { return { ...e, expanded: r }; } function M_(e, t) { - const n = t.map(it), r = t.filter((s, i) => n.indexOf(n[i]) === i); + const n = t.map(at), r = t.filter((s, i) => n.indexOf(n[i]) === i); return r.length === e.selected.length && r.every((s, i) => s.objectNumber === e.selected[i].objectNumber) ? e : { ...e, selected: r }; } function Tde(e, t) { - const n = Object.keys(e.expanded).filter((s) => !t.items[s]), r = e.selected.filter((s) => t.items[it(s)]); + const n = Object.keys(e.expanded).filter((s) => !t.items[s]), r = e.selected.filter((s) => t.items[at(s)]); if (n.length === 0 && r.length === e.selected.length) return e; const o = Xk(e, n); return r.length === e.selected.length ? o : { ...o, selected: r }; } -const Mde = (e) => e === Kf ? null : o6(Number(e)); +const Mde = (e) => e === zf ? null : o6(Number(e)); function Da(e, t, n) { const r = { ...e.children }; n.length > 0 ? r[t] = n : delete r[t]; @@ -24039,10 +24070,10 @@ function Da(e, t, n) { items: s === o ? e.items : { ...e.items, [t]: s } }; } -function $d(e, t) { +function Kd(e, t) { if (t.length === 0) return e; const n = { ...e.items }; - for (const r of t) n[it(r.ref)] = r; + for (const r of t) n[at(r.ref)] = r; return { ...e, items: n }; } function D9(e, t) { @@ -24051,7 +24082,7 @@ function D9(e, t) { const r = L9(e, t), o = { ...e.items }, s = { ...e.children }; for (const a of r) delete o[a], delete s[a]; - const i = it(n.parent); + const i = at(n.parent); return Da( { ...e, items: o, children: s }, i, @@ -24063,7 +24094,7 @@ function j9(e, t) { return n6( e.map(Mde).filter((n) => n !== null), t, - it + at ); } catch { return null; @@ -24077,21 +24108,21 @@ function Bde(e, t) { switch (t.type) { case "outline.created": return Da( - $d(e, [t.item]), - it(t.order.parent), - t.order.children.map(it) + Kd(e, [t.item]), + at(t.order.parent), + t.order.children.map(at) ); case "outline.updated": - return $d(e, [t.item]); + return Kd(e, [t.item]); case "outline.moved": { let n = e; for (const r of t.orders) { - const o = it(r.parent); - n = Da(n, o, r.children.map(it)), n = $d( + const o = at(r.parent); + n = Da(n, o, r.children.map(at)), n = Kd( n, r.children.flatMap((s) => { - const i = n.items[it(s)]; - return i && it(i.parent) !== o ? [{ ...i, parent: r.parent }] : []; + const i = n.items[at(s)]; + return i && at(i.parent) !== o ? [{ ...i, parent: r.parent }] : []; }) ); } @@ -24099,23 +24130,23 @@ function Bde(e, t) { } case "outline.deleted": { const [n] = t.deleted; - return n ? D9(e, it(n)) : e; + return n ? D9(e, at(n)) : e; } case "outline.restored": return Da( F9(e, t.items), - it(t.order.parent), - t.order.children.map(it) + at(t.order.parent), + t.order.children.map(at) ); default: return e; } } function F9(e, t) { - const n = $d(e, t), r = { ...n.children }, o = new Set(t.map((i) => it(i.ref))), s = {}; + const n = Kd(e, t), r = { ...n.children }, o = new Set(t.map((i) => at(i.ref))), s = {}; for (const i of t.slice(1)) { - const a = it(i.parent); - o.has(a) && (s[a] ?? (s[a] = [])).push(it(i.ref)); + const a = at(i.parent); + o.has(a) && (s[a] ?? (s[a] = [])).push(at(i.ref)); } for (const i of o) s[i] ? r[i] = s[i] : delete r[i]; @@ -24126,25 +24157,25 @@ function V9(e, t) { switch (t.type) { case "outline.create": { if (t.objectNumber === void 0) return e; - const n = o6(t.objectNumber), r = it(n), o = it(t.parent); - if (e.items[r] || o !== Kf && !e.items[o]) return e; + const n = o6(t.objectNumber), r = at(n), o = at(t.parent); + if (e.items[r] || o !== zf && !e.items[o]) return e; const s = Tr(e, o), i = j9(s, t.position ?? "end"); return i === null ? e : Da( - $d(e, [dZ(n, t.parent, t.data)]), + Kd(e, [dZ(n, t.parent, t.data)]), o, yR(s, i, [r]) ); } case "outline.update": { - const n = it(t.ref), r = e.items[n]; + const n = at(t.ref), r = e.items[n]; if (!r) return e; const o = fZ(r, t.patch, Tr(e, n).length > 0); - return o === r ? e : $d(e, [o]); + return o === r ? e : Kd(e, [o]); } case "outline.move": - return _de(e, t.refs.map(it), t.parent, t.position); + return _de(e, t.refs.map(at), t.parent, t.position); case "outline.delete": - return D9(e, it(t.ref)); + return D9(e, at(t.ref)); case "outline.restore": return Lde(e, t.items, t.index); default: @@ -24152,49 +24183,49 @@ function V9(e, t) { } } function _de(e, t, n, r) { - const o = it(n); - if (o !== Kf && !e.items[o] || new Set(t).size !== t.length || t.some((d) => !e.items[d])) return e; + const o = at(n); + if (o !== zf && !e.items[o] || new Set(t).size !== t.length || t.some((f) => !e.items[f])) return e; const s = new Set(t); - for (const d of t) - if (d === o || NS(e, d).some((f) => s.has(f))) + for (const f of t) + if (f === o || NS(e, f).some((d) => s.has(d))) return e; - if (NS(e, o).some((d) => s.has(d))) return e; - const i = Tr(e, o).filter((d) => !s.has(d)), a = j9(i, r); + if (NS(e, o).some((f) => s.has(f))) return e; + const i = Tr(e, o).filter((f) => !s.has(f)), a = j9(i, r); if (a === null) return e; const c = yR(i, a, t); if (Dde(c, Tr(e, o))) return e; let l = e; - const u = new Set(t.map((d) => it(e.items[d].parent))); + const u = new Set(t.map((f) => at(e.items[f].parent))); u.delete(o); - for (const d of u) + for (const f of u) l = Da( l, - d, - Tr(l, d).filter((f) => !s.has(f)) + f, + Tr(l, f).filter((d) => !s.has(d)) ); - return l = Da(l, o, c), $d( + return l = Da(l, o, c), Kd( l, - t.flatMap((d) => { - const f = l.items[d]; - return it(f.parent) === o ? [] : [{ ...f, parent: n }]; + t.flatMap((f) => { + const d = l.items[f]; + return at(d.parent) === o ? [] : [{ ...d, parent: n }]; }) ); } function Lde(e, t, n) { const [r] = t; if (!r) return e; - const o = it(r.parent); - if (o !== Kf && !e.items[o]) return e; - const s = it(r.ref); + const o = at(r.parent); + if (o !== zf && !e.items[o]) return e; + const s = at(r.ref); let i = e; for (const l of t) { - const u = i.items[it(l.ref)]; + const u = i.items[at(l.ref)]; if (!u) continue; - const d = it(u.parent); + const f = at(u.parent); i = Da( i, - d, - Tr(i, d).filter((f) => f !== it(l.ref)) + f, + Tr(i, f).filter((d) => d !== at(l.ref)) ); } const a = Tr(i, o), c = Math.max(0, Math.min(n, a.length)); @@ -24209,7 +24240,7 @@ function B_(e, t) { const s = e.items[o]; return s ? [s] : []; }), - index: Tr(e, it(n.parent)).indexOf(t) + index: Tr(e, at(n.parent)).indexOf(t) } : null; } function jde(e, t) { @@ -24218,12 +24249,12 @@ function jde(e, t) { return t.objectNumber === void 0 ? [] : [{ type: "outline.delete", ref: o6(t.objectNumber) }]; case "outline.update": case "outline.delete": { - const n = B_(e, it(t.ref)); + const n = B_(e, at(t.ref)); return n ? [n] : []; } case "outline.move": return t.refs.flatMap((r) => { - const o = B_(e, it(r)); + const o = B_(e, at(r)); return o ? [o] : []; }).sort( (r, o) => r.type === "outline.restore" && o.type === "outline.restore" ? r.index - o.index : 0 @@ -24271,17 +24302,17 @@ function Hde(e) { e.state.update(Rde, F), e.state.update(Tde, r.view() ?? F), n.emit({ outline: { items: T_(F), incomplete: F.incomplete } }); return; } - const B = M && "origin" in M ? Kde(M) : null; - B && M && "origin" in M && t.emit({ ...B, origin: M.origin }); + const _ = M && "origin" in M ? Kde(M) : null; + _ && M && "origin" in M && t.emit({ ..._, origin: M.origin }); } - }), o = () => r.view(), s = () => e.tryGet(Zt), i = tt( + }), o = () => r.view(), s = () => e.tryGet(tn), i = tt( () => [o()], (R) => R ? T_(R) : L_ - ), a = (R) => o()?.items[it(R)] ?? null, c = Mn( + ), a = (R) => o()?.items[at(R)] ?? null, c = Mn( (R) => [o()], (R, M) => M ? Tr(M, R).flatMap((F) => { - const B = M.items[F]; - return B ? [B] : []; + const _ = M.items[F]; + return _ ? [_] : []; }) : L_, { maxEntries: 256 } ), l = tt( @@ -24289,18 +24320,18 @@ function Hde(e) { (R, M) => R ? Cde(R, M) : $de ), u = tt( () => [o(), e.state.get().selected], - (R, M) => R && M.length > 0 ? M.filter((F) => R.items[it(F)] !== void 0) : Ude - ), d = tt( + (R, M) => R && M.length > 0 ? M.filter((F) => R.items[at(F)] !== void 0) : Ude + ), f = tt( () => [i(), e.document()?.pagesSequence ?? 0], (R) => Ide(R, (M) => e.getPage(M)?.index ?? null) - ), f = tt( + ), d = tt( () => { const R = s()?.getCurrentDestination() ?? null, M = R ? e.getPage(R.page)?.index ?? -1 : -1, F = R?.kind === "xyz" ? R.y ?? 0 : 0; - return [d(), M, F]; + return [f(), M, F]; }, (R, M, F) => M < 0 ? null : Ode(R, M, F) ), h = () => { - const R = f(); + const R = d(); return R ? o()?.items[R.key]?.ref ?? null : null; }, g = () => { const R = s()?.getCurrentDestination() ?? null; @@ -24309,15 +24340,15 @@ function Hde(e) { const R = o(); return R ? Object.keys(R.children).filter((M) => R.items[M]) : []; }, v = (R) => { - const M = o(), F = it(R); + const M = o(), F = at(R); return !!M && Tr(M, F).length > 0 && e.state.get().expanded[F] === !0; }, S = (R) => { const M = o(); - M && e.state.update(C1, NS(M, it(R))); + M && e.state.update(C1, NS(M, at(R))); }, C = (R) => { const M = a(R); if (!M) - throw new re("not-found", "outline", `the outline has no item ${R.objectNumber}`); + throw new te("not-found", "outline", `the outline has no item ${R.objectNumber}`); const F = e.tryGet(Lr); if (M.action && F) return { status: "dispatched", dispatch: F.execute(M.action, { @@ -24326,8 +24357,8 @@ function Hde(e) { event: { type: "activate" } }) }; if (!M.target) return { status: "none" }; - const B = e.tryGet(Pf); - if (B) return B.activate(M.target); + const _ = e.tryGet(Tf); + if (_) return _.activate(M.target); const $ = _9(M.target, (D) => e.getPage(D) !== null); switch ($.kind) { case "destination": { @@ -24343,10 +24374,10 @@ function Hde(e) { } }, k = (R, M) => { if (e.assertAllowed(__, R), M?.signal?.aborted) - throw new re("operation-cancelled", "outline", `${R} was cancelled`); + throw new te("operation-cancelled", "outline", `${R} was cancelled`); }, N = (R, M) => { if (o() && !p(R)) - throw new re( + throw new te( "not-found", "outline", `${M}: the outline has no item ${R.objectNumber}` @@ -24359,7 +24390,7 @@ function Hde(e) { try { return (await e.cancellable(M?.signal, R.result)).items[0]; } catch (F) { - throw qe("outline", F); + throw ze("outline", F); } }, x = async () => { for (; ; ) { @@ -24374,53 +24405,53 @@ function Hde(e) { const F = (await M.readText(R)).replace(/\s+/g, " ").trim(); if (F) return F.slice(0, Vde); } catch (F) { - if (R?.signal?.aborted) throw qe("outline", F); + if (R?.signal?.aborted) throw ze("outline", F); } - return e.tryGet(vo)?.t("outline.untitled", { fallback: "Untitled" }) ?? "Untitled"; + return e.tryGet(ko)?.t("outline.untitled", { fallback: "Untitled" }) ?? "Untitled"; }, b = async (R = {}, M) => { k("outline.create", M); - const { parent: F = null, position: B, title: $, target: D, color: _, bold: L, italic: j } = R; + const { parent: F = null, position: _, title: $, target: D, color: B, bold: L, italic: j } = R; F && N(F, "outline.create"); const H = D === void 0 ? g() : D, Y = { title: $ ?? await A(M), ...H ? { target: H } : {}, - ..._ !== void 0 ? { color: _ } : {}, + ...B !== void 0 ? { color: B } : {}, ...L !== void 0 ? { bold: L } : {}, ...j !== void 0 ? { italic: j } : {} - }, ue = await x(), le = w("create", [ - { type: "outline.create", parent: F, ...B ? { position: B } : {}, data: Y, objectNumber: ue } + }, le = await x(), ie = w("create", [ + { type: "outline.create", parent: F, ..._ ? { position: _ } : {}, data: Y, objectNumber: le } ]); if (M?.select) { - const ge = { kind: "objectNumber", objectNumber: ue }; - S(ge), e.state.update(M_, [ge]); + const ve = { kind: "objectNumber", objectNumber: le }; + S(ve), e.state.update(M_, [ve]); } - return { item: (await y(le, M)).item }; + return { item: (await y(ie, M)).item }; }, E = async (R, M, F) => { k("outline.update", F), N(R, "outline.update"); - const B = w("update", [{ type: "outline.update", ref: R, patch: M }]); - return { item: (await y(B, F)).item }; - }, I = async (R, M, F, B) => { - if (k("outline.move", B), R.length === 0) return; + const _ = w("update", [{ type: "outline.update", ref: R, patch: M }]); + return { item: (await y(_, F)).item }; + }, I = async (R, M, F, _) => { + if (k("outline.move", _), R.length === 0) return; for (const D of R) N(D, "outline.move"); M && N(M, "outline.move"); const $ = w("move", [{ type: "outline.move", refs: R, parent: M, position: F }]); - await y($, B); + await y($, _); }, O = async (R, M) => { k("outline.delete", M); for (const D of R) N(D, "outline.delete"); - const F = o(), B = F ? Ede(F, R) : R; - if (B.length === 0) return; + const F = o(), _ = F ? Ede(F, R) : R; + if (_.length === 0) return; const $ = w( "delete", - B.map((D) => ({ type: "outline.delete", ref: D })), - B.length + _.map((D) => ({ type: "outline.delete", ref: D })), + _.length ); await y($, M); }; return { api: { list: i, get: a, - getChildren: (R) => c(it(R)), + getChildren: (R) => c(at(R)), listRows: l, getCurrentItem: h, isIncomplete: () => o()?.incomplete ?? !1, @@ -24429,11 +24460,11 @@ function Hde(e) { refresh: (R) => e.cancellable(R?.signal, r.refresh()), isExpanded: v, expand: (R) => { - p(R) && e.state.update(C1, [it(R)]); + p(R) && e.state.update(C1, [at(R)]); }, - collapse: (R) => e.state.update(Xk, [it(R)]), + collapse: (R) => e.state.update(Xk, [at(R)]), toggle: (R) => { - v(R) ? e.state.update(Xk, [it(R)]) : p(R) && e.state.update(C1, [it(R)]); + v(R) ? e.state.update(Xk, [at(R)]) : p(R) && e.state.update(C1, [at(R)]); }, expandAll: () => e.state.update(C1, m()), collapseAll: () => e.state.update(Xk, Object.keys(e.state.get().expanded)), @@ -24453,12 +24484,12 @@ function Hde(e) { } const zde = () => ({ id: "outline", - token: Vm, + token: $m, scope: "document", - optional: [Zt, Lr, Pf, _r, vo], + optional: [tn, Lr, Tf, _r, ko], state: Pde, create: Hde -}), Wde = wr(Vm, { +}), Wde = wr($m, { read: (e) => ({ items: e.list(), rows: e.listRows(), @@ -24480,9 +24511,9 @@ const zde = () => ({ ensure: (e) => e.ensureLoaded() }); function RDe() { - return bt(Vm); + return bt($m); } -const qde = wo(Wde), $m = sn("attachment", { +const qde = vo(Wde), Um = an("attachment", { hint: "add attachmentPlugin() from '@embedpdf/plugin-attachment' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -24643,7 +24674,7 @@ function ife(e) { ]; return A.length > 0 ? A : N1; } - ), d = (y) => u().find((x) => x.id === y) ?? null, f = tt( + ), f = (y) => u().find((x) => x.id === y) ?? null, d = tt( () => [u(), e.state.get().selected], (y, x) => { if (x.length === 0) return N1; @@ -24659,22 +24690,22 @@ function ife(e) { return !(c.get() ?? []).some((A) => A.ref.key === x); }, g = (y, x, A) => { if (e.assertAllowed(y, x), A?.signal?.aborted) - throw new re("operation-cancelled", "attachment", `${x} was cancelled`); + throw new te("operation-cancelled", "attachment", `${x} was cancelled`); }, p = async (y, x) => { try { return await e.cancellable(x?.signal, y.result); } catch (A) { - throw qe("attachment", A); + throw ze("attachment", A); } }, m = (y) => { const x = l(); if (!x) - throw new re("not-found", "attachment", `${y}: no annotation plugin`); + throw new te("not-found", "attachment", `${y}: no annotation plugin`); return x; }, v = (y, x) => { const { data: A, description: b } = y, E = typeof Blob < "u" && A instanceof Blob ? A : null, I = y.name ?? (E && "name" in E ? String(E.name) : ""); if (!I) - throw new re( + throw new te( "invalid-input", "attachment", "attachment.add: a file needs a name: pass { data, name } or a File" @@ -24708,7 +24739,7 @@ function ife(e) { g(I1, "attachment.remove", x); const { ref: A } = y.home, b = c.view(); if (b && !b.some((O) => O.ref.key === A.key)) - throw new re( + throw new te( "not-found", "attachment", `attachment.remove: the document has no attachment '${A.key}'` @@ -24735,12 +24766,12 @@ function ife(e) { await e.cancellable(x?.signal, e.doc.attachments.download(y.home.ref)) ); } catch (b) { - throw qe("attachment", b); + throw ze("attachment", b); } }, N = (y) => { if (y.home.kind !== "page") return; const x = l(), A = x?.get(y.home.ref); - !x || !A || (x.selection.select([A.ref]), e.tryGet(Zt)?.reveal(A.ref.page, { + !x || !A || (x.selection.select([A.ref]), e.tryGet(tn)?.reveal(A.ref.page, { rect: A.rect, align: { x: "center", y: 0.35 }, behavior: "smooth" @@ -24748,8 +24779,8 @@ function ife(e) { }; return { api: { list: u, - get: d, - getSelected: f, + get: f, + getSelected: d, select: (y) => e.state.update( Qde, y.map((x) => x.id) @@ -24771,12 +24802,12 @@ function ife(e) { } const afe = () => ({ id: "attachment", - token: $m, + token: Um, scope: "document", - optional: [vt, Zt], + optional: [vt, tn], state: Yde, create: ife -}), cfe = wr($m, { +}), cfe = wr(Um, { read: (e) => ({ files: e.list(), selected: e.getSelected(), @@ -24794,9 +24825,9 @@ const afe = () => ({ ensure: (e) => e.ensureLoaded() }); function TDe() { - return bt($m); + return bt(Um); } -const H9 = wo(cfe), lfe = () => ({ +const H9 = vo(cfe), lfe = () => ({ activeToolId: "pointer", toolStack: [], cursor: "default" @@ -24848,63 +24879,63 @@ function gfe(e, t) { const n = e.settings(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(); let s = 0; const i = [], a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(); - let u = null, d = null, f = !1; + let u = null, f = null, d = !1; const h = e.events.source(), g = e.events.source(), p = e.events.source(), m = e.events.source(), v = e.events.source(); - e.state.onChange(({ previous: B, next: $ }) => { - B.cursor !== $.cursor && v.emit({ cursor: $.cursor }); + e.state.onChange(({ previous: _, next: $ }) => { + _.cursor !== $.cursor && v.emit({ cursor: $.cursor }); }); - const S = () => e.state.get(), C = (B) => r.get(B) ?? { id: B, cursor: "default", enables: F_ }, k = () => C(S().activeToolId), N = tt( + const S = () => e.state.get(), C = (_) => r.get(_) ?? { id: _, cursor: "default", enables: F_ }, k = () => C(S().activeToolId), N = tt( () => [s], - (B) => [...r.values()] + (_) => [...r.values()] ), w = () => { - let B = null; - for (const _ of c.values()) (!B || _.priority > B.priority) && (B = _); + let _ = null; + for (const B of c.values()) (!_ || B.priority > _.priority) && (_ = B); const $ = k(), D = l.get($.id); - return B ? D?.[B.cursor] ?? B.cursor : f ? D?.[$.cursor] ?? $.cursor : $.gapCursor ?? "default"; - }, y = () => e.state.update(ffe, w()), x = (B) => { - const $ = i.indexOf(B); - $ >= 0 && i.splice($, 1), a.delete(B), u === B && (u = null, d = null); - }, A = (B, $) => (i.push(B), $ !== void 0 && a.set(B, $), () => x(B)), b = (B) => { - r.delete(B.id); - const $ = o.get(B); - o.delete(B), $ && x($); - }, E = (B, $) => { - const D = r.get(B.id); + return _ ? D?.[_.cursor] ?? _.cursor : d ? D?.[$.cursor] ?? $.cursor : $.gapCursor ?? "default"; + }, y = () => e.state.update(ffe, w()), x = (_) => { + const $ = i.indexOf(_); + $ >= 0 && i.splice($, 1), a.delete(_), u === _ && (u = null, f = null); + }, A = (_, $) => (i.push(_), $ !== void 0 && a.set(_, $), () => x(_)), b = (_) => { + r.delete(_.id); + const $ = o.get(_); + o.delete(_), $ && x($); + }, E = (_, $) => { + const D = r.get(_.id); if (D && !$) - throw new re( + throw new te( "conflict", "interaction", - `tool '${B.id}' is already registered; pass { replace: true } to replace it` + `tool '${_.id}' is already registered; pass { replace: true } to replace it` ); D && b(D); - const _ = B.enables ? B : { ...B, enables: F_ }; - r.set(_.id, _); - const L = mfe(_); - return L && (o.set(_, L), A(L)), _; + const B = _.enables ? _ : { ..._, enables: F_ }; + r.set(B.id, B); + const L = mfe(B); + return L && (o.set(B, L), A(L)), B; }, I = () => { s += 1, e.notify(); - }, O = (B) => () => { - r.get(B.id) === B && (b(B), l.delete(B.id), I()); + }, O = (_) => () => { + r.get(_.id) === _ && (b(_), l.delete(_.id), I()); }; - for (const B of t) E(B, !0); - let T = n.get().tools.map((B) => O(E(B, !0))); - n.api.onSettingsChanged(({ changedKeys: B }) => { - if (B.includes("tools")) { + for (const _ of t) E(_, !0); + let T = n.get().tools.map((_) => O(E(_, !0))); + n.api.onSettingsChanged(({ changedKeys: _ }) => { + if (_.includes("tools")) { for (const $ of T) $(); T = n.get().tools.map(($) => O(E($, !0))), I(); } }), e.state.update(fC, n.get().defaultTool), y(); - const R = (B) => { + const R = (_) => { const $ = k(); return i.filter((D) => { - const _ = a.get(D); - return _ === void 0 || B === void 0 || _ === B; - }).filter((D) => D.enabledFor($)).sort((D, _) => _.priority - D.priority); + const B = a.get(D); + return B === void 0 || _ === void 0 || B === _; + }).filter((D) => D.enabledFor($)).sort((D, B) => B.priority - D.priority); }; - function M(B, $) { - if (!r.has(B)) throw new re("not-found", "interaction", `unknown tool '${B}'`); + function M(_, $) { + if (!r.has(_)) throw new te("not-found", "interaction", `unknown tool '${_}'`); const D = S().activeToolId; - u = null, d = null, c.clear(), e.state.update($), y(), h.emit({ toolId: B, previousToolId: D }); + u = null, f = null, c.clear(), e.state.update($), y(), h.emit({ toolId: _, previousToolId: D }); } return { api: { ...n.api, @@ -24913,27 +24944,27 @@ function gfe(e, t) { getActiveToolId: () => S().activeToolId, getDefaultToolId: () => n.get().defaultTool, listTools: N, - getTool: (B) => r.get(B) ?? null, - hasTool: (B) => r.has(B), - canUseTool: (B) => { - const $ = r.get(B); + getTool: (_) => r.get(_) ?? null, + hasTool: (_) => r.has(_), + canUseTool: (_) => { + const $ = r.get(_); return !!$ && ($.canUse?.() ?? !0); }, - activateTool: (B) => M(B, ($) => fC($, B)), + activateTool: (_) => M(_, ($) => fC($, _)), activateDefaultTool: () => { - const B = n.get().defaultTool; - M(B, ($) => fC($, B)); + const _ = n.get().defaultTool; + M(_, ($) => fC($, _)); }, - pushTool: (B) => M(B, ($) => ufe($, B)), + pushTool: (_) => M(_, ($) => ufe($, _)), popTool: () => { - const B = S().toolStack; - B.length !== 0 && M(B[B.length - 1], dfe); + const _ = S().toolStack; + _.length !== 0 && M(_[_.length - 1], dfe); }, - setToolCursor: (B, $) => { - $ === null ? l.delete(B) : l.set(B, $), y(); + setToolCursor: (_, $) => { + $ === null ? l.delete(_) : l.set(_, $), y(); }, - registerTool: (B, $) => { - const D = E(B, $?.replace ?? !1); + registerTool: (_, $) => { + const D = E(_, $?.replace ?? !1); return I(), O(D); }, onToolChanged: h.on, @@ -24941,38 +24972,38 @@ function gfe(e, t) { onGestureEnded: p.on, onGestureCancelled: m.on, // ── host ────────────────────────────────────────────────────────────── - activeToolEnables: (B) => k().enables.has(B), - registerHandler: (B, $) => A(B, $?.source), - claimCursor: (B, $, D = 0) => { - $ === null ? c.delete(B) : c.set(B, { cursor: $, priority: D }), y(); + activeToolEnables: (_) => k().enables.has(_), + registerHandler: (_, $) => A(_, $?.source), + claimCursor: (_, $, D = 0) => { + $ === null ? c.delete(_) : c.set(_, { cursor: $, priority: D }), y(); }, getCursor: () => S().cursor, hasCursorClaim: () => c.size > 0, onCursorChanged: v.on, - wouldClaimTouch: (B) => { - for (const $ of R(B.source)) if ($.claimsTouch?.(B)) return !0; + wouldClaimTouch: (_) => { + for (const $ of R(_.source)) if ($.claimsTouch?.(_)) return !0; return !1; }, - dispatchPointer: (B) => { - const $ = B.page != null; - if ($ !== f && (f = $, y()), B.phase === "down") { - u = null, d = null; - for (const D of R(B.source)) - if (D.onPointerDown(B)) { - u = D, d = { + dispatchPointer: (_) => { + const $ = _.page != null; + if ($ !== d && (d = $, y()), _.phase === "down") { + u = null, f = null; + for (const D of R(_.source)) + if (D.onPointerDown(_)) { + u = D, f = { toolId: S().activeToolId, - page: B.page?.ref ?? null, - pointerType: B.pointerType ?? "mouse" - }, g.emit(d); + page: _.page?.ref ?? null, + pointerType: _.pointerType ?? "mouse" + }, g.emit(f); break; } - } else if (B.phase === "move") - if (u) u.onPointerMove?.(B); - else for (const D of R(B.source)) D.onHover?.(B); + } else if (_.phase === "move") + if (u) u.onPointerMove?.(_); + else for (const D of R(_.source)) D.onHover?.(_); else { - const D = u, _ = d; - if (u = null, d = null, !D || !_) return; - B.phase === "cancel" ? ((D.onPointerCancel ?? D.onPointerUp)?.call(D, B), m.emit(_)) : (D.onPointerUp?.(B), p.emit(_)); + const D = u, B = f; + if (u = null, f = null, !D || !B) return; + _.phase === "cancel" ? ((D.onPointerCancel ?? D.onPointerUp)?.call(D, _), m.emit(B)) : (D.onPointerUp?.(_), p.emit(B)); } } } }; @@ -25034,9 +25065,9 @@ const yfe = (e) => ({ scope: "workspace", token: uR, create: () => ({ api: e.provider ?? wfe }) -}), kfe = wo(bfe); +}), kfe = vo(bfe); function Afe(e) { - const t = Rt(Cn), n = e && JSON.stringify(e), r = Re(e); + const t = Bt(Cn), n = e && JSON.stringify(e), r = Re(e); r.current = e, Ke(() => { const o = r.current; if (!(!o || !t)) @@ -25132,9 +25163,9 @@ function U_(e) { const t = e.results.filter((n) => n.status === "applied").map((n) => n.page); return t.length > 0 ? t : null; } -const uh = "doc.text.select", hC = "doc.text.copy", O1 = Object.freeze([]), Tfe = Object.freeze([]), Mfe = Object.freeze([]), K_ = 8, py = Number.MAX_SAFE_INTEGER; +const fh = "doc.text.select", hC = "doc.text.copy", O1 = Object.freeze([]), Tfe = Object.freeze([]), Mfe = Object.freeze([]), K_ = 8, py = Number.MAX_SAFE_INTEGER; function Bfe(e) { - const t = e.settings(), n = e.events.source(), r = e.events.source(), o = e.events.source(), s = /* @__PURE__ */ new Map(), i = () => e.state.get(), a = () => e.allows(uh), c = () => e.allows(hC), l = (L) => e.getPage(L)?.index ?? -1, u = (L) => e.document()?.pages[L]?.ref, d = e.pageMirror({ + const t = e.settings(), n = e.events.source(), r = e.events.source(), o = e.events.source(), s = /* @__PURE__ */ new Map(), i = () => e.state.get(), a = () => e.allows(fh), c = () => e.allows(hC), l = (L) => e.getPage(L)?.index ?? -1, u = (L) => e.document()?.pages[L]?.ref, f = e.pageMirror({ name: "geometry", load: (L, j) => L.page(j).text.layout(), affected: U_, @@ -25143,9 +25174,9 @@ function Bfe(e) { const j = i().selection; j && S(j); } - }), h = (L) => d.getStatus(L) === "ready" ? d.get(L) : void 0, g = (L, j) => L.charAt(j); + }), h = (L) => f.getStatus(L) === "ready" ? f.get(L) : void 0, g = (L, j) => L.charAt(j); function p(L) { - return !a() || !e.getPage(L) ? Promise.resolve() : d.ensureLoaded(L).catch(() => { + return !a() || !e.getPage(L) ? Promise.resolve() : f.ensureLoaded(L).catch(() => { }); } function m(L) { @@ -25162,22 +25193,22 @@ function Bfe(e) { const j = { anchor: v(L.anchor), focus: v(L.focus) - }, { start: H, end: Y } = m(j), ue = l(H.page), le = l(Y.page); - if (ue < 0 || le < 0) { + }, { start: H, end: Y } = m(j), le = l(H.page), ie = l(Y.page); + if (le < 0 || ie < 0) { e.state.update(hy); return; } const pe = {}; - for (let ge = ue; ge <= le; ge++) { - const Me = u(ge); - if (!Me) continue; - const Be = h(Me); + for (let ve = le; ve <= ie; ve++) { + const _e = u(ve); + if (!_e) continue; + const Be = h(_e); if (!Be) { - p(Me); + p(_e); continue; } - const te = ge === ue ? H.glyph : 0, he = ge === le ? Y.glyph : Be.charCount - 1; - pe[Me.objectNumber] = Be.segments({ start: te, count: he - te + 1 }); + const ee = ve === le ? H.glyph : 0, he = ve === ie ? Y.glyph : Be.charCount - 1; + pe[_e.objectNumber] = Be.segments({ start: ee, count: he - ee + 1 }); } e.state.update(Ofe, j, pe); } @@ -25186,10 +25217,10 @@ function Bfe(e) { (L, j) => k(L, j) ); function k(L, j) { - const H = Object.keys(j).map((Te) => Lt(Number(Te))).filter((Te) => (j[Te.objectNumber]?.length ?? 0) > 0).sort((Te, ze) => l(Te) - l(ze)), Y = H.map((Te) => ({ + const H = Object.keys(j).map((Te) => Ft(Number(Te))).filter((Te) => (j[Te.objectNumber]?.length ?? 0) > 0).sort((Te, We) => l(Te) - l(We)), Y = H.map((Te) => ({ page: Te, segments: j[Te.objectNumber] - })), ue = H.length ? H : Tfe; + })), le = H.length ? H : Tfe; if (!L) return { snapshot: { @@ -25199,37 +25230,37 @@ function Bfe(e) { direction: "forward", range: null }, - pages: ue, + pages: le, anchor: null }; - const { start: le, end: pe, direction: ge } = m(L), Me = { + const { start: ie, end: pe, direction: ve } = m(L), _e = { pages: Y, - start: N(j, le, "start"), + start: N(j, ie, "start"), end: N(j, pe, "end"), - direction: ge, + direction: ve, range: { - start: { page: le.page, index: le.glyph }, + start: { page: ie.page, index: ie.glyph }, end: { page: pe.page, index: pe.glyph + 1 } } }, Be = w(j[pe.page.objectNumber]); - let te = Be ? { page: pe.page, bounds: Be } : null; + let ee = Be ? { page: pe.page, bounds: Be } : null; const he = H[H.length - 1]; - return !te && he && (te = { page: he, bounds: w(j[he.objectNumber]) }), { snapshot: Me, pages: ue, anchor: te }; + return !ee && he && (ee = { page: he, bounds: w(j[he.objectNumber]) }), { snapshot: _e, pages: le, anchor: ee }; } function N(L, j, H) { const Y = L[j.page.objectNumber] ?? O1; if (!Y.length) return null; - const ue = H === "start" ? Y[0] : Y[Y.length - 1], le = h(j.page), pe = le ? le.charQuad(j.glyph) : null; - return le && pe ? { + const le = H === "start" ? Y[0] : Y[Y.length - 1], ie = h(j.page), pe = ie ? ie.charQuad(j.glyph) : null; + return ie && pe ? { page: j.page, glyphQuad: pe, - advance: ue.advance, + advance: le.advance, rect: fR(pe) } : { page: j.page, - glyphQuad: ue.quad, - advance: ue.advance, - rect: ue.rect + glyphQuad: le.quad, + advance: le.advance, + rect: le.rect }; } const w = (L) => L ? r9(L.map((j) => j.rect)) : null, y = Mn( @@ -25242,33 +25273,33 @@ function Bfe(e) { n.emit({ range: H.snapshot.range, pages: H.pages }), L.selection !== null && j.selection === null && o.emit({}); }); function x(L) { - e.assertAllowed(uh, "selection.select"); + e.assertAllowed(fh, "selection.select"); const j = "page" in L ? { start: { page: L.page, index: L.start }, end: { page: L.page, index: L.start + L.count } } : L; e.assertPageRef(j.start.page), e.assertPageRef(j.end.page); const H = l(j.start.page); - let Y = l(j.end.page), ue = j.end.index; - if (Y < H || Y === H && ue <= j.start.index) { + let Y = l(j.end.page), le = j.end.index; + if (Y < H || Y === H && le <= j.start.index) { e.state.update(hy); return; } - if (ue === 0) { + if (le === 0) { if (Y -= 1, Y < H) { e.state.update(hy); return; } - ue = py; + le = py; } - const le = u(Y); - le && S({ + const ie = u(Y); + ie && S({ anchor: { page: j.start.page, glyph: Math.max(0, j.start.index) }, - focus: { page: le, glyph: ue - 1 } + focus: { page: ie, glyph: le - 1 } }); } function A() { - e.assertAllowed(uh, "selection.selectAll"); + e.assertAllowed(fh, "selection.selectAll"); const L = e.document()?.pages ?? []; L.length !== 0 && S({ anchor: { page: L[0].ref, glyph: 0 }, @@ -25276,33 +25307,33 @@ function Bfe(e) { }); } function b(L) { - e.assertAllowed(uh, "selection.selectPage"); + e.assertAllowed(fh, "selection.selectPage"); const j = e.pageOf(L).ref; S({ anchor: { page: j, glyph: 0 }, focus: { page: j, glyph: py } }); } function E(L, j, H) { - e.assertAllowed(uh, `selection.select${H === "word" ? "WordAt" : "LineAt"}`); - const Y = e.pageOf(L).ref, ue = h(Y); - if (!ue) return !1; - const le = g(ue, j); - if (le == null) return !1; - const pe = H === "word" ? ue.wordAt(le) : ue.lineAt(le); + e.assertAllowed(fh, `selection.select${H === "word" ? "WordAt" : "LineAt"}`); + const Y = e.pageOf(L).ref, le = h(Y); + if (!le) return !1; + const ie = g(le, j); + if (ie == null) return !1; + const pe = H === "word" ? le.wordAt(ie) : le.lineAt(ie); return pe ? (S({ anchor: { page: Y, glyph: pe.start }, focus: { page: Y, glyph: pe.start + pe.count - 1 } }), !0) : !1; } function I(L, j) { - e.assertAllowed(uh, "selection.extendTo"); + e.assertAllowed(fh, "selection.extendTo"); const H = e.pageOf(L).ref, Y = i().selection; if (!Y) return; - const ue = h(H); - if (!ue) { + const le = h(H); + if (!le) { p(H); return; } - const le = g(ue, j); - le != null && S({ anchor: Y.anchor, focus: { page: H, glyph: le } }); + const ie = g(le, j); + ie != null && S({ anchor: Y.anchor, focus: { page: H, glyph: ie } }); } function O(L) { const j = L.objectNumber, H = s.get(j); @@ -25323,33 +25354,33 @@ function Bfe(e) { async function M(L, j) { e.assertPageRef(L.start.page), e.assertPageRef(L.end.page); const H = l(L.start.page); - let Y = l(L.end.page), ue = L.end.index; - if (Y < H || Y === H && ue <= L.start.index) + let Y = l(L.end.page), le = L.end.index; + if (Y < H || Y === H && le <= L.start.index) return ""; - ue === 0 && (Y -= 1, ue = py); - const le = []; - for (let Me = H; Me <= Y; Me++) { - const Be = u(Me); - Be && le.push({ + le === 0 && (Y -= 1, le = py); + const ie = []; + for (let _e = H; _e <= Y; _e++) { + const Be = u(_e); + Be && ie.push({ page: Be, - from: Me === H ? Math.max(0, L.start.index) : 0, - to: Me === Y ? ue : py + from: _e === H ? Math.max(0, L.start.index) : 0, + to: _e === Y ? le : py }); } - const pe = j?.signal, ge = new Array(le.length); - for (let Me = 0; Me < le.length; Me += K_) { + const pe = j?.signal, ve = new Array(ie.length); + for (let _e = 0; _e < ie.length; _e += K_) { if (pe?.aborted) - throw new re("operation-cancelled", "selection", "reading the text was cancelled"); - const Be = le.slice(Me, Me + K_); + throw new te("operation-cancelled", "selection", "reading the text was cancelled"); + const Be = ie.slice(_e, _e + K_); (await e.cancellable( pe, Promise.all(Be.map((he) => O(he.page))) )).forEach((he, Te) => { - const { from: ze, to: ae } = Be[Te]; - ge[Me + Te] = PV(he, { start: ze, count: ae - ze }); + const { from: We, to: ae } = Be[Te]; + ve[_e + Te] = PV(he, { start: We, count: ae - We }); }); } - return ge.join(` + return ve.join(` `); } function F() { @@ -25359,14 +25390,14 @@ function Bfe(e) { const j = i().selection; j && S(j); } - function B(L) { + function _(L) { for (const j of L) s.delete(j.objectNumber); e.state.update(hy); } const $ = (L) => e.state.update(Rfe, L), D = (L) => { const j = e.getPage(L); return j ? i().segments[j.ref.objectNumber] ?? O1 : O1; - }, _ = { + }, B = { ...t.api, // ── public lens ── canSelect: a, @@ -25396,7 +25427,7 @@ function Bfe(e) { onCleared: o.on, // ── host lens ── ensureLoaded: p, - isLoaded: (L) => d.getStatus(L) === "ready", + isLoaded: (L) => f.getStatus(L) === "ready", isOverText: (L, j) => { const H = h(L); return H ? g(H, j) != null : !1; @@ -25418,12 +25449,12 @@ function Bfe(e) { isHighlightVisible: () => !i().highlightHidden }; return { - api: _, + api: B, connect() { e.watch(() => e.document()?.pagesSequence ?? 0, F), e.listen(e.doc.events, (L) => { const j = U_(L); - j && B(j); - }), xfe(e, _); + j && _(j); + }), xfe(e, B); } }; } @@ -25464,7 +25495,7 @@ function Dfe(e) { end: { page: n.page, glyphQuad: n.glyphQuad, advance: n.advance } }; } -const ra = 12, P1 = 2, yu = 14, jfe = 0.05, Zk = (e, t) => ({ +const ra = 12, P1 = 2, bu = 14, jfe = 0.05, Zk = (e, t) => ({ x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 }); @@ -25473,8 +25504,8 @@ function z9(e, t, n) { if (!i || !a) return null; const c = a.x - i.x, l = a.y - i.y, u = Math.hypot(c, l); if (u === 0) return null; - const d = Math.atan2(l, c) * 180 / Math.PI - 90, f = Math.abs(d) < jfe, h = c / u, g = l / u, p = n === "start" ? { x: i.x - h * ra / 2, y: i.y - g * ra / 2 } : { x: a.x + h * ra / 2, y: a.y + g * ra / 2 }; - return { bar: { from: i, to: a }, length: u, rotation: d, upright: f, head: p }; + const f = Math.atan2(l, c) * 180 / Math.PI - 90, d = Math.abs(f) < jfe, h = c / u, g = l / u, p = n === "start" ? { x: i.x - h * ra / 2, y: i.y - g * ra / 2 } : { x: a.x + h * ra / 2, y: a.y + g * ra / 2 }; + return { bar: { from: i, to: a }, length: u, rotation: f, upright: d, head: p }; } function Ffe(e, t, n, r) { const o = n.glyphQuad, s = Zk( @@ -25511,15 +25542,15 @@ function Vfe(e, t, n, r) { }; } function $fe() { - const e = qo(), t = bt(ja), n = wt( + const e = Go(), t = bt(ja), n = wt( ja, (a) => a.listSegments(e.ref), pi - ), r = wt(ja, (a) => a.isHighlightVisible()), o = q9((a) => a.color), s = nu((a) => a.accent); + ), r = wt(ja, (a) => a.isHighlightVisible()), o = q9((a) => a.color), s = ru((a) => a.accent); if (Ke(() => { t.ensureLoaded(e.ref); }, [t, e.ref]), !r) return null; - const i = pt("text-selection", o ?? Lm("text-selection", s)); + const i = gt("text-selection", o ?? Dm("text-selection", s)); return /* @__PURE__ */ P( "svg", { @@ -25546,32 +25577,32 @@ function $fe() { } ); } -const W9 = wo(Lfe), q9 = jm(_r); +const W9 = vo(Lfe), q9 = Fm(_r); function Ufe({ children: e, gap: t = 8, placement: n = "top" }) { const r = W9((s) => s.isSelecting), o = wt(_r, (s) => s.getAnchor(), LU); return r || !o ? null : /* @__PURE__ */ P(u2, { anchor: o, placement: n, gap: t, children: e }); } function Kfe({ token: e } = {}) { - const t = Uf(e), n = bt(ja), r = Rt(t), o = pue(); + const t = Hf(e), n = bt(ja), r = Bt(t), o = pue(); (!o || o.projector.space !== "overlay") && bv( "selection-handles-outside-stage", " renders nothing here: mount it in the overlay slot (a has no camera to project the handles through)." ); - const s = W9((S) => S.isSelecting), i = wt(ja, (S) => S.isHighlightVisible()), a = q9((S) => S.handles), c = nu((S) => S.accent), l = wt( + const s = W9((S) => S.isSelecting), i = wt(ja, (S) => S.isHighlightVisible()), a = q9((S) => S.handles), c = ru((S) => S.accent), l = wt( ja, (S) => Dfe(S.getSnapshot()), gie ); - en(() => r?.listVisiblePages() ?? null); - const [u, d] = De(null), f = Re( + nn(() => r?.listVisiblePages() ?? null); + const [u, f] = je(null), d = Re( null ); - f.current = r && l ? { stage: r, endpoints: l } : null; + d.current = r && l ? { stage: r, endpoints: l } : null; const h = ft(() => { const S = {}, C = (k) => (N) => { S[k]?.(), delete S[k], N && (S[k] = jse(N, { arm: () => { - const w = f.current; + const w = d.current; if (!w) return null; const y = Vfe( n, @@ -25579,13 +25610,13 @@ function Kfe({ token: e } = {}) { w.endpoints, k ); - return y ? (d(k), { + return y ? (f(k), { // the point the user grabbed: the bar's midpoint base: y.base, session: { move: y.drag.move, end: () => { - y.drag.end(), d(null); + y.drag.end(), f(null); } } }) : null; @@ -25595,10 +25626,10 @@ function Kfe({ token: e } = {}) { return { start: C("start"), end: C("end") }; }, [n]); if (!r || !l || !i || s && !u) return null; - const g = H_(r), p = pt("text-selection-handle", a.color ?? c), m = pt("text-selection-handle-shadow", a.shadow), v = (S) => { + const g = H_(r), p = gt("text-selection-handle", a.color ?? c), m = gt("text-selection-handle-shadow", a.shadow), v = (S) => { const C = z9(g, l[S], S); if (!C) return null; - const k = yu + (S === "start" ? ra : 0), N = yu + P1 / 2; + const k = bu + (S === "start" ? ra : 0), N = bu + P1 / 2; return /* @__PURE__ */ P( "div", { @@ -25607,8 +25638,8 @@ function Kfe({ token: e } = {}) { position: "absolute", left: C.bar.from.x - N, top: C.bar.from.y - k, - width: P1 + 2 * yu, - height: C.length + ra + 2 * yu, + width: P1 + 2 * bu, + height: C.length + ra + 2 * bu, // Upright text carries no transform — pixel-identical to an // axis-aligned box (the geometry's float-noise guard decides). ...C.upright ? null : { @@ -25625,7 +25656,7 @@ function Kfe({ token: e } = {}) { { style: { position: "absolute", - left: yu, + left: bu, top: k, width: P1, height: C.length, @@ -25640,7 +25671,7 @@ function Kfe({ token: e } = {}) { style: { position: "absolute", left: N - ra / 2, - top: S === "start" ? yu : yu + C.length, + top: S === "start" ? bu : bu + C.length, width: ra, height: ra, borderRadius: "50%", @@ -25660,7 +25691,7 @@ function Kfe({ token: e } = {}) { ] }); } function Hfe({ prefetch: e, onRefused: t, target: n } = {}) { - const r = Rt(_r), o = Re(t); + const r = Bt(_r), o = Re(t); return o.current = t, Ke(() => { const s = n ? n.current : void 0; if (!(!r || s === null)) @@ -25671,7 +25702,7 @@ function Hfe({ prefetch: e, onRefused: t, target: n } = {}) { }); }, [r, e, n]), null; } -const Xa = sn("fonts", { +const Xa = an("fonts", { hint: "add fontsPlugin() from '@embedpdf/plugin-fonts' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -25718,7 +25749,7 @@ const J9 = (e) => ({ e: e === "ne" || e === "e" || e === "se", n: e === "nw" || e === "n" || e === "ne", s: e === "sw" || e === "s" || e === "se" -}), Gfe = { left: 0, top: 0, right: 0, bottom: 0 }, dm = { small: !1, spread: Gfe }, Jfe = ["nw", "ne", "se", "sw"], Yfe = 6, bR = (e, t) => ({ +}), Gfe = { left: 0, top: 0, right: 0, bottom: 0 }, fm = { small: !1, spread: Gfe }, Jfe = ["nw", "ne", "se", "sw"], Yfe = 6, bR = (e, t) => ({ x: e.x - t.left, y: e.y - t.top, width: e.width + t.left + t.right, @@ -25727,9 +25758,9 @@ const J9 = (e) => ({ function Qfe(e, t, n, r) { const o = { left: n, top: n, right: n, bottom: n }; if (!r) return o; - const s = vn(e), i = Mt( - Yr(bR(e, o)).map((u) => Bt(u, s, t)) - ), a = (u, d) => u > 0 ? u : Math.min(d, 0), c = Bt( + const s = vn(e), i = Lt( + Qr(bR(e, o)).map((u) => Dt(u, s, t)) + ), a = (u, f) => u > 0 ? u : Math.min(f, 0), c = Dt( { x: a(r.x - i.x, r.x + r.width - (i.x + i.width)), y: a(r.y - i.y, r.y + r.height - (i.y + i.height)) @@ -25745,7 +25776,7 @@ function Qfe(e, t, n, r) { }; } function wR(e, t, n, r) { - return !n || n <= 0 || Math.min(e.width, e.height) > Yfe * n - 1e-6 ? dm : { small: !0, spread: Qfe(e, t, n / 2, r) }; + return !n || n <= 0 || Math.min(e.width, e.height) > Yfe * n - 1e-6 ? fm : { small: !0, spread: Qfe(e, t, n / 2, r) }; } const wv = (e, t) => { const n = J9(t); @@ -25800,7 +25831,7 @@ function Xfe(e, t, n) { return X9(e, t, n) ? 0 : Math.min( z_(e, n), z_(t, n), - ...Yr(n).map((r) => vR(r, e, t)) + ...Qr(n).map((r) => vR(r, e, t)) ); } function Zfe(e, t) { @@ -25814,18 +25845,18 @@ function vv(e, t) { } return n; } -function Mt(e) { +function Lt(e) { let t = 1 / 0, n = 1 / 0, r = -1 / 0, o = -1 / 0; for (const s of e) t = Math.min(t, s.x), n = Math.min(n, s.y), r = Math.max(r, s.x), o = Math.max(o, s.y); return { x: t, y: n, width: r - t, height: o - n }; } -const Hf = (e, t) => ({ +const Wf = (e, t) => ({ x: e.x - t, y: e.y - t, width: e.width + 2 * t, height: e.height + 2 * t -}), Yr = (e) => [ +}), Qr = (e) => [ { x: e.x, y: e.y }, { x: e.x + e.width, y: e.y }, { x: e.x + e.width, y: e.y + e.height }, @@ -25843,13 +25874,13 @@ function d2(e) { height: e.width }; } -function fm(e, t) { +function hm(e, t) { const n = zn(t); return n % 90 !== 0 ? kv(e, n) : n % 180 === 0 ? e : d2(e); } -const ehe = (e, t) => Rce(e, t * PS), Bt = (e, t, n) => ci(ehe(t, n), e); +const ehe = (e, t) => Rce(e, t * PS), Dt = (e, t, n) => ci(ehe(t, n), e); function kv(e, t, n = vn(e)) { - return t ? Mt(Yr(e).map((r) => Bt(r, n, t))) : e; + return t ? Lt(Qr(e).map((r) => Dt(r, n, t))) : e; } const kR = (e, t) => { const n = Math.max(0, e.width - 2 * t), r = Math.max(0, e.height - 2 * t); @@ -25871,7 +25902,7 @@ const kR = (e, t) => { }; function the(e, t, n, r) { if (!t) return BN(e, n, r); - const o = vn(e), s = Bt(r, o, -t), i = BN(e, n, s), a = wv(e, Z9[n]), c = Bt(a, o, t), l = vn(i), u = a.x - l.x, d = a.y - l.y, f = t * PS, h = Math.cos(f), g = Math.sin(f), p = h * u - g * d, m = g * u + h * d, v = c.x - p, S = c.y - m; + const o = vn(e), s = Dt(r, o, -t), i = BN(e, n, s), a = wv(e, Z9[n]), c = Dt(a, o, t), l = vn(i), u = a.x - l.x, f = a.y - l.y, d = t * PS, h = Math.cos(d), g = Math.sin(d), p = h * u - g * f, m = g * u + h * f, v = c.x - p, S = c.y - m; return { x: v - i.width / 2, y: S - i.height / 2, @@ -25879,7 +25910,7 @@ function the(e, t, n, r) { height: i.height }; } -function Rf(e, t, n, r, o) { +function Mf(e, t, n, r, o) { const s = 1 - o, i = [s * s * s, 3 * s * s * o, 3 * s * o * o, o * o * o]; return { x: i[0] * e.x + i[1] * t.x + i[2] * n.x + i[3] * r.x, @@ -25898,10 +25929,10 @@ function nhe(e, t, n, r, o) { Math.hypot(e.x - 2 * t.x + n.x, e.y - 2 * t.y + n.y), Math.hypot(t.x - 2 * n.x + r.x, t.y - 2 * n.y + r.y) ), i = Math.max(1, Math.ceil(Math.sqrt(0.75 * s / o))), a = []; - for (let c = 1; c <= i; c++) a.push(Rf(e, t, n, r, c / i)); + for (let c = 1; c <= i; c++) a.push(Mf(e, t, n, r, c / i)); return a; } -const Ns = (e) => Number(e.toFixed(4)).toString(), _0 = Math.PI, wl = Math.PI / 2, sa = 34 * Math.PI / 180, W_ = 30 * Math.PI / 180, _N = 12 * Math.PI / 180; +const Ns = (e) => Number(e.toFixed(4)).toString(), _0 = Math.PI, vl = Math.PI / 2, sa = 34 * Math.PI / 180, W_ = 30 * Math.PI / 180, _N = 12 * Math.PI / 180; class eK { constructor(t, n) { this.ox = t, this.oy = n, this.parts = [], this.started = !1; @@ -25936,11 +25967,11 @@ class tK { } curveTo(t, n, r, o, s, i) { const a = this.current, c = this.place(t, n), l = this.place(r, o), u = this.place(s, i); - for (const d of [ + for (const f of [ ...RS(a.x, c.x, l.x, u.x), ...RS(a.y, c.y, l.y, u.y) ]) - this.add(Rf(a, c, l, u, d)); + this.add(Mf(a, c, l, u, f)); this.add(u), this.current = u; } bounds() { @@ -25964,14 +25995,14 @@ class nK { this.current = this.place(t, n), this.lines.push([this.current]); } curveTo(t, n, r, o, s, i) { - const a = this.current, c = this.place(t, n), l = this.place(r, o), u = this.place(s, i), d = Sl(a, c) + Sl(c, l) + Sl(l, u), f = Math.max(2, Math.ceil(d / rhe)); + const a = this.current, c = this.place(t, n), l = this.place(r, o), u = this.place(s, i), f = xl(a, c) + xl(c, l) + xl(l, u), d = Math.max(2, Math.ceil(f / rhe)); let h = this.lines[this.lines.length - 1]; h || this.lines.push(h = [a]); - for (let g = 1; g <= f; g++) h.push(Rf(a, c, l, u, g / f)); + for (let g = 1; g <= d; g++) h.push(Mf(a, c, l, u, g / d)); this.current = u; } } -const Sl = (e, t) => Math.hypot(t.x - e.x, t.y - e.y), rK = (e, t) => t === 0 ? 0 : e / t, oK = (e, t) => t === 0 ? 0 : e / t; +const xl = (e, t) => Math.hypot(t.x - e.x, t.y - e.y), rK = (e, t) => t === 0 ? 0 : e / t, oK = (e, t) => t === 0 ? 0 : e / t; function ohe(e) { let t = 0; for (let n = 0; n < e.length; n++) { @@ -25992,20 +26023,20 @@ function ihe(e) { } return n; } -function mg(e, t, n, r, o, s, i, a) { - const c = Math.cos(e), l = Math.sin(e), u = Math.cos(t), d = Math.sin(t), f = Math.sin((t - e) / 2); - if (f === 0) { +function yg(e, t, n, r, o, s, i, a) { + const c = Math.cos(e), l = Math.sin(e), u = Math.cos(t), f = Math.sin(t), d = Math.sin((t - e) / 2); + if (d === 0) { a && i.moveTo(n + o * c, r + s * l); return; } - const h = 4 / 3 * (1 - Math.cos((t - e) / 2)) / f; + const h = 4 / 3 * (1 - Math.cos((t - e) / 2)) / d; a && i.moveTo(n + o * c, r + s * l), i.curveTo( n + o * (c - h * l), r + s * (l + h * c), - n + o * (u + h * d), - r + s * (d - h * u), + n + o * (u + h * f), + r + s * (f - h * u), n + o * u, - r + s * d + r + s * f ); } function pC(e, t, n, r) { @@ -26023,24 +26054,24 @@ function sK(e, t, n, r, o, s, i, a) { for (; c < 0; ) c += 2 * Math.PI; const l = c; let u = 0; - for (a && i.moveTo(o + n * Math.cos(e), s + r * Math.sin(e)); c > wl; ) - mg(e + u, e + u + wl, o, s, n, r, i, !1), u += wl, c -= wl; - c > 0 && mg(e + u, e + l, o, s, n, r, i, !1); + for (a && i.moveTo(o + n * Math.cos(e), s + r * Math.sin(e)); c > vl; ) + yg(e + u, e + u + vl, o, s, n, r, i, !1), u += vl, c -= vl; + c > 0 && yg(e + u, e + l, o, s, n, r, i, !1); } function iK(e, t, n, r, o, s, i, a, c) { const l = e + _0 + i, u = l - 22 * Math.PI / 180; - mg(l, u, r, o, n, n, a, c), sK(u, t - s, n, n, r, o, a, !1); + yg(l, u, r, o, n, n, a, c), sK(u, t - s, n, n, r, o, a, !1); } function ahe(e, t, n, r, o, s) { const i = e + _0; - mg(i + n, i + n - W_, r, o, t, t, s, !1), mg(i + n - W_, i + wl, r, o, t, t, s, !1), mg(i + wl, i + _0 - sa, r, o, t, t, s, !1); + yg(i + n, i + n - W_, r, o, t, t, s, !1), yg(i + n - W_, i + vl, r, o, t, t, s, !1), yg(i + vl, i + _0 - sa, r, o, t, t, s, !1); } function che(e, t) { const n = e + _0; return [ ...pC(n + sa, n + _N, t, t), - ...pC(n + _N, n + wl, t, t), - ...pC(n + wl, n + _0 - sa, t, t) + ...pC(n + _N, n + vl, t, t), + ...pC(n + vl, n + _0 - sa, t, t) ]; } function lhe(e, t, n, r) { @@ -26069,44 +26100,44 @@ function AR(e, t, n, r, o) { if (i < 2) return; if (n <= 0) { o.moveTo(s[0].x, s[0].y); - for (let f = 1; f < i; f++) + for (let d = 1; d < i; d++) o.curveTo( - s[f].x, - s[f].y, - s[f].x, - s[f].y, - s[f].x, - s[f].y + s[d].x, + s[d].y, + s[d].x, + s[d].y, + s[d].x, + s[d].y ); return; } let a = t ? aK(n, r) : uhe(n, r); a < 0.5 && (a = 0.5); const c = Math.cos(sa), l = []; - for (let f = 0; f + 1 < i; f++) { - const h = Sl(s[f], s[f + 1]); + for (let d = 0; d + 1 < i; d++) { + const h = xl(s[d], s[d + 1]); l.push( h <= 0 || h >= 2 * c * a ? sa : Math.acos(Math.min(1, h / (2 * a))) ); } - let u = 0, d = !1; - for (let f = 0; f + 1 < i; f++) { - const h = s[f], g = s[f + 1], p = Sl(h, g); + let u = 0, f = !1; + for (let d = 0; d + 1 < i; d++) { + const h = s[d], g = s[d + 1], p = xl(h, g); if (p === 0) continue; const m = dhe(a, c, p); if (m.n < 0) { - d || (o.moveTo(h.x, h.y), d = !0); + f || (o.moveTo(h.x, h.y), f = !0); continue; } const v = Math.max(0.5, m.adjustedRadius), S = 2 * c * v, C = c * a + c * v, k = Math.atan2(g.y - h.y, g.x - h.x); - if (f === 0) { + if (d === 0) { const E = s[i - 2]; u = Math.atan2(h.y - E.y, h.x - E.x); } const N = rK(g.x - h.x, p), w = oK(g.y - h.y, p); let y = h.x, x = h.y; - const A = l[f], b = l[f === 0 ? i - 2 : f - 1] ?? sa; - if (iK(u, k, a, h.x, h.y, A, b, o, !d), d = !0, m.n === 0) + const A = l[d], b = l[d === 0 ? i - 2 : d - 1] ?? sa; + if (iK(u, k, a, h.x, h.y, A, b, o, !f), f = !0, m.n === 0) y += p * N, x += p * w; else { y += C * N, x += C * w; @@ -26124,13 +26155,13 @@ function fhe(e, t, n, r) { if (i <= 0 || a <= 0) return []; const c = Math.max(32, Math.ceil(Math.max(i, a) * 2)), l = []; for (let u = 0; u <= c; u++) { - const d = 2 * Math.PI * u / c; - l.push({ x: o + i * Math.cos(d), y: s + a * Math.sin(d) }); + const f = 2 * Math.PI * u / c; + l.push({ x: o + i * Math.cos(f), y: s + a * Math.sin(f) }); } return l; } function q_(e, t, n, r) { - const o = Sl(e, t); + const o = xl(e, t); if (o === 0) return sa; const s = (r / 2 + (o - r) / 2) / n; return s < -1 || s > 1 ? 0 : Math.acos(s); @@ -26158,24 +26189,24 @@ function hhe(e, t, n, r, o, s, i) { s, i ); - const d = Math.sin(_N) * u - 1.5; - let f = e, h = n, g = t, p = r; - if (c > 2 * d) - f += d, h -= d; + const f = Math.sin(_N) * u - 1.5; + let d = e, h = n, g = t, p = r; + if (c > 2 * f) + d += f, h -= f; else { const E = (e + n) / 2; - f = E - 0.1, h = E + 0.1; + d = E - 0.1, h = E + 0.1; } - if (l > 2 * d) - g += d, p -= d; + if (l > 2 * f) + g += f, p -= f; else { const E = (r + t) / 2; p = E + 0.1, g = E - 0.1; } - const m = fhe(f, g, h, p); + const m = fhe(d, g, h, p); if (m.length < 2) return; let v = 0; - for (let E = 1; E < m.length; E++) v += Sl(m[E - 1], m[E]); + for (let E = 1; E < m.length; E++) v += xl(m[E - 1], m[E]); const S = Math.cos(sa); let C = Math.ceil(v / (2 * S * u)); if (C < 2) return a(); @@ -26188,14 +26219,14 @@ function hhe(e, t, n, r, o, s, i) { let w = 0; const y = s * 0.1; for (let E = 0; E + 1 < m.length; E++) { - const I = m[E], O = m[E + 1], T = Sl(I, O); + const I = m[E], O = m[E + 1], T = xl(I, O); if (T === 0) continue; let R = T + w; if (R >= k - y || E === m.length - 2) { const M = rK(O.x - I.x, T), F = oK(O.y - I.y, T); - let B = k - w; + let _ = k - w; for (; R >= k - y; ) - N.push({ x: I.x + B * M, y: I.y + B * F }), R -= k, B += k; + N.push({ x: I.x + _ * M, y: I.y + _ * F }), R -= k, _ += k; w = Math.max(0, R); } else w += T; @@ -26242,7 +26273,7 @@ function ghe(e, t, n, r) { } function mhe(e, t, n) { const r = new tK(0, 0); - return SR(e, t, n, r), Hf(r.bounds(), n / 2); + return SR(e, t, n, r), Wf(r.bounds(), n / 2); } function yhe(e, t, n) { const r = new nK(0, 0); @@ -26254,7 +26285,7 @@ function bhe(e, t, n, r) { } function whe(e, t, n, r) { const o = new tK(e.x, e.y); - return xR(e, t, n, r, o), Hf(o.bounds(), r / 2); + return xR(e, t, n, r, o), Wf(o.bounds(), r / 2); } const cK = /* @__PURE__ */ new Set(["square", "circle", "stamp", "widget"]), vhe = /* @__PURE__ */ new Set(["stamp", "widget"]), LN = (e) => e.subtype === "circle" || e.subtype === "widget" && e.fieldKind === "radio"; function khe(e) { @@ -26287,17 +26318,17 @@ function lK(e, t) { } function xhe(e, t) { const n = lK(e, t); - return n === e.box ? fm(n, e.rotation) : kv(n, e.rotation, vn(e.box)); + return n === e.box ? hm(n, e.rotation) : kv(n, e.rotation, vn(e.box)); } -function ql(e) { +function Gl(e) { const t = vn(e.box); - return Yr(e.box).map( - (n) => Bt(n, t, e.rotation) + return Qr(e.box).map( + (n) => Dt(n, t, e.rotation) ); } function uK(e, t, n) { - const r = e.rotation ? Bt(t, vn(e.box), -e.rotation) : t; - return Q9(Hf(e.box, n), r); + const r = e.rotation ? Dt(t, vn(e.box), -e.rotation) : t; + return Q9(Wf(e.box, n), r); } function ER(e, t) { return { ...e, box: { ...e.box, x: e.box.x + t.x, y: e.box.y + t.y } }; @@ -26311,7 +26342,7 @@ const dK = (e, t) => ({ function fK(e, t, n) { return { ...e, - box: dK(Bt(vn(e.box), t, n), e.box), + box: dK(Dt(vn(e.box), t, n), e.box), rotation: zn(e.rotation + n) }; } @@ -26329,11 +26360,11 @@ function CR(e, t, n, r, o = 0) { }; } const hK = (e, t, n) => wR(e.box, e.rotation, t, n); -function pK(e, t = dm) { +function pK(e, t = fm) { const n = vn(e.box), r = bR(e.box, t.spread); return Y9(t).map((o) => ({ id: o, - at: Bt(wv(r, o), n, e.rotation), + at: Dt(wv(r, o), n, e.rotation), cursor: qfe(o, e.rotation) })); } @@ -26341,7 +26372,7 @@ function gK(e, t, n) { return { ...e, box: the(e.box, e.rotation, t, n) }; } function Ehe(e, t, n) { - const { strokeWidth: r, cloudyIntensity: o } = t, { box: s, rotation: i, ellipse: a } = e, c = r / 2, l = vn(s), u = (h) => i ? h.map((g) => Bt(g, l, i)) : h; + const { strokeWidth: r, cloudyIntensity: o } = t, { box: s, rotation: i, ellipse: a } = e, c = r / 2, l = vn(s), u = (h) => i ? h.map((g) => Dt(g, l, i)) : h; if (o && s.width > 0 && s.height > 0) { const h = bhe(s, a, o, r).map(u), g = h.map( (m) => ({ kind: "stroke", points: m, closed: !0, halfWidth: c }) @@ -26354,21 +26385,21 @@ function Ehe(e, t, n) { rotation: i, halfWidth: 0, filled: !0 - } : { kind: "area", ring: ql(e) }, ...h.map((m) => ({ kind: "area", ring: m })), ...g] : g; + } : { kind: "area", ring: Gl(e) }, ...h.map((m) => ({ kind: "area", ring: m })), ...g] : g; } - const d = kR(s, c); + const f = kR(s, c); if (a) { if (s.width <= 0 || s.height <= 0) return []; - const h = Math.max(0.01, d.width / 2), g = Math.max(0.01, d.height / 2); + const h = Math.max(0.01, f.width / 2), g = Math.max(0.01, f.height / 2); return [{ kind: "oval", center: l, rx: h, ry: g, rotation: i, halfWidth: c, filled: n }]; } - const f = { + const d = { kind: "stroke", - points: u(Yr(d)), + points: u(Qr(f)), closed: !0, halfWidth: c }; - return n ? [{ kind: "area", ring: ql(e) }, f] : [f]; + return n ? [{ kind: "area", ring: Gl(e) }, d] : [d]; } function Che(e, t) { const { strokeWidth: n, cloudyIntensity: r } = t; @@ -26391,7 +26422,7 @@ const vr = { rect: xhe, selectionBounds: (e) => e.box, oriented: () => !0, - turnedCorners: ql, + turnedCorners: Gl, pivot: (e) => vn(e.box), translate: ER, rotateAbout: fK, @@ -26430,13 +26461,13 @@ function Phe(e, t) { return Zfe(e.ring, t); case "oval": { if (e.rx <= 0 || e.ry <= 0) return !1; - const n = Yr(t).map((a) => mK(e, a)), r = { x: 0, y: 0 }, o = vv(r, n) ? 0 : Math.min(...n.map((a, c) => vR(r, a, n[(c + 1) % 4]))), s = Math.max(...n.map((a) => Math.hypot(a.x, a.y))), i = yK(e, e.halfWidth); + const n = Qr(t).map((a) => mK(e, a)), r = { x: 0, y: 0 }, o = vv(r, n) ? 0 : Math.min(...n.map((a, c) => vR(r, a, n[(c + 1) % 4]))), s = Math.max(...n.map((a) => Math.hypot(a.x, a.y))), i = yK(e, e.halfWidth); return o <= 1 + i && (e.filled || s >= 1 - i); } } } function mK(e, t) { - const n = e.rotation ? Bt(t, e.center, -e.rotation) : t; + const n = e.rotation ? Dt(t, e.center, -e.rotation) : t; return { x: (n.x - e.center.x) / e.rx, y: (n.y - e.center.y) / e.ry }; } const yK = (e, t) => t / Math.min(e.rx, e.ry); @@ -26462,10 +26493,10 @@ function wK(e) { const t = e.glyphQuad, n = Math.hypot(t.lowerLeft.x - t.upperLeft.x, t.lowerLeft.y - t.upperLeft.y), r = Math.max(n / 2, 1), o = e.advance > 0 ? t.lowerRight : t.lowerLeft, s = t.lowerRight.x - t.lowerLeft.x, i = t.lowerRight.y - t.lowerLeft.y, a = Math.hypot(s, i) > 0 ? zn(Math.atan2(i, s) * 180 / Math.PI) : 0; if (a < G_ || a > 360 - G_) return { kind: "caret", box: Mhe(e), rotation: 0 }; - const c = (t.upperLeft.x - t.lowerLeft.x) / n, l = (t.upperLeft.y - t.lowerLeft.y) / n, u = o.x + c * r / 2, d = o.y + l * r / 2; + const c = (t.upperLeft.x - t.lowerLeft.x) / n, l = (t.upperLeft.y - t.lowerLeft.y) / n, u = o.x + c * r / 2, f = o.y + l * r / 2; return { kind: "caret", - box: { x: u - r / 2, y: d - r / 2, width: r, height: r }, + box: { x: u - r / 2, y: f - r / 2, width: r, height: r }, rotation: a }; } @@ -26492,7 +26523,7 @@ const kK = { rect: (e) => kv(J_(e), e.rotation, vn(e.box)), selectionBounds: (e) => e.box, oriented: () => !0, - turnedCorners: ql, + turnedCorners: Gl, pivot: (e) => vn(e.box), translate: ER, rotateAbout: (e) => e, @@ -26501,7 +26532,7 @@ const kK = { handles: () => [], drag: (e) => e, // A caret paints its whole box: the mark is small. - painted: (e) => IR(ql(e)), + painted: (e) => IR(Gl(e)), scene: Bhe }, R1 = (e) => ({ shape: "poly", @@ -26591,7 +26622,7 @@ function DN(e, t, n, r) { const s = o.rotation(t); return o.points(r).map((i) => AK(i, s, e)); } -function Gl(e, t, n, r) { +function Jl(e, t, n, r) { const o = SK(n); if (!o) return []; const s = o.rotation(t), i = o.points(r).map((a) => AK(a, s, e)); @@ -26638,7 +26669,7 @@ function NR(e, t) { return r.closed ? [{ kind: "area", ring: r.points }, o] : [o]; }); } -const Lhe = Math.SQRT2, Od = 0.5, ll = (e, t) => ({ x: e.x + t.x, y: e.y + t.y }), Ud = (e, t) => ({ x: e.x - t.x, y: e.y - t.y }), No = (e, t) => ({ x: e.x * t, y: e.y * t }), ul = (e, t) => e.x * t.x + e.y * t.y, f2 = (e, t) => Math.hypot(e.x - t.x, e.y - t.y); +const Lhe = Math.SQRT2, Rd = 0.5, ul = (e, t) => ({ x: e.x + t.x, y: e.y + t.y }), Hd = (e, t) => ({ x: e.x - t.x, y: e.y - t.y }), Oo = (e, t) => ({ x: e.x * t, y: e.y * t }), dl = (e, t) => e.x * t.x + e.y * t.y, f2 = (e, t) => Math.hypot(e.x - t.x, e.y - t.y); function gC(e) { const t = Math.hypot(e.x, e.y); return t === 0 ? { x: 0, y: 0 } : { x: e.x / t, y: e.y / t }; @@ -26654,21 +26685,21 @@ function jhe(e, t, n) { const r = e[t.first], o = e[t.last]; let s = 0, i = 0, a = 0, c = 0, l = 0; n.forEach((g, p) => { - const m = 1 - g, v = m * m * m, S = 3 * g * m * m, C = 3 * g * g * m, k = g * g * g, N = No(t.leaving, S), w = No(t.arriving, C); - s += ul(N, N), i += ul(N, w), a += ul(w, w); - const y = Ud( + const m = 1 - g, v = m * m * m, S = 3 * g * m * m, C = 3 * g * g * m, k = g * g * g, N = Oo(t.leaving, S), w = Oo(t.arriving, C); + s += dl(N, N), i += dl(N, w), a += dl(w, w); + const y = Hd( e[t.first + p], - ll(ll(No(r, v), No(r, S)), ll(No(o, C), No(o, k))) + ul(ul(Oo(r, v), Oo(r, S)), ul(Oo(o, C), Oo(o, k))) ); - c += ul(N, y), l += ul(w, y); + c += dl(N, y), l += dl(w, y); }); const u = s * a - i * i; - let d = u === 0 ? 0 : (c * a - l * i) / u, f = u === 0 ? 0 : (s * l - i * c) / u; + let f = u === 0 ? 0 : (c * a - l * i) / u, d = u === 0 ? 0 : (s * l - i * c) / u; const h = f2(o, r); - return (d < 1e-6 * h || f < 1e-6 * h) && (d = h / 3, f = h / 3), [ + return (f < 1e-6 * h || d < 1e-6 * h) && (f = h / 3, d = h / 3), [ r, - ll(r, No(t.leaving, d)), - ll(o, No(t.arriving, f)), + ul(r, Oo(t.leaving, f)), + ul(o, Oo(t.arriving, d)), o ]; } @@ -26676,23 +26707,23 @@ function Fhe(e, t, n, r) { const [o, s, i, a] = r; let c = { squared: 0, index: Math.floor((t.last - t.first + 1) / 2) + t.first }; for (let l = t.first + 1; l < t.last; l++) { - const u = Ud(Rf(o, s, i, a, n[l - t.first]), e[l]), d = ul(u, u); - d >= c.squared && (c = { squared: d, index: l }); + const u = Hd(Mf(o, s, i, a, n[l - t.first]), e[l]), f = dl(u, u); + f >= c.squared && (c = { squared: f, index: l }); } return c; } function Vhe(e, t, n) { - const r = Ud(n, t), o = ul(r, r), s = o === 0 ? 0 : Math.min(1, Math.max(0, ul(Ud(e, t), r) / o)); - return f2(e, ll(t, No(r, s))); + const r = Hd(n, t), o = dl(r, r), s = o === 0 ? 0 : Math.min(1, Math.max(0, dl(Hd(e, t), r) / o)); + return f2(e, ul(t, Oo(r, s))); } function $he(e, t, n) { const [r, o, s, i] = n; let a = 0; for (let c = 0; c <= 64; c++) { - const l = Rf(r, o, s, i, c / 64); + const l = Mf(r, o, s, i, c / 64); let u = 1 / 0; - for (let d = t.first; d < t.last; d++) - u = Math.min(u, Vhe(l, e[d], e[d + 1])); + for (let f = t.first; f < t.last; f++) + u = Math.min(u, Vhe(l, e[f], e[f + 1])); a = Math.max(a, u); } return a; @@ -26709,8 +26740,8 @@ function Uhe(e, t = Lhe) { { first: 0, last: o, - leaving: gC(Ud(n[1], n[0])), - arriving: gC(Ud(n[o - 1], n[o])) + leaving: gC(Hd(n[1], n[0])), + arriving: gC(Hd(n[o - 1], n[o])) } ]; for (; s.length > 0; ) { @@ -26718,24 +26749,24 @@ function Uhe(e, t = Lhe) { if (i.last - i.first === 1) { const g = f2(c, a) / 3; r.push({ - control1: ll(a, No(i.leaving, g)), - control2: ll(c, No(i.arriving, g)), + control1: ul(a, Oo(i.leaving, g)), + control2: ul(c, Oo(i.arriving, g)), end: c }); continue; } - const l = Dhe(n, i), u = jhe(n, i, l), d = Fhe(n, i, l, u); - if (d.squared < t * t && $he(n, i, u) < t) { + const l = Dhe(n, i), u = jhe(n, i, l), f = Fhe(n, i, l, u); + if (f.squared < t * t && $he(n, i, u) < t) { r.push({ control1: u[1], control2: u[2], end: c }); continue; } - const f = d.index, h = gC(Ud(n[f - 1], n[f + 1])); + const d = f.index, h = gC(Hd(n[d - 1], n[d + 1])); s.push({ - first: f, + first: d, last: i.last, - leaving: No(h, -1), + leaving: Oo(h, -1), arriving: i.arriving - }), s.push({ first: i.first, last: f, leaving: i.leaving, arriving: h }); + }), s.push({ first: i.first, last: d, leaving: i.leaving, arriving: h }); } return { kind: "curves", start: n[0], cubics: r }; } @@ -26841,13 +26872,13 @@ function p2(e) { const [t, n] = Za(e)[0]; return { start: t, end: n }; } -const Xhe = (e) => Za(e)[0], Av = (e) => vn(Mt(h2(e).flat())), Zhe = (e) => Mt(Za(e).flat()); +const Xhe = (e) => Za(e)[0], Av = (e) => vn(Lt(h2(e).flat())), Zhe = (e) => Lt(Za(e).flat()); function EK(e, t) { return !t.x && !t.y ? e : xK(e, (n) => ({ x: n.x + t.x, y: n.y + t.y })); } const X_ = 1e-9; function CK(e, t, n) { - const r = Av(e), o = Bt(r, t, n), s = { x: o.x - r.x, y: o.y - r.y }; + const r = Av(e), o = Dt(r, t, n), s = { x: o.x - r.x, y: o.y - r.y }; return { ...Math.abs(s.x) < X_ && Math.abs(s.y) < X_ ? e : EK(e, s), rotation: zn(e.rotation + n) }; } function epe(e, t, n, r) { @@ -26878,18 +26909,18 @@ function FN(e, t, n) { if (o === 0) return []; if (o === 1 || r === 0) return [...e]; const s = t ? o : o - 1, i = [], a = []; - for (let d = 0; d < s; d++) { - const f = e[d], h = e[(d + 1) % o], g = Math.hypot(h.x - f.x, h.y - f.y) || 1, p = (h.x - f.x) / g, m = (h.y - f.y) / g; + for (let f = 0; f < s; f++) { + const d = e[f], h = e[(f + 1) % o], g = Math.hypot(h.x - d.x, h.y - d.y) || 1, p = (h.x - d.x) / g, m = (h.y - d.y) / g; i.push({ x: p, y: m }), a.push({ x: -m, y: p }); } const c = []; - for (let d = 0; d < s; d++) { - const f = e[d], h = e[(d + 1) % o], g = a[d].x * r, p = a[d].y * r; - c.push({ x: f.x + g, y: f.y + p }, { x: f.x - g, y: f.y - p }), c.push({ x: h.x + g, y: h.y + p }, { x: h.x - g, y: h.y - p }); + for (let f = 0; f < s; f++) { + const d = e[f], h = e[(f + 1) % o], g = a[f].x * r, p = a[f].y * r; + c.push({ x: d.x + g, y: d.y + p }, { x: d.x - g, y: d.y - p }), c.push({ x: h.x + g, y: h.y + p }, { x: h.x - g, y: h.y - p }); } const l = t ? 0 : 1, u = t ? o : o - 1; - for (let d = l; d < u; d++) { - const f = t ? (d - 1 + o) % o : d - 1, h = d, g = i[f], p = i[h], m = a[f], v = a[h], S = g.x - p.x, C = g.y - p.y; + for (let f = l; f < u; f++) { + const d = t ? (f - 1 + o) % o : f - 1, h = f, g = i[d], p = i[h], m = a[d], v = a[h], S = g.x - p.x, C = g.y - p.y; if (Math.hypot(S, C) < 1e-9) continue; let k = m.x + v.x, N = m.y + v.y; const w = Math.hypot(k, N); @@ -26899,7 +26930,7 @@ function FN(e, t, n) { if (y < 1e-9) continue; const x = r / y; if (x > g2 * r) continue; - const A = e[d]; + const A = e[f]; c.push({ x: A.x + k * x, y: A.y + N * x }); } return c; @@ -26913,7 +26944,7 @@ function PR(e, t) { return FN(n.points, n.closed, t); case "ellipse": case "rect": - return Yr(Hf(n.rect, t / 2)); + return Qr(Wf(n.rect, t / 2)); case "path": return []; } @@ -26940,22 +26971,22 @@ function eL(e, t) { function ope(e, t) { const n = t / 2; if (e.kind === "dot") { - const { x: l, y: u } = e.center, d = Od + n; + const { x: l, y: u } = e.center, f = Rd + n; return [ - { x: l - d, y: u - d }, - { x: l + d, y: u + d } + { x: l - f, y: u - f }, + { x: l + f, y: u + f } ]; } const r = [e.start], o = [], s = []; let i = e.start; - for (const { control1: l, control2: u, end: d } of e.cubics) { - r.push(d); - for (const g of RS(i.x, l.x, u.x, d.x)) - o.push({ at: Rf(i, l, u, d, g), acrossX: !0 }); - for (const g of RS(i.y, l.y, u.y, d.y)) - o.push({ at: Rf(i, l, u, d, g), acrossX: !1 }); - const f = eL(i, [l, u, d]), h = eL(d, [u, l, i]); - f && h && s.push({ from: i, to: d, leaving: f, arriving: { x: -h.x, y: -h.y } }), i = d; + for (const { control1: l, control2: u, end: f } of e.cubics) { + r.push(f); + for (const g of RS(i.x, l.x, u.x, f.x)) + o.push({ at: Mf(i, l, u, f, g), acrossX: !0 }); + for (const g of RS(i.y, l.y, u.y, f.y)) + o.push({ at: Mf(i, l, u, f, g), acrossX: !1 }); + const d = eL(i, [l, u, f]), h = eL(f, [u, l, i]); + d && h && s.push({ from: i, to: f, leaving: d, arriving: { x: -h.x, y: -h.y } }), i = f; } if (r.push(...o.map(({ at: l }) => l)), n <= 0 || s.length === 0) return r; const a = (l, u) => [ @@ -26970,7 +27001,7 @@ function ope(e, t) { for (const l of s) r.push(...a(l.from, l.leaving), ...a(l.to, l.arriving)); for (let l = 0; l + 1 < s.length; l++) { - const { to: u, arriving: d } = s[l], { leaving: f } = s[l + 1], h = Math.hypot(d.x + f.x, d.y + f.y), g = { x: d.x - f.x, y: d.y - f.y }, p = Math.hypot(g.x, g.y); + const { to: u, arriving: f } = s[l], { leaving: d } = s[l + 1], h = Math.hypot(f.x + d.x, f.y + d.y), g = { x: f.x - d.x, y: f.y - d.y }, p = Math.hypot(g.x, g.y); if (h < 1e-9 || p < 1e-9 || 2 / h > g2) continue; const m = n * (2 / h) / p; r.push({ x: u.x + g.x * m, y: u.y + g.y * m }); @@ -27007,52 +27038,52 @@ function eA(e, t) { const { strokeWidth: n, cloudyIntensity: r } = t, o = Za(e); if (e.kind === "ink") { const { fitted: c, drawing: l } = TR(e, o); - return Mt([ + return Lt([ ...o.flat(), ...RR(c).flatMap((u) => ope(u, n)), - ...l ? Yr(Hf(Mt(l), n / 2)) : [] + ...l ? Qr(Wf(Lt(l), n / 2)) : [] ]); } const s = o[0], i = e.kind === "poly" && e.closed; if (i && r) return mhe(s, r, n); const a = BR(e).flatMap( - (c) => Gl(c.tip, c.angle, c.ending, MR(n)) + (c) => Jl(c.tip, c.angle, c.ending, MR(n)) ); - return Mt([ + return Lt([ ...FN(s, i, n), ...PR(a, n) ]); } function spe(e, t) { - const n = { ...e, rotation: 0 }, r = Yr(eA(n, t)); + const n = { ...e, rotation: 0 }, r = Qr(eA(n, t)); if (!e.rotation) return r; const o = Av(e); - return r.map((s) => Bt(s, o, e.rotation)); + return r.map((s) => Dt(s, o, e.rotation)); } function ipe(e, t, n) { const { strokeWidth: r, cloudyIntensity: o } = t, s = r / 2, i = Za(e); if (e.kind === "ink") { - const { fitted: u, drawing: d } = TR(e, i), f = RR(u).map( + const { fitted: u, drawing: f } = TR(e, i), d = RR(u).map( (h) => h.kind === "dot" ? { kind: "oval", center: h.center, - rx: Od, - ry: Od, + rx: Rd, + ry: Rd, rotation: 0, halfWidth: s, filled: !0 } : { kind: "stroke", points: zhe(h), closed: !1, halfWidth: s } ); - return d && f.push({ kind: "stroke", points: d, closed: !1, halfWidth: s }), f; + return f && d.push({ kind: "stroke", points: f, closed: !1, halfWidth: s }), d; } const a = e.kind === "poly" && e.closed, c = i[0], l = []; if (c && a && o && c.length >= 3) { const u = yhe(c, o, r); if (n) { l.push({ kind: "area", ring: c }); - for (const d of u) l.push({ kind: "area", ring: d }); + for (const f of u) l.push({ kind: "area", ring: f }); } - for (const d of u) l.push({ kind: "stroke", points: d, closed: !0, halfWidth: s }); + for (const f of u) l.push({ kind: "stroke", points: f, closed: !0, halfWidth: s }); return l; } c && n && a && l.push({ kind: "area", ring: c }); @@ -27060,7 +27091,7 @@ function ipe(e, t, n) { for (const u of BR(e)) l.push( ...NR( - Gl(u.tip, u.angle, u.ending, MR(r)), + Jl(u.tip, u.angle, u.ending, MR(r)), r ) ); @@ -27073,10 +27104,10 @@ function ape(e, t) { (u) => u.kind === "dot" ? { kind: "ellipse", rect: { - x: u.center.x - Od, - y: u.center.y - Od, - width: 2 * Od, - height: 2 * Od + x: u.center.x - Rd, + y: u.center.y - Rd, + width: 2 * Rd, + height: 2 * Rd } } : { kind: "path", d: Khe(u) } ); @@ -27087,10 +27118,10 @@ function ape(e, t) { return [{ kind: "path", d: phe(s, r, n) }]; const i = e.kind === "line" ? [{ kind: "line", a: s[0], b: s[1] }] : [{ kind: "poly", points: s, closed: e.closed }]; for (const a of BR(e)) - i.push(...Gl(a.tip, a.angle, a.ending, MR(n))); + i.push(...Jl(a.tip, a.angle, a.ending, MR(n))); return i; } -const Kd = { +const zd = { read: Whe, write: Jhe, placed: Ghe, @@ -27113,7 +27144,7 @@ const Kd = { function cpe(e) { return { kind: "quads", quadPoints: e.quadPoints }; } -const VN = (e) => Mt(e.quadPoints.flatMap(i9)), tL = (e, { strokeWidth: t }) => Hf(VN(e), t / 2); +const VN = (e) => Lt(e.quadPoints.flatMap(i9)), tL = (e, { strokeWidth: t }) => Wf(VN(e), t / 2); function lpe(e) { const t = e.quadPoints.flatMap(i9), n = t.length || 1; return { @@ -27131,7 +27162,7 @@ function dpe(e, t) { const n = (r) => ({ x: r.x + t.x, y: r.y + t.y }); return { ...e, quadPoints: e.quadPoints.map((r) => upe(r, n)) }; } -const fpe = (e) => e.quadPoints.map((t) => ({ kind: "poly", points: o2(t), closed: !0 })), Um = { +const fpe = (e) => e.quadPoints.map((t) => ({ kind: "poly", points: o2(t), closed: !0 })), Km = { read: cpe, write: (e) => ({ quadPoints: e.quadPoints }), // Quads are made from a text selection, never placed. @@ -27180,8 +27211,8 @@ function gpe(e) { }; } function nL(e, t, n = 0) { - const r = vn(e), o = n ? Bt(t, r, -n) : t, s = o.x - r.x, i = o.y - r.y, a = Math.abs(s) >= Math.abs(i) ? { x: s >= 0 ? e.x + e.width : e.x, y: r.y } : { x: r.x, y: i >= 0 ? e.y + e.height : e.y }; - return n ? Bt(a, r, n) : a; + const r = vn(e), o = n ? Dt(t, r, -n) : t, s = o.x - r.x, i = o.y - r.y, a = Math.abs(s) >= Math.abs(i) ? { x: s >= 0 ? e.x + e.width : e.x, y: r.y } : { x: r.x, y: i >= 0 ? e.y + e.height : e.y }; + return n ? Dt(a, r, n) : a; } const IK = (e, t, n) => n ? [t, n, nL(e.box, n, e.rotation)] : [t, nL(e.box, t, e.rotation)]; function NK(e, t, n, r, o) { @@ -27222,8 +27253,8 @@ const m2 = (e) => Math.atan2(e[0].y - e[1].y, e[0].x - e[1].x); function Ape(e, { strokeWidth: t }) { const n = e.calloutLine; if (!n) return e.box; - const r = [...ql(e), ...n]; - return e.lineEnding && r.push(...DN(n[0], m2(n), e.lineEnding, t)), Hf(Mt(r), t / 2); + const r = [...Gl(e), ...n]; + return e.lineEnding && r.push(...DN(n[0], m2(n), e.lineEnding, t)), Wf(Lt(r), t / 2); } function OK(e, { strokeWidth: t }) { const n = kv(e.box, e.rotation), r = e.calloutLine; @@ -27233,18 +27264,18 @@ function OK(e, { strokeWidth: t }) { ...r.slice(0, -1), { x: o.x + (o.x - s.x) * a, y: o.y + (o.y - s.y) * a } ], closed: !1 }, - ...Gl(r[0], m2(r), e.lineEnding ?? void 0, t) + ...Jl(r[0], m2(r), e.lineEnding ?? void 0, t) ]; - return Mt([...Yr(n), ...PR(l, t)]); + return Lt([...Qr(n), ...PR(l, t)]); } function Spe(e, t) { return e.calloutLine ? OK(e, t) : e.box; } function xpe(e, { strokeWidth: t }) { - const n = IR(ql(e)), r = e.calloutLine; + const n = IR(Gl(e)), r = e.calloutLine; if (!r) return n; n.push({ kind: "stroke", points: r, closed: !1, halfWidth: t / 2 }); - const o = Gl(r[0], m2(r), e.lineEnding ?? void 0, t); + const o = Jl(r[0], m2(r), e.lineEnding ?? void 0, t); return [...n, ...NR(o, t)]; } function Epe(e, { strokeWidth: t }) { @@ -27254,7 +27285,7 @@ function Epe(e, { strokeWidth: t }) { t > 0 && l > 0 && (i[i.length - 1] = { x: a.x + (a.x - c.x) / l * (t / 2), y: a.y + (a.y - c.y) / l * (t / 2) - }), n.push({ kind: "poly", points: i, closed: !1 }), e.lineEnding && n.push(...Gl(r[0], m2(r), e.lineEnding, t)); + }), n.push({ kind: "poly", points: i, closed: !1 }), e.lineEnding && n.push(...Jl(r[0], m2(r), e.lineEnding, t)); } const o = kR(e.box, t / 2); if (!r || !e.rotation) @@ -27262,7 +27293,7 @@ function Epe(e, { strokeWidth: t }) { const s = vn(e.box); return n.push({ kind: "poly", - points: Yr(o).map((i) => Bt(i, s, e.rotation)), + points: Qr(o).map((i) => Dt(i, s, e.rotation)), closed: !0 }), n; } @@ -27275,7 +27306,7 @@ const _R = { rect: OK, selectionBounds: Spe, oriented: (e) => !e.calloutLine, - turnedCorners: (e) => e.calloutLine ? null : ql(e), + turnedCorners: (e) => e.calloutLine ? null : Gl(e), pivot: (e) => vn(e.box), translate: mpe, rotateAbout: ype, @@ -27295,10 +27326,10 @@ const Ipe = { box: vr, caret: kK, "text-box": _R, - quads: Um, - line: Kd, - poly: Kd, - ink: Kd + quads: Km, + line: zd, + poly: zd, + ink: zd }, kt = (e) => Ipe[e.kind]; function Npe(e) { return { @@ -27316,7 +27347,7 @@ function Npe(e) { rotateAbout: (t, n, r) => kt(t).rotateAbout(t, n, r), scaleAbout: (t, n, r, o, s) => kt(t).scaleAbout(t, n, r, o, s), upright: (t, n) => kt(t).upright(t, n), - handleLayout: (t, n, r) => kt(t).handleLayout?.(t, n, r) ?? dm, + handleLayout: (t, n, r) => kt(t).handleLayout?.(t, n, r) ?? fm, handles: (t, n) => kt(t).handles(t, n), drag: (t, n, r) => kt(t).drag(t, n, r), painted: (t, n, r) => kt(t).painted(t, n, r), @@ -27346,7 +27377,7 @@ const Gn = { ignoresReadOnly: !1, noZoom: !1, noRotate: !1 -}, tn = (e) => e, Ci = { +}, rn = (e) => e, Ci = { key: "opacity", control: "number", label: "Opacity", @@ -27504,7 +27535,7 @@ const Gn = { { value: "center", label: "Center", labelKey: "annotation.alignments.center" }, { value: "right", label: "Right", labelKey: "annotation.alignments.right" } ] -}, ru = { +}, ou = { key: "link", control: "link", label: "Link", @@ -27515,7 +27546,7 @@ const Gn = { Ci, DR, Ppe, - ru + ou ], _K = [ PK, LR, @@ -27523,8 +27554,8 @@ const Gn = { DR, MK, Tpe, - ru -], y2 = [Sv, Ci, BK, ru], _pe = [ + ou +], y2 = [Sv, Ci, BK, ou], _pe = [ { key: "print", control: "flag", label: "Print", labelKey: "annotation.flags.print" }, { key: "hidden", control: "flag", label: "Hidden", labelKey: "annotation.flags.hidden" }, { key: "noView", control: "flag", label: "No view", labelKey: "annotation.flags.noView" }, @@ -27574,7 +27605,7 @@ function jpe(e) { }; } const b2 = { borderStyle: "solid", dashArray: null, cloudyIntensity: null }; -function ou(e) { +function su(e) { const t = e; return { color: t.color, @@ -27609,7 +27640,7 @@ function $pe(e) { ...b2 }; } -function zf(e) { +function qf(e) { const t = e; return { color: t.color ?? "#1a1a1a", @@ -27633,23 +27664,23 @@ function DK(e) { ...b2 }; } -function Pd(e) { +function Td(e) { return e.blendMode === "normal" ? void 0 : e.blendMode; } function jK(e) { if (!(e.cloudyIntensity || e.borderStyle !== "dashed")) return e.dashArray?.length ? e.dashArray : [3, 3]; } -const rL = tn({ +const rL = rn({ name: "caret", family: kK, style: Fpe, caps: { ...Gn, selectable: !0, anchored: !0, commentable: !0 }, properties: [Sv, Ci] -}), oL = tn({ +}), oL = rn({ name: "circle", family: vr, - style: ou, + style: su, caps: { ...Gn, selectable: !0, @@ -27669,7 +27700,7 @@ const rL = tn({ { value: "paperclip", label: "Paperclip", labelKey: "annotation.attachmentIcons.paperclip" }, { value: "graph", label: "Graph", labelKey: "annotation.attachmentIcons.graph" }, { value: "tag", label: "Tag", labelKey: "annotation.attachmentIcons.tag" } -], sL = tn({ +], sL = rn({ name: "file-attachment", family: vr, style: LK, @@ -27795,31 +27826,31 @@ const VK = { max: 12, step: 0.5 }, - ru -], iL = tn({ + ou +], iL = rn({ name: "free-text", family: _R, - style: ou, + style: su, text: FK, caps: VK, properties: $K -}), aL = tn({ +}), aL = rn({ name: "free-text-callout", family: _R, - style: ou, + style: su, text: FK, caps: { ...VK, rotatable: !1, groupResizable: !1, groupRotatable: !1 }, properties: $K -}), cL = tn({ +}), cL = rn({ name: "highlight", - family: Um, + family: Km, style: v2, caps: { ...Gn, paintsBeneath: !0, selectable: !0, anchored: !0, commentable: !0 }, properties: y2 -}), lL = tn({ +}), lL = rn({ name: "ink", - family: Kd, - style: ou, + family: zd, + style: su, caps: { ...Gn, selectable: !0, @@ -27830,11 +27861,11 @@ const VK = { groupRotatable: !0, commentable: !0 }, - properties: [Sv, Ci, DR, BK, ru] -}), uL = tn({ + properties: [Sv, Ci, DR, BK, ou] +}), uL = rn({ name: "line", - family: Kd, - style: ou, + family: zd, + style: su, caps: { ...Gn, selectable: !0, @@ -27848,7 +27879,7 @@ const VK = { hasEndings: !0 }, properties: _K -}), dL = tn({ +}), dL = rn({ name: "link", family: vr, style: DK, @@ -27861,11 +27892,11 @@ const VK = { opaqueBody: !0, rasterOnly: !0 }, - properties: [ru] -}), fL = tn({ + properties: [ou] +}), fL = rn({ name: "polygon", - family: Kd, - style: ou, + family: zd, + style: su, caps: { ...Gn, selectable: !0, @@ -27880,10 +27911,10 @@ const VK = { hasCloudy: !0 }, properties: VR -}), hL = tn({ +}), hL = rn({ name: "polyline", - family: Kd, - style: ou, + family: zd, + style: su, caps: { ...Gn, selectable: !0, @@ -27898,8 +27929,8 @@ const VK = { }, properties: _K }), Hpe = Npe( - (e) => e.subtype === "redact" && e.quadPoints.length > 0 ? Um : vr -), pL = tn({ + (e) => e.subtype === "redact" && e.quadPoints.length > 0 ? Km : vr +), pL = rn({ name: "redact", family: Hpe, style: Vpe, @@ -27937,10 +27968,10 @@ const VK = { }, FR ] -}), gL = tn({ +}), gL = rn({ name: "square", family: vr, - style: ou, + style: su, caps: { ...Gn, selectable: !0, @@ -27955,13 +27986,13 @@ const VK = { hasCloudy: !0 }, properties: VR -}), mL = tn({ +}), mL = rn({ name: "squiggly", - family: Um, + family: Km, style: v2, caps: { ...Gn, paintsBeneath: !0, selectable: !0, anchored: !0, commentable: !0 }, properties: y2 -}), yL = tn({ +}), yL = rn({ name: "stamp", family: vr, style: $pe, @@ -27978,10 +28009,10 @@ const VK = { opaqueBody: !0, rasterOnly: !0 }, - properties: [Ci, ru] -}), bL = tn({ + properties: [Ci, ou] +}), bL = rn({ name: "strikeout", - family: Um, + family: Km, style: v2, caps: { ...Gn, paintsBeneath: !0, selectable: !0, anchored: !0, commentable: !0 }, properties: y2 @@ -27997,7 +28028,7 @@ const VK = { }, { value: "paragraph", label: "Paragraph", labelKey: "annotation.noteIcons.paragraph" }, { value: "insert", label: "Insert", labelKey: "annotation.noteIcons.insert" } -], wL = tn({ +], wL = rn({ name: "text", family: vr, style: LK, @@ -28022,15 +28053,15 @@ const VK = { }, Sv, Ci, - ru + ou ] -}), vL = tn({ +}), vL = rn({ name: "underline", - family: Um, + family: Km, style: v2, caps: { ...Gn, paintsBeneath: !0, selectable: !0, anchored: !0, commentable: !0 }, properties: y2 -}), Wf = { +}), Gf = { ...Gn, selectable: !0, movable: !0, @@ -28085,50 +28116,50 @@ const VK = { labelKey: "annotation.style.textColor" }, { ...FR, label: "Alignment", labelKey: "annotation.style.alignment" } -], TS = tn({ +], TS = rn({ name: "widget-text", family: vr, - style: zf, + style: qf, text: $R, - caps: Wf, + caps: Gf, properties: UR -}), D0 = tn({ +}), D0 = rn({ name: "widget-choice", family: vr, - style: zf, + style: qf, text: $R, - caps: Wf, + caps: Gf, properties: UR -}), MS = tn({ +}), MS = rn({ name: "widget-button", family: vr, - style: zf, + style: qf, text: $R, - caps: Wf, + caps: Gf, properties: UR -}), BS = tn({ +}), BS = rn({ name: "widget-toggle", family: vr, - style: zf, - caps: Wf, + style: qf, + caps: Gf, properties: k2 -}), _S = tn({ +}), _S = rn({ name: "widget-radio", family: vr, - style: zf, - caps: Wf, + style: qf, + caps: Gf, properties: k2 -}), LS = tn({ +}), LS = rn({ name: "widget-box", family: vr, - style: zf, - caps: Wf, + style: qf, + caps: Gf, properties: k2 -}), $N = tn({ +}), $N = rn({ name: "widget-mark", family: vr, - style: zf, - caps: Wf, + style: qf, + caps: Gf, properties: [] }), Wpe = { text: TS.name, @@ -28183,7 +28214,7 @@ function nA(e) { properties: [] }, kL.set(e, n)), n; } -function Wt(e) { +function Jt(e) { switch (e.subtype) { case "widget": return nA(qpe(e)); @@ -28195,19 +28226,19 @@ function Wt(e) { return nA(e.subtype); } } -const Sn = (e) => e?.annotation.ref ?? null, Tf = (e) => e.reply?.type === "group" ? oe(e.reply.to) : void 0, Qpe = { ...UF, print: !0 }, Xpe = Object.keys(UF), Zpe = (e) => e.invisible && e.subtype === "unsupported" && e.rawSubtypeCode === JX.UNKNOWN && e.rawSubtypeName !== "Projection", KR = (e, t = !1) => !e.hidden && !Zpe(e) && (!e.noView || e.toggleNoView && t), ege = (e) => !e.hidden && !e.noView && !e.readOnly, A2 = (e) => Wt(e.annotation).caps.ignoresReadOnly ? !e.annotation.hidden && !e.annotation.noView : ege(e.annotation), S2 = (e) => A2(e) && !e.annotation.locked && (e.authority?.update ?? !0), UK = (e) => A2(e) && !e.annotation.locked && (e.authority?.delete ?? !0), x2 = (e) => A2(e) && !e.annotation.lockedContents && (e.authority?.update ?? !0), tge = /* @__PURE__ */ new Set(["contents", "richText"]); +const Sn = (e) => e?.annotation.ref ?? null, Bf = (e) => e.reply?.type === "group" ? oe(e.reply.to) : void 0, Qpe = { ...UF, print: !0 }, Xpe = Object.keys(UF), Zpe = (e) => e.invisible && e.subtype === "unsupported" && e.rawSubtypeCode === JX.UNKNOWN && e.rawSubtypeName !== "Projection", KR = (e, t = !1) => !e.hidden && !Zpe(e) && (!e.noView || e.toggleNoView && t), ege = (e) => !e.hidden && !e.noView && !e.readOnly, A2 = (e) => Jt(e.annotation).caps.ignoresReadOnly ? !e.annotation.hidden && !e.annotation.noView : ege(e.annotation), S2 = (e) => A2(e) && !e.annotation.locked && (e.authority?.update ?? !0), UK = (e) => A2(e) && !e.annotation.locked && (e.authority?.delete ?? !0), x2 = (e) => A2(e) && !e.annotation.lockedContents && (e.authority?.update ?? !0), tge = /* @__PURE__ */ new Set(["contents", "richText"]); function KK(e, t) { return Xpe.includes(t) ? e.authority?.update ?? !0 : tge.has(t) ? x2(e) : S2(e); } function nge(e) { const { intent: t } = e; - return sm(e) ? t : e.subtype; + return im(e) ? t : e.subtype; } -function su(e, t) { +function iu(e, t) { const { editable: n } = e; return typeof n == "boolean" ? n : n.includes(nge(t)); } -const Ii = (e, t) => S2(t) && su(e, t.annotation), rge = (e, t) => UK(t) && su(e, t.annotation), HK = (e, t) => x2(t) && su(e, t.annotation), AL = (e) => typeof e == "string" && e !== ""; +const Ii = (e, t) => S2(t) && iu(e, t.annotation), rge = (e, t) => UK(t) && iu(e, t.annotation), HK = (e, t) => x2(t) && iu(e, t.annotation), AL = (e) => typeof e == "string" && e !== ""; function oge(e) { const t = e.annotation; return t.reply && t.reply.type !== "group" || t.subtype === "text" && (AL(t.state) || AL(t.stateModel)) ? !0 : t.subtype === "popup"; @@ -28237,8 +28268,8 @@ function cge(e, t, n, r) { } const SL = (e, t, n) => Math.max(t, Math.min(n, e)); function WR(e, t, n, r) { - const o = o9(zn(r) ?? 0), s = o ? t.height : t.width, i = o ? t.width : t.height, a = Math.min(1, s > 0 ? n.width / s : 1, i > 0 ? n.height / i : 1), c = t.width * a, l = t.height * a, u = o ? l : c, d = o ? c : l, f = SL(e.x, u / 2, n.width - u / 2), h = SL(e.y, d / 2, n.height - d / 2); - return { x: f - c / 2, y: h - l / 2, width: c, height: l }; + const o = o9(zn(r) ?? 0), s = o ? t.height : t.width, i = o ? t.width : t.height, a = Math.min(1, s > 0 ? n.width / s : 1, i > 0 ? n.height / i : 1), c = t.width * a, l = t.height * a, u = o ? l : c, f = o ? c : l, d = SL(e.x, u / 2, n.width - u / 2), h = SL(e.y, f / 2, n.height - f / 2); + return { x: d - c / 2, y: h - l / 2, width: c, height: l }; } function lge(e, t) { return Dr(e) ? kt(e).upright(e, t) : e; @@ -28247,7 +28278,7 @@ function uge(e, t) { const n = kt(e).turnedCorners(e, t); return n ? { corners: n, angle: Dr(e) } : null; } -function UN(e, t = dm) { +function UN(e, t = fm) { const n = bR(e, t.spread); return Y9(t).map((r) => ({ id: r, @@ -28294,8 +28325,8 @@ function hge(e, t, n) { if (a < c || a > l) return null; continue; } - const u = (c - a) / i, d = (l - a) / i; - o = Math.max(o, Math.min(u, d)), s = Math.min(s, Math.max(u, d)); + const u = (c - a) / i, f = (l - a) / i; + o = Math.max(o, Math.min(u, f)), s = Math.min(s, Math.max(u, f)); } return o >= s || !Number.isFinite(o) || !Number.isFinite(s) ? null : { a: { x: t.x + r.x * o, y: t.y + r.y * o }, @@ -28318,9 +28349,9 @@ function DS(e, t, n) { }; } const $y = (e, t) => kt(e).drawnBounds(e, t), pge = (e, t) => kt(e).selectionBounds(e, t); -function Km(e, t) { +function Hm(e, t) { const n = uge(e, t); - return n ? n.corners : Yr(pge(e, t)); + return n ? n.corners : Qr(pge(e, t)); } const gge = (e, t) => vv(e, t), qK = (e) => kt(e).bounds(e), EL = /* @__PURE__ */ new WeakMap(); function mge(e, t, n) { @@ -28333,13 +28364,13 @@ function mge(e, t, n) { const s = kt(e).painted(e, r, n); return EL.set(e, { stroke: r, filled: n, pieces: s }), s; } -const GK = (e, t, n) => (t ? kt(e).handleLayout?.(e, t, n) : void 0) ?? dm, jS = (e, t) => kt(e).handles(e, t), N2 = (e, t) => kt(e).translate(e, t), yge = (e, t, n) => kt(e).drag(e, t, n), CL = (e, t) => kt(e).scene(e, t); +const GK = (e, t, n) => (t ? kt(e).handleLayout?.(e, t, n) : void 0) ?? fm, jS = (e, t) => kt(e).handles(e, t), N2 = (e, t) => kt(e).translate(e, t), yge = (e, t, n) => kt(e).drag(e, t, n), CL = (e, t) => kt(e).scene(e, t); function bge(e, t) { const n = e.annotation.subtype, r = t.subtype; return typeof r != "string" || r === n ? n : KK(e, "subtype") && lV(e.annotation, r) ? r : n; } -function Mf(e, t) { - const n = bge(e, t), r = Pm[n], o = n === e.annotation.subtype ? {} : { subtype: n }; +function _f(e, t) { + const n = bge(e, t), r = Rm[n], o = n === e.annotation.subtype ? {} : { subtype: n }; for (const [a, c] of Object.entries(t)) c === void 0 || a === "subtype" || !r.includes(a) || KK(e, a) && (o[a] = c); if (!Object.keys(o).length) return e; @@ -28350,31 +28381,31 @@ function Mf(e, t) { return Object.keys(E0(e.annotation, i)).length ? { ...e, annotation: i } : e; } const IL = /* @__PURE__ */ new WeakMap(); -function Vt(e) { +function Ht(e) { let t = IL.get(e); - return t || (t = Wt(e).family.read(e), IL.set(e, t)), t; + return t || (t = Jt(e).family.read(e), IL.set(e, t)), t; } -const dl = (e, t) => Mf(e, kt(t).write(t, e.annotation.subtype)); +const fl = (e, t) => _f(e, kt(t).write(t, e.annotation.subtype)); function MDe(e, t) { - if (!Wt(e).caps.quarterTurns) return {}; - const n = Vt(e); + if (!Jt(e).caps.quarterTurns) return {}; + const n = Ht(e); if (n.kind !== "box") return {}; - const r = fm(n.box, n.rotation); - return { box: fm(r, t), rotation: t || null }; + const r = hm(n.box, n.rotation); + return { box: hm(r, t), rotation: t || null }; } const NL = /* @__PURE__ */ new WeakMap(); function Wn(e) { let t = NL.get(e); - return t || (t = Wt(e).style(e), NL.set(e, t)), t; + return t || (t = Jt(e).style(e), NL.set(e, t)), t; } const mC = /* @__PURE__ */ new WeakMap(); -function qf(e) { +function Jf(e) { if (mC.has(e)) return mC.get(e); - const t = Wt(e).text?.(e); + const t = Jt(e).text?.(e); return mC.set(e, t), t; } function wge(e, t) { - return e.kind === "quads" ? e.quadPoints.map(fR) : e.kind === "text-box" ? [kv(e.box, e.rotation)] : [Mt(Km(e, t))]; + return e.kind === "quads" ? e.quadPoints.map(fR) : e.kind === "text-box" ? [kv(e.box, e.rotation)] : [Lt(Hm(e, t))]; } function qR(e) { return e && (e.kind === "goto" || e.kind === "uri") ? e : null; @@ -28409,16 +28440,16 @@ function vge() { r[W] = 1 << Se + 1, o[r[W]] = W; }), Object.freeze(r); var s = r.LRI | r.RLI | r.FSI, i = r.L | r.R | r.AL, a = r.B | r.S | r.WS | r.ON | r.FSI | r.LRI | r.RLI | r.PDI, c = r.BN | r.RLE | r.LRE | r.RLO | r.LRO | r.PDF, l = r.S | r.WS | r.B | s | r.PDI | c, u = null; - function d() { + function f() { if (!u) { u = /* @__PURE__ */ new Map(); var W = 0; for (var Se in n) if (n.hasOwnProperty(Se)) - for (var Ae = n[Se], ce = "", Ne = void 0, K = !1, U = 0, Z = 0; Z <= Ae.length + 1; Z += 1) { - var ne = Ae[Z]; - if (ne !== "," && Z !== Ae.length) - ne === "+" ? (K = !0, U = W = U + parseInt(ce, 36), ce = "") : ce += ne; + for (var Ae = n[Se], ce = "", Ne = void 0, K = !1, U = 0, X = 0; X <= Ae.length + 1; X += 1) { + var re = Ae[X]; + if (re !== "," && X !== Ae.length) + re === "+" ? (K = !0, U = W = U + parseInt(ce, 36), ce = "") : ce += re; else { K ? Ne = W + parseInt(ce, 36) : (U = W = U + parseInt(ce, 36), Ne = W), K = !1, ce = "", U = Ne; for (var xe = W; xe < Ne + 1; xe += 1) @@ -28427,11 +28458,11 @@ function vge() { } } } - function f(W) { - return d(), u.get(W.codePointAt(0)) || r.L; + function d(W) { + return f(), u.get(W.codePointAt(0)) || r.L; } function h(W) { - return o[f(W)]; + return o[d(W)]; } var g = { pairs: "14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1", @@ -28439,14 +28470,14 @@ function vge() { }; function p(W, Se) { var Ae = 36, ce = 0, Ne = /* @__PURE__ */ new Map(), K = Se && /* @__PURE__ */ new Map(), U; - return W.split(",").forEach(function Z(ne) { - if (ne.indexOf("+") !== -1) - for (var xe = +ne; xe--; ) - Z(U); + return W.split(",").forEach(function X(re) { + if (re.indexOf("+") !== -1) + for (var xe = +re; xe--; ) + X(U); else { - U = ne; - var _e = ne.split(">"), Ie = _e[0], Le = _e[1]; - Ie = String.fromCodePoint(ce += parseInt(Ie, Ae)), Le = String.fromCodePoint(ce += parseInt(Le, Ae)), Ne.set(Ie, Le), Se && K.set(Le, Ie); + U = re; + var Le = re.split(">"), Ie = Le[0], De = Le[1]; + Ie = String.fromCodePoint(ce += parseInt(Ie, Ae)), De = String.fromCodePoint(ce += parseInt(De, Ae)), Ne.set(Ie, De), Se && K.set(De, Ie); } }), { map: Ne, reverseMap: K }; } @@ -28466,83 +28497,83 @@ function vge() { function w(W) { return C(), S.get(W) || null; } - var y = r.L, x = r.R, A = r.EN, b = r.ES, E = r.ET, I = r.AN, O = r.CS, T = r.B, R = r.S, M = r.ON, F = r.BN, B = r.NSM, $ = r.AL, D = r.LRO, _ = r.RLO, L = r.LRE, j = r.RLE, H = r.PDF, Y = r.LRI, ue = r.RLI, le = r.FSI, pe = r.PDI; - function ge(W, Se) { + var y = r.L, x = r.R, A = r.EN, b = r.ES, E = r.ET, I = r.AN, O = r.CS, T = r.B, R = r.S, M = r.ON, F = r.BN, _ = r.NSM, $ = r.AL, D = r.LRO, B = r.RLO, L = r.LRE, j = r.RLE, H = r.PDF, Y = r.LRI, le = r.RLI, ie = r.FSI, pe = r.PDI; + function ve(W, Se) { for (var Ae = 125, ce = new Uint32Array(W.length), Ne = 0; Ne < W.length; Ne++) - ce[Ne] = f(W[Ne]); + ce[Ne] = d(W[Ne]); var K = /* @__PURE__ */ new Map(); - function U(Fr, Qo) { - var Vr = ce[Fr]; - ce[Fr] = Qo, K.set(Vr, K.get(Vr) - 1), Vr & a && K.set(a, K.get(a) - 1), K.set(Qo, (K.get(Qo) || 0) + 1), Qo & a && K.set(a, (K.get(a) || 0) + 1); + function U(Vr, Qo) { + var $r = ce[Vr]; + ce[Vr] = Qo, K.set($r, K.get($r) - 1), $r & a && K.set(a, K.get(a) - 1), K.set(Qo, (K.get(Qo) || 0) + 1), Qo & a && K.set(a, (K.get(a) || 0) + 1); } - for (var Z = new Uint8Array(W.length), ne = /* @__PURE__ */ new Map(), xe = [], _e = null, Ie = 0; Ie < W.length; Ie++) - _e || xe.push(_e = { + for (var X = new Uint8Array(W.length), re = /* @__PURE__ */ new Map(), xe = [], Le = null, Ie = 0; Ie < W.length; Ie++) + Le || xe.push(Le = { start: Ie, end: W.length - 1, // 3.3.1 P2-P3: Determine the paragraph level level: Se === "rtl" ? 1 : Se === "ltr" ? 0 : R3(Ie, !1) - }), ce[Ie] & T && (_e.end = Ie, _e = null); - for (var Le = j | L | _ | D | s | pe | H | T, X = function(Fr) { - return Fr + (Fr & 1 ? 1 : 2); - }, ie = function(Fr) { - return Fr + (Fr & 1 ? 2 : 1); - }, Fe = 0; Fe < xe.length; Fe++) { - _e = xe[Fe]; - var He = [{ - _level: _e.level, + }), ce[Ie] & T && (Le.end = Ie, Le = null); + for (var De = j | L | B | D | s | pe | H | T, qe = function(Vr) { + return Vr + (Vr & 1 ? 1 : 2); + }, Me = function(Vr) { + return Vr + (Vr & 1 ? 2 : 1); + }, It = 0; It < xe.length; It++) { + Le = xe[It]; + var rt = [{ + _level: Le.level, _override: 0, //0=neutral, 1=L, 2=R _isolate: 0 //bool - }], ut = void 0, $e = 0, gt = 0, qt = 0; + }], Z = void 0, fe = 0, Fe = 0, ht = 0; K.clear(); - for (var $t = _e.start; $t <= _e.end; $t++) { - var nn = ce[$t]; - if (ut = He[He.length - 1], K.set(nn, (K.get(nn) || 0) + 1), nn & a && K.set(a, (K.get(a) || 0) + 1), nn & Le) - if (nn & (j | L)) { - Z[$t] = ut._level; - var pn = (nn === j ? ie : X)(ut._level); - pn <= Ae && !$e && !gt ? He.push({ - _level: pn, + for (var At = Le.start; At <= Le.end; At++) { + var Nt = ce[At]; + if (Z = rt[rt.length - 1], K.set(Nt, (K.get(Nt) || 0) + 1), Nt & a && K.set(a, (K.get(a) || 0) + 1), Nt & De) + if (Nt & (j | L)) { + X[At] = Z._level; + var $t = (Nt === j ? Me : qe)(Z._level); + $t <= Ae && !fe && !Fe ? rt.push({ + _level: $t, _override: 0, _isolate: 0 - }) : $e || gt++; - } else if (nn & (_ | D)) { - Z[$t] = ut._level; - var Jo = (nn === _ ? ie : X)(ut._level); - Jo <= Ae && !$e && !gt ? He.push({ - _level: Jo, - _override: nn & _ ? x : y, + }) : fe || Fe++; + } else if (Nt & (B | D)) { + X[At] = Z._level; + var Fr = (Nt === B ? Me : qe)(Z._level); + Fr <= Ae && !fe && !Fe ? rt.push({ + _level: Fr, + _override: Nt & B ? x : y, _isolate: 0 - }) : $e || gt++; - } else if (nn & s) { - nn & le && (nn = R3($t + 1, !0) === 1 ? ue : Y), Z[$t] = ut._level, ut._override && U($t, ut._override); - var Ym = (nn === ue ? ie : X)(ut._level); - Ym <= Ae && $e === 0 && gt === 0 ? (qt++, He.push({ - _level: Ym, + }) : fe || Fe++; + } else if (Nt & s) { + Nt & ie && (Nt = R3(At + 1, !0) === 1 ? le : Y), X[At] = Z._level, Z._override && U(At, Z._override); + var sc = (Nt === le ? Me : qe)(Z._level); + sc <= Ae && fe === 0 && Fe === 0 ? (ht++, rt.push({ + _level: sc, _override: 0, _isolate: 1, - _isolInitIndex: $t - })) : $e++; - } else if (nn & pe) { - if ($e > 0) - $e--; - else if (qt > 0) { - for (gt = 0; !He[He.length - 1]._isolate; ) - He.pop(); - var du = He[He.length - 1]._isolInitIndex; - du != null && (ne.set(du, $t), ne.set($t, du)), He.pop(), qt--; + _isolInitIndex: At + })) : fe++; + } else if (Nt & pe) { + if (fe > 0) + fe--; + else if (ht > 0) { + for (Fe = 0; !rt[rt.length - 1]._isolate; ) + rt.pop(); + var fu = rt[rt.length - 1]._isolInitIndex; + fu != null && (re.set(fu, At), re.set(At, fu)), rt.pop(), ht--; } - ut = He[He.length - 1], Z[$t] = ut._level, ut._override && U($t, ut._override); - } else nn & H ? ($e === 0 && (gt > 0 ? gt-- : !ut._isolate && He.length > 1 && (He.pop(), ut = He[He.length - 1])), Z[$t] = ut._level) : nn & T && (Z[$t] = _e.level); + Z = rt[rt.length - 1], X[At] = Z._level, Z._override && U(At, Z._override); + } else Nt & H ? (fe === 0 && (Fe > 0 ? Fe-- : !Z._isolate && rt.length > 1 && (rt.pop(), Z = rt[rt.length - 1])), X[At] = Z._level) : Nt & T && (X[At] = Le.level); else - Z[$t] = ut._level, ut._override && nn !== F && U($t, ut._override); + X[At] = Z._level, Z._override && Nt !== F && U(At, Z._override); } - for (var Ao = [], kr = null, Mi = _e.start; Mi <= _e.end; Mi++) { - var fu = ce[Mi]; - if (!(fu & c)) { - var Qm = Z[Mi], V = fu & s, G = fu === pe; - kr && Qm === kr._level ? (kr._end = Mi, kr._endsWithIsolInit = V) : Ao.push(kr = { + for (var So = [], kr = null, Mi = Le.start; Mi <= Le.end; Mi++) { + var hu = ce[Mi]; + if (!(hu & c)) { + var Qm = X[Mi], V = hu & s, G = hu === pe; + kr && Qm === kr._level ? (kr._end = Mi, kr._endsWithIsolInit = V) : So.push(kr = { _start: Mi, _end: Mi, _level: Qm, @@ -28551,44 +28582,44 @@ function vge() { }); } } - for (var Q = [], be = 0; be < Ao.length; be++) { - var we = Ao[be]; - if (!we._startsWithPDI || we._startsWithPDI && !ne.has(we._start)) { - for (var ye = [kr = we], st = void 0; kr && kr._endsWithIsolInit && (st = ne.get(kr._end)) != null; ) - for (var Qe = be + 1; Qe < Ao.length; Qe++) - if (Ao[Qe]._start === st) { - ye.push(kr = Ao[Qe]); + for (var Q = [], ye = 0; ye < So.length; ye++) { + var be = So[ye]; + if (!be._startsWithPDI || be._startsWithPDI && !re.has(be._start)) { + for (var me = [kr = be], it = void 0; kr && kr._endsWithIsolInit && (it = re.get(kr._end)) != null; ) + for (var Qe = ye + 1; Qe < So.length; Qe++) + if (So[Qe]._start === it) { + me.push(kr = So[Qe]); break; } - for (var At = [], Nn = 0; Nn < ye.length; Nn++) - for (var mt = ye[Nn], On = mt._start; On <= mt._end; On++) - At.push(On); - for (var Zn = Z[At[0]], sc = _e.level, ic = At[0] - 1; ic >= 0; ic--) - if (!(ce[ic] & c)) { - sc = Z[ic]; + for (var St = [], Nn = 0; Nn < me.length; Nn++) + for (var mt = me[Nn], On = mt._start; On <= mt._end; On++) + St.push(On); + for (var er = X[St[0]], ic = Le.level, ac = St[0] - 1; ac >= 0; ac--) + if (!(ce[ac] & c)) { + ic = X[ac]; break; } - var hE = At[At.length - 1], XJ = Z[hE], h3 = _e.level; + var hE = St[St.length - 1], XJ = X[hE], h3 = Le.level; if (!(ce[hE] & s)) { - for (var Jv = hE + 1; Jv <= _e.end; Jv++) + for (var Jv = hE + 1; Jv <= Le.end; Jv++) if (!(ce[Jv] & c)) { - h3 = Z[Jv]; + h3 = X[Jv]; break; } } Q.push({ - _seqIndices: At, - _sosType: Math.max(sc, Zn) % 2 ? x : y, + _seqIndices: St, + _sosType: Math.max(ic, er) % 2 ? x : y, _eosType: Math.max(h3, XJ) % 2 ? x : y }); } } for (var pE = 0; pE < Q.length; pE++) { - var gE = Q[pE], Ge = gE._seqIndices, Xm = gE._sosType, ZJ = gE._eosType, eh = Z[Ge[0]] & 1 ? x : y; - if (K.get(B)) + var gE = Q[pE], Ge = gE._seqIndices, Xm = gE._sosType, ZJ = gE._eosType, nh = X[Ge[0]] & 1 ? x : y; + if (K.get(_)) for (var Yv = 0; Yv < Ge.length; Yv++) { var p3 = Ge[Yv]; - if (ce[p3] & B) { + if (ce[p3] & _) { for (var mE = Xm, Qv = Yv - 1; Qv >= 0; Qv--) if (!(ce[Ge[Qv]] & c)) { mE = ce[Ge[Qv]]; @@ -28618,11 +28649,11 @@ function vge() { for (var Zm = 1; Zm < Ge.length - 1; Zm++) { var bE = Ge[Zm]; if (ce[bE] & (b | O)) { - for (var th = 0, wE = 0, vE = Zm - 1; vE >= 0 && (th = ce[Ge[vE]], !!(th & c)); vE--) + for (var rh = 0, wE = 0, vE = Zm - 1; vE >= 0 && (rh = ce[Ge[vE]], !!(rh & c)); vE--) ; for (var kE = Zm + 1; kE < Ge.length && (wE = ce[Ge[kE]], !!(wE & c)); kE++) ; - th === wE && (ce[bE] === b ? th === A : th & (A | I)) && U(bE, th); + rh === wE && (ce[bE] === b ? rh === A : rh & (A | I)) && U(bE, rh); } } if (K.get(A)) @@ -28654,25 +28685,25 @@ function vge() { if (K.get(a)) { var ty = x | A | I, k3 = ty | y, r1 = []; { - for (var nh = [], rh = 0; rh < Ge.length; rh++) - if (ce[Ge[rh]] & a) { - var ny = W[Ge[rh]], A3 = void 0; + for (var oh = [], sh = 0; sh < Ge.length; sh++) + if (ce[Ge[sh]] & a) { + var ny = W[Ge[sh]], A3 = void 0; if (k(ny) !== null) - if (nh.length < 63) - nh.push({ char: ny, seqIndex: rh }); + if (oh.length < 63) + oh.push({ char: ny, seqIndex: sh }); else break; else if ((A3 = N(ny)) !== null) - for (var ry = nh.length - 1; ry >= 0; ry--) { - var xE = nh[ry].char; + for (var ry = oh.length - 1; ry >= 0; ry--) { + var xE = oh[ry].char; if (xE === A3 || xE === N(w(ny)) || k(w(xE)) === ny) { - r1.push([nh[ry].seqIndex, rh]), nh.length = ry; + r1.push([oh[ry].seqIndex, sh]), oh.length = ry; break; } } } - r1.sort(function(Fr, Qo) { - return Fr[0] - Qo[0]; + r1.sort(function(Vr, Qo) { + return Vr[0] - Qo[0]; }); } for (var EE = 0; EE < r1.length; EE++) { @@ -28681,7 +28712,7 @@ function vge() { if (ce[E3] & k3) { x3 = !0; var C3 = ce[E3] & ty ? x : y; - if (C3 === eh) { + if (C3 === nh) { Yo = C3; break; } @@ -28693,38 +28724,38 @@ function vge() { var I3 = Ge[NE]; if (ce[I3] & k3) { var N3 = ce[I3] & ty ? x : y; - N3 !== eh ? Yo = N3 : Yo = eh; + N3 !== nh ? Yo = N3 : Yo = nh; break; } } } if (Yo) { - if (ce[Ge[o1]] = ce[Ge[CE]] = Yo, Yo !== eh) { + if (ce[Ge[o1]] = ce[Ge[CE]] = Yo, Yo !== nh) { for (var oy = o1 + 1; oy < Ge.length; oy++) if (!(ce[Ge[oy]] & c)) { - f(W[Ge[oy]]) & B && (ce[Ge[oy]] = Yo); + d(W[Ge[oy]]) & _ && (ce[Ge[oy]] = Yo); break; } } - if (Yo !== eh) { + if (Yo !== nh) { for (var sy = CE + 1; sy < Ge.length; sy++) if (!(ce[Ge[sy]] & c)) { - f(W[Ge[sy]]) & B && (ce[Ge[sy]] = Yo); + d(W[Ge[sy]]) & _ && (ce[Ge[sy]] = Yo); break; } } } } - for (var ac = 0; ac < Ge.length; ac++) - if (ce[Ge[ac]] & a) { - for (var O3 = ac, OE = ac, PE = Xm, iy = ac - 1; iy >= 0; iy--) + for (var cc = 0; cc < Ge.length; cc++) + if (ce[Ge[cc]] & a) { + for (var O3 = cc, OE = cc, PE = Xm, iy = cc - 1; iy >= 0; iy--) if (ce[Ge[iy]] & c) O3 = iy; else { PE = ce[Ge[iy]] & ty ? x : y; break; } - for (var P3 = ZJ, ay = ac + 1; ay < Ge.length; ay++) + for (var P3 = ZJ, ay = cc + 1; ay < Ge.length; ay++) if (ce[Ge[ay]] & (a | c)) OE = ay; else { @@ -28732,113 +28763,113 @@ function vge() { break; } for (var RE = O3; RE <= OE; RE++) - ce[Ge[RE]] = PE === P3 ? PE : eh; - ac = OE; + ce[Ge[RE]] = PE === P3 ? PE : nh; + cc = OE; } } } - for (var Zr = _e.start; Zr <= _e.end; Zr++) { - var tY = Z[Zr], s1 = ce[Zr]; - if (tY & 1 ? s1 & (y | A | I) && Z[Zr]++ : s1 & x ? Z[Zr]++ : s1 & (I | A) && (Z[Zr] += 2), s1 & c && (Z[Zr] = Zr === 0 ? _e.level : Z[Zr - 1]), Zr === _e.end || f(W[Zr]) & (R | T)) - for (var i1 = Zr; i1 >= 0 && f(W[i1]) & l; i1--) - Z[i1] = _e.level; + for (var eo = Le.start; eo <= Le.end; eo++) { + var tY = X[eo], s1 = ce[eo]; + if (tY & 1 ? s1 & (y | A | I) && X[eo]++ : s1 & x ? X[eo]++ : s1 & (I | A) && (X[eo] += 2), s1 & c && (X[eo] = eo === 0 ? Le.level : X[eo - 1]), eo === Le.end || d(W[eo]) & (R | T)) + for (var i1 = eo; i1 >= 0 && d(W[i1]) & l; i1--) + X[i1] = Le.level; } } return { - levels: Z, + levels: X, paragraphs: xe }; - function R3(Fr, Qo) { - for (var Vr = Fr; Vr < W.length; Vr++) { - var cc = ce[Vr]; - if (cc & (x | $)) + function R3(Vr, Qo) { + for (var $r = Vr; $r < W.length; $r++) { + var lc = ce[$r]; + if (lc & (x | $)) return 1; - if (cc & (T | y) || Qo && cc === pe) + if (lc & (T | y) || Qo && lc === pe) return 0; - if (cc & s) { - var T3 = nY(Vr); - Vr = T3 === -1 ? W.length : T3; + if (lc & s) { + var T3 = nY($r); + $r = T3 === -1 ? W.length : T3; } } return 0; } - function nY(Fr) { - for (var Qo = 1, Vr = Fr + 1; Vr < W.length; Vr++) { - var cc = ce[Vr]; - if (cc & T) + function nY(Vr) { + for (var Qo = 1, $r = Vr + 1; $r < W.length; $r++) { + var lc = ce[$r]; + if (lc & T) break; - if (cc & pe) { + if (lc & pe) { if (--Qo === 0) - return Vr; - } else cc & s && Qo++; + return $r; + } else lc & s && Qo++; } return -1; } } - var Me = "14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1", Be; - function te() { + var _e = "14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1", Be; + function ee() { if (!Be) { - var W = p(Me, !0), Se = W.map, Ae = W.reverseMap; + var W = p(_e, !0), Se = W.map, Ae = W.reverseMap; Ae.forEach(function(ce, Ne) { Se.set(Ne, ce); }), Be = Se; } } function he(W) { - return te(), Be.get(W) || null; + return ee(), Be.get(W) || null; } function Te(W, Se, Ae, ce) { var Ne = W.length; Ae = Math.max(0, Ae == null ? 0 : +Ae), ce = Math.min(Ne - 1, ce == null ? Ne - 1 : +ce); for (var K = /* @__PURE__ */ new Map(), U = Ae; U <= ce; U++) if (Se[U] & 1) { - var Z = he(W[U]); - Z !== null && K.set(U, Z); + var X = he(W[U]); + X !== null && K.set(U, X); } return K; } - function ze(W, Se, Ae, ce) { + function We(W, Se, Ae, ce) { var Ne = W.length; Ae = Math.max(0, Ae == null ? 0 : +Ae), ce = Math.min(Ne - 1, ce == null ? Ne - 1 : +ce); var K = []; return Se.paragraphs.forEach(function(U) { - var Z = Math.max(Ae, U.start), ne = Math.min(ce, U.end); - if (Z < ne) { - for (var xe = Se.levels.slice(Z, ne + 1), _e = ne; _e >= Z && f(W[_e]) & l; _e--) - xe[_e] = U.level; - for (var Ie = U.level, Le = 1 / 0, X = 0; X < xe.length; X++) { - var ie = xe[X]; - ie > Ie && (Ie = ie), ie < Le && (Le = ie | 1); + var X = Math.max(Ae, U.start), re = Math.min(ce, U.end); + if (X < re) { + for (var xe = Se.levels.slice(X, re + 1), Le = re; Le >= X && d(W[Le]) & l; Le--) + xe[Le] = U.level; + for (var Ie = U.level, De = 1 / 0, qe = 0; qe < xe.length; qe++) { + var Me = xe[qe]; + Me > Ie && (Ie = Me), Me < De && (De = Me | 1); } - for (var Fe = Ie; Fe >= Le; Fe--) - for (var He = 0; He < xe.length; He++) - if (xe[He] >= Fe) { - for (var ut = He; He + 1 < xe.length && xe[He + 1] >= Fe; ) - He++; - He > ut && K.push([ut + Z, He + Z]); + for (var It = Ie; It >= De; It--) + for (var rt = 0; rt < xe.length; rt++) + if (xe[rt] >= It) { + for (var Z = rt; rt + 1 < xe.length && xe[rt + 1] >= It; ) + rt++; + rt > Z && K.push([Z + X, rt + X]); } } }), K; } function ae(W, Se, Ae, ce) { - var Ne = me(W, Se, Ae, ce), K = [].concat(W); - return Ne.forEach(function(U, Z) { - K[Z] = (Se.levels[U] & 1 ? he(W[U]) : null) || W[U]; + var Ne = ge(W, Se, Ae, ce), K = [].concat(W); + return Ne.forEach(function(U, X) { + K[X] = (Se.levels[U] & 1 ? he(W[U]) : null) || W[U]; }), K.join(""); } - function me(W, Se, Ae, ce) { - for (var Ne = ze(W, Se, Ae, ce), K = [], U = 0; U < W.length; U++) + function ge(W, Se, Ae, ce) { + for (var Ne = We(W, Se, Ae, ce), K = [], U = 0; U < W.length; U++) K[U] = U; - return Ne.forEach(function(Z) { - for (var ne = Z[0], xe = Z[1], _e = K.slice(ne, xe + 1), Ie = _e.length; Ie--; ) - K[xe - Ie] = _e[Ie]; + return Ne.forEach(function(X) { + for (var re = X[0], xe = X[1], Le = K.slice(re, xe + 1), Ie = Le.length; Ie--; ) + K[xe - Ie] = Le[Ie]; }), K; } - return t.closingToOpeningBracket = N, t.getBidiCharType = f, t.getBidiCharTypeName = h, t.getCanonicalBracket = w, t.getEmbeddingLevels = ge, t.getMirroredCharacter = he, t.getMirroredCharactersMap = Te, t.getReorderSegments = ze, t.getReorderedIndices = me, t.getReorderedString = ae, t.openingToClosingBracket = k, Object.defineProperty(t, "__esModule", { value: !0 }), t; + return t.closingToOpeningBracket = N, t.getBidiCharType = d, t.getBidiCharTypeName = h, t.getCanonicalBracket = w, t.getEmbeddingLevels = ve, t.getMirroredCharacter = he, t.getMirroredCharactersMap = Te, t.getReorderSegments = We, t.getReorderedIndices = ge, t.getReorderedString = ae, t.openingToClosingBracket = k, Object.defineProperty(t, "__esModule", { value: !0 }), t; })({}); return e; } -const So = [ +const xo = [ 32, 33, 34, @@ -29060,7 +29091,7 @@ const So = [ ascent: 803, descent: -248, programHash: "955500bf0048e07e3046477b3874ef9e7653010a2bc780bbf27f837d7ca34d19", - codePoints: So, + codePoints: xo, advances: [ 600, 600, @@ -29284,7 +29315,7 @@ const So = [ ascent: 811, descent: -248, programHash: "386d8684b075c7ff4911235ae9691d5e9e924fff13fa1f17841c6d4d4f3762e6", - codePoints: So, + codePoints: xo, advances: [ 600, 600, @@ -29508,7 +29539,7 @@ const So = [ ascent: 811, descent: -248, programHash: "d1dae62980ea92bfa86f9e3961a3064e164e41a5064211f2a3a8833643a322a5", - codePoints: So, + codePoints: xo, advances: [ 600, 600, @@ -29732,7 +29763,7 @@ const So = [ ascent: 803, descent: -248, programHash: "d790f273acf84a1afada2cf96a6eb646728a1a6e7afe961a2cc846bb3a501b0b", - codePoints: So, + codePoints: xo, advances: [ 600, 600, @@ -29956,7 +29987,7 @@ const So = [ ascent: 945, descent: -224, programHash: "93fe419ed14bac240018cf4506dbb64643eeeee379c0b51d3c52d239f4adbc58", - codePoints: So, + codePoints: xo, advances: [ 278, 278, @@ -30180,7 +30211,7 @@ const So = [ ascent: 962, descent: -227, programHash: "f11bf41cf5d115966ee4d954d9d3eab4a7d1b63d371e5d655fc82d15350bc929", - codePoints: So, + codePoints: xo, advances: [ 278, 333, @@ -30404,7 +30435,7 @@ const So = [ ascent: 962, descent: -227, programHash: "9cd559e9d134dd6bb8bb75186d4302079e78ebee53a7c9b38dea1fba52a534d8", - codePoints: So, + codePoints: xo, advances: [ 278, 333, @@ -30628,7 +30659,7 @@ const So = [ ascent: 951, descent: -224, programHash: "872e4efa9cc73daff4a3fffa952663f32144db19ec91a8407afc359486eae30b", - codePoints: So, + codePoints: xo, advances: [ 278, 278, @@ -30852,7 +30883,7 @@ const So = [ ascent: 878, descent: -249, programHash: "7be927a55309ca34d67972ccf041ff3d156d774017022b18131fa365e6dd922e", - codePoints: So, + codePoints: xo, advances: [ 250, 333, @@ -31076,7 +31107,7 @@ const So = [ ascent: 889, descent: -249, programHash: "f23f2efbfa079f9083d967acf695b10db7c78e39862dbeb4788a4fd0533ff29c", - codePoints: So, + codePoints: xo, advances: [ 250, 333, @@ -31300,7 +31331,7 @@ const So = [ ascent: 869, descent: -249, programHash: "cf51fab68d7d965f5755218a7f99b0376bc440e1bb4e90498aef0964aac94490", - codePoints: So, + codePoints: xo, advances: [ 250, 389, @@ -31524,7 +31555,7 @@ const So = [ ascent: 868, descent: -249, programHash: "f405670768d71ff8d8a4e493cbcb9c6deff9565419bf63a38abb544789aa87b4", - codePoints: So, + codePoints: xo, advances: [ 250, 333, @@ -32558,7 +32589,7 @@ const Age = { symbol: () => import("./symbol.generated-DXSVzciM-CR210hra.js"), "zapf-dingbats": () => import("./zapf-dingbats.generated-DSHah6NK-lpJ-p1Lt.js") }, qa = (e) => `epdf-${e.slice(0, 16)}`, PL = /* @__PURE__ */ new Map(); -function vl(e) { +function kl(e) { const t = PL.get(e); if (t) return t; const n = Ev[e].programHash; @@ -32580,14 +32611,14 @@ function vl(e) { }; return PL.set(e, o), o; } -const Jl = "e9d14973462069b4906f8d22a9aaec2d6ec9eb02ac31d697631783316d8b8768", Sge = "AAEAAAAKAIAAAwAgT1MvMlUTUmMAAACsAAAAYGNtYXAAIrhhAAABDAAAADRnbHlmBX0EwQAAAUAAAAA4aGVhZGHSQ6EAAAF4AAAANmhoZWEFogH3AAABsAAAACRobXR4BRQAPAAAAdQAAAAIbG9jYQAcAAAAAAHcAAAABm1heHAABQAKAAAB5AAAACBuYW1lLeJOdAAAAgQAAAI6cG9zdP+fADIAAARAAAAAIAAEArwBkAAFAQACigJYAAAASwKKAlgAAAFeADIA+gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFUERGAMAAIP//AyD/OAAAAyAAyAAAAAAAAAAAAfQCvAAAACAAAQAAAAEAAwAKAAAADAANAAAAAAAoAAAAAAAAAAIAAAAgAADX/wAAAAEAAOAAABD//wAAAAEAAgA8AAACgAK8AAMABwAAAQEBAQEBAQEAPAAAAkQAAP/EAAD+NAAAAAACvAAA/UQAPAJEAAD9vAABAAAAAQAAu91Pc18PPPUAAwPoAAAAAAAAAAAAAAAAAAAAAAA8AAACgAK8AAAACAACAAAAAAAAAAEAAAMg/zgAAAK8AAAAAAKAAAEAAAAAAAAAAAAAAAAAAAACAlgAAAK8ADwAAAAAABwAAAABAAAAAgAIAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAACQByAAMAAQQJAAAANgAAAAMAAQQJAAEAKAA2AAMAAQQJAAIADgBeAAMAAQQJAAMANABsAAMAAQQJAAQAKACgAAMAAQQJAAUAGgDIAAMAAQQJAAYANADiAAMAAQQJAA0AXAEWAAMAAQQJAA4AVgFyAEMAbwBwAHkAcgBpAGcAaAB0ACAAMgAwADIANgAgAEMAbABvAHUAZABQAEQARgAgAEwAVABEAEUAbQBiAGUAZABQAEQARgAgAEwAYQBzAHQAIABSAGUAcwBvAHIAdABSAGUAZwB1AGwAYQByAEUAbQBiAGUAZABQAEQARgBMAGEAcwB0AFIAZQBzAG8AcgB0AC0AUgBlAGcAdQBsAGEAcgBFAG0AYgBlAGQAUABEAEYAIABMAGEAcwB0ACAAUgBlAHMAbwByAHQAVgBlAHIAcwBpAG8AbgAgADEALgAwADAAMABFAG0AYgBlAGQAUABEAEYATABhAHMAdABSAGUAcwBvAHIAdAAtAFIAZQBnAHUAbABhAHIATABpAGMAZQBuAHMAZQBkACAAdQBuAGQAZQByACAAdABoAGUAIABBAHAAYQBjAGgAZQAgAEwAaQBjAGUAbgBzAGUALAAgAFYAZQByAHMAaQBvAG4AIAAyAC4AMABoAHQAdABwAHMAOgAvAC8AdwB3AHcALgBhAHAAYQBjAGgAZQAuAG8AcgBnAC8AbABpAGMAZQBuAHMAZQBzAC8ATABJAEMARQBOAFMARQAtADIALgAwAAAAAwAAAAAAAP+cADIAAAAAAAAAAAAAAAAAAAAAAAAAAA=="; +const Yl = "e9d14973462069b4906f8d22a9aaec2d6ec9eb02ac31d697631783316d8b8768", Sge = "AAEAAAAKAIAAAwAgT1MvMlUTUmMAAACsAAAAYGNtYXAAIrhhAAABDAAAADRnbHlmBX0EwQAAAUAAAAA4aGVhZGHSQ6EAAAF4AAAANmhoZWEFogH3AAABsAAAACRobXR4BRQAPAAAAdQAAAAIbG9jYQAcAAAAAAHcAAAABm1heHAABQAKAAAB5AAAACBuYW1lLeJOdAAAAgQAAAI6cG9zdP+fADIAAARAAAAAIAAEArwBkAAFAQACigJYAAAASwKKAlgAAAFeADIA+gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFUERGAMAAIP//AyD/OAAAAyAAyAAAAAAAAAAAAfQCvAAAACAAAQAAAAEAAwAKAAAADAANAAAAAAAoAAAAAAAAAAIAAAAgAADX/wAAAAEAAOAAABD//wAAAAEAAgA8AAACgAK8AAMABwAAAQEBAQEBAQEAPAAAAkQAAP/EAAD+NAAAAAACvAAA/UQAPAJEAAD9vAABAAAAAQAAu91Pc18PPPUAAwPoAAAAAAAAAAAAAAAAAAAAAAA8AAACgAK8AAAACAACAAAAAAAAAAEAAAMg/zgAAAK8AAAAAAKAAAEAAAAAAAAAAAAAAAAAAAACAlgAAAK8ADwAAAAAABwAAAABAAAAAgAIAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAACQByAAMAAQQJAAAANgAAAAMAAQQJAAEAKAA2AAMAAQQJAAIADgBeAAMAAQQJAAMANABsAAMAAQQJAAQAKACgAAMAAQQJAAUAGgDIAAMAAQQJAAYANADiAAMAAQQJAA0AXAEWAAMAAQQJAA4AVgFyAEMAbwBwAHkAcgBpAGcAaAB0ACAAMgAwADIANgAgAEMAbABvAHUAZABQAEQARgAgAEwAVABEAEUAbQBiAGUAZABQAEQARgAgAEwAYQBzAHQAIABSAGUAcwBvAHIAdABSAGUAZwB1AGwAYQByAEUAbQBiAGUAZABQAEQARgBMAGEAcwB0AFIAZQBzAG8AcgB0AC0AUgBlAGcAdQBsAGEAcgBFAG0AYgBlAGQAUABEAEYAIABMAGEAcwB0ACAAUgBlAHMAbwByAHQAVgBlAHIAcwBpAG8AbgAgADEALgAwADAAMABFAG0AYgBlAGQAUABEAEYATABhAHMAdABSAGUAcwBvAHIAdAAtAFIAZQBnAHUAbABhAHIATABpAGMAZQBuAHMAZQBkACAAdQBuAGQAZQByACAAdABoAGUAIABBAHAAYQBjAGgAZQAgAEwAaQBjAGUAbgBzAGUALAAgAFYAZQByAHMAaQBvAG4AIAAyAC4AMABoAHQAdABwAHMAOgAvAC8AdwB3AHcALgBhAHAAYQBjAGgAZQAuAG8AcgBnAC8AbABpAGMAZQBuAHMAZQBzAC8ATABJAEMARQBOAFMARQAtADIALgAwAAAAAwAAAAAAAP+cADIAAAAAAAAAAAAAAAAAAAAAAAAAAA=="; let yC = null; function j0() { if (!yC) { let e = null; yC = { - hash: Jl, - family: qa(Jl), + hash: Yl, + family: qa(Yl), weight: 400, style: "normal", load: () => Promise.resolve(e ?? (e = JR("AAEAAAAKAIAAAwAgT1MvMlUTUmMAAACsAAAAYGNtYXAAIrhhAAABDAAAADRnbHlmBX0EwQAAAUAAAAA4aGVhZGHSQ6EAAAF4AAAANmhoZWEFogH3AAABsAAAACRobXR4BRQAPAAAAdQAAAAIbG9jYQAcAAAAAAHcAAAABm1heHAABQAKAAAB5AAAACBuYW1lLeJOdAAAAgQAAAI6cG9zdP+fADIAAARAAAAAIAAEArwBkAAFAQACigJYAAAASwKKAlgAAAFeADIA+gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFUERGAMAAIP//AyD/OAAAAyAAyAAAAAAAAAAAAfQCvAAAACAAAQAAAAEAAwAKAAAADAANAAAAAAAoAAAAAAAAAAIAAAAgAADX/wAAAAEAAOAAABD//wAAAAEAAgA8AAACgAK8AAMABwAAAQEBAQEBAQEAPAAAAkQAAP/EAAD+NAAAAAACvAAA/UQAPAJEAAD9vAABAAAAAQAAu91Pc18PPPUAAwPoAAAAAAAAAAAAAAAAAAAAAAA8AAACgAK8AAAACAACAAAAAAAAAAEAAAMg/zgAAAK8AAAAAAKAAAEAAAAAAAAAAAAAAAAAAAACAlgAAAK8ADwAAAAAABwAAAABAAAAAgAIAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAACQByAAMAAQQJAAAANgAAAAMAAQQJAAEAKAA2AAMAAQQJAAIADgBeAAMAAQQJAAMANABsAAMAAQQJAAQAKACgAAMAAQQJAAUAGgDIAAMAAQQJAAYANADiAAMAAQQJAA0AXAEWAAMAAQQJAA4AVgFyAEMAbwBwAHkAcgBpAGcAaAB0ACAAMgAwADIANgAgAEMAbABvAHUAZABQAEQARgAgAEwAVABEAEUAbQBiAGUAZABQAEQARgAgAEwAYQBzAHQAIABSAGUAcwBvAHIAdABSAGUAZwB1AGwAYQByAEUAbQBiAGUAZABQAEQARgBMAGEAcwB0AFIAZQBzAG8AcgB0AC0AUgBlAGcAdQBsAGEAcgBFAG0AYgBlAGQAUABEAEYAIABMAGEAcwB0ACAAUgBlAHMAbwByAHQAVgBlAHIAcwBpAG8AbgAgADEALgAwADAAMABFAG0AYgBlAGQAUABEAEYATABhAHMAdABSAGUAcwBvAHIAdAAtAFIAZQBnAHUAbABhAHIATABpAGMAZQBuAHMAZQBkACAAdQBuAGQAZQByACAAdABoAGUAIABBAHAAYQBjAGgAZQAgAEwAaQBjAGUAbgBzAGUALAAgAFYAZQByAHMAaQBvAG4AIAAyAC4AMABoAHQAdABwAHMAOgAvAC8AdwB3AHcALgBhAHAAYQBjAGgAZQAuAG8AcgBnAC8AbABpAGMAZQBuAHMAZQBzAC8ATABJAEMARQBOAFMARQAtADIALgAwAAAAAwAAAAAAAP+cADIAAAAAAAAAAAAAAAAAAAAAAAAAAA=="))) @@ -32595,7 +32626,7 @@ function j0() { } return yC; } -const yg = { +const bg = { advance: 700, ascent: 800, descent: -200 @@ -32614,10 +32645,10 @@ function O2(e) { return Ege[ui[e].family]; } const RL = /* @__PURE__ */ new Map(); -function hm(e) { +function pm(e) { let t = RL.get(e); if (!t) { - const n = vl(e); + const n = kl(e); t = { fontFamily: `"${n.family}", ${O2(e)}`, fontWeight: n.weight, @@ -32627,23 +32658,23 @@ function hm(e) { } return t; } -function Gf(e) { +function Yf(e) { return gs(e) ? e : "helvetica"; } let bC = null; function F0(e) { - return bC ?? (bC = new Map(Om.map((t) => [qa(Ev[t].programHash), t]))), bC.get(e); + return bC ?? (bC = new Map(Pm.map((t) => [qa(Ev[t].programHash), t]))), bC.get(e); } const Cge = { standardDisplayHash: (e) => Ev[e].programHash, - lastResortDisplayHash: Jl + lastResortDisplayHash: Yl }, Ige = [{ start: 32, count: 55264 }, { start: 57344, count: 1056768 -}], JK = (e) => Om.find((t) => Ev[t].programHash === e); +}], JK = (e) => Pm.find((t) => Ev[t].programHash === e); function Nge(e) { const t = []; for (const n of [...e].sort((r, o) => r - o)) { @@ -32678,30 +32709,30 @@ function Oge(e) { format: "truetype", embeddingPermission: "installable", covers: Ige, - ascent: yg.ascent, - descent: yg.descent + ascent: bg.ascent, + descent: bg.descent }; } function Pge(e) { const t = JK(e); - if (t) return vl(t).load(); + if (t) return kl(t).load(); if (e === "e9d14973462069b4906f8d22a9aaec2d6ec9eb02ac31d697631783316d8b8768") return j0().load(); } const Rge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, BUILT_IN_PROGRAMS: Cge, - LAST_RESORT_HASH: Jl, - LAST_RESORT_METRICS: yg, + LAST_RESORT_HASH: Yl, + LAST_RESORT_METRICS: bg, builtInProgramInfo: Oge, fontProgramFamily: qa, lastResortFontBytes: xge, lastResortFontProgram: j0, loadBuiltInProgram: Pge, - standardFontCss: hm, + standardFontCss: pm, standardFontMetrics: GR, - standardFontOf: Gf, + standardFontOf: Yf, standardFontOfProgramFamily: F0, - standardFontProgram: vl, + standardFontProgram: kl, standardFontStack: O2 }, Symbol.toStringTag, { value: "Module" })), KN = 8205, Tge = /\p{M}/u, YR = (e) => e > 65535 ? 2 : 1, Mge = (e) => Tge.test(String.fromCodePoint(e)), YK = (e) => e >= 65024 && e <= 65039 || e >= 917760 && e <= 917999; function Cv(e) { @@ -33186,14 +33217,14 @@ const wC = (e) => e === ZR || e === e5 || e === t5, nH = (e) => Qge.has(e), tme function nme(e, t, n) { const r = jge(e, t), o = XK(e), s = [], i = []; let a = "Common"; - for (const [u, d] of o) { - const f = e.slice(u, d); + for (const [u, f] of o) { + const d = e.slice(u, f); let h = eme(e.codePointAt(u)); wC(h) ? h = a : a = h; - const g = tH(f, n); - !g.covered && !ZK(f) && !s.includes(f) && s.push(f), i.push({ + const g = tH(d, n); + !g.covered && !ZK(d) && !s.includes(d) && s.push(d), i.push({ begin: u, - end: d, + end: f, script: h, level: r[u], font: g.font @@ -33202,10 +33233,10 @@ function nme(e, t, n) { for (let u = i.length; u > 1; u -= 1) wC(i[u - 2].script) && (i[u - 2].script = i[u - 1].script); const c = []; for (const u of i) { - const d = c[c.length - 1]; - if (d && d.font === u.font && d.level === u.level && (d.script === u.script || wC(u.script))) { + const f = c[c.length - 1]; + if (f && f.font === u.font && f.level === u.level && (f.script === u.script || wC(u.script))) { c[c.length - 1] = { - ...d, + ...f, end: u.end }; continue; @@ -33213,12 +33244,12 @@ function nme(e, t, n) { c.push({ ...u }); } const l = []; - return c.forEach((u, d) => { - const f = o.filter(([g]) => g >= u.begin && g < u.end), h = rme(e, u, f); - f.forEach(([g, p], m) => l.push({ + return c.forEach((u, f) => { + const d = o.filter(([g]) => g >= u.begin && g < u.end), h = rme(e, u, d); + d.forEach(([g, p], m) => l.push({ begin: g, end: p, - item: d, + item: f, widths: h[m] })); }), { @@ -33244,27 +33275,27 @@ function rme(e, t, n) { for (; c < n.length && !i(c); ) c += 1; const l = n[a][0]; let u = 0; - for (let d = a; d < c; d += 1) { - const f = o.width(e.slice(l, n[d][1]), r); - s.push([f - u]), u = f; + for (let f = a; f < c; f += 1) { + const d = o.width(e.slice(l, n[f][1]), r); + s.push([d - u]), u = d; } a = c; } return s; } -const FS = Math.fround, ome = FS(1e-3), Eu = (e, t) => FS(FS(e * t) * ome); +const FS = Math.fround, ome = FS(1e-3), Cu = (e, t) => FS(FS(e * t) * ome); function rH(e, t, n, r) { let o = 0; - for (let s = t; s < n; s += 1) for (const i of e.graphemes[s].widths) o = FS(o + Eu(i, r)); + for (let s = t; s < n; s += 1) for (const i of e.graphemes[s].widths) o = FS(o + Cu(i, r)); return o; } function $L(e, t, n, r) { if (t >= n) return []; - const { text: o, graphemes: s, items: i } = e, a = s[t].begin, c = s[n - 1].end, l = Fge(o, e.levels, a, c, e.base), u = [], d = []; - let f = t; - for (; f < n; ) { - const h = s[f], g = l[h.begin - a]; - let p = f + 1; + const { text: o, graphemes: s, items: i } = e, a = s[t].begin, c = s[n - 1].end, l = Fge(o, e.levels, a, c, e.base), u = [], f = []; + let d = t; + for (; d < n; ) { + const h = s[d], g = l[h.begin - a]; + let p = d + 1; for (; p < n && s[p].item === h.item && l[s[p].begin - a] === g; ) p += 1; const m = i[h.item], v = s[p - 1].end; u.push({ @@ -33272,12 +33303,12 @@ function $L(e, t, n, r) { text: o.slice(h.begin, v), rtl: m.level % 2 === 1, plain: m.font.standard || nH(m.script), - width: rH(e, f, p, r), + width: rH(e, d, p, r), begin: h.begin, end: v - }), d.push(g), f = p; + }), f.push(g), d = p; } - return $ge(d).map((h) => u[h]); + return $ge(f).map((h) => u[h]); } const UL = [ [ @@ -34249,7 +34280,7 @@ function ume(e, t = () => !0) { s !== "T" && (o >= 0 && lme(n[o]) && cme(s) && t(o, i) && (r[o].next = !0, r[i].previous = !0), o = i); }), r; } -const KL = "‍", dme = (e, t) => `${t.previous ? KL : ""}${e}${t.next ? KL : ""}`, _t = Math.fround, oH = (e) => e < 1e-4 && e > -1e-4, HL = (e, t) => e > t && !oH(_t(e - t)), vC = [ +const KL = "‍", dme = (e, t) => `${t.previous ? KL : ""}${e}${t.next ? KL : ""}`, jt = Math.fround, oH = (e) => e < 1e-4 && e > -1e-4, HL = (e, t) => e > t && !oH(jt(e - t)), vC = [ 4, 6, 8, @@ -34277,8 +34308,8 @@ const KL = "‍", dme = (e, t) => `${t.previous ? KL : ""}${e}${t.next ? KL : "" 144 ]; function WN(e, t, n) { - const { plate: r, alignment: o, multiline: s, cells: i } = n, a = _t(r.right - r.left), c = _t(r.top - r.bottom), l = Math.max(a, 0), u = fme(e, n), d = Vge(u.join("")) ?? !1, f = i > 0, h = u.map((I) => { - const O = nme(I, d, t); + const { plate: r, alignment: o, multiline: s, cells: i } = n, a = jt(r.right - r.left), c = jt(r.top - r.bottom), l = Math.max(a, 0), u = fme(e, n), f = Vge(u.join("")) ?? !1, d = i > 0, h = u.map((I) => { + const O = nme(I, f, t); return { paragraph: O, units: O.graphemes.map((T, R) => { @@ -34296,16 +34327,16 @@ function WN(e, t, n) { return ume(O.map((R) => I.text.slice(T(R).begin, T(R).end)), (R, M) => T(O[R]).item === T(O[M]).item); }, v = (I, O, T, R) => { if (!T.previous && !T.next) return p(I, O, R); - const { paragraph: M } = I, F = M.graphemes[O.grapheme], B = M.items[F.item], $ = dme(M.text.slice(F.begin, F.end), T); - return Eu(B.font.width($, B.level % 2 === 1), R); - }, S = (I) => Eu(t.face.ascent, I), C = (I) => Eu(t.face.descent, I); + const { paragraph: M } = I, F = M.graphemes[O.grapheme], _ = M.items[F.item], $ = dme(M.text.slice(F.begin, F.end), T); + return Cu(_.font.width($, _.level % 2 === 1), R); + }, S = (I) => Cu(t.face.ascent, I), C = (I) => Cu(t.face.descent, I); let k = n.fontSize; if (oH(k) && (k = 0, a > 0)) { const I = s ? vC.slice(0, Math.trunc(vC.length / 4)) : vC, O = (M) => { - let F = 0, B = 0; + let F = 0, _ = 0; for (const $ of h) { const D = E($, M, null); - if (F = Math.max(D.width, F), B = _t(B + D.height), HL(F, a) || HL(B, c)) return !0; + if (F = Math.max(D.width, F), _ = jt(_ + D.height), HL(F, a) || HL(_, c)) return !0; } return !1; }; @@ -34322,28 +34353,28 @@ function WN(e, t, n) { let O; const T = []; let R = [], M = 0, F; - if (f) { - const B = _t(a / i), $ = I.units.length; + if (d) { + const _ = jt(a / i), $ = I.units.length; let D = 0; o === 1 ? D = Math.trunc((i - $) / 2) : o === 2 && (D = i - $); - const _ = S(k); + const B = S(k); let L = C(k); R = m(I); for (let j = 0; j < $ && j < i; j += 1) { const H = I.units[j], Y = v(I, H, R[j], k); - T.push(_t(B * (j + D + 0.5) - _t(Y * 0.5))), L = Math.min(L, Eu(H.descent, k)); + T.push(jt(_ * (j + D + 0.5) - jt(Y * 0.5))), L = Math.min(L, Cu(H.descent, k)); } O = [{ begin: $ > 0 ? 0 : -1, end: $ - 1, width: 0, - ascent: _, + ascent: B, descent: L - }], F = _t(_ - L); + }], F = jt(B - L); } else { O = []; - const B = E(I, k, O); - M = zL(o, l, B.width), F = B.height; + const _ = E(I, k, O); + M = zL(o, l, _.width), F = _.height; } N.push({ section: I, @@ -34352,20 +34383,20 @@ function WN(e, t, n) { cellJoins: R, left: M, top: w - }), w = _t(w + F), y = _t(y + F); + }), w = jt(w + F), y = jt(y + F); } - const x = n.centered ? _t(_t(y - c) / 2) : 0, A = []; + const x = n.centered ? jt(jt(y - c) / 2) : 0, A = []; for (const { section: I, lines: O, cellX: T, cellJoins: R, left: M, top: F } of N) { - let B = 0; + let _ = 0; for (const $ of O) { - B = _t(B + $.ascent); - const D = _t(_t(B + F) - x); - B = _t(B - $.descent); - const _ = []; - if ($.begin >= 0) if (f) T.forEach((L, j) => { + _ = jt(_ + $.ascent); + const D = jt(jt(_ + F) - x); + _ = jt(_ - $.descent); + const B = []; + if ($.begin >= 0) if (d) T.forEach((L, j) => { const H = I.units[j], Y = R[j]; - for (const ue of $L(I.paragraph, H.grapheme, H.grapheme + 1, k)) _.push({ - ...b(ue, L), + for (const le of $L(I.paragraph, H.grapheme, H.grapheme + 1, k)) B.push({ + ...b(le, L), width: v(I, H, Y, k), joinsPrevious: Y.previous, joinsNext: Y.next @@ -34375,11 +34406,11 @@ function WN(e, t, n) { let L = zL(o, l, $.width); const j = I.units[$.begin].grapheme, H = I.units[$.end].grapheme + 1; for (const Y of $L(I.paragraph, j, H, k)) - _.push(b(Y, _t(_t(L - M) + M))), L = _t(L + Y.width); + B.push(b(Y, jt(jt(L - M) + M))), L = jt(L + Y.width); } A.push({ - baseline: _t(r.top - D), - runs: _ + baseline: jt(r.top - D), + runs: B }); } } @@ -34387,18 +34418,18 @@ function WN(e, t, n) { fontSize: k, contentHeight: y, lines: A, - rtl: d, + rtl: f, missing: g }; function b(I, O) { - const { font: T, text: R, rtl: M, plain: F, width: B } = I; + const { font: T, text: R, rtl: M, plain: F, width: _ } = I; return { font: T, text: R, rtl: M, plain: F, - x: _t(r.left + O), - width: B, + x: jt(r.left + O), + width: _, joinsPrevious: !1, joinsNext: !1 }; @@ -34406,75 +34437,75 @@ function WN(e, t, n) { function E(I, O, T) { const { units: R } = I; if (R.length === 0) { - const te = S(O), he = C(O); + const ee = S(O), he = C(O); return T?.push({ begin: -1, end: -1, width: 0, - ascent: te, + ascent: ee, descent: he }), { width: 0, - height: _t(te - he) + height: jt(ee - he) }; } - let M = 0, F = 0, B = 0, $ = 0, D = 0, _ = 0, L = 0, j = 0, H = 0, Y = 0, ue = !1, le = 0, pe = 0, ge = !1; - const Me = (te) => { + let M = 0, F = 0, _ = 0, $ = 0, D = 0, B = 0, L = 0, j = 0, H = 0, Y = 0, le = !1, ie = 0, pe = 0, ve = !1; + const _e = (ee) => { T?.push({ begin: M, - end: te, + end: ee, width: $, - ascent: _, + ascent: B, descent: j - }), B = _t(B + _), B = _t(B - j), F = Math.max($, F); + }), _ = jt(_ + B), _ = jt(_ - j), F = Math.max($, F); }; let Be = 0; for (; Be < R.length; ) { - const te = R[Be], he = R[Be > 0 ? Be - 1 : Be]; - _ = Math.max(_, Eu(te.ascent, O)), j = Math.min(j, Eu(te.descent, O)), ge ? !HN(te.code) && !DL(te.code) && (ge = !1) : DL(te.code) ? (ge = !0, ue = !0) : Jge(he.code, te.code) && (ue = !0), ue && (ue = !1, pe > 0 && (le += 1), Y = Be, D = $, L = _, H = j), pe += 1; - const Te = p(I, te, O); - s && l > 0 && _t($ + Te) > l ? (le > 0 && (Be = Y, $ = D, _ = L, j = H), pe === 1 && ($ = Te, Be += 1), Me(Be - 1), M = Be, $ = 0, _ = 0, j = 0, pe = 0, le = 0, ue = !1) : ($ = _t($ + Te), Be += 1); + const ee = R[Be], he = R[Be > 0 ? Be - 1 : Be]; + B = Math.max(B, Cu(ee.ascent, O)), j = Math.min(j, Cu(ee.descent, O)), ve ? !HN(ee.code) && !DL(ee.code) && (ve = !1) : DL(ee.code) ? (ve = !0, le = !0) : Jge(he.code, ee.code) && (le = !0), le && (le = !1, pe > 0 && (ie += 1), Y = Be, D = $, L = B, H = j), pe += 1; + const Te = p(I, ee, O); + s && l > 0 && jt($ + Te) > l ? (ie > 0 && (Be = Y, $ = D, B = L, j = H), pe === 1 && ($ = Te, Be += 1), _e(Be - 1), M = Be, $ = 0, B = 0, j = 0, pe = 0, ie = 0, le = !1) : ($ = jt($ + Te), Be += 1); } - return M <= R.length - 1 && Me(R.length - 1), { + return M <= R.length - 1 && _e(R.length - 1), { width: F, - height: B + height: _ }; } } function zL(e, t, n) { - return e === 1 ? _t(_t(t - n) * 0.5) : e === 2 ? _t(t - n) : 0; + return e === 1 ? jt(jt(t - n) * 0.5) : e === 2 ? jt(t - n) : 0; } function fme(e, t) { const { limit: n, cells: r, multiline: o, password: s } = t, i = QK(e), a = [""]; - let c = 0, l = 0, u = 0, d = 0; - for (let f = 0; f < e.length; ) { - let h = f + 1; + let c = 0, l = 0, u = 0, f = 0; + for (let d = 0; d < e.length; ) { + let h = d + 1; for (; h < e.length && !i[h]; ) h += 1; - const g = h - f; + const g = h - d; if (n > 0 && c + g > n || r > 0 && l >= r) break; - const p = e[f]; + const p = e[d]; if (p === "\r" || p === ` `) { if (o) { const m = p === "\r" ? ` ` : "\r"; - e[h] === m && (h += 1), a.push(""), u += 1, d += 1; + e[h] === m && (h += 1), a.push(""), u += 1, f += 1; } - } else n > 0 && u + g > n || r > 0 && d >= r || (a[a.length - 1] += s ? "*" : p === " " ? " " : e.slice(f, h), u += g, d += 1); - c += g, l += 1, f = h; + } else n > 0 && u + g > n || r > 0 && f >= r || (a[a.length - 1] += s ? "*" : p === " " ? " " : e.slice(d, h), u += g, f += 1); + c += g, l += 1, d = h; } return a; } const WL = /* @__PURE__ */ new Map(); -function sg(e) { +function ig(e) { const t = WL.get(e); if (t) return t; - const { fontFamily: n, fontWeight: r, fontStyle: o } = hm(e), s = { + const { fontFamily: n, fontWeight: r, fontStyle: o } = pm(e), s = { ...Yge(e), fontFamily: n, fontWeight: r, fontStyle: o, - program: vl(e) + program: kl(e) }; return WL.set(e, s), s; } @@ -34512,20 +34543,20 @@ function sH() { if (T1) return T1; const e = j0(); return T1 = { - key: Jl, - ascent: yg.ascent, - descent: yg.descent, + key: Yl, + ascent: bg.ascent, + descent: bg.descent, standard: !1, covers: (t) => t >= 32 && (t < 55296 || t > 57343), width: (t) => { let n = 0; for (const r of t) { const o = r.codePointAt(0); - o !== gme && !mme(o) && (n += yg.advance); + o !== gme && !mme(o) && (n += bg.advance); } return n; }, - fontFamily: `"${qa(Jl)}"`, + fontFamily: `"${qa(Yl)}"`, fontWeight: e.weight, fontStyle: e.style, program: e @@ -34533,7 +34564,7 @@ function sH() { } function n5(e) { return { - face: sg(Gf(e ?? "helvetica")), + face: ig(Yf(e ?? "helvetica")), fallbacks: [], lastResort: sH() }; @@ -34650,9 +34681,9 @@ function wme(e) { } return t / 1e3; } -const xl = 9; +const El = 9; function iH(e) { - return wme(e.trimEnd()) * xl; + return wme(e.trimEnd()) * El; } function bs(e) { if (e.subtype === "line" && e.intent === "line-dimension") @@ -34692,14 +34723,14 @@ function r5(e) { subject: vme[e.intent] }; } -const pm = 2, kme = 7, Ame = 24, Sme = 20; +const gm = 2, kme = 7, Ame = 24, Sme = 20; function Hn(e, t, n) { return { x: e.x + t.x * n, y: e.y + t.y * n }; } -function Bf(e, t, n) { +function Lf(e, t, n) { return (t.x - e.x) * n.x + (t.y - e.y) * n.y; } function o5(e, t) { @@ -34715,7 +34746,7 @@ function xme(e, t) { measure: t.measure, linePoints: e.linePoints }); - return Rm(n) ? n.label : t.contents ?? ""; + return Tm(n) ? n.label : t.contents ?? ""; } function Eme(e, t, n, r, o) { const s = (i, a) => Hn(Hn(e, t, i), n, a); @@ -34729,12 +34760,12 @@ function Eme(e, t, n, r, o) { function Cme(e, t, n, r, o) { if (!o || o.along === 0 && o.perpendicular === 0) return []; - const s = Bf(e, t.center, r), i = Bf(e, t.center, n), a = t.width / 2 + pm, c = t.height / 2 + pm; + const s = Lf(e, t.center, r), i = Lf(e, t.center, n), a = t.width / 2 + gm, c = t.height / 2 + gm; if (Math.abs(s) <= c) return []; if (Math.abs(i) <= a) { - const d = Hn(e, r, s - Math.sign(s) * c); - return [{ from: e, to: d }]; + const f = Hn(e, r, s - Math.sign(s) * c); + return [{ from: e, to: f }]; } const l = Hn(e, r, s), u = Hn(t.center, n, -Math.sign(i) * a); return [ @@ -34752,32 +34783,32 @@ function Ime(e, t, n, r, o, s, i, a, c) { } if (!s || i === "top") return [{ from: e, to: t }]; - const l = Bf(e, s.center, r); - if (Math.abs(l) >= s.height / 2 + pm) + const l = Lf(e, s.center, r); + if (Math.abs(l) >= s.height / 2 + gm) return [{ from: e, to: t }]; - const u = Bf(e, s.center, n), d = s.width / 2 + pm, f = Math.max(0, Math.min(o, u - d)), h = Math.max(0, Math.min(o, u + d)), g = []; - return f > 0 && g.push({ from: e, to: Hn(e, n, f) }), h < o && g.push({ from: Hn(e, n, h), to: t }), g; + const u = Lf(e, s.center, n), f = s.width / 2 + gm, d = Math.max(0, Math.min(o, u - f)), h = Math.max(0, Math.min(o, u + f)), g = []; + return d > 0 && g.push({ from: e, to: Hn(e, n, d) }), h < o && g.push({ from: Hn(e, n, h), to: t }), g; } -function Jf(e, t, n) { +function Qf(e, t, n) { if (e.kind !== "line") return null; - const { start: r, end: o } = p2(e), { along: s, normal: i, length: a } = o5(r, o), c = t.leader?.length ?? 0, l = Hn(r, i, c), u = Hn(o, i, c), d = Hn(l, s, a / 2), f = xme(e, t), h = iH(f), g = !!t.captionEnabled && f.length > 0, p = g && h + 2 * pm + Ame * n > a; + const { start: r, end: o } = p2(e), { along: s, normal: i, length: a } = o5(r, o), c = t.leader?.length ?? 0, l = Hn(r, i, c), u = Hn(o, i, c), f = Hn(l, s, a / 2), d = xme(e, t), h = iH(d), g = !!t.captionEnabled && d.length > 0, p = g && h + 2 * gm + Ame * n > a; let m = null; if (g) { const b = s.x < 0 || s.x === 0 && s.y > 0 ? { x: -s.x, y: -s.y } : s, E = { x: b.y, y: -b.x }, I = t.captionOffset; - let O = Hn(d, s, I?.along ?? 0); + let O = Hn(f, s, I?.along ?? 0); if (O = Hn(O, i, I?.perpendicular ?? 0), t.captionPosition === "top" || p) { - const T = p && c < 0 ? -1 : 1, R = p ? kme : pm; - O = Hn(O, i, T * (xl / 2 + R)); + const T = p && c < 0 ? -1 : 1, R = p ? kme : gm; + O = Hn(O, i, T * (El / 2 + R)); } m = { - text: f, + text: d, center: O, along: b, normal: E, width: h, - height: xl, - bounds: Eme(O, b, E, h, xl) + height: El, + bounds: Eme(O, b, E, h, El) }; } const v = []; @@ -34799,9 +34830,9 @@ function Jf(e, t, n) { t.captionPosition, p, n - ), C = m ? Cme(d, m, s, i, t.captionOffset) : [], k = Math.atan2(s.y, s.x), N = p ? k : k + Math.PI, w = p ? k + Math.PI : k, y = [ - ...Gl(l, N, e.lineEndings?.start, n), - ...Gl(u, w, e.lineEndings?.end, n) + ), C = m ? Cme(f, m, s, i, t.captionOffset) : [], k = Math.atan2(s.y, s.x), N = p ? k : k + Math.PI, w = p ? k + Math.PI : k, y = [ + ...Jl(l, N, e.lineEndings?.start, n), + ...Jl(u, w, e.lineEndings?.end, n) ], x = [ r, o, @@ -34827,7 +34858,7 @@ function Jf(e, t, n) { arrowPlacement: p ? "outside" : "inside", endings: y, selectionPoints: x, - visualBounds: aH(Mt(x), n / 2 + 1) + visualBounds: aH(Lt(x), n / 2 + 1) }; } function aH(e, t) { @@ -34839,10 +34870,10 @@ function aH(e, t) { }; } function Nme(e, t, n) { - const r = Jf(e, t, n); + const r = Qf(e, t, n); if (!r || e.kind !== "line") - return Km(e, { strokeWidth: n }); - const o = Dr(e), s = p2(e).start, i = r.selectionPoints.map((l) => Bt(l, s, -o)), a = aH(Mt(i), n / 2 + 1), c = (l, u) => Bt({ x: l, y: u }, s, o); + return Hm(e, { strokeWidth: n }); + const o = Dr(e), s = p2(e).start, i = r.selectionPoints.map((l) => Dt(l, s, -o)), a = aH(Lt(i), n / 2 + 1), c = (l, u) => Dt({ x: l, y: u }, s, o); return [ c(a.x, a.y), c(a.x + a.width, a.y), @@ -34862,7 +34893,7 @@ function Ome(e, t, n = 0) { const r = e.caption; if (!r) return !1; - const o = Bf(r.center, t, r.along), s = Bf(r.center, t, r.normal); + const o = Lf(r.center, t, r.along), s = Lf(r.center, t, r.normal); return Math.abs(o) <= r.width / 2 + n && Math.abs(s) <= r.height / 2 + n; } const lH = (e) => e ? IR(e.bounds) : []; @@ -34889,7 +34920,7 @@ function qN(e, t) { if (e.kind !== "line") return 0; const { start: n, end: r } = p2(e), { normal: o } = o5(n, r); - return Bf(n, t, o); + return Lf(n, t, o); } function Rme(e, t, n) { if (e.kind !== "line") @@ -34909,13 +34940,13 @@ function Tme(e, t) { ...e.leaderSegments, ...e.captionConnector ].map((r) => ({ kind: "line", a: r.from, b: r.to })); - return Mt([ + return Lt([ ...PR([...n, ...e.endings], t), ...e.caption?.bounds ?? [] ]); } function Mme(e, t, n) { - const r = Jf(e, t, n.strokeWidth); + const r = Qf(e, t, n.strokeWidth); if (!r) return []; const o = { @@ -34947,13 +34978,13 @@ function Mme(e, t, n) { } function uH(e, t) { if (e) { - const n = sg("helvetica"), r = Hn(e.center, e.normal, -xl * 0.33); + const n = ig("helvetica"), r = Hn(e.center, e.normal, -El * 0.33); return [ { kind: "text", at: Hn(r, e.along, -e.width / 2), text: e.text, - fontSize: xl, + fontSize: El, fontFamily: n.fontFamily, program: n.program, rotation: Math.atan2(e.along.y, e.along.x) * 180 / Math.PI, @@ -34963,7 +34994,7 @@ function uH(e, t) { } return []; } -const bg = { x: 0, y: 0 }; +const wg = { x: 0, y: 0 }; function R2(e, t) { return Ba({ subtype: t.intent === "polygon-dimension" ? "polygon" : "polyline", @@ -34974,57 +35005,57 @@ function R2(e, t) { } function Bme(e, t) { const n = R2(e, t); - return Rm(n) ? n.label : n.unavailable === "invalid-geometry" ? "—" : t.contents ?? ""; + return Tm(n) ? n.label : n.unavailable === "invalid-geometry" ? "—" : t.contents ?? ""; } function _me(e, t) { - if (!e.length) return bg; + if (!e.length) return wg; if (!t) { - const u = e.slice(1).map((f, h) => Math.hypot(f.x - e[h].x, f.y - e[h].y)); - let d = u.reduce((f, h) => f + h, 0) / 2; - for (let f = 0; f < u.length; f++) { - const h = u[f]; - if (h > 0 && d <= h) { - const g = d / h; + const u = e.slice(1).map((d, h) => Math.hypot(d.x - e[h].x, d.y - e[h].y)); + let f = u.reduce((d, h) => d + h, 0) / 2; + for (let d = 0; d < u.length; d++) { + const h = u[d]; + if (h > 0 && f <= h) { + const g = f / h; return { - x: e[f].x + g * (e[f + 1].x - e[f].x), - y: e[f].y + g * (e[f + 1].y - e[f].y) - xl / 2 - 2 + x: e[d].x + g * (e[d + 1].x - e[d].x), + y: e[d].y + g * (e[d + 1].y - e[d].y) - El / 2 - 2 }; } - d -= h; + f -= h; } return e[0]; } const n = e[0]; let r = 0, o = 0, s = 0; for (let u = 0; u < e.length; u++) { - const d = { x: e[u].x - n.x, y: e[u].y - n.y }, f = e[(u + 1) % e.length], h = { x: f.x - n.x, y: f.y - n.y }, g = d.x * h.y - h.x * d.y; - r += g, o += (d.x + h.x) * g, s += (d.y + h.y) * g; + const f = { x: e[u].x - n.x, y: e[u].y - n.y }, d = e[(u + 1) % e.length], h = { x: d.x - n.x, y: d.y - n.y }, g = f.x * h.y - h.x * f.y; + r += g, o += (f.x + h.x) * g, s += (f.y + h.y) * g; } if (Math.abs(r) > 1e-8) { const u = { x: n.x + o / (3 * r), y: n.y + s / (3 * r) }; if (vv(u, e)) return u; } - const i = Mt([...e]), a = { x: i.x + i.width / 2, y: i.y + i.height / 2 }, c = []; + const i = Lt([...e]), a = { x: i.x + i.width / 2, y: i.y + i.height / 2 }, c = []; for (let u = 0; u < e.length; u++) { - const d = e[u], f = e[(u + 1) % e.length]; - d.y > a.y != f.y > a.y && c.push( - d.x + (a.y - d.y) * (f.x - d.x) / (f.y - d.y) + const f = e[u], d = e[(u + 1) % e.length]; + f.y > a.y != d.y > a.y && c.push( + f.x + (a.y - f.y) * (d.x - f.x) / (d.y - f.y) ); } - c.sort((u, d) => u - d); + c.sort((u, f) => u - f); let l = -1; for (let u = 1; u < c.length; u += 2) { - const d = c[u] - c[u - 1]; - d > l && (l = d, a.x = (c[u] + c[u - 1]) / 2); + const f = c[u] - c[u - 1]; + f > l && (l = f, a.x = (c[u] + c[u - 1]) / 2); } return a; } function Iv(e, t, n) { if (e.kind !== "poly" || !e.vertices.length) return null; - const r = Dr(e), o = Xhe(e).map((g) => Bt(g, bg, -r)), s = e.captionCenter ? Yhe(e, e.captionCenter) : Bt(_me(o, e.closed), bg, r), i = Bme(e, t), a = iH(i), c = xl, l = Bt({ x: 1, y: 0 }, bg, r), u = { x: l.y, y: -l.x }, d = (g, p) => ({ + const r = Dr(e), o = Xhe(e).map((g) => Dt(g, wg, -r)), s = e.captionCenter ? Yhe(e, e.captionCenter) : Dt(_me(o, e.closed), wg, r), i = Bme(e, t), a = iH(i), c = El, l = Dt({ x: 1, y: 0 }, wg, r), u = { x: l.y, y: -l.x }, f = (g, p) => ({ x: s.x + g * l.x + p * u.x, y: s.y + g * l.y + p * u.y - }), f = t.captionEnabled && i ? { + }), d = t.captionEnabled && i ? { text: i, center: s, along: l, @@ -35032,31 +35063,31 @@ function Iv(e, t, n) { width: a, height: c, bounds: [ - d(-a / 2, -c / 2), - d(a / 2, -c / 2), - d(a / 2, c / 2), - d(-a / 2, c / 2) + f(-a / 2, -c / 2), + f(a / 2, -c / 2), + f(a / 2, c / 2), + f(-a / 2, c / 2) ] - } : null, h = [...Km(e, n), ...f?.bounds ?? []]; - return { caption: f, selectionPoints: h, visualBounds: Mt(h) }; + } : null, h = [...Hm(e, n), ...d?.bounds ?? []]; + return { caption: d, selectionPoints: h, visualBounds: Lt(h) }; } function V0(e, t, n) { - return t.intent === "line-dimension" ? Jf(e, t, n.strokeWidth) : Iv(e, t, n); + return t.intent === "line-dimension" ? Qf(e, t, n.strokeWidth) : Iv(e, t, n); } function dH(e, t, n) { if (t.intent === "line-dimension") return Nme(e, t, n.strokeWidth); const r = Iv(e, t, n); - if (!r) return Km(e, n); - const o = Dr(e), s = Mt( - r.selectionPoints.map((i) => Bt(i, bg, -o)) + if (!r) return Hm(e, n); + const o = Dr(e), s = Lt( + r.selectionPoints.map((i) => Dt(i, wg, -o)) ); return [ { x: s.x, y: s.y }, { x: s.x + s.width, y: s.y }, { x: s.x + s.width, y: s.y + s.height }, { x: s.x, y: s.y + s.height } - ].map((i) => Bt(i, bg, o)); + ].map((i) => Dt(i, wg, o)); } function T2(e, t, n, r) { if (t.intent === "line-dimension") @@ -35071,14 +35102,14 @@ function T2(e, t, n, r) { } const GN = (e) => jx.has(e.subtype); function fH(e) { - const t = Vt(e), n = Wn(e), r = kt(t).rect(t, n), o = bs(e); + const t = Ht(e), n = Wn(e), r = kt(t).rect(t, n), o = bs(e); if (!o) return r; if (o.intent === "line-dimension") { - const i = Jf(t, o, n.strokeWidth); + const i = Qf(t, o, n.strokeWidth); return i ? Tme(i, n.strokeWidth) : r; } const s = Iv(t, o, n)?.caption; - return s ? Mt([...Yr(r), ...s.bounds]) : r; + return s ? Lt([...Qr(r), ...s.bounds]) : r; } function hH(e, t) { const n = u7(e, t); @@ -35109,7 +35140,7 @@ function Ky(e) { source: "baked", annotation: e, apBox: t ?? e.rect, - ...t ? { apRot: Dr(Vt(e)) } : {} + ...t ? { apRot: Dr(Ht(e)) } : {} }; } const pH = (e) => !!e && !E2(e); @@ -35117,7 +35148,7 @@ function i5(e, t) { const n = t.map((o) => e.byId[o]).filter((o) => !!o); if (n.length === 0) return { movable: !1, resizable: !1, rotatable: !1 }; const r = (o) => n.every( - (s) => Ii(e, s) && o(Wt(s.annotation).caps) + (s) => Ii(e, s) && o(Jt(s.annotation).caps) ); return { movable: r((o) => o.groupMovable), @@ -35128,11 +35159,11 @@ function i5(e, t) { function gH(e, t) { const n = e.byId[t]; if (!n) return null; - const r = Tf(n.annotation); + const r = Bf(n.annotation); if (r) return E2(n) ? null : r; for (const o of e.order) { const s = e.byId[o]; - if (s && Tf(s.annotation) === t && pH(s)) return t; + if (s && Bf(s.annotation) === t && pH(s)) return t; } return null; } @@ -35143,7 +35174,7 @@ function mH(e, t) { e.byId[n] && r.push(n); for (const o of e.order) { const s = e.byId[o]; - o !== n && s && Tf(s.annotation) === n && pH(s) && r.push(o); + o !== n && s && Bf(s.annotation) === n && pH(s) && r.push(o); } return r; } @@ -35155,7 +35186,7 @@ function VS(e, t) { return n; } function qn(e) { - const t = Wt(e.annotation).caps, n = !!e.annotation.noZoom || t.noZoom, r = !!e.annotation.noRotate || t.noRotate; + const t = Jt(e.annotation).caps, n = !!e.annotation.noZoom || t.noZoom, r = !!e.annotation.noRotate || t.noRotate; return n || r ? { zoom: n, upright: r } : null; } const yH = (e) => e.kind === "box" || e.kind === "line" || e.kind === "poly" || e.kind === "ink" || e.kind === "text-box" && !e.calloutLine, a5 = (e) => { @@ -35183,7 +35214,7 @@ function c5(e, t, n) { if (!r || !yH(e)) return e; let o = e; r.s !== 1 && (o = I2(o, kC, r.s, r.s)), r.r !== 0 && (o = xv(o, kC, r.r)); - const s = a5(o), i = Bt(s, kC, -r.r); + const s = a5(o), i = Dt(s, kC, -r.r); return N2(o, { x: i.x / r.s - s.x, y: i.y / r.s - s.y @@ -35199,14 +35230,14 @@ function Lme(e, t, n, r) { const s = { x: e.x + e.width / 2, y: e.y + e.height / 2 }, i = { x: t.x + (s.x - t.x) / o.s, y: t.y + (s.y - t.y) / o.s - }, a = o.r !== 0 ? Bt(i, t, zn(-o.r)) : i, c = e.width / o.s, l = e.height / o.s; + }, a = o.r !== 0 ? Dt(i, t, zn(-o.r)) : i, c = e.width / o.s, l = e.height / o.s; return { box: { x: a.x - c / 2, y: a.y - l / 2, width: c, height: l }, rot: zn(-o.r) }; } function Fa(e, t, n) { - const r = n?.style ?? Wn(e.annotation), o = n?.measure ?? bs(e.annotation), s = qn(e), i = Ni(n?.geometry ?? Vt(e.annotation), s, t), a = l5(r.strokeWidth, s, t), c = o ? dH(i, o, { ...r, strokeWidth: a }) : Km(i, { ...r, strokeWidth: a }); + const r = n?.style ?? Wn(e.annotation), o = n?.measure ?? bs(e.annotation), s = qn(e), i = Ni(n?.geometry ?? Ht(e.annotation), s, t), a = l5(r.strokeWidth, s, t), c = o ? dH(i, o, { ...r, strokeWidth: a }) : Hm(i, { ...r, strokeWidth: a }); return { corners: c, center: { @@ -35217,31 +35248,31 @@ function Fa(e, t, n) { }; } function u5(e, t) { - return ige(Ni(Vt(e.annotation), qn(e), t)); + return ige(Ni(Ht(e.annotation), qn(e), t)); } function wH(e, t) { const n = t.objectNumber, r = [], o = []; for (const s of e.order) { const i = e.byId[s]; - !i || i.annotation.page.objectNumber !== n || KR(i.annotation, e.selected.includes(s)) && (HR(i) || (Wt(i.annotation).caps.paintsBeneath ? r : o).push(s)); + !i || i.annotation.page.objectNumber !== n || KR(i.annotation, e.selected.includes(s)) && (HR(i) || (Jt(i.annotation).caps.paintsBeneath ? r : o).push(s)); } return [...r, ...o]; } const ws = (e, t) => { const n = e.byId[t]; - return !!n && A2(n) && Wt(n.annotation).caps.selectable; -}, vH = (e) => Wt(e.annotation).caps.anchored && Vt(e.annotation).kind === "quads", kH = (e) => Wt(e.annotation).caps.movable && !vH(e), gm = (e, t) => { + return !!n && A2(n) && Jt(n.annotation).caps.selectable; +}, vH = (e) => Jt(e.annotation).caps.anchored && Ht(e.annotation).kind === "quads", kH = (e) => Jt(e.annotation).caps.movable && !vH(e), mm = (e, t) => { const n = e.byId[t]; return !!n && Ii(e, n) && kH(n); }, Dme = (e, t) => { if (!Ii(e, t) || vH(t)) return !1; - const n = Wt(t.annotation).caps; + const n = Jt(t.annotation).caps; return n.resizable || n.vertexEditable; -}, d5 = (e, t) => Ni(Vt(e.annotation), qn(e), t); +}, d5 = (e, t) => Ni(Ht(e.annotation), qn(e), t); function AH(e, t) { const n = Wn(e.annotation), r = bs(e.annotation), o = d5(e, t), s = { ...n, strokeWidth: JN(e, t) }; if (r?.intent === "line-dimension") { - const c = Jf(o, r, s.strokeWidth); + const c = Qf(o, r, s.strokeWidth); if (c) return Pme(c, s.strokeWidth); } const i = r ? V0(o, r, s)?.caption : null, a = mge(o, s, Fme(e)); @@ -35252,8 +35283,8 @@ function jme(e, t, n, r) { return o.kind === "text-box" && uK(o, t, n); } const JN = (e, t) => l5(Wn(e.annotation).strokeWidth, qn(e), t), Fme = (e) => { - const t = Vt(e.annotation); - return Wn(e.annotation).interiorColor != null || t.kind === "quads" || Wt(e.annotation).caps.opaqueBody; + const t = Ht(e.annotation); + return Wn(e.annotation).interiorColor != null || t.kind === "quads" || Jt(e.annotation).caps.opaqueBody; }, qL = (e, t) => t.x >= e.x && t.x <= e.x + e.width && t.y >= e.y && t.y <= e.y + e.height, Vme = (e, t, n) => gge(t, Fa(e, n).corners); function GL(e, t, n) { let r = null, o = 1 / 0; @@ -35272,13 +35303,13 @@ function YL(e, t, n, r) { const o = n / 2 - Ume; return e.filter((s) => { if (!G9.includes(s.id)) return !0; - const i = r ? Bt(t, s.at, -r) : t; + const i = r ? Dt(t, s.at, -r) : t; return Math.abs(i.x - s.at.x) < o && Math.abs(i.y - s.at.y) < o; }); } function Kme(e, t, n) { const r = t.objectNumber, o = e.selected.filter( - (i) => e.byId[i]?.annotation.page.objectNumber === r && ws(e, i) && gm(e, i) + (i) => e.byId[i]?.annotation.page.objectNumber === r && ws(e, i) && mm(e, i) ); if (o.length < 2) return null; const s = []; @@ -35286,7 +35317,7 @@ function Kme(e, t, n) { const a = e.byId[i]; s.push(...Fa(a, n).corners); } - return Mt(s); + return Lt(s); } function SH(e, t, n) { const r = t.objectNumber, o = []; @@ -35294,25 +35325,25 @@ function SH(e, t, n) { const i = e.byId[s]; !i || i.annotation.page.objectNumber !== r || o.push(...Fa(i, n).corners); } - return o.length ? Mt(o) : null; + return o.length ? Lt(o) : null; } function f5(e, t, n, r, o, s, i, a) { const c = t.objectNumber; if (e.selected.length === 1 && ws(e, e.selected[0])) { - const d = e.byId[e.selected[0]]; - if (d.annotation.page.objectNumber === c) { - let f = 1 / 0; - if (r.rotationHandle !== !1 && Wt(d.annotation).caps.rotatable && Ii(e, d)) { - const g = Fa(d, a), p = DS(g.corners, r.knobOffset, s); - f = YN(p.at, n, r.knobTol); + const f = e.byId[e.selected[0]]; + if (f.annotation.page.objectNumber === c) { + let d = 1 / 0; + if (r.rotationHandle !== !1 && Jt(f.annotation).caps.rotatable && Ii(e, f)) { + const g = Fa(f, a), p = DS(g.corners, r.knobOffset, s); + d = YN(p.at, n, r.knobTol); } const h = () => ({ kind: "rotate", - ids: [d.id], - pivot: u5(d, a) + ids: [f.id], + pivot: u5(f, a) }); - if (Dme(e, d)) { - const g = Wn(d.annotation), p = bs(d.annotation), m = d5(d, a), v = p?.intent === "line-dimension" && Jf(m, p, JN(d, a)), S = GK(m, r.handleSize, s), C = v ? cH(v) : jS(m, S), k = !v && S.small && $me(m, n), N = GL( + if (Dme(e, f)) { + const g = Wn(f.annotation), p = bs(f.annotation), m = d5(f, a), v = p?.intent === "line-dimension" && Qf(m, p, JN(f, a)), S = GK(m, r.handleSize, s), C = v ? cH(v) : jS(m, S), k = !v && S.small && $me(m, n), N = GL( k ? YL( C, n, @@ -35322,49 +35353,49 @@ function f5(e, t, n, r, o, s, i, a) { n, r.handleTol ); - if (JL(f, N, n)) return h(); + if (JL(d, N, n)) return h(); const w = p && V0(m, p, { ...g, - strokeWidth: JN(d, a) + strokeWidth: JN(f, a) }); if (w && Ome(w, n, Math.min(2, r.handleTol / 3))) - return { kind: "handle", id: d.id, handle: "caption", cursor: "move" }; + return { kind: "handle", id: f.id, handle: "caption", cursor: "move" }; if (N) return { kind: "handle", - id: d.id, + id: f.id, handle: N.id, cursor: OS(N.cursor, a?.rotation ?? 0) }; - } else if (f !== 1 / 0) return h(); + } else if (d !== 1 / 0) return h(); } } else if (e.selected.length > 1) { - const d = i5(e, e.selected), f = d.rotatable || d.resizable ? SH(e, t, a) : null; - if (f) { + const f = i5(e, e.selected), d = f.rotatable || f.resizable ? SH(e, t, a) : null; + if (d) { const h = e.selected.filter( (m) => e.byId[m]?.annotation.page.objectNumber === c ); let g = 1 / 0; - if (d.rotatable && r.rotationHandle !== !1) { + if (f.rotatable && r.rotationHandle !== !1) { const m = [ - { x: f.x, y: f.y }, - { x: f.x + f.width, y: f.y }, - { x: f.x + f.width, y: f.y + f.height }, - { x: f.x, y: f.y + f.height } + { x: d.x, y: d.y }, + { x: d.x + d.width, y: d.y }, + { x: d.x + d.width, y: d.y + d.height }, + { x: d.x, y: d.y + d.height } ], v = DS(m, r.knobOffset, s); g = YN(v.at, n, r.knobTol); } let p = null; - if (d.resizable) { - const m = wR(f, 0, r.handleSize, s), v = UN(f, m); + if (f.resizable) { + const m = wR(d, 0, r.handleSize, s), v = UN(d, m); p = GL( - m.small && qL(f, n) ? YL(v, n, r.handleSize ?? 0, 0) : v, + m.small && qL(d, n) ? YL(v, n, r.handleSize ?? 0, 0) : v, n, r.handleTol ); } if (JL(g, p, n)) { - const m = { x: f.x + f.width / 2, y: f.y + f.height / 2 }; + const m = { x: d.x + d.width / 2, y: d.y + d.height / 2 }; return { kind: "rotate", ids: h, pivot: m }; } if (p) @@ -35373,35 +35404,35 @@ function f5(e, t, n, r, o, s, i, a) { ids: h, handle: p.id, cursor: OS(p.cursor, a?.rotation ?? 0), - box: f + box: d }; } } const l = wH(e, t); - for (let d = l.length - 1; d >= 0; d--) { - const f = l[d], h = e.byId[f]; - if (!(!h || i?.has(f) || !ws(e, f))) { - if (e.selected.includes(f) && gm(e, f) && Vme(h, n, a)) - return { kind: "annot", id: f }; + for (let f = l.length - 1; f >= 0; f--) { + const d = l[f], h = e.byId[d]; + if (!(!h || i?.has(d) || !ws(e, d))) { + if (e.selected.includes(d) && mm(e, d) && Vme(h, n, a)) + return { kind: "annot", id: d }; if (Ihe(AH(h, a), n, o)) - return { kind: "annot", id: f }; + return { kind: "annot", id: d }; } } const u = Kme(e, t, a); if (u && qL(u, n)) { - for (let d = l.length - 1; d >= 0; d--) - if (e.selected.includes(l[d]) && gm(e, l[d])) - return { kind: "annot", id: l[d] }; + for (let f = l.length - 1; f >= 0; f--) + if (e.selected.includes(l[f]) && mm(e, l[f])) + return { kind: "annot", id: l[f] }; } return { kind: "empty" }; } function Hme(e, t, n, r, o, s, i, a) { const c = f5(e, t, n, r, o, s, i, a); - return c.kind === "handle" || c.kind === "group-handle" ? c.cursor : c.kind === "rotate" ? "grab" : c.kind === "annot" ? e.selected.includes(c.id) && gm(e, c.id) ? "move" : "pointer" : null; + return c.kind === "handle" || c.kind === "group-handle" ? c.cursor : c.kind === "rotate" ? "grab" : c.kind === "annot" ? e.selected.includes(c.id) && mm(e, c.id) ? "move" : "pointer" : null; } -const Hm = (e) => e.painter !== void 0 || !Wt(e.annotation).caps.rasterOnly, M2 = (e) => Hm({ annotation: e }) ? "vector" : "baked", QL = (e, t) => Hm({ annotation: e }) && (t || !e.hasAppearance) ? "vector" : "baked"; +const zm = (e) => e.painter !== void 0 || !Jt(e.annotation).caps.rasterOnly, M2 = (e) => zm({ annotation: e }) ? "vector" : "baked", QL = (e, t) => zm({ annotation: e }) && (t || !e.hasAppearance) ? "vector" : "baked"; function $S(e, t) { - if (!Hm(e)) return {}; + if (!zm(e)) return {}; const n = fV( e.annotation, $x(e.annotation, t) @@ -35426,8 +35457,8 @@ function zme(e, t) { } function xH(e, t) { const n = e.byId[t]; - if (!Hm(n)) return n.source; - if (e.editing === t && Vt(n.annotation).kind === "text-box") return "vector"; + if (!zm(n)) return n.source; + if (e.editing === t && Ht(n.annotation).kind === "text-box") return "vector"; const r = e.draft; return (r?.kind === "handle" || r?.kind === "caption" || r?.kind === "leader") && r.id === t || (r?.kind === "rotate" || r?.kind === "group") && r.ids.includes(t) ? "vector" : n.source; } @@ -35437,15 +35468,15 @@ function Wme(e, t) { } function qme(e, t, n, r) { const o = e.byId[t]; - if (Wt(o.annotation).caps.rasterOnly) - return r.kind === "box" && o.annotation.subtype === "widget" ? { box: fm(r.box, r.rotation) } : { + if (Jt(o.annotation).caps.rasterOnly) + return r.kind === "box" && o.annotation.subtype === "widget" ? { box: hm(r.box, r.rotation) } : { box: r.kind === "box" ? Wme(o, r.box) : o.apBox, rot: Dr(r) || void 0 }; if (!o.apBox) return { rot: o.apRot }; const s = Lme( o.apBox, - a5(Vt(o.annotation)), + a5(Ht(o.annotation)), qn(o), n ); @@ -35458,19 +35489,19 @@ function Gme(e, t) { const n = e[0], r = e[e.length - 1], o = r.x - n.x, s = r.y - n.y, i = Math.hypot(o, s); if (i < 3) return [...e]; if (e.reduce((l, u) => { - const d = Math.abs(o * (n.y - u.y) - (n.x - u.x) * s) / i; - return Math.max(l, d); + const f = Math.abs(o * (n.y - u.y) - (n.x - u.x) * s) / i; + return Math.max(l, f); }, 0) / i >= t.deviationThreshold) return [...e]; const c = Math.atan2(Math.abs(s), Math.abs(o)) * (180 / Math.PI); if (c <= t.axisSnapDegrees) { - const l = e.reduce((u, d) => u + d.y, 0) / e.length; + const l = e.reduce((u, f) => u + f.y, 0) / e.length; return [ { x: n.x, y: l }, { x: r.x, y: l } ]; } if (c >= 90 - t.axisSnapDegrees) { - const l = e.reduce((u, d) => u + d.x, 0) / e.length; + const l = e.reduce((u, f) => u + f.x, 0) / e.length; return [ { x: l, y: n.y }, { x: l, y: r.y } @@ -35478,10 +35509,10 @@ function Gme(e, t) { } return [...e]; } -const US = (e, t, n) => Math.max(t, Math.min(n, e)), mm = (e, t) => t ? { +const US = (e, t, n) => Math.max(t, Math.min(n, e)), ym = (e, t) => t ? { x: US(e.x, t.x, t.x + t.width), y: US(e.y, t.y, t.y + t.height) -} : e, ig = (e) => e.zoom != null || e.displayRotation != null ? { zoom: e.zoom ?? 1, rotation: e.displayRotation ?? 0 } : void 0; +} : e, ag = (e) => e.zoom != null || e.displayRotation != null ? { zoom: e.zoom ?? 1, rotation: e.displayRotation ?? 0 } : void 0; function XL(e, t) { let n = 0; for (const r of e) @@ -35515,7 +35546,7 @@ function Jme(e, t, n) { const s = e.byId[o]; s && r.push(...Fa(s, n).corners); } - return r.length ? Mt(r) : null; + return r.length ? Lt(r) : null; } function QN(e, t, n, r, o) { if (!r) return n; @@ -35534,14 +35565,14 @@ const e0 = 3, eD = (e, t) => t ? { x: Math.min(Math.max(e.x, t.x), Math.max(t.x, t.x + t.width - e.width)), y: Math.min(Math.max(e.y, t.y), Math.max(t.y, t.y + t.height - e.height)) } : e; -function wg(e, t, n) { +function vg(e, t, n) { return e === "segment" ? Math.hypot(n.x - t.x, n.y - t.y) >= e0 : Math.abs(n.x - t.x) >= e0 || Math.abs(n.y - t.y) >= e0; } const EH = ({ upright: e, displayRotation: t }) => e && t ? zR(t) : 0; function B2(e, t, n, r, o = {}) { - if (!wg(e, t, n)) + if (!vg(e, t, n)) return r ? CH(t, r, o) : null; - const s = o.pageBox ? mm(t, o.pageBox) : t, i = o.pageBox ? mm(n, o.pageBox) : n; + const s = o.pageBox ? ym(t, o.pageBox) : t, i = o.pageBox ? ym(n, o.pageBox) : n; if (e === "segment") return { kind: "segment", a: s, b: i }; const a = EH(o), c = B0(s, i); return { kind: "box", rect: a % 180 ? d2(c) : c, rot: a }; @@ -35549,11 +35580,11 @@ function B2(e, t, n, r, o = {}) { function CH(e, t, n = {}) { const r = n.upright ? n.displayRotation ?? 0 : 0; if ("length" in t) { - const u = (t.rotation ?? 0) * Math.PI / 180, d = Bt( + const u = (t.rotation ?? 0) * Math.PI / 180, f = Dt( { x: Math.cos(u) * t.length, y: Math.sin(u) * t.length }, { x: 0, y: 0 }, -r - ), f = t.anchor === "start" ? 0 : t.anchor === "end" ? 1 : 0.5, h = { x: e.x - d.x * f, y: e.y - d.y * f }, g = { x: h.x + d.x, y: h.y + d.y }, p = B0(h, g), m = eD(p, n.pageBox), v = m.x - p.x, S = m.y - p.y; + ), d = t.anchor === "start" ? 0 : t.anchor === "end" ? 1 : 0.5, h = { x: e.x - f.x * d, y: e.y - f.y * d }, g = { x: h.x + f.x, y: h.y + f.y }, p = B0(h, g), m = eD(p, n.pageBox), v = m.x - p.x, S = m.y - p.y; return { kind: "segment", a: { x: h.x + v, y: h.y + S }, b: { x: g.x + v, y: g.y + S } }; } const { width: o, height: s } = t, i = EH(n), a = t.anchor === "top-left" ? cge(e, o, s, r) : { x: e.x - o / 2, y: e.y - s / 2, width: o, height: s }, c = i % 180 ? d2(a) : a, l = eD(c, n.pageBox); @@ -35564,7 +35595,7 @@ function CH(e, t, n = {}) { }; } function t0(e, t) { - return Wt(e).family.placed(t, e); + return Jt(e).family.placed(t, e); } function Qme(e) { return { box: e.rect, rotation: e.rot || null }; @@ -35616,9 +35647,9 @@ const OH = { rotationThresholdDeg: 4 }, editable: !0 -}, eye = {}, Qr = (e, t) => e.defaults[t] ?? eye, li = (e, t, n = t) => NH(t, Qr(e, n)); +}, eye = {}, Xr = (e, t) => e.defaults[t] ?? eye, li = (e, t, n = t) => NH(t, Xr(e, n)); function tye(e, t, n) { - return PH(e, t, { ...Qr(e, t), ...n }); + return PH(e, t, { ...Xr(e, t), ...n }); } function PH(e, t, n) { return [{ ...e, defaults: { ...e.defaults, [t]: n } }, []]; @@ -35633,7 +35664,7 @@ function RH(e, t) { const rye = (e) => e === "polygon" || e === "polyline", AC = (e, t) => ({ x: e.x - t.x, y: e.y - t.y }), tD = (e, t, n) => { const r = qn(e); return c5( - n(Ni(Vt(e.annotation), r, t)), + n(Ni(Ht(e.annotation), r, t)), r, t ); @@ -35642,9 +35673,9 @@ const rye = (e) => e === "polygon" || e === "polyline", AC = (e, t) => ({ x: e.x if (r === void 0) throw new Error("annotation-core: the session holds no object number for a new record"); return { kind: "objectNumber", page: t, objectNumber: r }; -}, iu = (e, t) => e.objectNumbers.slice(t); +}, au = (e, t) => e.objectNumbers.slice(t); function Ga(e, t, n, r = {}, o = {}) { - const s = IH(e), i = Pm[s]; + const s = IH(e), i = Rm[s]; return { ...Object.fromEntries( Object.entries(t).filter(([c]) => i.includes(c)) @@ -35717,28 +35748,28 @@ function cye(e, t, n, r = "free-text-callout", o) { return s?.kind !== "create-callout" ? [e, []] : s.step === "box" && s.boxFrom ? [{ ...e, draft: { ...s, boxTo: n.point } }, []] : [{ ...e, draft: { ...s, current: n.point } }, []]; if (s?.kind !== "create-callout" || s.step !== "box" || !s.boxFrom) return [e, []]; - const i = MH(s), a = TH(s), c = li(e, "free-text-callout", s.preset), l = c.subtype === "free-text" ? c.lineEnding : null, u = l && l !== "none" ? l : "open-arrow", d = Ja( + const i = MH(s), a = TH(s), c = li(e, "free-text-callout", s.preset), l = c.subtype === "free-text" ? c.lineEnding : null, u = l && l !== "none" ? l : "open-arrow", f = Ja( e, s.page, Ga( "free-text-callout", - Qr(e, s.preset ?? "free-text-callout"), + Xr(e, s.preset ?? "free-text-callout"), NK(i, a, s.tip, s.knee, u), { intent: "free-text-callout", contents: "" }, s.flags ) - ), f = d.record.id; + ), d = f.record.id; return [ { ...e, - objectNumbers: iu(e, 1), - byId: { ...e.byId, [f]: d.record }, - order: [...e.order, f], - selected: [f], + objectNumbers: au(e, 1), + byId: { ...e.byId, [d]: f.record }, + order: [...e.order, d], + selected: [d], draft: null, - editing: f + editing: d }, - [{ type: "create", id: f, draft: d.draft }] + [{ type: "create", id: d, draft: f.draft }] ]; } function lye(e, t, n, r, o, s) { @@ -35783,10 +35814,10 @@ function lye(e, t, n, r, o, s) { }, l = Wn(a), u = (m) => ({ ...i.measure, leader: { ...i.measure.leader, length: m } - }), d = qN(c, n.point), f = KS( + }), f = qN(c, n.point), d = KS( n.pageBox, - (m) => dH(c, u(d * m), l) - ), h = u(d * f); + (m) => dH(c, u(f * m), l) + ), h = u(f * d); if (t === "move") return [{ ...e, draft: { ...i, measure: h } }, []]; const g = Ja( @@ -35794,7 +35825,7 @@ function lye(e, t, n, r, o, s) { i.page, Ga( "line", - Qr(e, i.preset), + Xr(e, i.preset), c, { ...r5(h), @@ -35807,7 +35838,7 @@ function lye(e, t, n, r, o, s) { return [ { ...e, - objectNumbers: iu(e, 1), + objectNumbers: au(e, 1), byId: { ...e.byId, [p]: g.record }, order: [...e.order, p], selected: [p], @@ -35825,10 +35856,10 @@ function BH(e, t) { { pageBox: t, upright: e.upright, displayRotation: e.displayRotation } ); } -function uye(e, t, n, r, o = n, s, i = !1, a, c, l, u, d) { +function uye(e, t, n, r, o = n, s, i = !1, a, c, l, u, f) { if (t !== "down" && e.draft && "page" in e.draft && e.draft.page.objectNumber !== r.page.objectNumber) return [e, []]; - if (r.pageBox && (r = { ...r, point: mm(r.point, r.pageBox) }), e.draft?.kind === "create-distance" || u?.intent === "line-dimension" && !d) + if (r.pageBox && (r = { ...r, point: ym(r.point, r.pageBox) }), e.draft?.kind === "create-distance" || u?.intent === "line-dimension" && !f) return lye( e, t, @@ -35871,7 +35902,7 @@ function uye(e, t, n, r, o = n, s, i = !1, a, c, l, u, d) { const C = n === "line" ? { kind: "create-line", measure: u, - capture: d, + capture: f, subtype: n, preset: o, page: r.page, @@ -35916,48 +35947,48 @@ function uye(e, t, n, r, o = n, s, i = !1, a, c, l, u, d) { } return [e, []]; } - const f = e.draft; - if (f?.kind !== "create-rect" && f?.kind !== "create-line" && f?.kind !== "create-ink") + const d = e.draft; + if (d?.kind !== "create-rect" && d?.kind !== "create-line" && d?.kind !== "create-ink") return [e, []]; - if (f.kind === "create-ink") { - const C = f.strokes.slice(); + if (d.kind === "create-ink") { + const C = d.strokes.slice(); if (a && C.length) { const N = C.length - 1; C[N] = Gme(C[N], a); } - const k = { ...e, draft: { ...f, strokes: C, drawing: !1 } }; + const k = { ...e, draft: { ...d, strokes: C, drawing: !1 } }; return i ? [k, []] : _H(k); } - const h = li(e, f.subtype, f.preset), g = BH(f, r.pageBox), p = g && t0(h, g); + const h = li(e, d.subtype, d.preset), g = BH(d, r.pageBox), p = g && t0(h, g); if (!p) return [{ ...e, draft: null }, []]; - if (f.kind === "create-line" && f.capture) + if (d.kind === "create-line" && d.capture) return [ { ...e, draft: null }, - [{ type: "captured", tool: f.capture, page: f.page, geometry: p }] + [{ type: "captured", tool: d.capture, page: d.page, geometry: p }] ]; const m = { // A measurement states its intent, scale, caption and leader. - ...f.kind === "create-line" && f.measure ? r5(f.measure) : {}, + ...d.kind === "create-line" && d.measure ? r5(d.measure) : {}, // A free text starts empty, as a plain box. ...p.kind === "text-box" ? { intent: "free-text", contents: "" } : {}, // A drawn link starts at the tool preset's target ('docs-link' style // presets), or dead (`null` — the create-then-edit flow). - ...f.subtype === "link" ? { target: qR(h.subtype === "link" ? h.target : null) } : {} + ...d.subtype === "link" ? { target: qR(h.subtype === "link" ? h.target : null) } : {} }, v = Ja( e, - f.page, + d.page, Ga( - f.subtype, - Qr(e, f.preset ?? f.subtype), + d.subtype, + Xr(e, d.preset ?? d.subtype), p, m, - f.flags + d.flags ) ), S = v.record.id; return [ { ...e, - objectNumbers: iu(e, 1), + objectNumbers: au(e, 1), byId: { ...e.byId, [S]: v.record }, order: [...e.order, S], selected: [S], @@ -35974,14 +36005,14 @@ function _H(e) { const n = t.strokes.flat(); if (!t.strokes.some((i) => i.length >= 2) || n.length === 0) return [{ ...e, draft: null }, []]; - const r = Mt(n); + const r = Lt(n); if (Math.max(r.width, r.height) < e0) return [{ ...e, draft: null }, []]; const o = Ja( e, t.page, Ga( t.subtype, - Qr(e, t.preset ?? t.subtype), + Xr(e, t.preset ?? t.subtype), { kind: "ink", inkList: t.strokes, rotation: 0 }, // The ink highlighter says so: `/IT` is set at create, never changed. t.intent === "ink-highlight" ? { intent: t.intent } : {}, @@ -35991,7 +36022,7 @@ function _H(e) { return [ { ...e, - objectNumbers: iu(e, 1), + objectNumbers: au(e, 1), byId: { ...e.byId, [s]: o.record }, order: [...e.order, s], selected: [s], @@ -36025,7 +36056,7 @@ function LH(e) { t.page, Ga( t.subtype, - Qr(e, t.preset ?? t.subtype), + Xr(e, t.preset ?? t.subtype), o, t.measure ? r5(t.measure) : {}, t.flags @@ -36034,7 +36065,7 @@ function LH(e) { return [ { ...e, - objectNumbers: iu(e, 1), + objectNumbers: au(e, 1), byId: { ...e.byId, [i]: s.record }, order: [...e.order, i], selected: [i], @@ -36050,43 +36081,43 @@ const M1 = 14, SC = (e) => ({ min: { x: e.min.x + t.x, y: e.min.y + t.y }, max: { x: e.max.x + t.x, y: e.max.y + t.y } }), sD = (e, t) => { - const n = Vt(e.byId[t].annotation), r = Wn(e.byId[t].annotation); - return Km(n, r); + const n = Ht(e.byId[t].annotation), r = Wn(e.byId[t].annotation); + return Hm(n, r); }; function fye(e, t, n, r, o, s) { const i = n.objectNumber, a = new Set(t); if (t.some((m) => e.byId[m] && qn(e.byId[m]))) return { delta: r, guides: [] }; - const c = SC(Mt(t.flatMap((m) => sD(e, m)))), l = oD(c, r), u = [ + const c = SC(Lt(t.flatMap((m) => sD(e, m)))), l = oD(c, r), u = [ ...s ? [SC(s)] : [], ...e.order.filter( (m) => !a.has(m) && e.byId[m].annotation.page.objectNumber === i && ws(e, m) && !qn(e.byId[m]) - ).map((m) => SC(Mt(sD(e, m)))) + ).map((m) => SC(Lt(sD(e, m)))) ]; - let d = null, f = null; + let f = null, d = null; for (const m of u) { for (const v of nD(m)) for (const S of nD(l)) { const C = v - S; - Math.abs(C) < o && (!d || Math.abs(C) < Math.abs(d.adjust)) && (d = { adjust: C, at: v, tb: m }); + Math.abs(C) < o && (!f || Math.abs(C) < Math.abs(f.adjust)) && (f = { adjust: C, at: v, tb: m }); } for (const v of rD(m)) for (const S of rD(l)) { const C = v - S; - Math.abs(C) < o && (!f || Math.abs(C) < Math.abs(f.adjust)) && (f = { adjust: C, at: v, tb: m }); + Math.abs(C) < o && (!d || Math.abs(C) < Math.abs(d.adjust)) && (d = { adjust: C, at: v, tb: m }); } } - const h = { x: r.x + (d?.adjust ?? 0), y: r.y + (f?.adjust ?? 0) }, g = oD(c, h), p = []; - return d && p.push({ + const h = { x: r.x + (f?.adjust ?? 0), y: r.y + (d?.adjust ?? 0) }, g = oD(c, h), p = []; + return f && p.push({ axis: "x", - at: d.at, - lo: Math.min(g.min.y, d.tb.min.y) - M1, - hi: Math.max(g.max.y, d.tb.max.y) + M1 - }), f && p.push({ - axis: "y", at: f.at, - lo: Math.min(g.min.x, f.tb.min.x) - M1, - hi: Math.max(g.max.x, f.tb.max.x) + M1 + lo: Math.min(g.min.y, f.tb.min.y) - M1, + hi: Math.max(g.max.y, f.tb.max.y) + M1 + }), d && p.push({ + axis: "y", + at: d.at, + lo: Math.min(g.min.x, d.tb.min.x) - M1, + hi: Math.max(g.max.x, d.tb.max.x) + M1 }), { delta: h, guides: p }; } function hye(e) { @@ -36095,7 +36126,7 @@ function hye(e) { const n = e.byId[t.id], r = n && bs(n.annotation); if (r?.intent !== "line-dimension" || t.delta === 0) return [{ ...e, draft: null }, []]; - const o = Mf(n, { + const o = _f(n, { leader: { ...r.leader, length: (r.leader?.length ?? 0) + t.delta } }); return [{ ...e, draft: null, byId: { ...e.byId, [o.id]: o } }, []]; @@ -36104,11 +36135,11 @@ function hye(e) { const n = e.byId[t.id], r = n && bs(n.annotation); if (!r || !t.delta.x && !t.delta.y) return [{ ...e, draft: null }, []]; const o = Wn(n.annotation), s = T2( - Vt(n.annotation), + Ht(n.annotation), r, t.delta, o - ), i = s.measure.intent === "line-dimension" ? Mf(n, { captionOffset: s.measure.captionOffset }) : dl(n, s.geometry); + ), i = s.measure.intent === "line-dimension" ? _f(n, { captionOffset: s.measure.captionOffset }) : fl(n, s.geometry); return [{ ...e, draft: null, byId: { ...e.byId, [i.id]: i } }, []]; } if (t.kind === "handle") { @@ -36119,7 +36150,7 @@ function hye(e) { if ("unavailable" in i && i.unavailable === "invalid-geometry") return [{ ...e, draft: null }, []]; } - const s = dl(n, r); + const s = fl(n, r); return [{ ...e, byId: { ...e.byId, [t.id]: s }, draft: null }, []]; } if (t.kind === "rotate") { @@ -36134,7 +36165,7 @@ function hye(e) { t.view, (a) => xv(a, t.pivot, n) ); - r[o] = dl(s, i); + r[o] = fl(s, i); } return [{ ...e, byId: r, draft: null }, []]; } @@ -36150,7 +36181,7 @@ function hye(e) { t.view, (c) => I2(c, t.anchor, n, r, M0) ); - o[s] = dl(i, a); + o[s] = fl(i, a); } return [{ ...e, byId: o, draft: null }, []]; } @@ -36158,8 +36189,8 @@ function hye(e) { if (Math.hypot(t.delta.x, t.delta.y) < 0.01) return [{ ...e, draft: null }, []]; const n = { ...e.byId }; for (const r of t.ids) { - const o = n[r], s = Vt(o.annotation); - n[r] = dl(o, N2(s, t.delta)); + const o = n[r], s = Ht(o.annotation); + n[r] = fl(o, N2(s, t.delta)); } return [{ ...e, byId: n, draft: null }, []]; } @@ -36167,7 +36198,7 @@ function hye(e) { } const pye = 180 / Math.PI, iD = (e, t) => Math.atan2(t.y - e.y, t.x - e.x) * pye, gye = (e, t) => (t - e + 540) % 360 - 180; function Ov(e, t) { - const n = iD(t.pivot, t.current) - iD(t.pivot, t.start), r = t.ids.length === 1 ? e.byId[t.ids[0]] : null, o = r ? Dr(Ni(Vt(r.annotation), qn(r), t.view)) : 0, s = zn(o + n); + const n = iD(t.pivot, t.current) - iD(t.pivot, t.start), r = t.ids.length === 1 ? e.byId[t.ids[0]] : null, o = r ? Dr(Ni(Ht(r.annotation), qn(r), t.view)) : 0, s = zn(o + n); if (!e.snap.rotation || t.free) return { delta: n, angle: s, snapped: !1 }; for (const i of e.snap.rotationAngles) { const a = gye(s, zn(i)); @@ -36178,7 +36209,7 @@ function Ov(e, t) { } const mye = (e, t) => t.some((n) => { const r = e.byId[n]; - return !!r && Dr(Vt(r.annotation)) !== 0; + return !!r && Dr(Ht(r.annotation)) !== 0; }); function yye(e, t, n) { return t === "down" ? bye(e, n) : t === "move" ? e.draft ? wye(e, n) : [e, []] : e.draft ? hye(e) : [e, []]; @@ -36192,7 +36223,7 @@ function bye(e, t) { e.hitMargin / (t.scale || 1), t.pageBox, t.inert, - ig(t) + ag(t) ); if (n.kind === "handle" && n.handle === "caption") return [ @@ -36211,7 +36242,7 @@ function bye(e, t) { [] ]; if (n.kind === "handle") { - const r = e.byId[n.id], o = ig(t), s = Ni(Vt(r.annotation), qn(r), o); + const r = e.byId[n.id], o = ag(t), s = Ni(Ht(r.annotation), qn(r), o); return [ { ...e, @@ -36229,7 +36260,7 @@ function bye(e, t) { ]; } if (n.kind === "rotate") { - const r = ig(t); + const r = ag(t); return [ { ...e, @@ -36246,7 +36277,7 @@ function bye(e, t) { ]; } if (n.kind === "group-handle") { - const r = ig(t); + const r = ag(t); return [ { ...e, @@ -36266,20 +36297,20 @@ function bye(e, t) { ]; } if (n.kind === "annot") { - const r = mH(e, n.id), o = e.selected.includes(n.id), s = t.shift ? o ? e.selected.filter((c) => !r.includes(c)) : [...e.selected, ...r.filter((c) => !e.selected.includes(c))] : o ? e.selected : r, a = s.length > 0 && s.every((c) => gm(e, c)) ? { kind: "move", ids: s, start: t.point, delta: { x: 0, y: 0 }, guides: [] } : null; + const r = mH(e, n.id), o = e.selected.includes(n.id), s = t.shift ? o ? e.selected.filter((c) => !r.includes(c)) : [...e.selected, ...r.filter((c) => !e.selected.includes(c))] : o ? e.selected : r, a = s.length > 0 && s.every((c) => mm(e, c)) ? { kind: "move", ids: s, start: t.point, delta: { x: 0, y: 0 }, guides: [] } : null; return [{ ...e, selected: s, draft: a }, []]; } return [{ ...e, selected: [] }, []]; } -const aD = (e, t, n) => mm( +const aD = (e, t, n) => ym( { x: e.x + n.point.x - t.x, y: e.y + n.point.y - t.y }, - n.pageBox && Mt([...Yr(n.pageBox), e]) + n.pageBox && Lt([...Qr(n.pageBox), e]) ); function wye(e, t) { const n = e.draft, r = Yme(e, n); if (r != null && t.page.objectNumber !== r.objectNumber) return [e, []]; if (n.kind === "move") { - const s = ig(t), i = QN( + const s = ag(t), i = QN( e, n.ids, AC(t.point, n.start), @@ -36301,28 +36332,28 @@ function wye(e, t) { ); return [{ ...e, draft: { ...n, delta: c, guides: l } }, []]; } - const o = mm(t.point, t.pageBox); + const o = ym(t.point, t.pageBox); if (n.kind === "leader") { - const s = e.byId[n.id], i = Vt(s.annotation), a = bs(s.annotation), c = qN(i, o) - qN(i, n.start); + const s = e.byId[n.id], i = Ht(s.annotation), a = bs(s.annotation), c = qN(i, o) - qN(i, n.start); if (a?.intent !== "line-dimension") return [{ ...e, draft: { ...n, delta: c } }, []]; - const l = a.leader?.length ?? 0, u = KS(t.pageBox, (d) => { - const f = { ...a.leader, length: l + c * d }; - return Fa(s, void 0, { measure: { ...a, leader: f } }).corners; + const l = a.leader?.length ?? 0, u = KS(t.pageBox, (f) => { + const d = { ...a.leader, length: l + c * f }; + return Fa(s, void 0, { measure: { ...a, leader: d } }).corners; }); return [{ ...e, draft: { ...n, delta: c * u } }, []]; } if (n.kind === "caption") { - const s = e.byId[n.id], i = Vt(s.annotation), a = bs(s.annotation), c = Wn(s.annotation), l = AC(o, n.start), u = a ? ZL(t.pageBox, l, (d) => { - const f = T2(i, a, d, c); - return Fa(s, void 0, f).corners; + const s = e.byId[n.id], i = Ht(s.annotation), a = bs(s.annotation), c = Wn(s.annotation), l = AC(o, n.start), u = a ? ZL(t.pageBox, l, (f) => { + const d = T2(i, a, f, c); + return Fa(s, void 0, d).corners; }) : l; return [{ ...e, draft: { ...n, delta: u } }, []]; } if (n.kind === "handle") { const s = e.byId[n.id], i = jS(n.base).find((u) => u.id === n.handle)?.at ?? o, a = n.start ? aD(i, n.start, t) : o, c = (u) => yge(n.base, n.handle, { x: i.x + u.x, y: i.y + u.y }), l = ZL(t.pageBox, AC(a, i), (u) => { - const d = c(u); - return Fa(s, void 0, { geometry: d }).corners; + const f = c(u); + return Fa(s, void 0, { geometry: f }).corners; }); return [{ ...e, draft: { ...n, current: c(l) } }, []]; } @@ -36341,7 +36372,7 @@ function wye(e, t) { return [e, []]; } function vye(e, t, n) { - const r = mm(n.point, n.pageBox); + const r = ym(n.point, n.pageBox); if (t === "down") return [{ ...e, draft: { kind: "marquee", page: n.page, from: r, to: r } }, []]; if (e.draft?.kind !== "marquee") return [e, []]; @@ -36353,7 +36384,7 @@ function vye(e, t, n) { e.draft.page, B0(e.draft.from, r), n.inert, - ig(n) + ag(n) ), s = n.shift ? kye(e.selected, o) : o; return [{ ...e, selected: s, draft: null }, []]; } @@ -36377,7 +36408,7 @@ function $0(e, t) { const n = []; for (const r of e.order) { const o = e.byId[r]; - o && E2(o) && Tf(o.annotation) === t && n.push(o); + o && E2(o) && Bf(o.annotation) === t && n.push(o); } return n; } @@ -36411,7 +36442,7 @@ function Cye(e, t) { (i) => r.includes(i.subtype) && oS(i.subtype).some((a) => lV(i, a)) )) return null; const s = r.filter( - (i) => su(e, { ...n, subtype: i }) + (i) => iu(e, { ...n, subtype: i }) ); return s.length > 1 ? jpe(s) : null; } @@ -36421,7 +36452,7 @@ function Iye(e, t) { return [...e.slice(0, r), Dpe, ...e.slice(r)]; } function Nye(e, t) { - const n = t.map((s) => Wt(s)), r = Iye(Eye(n), n), o = Cye(e, t); + const n = t.map((s) => Jt(s)), r = Iye(Eye(n), n), o = Cye(e, t); return o ? [o, ...r] : r; } function Oye(e) { @@ -36509,13 +36540,13 @@ function FH(e, t, n, r = []) { if (s <= o) return e; const i = U0(e, o), a = U0(e, s), c = e.paragraphs.map((l, u) => { if (u < i.paragraph || u > a.paragraph) return l; - const d = u === i.paragraph ? i.offset : 0, f = u === a.paragraph ? a.offset : l.runs.reduce((m, v) => m + v.text.length, 0); - if (f <= d) return l; - const h = lD(lD(l, d), f); + const f = u === i.paragraph ? i.offset : 0, d = u === a.paragraph ? a.offset : l.runs.reduce((m, v) => m + v.text.length, 0); + if (d <= f) return l; + const h = lD(lD(l, f), d); let g = 0; const p = h.runs.map((m) => { const v = g; - if (g += m.text.length, v < d || v >= f || m.text.length === 0) return m; + if (g += m.text.length, v < f || v >= d || m.text.length === 0) return m; const S = { ...m.style ?? {}, ...n }; for (const C of r) delete S[C]; return { ...m, style: S }; @@ -36588,9 +36619,9 @@ function jye(e, t) { dir: "ltr" }; } -function Yl(e, t) { +function Ql(e, t) { if (e.subtype === "free-text" && e.richText) return e.richText; - const n = qf(e) ?? { + const n = Jf(e) ?? { fontFamily: "helvetica", fontSize: 12, fontColor: "#000000", @@ -36605,7 +36636,7 @@ function _2(e, t, n) { let r = null; for (const o of t) { const s = (r ?? e.byId)[o]; - if (!s || !su(e, s.annotation)) continue; + if (!s || !iu(e, s.annotation)) continue; const i = n(s); i !== s && (r ?? (r = { ...e.byId }), r[o] = i); } @@ -36613,8 +36644,8 @@ function _2(e, t, n) { } function Fye(e, t) { return [_2(e, Object.keys(t), (r) => { - const { subtype: o, ...s } = t[r.id], i = o === void 0 || su(e, { ...r.annotation, subtype: o }), a = Vye(r.annotation, s); - return Mf(r, i ? { subtype: o, ...a } : a); + const { subtype: o, ...s } = t[r.id], i = o === void 0 || iu(e, { ...r.annotation, subtype: o }), a = Vye(r.annotation, s); + return _f(r, i ? { subtype: o, ...a } : a); }), []]; } const uD = { @@ -36650,7 +36681,7 @@ function Hye(e, t, n) { const s = o.annotation; if (s.subtype !== "free-text") return o; const { body: i, paragraphs: a } = s.richText, c = VH({ paragraphs: a }, (l) => Kye(l, t, n)); - return $ye(i, t) === n && c.paragraphs === a ? o : Mf(o, { + return $ye(i, t) === n && c.paragraphs === a ? o : _f(o, { richText: { body: Uye(i, t, n), paragraphs: c.paragraphs } }); }), []]; @@ -36659,15 +36690,15 @@ function zye(e, t) { const n = [], r = []; for (const o of e.selected) { const s = e.byId[o]; - !s || !Ii(e, s) || !xye(Wt(s.annotation)) || (s.annotation.subtype === "link" ? r.push(o) : n.push({ type: "syncLink", id: o, target: t })); + !s || !Ii(e, s) || !xye(Jt(s.annotation)) || (s.annotation.subtype === "link" ? r.push(o) : n.push({ type: "syncLink", id: o, target: t })); } - return t && !qR(t) ? [e, n] : [_2(e, r, (o) => Mf(o, { target: t })), n]; + return t && !qR(t) ? [e, n] : [_2(e, r, (o) => _f(o, { target: t })), n]; } function Wye(e, t, n) { - return [_2(e, n ?? e.selected, (r) => Mf(r, t)), []]; + return [_2(e, n ?? e.selected, (r) => _f(r, t)), []]; } const KH = (e, t) => { - const { rotatable: n, quarterTurns: r } = Wt(e.annotation).caps; + const { rotatable: n, quarterTurns: r } = Jt(e.annotation).caps; return n || r && t % 90 === 0; }; function HH(e, t, n) { @@ -36684,7 +36715,7 @@ function HH(e, t, n) { o ?? (o = { ...e.byId }); for (const c of i) { const l = o[c]; - o[c] = dl(l, N2(Vt(l.annotation), a)); + o[c] = fl(l, N2(Ht(l.annotation), a)); } } } @@ -36707,8 +36738,8 @@ function qye(e, t, n) { } const s = { ...e.byId }; for (const i of r) { - const a = s[i], c = Vt(a.annotation); - s[i] = dl(a, xv(c, o, t)); + const a = s[i], c = Ht(a.annotation); + s[i] = fl(a, xv(c, o, t)); } return [HH({ ...e, byId: s }, r, n), []]; } @@ -36717,10 +36748,10 @@ function Gye(e, t) { for (const o of e.selected) { const s = n[o]; if (!s || !Ii(e, s) || !KH(s, 0)) continue; - const i = Vt(s.annotation); + const i = Ht(s.annotation); if (Dr(i) === 0) continue; const a = u5(s); - n[o] = dl(s, lge(i, a)), r.push(o); + n[o] = fl(s, lge(i, a)), r.push(o); } return r.length ? [HH({ ...e, byId: n }, r, t), []] : [e, []]; } @@ -36771,12 +36802,12 @@ function Xye(e, t, n, r, o = t, s) { const a = { kind: "quads", quadPoints: i }, c = t === "redact" ? { rect: qK(a) } : {}, l = Ja( e, n, - Ga(t, Qr(e, o), a, c, s) + Ga(t, Xr(e, o), a, c, s) ), u = l.record.id; return [ { ...e, - objectNumbers: iu(e, 1), + objectNumbers: au(e, 1), byId: { ...e.byId, [u]: l.record }, order: [...e.order, u], selected: [u], @@ -36802,7 +36833,7 @@ function Zye(e, t, n, r, o = "replace-text") { t, Ga( "strikeout", - Qr(e, o), + Xr(e, o), { kind: "quads", quadPoints: s }, { intent: "strikeout-text-edit" } ), @@ -36811,7 +36842,7 @@ function Zye(e, t, n, r, o = "replace-text") { return [ { ...e, - objectNumbers: iu(e, 2), + objectNumbers: au(e, 2), byId: { ...e.byId, [c]: a.record, [u]: l.record }, order: [...e.order, c, u], selected: [c, u], @@ -36830,12 +36861,12 @@ function ebe(e, t, n, r) { const s = Ja( e, t, - Ga("caret", Qr(e, "caret"), o, {}, r) + Ga("caret", Xr(e, "caret"), o, {}, r) ), i = s.record.id; return [ { ...e, - objectNumbers: iu(e, 1), + objectNumbers: au(e, 1), byId: { ...e.byId, [i]: s.record }, order: [...e.order, i], selected: [i], @@ -37018,7 +37049,7 @@ function dbe(e, t) { return e.kind === "box" || e.kind === "caret" || e.kind === "text-box" && !e.calloutLine ? zn(t ?? 0) : 0; } function fbe(e, t, n) { - const r = Bt(vn(t), vn(e.box), -e.rotation); + const r = Dt(vn(t), vn(e.box), -e.rotation); return { box: { x: r.x - t.width / 2 - e.box.x, @@ -37030,7 +37061,7 @@ function fbe(e, t, n) { }; } function Hy(e, t = 1) { - const n = { box: e.box, rotation: dbe(e.geometry, e.rot), scale: t }, r = Pd(e.style); + const n = { box: e.box, rotation: dbe(e.geometry, e.rot), scale: t }, r = Td(e.style); return { ...e, frame: n, @@ -37047,7 +37078,7 @@ function g5(e, t) { if (!o || !r) return o; if (r.kind === "caption" && r.id === t) { - const s = Vt(n.annotation), i = Wn(n.annotation); + const s = Ht(n.annotation), i = Wn(n.annotation); return T2(s, o, r.delta, i).measure; } return r.kind === "leader" && r.id === t && o.intent === "line-dimension" ? { @@ -37058,8 +37089,8 @@ function g5(e, t) { } } : o; } -function _f(e, t, n) { - const r = e.byId[t], o = Ni(Vt(r.annotation), qn(r), n), s = e.draft; +function Df(e, t, n) { + const r = e.byId[t], o = Ni(Ht(r.annotation), qn(r), n), s = e.draft; if (s) { if (s.kind === "move" && s.ids.includes(t)) return N2(o, s.delta); @@ -37091,20 +37122,20 @@ function qH(e, t) { }; } function tO(e, t, n, r, o, s, i) { - const a = Ni(n, qn({ annotation: t }), o), c = L2(t, o), l = s && V0(a, s, c), u = qf(t), d = l?.visualBounds ?? $y(a, c); + const a = Ni(n, qn({ annotation: t }), o), c = L2(t, o), l = s && V0(a, s, c), u = Jf(t), f = l?.visualBounds ?? $y(a, c); return Hy( { id: e, ref: null, - subtype: Wt(t).name, + subtype: Jt(t).name, geometry: a, - box: d, + box: f, style: c, ...u ? { text: u } : {}, ...WH(t), ...zH(t), ...s ? { measure: s } : {}, - ...i ? qH(i, d) : {}, + ...i ? qH(i, f) : {}, source: r, selected: !1, rot: Dr(a) @@ -37122,18 +37153,18 @@ function mbe(e, t) { function ybe(e, t, n) { const r = t.objectNumber, o = []; for (const a of wH(e, t)) { - const c = e.byId[a], l = qf(c.annotation), u = _f(e, a, n), d = L2(c.annotation, n), f = qme(e, a, n, u), h = g5(e, a), p = (h && V0(u, h, d))?.visualBounds ?? $y(u, d); + const c = e.byId[a], l = Jf(c.annotation), u = Df(e, a, n), f = L2(c.annotation, n), d = qme(e, a, n, u), h = g5(e, a), p = (h && V0(u, h, f))?.visualBounds ?? $y(u, f); o.push( Hy( { id: a, ref: Sn(c), annotation: c.annotation, - subtype: Wt(c.annotation).name, + subtype: Jt(c.annotation).name, geometry: u, box: p, - apBox: f.box, - style: d, + apBox: d.box, + style: f, ...l ? { text: l } : {}, ...WH(c.annotation), ...zH(c.annotation), @@ -37144,14 +37175,14 @@ function ybe(e, t, n) { selected: e.selected.includes(a), ...e.hovered === a ? { hovered: !0 } : {}, rot: Dr(u), - ...f.rot ? { apRot: f.rot } : {} + ...d.rot ? { apRot: d.rot } : {} }, bH(qn(c), n) ) ); } const s = e.draft; - if ((s?.kind === "create-rect" || s?.kind === "create-line") && s.page.objectNumber === r && wg(s.kind === "create-line" ? "segment" : "box", s.from, s.to)) { + if ((s?.kind === "create-rect" || s?.kind === "create-line") && s.page.objectNumber === r && vg(s.kind === "create-line" ? "segment" : "box", s.from, s.to)) { const a = BH(s), c = { ...li(e, s.subtype, s.preset), ...s.flags }, l = a && t0(c, a); if (l) { const u = s.kind === "create-line" ? s.measure : void 0; @@ -37177,7 +37208,7 @@ function ybe(e, t, n) { inkList: s.strokes, rotation: 0, ...s.drawing ? { drawing: !0 } : {} - }, u = s.kind === "create-distance" || s.kind === "create-poly" ? s.measure : void 0, d = u && V0(l, u, c); + }, u = s.kind === "create-distance" || s.kind === "create-poly" ? s.measure : void 0, f = u && V0(l, u, c); o.push( Hy({ id: xC, @@ -37185,7 +37216,7 @@ function ybe(e, t, n) { measure: u, subtype: s.subtype, geometry: l, - box: d?.visualBounds ?? $y(l, c), + box: f?.visualBounds ?? $y(l, c), style: c, source: "draft", selected: !1 @@ -37193,19 +37224,19 @@ function ybe(e, t, n) { ); } if (s?.kind === "create-callout" && s.page.objectNumber === r) { - const a = li(e, s.subtype, s.preset), c = Wn(a), l = a.subtype === "free-text" ? a.lineEnding : null, u = l && l !== "none" ? l : "open-arrow", d = TH(s), f = s.step === "knee" ? { + const a = li(e, s.subtype, s.preset), c = Wn(a), l = a.subtype === "free-text" ? a.lineEnding : null, u = l && l !== "none" ? l : "open-arrow", f = TH(s), d = s.step === "knee" ? { kind: "line", linePoints: { start: s.tip, end: s.current }, lineEndings: { start: u, end: "none" }, rotation: 0 - } : NK(MH(s), d, s.tip, s.knee, u); + } : NK(MH(s), f, s.tip, s.knee, u); o.push( Hy({ id: xC, ref: null, subtype: s.subtype, - geometry: f, - box: $y(f, c), + geometry: d, + box: $y(d, c), style: c, source: "draft", selected: !1 @@ -37242,8 +37273,8 @@ function bbe(e, t, n) { } function GH(e, t, n) { const r = e.byId[t]; - if (!r || Vt(r.annotation).kind !== "text-box") return null; - const o = _f(e, t, n); + if (!r || Ht(r.annotation).kind !== "text-box") return null; + const o = Df(e, t, n); return o.kind !== "text-box" ? null : { id: t, box: o.box, @@ -37271,7 +37302,7 @@ function JH(e, t, n, r) { const a = e.byId[i]; !a || a.annotation.page.objectNumber !== o || s.push(...Pv(e, i, n(i), r).corners); } - return s.length ? Mt(s) : null; + return s.length ? Lt(s) : null; } function fD(e, t, n, r, o, s) { const i = t.objectNumber, a = e.selected.filter( @@ -37279,7 +37310,7 @@ function fD(e, t, n, r, o, s) { ); if (a.length === 1) { const c = e.byId[a[0]]; - if (!Wt(c.annotation).caps.rotatable || !Ii(e, c)) + if (!Jt(c.annotation).caps.rotatable || !Ii(e, c)) return null; const l = Pv(e, c.id, o(c.id), s); return DS(l.corners, r, n); @@ -37298,14 +37329,14 @@ function YH(e, t, n, r = C2, o) { t, n, r, - (c) => Ni(Vt(e.byId[c].annotation), qn(e.byId[c]), o), + (c) => Ni(Ht(e.byId[c].annotation), qn(e.byId[c]), o), o ); if (!i) return null; const { delta: a } = Ov(e, s); return { - at: Bt(i.at, s.pivot, a), - from: Bt(i.from, s.pivot, a) + at: Dt(i.at, s.pivot, a), + from: Dt(i.from, s.pivot, a) }; } return fD( @@ -37313,7 +37344,7 @@ function YH(e, t, n, r = C2, o) { t, n, r, - (i) => _f(e, i, o), + (i) => Df(e, i, o), o ); } @@ -37324,27 +37355,27 @@ function vbe(e, t, n, r = C2, o, s) { a.push({ kind: "guide", axis: u.axis, at: u.at, lo: u.lo, hi: u.hi }); const c = e.draft?.kind === "rotate" && e.byId[e.draft.ids[0]]?.annotation.page.objectNumber === i ? e.draft : null; if (c) { - const { angle: u } = Ov(e, c), d = n ?? { x: c.pivot.x - 300, y: c.pivot.y - 300, width: 600, height: 600 }, f = []; + const { angle: u } = Ov(e, c), f = n ?? { x: c.pivot.x - 300, y: c.pivot.y - 300, width: 600, height: 600 }, d = []; for (const [h, g] of [ [0, "axis"], [90, "axis"], [u, "indicator"] ]) { - const p = hge(d, c.pivot, h); - p && f.push({ ...p, role: g }); + const p = hge(f, c.pivot, h); + p && d.push({ ...p, role: g }); } - a.push({ kind: "rotate-guides", center: c.pivot, angle: u, lines: f }); + a.push({ kind: "rotate-guides", center: c.pivot, angle: u, lines: d }); } const l = e.selected.filter( (u) => ws(e, u) && e.byId[u].annotation.page.objectNumber === i ); if (l.length === 1) { - const u = e.byId[l[0]], d = _f(e, l[0], o), f = L2(u.annotation, o), h = Wt(u.annotation).caps, g = Dr(d), p = g5(e, u.id), m = p?.intent === "line-dimension" && Jf(d, p, f.strokeWidth), v = Pv(e, u.id, d, o); - if (v.angle !== 0 ? a.push({ kind: "obb", corners: v.corners, angle: v.angle }) : a.push({ kind: "outline", rect: Mt(v.corners) }), !c && Ii(e, u) && (h.resizable || h.vertexEditable)) { - const S = GK(d, s, n), C = e.draft?.kind === "handle" && e.draft.id === u.id ? e.draft.handle : null, k = m ? cH(m) : hD( - jS(d, S), + const u = e.byId[l[0]], f = Df(e, l[0], o), d = L2(u.annotation, o), h = Jt(u.annotation).caps, g = Dr(f), p = g5(e, u.id), m = p?.intent === "line-dimension" && Qf(f, p, d.strokeWidth), v = Pv(e, u.id, f, o); + if (v.angle !== 0 ? a.push({ kind: "obb", corners: v.corners, angle: v.angle }) : a.push({ kind: "outline", rect: Lt(v.corners) }), !c && Ii(e, u) && (h.resizable || h.vertexEditable)) { + const S = GK(f, s, n), C = e.draft?.kind === "handle" && e.draft.id === u.id ? e.draft.handle : null, k = m ? cH(m) : hD( + jS(f, S), C, - () => jS(d, { ...S, small: !1 }) + () => jS(f, { ...S, small: !1 }) ); for (const N of k) a.push({ @@ -37357,11 +37388,11 @@ function vbe(e, t, n, r = C2, o, s) { }); } } else if (l.length > 1 && !c) { - const u = JH(e, t, (d) => _f(e, d, o), o); + const u = JH(e, t, (f) => Df(e, f, o), o); if (u && (a.push({ kind: "outline", rect: u }), i5(e, l).resizable)) { - const f = e.draft?.kind === "group" && e.draft.op === "resize" ? e.draft.handle : null, h = wR(u, 0, s, n), g = hD( + const d = e.draft?.kind === "group" && e.draft.op === "resize" ? e.draft.handle : null, h = wR(u, 0, s, n), g = hD( UN(u, h), - f, + d, () => UN(u, { ...h, small: !1 }) ); for (const p of g) @@ -37370,7 +37401,7 @@ function vbe(e, t, n, r = C2, o, s) { at: p.at, cursor: OS(p.cursor, o?.rotation ?? 0), role: pD(p.id), - active: p.id === f + active: p.id === d }); } } @@ -37386,9 +37417,9 @@ function kbe(e, t, n) { ); if (o.length === 0) return null; const s = o.flatMap( - (i) => Pv(e, i, _f(e, i, n), n).corners + (i) => Pv(e, i, Df(e, i, n), n).corners ); - return Mt(s); + return Lt(s); } function Abe(e, t, n, r) { if (e.draft && !e.draft.kind.startsWith("create-")) return null; @@ -37423,7 +37454,7 @@ function QH(e) { kind: "poly", subtype: t.closed ? "polygon" : "polyline", page: t.page, - bounds: Mt(t.points), + bounds: Lt(t.points), pointCount: t.points.length, minPoints: n, canFinish: t.points.length >= n && (!t.measure || !("unavailable" in R2( @@ -37443,10 +37474,10 @@ function pD(e) { function gD(e, t, n) { const r = e.byId[t]; if (!r) return null; - const o = Pv(e, t, _f(e, t, n), n); - return { page: r.annotation.page, bounds: Mt(o.corners) }; + const o = Pv(e, t, Df(e, t, n), n); + return { page: r.annotation.page, bounds: Lt(o.corners) }; } -const vg = 20, ag = 1, mD = (e) => Number(e.toFixed(3)); +const kg = 20, cg = 1, mD = (e) => Number(e.toFixed(3)); class nO { constructor(t) { this.toPage = t, this.parts = []; @@ -37473,8 +37504,8 @@ class nO { } /** A closed ellipse in the box between two corners: four curves from its top middle. */ ellipse(t, n, r, o) { - const s = (t + r) / 2, i = (n + o) / 2, a = yD * Math.abs(r - t) / 2, c = yD * Math.abs(o - n) / 2, [l, u] = [Math.min(t, r), Math.max(t, r)], [d, f] = [Math.min(n, o), Math.max(n, o)]; - return this.move(s, f).curve(s + a, f, u, i + c, u, i).curve(u, i - c, s + a, d, s, d).curve(s - a, d, l, i - c, l, i).curve(l, i + c, s - a, f, s, f).close(); + const s = (t + r) / 2, i = (n + o) / 2, a = yD * Math.abs(r - t) / 2, c = yD * Math.abs(o - n) / 2, [l, u] = [Math.min(t, r), Math.max(t, r)], [f, d] = [Math.min(n, o), Math.max(n, o)]; + return this.move(s, d).curve(s + a, d, u, i + c, u, i).curve(u, i - c, s + a, f, s, f).curve(s - a, f, l, i - c, l, i).curve(l, i + c, s - a, d, s, d).close(); } get d() { return this.parts.join(" "); @@ -37486,7 +37517,7 @@ function xbe(e) { return 0.299 * n + 0.587 * r + 0.114 * o < 0.45 ? "#ffffff" : "#000000"; } function XH(e, t) { - const n = xbe(e.color), r = { opacity: e.opacity, blend: Pd(e) }; + const n = xbe(e.color), r = { opacity: e.opacity, blend: Td(e) }; return { contrast: n, /** Filled with the colour and outlined, as PDF's `B` (or `B*`, even-odd) paints. */ @@ -37494,11 +37525,11 @@ function XH(e, t) { ...r, fill: e.color ?? void 0, stroke: n, - width: ag * t, + width: cg * t, ...o ? { fillRule: "evenodd" } : {} }), /** Outlined only. */ - outline: (o = ag, s = !1) => ({ + outline: (o = cg, s = !1) => ({ ...r, stroke: n, width: o * t, @@ -37517,18 +37548,18 @@ function XH(e, t) { }; } function ZH(e) { - const t = e.width / vg, n = e.height / vg; + const t = e.width / kg, n = e.height / kg; return { - toPage: (r, o) => ({ x: e.x + r * t, y: e.y + (vg - o) * n }), + toPage: (r, o) => ({ x: e.x + r * t, y: e.y + (kg - o) * n }), pen: Math.sqrt(t * n) }; } const ez = (e, t) => (n, r) => e( - ag / 2 + n / t * (vg - ag), - ag / 2 + r / t * (vg - ag) + cg / 2 + n / t * (kg - cg), + cg / 2 + r / t * (kg - cg) ); function Ebe(e, t, n) { - const { toPage: r, pen: o } = ZH(t), s = XH(n, o), i = () => new nO(r), a = () => new nO(ez(r, vg)), c = (l, u) => ({ kind: "path", d: l.d, paint: u }); + const { toPage: r, pen: o } = ZH(t), s = XH(n, o), i = () => new nO(r), a = () => new nO(ez(r, kg)), c = (l, u) => ({ kind: "path", d: l.d, paint: u }); switch (e) { case "comment": { const l = i().move(0.5, 4.5).line(0.5, 19.5).line(19.5, 19.5).line(19.5, 4.5).line(8.5, 4.5).line(6.5, 0.5).line(4.5, 4.5).line(0.5, 4.5); @@ -37561,7 +37592,7 @@ function Ebe(e, t, n) { } default: { const l = a().move(3.5, 1).line(3.5, 19).line(12.5, 19).line(16.5, 15).line(16.5, 1).close(), u = a().move(12.5, 19).line(12.5, 15).line(16.5, 15); - for (const d of [12, 8.5, 5]) u.move(6, d).line(14, d); + for (const f of [12, 8.5, 5]) u.move(6, f).line(14, f); return [c(l, s.body()), c(u, s.outline())]; } } @@ -37603,9 +37634,9 @@ function Nbe(e, t) { }; } function Obe(e, t, n, r, o) { - const s = Math.max(2, o * 1.5), i = (u, d) => ({ - x: e.x + t.x * u + n.x * d, - y: e.y + t.y * u + n.y * d + const s = Math.max(2, o * 1.5), i = (u, f) => ({ + x: e.x + t.x * u + n.x * f, + y: e.y + t.y * u + n.y * f }), a = (u) => `${zS(u.x)} ${zS(u.y)}`, c = i(s / 2, o); let l = `M ${a(i(0, 0))} Q ${a(c)} ${a(i(s, 0))}`; for (let u = s; u + s <= r + 0.5; u += s) @@ -37623,13 +37654,13 @@ function Pbe(e, t, n) { y: i.lowerRight.y - i.lowerLeft.y }, u = Math.hypot(l.x, l.y); if (u <= 0 || c <= 0) continue; - const d = { x: a.x / c, y: a.y / c }, f = Math.min(2.5, Math.max(0.75, c * 0.06)); + const f = { x: a.x / c, y: a.y / c }, d = Math.min(2.5, Math.max(0.75, c * 0.06)); if (e === "underline") s.push({ kind: "line", - a: { x: i.lowerLeft.x - d.x * f, y: i.lowerLeft.y - d.y * f }, - b: { x: i.lowerRight.x - d.x * f, y: i.lowerRight.y - d.y * f }, - paint: { stroke: r, width: f, opacity: o, blend: Pd(n) } + a: { x: i.lowerLeft.x - f.x * d, y: i.lowerLeft.y - f.y * d }, + b: { x: i.lowerRight.x - f.x * d, y: i.lowerRight.y - f.y * d }, + paint: { stroke: r, width: d, opacity: o, blend: Td(n) } }); else if (e === "strikeout") s.push({ @@ -37642,25 +37673,25 @@ function Pbe(e, t, n) { x: (i.upperRight.x + i.lowerRight.x) / 2, y: (i.upperRight.y + i.lowerRight.y) / 2 }, - paint: { stroke: r, width: f, opacity: o, blend: Pd(n) } + paint: { stroke: r, width: d, opacity: o, blend: Td(n) } }); else if (e === "squiggly") { const h = Math.min(2, Math.max(1, c * 0.08)), g = { x: l.x / u, y: l.y / u }, p = { - x: i.lowerLeft.x - d.x * h, - y: i.lowerLeft.y - d.y * h + x: i.lowerLeft.x - f.x * h, + y: i.lowerLeft.y - f.y * h }; s.push({ kind: "path", // n̂ toward ascent = −(toward baseline) - d: Obe(p, g, { x: -d.x, y: -d.y }, u, h), - paint: { stroke: r, width: f, opacity: o, blend: Pd(n) } + d: Obe(p, g, { x: -f.x, y: -f.y }, u, h), + paint: { stroke: r, width: d, opacity: o, blend: Td(n) } }); } else s.push({ kind: "poly", points: o2(i), closed: !0, - paint: { fill: r, opacity: o, blend: Pd(n) } + paint: { fill: r, opacity: o, blend: Td(n) } }); } return s; @@ -37752,7 +37783,7 @@ function jbe(e) { n.push(...Dbe(r.bounds, e.label, e.text)); return n; } -const Fbe = (e) => e.source !== "baked" || e.lentScene !== void 0 || e.annotation !== void 0 && Hm({ annotation: e.annotation }); +const Fbe = (e) => e.source !== "baked" || e.lentScene !== void 0 || e.annotation !== void 0 && zm({ annotation: e.annotation }); function Vbe(e) { if (e.lentScene) return [...e.lentScene()]; if (e.subtype === "link") return []; @@ -37778,7 +37809,7 @@ function Vbe(e) { const t = e.geometry.kind === "ink", n = e.style.strokeWidth === 0 && Ibe.has(e.subtype), r = CL(e.geometry, e.style).map((o) => { const s = o.kind === "rect" || o.kind === "ellipse" || o.kind === "path" && !t || o.kind === "poly" && o.closed, i = { ...Nbe(e.style, s), - blend: Pd(e.style), + blend: Td(e.style), ...n ? { hairline: !0 } : {} }; return { @@ -37814,7 +37845,7 @@ function n0(e) { const [t] = e.failed; if (t) throw t.error; } -const tz = () => new re("operation-failed", "annotation", "the annotation could not be created"), Ube = (e, t) => { +const tz = () => new te("operation-failed", "annotation", "the annotation could not be created"), Ube = (e, t) => { for (const n of e.result?.items ?? []) if (n.type === "annotations.create" && oe(n.annotation.ref) === t) return n.annotation; @@ -37831,109 +37862,109 @@ async function Va(e) { const t = await e.written; return n0(t), t; } -async function ym(e, t = 0) { +async function bm(e, t = 0) { return (await Va(e)).annotations[t] ?? null; } async function Kbe(e, t = 0) { - const n = await ym(e, t); + const n = await bm(e, t); if (!n) throw tz(); return n.ref; } const Hbe = { noZoom: !0, noRotate: !0 }, bD = { hidden: !0, noZoom: !0, noRotate: !0 }, EC = (e) => ({ x: e.x, y: e.y, width: 20, height: 20 }); function zbe(e, { store: t, authority: n, events: r }, o, s) { - const i = (d, f) => t.applyWhenNumbered([{ type: "create", page: Lt(d), draft: f }]).then((h) => Kbe(h)), a = async (d, f) => { - await e.cancellable(f, Va(t.apply([{ type: "delete", ref: d }]))); - }, c = (d) => { - const f = t.model().byId[oe(d)]; - return !!f && !sm(f.annotation) && x2(f); - }, l = (d, f) => r.threadChanged.emit({ rootRef: d, type: f }); + const i = (f, d) => t.applyWhenNumbered([{ type: "create", page: Ft(f), draft: d }]).then((h) => Kbe(h)), a = async (f, d) => { + await e.cancellable(d, Va(t.apply([{ type: "delete", ref: f }]))); + }, c = (f) => { + const d = t.model().byId[oe(f)]; + return !!d && !im(d.annotation) && x2(d); + }, l = (f, d) => r.threadChanged.emit({ rootRef: f, type: d }); return { api: { comments: { listThreads: () => o.index().threads, - getThread: (d) => o.index().byMember.get(oe(d)) ?? null, + getThread: (f) => o.index().byMember.get(oe(f)) ?? null, onThreadChanged: r.threadChanged.on, - reply: async (d, f, h = {}) => { + reply: async (f, d, h = {}) => { e.assertAllowed("annotations:create", "annotation.comments.reply"); - const g = o.rootRefOf(d), p = o.threadOf(d), m = await t.applyWhenNumbered([ + const g = o.rootRefOf(f), p = o.threadOf(f), m = await t.applyWhenNumbered([ { type: "create", - page: Lt(p.page.objectNumber), + page: Ft(p.page.objectNumber), draft: { subtype: "text", rect: EC(p.root.rect), icon: "comment", - contents: f, + contents: d, reply: { to: p.root.ref }, ...Hbe } } ]), v = await e.cancellable( h.signal, - ym(m) + bm(m) ); if (l(g, "reply"), !v) - throw new re("operation-failed", "annotation", "the reply could not be created"); + throw new te("operation-failed", "annotation", "the reply could not be created"); return { annotation: v }; }, - setText: async (d, f, h = {}) => { - const g = o.rootRefOf(d), p = t.model().byId[oe(d)]; - if (p && sm(p.annotation)) - throw new re( + setText: async (f, d, h = {}) => { + const g = o.rootRefOf(f), p = t.model().byId[oe(f)]; + if (p && im(p.annotation)) + throw new te( "invalid-input", "annotation", "a measurement's text is worked out from its points" ); if (!Sn(p)) - throw new re("not-found", "annotation", `no annotation ${oe(d)}`); + throw new te("not-found", "annotation", `no annotation ${oe(f)}`); await s.update( - d, - { subtype: p.annotation.subtype, contents: f }, + f, + { subtype: p.annotation.subtype, contents: d }, void 0, h ), l(g, "text"); }, - setStatus: async (d, f, h = {}) => { + setStatus: async (f, d, h = {}) => { e.assertAllowed("annotations:create", "annotation.comments.setStatus"); - const g = o.rootRefOf(d), p = o.threadOf(d), m = o.currentUserId(), v = m ? p.review.byReviewer[m] : void 0; + const g = o.rootRefOf(f), p = o.threadOf(f), m = o.currentUserId(), v = m ? p.review.byReviewer[m] : void 0; await e.cancellable( h.signal, i(p.page.objectNumber, { subtype: "text", rect: EC(p.root.rect), reply: { to: v?.ref ?? p.root.ref }, - state: f, + state: d, stateModel: "review", ...bD }) ), l(g, "status"); }, - setMarked: async (d, f, h = {}) => { + setMarked: async (f, d, h = {}) => { e.assertAllowed("annotations:create", "annotation.comments.setMarked"); - const g = o.rootRefOf(d), p = o.threadOf(d); + const g = o.rootRefOf(f), p = o.threadOf(f); await e.cancellable( h.signal, i(p.page.objectNumber, { subtype: "text", rect: EC(p.root.rect), reply: { to: p.root.ref }, - state: f ? "marked" : "unmarked", + state: d ? "marked" : "unmarked", stateModel: "marked", ...bD }) ), l(g, "marked"); }, - delete: async (d, f = {}) => { - const h = o.rootRefOf(d); - await a(d, f.signal), l(h, "deleted"); + delete: async (f, d = {}) => { + const h = o.rootRefOf(f); + await a(f, d.signal), l(h, "deleted"); }, - deleteThread: async (d, f = {}) => { - const h = o.rootRefOf(d), g = o.threadOf(d), p = o.memberRefsOf(g), m = n.blockersOf(h); + deleteThread: async (f, d = {}) => { + const h = o.rootRefOf(f), g = o.threadOf(f), p = o.memberRefsOf(g), m = n.blockersOf(h); if (m.length > 0) return l(h, "deleted"), { deleted: [], failed: m.map((v) => ({ ref: v, error: new Error("delete not permitted") })) }; try { - return await a(h, f.signal), { deleted: p, failed: [] }; + return await a(h, d.signal), { deleted: p, failed: [] }; } catch (v) { return { deleted: [], failed: [{ ref: h, error: v }] }; } finally { @@ -37946,10 +37977,10 @@ function zbe(e, { store: t, authority: n, events: r }, o, s) { canSetStatus: () => n.canCreate(), canSetMarked: () => n.canCreate(), canSetText: c, - canDelete: (d) => n.canDelete(d), - canDeleteThread: (d) => { - const f = o.index().byMember.get(oe(d)) ?? null; - return f !== null && n.canDelete(f.root.ref); + canDelete: (f) => n.canDelete(f), + canDeleteThread: (f) => { + const d = o.index().byMember.get(oe(f)) ?? null; + return d !== null && n.canDelete(d.root.ref); } } } }; } @@ -37957,13 +37988,13 @@ function Wbe(e, { store: t }) { const n = () => e.doc?.security.identity?.userId; let r = null; const o = () => (e.document()?.pages ?? []).map((u) => u.ref.objectNumber).join(","), s = () => { - const u = t.model(), d = []; + const u = t.model(), f = []; for (const m of u.order) { const v = u.byId[m]; - v && Sn(v) && d.push(v.annotation); + v && Sn(v) && f.push(v.annotation); } - const f = ZY(d, { currentUserId: n() }), h = e.document()?.pages ?? [], g = new Map(h.map((m, v) => [m.ref.objectNumber, v])); - f.sort((m, v) => { + const d = ZY(f, { currentUserId: n() }), h = e.document()?.pages ?? [], g = new Map(h.map((m, v) => [m.ref.objectNumber, v])); + d.sort((m, v) => { const S = g.get(m.page.objectNumber) ?? Number.MAX_SAFE_INTEGER, C = g.get(v.page.objectNumber) ?? Number.MAX_SAFE_INTEGER; if (S !== C) return S - C; if (m.root.rect.y !== v.root.rect.y) return m.root.rect.y - v.root.rect.y; @@ -37971,30 +38002,30 @@ function Wbe(e, { store: t }) { return k === null || N === null ? k === N ? 0 : k === null ? -1 : 1 : GP(k, N); }); const p = /* @__PURE__ */ new Map(); - for (const m of f) { + for (const m of d) { p.set(oe(m.root.ref), m); for (const v of m.replies) p.set(oe(v.ref), m); for (const v of m.groupedParts) p.set(oe(v.ref), m); for (const v of m.review.statusRefs) p.set(oe(v), m); } - return { threads: f, byMember: p }; + return { threads: d, byMember: p }; }, i = () => { - const u = t.model(), d = o(), f = n(); - return r && r.byId === u.byId && r.order === u.order && r.layout === d && r.userId === f || (r = { ...s(), byId: u.byId, order: u.order, layout: d, userId: f }), r; + const u = t.model(), f = o(), d = n(); + return r && r.byId === u.byId && r.order === u.order && r.layout === f && r.userId === d || (r = { ...s(), byId: u.byId, order: u.order, layout: f, userId: d }), r; }; return { currentUserId: n, index: i, threadOf: (u) => { - const d = i().byMember.get(oe(u)); - if (!d) throw new Error("[annotation] no comment thread contains this ref"); - return d; + const f = i().byMember.get(oe(u)); + if (!f) throw new Error("[annotation] no comment thread contains this ref"); + return f; }, rootRefOf: (u) => i().byMember.get(oe(u))?.root.ref ?? u, memberRefsOf: (u) => [ - ...u.replies.map((d) => d.ref), - ...u.groupedParts.map((d) => d.ref), + ...u.replies.map((f) => f.ref), + ...u.groupedParts.map((f) => f.ref), ...u.review.statusRefs, u.root.ref // root LAST — children first keeps foreign readers coherent ] }; } -const rz = 100, qbe = 95, Gbe = 55, Jbe = 50, Ybe = 4, B1 = (e) => e === "polygon" || e === "polyline", wD = (e) => e === "free-text-callout", fl = (e, t) => e.project?.(t) ?? (e.page?.ref.objectNumber === t.objectNumber ? e.page.point : null); +const rz = 100, qbe = 95, Gbe = 55, Jbe = 50, Ybe = 4, B1 = (e) => e === "polygon" || e === "polyline", wD = (e) => e === "free-text-callout", hl = (e, t) => e.project?.(t) ?? (e.page?.ref.objectNumber === t.objectNumber ? e.page.point : null); function oz(e, t, n) { n.page && e.canCreate() && !t.hasCursorClaim() ? e.hoverGhostAt( t.getActiveToolId(), @@ -38072,7 +38103,7 @@ function Xbe(e, t) { }, onPointerMove: (r) => { if (!n) return; - const o = fl(r, n.page); + const o = hl(r, n.page); o && (n.point = o, e.editPointer( "move", n.page, @@ -38088,7 +38119,7 @@ function Xbe(e, t) { n && (e.editPointer( "up", n.page, - fl(r, n.page) ?? n.point, + hl(r, n.page) ?? n.point, !1, void 0, void 0, @@ -38134,7 +38165,7 @@ function Zbe(e) { }, n = { page: s.page.ref, point: s.page.point }, o = { scale: s.page.scale, rotation: s.page.rotation, zoom: s.page.zoom }, r = !1, !0) : !1, onPointerMove: (s) => { if (!t) return; - const i = fl(s, t.page); + const i = hl(s, t.page); if (i) { if (n = { page: t.page, point: i }, !r) { if (Math.hypot(s.viewport.x - t.vx, s.viewport.y - t.vy) < Ybe) @@ -38198,15 +38229,15 @@ function ewe(e, t) { priority: Gbe, enabledFor: (c) => c.enables.has("annotation-draw"), onPointerDown: (c) => { - const l = n(), u = r(l), d = e.getDistanceCreationPage?.(); - if (d != null) { - const f = fl(c, d); - return f && e.createPointer(l, "down", d, f), a = null, !0; + const l = n(), u = r(l), f = e.getDistanceCreationPage?.(); + if (f != null) { + const d = hl(c, f); + return d && e.createPointer(l, "down", f, d), a = null, !0; } if (!c.page) return !1; if (a = { page: c.page.ref, point: c.page.point }, B1(u)) { - const f = (c.clickCount ?? 1) >= 2; - return e.createPointer(l, "down", c.page.ref, c.page.point, f), o = !f, i = f ? null : c.page.ref, !0; + const d = (c.clickCount ?? 1) >= 2; + return e.createPointer(l, "down", c.page.ref, c.page.point, d), o = !d, i = d ? null : c.page.ref, !0; } return o = !1, wD(u) ? (s = !0, i = c.page.ref) : i = null, e.createPointer( l, @@ -38220,27 +38251,27 @@ function ewe(e, t) { onPointerMove: (c) => { const l = n(), u = r(l); if (!a || B1(u) && !o) return; - const d = fl(c, a.page); - d && (a.point = d, e.createPointer(l, "move", a.page, d)); + const f = hl(c, a.page); + f && (a.point = f, e.createPointer(l, "move", a.page, f)); }, onPointerUp: (c) => { const l = n(), u = r(l); - a && !B1(u) && e.createPointer(l, "up", a.page, fl(c, a.page) ?? a.point), a = null, e.clearGhost(); + a && !B1(u) && e.createPointer(l, "up", a.page, hl(c, a.page) ?? a.point), a = null, e.clearGhost(); }, onPointerCancel: () => { o = !1, s = !1, i = null, a = null, e.draft.cancel(), e.clearGhost(); }, onHover: (c) => { oz(e, t, c); - const l = n(), u = r(l), d = e.getDistanceCreationPage?.(); - if (d != null) { - const f = fl(c, d); - f && e.createPointer(l, "move", d, f); + const l = n(), u = r(l), f = e.getDistanceCreationPage?.(); + if (f != null) { + const d = hl(c, f); + d && e.createPointer(l, "move", f, d); return; } if (i && (o && B1(u) || s && wD(u))) { - const f = fl(c, i); - f && e.createPointer(l, "move", i, f); + const d = hl(c, i); + d && e.createPointer(l, "move", i, d); } } }; @@ -38263,7 +38294,7 @@ function twe(e, t, n) { }); } function nwe(e, t) { - const n = e.get(Cn), r = e.tryGet(ja), o = e.tryGet(Dm); + const n = e.get(Cn), r = e.tryGet(ja), o = e.tryGet(jm); o && e.cleanup( o.registerAnnotCommitSink((s) => t.commitScriptEffects(s)) ); @@ -38289,7 +38320,7 @@ function nwe(e, t) { e.listen(n.onToolChanged, () => { t.finishInkDraft(), t.cancel(), t.clearGhost(), t.hoverGhostIn(null), t.pruneEngagedSelection(); const s = n.getActiveTool(); - s.id !== Vd && !s.enables.has("annotation-stamp") && t.stamps.disarm(); + s.id !== Ud && !s.enables.has("annotation-stamp") && t.stamps.disarm(); }), r && twe(t, r, n); } const rwe = () => ({ @@ -38349,7 +38380,7 @@ function iwe(e, { store: t, records: n, lending: r }) { ); }, c = (w) => w.map((y) => y.annotation); let l = null; - const u = /* @__PURE__ */ new Map(), d = (w) => { + const u = /* @__PURE__ */ new Map(), f = (w) => { const y = t.model(); if (!w || !w.pages && w.subtype === void 0) return l?.model !== y && (l = { model: y, v: c(a()) }), l.v; @@ -38362,18 +38393,18 @@ function iwe(e, { store: t, records: n, lending: r }) { } return c(a(w)); }; - let f = null; + let d = null; return { get: o, listAnnots: a, listSelected: () => { const w = t.model(); - return f?.model !== w && (f = { + return d?.model !== w && (d = { model: w, v: c( w.selected.map((y) => w.byId[y]).filter((y) => !!y) ) - }), f.v; + }), d.v; }, getEditing: () => { const w = t.model(); @@ -38382,7 +38413,7 @@ function iwe(e, { store: t, records: n, lending: r }) { loadedOrThrow: (w) => { const y = t.model().byId[oe(w)]; if (!y) - throw new re("not-found", "annotation", "annotation is not loaded in this document"); + throw new te("not-found", "annotation", "annotation is not loaded in this document"); return y; }, selectedRecords: () => { @@ -38390,19 +38421,19 @@ function iwe(e, { store: t, records: n, lending: r }) { return w.selected.map((y) => w.byId[y]).filter((y) => !!y); }, pageOf: (w) => t.model().byId[oe(w)]?.annotation.page ?? w.page, - api: { get: o, list: d, isPending: s, getHovered: () => { + api: { get: o, list: f, isPending: s, getHovered: () => { const w = t.model(); return w.hovered ? w.byId[w.hovered]?.annotation ?? null : null; }, isEditable: (w) => { const y = t.model(), x = y.byId[oe(w)]; - return !!x && su(y, x.annotation); + return !!x && iu(y, x.annotation); }, isMovable: (w) => { const y = t.model().byId[oe(w)]; return !!y && kH(y); } } }; } -const Id = (e, t) => e != null || t != null ? { zoom: e ?? 1, rotation: t ?? 0 } : void 0; +const Od = (e, t) => e != null || t != null ? { zoom: e ?? 1, rotation: t ?? 0 } : void 0; function awe(e) { const t = (s) => e.document()?.pages.find((i) => i.ref.objectNumber === s), n = (s) => t(s)?.size ?? null; return { sizeOf: n, cropOf: (s) => t(s)?.pdfCropBox ?? null, pageBoxOf: (s) => { @@ -38436,7 +38467,7 @@ function cwe(e, { c(A.scale), n.pageBoxOf(O), E === void 0 ? r.engagedIdsOn(O) : E ?? void 0, - Id(A.zoom, A.rotation) + Od(A.zoom, A.rotation) ); }, u = (y, x, A = {}) => { const b = l(y, x, A, 1, null), E = b.kind === "annot" || b.kind === "handle" ? b.id : null, I = E != null ? t.model().byId[E] : void 0; @@ -38444,10 +38475,10 @@ function cwe(e, { I, x, i(A.scale).handleTol, - Id(A.zoom, A.rotation) + Od(A.zoom, A.rotation) ) ? E : null; - }, d = /* @__PURE__ */ new Map(), f = (y, x, A, b) => { - const E = y.objectNumber, I = t.model(), O = s(), T = d.get(E); + }, f = /* @__PURE__ */ new Map(), d = (y, x, A, b) => { + const E = y.objectNumber, I = t.model(), O = s(), T = f.get(E); if (T && T.model === I && T.cs === O && T.scale === x && T.rotation === A && T.zoom === b) return T.v; const R = i(x); @@ -38456,10 +38487,10 @@ function cwe(e, { y, n.pageBoxOf(E), R.knobOffset, - Id(b, A), + Od(b, A), R.handleSize ); - return O.guides.enabled || (M = M.filter((F) => F.kind !== "rotate-guides")), O.rotationHandle.enabled || (M = M.filter((F) => F.kind !== "rotate-knob")), d.set(E, { model: I, cs: O, scale: x, rotation: A, zoom: b, v: M }), M; + return O.guides.enabled || (M = M.filter((F) => F.kind !== "rotate-guides")), O.rotationHandle.enabled || (M = M.filter((F) => F.kind !== "rotate-knob")), f.set(E, { model: I, cs: O, scale: x, rotation: A, zoom: b, v: M }), M; }; let h = null; const g = (y, x, A) => { @@ -38470,7 +38501,7 @@ function cwe(e, { b, (T) => n.pageBoxOf(T.objectNumber), () => i(y).knobOffset, - () => Id(A, x) + () => Od(A, x) ), O = I ? { page: I.page, bounds: I.bounds, @@ -38517,13 +38548,13 @@ function cwe(e, { selectionAnchor: () => g(), rotationAnchor: () => N(), api: { - listChromeNodes: (y, x, A, b) => f(y, x, A, b), + listChromeNodes: (y, x, A, b) => d(y, x, A, b), getSelectionAnchorIn: (y) => g(y.scale, y.rotation, y.zoom), getAnnotationAnchor: (y, x) => S(y, x), getHitKind: (y, x, A, b, E, I) => l(y, x, { scale: A, rotation: b, zoom: E }, a(I)).kind, claimsTouchAt: (y, x, A, b, E) => { const I = t.model(), O = l(y, x, { scale: A, rotation: b, zoom: E }, ED); - return O.kind === "handle" || O.kind === "rotate" || O.kind === "group-handle" ? !0 : O.kind === "annot" ? I.selected.includes(O.id) && I.selected.every((T) => gm(I, T)) : !1; + return O.kind === "handle" || O.kind === "rotate" || O.kind === "group-handle" ? !0 : O.kind === "annot" ? I.selected.includes(O.id) && I.selected.every((T) => mm(I, T)) : !1; }, getCursorAt: (y, x, A, b, E) => { const I = y.objectNumber, O = t.model(); @@ -38535,7 +38566,7 @@ function cwe(e, { c(A), n.pageBoxOf(I), r.engagedIdsOn(I), - Id(E, b) + Od(E, b) ); } } @@ -38552,10 +38583,10 @@ const CD = [ function lwe(e, t) { const n = e.weight ?? 400, r = e.italic ?? !1; return UP({ family: e.family, weight: n, italic: r }, (o) => { - const s = Cf(o); + const s = Nf(o); let i; for (const a of t?.() ?? []) { - if (Cf(a.familyName) !== s) continue; + if (Nf(a.familyName) !== s) continue; const c = Math.abs(a.weight - n) + (a.italic === r ? 0 : 1e3); (!i || c < i.score) && (i = { key: a.key, score: c }); } @@ -38566,7 +38597,7 @@ const uwe = (e) => e.trim().toUpperCase(); function dwe(e, t, n) { return { richText: { - paragraphs: az(t, Yl(e.annotation, n).body) + paragraphs: az(t, Ql(e.annotation, n).body) } }; } @@ -38617,11 +38648,11 @@ function hwe(e, t) { if (r <= n) return []; const o = U0(e, n), s = U0(e, r), i = []; for (let a = o.paragraph; a <= s.paragraph; a++) { - const c = e.paragraphs[a], l = a === o.paragraph ? o.offset : 0, u = a === s.paragraph ? s.offset : c.runs.reduce((f, h) => f + h.text.length, 0); - let d = 0; - for (const f of c.runs) { - const h = d + f.text.length; - h > l && d < u && f.text.length > 0 && i.push(f.style ?? {}), d = h; + const c = e.paragraphs[a], l = a === o.paragraph ? o.offset : 0, u = a === s.paragraph ? s.offset : c.runs.reduce((d, h) => d + h.text.length, 0); + let f = 0; + for (const d of c.runs) { + const h = f + d.text.length; + h > l && f < u && d.text.length > 0 && i.push(d.style ?? {}), f = h; } } return i; @@ -38642,7 +38673,7 @@ function cz(e, t, n) { decoration: c.decoration ?? e.decoration }), o = (t.length ? t : [{}]).map(r), s = {}, i = [], a = (c, l) => { const u = l(o[0]); - s[c] = u, o.some((d) => JSON.stringify(l(d)) !== JSON.stringify(u)) && i.push(c); + s[c] = u, o.some((f) => JSON.stringify(l(f)) !== JSON.stringify(u)) && i.push(c); }; return a( "fontFamily", @@ -38675,38 +38706,38 @@ function uz(e, t) { } function ywe(e, { store: t, fonts: n }) { const r = (u) => { - const d = e.state.get().textSelection; - return d && u.editing === d.id && u.byId[d.id] ? d : null; + const f = e.state.get().textSelection; + return f && u.editing === f.id && u.byId[f.id] ? f : null; }, o = (u) => { - const d = r(u); - return d && d.end > d.start ? d : null; + const f = r(u); + return f && f.end > f.start ? f : null; }, s = (u) => { - const d = r(u); - return d && d.end === d.start ? d : null; - }, i = (u, d) => { - const f = d.annotation, h = qf(f); + const f = r(u); + return f && f.end === f.start ? f : null; + }, i = (u, f) => { + const d = f.annotation, h = Jf(d); return { - data: f, + data: d, ...h ? { text: h } : {}, // Parents store no link: the committed children are the truth, read // through the lens. A link annotation reads its own target. - link: f.subtype === "link" ? f.target ?? null : XN(u, d.id) + link: d.subtype === "link" ? d.target ?? null : XN(u, f.id) }; - }, a = (u, d) => { - if (d.annotation.subtype !== "free-text") return null; - const f = Yl(d.annotation, n), h = r(u); - return h?.id !== d.id ? ID(f, { start: 0, end: Oye(f) }, n) : h.end > h.start ? ID(f, h, n) : pwe(f, h.start, h.typing, n); + }, a = (u, f) => { + if (f.annotation.subtype !== "free-text") return null; + const d = Ql(f.annotation, n), h = r(u); + return h?.id !== f.id ? ID(d, { start: 0, end: Oye(d) }, n) : h.end > h.start ? ID(d, h, n) : pwe(d, h.start, h.typing, n); }; let c = null; return { activeTextRange: o, activeCaret: s, selectionPropertiesOf: () => { - const u = t.model(), d = r(u); - if (c && c.model === u && c.selection === d) return c.v; - const f = u.selected.map((k) => u.byId[k]).filter( - (k) => !!k && su(u, k.annotation) + const u = t.model(), f = r(u); + if (c && c.model === u && c.selection === f) return c.v; + const d = u.selected.map((k) => u.byId[k]).filter( + (k) => !!k && iu(u, k.annotation) ), h = Nye( u, - f.map((k) => k.annotation) - ), g = f.map((k) => i(u, k)), p = f.map((k) => a(u, k)), m = (k, N) => { + d.map((k) => k.annotation) + ), g = d.map((k) => i(u, k)), p = d.map((k) => a(u, k)), m = (k, N) => { const w = p[N]; return w && CD.includes(k.key) ? w.values[k.key] : lz(k, g[N]); }, v = g.length ? uz(h, g[0]) : {}, S = []; @@ -38717,7 +38748,7 @@ function ywe(e, { store: t, fonts: n }) { (g.some((y, x) => JSON.stringify(m(k, x)) !== w) || N && p.some((y) => y?.mixed.includes(k.key))) && S.push(k.key); } const C = { properties: h, values: v, mixed: S }; - return c = { model: u, selection: d, v: C }, C; + return c = { model: u, selection: f, v: C }, C; } }; } function bwe(e, t, n, r) { @@ -38728,7 +38759,7 @@ function wwe(e, t, n, r) { return o && dz(e, o, r); } function dz(e, t, n) { - const r = e.byId[t.id], o = (r && qf(r.annotation)) ?? Sye, s = r ? Wn(r.annotation).strokeWidth : 0, i = r ? Yl(r.annotation, n?.lookup) : null, a = i ? { family: i.body.family, weight: i.body.weight, italic: i.body.italic } : { family: "Helvetica", weight: 400, italic: !1 }, c = n?.text.bodyCss(t.id, o, a) ?? hm(Gf(o.fontFamily)); + const r = e.byId[t.id], o = (r && Jf(r.annotation)) ?? Sye, s = r ? Wn(r.annotation).strokeWidth : 0, i = r ? Ql(r.annotation, n?.lookup) : null, a = i ? { family: i.body.family, weight: i.body.weight, italic: i.body.italic } : { family: "Helvetica", weight: 400, italic: !1 }, c = n?.text.bodyCss(t.id, o, a) ?? pm(Yf(o.fontFamily)); return { id: t.id, ref: Sn(r), @@ -38770,7 +38801,7 @@ function vwe(e, t, n, r, o) { italic: c.italic ?? n.italic }); for (const u of l.programs) - s.some((d) => d.hash === u.hash) || s.push(u); + s.some((f) => f.hash === u.hash) || s.push(u); } return s; } @@ -38782,71 +38813,71 @@ function kwe(e, { fonts: s, textFonts: i }, a, c) { - const l = /* @__PURE__ */ new Map(), u = () => e.tryGet(Xa), d = (I) => { + const l = /* @__PURE__ */ new Map(), u = () => e.tryGet(Xa), f = (I) => { if (!I.hovered || !I.label) return I; const O = u()?.getPaintFonts( I.text?.fontFamily ?? "helvetica", I.label.text ); return O ? { ...I, label: { ...I.label, fonts: O } } : I; - }, f = (I, O) => { - const T = I.objectNumber, R = t(T), M = e.state.get(), F = M.ghostAt?.page.objectNumber === T ? M.ghostAt : null, B = M.placing?.page.objectNumber === T ? M.placing : null, $ = u()?.getPaintFontsEpoch() ?? 0, D = l.get(T); - if (D && D.model === R && D.ghostAt === F && D.placing === B && D.zoom === O?.zoom && D.rotation === O?.rotation && D.fontsEpoch === $) + }, d = (I, O) => { + const T = I.objectNumber, R = t(T), M = e.state.get(), F = M.ghostAt?.page.objectNumber === T ? M.ghostAt : null, _ = M.placing?.page.objectNumber === T ? M.placing : null, $ = u()?.getPaintFontsEpoch() ?? 0, D = l.get(T); + if (D && D.model === R && D.ghostAt === F && D.placing === _ && D.zoom === O?.zoom && D.rotation === O?.rotation && D.fontsEpoch === $) return D.v; - const _ = [ - ...ybe(R, I, O).map(d), + const B = [ + ...ybe(R, I, O).map(f), ...a.itemsOn(T, R, O) ]; return l.set(T, { model: R, ghostAt: F, - placing: B, + placing: _, zoom: O?.zoom, rotation: O?.rotation, fontsEpoch: $, - v: _ - }), _; + v: B + }), B; }, h = /* @__PURE__ */ new Map(), g = (I, O) => { const T = I.objectNumber, R = t(T), M = i.version(), F = h.get(T); if (F && F.model === R && F.zoom === O?.zoom && F.rotation === O?.rotation && F.fonts === M) return F.v; - const B = bwe(R, I, O, { lookup: s, text: i }); + const _ = bwe(R, I, O, { lookup: s, text: i }); return h.set(T, { model: R, zoom: O?.zoom, rotation: O?.rotation, fonts: M, - v: B - }), B; + v: _ + }), _; }, p = /* @__PURE__ */ new Map(), m = (I, O) => { const T = oe(I), R = t(I.page.objectNumber), M = i.version(), F = p.get(T); if (F && F.model === R && F.zoom === O?.zoom && F.rotation === O?.rotation && F.fonts === M) return F.v; - const B = wwe(R, T, O, { lookup: s, text: i }); - return p.set(T, { model: R, zoom: O?.zoom, rotation: O?.rotation, fonts: M, v: B }), B; + const _ = wwe(R, T, O, { lookup: s, text: i }); + return p.set(T, { model: R, zoom: O?.zoom, rotation: O?.rotation, fonts: M, v: _ }), _; }, v = /* @__PURE__ */ new Map(), S = (I) => { const O = t(I), T = v.get(I); if (T && T.model === O) return T.v; const R = []; for (const M of O.order) { - const F = O.byId[M], B = F?.annotation; - if (!B || B.page.objectNumber !== I || B.subtype !== "link" || !KR(B, !1)) continue; - const $ = B.target ?? null, D = Vt(B); + const F = O.byId[M], _ = F?.annotation; + if (!_ || _.page.objectNumber !== I || _.subtype !== "link" || !KR(_, !1)) continue; + const $ = _.target ?? null, D = Ht(_); if ($ == null || D.kind !== "box") continue; - const _ = B.actions?.activate, L = Sn(F) ?? void 0, j = !!B.actions?.cursorEnter?.root, H = !!B.actions?.cursorExit?.root; + const B = _.actions?.activate, L = Sn(F) ?? void 0, j = !!_.actions?.cursorEnter?.root, H = !!_.actions?.cursorExit?.root; R.push({ id: M, bounds: D.box, target: $, - attached: Tf(B) !== void 0, - ..._ ? { activate: _ } : {}, + attached: Bf(_) !== void 0, + ...B ? { activate: B } : {}, ...L ? { ref: L } : {}, ...j || H ? { hoverEvents: { enter: j, exit: H } } : {} }); } return v.set(I, { model: O, v: R }), R; }, C = { - listPageItems: (I, O) => f(I, O), + listPageItems: (I, O) => d(I, O), listTextItems: (I, O) => g(I, O), getTextItem: (I, O) => m(I, O), listLinkItems: (I) => S(I.objectNumber), @@ -38876,14 +38907,14 @@ function kwe(e, { R.push({ ref: D.annotation.ref, version: D.pictureVersion ?? 0 }); } } - const B = n.lender(); + const _ = n.lender(); return { engine: R, placed: M.sort().join("|"), - lent: F && B ? `lent:${B.getPictureEpoch(I)}` : "" + lent: F && _ ? `lent:${_.getPictureEpoch(I)}` : "" }; }, N = (I, O, T) => { - const R = n.lender(), M = t(I.objectNumber), F = M.order.some((B) => n.owns(B) && !M.byId[B].unconfirmed); + const R = n.lender(), M = t(I.objectNumber), F = M.order.some((_) => n.owns(_) && !M.byId[_].unconfirmed); return !R || !F ? Promise.resolve([]) : R.renderAppearances(I, O, T).catch(() => []); }, w = (I, O, T, R) => { const M = e.tryGet(Pr); @@ -38916,26 +38947,26 @@ function kwe(e, { for (const M of x(I.id)) { const F = O.getKeptAppearances("annotations", M); if (F.length) - return F.map((B) => ({ ...B, ref: T, rect: I.apBox ?? B.rect })); + return F.map((_) => ({ ..._, ref: T, rect: I.apBox ?? _.rect })); } return []; }, E = async (I, O) => { const T = t(I.objectNumber), R = T.order.map(async (M) => { const F = T.byId[M]; if (!F.unconfirmed) return []; - const B = F.pictureVersion ?? 0, $ = A(F); - if (!$) return b(F).map((L) => ({ ...L, version: B })); + const _ = F.pictureVersion ?? 0, $ = A(F); + if (!$) return b(F).map((L) => ({ ...L, version: _ })); const D = F.apBox; if (!D) return []; - const _ = await $(D.width * O); - return _ ? [ + const B = await $(D.width * O); + return B ? [ { ref: F.annotation.ref, mode: "normal", state: null, rect: D, - image: UQ(_.bytes, _.mimeType ?? "image/png"), - version: B + image: UQ(B.bytes, B.mimeType ?? "image/png"), + version: _ } ] : []; }); @@ -38945,34 +38976,34 @@ function kwe(e, { } function Awe(e, t) { const n = () => e.allows("doc.annotate.read"), r = () => e.allows("annotations:create"), o = (u) => { - const d = t.model().byId[oe(u)]?.annotation; + const f = t.model().byId[oe(u)]?.annotation; return { - ...d?.userId != null ? { userId: d.userId } : {}, - ...d?.groupId != null ? { groupId: d.groupId } : {} + ...f?.userId != null ? { userId: f.userId } : {}, + ...f?.groupId != null ? { groupId: f.groupId } : {} }; - }, s = (u, d) => e.doc?.security.allowsAnnotation(u, o(d)) ?? !1, i = (u) => { - const d = t.model().byId[oe(u)]; - return !!d && S2(d); + }, s = (u, f) => e.doc?.security.allowsAnnotation(u, o(f)) ?? !1, i = (u) => { + const f = t.model().byId[oe(u)]; + return !!f && S2(f); }, a = (u) => { - const d = t.model(), f = oe(u); - if (!d.byId[f]) return [u]; - const g = d.order.map((p) => d.byId[p]?.annotation).filter( + const f = t.model(), d = oe(u); + if (!f.byId[d]) return [u]; + const g = f.order.map((p) => f.byId[p]?.annotation).filter( (p) => p?.page.objectNumber === u.page.objectNumber ); return Dx(g, u).filter((p) => { - const m = d.byId[oe(p.ref)]; - return m ? oe(p.ref) === f ? !UK(m) : !Swe(m) : !0; + const m = f.byId[oe(p.ref)]; + return m ? oe(p.ref) === d ? !UK(m) : !Swe(m) : !0; }).map((p) => p.ref); }; return { canRead: n, canCreate: r, canUpdate: i, canDelete: (u) => a(u).length === 0, canDuplicate: (u) => { if (!u.length || !r()) return !1; - const d = t.model(), f = []; + const f = t.model(), d = []; for (const h of u) { - const g = d.byId[oe(h)]?.annotation; + const g = f.byId[oe(h)]?.annotation; if (!g || g.locked) return !1; - f.push(g); + d.push(g); } - return g7(f, {}).dropped.length === 0; + return g7(d, {}).dropped.length === 0; }, blockersOf: a, allowsMutation: s }; } const Swe = (e) => !e.annotation.locked && (e.authority?.delete ?? !0), xwe = (e, t) => { @@ -39016,9 +39047,9 @@ function Ewe(e, t, n) { if (y.paintOf) return y.paintOf(w) ?? a; const x = y.painter?.(w) ?? null, A = y.accentOf?.(w) ?? null; return { ...x ? { painter: x } : {}, ...A ? { accent: A } : {} }; - }, l = (w, y) => w === y || w !== null && y !== null && w.color === y.color && w.strength === y.strength && w.setting === y.setting, u = (w, y) => w === y || w !== null && y !== null && w.color === y.color, d = (w, y) => w === y || w !== null && y !== null && w.text === y.text && w.color === y.color && w.align === y.align, f = /* @__PURE__ */ new WeakMap(), h = (w, y, x) => { - const A = c(w, x), b = A.painter ?? null, E = A.accent ?? null, I = A.placeholder ?? null, O = A.outline ?? null, T = b ? { painter: b } : {}, R = f.get(w); - if (R && R.truth === y && R.painter === b && l(R.accent, E) && d(R.placeholder, I) && u(R.outline, O)) + }, l = (w, y) => w === y || w !== null && y !== null && w.color === y.color && w.strength === y.strength && w.setting === y.setting, u = (w, y) => w === y || w !== null && y !== null && w.color === y.color, f = (w, y) => w === y || w !== null && y !== null && w.text === y.text && w.color === y.color && w.align === y.align, d = /* @__PURE__ */ new WeakMap(), h = (w, y, x) => { + const A = c(w, x), b = A.painter ?? null, E = A.accent ?? null, I = A.placeholder ?? null, O = A.outline ?? null, T = b ? { painter: b } : {}, R = d.get(w); + if (R && R.truth === y && R.painter === b && l(R.accent, E) && f(R.placeholder, I) && u(R.outline, O)) return R.record; let M; if (!y) @@ -39037,10 +39068,10 @@ function Ewe(e, t, n) { pictureVersion: x.getPictureVersion(y.ref), authority: x.getAuthority(y), ...T - }, B = { ...E0(y, w), subtype: y.subtype }; - M = w === y ? F : { ...F, annotation: w, ...$S(F, B) }, x.isPending(w.ref) && Hm(M) && (M = { ...M, source: "vector" }); + }, _ = { ...E0(y, w), subtype: y.subtype }; + M = w === y ? F : { ...F, annotation: w, ...$S(F, _) }, x.isPending(w.ref) && zm(M) && (M = { ...M, source: "vector" }); } - return E && (M = { ...M, accent: E }), I && (M = { ...M, placeholder: I }), O && (M = { ...M, outline: O }), f.set(w, { truth: y, painter: b, accent: E, placeholder: I, outline: O, record: M }), M; + return E && (M = { ...M, accent: E }), I && (M = { ...M, placeholder: I }), O && (M = { ...M, outline: O }), d.set(w, { truth: y, painter: b, accent: E, placeholder: I, outline: O, record: M }), M; }, g = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new Set(), m = (w) => { let y = g.get(w); if (!y) { @@ -39156,14 +39187,14 @@ function Pwe(e) { toolId: o.id, subtype: o.subtype, accept: l?.kind === "prompt" ? l.accept : void 0, - page: Lt(s), + page: Ft(s), point: i - }, d = e.doc; + }, f = e.doc; return c(u).then( - (f) => { - f && e.doc === d && e.tryGet(yr)?.getActiveToolId() === o.id && a(f); + (d) => { + d && e.doc === f && e.tryGet(yr)?.getActiveToolId() === o.id && a(d); }, - (f) => console.error("[annotation] file-picker provider failed:", f) + (d) => console.error("[annotation] file-picker provider failed:", d) ), !0; } }; } @@ -39188,7 +39219,7 @@ function Twe(e) { function ND(e, t) { if (!e.owns(oe(t))) return; const n = e.lender()?.owner ?? "its own"; - throw new re( + throw new te( "invalid-input", "annotation", `${oe(t)} belongs to the ${n} plugin: change it there` @@ -39199,7 +39230,7 @@ function Mwe(e, t, n) { if (!r || !s.length) return t; const i = t.refs.filter((c) => !o(c)), a = Fx(t.position); if (a && (i.length || !o(a))) - throw new re( + throw new te( "invalid-input", "annotation", `${r.owner} records move among their own: ${oe(a)} can't be their neighbour` @@ -39233,8 +39264,8 @@ function Bwe(e) { let c = a; return { ops: i.map((u) => { if (u.type !== "annotations.create" || u.objectNumber !== void 0) return u; - const [d, ...f] = c, h = d ?? e.changes.takeObjectNumber(); - return d !== void 0 && (c = f), h === null ? u : { ...u, objectNumber: h }; + const [f, ...d] = c, h = f ?? e.changes.takeObjectNumber(); + return f !== void 0 && (c = d), h === null ? u : { ...u, objectNumber: h }; }), held: c }; } }; } @@ -39642,7 +39673,7 @@ function Gwe(e, t) { const r = t.change.put.map((s) => s.id).filter((s) => !(s in e.byId)), o = [...e.order.filter((s) => s in n), ...r]; return { ...t.session, byId: n, order: o }; } -const sO = (e) => new re("not-found", "annotation", `no annotation ${oe(e)}`), MD = (e) => e.reduce( +const sO = (e) => new te("not-found", "annotation", `no annotation ${oe(e)}`), MD = (e) => e.reduce( (t, n) => t + (n.type === "create" ? 1 : n.type === "copy" ? b5(n).length : 0), 0 ); @@ -39711,7 +39742,7 @@ function Ywe(e, t, n, r) { live: !!a && $S(a, e.patch).source === "vector" }; } -const iO = (e, t) => t.map((n) => Sn(e.byId[n])).filter((n) => n != null), BD = (e, t) => e === t || e.length === t.length && e.every((n, r) => n === t[r]), NC = { failed: [], result: null }, Qwe = () => new re( +const iO = (e, t) => t.map((n) => Sn(e.byId[n])).filter((n) => n != null), BD = (e, t) => e === t || e.length === t.length && e.every((n, r) => n === t[r]), NC = { failed: [], result: null }, Qwe = () => new te( "not-ready", "annotation", "the document holds no object number for a new annotation right now" @@ -39727,13 +39758,13 @@ function Xwe(e, t, n, r, o, s) { ); r.writeFailed.emit({ refs: w, error: Br(N.error) }); }); - const d = (N, w) => N.result.then( + const f = (N, w) => N.result.then( (y) => ({ failed: [], result: y }), (y) => ({ - failed: [{ ids: w, error: qe("annotation", y) }], + failed: [{ ids: w, error: ze("annotation", y) }], result: null }) - ), f = (N, w, y = [], x) => { + ), d = (N, w, y = [], x) => { const A = [...N, ...y], b = [ ...y.length ? o.lender()?.undoOf(y) ?? [] : [], ...OD(w, N) @@ -39759,40 +39790,40 @@ function Xwe(e, t, n, r, o, s) { let A; try { A = nbe(x, N); - } catch (_) { - throw qe("annotation", _); + } catch (B) { + throw ze("annotation", B); } if (a && dye(x, A.session, N) && (a(), l().draft !== x.draft)) return m(N, w); w.adjust && (A = w.adjust(A)); - const b = Gwe(x, A), E = n.view(), I = o.lender(), O = (_) => I !== null && "id" in _ && o.owns(_.id), T = A.effects.filter(O), R = TD( - A.effects.filter((_) => !O(_)).flatMap((_) => c.get(_.type)?.(_, b, x) ?? []), + const b = Gwe(x, A), E = n.view(), I = o.lender(), O = (B) => I !== null && "id" in B && o.owns(B.id), T = A.effects.filter(O), R = TD( + A.effects.filter((B) => !O(B)).flatMap((B) => c.get(B.type)?.(B, b, x) ?? []), i, b - ), M = T.length && I ? I.opsOf(T, b, x) : [], F = h.named(R, A.session.objectNumbers), B = RD(E, F.ops); + ), M = T.length && I ? I.opsOf(T, b, x) : [], F = h.named(R, A.session.objectNumbers), _ = RD(E, F.ops); F.held !== A.session.objectNumbers && (A = { ...A, session: { ...A.session, objectNumbers: F.held } }); let $ = Promise.resolve(NC); if (M.length && !w.into) { - const _ = f(B, E, M); - g.remember(_.opId, x.selected, A.session.selected), $ = d(_, zy([...B, ...M])); - } else if (B.length) { - const _ = w.into; - if (_) { - _.base ?? (_.base = E), _.held.set(B, OD(_.base, B)); - const L = _.held.change; - L && (u.add(L.opId), g.remember(L.opId, x.selected, A.session.selected), $ = d(L, zy(B))); + const B = d(_, E, M); + g.remember(B.opId, x.selected, A.session.selected), $ = f(B, zy([..._, ...M])); + } else if (_.length) { + const B = w.into; + if (B) { + B.base ?? (B.base = E), B.held.set(_, OD(B.base, _)); + const L = B.held.change; + L && (u.add(L.opId), g.remember(L.opId, x.selected, A.session.selected), $ = f(L, zy(_))); } else { - const L = f(B, E); - g.remember(L.opId, x.selected, A.session.selected), $ = d(L, zy(B)); + const L = d(_, E); + g.remember(L.opId, x.selected, A.session.selected), $ = f(L, zy(_)); } } - const D = A.change.put.filter((_) => _.source === "vector").map((_) => _.id); + const D = A.change.put.filter((B) => B.source === "vector").map((B) => B.id); return e.state.update(AD, A.session, D), { effects: A.effects, written: $ }; }, v = (N, w, y) => { const x = l().draft, A = e.changes.reserveObjectNumbers(y).then( () => l().draft === x ? m(N, w).written : NC, (b) => ({ - failed: [{ ids: [], error: qe("annotation", b) }], + failed: [{ ids: [], error: ze("annotation", b) }], result: null }) ); @@ -39803,23 +39834,23 @@ function Xwe(e, t, n, r, o, s) { const b = [], E = [], I = [], O = [], T = [], R = []; let M = y; try { - for (const _ of N) { - if ((_.type === "update" || _.type === "delete") && ND(o, _.ref), _.type === "copy") { - for (const Y of [..._.refs, ..._.along ?? []]) ND(o, Y); - const H = Jwe(_, M, A); + for (const B of N) { + if ((B.type === "update" || B.type === "delete") && ND(o, B.ref), B.type === "copy") { + for (const Y of [...B.refs, ...B.along ?? []]) ND(o, Y); + const H = Jwe(B, M, A); O.push(...H.ids), I.push(b.length), b.push(H.op), T.push(...H.live), R.push(...H.copies), M = GS(M, H.op); continue; } - const L = _.type === "reorder" ? Mwe(o, _, E) : _; + const L = B.type === "reorder" ? Mwe(o, B, E) : B; if (!L) { - O.push(oe(_.refs[0])), I.push(-1); + O.push(oe(B.refs[0])), I.push(-1); continue; } const j = Ywe(L, M, A, (H) => l().byId[H]); O.push(j.id), I.push(j.op ? b.length : -1), j.op && (b.push(j.op), j.live && T.push(j.id), M = GS(M, j.op)); } - } catch (_) { - throw qe("annotation", _); + } catch (B) { + throw ze("annotation", B); } if (w.lent && (E.push(...w.lent.ops), O.push(...w.lent.ids)), !b.length && !E.length) return { @@ -39828,34 +39859,34 @@ function Xwe(e, t, n, r, o, s) { }; const F = h.named( TD(b, i, qwe(l(), y, M)).filter( - (_) => !b.includes(_) + (B) => !b.includes(B) ), e.state.get().session.objectNumbers ); - F.held !== e.state.get().session.objectNumbers && e.state.update((_) => ({ - ..._, - session: { ..._.session, objectNumbers: F.held } + F.held !== e.state.get().session.objectNumbers && e.state.update((B) => ({ + ...B, + session: { ...B.session, objectNumbers: F.held } })); - const B = l().selected; + const _ = l().selected; s.note(R); - const $ = f( + const $ = d( RD(y, [...b, ...F.ops]), y, E, w.label ); - if (g.remember($.opId, B, w.select ? O : B), T.length && e.state.update(AD, e.state.get().session, T), w.select && (m({ type: "select", ids: O }), O.some((_) => !(_ in l().byId)))) { - const _ = l().selected, L = () => { - BD(l().selected, _) && m({ type: "select", ids: O }); + if (g.remember($.opId, _, w.select ? O : _), T.length && e.state.update(AD, e.state.get().session, T), w.select && (m({ type: "select", ids: O }), O.some((B) => !(B in l().byId)))) { + const B = l().selected, L = () => { + BD(l().selected, B) && m({ type: "select", ids: O }); }; $.result.then(L, () => { }); } - const D = d($, zy([...b, ...E])).then( - (_) => ({ - ..._, + const D = f($, zy([...b, ...E])).then( + (B) => ({ + ...B, annotations: I.map((L) => { - const j = L < 0 ? void 0 : _.result?.items[L]; + const j = L < 0 ? void 0 : B.result?.items[L]; return j && "annotation" in j ? j.annotation : null; }) }) @@ -39902,7 +39933,7 @@ function Xwe(e, t, n, r, o, s) { whenWritten: () => e.changes.whenSettled() }; } -const Zwe = 250, L1 = (e) => `${Cf(e.family)}|${e.weight}|${e.italic}`, D1 = "body", _D = (e) => Array.from(e, (t) => t.codePointAt(0)); +const Zwe = 250, L1 = (e) => `${Nf(e.family)}|${e.weight}|${e.italic}`, D1 = "body", _D = (e) => Array.from(e, (t) => t.codePointAt(0)); function e0e(e, t, n) { const r = () => e.tryGet(Xa), o = /* @__PURE__ */ new Map(); let s = null, i = null; @@ -39913,23 +39944,23 @@ function e0e(e, t, n) { answered: l, epoch: 0 }; - const d = (p, m) => { + const f = (p, m) => { const v = VP( p.fontFamily, (S) => n().find((C) => C.key === S) ); return (v.weight ?? 400) === m.weight && (v.italic ?? !1) === m.italic; - }, f = (p) => { - const m = qf(p.annotation); + }, d = (p) => { + const m = Jf(p.annotation); if (!m || p.annotation.subtype !== "free-text") return null; - const v = Yl(p.annotation, n), S = v.body, C = [D1], k = [LD(m, S, d(m, S))]; + const v = Ql(p.annotation, n), S = v.body, C = [D1], k = [LD(m, S, f(m, S))]; let N = ""; for (const y of v.paragraphs) for (const x of y.runs) { N += x.text; const A = x.style; if (A?.family === void 0 && A?.weight === void 0 && A?.italic === void 0) { - C.push(D1), k.push({ ...LD(m, S, d(m, S)), text: x.text }); + C.push(D1), k.push({ ...LD(m, S, f(m, S)), text: x.text }); continue; } const b = { @@ -39942,7 +39973,7 @@ function e0e(e, t, n) { const w = JSON.stringify({ body: k[0], faces: [...new Set(C)].sort() }); return { body: S, runs: k, faces: C, text: N, key: w }; }, h = async (p) => { - const m = r(), v = t.model().byId[p], S = m && v && f(v); + const m = r(), v = t.model().byId[p], S = m && v && d(v); if (!m || !v || !S) return; const { body: C, runs: k, faces: N, text: w, key: y } = S, x = Sn(v) ?? void 0; p === s && (i = { id: p, codePoints: new Set(_D(w)) }), a.get(p)?.abort(); @@ -39968,7 +39999,7 @@ function e0e(e, t, n) { for (const [v, S] of o) { const C = p.byId[v]; if (C === S.record) continue; - const k = C && f(C); + const k = C && d(C); if (k && k.key === S.faces) { o.set(v, { ...S, record: C }); continue; @@ -39982,17 +40013,17 @@ function e0e(e, t, n) { p !== s && (s = p, c(), i = null, p !== null && h(p)); }), { bodyCss: (p, m, v) => { - const S = r(), C = d(m, v); + const S = r(), C = f(m, v); if (!S) - return hm( - C ? Gf(m.fontFamily) : cl(v) + return pm( + C ? Yf(m.fontFamily) : ll(v) ); const k = o.get(p)?.byFace.get(D1); return k ? S.getRunCss(k) : C ? S.getFontCss(m.fontFamily) : S.getFaceCss(v); }, faceCss: (p, m) => { const v = r(); - if (!v) return hm(cl(m)); + if (!v) return pm(ll(m)); const S = p !== null ? o.get(p)?.byFace.get(L1(m)) : void 0; return S ? v.getRunCss(S) : v.getFaceCss(m); }, @@ -40010,7 +40041,7 @@ function e0e(e, t, n) { if (s !== p) return; const m = t.model().byId[p]; if (!m) return; - const v = Yl(m.annotation, n).paragraphs.flatMap((C) => C.runs.map((k) => k.text)).join(""), S = i?.id === p ? i.codePoints : null; + const v = Ql(m.annotation, n).paragraphs.flatMap((C) => C.runs.map((k) => k.text)).join(""), S = i?.id === p ? i.codePoints : null; S && _D(v).every((C) => S.has(C)) || (c(), c = e.clock.after(Zwe, () => void h(p))); } }; @@ -40052,9 +40083,9 @@ function n0e(e, t, n, r) { const C = e.tryGet(Cn); return C ? o.get(C.getActiveToolId()) : void 0; }, c = (C) => C && a()?.upright ? zR(C) : 0, l = /* @__PURE__ */ new Map(), u = (C) => { - const k = o.get(C), N = k?.subtype ?? C, w = Qr(n.model(), k?.preset ?? C), y = l.get(C); + const k = o.get(C), N = k?.subtype ?? C, w = Xr(n.model(), k?.preset ?? C), y = l.get(C); if (y?.own === w) return y; - const x = NH(N, w), { subtype: A, ...b } = x, E = ZN(nA(k?.fieldsKind ?? C)), I = qf(x), O = x.subtype === "link" ? x.target ?? null : null, T = { + const x = NH(N, w), { subtype: A, ...b } = x, E = ZN(nA(k?.fieldsKind ?? C)), I = Jf(x), O = x.subtype === "link" ? x.target ?? null : null, T = { own: w, defaults: b, properties: { @@ -40064,7 +40095,7 @@ function n0e(e, t, n, r) { } }; return l.set(C, T), T; - }, d = (C, k) => { + }, f = (C, k) => { const N = u(C).own; Object.entries(k).some( ([y, x]) => JSON.stringify(N[y]) !== JSON.stringify(x) @@ -40073,8 +40104,8 @@ function n0e(e, t, n, r) { preset: o.get(C)?.preset ?? C, patch: k }), r.toolDefaultsChanged.emit({ toolId: C, defaults: u(C).defaults })); - }, f = /* @__PURE__ */ new WeakMap(), h = (C) => { - let k = f.get(C); + }, d = /* @__PURE__ */ new WeakMap(), h = (C) => { + let k = d.get(C); return k || (k = { id: C.id, subtype: C.subtype, @@ -40084,7 +40115,7 @@ function n0e(e, t, n, r) { ...C.defaults ? { defaults: C.defaults } : {}, ghost: C.ghost, ...C.meta ? { meta: C.meta } : {} - }, f.set(C, k)), k; + }, d.set(C, k)), k; }, g = (C) => { const { id: k, cursor: N, enables: w } = C, y = () => e.allows("annotations:create"), x = { id: k, cursor: N, enables: w, touch: e9(w), canUse: y }; return e.tryGet(Cn)?.registerTool(x, { replace: !0 }); @@ -40121,7 +40152,7 @@ function n0e(e, t, n, r) { }; }, getDefaults: (C) => u(C).defaults, - updateDefaults: d, + updateDefaults: f, getProperties: (C) => u(C).properties, onDefaultsChanged: r.toolDefaultsChanged.on }; @@ -40140,11 +40171,11 @@ function o0e(e, { settings: t, tools: n, store: r }) { return { shape: (c) => (l) => { const u = r0e(l); if (!u.length) return l; - const d = o(c); - let f = l.session; - !d.editText && f.editing !== null && u.includes(f.editing) && (f = { ...f, editing: null }); - const h = f.editing !== null && u.includes(f.editing); - return !d.select && !h && (f = { ...f, selected: [] }), f === l.session ? l : { ...l, session: f }; + const f = o(c); + let d = l.session; + !f.editText && d.editing !== null && u.includes(d.editing) && (d = { ...d, editing: null }); + const h = d.editing !== null && u.includes(d.editing); + return !f.select && !h && (d = { ...d, selected: [] }), d === l.session ? l : { ...l, session: d }; }, done: (c, l) => { l.effects.some((u) => u.type === "create") && o(c).tool === "default" && e.tryGet(Cn)?.activateDefaultTool(); }, placed: (c, l) => { @@ -40263,7 +40294,7 @@ function d0e(e) { } const f0e = "tool-ghost", h0e = "tool-placing"; function DD(e, t) { - return t && wg("box", t.from, t.to) ? !1 : e ? e.kind === "create-rect" ? !wg("box", e.from, e.to) : e.kind === "create-line" ? !wg("segment", e.from, e.to) : !1 : !0; + return t && vg("box", t.from, t.to) ? !1 : e ? e.kind === "create-rect" ? !vg("box", e.from, e.to) : e.kind === "create-line" ? !vg("segment", e.from, e.to) : !1 : !0; } function p0e(e, { store: t, @@ -40294,7 +40325,7 @@ function p0e(e, { if (!N) return null; const w = rA(C, v); if (JS(v.subtype)) { - const x = Id(S.zoom, S.displayRotation), { rect: A } = hz(w, S.point, N, x); + const x = Od(S.zoom, S.displayRotation), { rect: A } = hz(w, S.point, N, x); return t0(w, { kind: "box", rect: A, rot: 0 }); } if (!v.clickCreate) return null; @@ -40304,12 +40335,12 @@ function p0e(e, { displayRotation: S.displayRotation }); return t0(w, y); - }, d = (v, S) => o.lender()?.toolPaintOf?.(v.id, S) ?? void 0, f = (v, S, C) => { + }, f = (v, S) => o.lender()?.toolPaintOf?.(v.id, S) ?? void 0, d = (v, S, C) => { const { ghostAt: k, placing: N } = e.state.get(), w = [], y = k && r.get(k.toolId); if (k?.page.objectNumber === v && y?.ghost && s.clickStamp(y) === null && DD(S.draft, N)) { const A = u(y, k, S); if (A) { - const b = rA(S, y), E = d(y, k.page); + const b = rA(S, y), E = f(y, k.page); w.push({ ...tO(f0e, b, A, "ghost", C, void 0, E), ghostOpacity: y.ghost.opacity @@ -40317,18 +40348,18 @@ function p0e(e, { } } const x = N && r.get(N.toolId); - if (N?.page.objectNumber === v && x && wg("box", N.from, N.to)) { + if (N?.page.objectNumber === v && x && vg("box", N.from, N.to)) { const A = B2("box", N.from, N.to, x.clickCreate, { pageBox: n.pageBoxOf(v), upright: x.upright, displayRotation: N.displayRotation - }), b = rA(S, x), E = A && t0(b, A), I = d(x, N.page); + }), b = rA(S, x), E = A && t0(b, A), I = f(x, N.page); E && w.push(tO(h0e, b, E, "draft", C, void 0, I)); } return w; }; let h = null, g = null; - return { itemsOn: f, api: { + return { itemsOn: d, api: { hoverGhostAt: l, hoverGhostIn: a, clearGhost: i, @@ -40351,7 +40382,7 @@ function p0e(e, { const y = s.armed(); if (!y || C.page.objectNumber !== v.objectNumber) return null; if (g?.place !== C || g.armed !== y) { - const x = r.get(Vd); + const x = r.get(Ud); g = { place: C, armed: y, @@ -40386,12 +40417,12 @@ function g0e(e, { const a = (C) => { const k = s.get(C); if (!k) - throw new re("not-found", "annotation", `no annotation ${oe(C)}`); + throw new te("not-found", "annotation", `no annotation ${oe(C)}`); return { annotation: k }; }, c = (C, k) => { const N = n.get(k); - if (!N) throw new re("not-found", "annotation", `no tool '${k}'`); - const w = Pm[C.subtype], y = Object.entries(Qr(t.model(), N.preset)).filter( + if (!N) throw new te("not-found", "annotation", `no tool '${k}'`); + const w = Rm[C.subtype], y = Object.entries(Xr(t.model(), N.preset)).filter( ([x]) => x !== "richText" && w.includes(x) ); return { ...N.flags, ...Object.fromEntries(y), ...C }; @@ -40399,7 +40430,7 @@ function g0e(e, { e.assertAllowed("annotations:create", "annotation.create"); const { ref: y } = e.pageOf(C); if (k.subtype === "unsupported") - throw new re( + throw new te( "invalid-input", "annotation", "a kind the engine doesn't know can't be created" @@ -40407,9 +40438,9 @@ function g0e(e, { const x = k, A = w.tool ? c(x, w.tool) : x, b = await t.applyWhenNumbered( [{ type: "create", page: y, draft: A, ...N ? { resources: N } : {} }], { select: w.select } - ), E = await e.cancellable(w.signal, ym(b)); + ), E = await e.cancellable(w.signal, bm(b)); if (!E) - throw new re( + throw new te( "operation-failed", "annotation", "the annotation could not be created" @@ -40418,23 +40449,23 @@ function g0e(e, { }, u = async (C, k, N, w = {}) => { const y = await e.cancellable( w.signal, - ym( + bm( t.apply([{ type: "update", ref: C, patch: k, ...N ? { resources: N } : {} }]) ) ); return y ? { annotation: y } : a(C); - }, d = async (C, k = {}) => { + }, f = async (C, k = {}) => { await e.cancellable(k.signal, Va(t.apply([{ type: "delete", ref: C }]))); - }, f = async (C, k, N = {}) => { + }, d = async (C, k, N = {}) => { if (!C.length) return; const w = t.model(), y = (O) => { const T = w.byId[oe(O)]; if (!T) - throw new re("not-found", "annotation", `no annotation ${oe(O)}`); + throw new te("not-found", "annotation", `no annotation ${oe(O)}`); return T; }, x = C.map(y), A = Fx(k), b = A ? y(A) : null, E = x[0].annotation.page, I = (O) => O.annotation.page.objectNumber !== E.objectNumber; if (x.some(I) || b && I(b)) - throw new re( + throw new te( "invalid-input", "annotation", "a reorder stays on one page: the annotations and their neighbour" @@ -40458,7 +40489,7 @@ function g0e(e, { ...w ? { page: w } : {}, ...k.offset ? { offset: k.offset } : {} }, x = N.length ? o.lender() : null, A = x ? await x.copyOps(N, y) : null, b = t.model(), E = new Set(C.map(oe)), I = C.flatMap( - (_) => $0(b, oe(_)).map((L) => L.annotation.ref).filter((L) => !E.has(oe(L))) + (B) => $0(b, oe(B)).map((L) => L.annotation.ref).filter((L) => !E.has(oe(L))) ), O = A?.copies.map(oe) ?? [], T = await t.applyWhenNumbered( C.length ? [{ type: "copy", refs: C, ...I.length ? { along: I } : {}, ...y }] : [], { @@ -40471,28 +40502,28 @@ function g0e(e, { } } : {} } - ), M = (await e.cancellable(k.signal, Va(T))).result?.items ?? [], F = M.find((_) => _.type === "annotations.copy"); + ), M = (await e.cancellable(k.signal, Va(T))).result?.items ?? [], F = M.find((B) => B.type === "annotations.copy"); if (C.length && F?.type !== "annotations.copy") - throw new re( + throw new te( "operation-failed", "annotation", "the annotations could not be copied" ); - const B = new Set(T.ids), $ = F?.type === "annotations.copy" ? F.annotations.filter((_) => B.has(oe(_.ref))) : [], D = /* @__PURE__ */ new Map(); - for (const _ of M) { - const L = _.type === "forms.copy" || _.type === "forms.addWidget" ? _.widgets : _.type === "forms.updateWidget" ? [_.widget] : []; + const _ = new Set(T.ids), $ = F?.type === "annotations.copy" ? F.annotations.filter((B) => _.has(oe(B.ref))) : [], D = /* @__PURE__ */ new Map(); + for (const B of M) { + const L = B.type === "forms.copy" || B.type === "forms.addWidget" ? B.widgets : B.type === "forms.updateWidget" ? [B.widget] : []; for (const j of L) D.set(oe(j.ref), j); } return { - annotations: [...$, ...O.flatMap((_) => D.get(_) ?? [])], + annotations: [...$, ...O.flatMap((B) => D.get(B) ?? [])], dropped: F?.type === "annotations.copy" ? F.dropped : [] }; }, g = (C) => C?.map((k) => e.pageOf(k).ref); return { update: u, duplicate: h, api: { create: l, update: u, - delete: d, - reorder: f, + delete: f, + reorder: d, duplicate: h, export: async (C = {}, k = {}) => { e.assertAllowed("doc.download", "annotation.export"); @@ -40564,7 +40595,7 @@ function m0e(e, { const u = () => { const p = t.model().draft; return p?.kind === "create-ink" && !p.drawing ? p : null; - }, d = ({ selects: p = !0 } = {}) => { + }, f = ({ selects: p = !0 } = {}) => { const m = u(); if (!m) return; const v = l?.draft === m ? l : null; @@ -40576,16 +40607,16 @@ function m0e(e, { } ); (!v || v.activeToolId === r.activeTool()?.id) && o.done(S, k); - }, f = (p, m) => { + }, d = (p, m) => { const v = u(); if (!v) return; l?.cancel(); const S = e.clock.after(m, () => { - t.model().draft === v && d(); + t.model().draft === v && f(); }); l = { draft: v, toolId: p, activeToolId: r.activeTool()?.id, cancel: S }; }; - t.onWaitingInk(() => d({ selects: !1 })), e.onSettle(() => d()); + t.onWaitingInk(() => f({ selects: !1 })), e.onSettle(() => f()); const h = { get: () => a(), finish: c, @@ -40593,7 +40624,7 @@ function m0e(e, { t.commit({ type: "cancel" }); } }, g = { - finishInkDraft: () => d(), + finishInkDraft: () => f(), cancel: () => { t.commit({ type: "cancel" }); }, @@ -40607,7 +40638,7 @@ function m0e(e, { return p?.kind === "create-poly" || p?.kind === "create-callout" || p?.kind === "create-distance" && p.step === "offset"; } }; - return { draft: h, api: g, waitForNextStroke: f }; + return { draft: h, api: g, waitForNextStroke: d }; } function y0e(e, { store: t, @@ -40616,65 +40647,65 @@ function y0e(e, { filePicker: o, afterCreate: s }, i) { - const a = (d, f, { data: h, resources: g }) => t.applyWhenNumbered([ - { type: "create", page: Lt(f), draft: h, resources: g } - ]).then((p) => (s.placed(d.id, p.ids), Va(p))), c = (d, f, h, g, p) => { - const m = e.doc, v = n.sizeOf(f); - if (!m || !v || !JS(d.subtype)) return !1; - const { rect: S } = hz(rA(t.model(), d), h, v, g), C = u0e( - d.subtype, + const a = (f, d, { data: h, resources: g }) => t.applyWhenNumbered([ + { type: "create", page: Ft(d), draft: h, resources: g } + ]).then((p) => (s.placed(f.id, p.ids), Va(p))), c = (f, d, h, g, p) => { + const m = e.doc, v = n.sizeOf(d); + if (!m || !v || !JS(f.subtype)) return !1; + const { rect: S } = hz(rA(t.model(), f), h, v, g), C = u0e( + f.subtype, { rect: S }, - Qr(t.model(), d.preset), - d.flags, + Xr(t.model(), f.preset), + f.flags, p ); - return a(d, f, C).catch( + return a(f, d, C).catch( (k) => console.error("[annotation] icon placement failed:", k) ), !0; - }, l = (d, f, h, g) => { - if (i.placeArmedStamp(d, f, h)) return !0; + }, l = (f, d, h, g) => { + if (i.placeArmedStamp(f, d, h)) return !0; const p = r.activeTool(); if (!p) return !1; if (p.subtype === "stamp") - return i.requestStampAt(d, f, h); + return i.requestStampAt(f, d, h); if (!JS(p.subtype)) return !1; - const m = Id(g, h); - return p.subtype === "text" ? c(p, d, f, m, null) : o.promptAt( + const m = Od(g, h); + return p.subtype === "text" ? c(p, f, d, m, null) : o.promptAt( p, - d, f, - (v) => c(p, d, f, m, v) + d, + (v) => c(p, f, d, m, v) ); }; return { api: { - placeAt: (d, f, h, g) => l(d.objectNumber, f, h, g), - setFilePickerProvider: (d) => o.set(d) + placeAt: (f, d, h, g) => l(f.objectNumber, d, h, g), + setFilePickerProvider: (f) => o.set(f) } }; } function b0e(e, { store: t }) { const n = (s, i, a) => { const c = a.byId[s], l = Sn(c); - if (!c || !l || Wt(c.annotation).name === "link") return []; - const u = qR(i), d = i == null ? [] : wge(Vt(c.annotation), Wn(c.annotation)), f = $0(a, s), h = [], g = Math.min(f.length, d.length); + if (!c || !l || Jt(c.annotation).name === "link") return []; + const u = qR(i), f = i == null ? [] : wge(Ht(c.annotation), Wn(c.annotation)), d = $0(a, s), h = [], g = Math.min(d.length, f.length); for (let p = 0; p < g; p++) h.push({ type: "update", - ref: f[p].annotation.ref, - patch: { subtype: "link", rect: d[p], ...u ? { target: u } : {} } + ref: d[p].annotation.ref, + patch: { subtype: "link", rect: f[p], ...u ? { target: u } : {} } }); - for (let p = f.length; p < d.length; p++) + for (let p = d.length; p < f.length; p++) h.push({ type: "create", page: c.annotation.page, draft: { subtype: "link", - rect: d[p], + rect: f[p], target: u, reply: { to: l, type: "group" } } }); - for (let p = d.length; p < f.length; p++) - h.push({ type: "delete", ref: f[p].annotation.ref }); + for (let p = f.length; p < d.length; p++) + h.push({ type: "delete", ref: d[p].annotation.ref }); return h; }, r = async (s, i, a) => { const c = n(oe(s), i, t.model()); @@ -40711,78 +40742,78 @@ function w0e(e, { tools: r, afterCreate: o }, s) { - const i = (d, f, h, g, p) => t.commit( + const i = (f, d, h, g, p) => t.commit( { type: "createMarkup", - subtype: d, - page: f, + subtype: f, + page: d, quads: h, preset: g, flags: g ? r.get(g)?.flags : void 0 }, { adjust: p } - ), a = (d, f, h) => t.commit({ type: "createCaret", page: d, anchor: f }, { adjust: h }), c = (d, f, h, g, p) => t.commit({ type: "createReplaceText", page: d, quads: f, anchor: h, preset: g }, { adjust: p }), l = (d, f, h, g) => { - const p = f.end; - if (d.kind === "insert") + ), a = (f, d, h) => t.commit({ type: "createCaret", page: f, anchor: d }, { adjust: h }), c = (f, d, h, g, p) => t.commit({ type: "createReplaceText", page: f, quads: d, anchor: h, preset: g }, { adjust: p }), l = (f, d, h, g) => { + const p = d.end; + if (f.kind === "insert") return p ? [a(p.page, { glyphQuad: p.glyphQuad, advance: p.advance }, g)] : []; const m = []; - for (const v of f.pages) { + for (const v of d.pages) { const S = v.segments[v.segments.length - 1]; if (!S) continue; const C = v.segments.map((N) => N.quad); - if (d.kind === "markup") { - m.push(i(d.subtype, v.page, C, h, g)); + if (f.kind === "markup") { + m.push(i(f.subtype, v.page, C, h, g)); continue; } - const k = p && Vf(p.page, v.page) ? { glyphQuad: p.glyphQuad, advance: p.advance } : { glyphQuad: S.quad, advance: S.advance }; + const k = p && Uf(p.page, v.page) ? { glyphQuad: p.glyphQuad, advance: p.advance } : { glyphQuad: S.quad, advance: S.advance }; m.push(c(v.page, C, k, h, g)); } return m; }; return { api: { - createMarkup: (d, f, h, g) => { - n.canCreate() && i(d, f, h, g); + createMarkup: (f, d, h, g) => { + n.canCreate() && i(f, d, h, g); }, - createCaret: (d, f) => { - n.canCreate() && a(d, f); + createCaret: (f, d) => { + n.canCreate() && a(f, d); }, - createReplaceText: (d, f, h, g) => { - n.canCreate() && c(d, f, h, g); + createReplaceText: (f, d, h, g) => { + n.canCreate() && c(f, d, h, g); }, /** * Turn the text selection into what the tool makes of it, then clear the * selection. Nothing, and `false`, for a tool that makes nothing of a * selection, without create authority, or without a selection. */ - applyToolToSelection: (d) => { - const f = r.get(d), h = f && jD(f); - if (!f || !h || !n.canCreate()) return !1; + applyToolToSelection: (f) => { + const d = r.get(f), h = d && jD(d); + if (!d || !h || !n.canCreate()) return !1; const g = e.tryGet(_r); if (!g || !g.hasSelection()) return !1; const p = l( h, g.getSnapshot(), - f.preset, - o.shape(f.id) + d.preset, + o.shape(d.id) ); g.clear(); - for (const m of p) o.done(f.id, m); + for (const m of p) o.done(d.id, m); return !0; }, - previewMarkup: (d, f, h) => { - t.commit({ type: "setMarkupPreview", subtype: d, quadsByPage: f, preset: h }); + previewMarkup: (f, d, h) => { + t.commit({ type: "setMarkupPreview", subtype: f, quadsByPage: d, preset: h }); }, clearMarkupPreview: () => { t.commit({ type: "clearMarkupPreview" }); }, - createFromSelection: async (d, f = {}) => { + createFromSelection: async (f, d = {}) => { e.assertAllowed("annotations:create", "annotation.createFromSelection"); - const h = r.get(d), g = h && jD(h); + const h = r.get(f), g = h && jD(h); if (!h || !g) - throw new re( + throw new te( "not-found", "annotation", - `no tool '${d}' that makes something of selected text` + `no tool '${f}' that makes something of selected text` ); const p = e.tryGet(_r); if (!p || !p.hasSelection()) return { annotations: [] }; @@ -40795,9 +40826,9 @@ function w0e(e, { h.preset, v ); - return f.clear !== !1 && p.clear(), { + return d.clear !== !1 && p.clear(), { annotations: (await e.cancellable( - f.signal, + d.signal, Promise.all( S.filter((k) => k.effects.length).map((k) => nz(k)) ) @@ -40822,12 +40853,12 @@ function v0e(e, { store: t, records: n }) { const a = { page: s, scale: i, updated: [], skipped: [], failed: [] }; if (n.getStatus() !== "ready") return a.error = Mx(new Error("the annotations of this document are not loaded")), a; - const c = t.model(), l = Object.values(n.get().byKey).flatMap(({ dto: d }) => { - const f = c.byId[oe(d.ref)]; - return f && d.page.objectNumber === s.objectNumber && sm(d) ? [{ dto: d, annotation: f }] : []; + const c = t.model(), l = Object.values(n.get().byKey).flatMap(({ dto: f }) => { + const d = c.byId[oe(f.ref)]; + return d && f.page.objectNumber === s.objectNumber && im(f) ? [{ dto: f, annotation: d }] : []; }), u = []; - for (const { dto: d, annotation: f } of l) { - const h = d.ref, g = f.authority?.update === !1 ? "no-authority" : !S2(f) || !x2(f) ? "locked" : "measure" in d && d.measure && d.measure.subtype !== "rectilinear" ? "foreign-measure" : Rm(Ba({ ...d, measure: i })) ? null : "unavailable"; + for (const { dto: f, annotation: d } of l) { + const h = f.ref, g = d.authority?.update === !1 ? "no-authority" : !S2(d) || !x2(d) ? "locked" : "measure" in f && f.measure && f.measure.subtype !== "rectilinear" ? "foreign-measure" : Tm(Ba({ ...f, measure: i })) ? null : "unavailable"; if (g) { a.skipped.push({ ref: h, reason: g }); continue; @@ -40835,7 +40866,7 @@ function v0e(e, { store: t, records: n }) { u.push({ type: "update", ref: h, - patch: { subtype: d.subtype, measure: i } + patch: { subtype: f.subtype, measure: i } }), a.updated.push(h); } return u.length > 0 && t.apply(u), a; @@ -40867,7 +40898,7 @@ function A0e(e, t) { if (!o) return null; const s = t(o), i = s ? Sn(s) : null; if (!s || !i || s.unconfirmed) return null; - const a = Wt(s.annotation).name; + const a = Jt(s.annotation).name; if (a.startsWith("widget") || a === "link") return null; const c = !!s.annotation.actions?.cursorEnter?.root, l = !!s.annotation.actions?.cursorExit?.root; return !c && !l ? null : { ref: i, page: s.annotation.page, events: { enter: c, exit: l } }; @@ -40884,7 +40915,7 @@ function S0e(e, { behaviors: s, afterCreate: i }, a, c, l) { - const u = e.tryGet(Lr), d = u ? A0e(u, (h) => t.model().byId[h] ?? null) : null; + const u = e.tryGet(Lr), f = u ? A0e(u, (h) => t.model().byId[h] ?? null) : null; return { api: { editPointer: (h, g, p, m, v, S, C, k) => { t.commit({ @@ -40926,7 +40957,7 @@ function S0e(e, { const C = p.objectNumber, k = o.get(h); if (k?.capture === !0 ? !e.doc?.security.allows("doc.annotate.modify") : !r.canCreate()) return; - const N = n.sizeOf(C) !== null, w = c.viewportsOf(C), y = k?.ink?.groupStrokesMs ?? 0, x = t.model().draft, A = (x?.kind === "create-distance" || x?.kind === "create-poly") && x.page.objectNumber === C && x.preset === (k?.preset ?? h), b = k ? Qr(t.model(), k.preset) : {}, E = b.intent, I = k && sm({ subtype: k.subtype, intent: E }); + const N = n.sizeOf(C) !== null, w = c.viewportsOf(C), y = k?.ink?.groupStrokesMs ?? 0, x = t.model().draft, A = (x?.kind === "create-distance" || x?.kind === "create-poly") && x.page.objectNumber === C && x.preset === (k?.preset ?? h), b = k ? Xr(t.model(), k.preset) : {}, E = b.intent, I = k && im({ subtype: k.subtype, intent: E }); if (I && g === "down" && !A && (!N || !w?.viewports)) return; const O = N && w?.viewports ? TV(w.viewports, m) : void 0, T = O ? O.measure ?? null : w?.fallback, R = b.captionEnabled ?? !0, M = I && N && w ? E === "line-dimension" ? { @@ -40943,7 +40974,7 @@ function S0e(e, { captionEnabled: R, contents: "" } : void 0; - if (M && g === "down" && !A && !Rm( + if (M && g === "down" && !A && !Tm( Ba({ subtype: k.subtype, intent: M.intent, @@ -40995,7 +41026,7 @@ function S0e(e, { }); m.kind === "annot" && (p = m.id); } - g.hovered !== p && (d?.hover(p), t.commit({ type: "hover", id: p })); + g.hovered !== p && (f?.hover(p), t.commit({ type: "hover", id: p })); } } }; } @@ -41008,7 +41039,7 @@ function x0e(e) { }; return e.root && n(e.root), t; } -function ol(e) { +function sl(e) { return x0e(e).join(` ; `); @@ -41066,7 +41097,7 @@ function N0e(e) { ), m; }; let o = null, s = !1, i = null, a = null, c = 0, l = !1; - const u = () => (o ?? (o = e.sandboxFactory()), o), d = (p) => ({ + const u = () => (o ?? (o = e.sandboxFactory()), o), f = (p) => ({ document: { ...e.document(), ...p.pageNumber !== void 0 ? { pageNumber: p.pageNumber } : {} @@ -41078,7 +41109,7 @@ function N0e(e) { ...p.annotPages ? { annotPages: p.annotPages } : {}, ...p.annotsCoverDocument !== void 0 ? { annotsCoverDocument: p.annotsCoverDocument } : {}, event: p.event - }), f = (p) => { + }), d = (p) => { p.destroyed && (o = null, s = !1, i = null); }, h = async (p, m) => { if (s) return null; @@ -41105,14 +41136,14 @@ function N0e(e) { if (S.length === 0) return null; const C = v.boot( S, - d({ ...p, event: { kind: "name-tree-boot" } }), + f({ ...p, event: { kind: "name-tree-boot" } }), m ?? t ); - return f(v), C; + return d(v), C; }, g = async (p, m, v) => { s || (i = await h(m, v)); - const S = await u(), C = S.run(p, d(m), v ?? t); - return f(S), C; + const S = await u(), C = S.run(p, f(m), v ?? t); + return d(S), C; }; return { transaction(p) { @@ -41140,7 +41171,7 @@ function N0e(e) { function pz(e) { const t = e, n = Date; let r = null; - const o = (K) => Array.isArray(K) ? K.map((U) => String(U)) : K, s = (K, U) => Array.isArray(K) && Array.isArray(U) ? K.length === U.length && K.every((Z, ne) => Z === U[ne]) : K === U, i = (K) => { + const o = (K) => Array.isArray(K) ? K.map((U) => String(U)) : K, s = (K, U) => Array.isArray(K) && Array.isArray(U) ? K.length === U.length && K.every((X, re) => X === U[re]) : K === U, i = (K) => { const U = K; return U?.kind === "objectNumber" ? `obj:${String(U.objectNumber)}` : `fqn:${String(U?.name ?? "")}`; }, a = (K, U) => { @@ -41151,16 +41182,16 @@ function pz(e) { if (typeof K == "number") return Number.isFinite(K) ? K : 0; const U = Number(String(K ?? "").replace(/[^0-9+\-.]/g, "")); return Number.isFinite(U) ? U : 0; - }, u = (K) => K === "hidden" ? 1 : K === "noPrint" ? 2 : K === "noView" ? 3 : 0, d = (K) => Number(K) === 1 ? "hidden" : Number(K) === 2 ? "noPrint" : Number(K) === 3 ? "noView" : "visible", f = (K) => K === "widget-activate" ? "Mouse Up" : K === "field-keystroke" ? "Keystroke" : K === "field-validate" ? "Validate" : K === "field-calculate" ? "Calculate" : K === "field-format" ? "Format" : "Open", h = {}, g = (K) => { - const U = K.input, Z = {}; - return Object.defineProperties(Z, { + }, u = (K) => K === "hidden" ? 1 : K === "noPrint" ? 2 : K === "noView" ? 3 : 0, f = (K) => Number(K) === 1 ? "hidden" : Number(K) === 2 ? "noPrint" : Number(K) === 3 ? "noView" : "visible", d = (K) => K === "widget-activate" ? "Mouse Up" : K === "field-keystroke" ? "Keystroke" : K === "field-validate" ? "Validate" : K === "field-calculate" ? "Calculate" : K === "field-format" ? "Format" : "Open", h = {}, g = (K) => { + const U = K.input, X = {}; + return Object.defineProperties(X, { name: { enumerable: !0, get: () => U.name }, type: { enumerable: !0, get: () => U.kind }, value: { enumerable: !0, get: () => o(K.value), - set: (ne) => { - K.value = o(ne); + set: (re) => { + K.value = o(re); } }, valueAsString: { @@ -41185,14 +41216,14 @@ function pz(e) { display: { enumerable: !0, get: () => u(K.display), - set: (ne) => { - K.display = d(ne); + set: (re) => { + K.display = f(re); } }, source: { enumerable: !1, get: () => h } - }), Z.setFocus = () => { + }), X.setFocus = () => { r?.uiEffects.push({ type: "focusField", field: String(U.name) }); - }, Z; + }, X; }, p = (K) => r?.fieldsByName.get(String(K))?.wrapper ?? null, m = { square: ["strokeColor", "fillColor", "opacity", "width", "borderStyle", "dash", "rect"], circle: ["strokeColor", "fillColor", "opacity", "width", "borderStyle", "dash", "rect"], @@ -41227,78 +41258,78 @@ function pz(e) { "file-attachment": "FileAttachment" }, C = (K) => { if (!Array.isArray(K) || K.length === 0) return !1; - const Z = { T: 0, G: 1, RGB: 3, CMYK: 4 }[String(K[0])]; - return Z !== void 0 && K.length === Z + 1 && K.slice(1).every((ne) => typeof ne == "number" && isFinite(Number(ne))); + const X = { T: 0, G: 1, RGB: 3, CMYK: 4 }[String(K[0])]; + return X !== void 0 && K.length === X + 1 && K.slice(1).every((re) => typeof re == "number" && isFinite(Number(re))); }, k = (K) => { - const U = K, Z = String(U[0]); - if (Z === "T") return null; - if (Z === "G") return [Number(U[1]), Number(U[1]), Number(U[1])]; - if (Z === "RGB") return [Number(U[1]), Number(U[2]), Number(U[3])]; - const ne = Number(U[1]), xe = Number(U[2]), _e = Number(U[3]), Ie = Number(U[4]); + const U = K, X = String(U[0]); + if (X === "T") return null; + if (X === "G") return [Number(U[1]), Number(U[1]), Number(U[1])]; + if (X === "RGB") return [Number(U[1]), Number(U[2]), Number(U[3])]; + const re = Number(U[1]), xe = Number(U[2]), Le = Number(U[3]), Ie = Number(U[4]); return [ - 1 - Math.min(1, ne + Ie), + 1 - Math.min(1, re + Ie), 1 - Math.min(1, xe + Ie), - 1 - Math.min(1, _e + Ie) + 1 - Math.min(1, Le + Ie) ]; - }, N = (K, U) => Array.isArray(K) && Array.isArray(U) ? K.length === U.length && K.every((Z, ne) => Z === U[ne]) : K === U, w = (K) => Array.isArray(K) ? [...K] : K, y = (K) => { - const U = K.input, Z = String(U.subtype), ne = m[Z] ?? [], xe = {}, _e = (ie, Fe, He) => { - if (ie !== "contents" && v.indexOf(ie) < 0 && ne.indexOf(ie) < 0) { + }, N = (K, U) => Array.isArray(K) && Array.isArray(U) ? K.length === U.length && K.every((X, re) => X === U[re]) : K === U, w = (K) => Array.isArray(K) ? [...K] : K, y = (K) => { + const U = K.input, X = String(U.subtype), re = m[X] ?? [], xe = {}, Le = (Me, It, rt) => { + if (Me !== "contents" && v.indexOf(Me) < 0 && re.indexOf(Me) < 0) { a( "unsupported-api", - `Annot.${ie} is not writable on subtype '${Z}' (write ignored)` + `Annot.${Me} is not writable on subtype '${X}' (write ignored)` ); return; } - if (U.opaqueBody && v.indexOf(ie) < 0 && ie !== "contents") { + if (U.opaqueBody && v.indexOf(Me) < 0 && Me !== "contents") { a( "unsupported-api", - `Annot.${ie}: '${Z}' has an opaque appearance (write ignored)` + `Annot.${Me}: '${X}' has an opaque appearance (write ignored)` ); return; } - if (!He(Fe)) { - a("invalid-field-value", `Annot.${ie}: invalid value (write ignored)`); + if (!rt(It)) { + a("invalid-field-value", `Annot.${Me}: invalid value (write ignored)`); return; } - K.current[ie] = w(Fe); - }, Ie = (ie, Fe) => ({ + K.current[Me] = w(It); + }, Ie = (Me, It) => ({ enumerable: !0, - get: () => w(K.current[ie]), - set: (He) => _e(ie, He, Fe) - }), Le = (ie) => typeof ie == "number" && isFinite(ie), X = (ie) => typeof ie == "boolean"; + get: () => w(K.current[Me]), + set: (rt) => Le(Me, rt, It) + }), De = (Me) => typeof Me == "number" && isFinite(Me), qe = (Me) => typeof Me == "boolean"; return Object.defineProperties(xe, { name: { enumerable: !0, get: () => String(U.name ?? "") }, - type: { enumerable: !0, get: () => S[Z] ?? Z }, + type: { enumerable: !0, get: () => S[X] ?? X }, page: { enumerable: !0, get: () => Number(U.page ?? 0) }, author: { enumerable: !0, get: () => String(U.author ?? "") }, subject: { enumerable: !0, get: () => String(U.subject ?? "") }, strokeColor: Ie("strokeColor", C), fillColor: Ie("fillColor", C), - opacity: Ie("opacity", (ie) => Le(ie) && Number(ie) >= 0 && Number(ie) <= 1), - width: Ie("width", (ie) => Le(ie) && Number(ie) >= 0), - style: Ie("borderStyle", (ie) => ie === "S" || ie === "D"), - dash: Ie("dash", (ie) => Array.isArray(ie) && ie.every(Le)), + opacity: Ie("opacity", (Me) => De(Me) && Number(Me) >= 0 && Number(Me) <= 1), + width: Ie("width", (Me) => De(Me) && Number(Me) >= 0), + style: Ie("borderStyle", (Me) => Me === "S" || Me === "D"), + dash: Ie("dash", (Me) => Array.isArray(Me) && Me.every(De)), rect: Ie( "rect", - (ie) => Array.isArray(ie) && ie.length === 4 && ie.every(Le) + (Me) => Array.isArray(Me) && Me.length === 4 && Me.every(De) ), - contents: Ie("contents", (ie) => typeof ie == "string"), - hidden: Ie("hidden", X), - print: Ie("print", X), - readOnly: Ie("readOnly", X), - lock: Ie("locked", X), - noView: Ie("noView", X), - toggleNoView: Ie("toggleNoView", X), + contents: Ie("contents", (Me) => typeof Me == "string"), + hidden: Ie("hidden", qe), + print: Ie("print", qe), + readOnly: Ie("readOnly", qe), + lock: Ie("locked", qe), + noView: Ie("noView", qe), + toggleNoView: Ie("toggleNoView", qe), doc: { enumerable: !1, get: () => h } }), xe.getProps = () => { - const ie = {}; - for (const Fe of Object.keys(K.current)) - ie[Fe] = w(K.current[Fe]); - return ie; - }, xe.setProps = (ie) => { - const Fe = ie ?? {}; - for (const He of Object.keys(Fe)) - xe[He] = Fe[He]; + const Me = {}; + for (const It of Object.keys(K.current)) + Me[It] = w(K.current[It]); + return Me; + }, xe.setProps = (Me) => { + const It = Me ?? {}; + for (const rt of Object.keys(It)) + xe[rt] = It[rt]; }, xe; }, x = (K) => { if (!r) return null; @@ -41308,19 +41339,19 @@ function pz(e) { "unsupported-api", "getAnnots: whole-document search is limited to the prefetched pages (compatibility deviation)" ), r.annots.length ? r.annots.map((xe) => xe.wrapper) : null; - const Z = Math.trunc(Number(U)); - if (!r.annotPages.has(Z)) + const X = Math.trunc(Number(U)); + if (!r.annotPages.has(X)) return a( "unsupported-api", - `getAnnots: page ${Z} is outside the prefetched annots plane (compatibility deviation)` + `getAnnots: page ${X} is outside the prefetched annots plane (compatibility deviation)` ), null; - const ne = r.annotsByPage.get(Z) ?? []; - return ne.length ? ne.map((xe) => xe.wrapper) : null; + const re = r.annotsByPage.get(X) ?? []; + return re.length ? re.map((xe) => xe.wrapper) : null; }, A = (K, U) => { - const Z = x({ nPage: K }); - if (!Z) return null; - for (const ne of Z) - if (String(ne.name) === String(U)) return ne; + const X = x({ nPage: K }); + if (!X) return null; + for (const re of X) + if (String(re.name) === String(U)) return re; return null; }; h.getAnnots = x, h.getAnnot = A, Object.defineProperties(h, { @@ -41339,21 +41370,21 @@ function pz(e) { } }), h.getField = p, h.getNthFieldName = (K) => String(r?.fields[Math.trunc(Number(K))]?.input.name ?? ""), h.resetForm = (K) => { if (!r) return; - const U = K === void 0 ? r.fields : (Array.isArray(K) ? K : [K]).map((Z) => r.fieldsByName.get(String(Z))).filter((Z) => Z !== void 0); - for (const Z of U) { - Z.value = o(Z.input.defaultValue); - const ne = i(Z.input.ref); - r.resetKeys.has(ne) || (r.resetKeys.add(ne), r.resetRefs.push(Z.input.ref)); + const U = K === void 0 ? r.fields : (Array.isArray(K) ? K : [K]).map((X) => r.fieldsByName.get(String(X))).filter((X) => X !== void 0); + for (const X of U) { + X.value = o(X.input.defaultValue); + const re = i(X.input.ref); + r.resetKeys.has(re) || (r.resetKeys.add(re), r.resetRefs.push(X.input.ref)); } - }, h.print = () => r?.uiEffects.push({ type: "print" }), h.submitForm = (K, U, Z, ne) => { + }, h.print = () => r?.uiEffects.push({ type: "print" }), h.submitForm = (K, U, X, re) => { if (!r) return; - const xe = K !== null && typeof K == "object" ? K : { cURL: K, bFDF: U, bEmpty: Z, aFields: ne }, _e = Array.isArray(xe.aFields) ? xe.aFields.map((X) => String(X)) : null, Ie = xe.cSubmitAs === void 0 ? void 0 : String(xe.cSubmitAs).toUpperCase(), Le = Ie === "FDF" ? "fdf" : Ie === "XFDF" ? "xfdf" : Ie === "HTML" ? "html" : Ie === "PDF" ? "pdf" : xe.bFDF === !1 ? "html" : void 0; + const xe = K !== null && typeof K == "object" ? K : { cURL: K, bFDF: U, bEmpty: X, aFields: re }, Le = Array.isArray(xe.aFields) ? xe.aFields.map((qe) => String(qe)) : null, Ie = xe.cSubmitAs === void 0 ? void 0 : String(xe.cSubmitAs).toUpperCase(), De = Ie === "FDF" ? "fdf" : Ie === "XFDF" ? "xfdf" : Ie === "HTML" ? "html" : Ie === "PDF" ? "pdf" : xe.bFDF === !1 ? "html" : void 0; r.uiEffects.push({ type: "submitForm", url: xe.cURL === void 0 || xe.cURL === null ? null : String(xe.cURL), - fieldNames: _e, + fieldNames: Le, includeEmpty: !!xe.bEmpty, - ...Le === void 0 ? {} : { format: Le }, + ...De === void 0 ? {} : { format: De }, ...xe.bGet === void 0 ? {} : { method: xe.bGet ? "get" : "post" } }); }, h.mailDoc = () => c("mailDoc"), h.getURL = () => c("getURL"); @@ -41369,11 +41400,11 @@ function pz(e) { viewerVariation: "Reader", viewerVersion: 21, formsVersion: 21, - alert: (K, U, Z, ne) => (r?.uiEffects.push({ + alert: (K, U, X, re) => (r?.uiEffects.push({ type: "alert", message: String(K), icon: Number.isFinite(Number(U)) ? Number(U) : 0, - ...ne === void 0 ? {} : { title: String(ne) } + ...re === void 0 ? {} : { title: String(re) } }), 1), beep: () => a("unsupported-api", "app.beep is not supported in v1"), response: () => (a("unsupported-api", "app.response is not supported in v1"), null), @@ -41412,140 +41443,140 @@ function pz(e) { "November", "December" ], T = (K, U) => { - const Z = r?.input.environment ?? {}, ne = U && typeof U.getTime == "function" ? new n(Number(U.getTime())) : new n(Number(Z.nowMs ?? 0)), xe = new n( - ne.getTime() + Number(Z.utcOffsetMinutes ?? 0) * 6e4 - ), _e = xe.getUTCFullYear(), Ie = xe.getUTCMonth(), Le = xe.getUTCDate(), X = xe.getUTCHours(), ie = xe.getUTCMinutes(), Fe = xe.getUTCSeconds(), He = X % 12 === 0 ? 12 : X % 12, ut = { - yyyy: String(_e), - yy: E(_e % 100), + const X = r?.input.environment ?? {}, re = U && typeof U.getTime == "function" ? new n(Number(U.getTime())) : new n(Number(X.nowMs ?? 0)), xe = new n( + re.getTime() + Number(X.utcOffsetMinutes ?? 0) * 6e4 + ), Le = xe.getUTCFullYear(), Ie = xe.getUTCMonth(), De = xe.getUTCDate(), qe = xe.getUTCHours(), Me = xe.getUTCMinutes(), It = xe.getUTCSeconds(), rt = qe % 12 === 0 ? 12 : qe % 12, Z = { + yyyy: String(Le), + yy: E(Le % 100), mmmm: O[Ie], mmm: I[Ie], mm: E(Ie + 1), m: String(Ie + 1), - dd: E(Le), - d: String(Le), - HH: E(X), - hh: E(He), - h: String(He), - H: String(X), - MM: E(ie), - M: String(ie), - ss: E(Fe), - tt: X < 12 ? "am" : "pm" + dd: E(De), + d: String(De), + HH: E(qe), + hh: E(rt), + h: String(rt), + H: String(qe), + MM: E(Me), + M: String(Me), + ss: E(It), + tt: qe < 12 ? "am" : "pm" }; return String(K).replace( /yyyy|mmmm|mmm|yy|mm|dd|HH|hh|MM|ss|tt|m|d|H|h|M/g, - ($e) => ut[$e] + (fe) => Z[fe] ); }, R = { printd: T, printf: (K, ...U) => { - let Z = 0; - return String(K).replace(/%(?:,?\d*(?:\.\d+)?)?[dfs]/g, (ne) => { - const xe = U[Z++]; - if (ne.endsWith("s")) return String(xe ?? ""); - if (ne.endsWith("d")) return String(Math.trunc(l(xe))); - const _e = /\.(\d+)/.exec(ne)?.[1]; - return l(xe).toFixed(_e ? Number(_e) : 0); + let X = 0; + return String(K).replace(/%(?:,?\d*(?:\.\d+)?)?[dfs]/g, (re) => { + const xe = U[X++]; + if (re.endsWith("s")) return String(xe ?? ""); + if (re.endsWith("d")) return String(Math.trunc(l(xe))); + const Le = /\.(\d+)/.exec(re)?.[1]; + return l(xe).toFixed(Le ? Number(Le) : 0); }); } }, M = (K, U) => { - const Z = (K.fields ?? []).map(($e) => { - const gt = { - input: $e, - originalValue: o($e.value), - value: o($e.value), - originalDisplay: String($e.display ?? "visible"), - display: String($e.display ?? "visible"), + const X = (K.fields ?? []).map((fe) => { + const Fe = { + input: fe, + originalValue: o(fe.value), + value: o(fe.value), + originalDisplay: String(fe.display ?? "visible"), + display: String(fe.display ?? "visible"), wrapper: {} }; - return gt.wrapper = g(gt), gt; - }), ne = new Map(Z.map(($e) => [String($e.input.name), $e])), xe = new Map(Z.map(($e) => [i($e.input.ref), $e])), _e = (K.annots ?? []).map( - ($e) => { - const gt = () => ({ - strokeColor: w($e.strokeColor ?? ["T"]), - fillColor: w($e.fillColor ?? ["T"]), - opacity: Number($e.opacity ?? 1), - width: Number($e.width ?? 1), - borderStyle: String($e.borderStyle ?? "S"), - dash: w($e.dash ?? []), - rect: w($e.rect ?? [0, 0, 0, 0]), - contents: String($e.contents ?? ""), - hidden: !!$e.hidden, - print: !!$e.print, - readOnly: !!$e.readOnly, - locked: !!$e.locked, - noView: !!$e.noView, - toggleNoView: !!$e.toggleNoView - }), qt = { - input: $e, - original: gt(), - current: gt(), + return Fe.wrapper = g(Fe), Fe; + }), re = new Map(X.map((fe) => [String(fe.input.name), fe])), xe = new Map(X.map((fe) => [i(fe.input.ref), fe])), Le = (K.annots ?? []).map( + (fe) => { + const Fe = () => ({ + strokeColor: w(fe.strokeColor ?? ["T"]), + fillColor: w(fe.fillColor ?? ["T"]), + opacity: Number(fe.opacity ?? 1), + width: Number(fe.width ?? 1), + borderStyle: String(fe.borderStyle ?? "S"), + dash: w(fe.dash ?? []), + rect: w(fe.rect ?? [0, 0, 0, 0]), + contents: String(fe.contents ?? ""), + hidden: !!fe.hidden, + print: !!fe.print, + readOnly: !!fe.readOnly, + locked: !!fe.locked, + noView: !!fe.noView, + toggleNoView: !!fe.toggleNoView + }), ht = { + input: fe, + original: Fe(), + current: Fe(), wrapper: {} }; - return qt.wrapper = y(qt), qt; + return ht.wrapper = y(ht), ht; } ), Ie = /* @__PURE__ */ new Map(); - for (const $e of _e) { - const gt = Number($e.input.page ?? 0), qt = Ie.get(gt); - qt ? qt.push($e) : Ie.set(gt, [$e]); + for (const fe of Le) { + const Fe = Number(fe.input.page ?? 0), ht = Ie.get(Fe); + ht ? ht.push(fe) : Ie.set(Fe, [fe]); } - const Le = K.event ?? {}, X = xe.get(i(Le.target)), ie = xe.get(i(Le.source)), Fe = Le.value !== void 0 ? o(Le.value) : o(X?.value ?? null), He = Le.type !== void 0 ? String(Le.type) : Le.kind === "name-tree-boot" ? "Doc" : "Field", ut = { + const De = K.event ?? {}, qe = xe.get(i(De.target)), Me = xe.get(i(De.source)), It = De.value !== void 0 ? o(De.value) : o(qe?.value ?? null), rt = De.type !== void 0 ? String(De.type) : De.kind === "name-tree-boot" ? "Doc" : "Field", Z = { // Explicit type/name (action-driven runs, from trigger provenance) // beat the kind-derived defaults (the K/V/C/F pipeline path). - name: Le.name !== void 0 ? String(Le.name) : f(String(Le.kind ?? "")), - type: He, + name: De.name !== void 0 ? String(De.name) : d(String(De.kind ?? "")), + type: rt, // Doc-typed events target the Doc object (Acrobat's WillSave // boilerplate does `event.target.getField(...)`); field targets win // when present (a widget-anchored run). - target: X?.wrapper ?? (He === "Doc" ? h : null), - targetName: String(X?.input.name ?? ""), - source: ie?.wrapper ?? { source: h }, - value: Fe, - change: String(Le.change ?? ""), - selStart: Math.max(0, Math.trunc(Number(Le.selStart ?? 0))), - selEnd: Math.max(0, Math.trunc(Number(Le.selEnd ?? 0))), - willCommit: !!Le.willCommit, - modifier: !!Le.modifier, - shift: !!Le.shift, + target: qe?.wrapper ?? (rt === "Doc" ? h : null), + targetName: String(qe?.input.name ?? ""), + source: Me?.wrapper ?? { source: h }, + value: It, + change: String(De.change ?? ""), + selStart: Math.max(0, Math.trunc(Number(De.selStart ?? 0))), + selEnd: Math.max(0, Math.trunc(Number(De.selEnd ?? 0))), + willCommit: !!De.willCommit, + modifier: !!De.modifier, + shift: !!De.shift, rc: !0 }; r = { input: K, - fields: Z, - fieldsByName: ne, + fields: X, + fieldsByName: re, fieldsByRef: xe, - annots: _e, + annots: Le, annotsByPage: Ie, annotPages: new Set( - (K.annotPages ?? []).map(($e) => Math.trunc(Number($e))) + (K.annotPages ?? []).map((fe) => Math.trunc(Number(fe))) ), annotsCoverDocument: !!K.annotsCoverDocument, - event: ut, + event: Z, resetRefs: [], resetKeys: /* @__PURE__ */ new Set(), uiEffects: [], diagnostics: [], randomState: Number(K.environment?.randomSeed ?? 1) >>> 0, maxEffects: Math.max(1, Math.trunc(Number(U?.maxEffects ?? 256))) - }, t.event = ut, t.identity = { ...K.identity ?? {} }; + }, t.event = Z, t.identity = { ...K.identity ?? {} }; }, F = (K, U) => { - const Z = String(K.input.kind); - if (Z === "text") return { value: String(U ?? "") }; - if (Z === "checkbox" || Z === "radio") + const X = String(K.input.kind); + if (X === "text") return { value: String(U ?? "") }; + if (X === "checkbox" || X === "radio") return { value: U == null || String(U) === "Off" ? null : String(U) }; - if (Z === "combobox") { - const ne = Array.isArray(U) ? U[0] : U, xe = ne == null ? "" : String(ne); + if (X === "combobox") { + const re = Array.isArray(U) ? U[0] : U, xe = re == null ? "" : String(re); return { value: xe === "" ? null : xe }; } - return Z === "listbox" ? Array.isArray(U) ? { selectedValues: U.map(String) } : { + return X === "listbox" ? Array.isArray(U) ? { selectedValues: U.map(String) } : { selectedValues: U == null || U === "" ? [] : [String(U)] } : (a( "invalid-field-value", `field '${String(K.input.name)}' cannot accept a scripted value` ), null); - }, B = () => ({ + }, _ = () => ({ rc: !!r?.event.rc, value: o(r?.event.value ?? null), change: String(r?.event.change ?? ""), @@ -41553,50 +41584,50 @@ function pz(e) { selEnd: Math.max(0, Math.trunc(Number(r?.event.selEnd ?? 0))) }), $ = () => { if (!r) throw new Error("AcroJS run state was not initialized"); - const K = r.input.event, U = r.fieldsByRef.get(i(K.target)), Z = String(K.kind ?? ""); - U && Z === "field-calculate" && (U.value = o(r.event.value)); - const ne = []; - r.resetRefs.length > 0 && ne.push({ kind: "reset", refs: [...r.resetRefs] }); + const K = r.input.event, U = r.fieldsByRef.get(i(K.target)), X = String(K.kind ?? ""); + U && X === "field-calculate" && (U.value = o(r.event.value)); + const re = []; + r.resetRefs.length > 0 && re.push({ kind: "reset", refs: [...r.resetRefs] }); for (const Ie of r.fields) { - const Le = i(Ie.input.ref), X = r.resetKeys.has(Le) ? Ie.input.defaultValue : Ie.originalValue; - if (!s(Ie.value, X)) { - const ie = F(Ie, Ie.value); - ie && ne.push({ kind: "setValue", ref: Ie.input.ref, value: ie }); + const De = i(Ie.input.ref), qe = r.resetKeys.has(De) ? Ie.input.defaultValue : Ie.originalValue; + if (!s(Ie.value, qe)) { + const Me = F(Ie, Ie.value); + Me && re.push({ kind: "setValue", ref: Ie.input.ref, value: Me }); } - Ie.display !== Ie.originalDisplay && ne.push({ kind: "setDisplay", ref: Ie.input.ref, display: Ie.display }); + Ie.display !== Ie.originalDisplay && re.push({ kind: "setDisplay", ref: Ie.input.ref, display: Ie.display }); } - U && Z === "field-format" && ne.push({ + U && X === "field-format" && re.push({ kind: "setAppearanceText", ref: U.input.ref, text: String(r.event.value ?? "") }); const xe = []; for (const Ie of r.annots) { - const Le = {}, X = {}; - for (const ie of Object.keys(Ie.current)) - N(Ie.current[ie], Ie.original[ie]) || (v.indexOf(ie) >= 0 ? X[ie] = Ie.current[ie] : Le[ie] = w(Ie.current[ie])); - Object.keys(X).length > 0 && (Le.flags = X), Object.keys(Le).length > 0 && xe.push({ ref: Ie.input.ref, patch: Le }); - } - const _e = ne.length + xe.length + r.uiEffects.length; - return _e > r.maxEffects ? { - event: B(), + const De = {}, qe = {}; + for (const Me of Object.keys(Ie.current)) + N(Ie.current[Me], Ie.original[Me]) || (v.indexOf(Me) >= 0 ? qe[Me] = Ie.current[Me] : De[Me] = w(Ie.current[Me])); + Object.keys(qe).length > 0 && (De.flags = qe), Object.keys(De).length > 0 && xe.push({ ref: Ie.input.ref, patch: De }); + } + const Le = re.length + xe.length + r.uiEffects.length; + return Le > r.maxEffects ? { + event: _(), formEffects: [], annotEffects: [], uiEffects: [], diagnostics: [...r.diagnostics], error: { kind: "budget", - message: `script produced ${_e} effects; limit is ${r.maxEffects}` + message: `script produced ${Le} effects; limit is ${r.maxEffects}` } } : { - event: B(), - formEffects: ne, + event: _(), + formEffects: re, annotEffects: xe, uiEffects: [...r.uiEffects], diagnostics: [...r.diagnostics] }; }, D = (K) => ({ - event: B(), + event: _(), formEffects: [], annotEffects: [], uiEffects: [], @@ -41606,23 +41637,23 @@ function pz(e) { message: K instanceof Error ? K.message : String(K), ...K instanceof Error && K.stack ? { stack: K.stack } : {} } - }), _ = (K) => (0, eval)(K); + }), B = (K) => (0, eval)(K); Object.defineProperties(t, { - __acrojsBoot: { configurable: !1, writable: !1, value: (K, U, Z) => { - M(U, Z); + __acrojsBoot: { configurable: !1, writable: !1, value: (K, U, X) => { + M(U, X); try { - for (const ne of K ?? []) _(String(ne)); + for (const re of K ?? []) B(String(re)); return $(); - } catch (ne) { - return D(ne); + } catch (re) { + return D(re); } } }, - __acrojsRun: { configurable: !1, writable: !1, value: (K, U, Z) => { - M(U, Z); + __acrojsRun: { configurable: !1, writable: !1, value: (K, U, X) => { + M(U, X); try { - return _(String(K)), $(); - } catch (ne) { - return D(ne); + return B(String(K)), $(); + } catch (re) { + return D(re); } } } }), t.app = b, t.util = R, t.display = Object.freeze({ visible: 0, hidden: 1, noPrint: 2, noView: 3 }), t.color = Object.freeze({ @@ -41640,20 +41671,20 @@ function pz(e) { yellow: Object.freeze(["CMYK", 0, 0, 1, 0]), convert: (K, U) => { if (!C(K)) return ["T"]; - const Z = String(U), ne = k(K); - if (Z === "T" || ne === null) return ["T"]; - if (Z === "G") return ["G", 0.3 * ne[0] + 0.59 * ne[1] + 0.11 * ne[2]]; - if (Z === "RGB") return ["RGB", ne[0], ne[1], ne[2]]; - if (Z === "CMYK") { - const xe = 1 - Math.max(ne[0], ne[1], ne[2]); - return ["CMYK", 1 - ne[0] - xe, 1 - ne[1] - xe, 1 - ne[2] - xe, xe]; + const X = String(U), re = k(K); + if (X === "T" || re === null) return ["T"]; + if (X === "G") return ["G", 0.3 * re[0] + 0.59 * re[1] + 0.11 * re[2]]; + if (X === "RGB") return ["RGB", re[0], re[1], re[2]]; + if (X === "CMYK") { + const xe = 1 - Math.max(re[0], re[1], re[2]); + return ["CMYK", 1 - re[0] - xe, 1 - re[1] - xe, 1 - re[2] - xe, xe]; } return ["T"]; }, equal: (K, U) => { if (!C(K) || !C(U)) return !1; - const Z = k(K), ne = k(U); - return Z === null || ne === null ? Z === ne : Z.every((xe, _e) => Math.abs(xe - ne[_e]) < 1e-6); + const X = k(K), re = k(U); + return X === null || re === null ? X === re : X.every((xe, Le) => Math.abs(xe - re[Le]) < 1e-6); } }), t.getField = p, t.getAnnots = x, t.getAnnot = A, t.resetForm = h.resetForm, t.print = h.print, t.submitForm = h.submitForm, t.mailDoc = h.mailDoc, t.getURL = h.getURL, Object.defineProperties(t, { documentFileName: { configurable: !0, get: () => h.documentFileName }, @@ -41685,24 +41716,24 @@ function pz(e) { t.Date = H; const Y = t.Math; Y && (Y.random = () => r ? (r.randomState = 1664525 * r.randomState + 1013904223 >>> 0, r.randomState / 4294967296) : 0), t.AFSimple_Calculate = (K, U) => { - const ne = (Array.isArray(U) ? U : String(U).split(",")).map((Ie) => l(p(String(Ie).trim())?.value)), xe = String(K).toUpperCase(), _e = ne.length === 0 ? 0 : xe === "PRD" ? ne.reduce((Ie, Le) => Ie * Le, 1) : xe === "AVG" ? ne.reduce((Ie, Le) => Ie + Le, 0) / ne.length : xe === "MIN" ? Math.min(...ne) : xe === "MAX" ? Math.max(...ne) : ne.reduce((Ie, Le) => Ie + Le, 0); - r && (r.event.value = _e); - }, t.AFNumber_Format = (K, U, Z, ne, xe, _e) => { + const re = (Array.isArray(U) ? U : String(U).split(",")).map((Ie) => l(p(String(Ie).trim())?.value)), xe = String(K).toUpperCase(), Le = re.length === 0 ? 0 : xe === "PRD" ? re.reduce((Ie, De) => Ie * De, 1) : xe === "AVG" ? re.reduce((Ie, De) => Ie + De, 0) / re.length : xe === "MIN" ? Math.min(...re) : xe === "MAX" ? Math.max(...re) : re.reduce((Ie, De) => Ie + De, 0); + r && (r.event.value = Le); + }, t.AFNumber_Format = (K, U, X, re, xe, Le) => { if (!r) return; const Ie = Math.max(0, Math.min(10, Math.trunc(Number(K)))); - let Le = l(r.event.value).toFixed(Ie); + let De = l(r.event.value).toFixed(Ie); if (Number(U) === 0 || Number(U) === 2) { - const [ie, Fe] = Le.split("."); - Le = `${ie.replace(/\B(?=(\d{3})+(?!\d))/g, ",")}${Fe === void 0 ? "" : `.${Fe}`}`; + const [Me, It] = De.split("."); + De = `${Me.replace(/\B(?=(\d{3})+(?!\d))/g, ",")}${It === void 0 ? "" : `.${It}`}`; } - const X = String(xe ?? ""); - r.event.value = _e ? `${X}${Le}` : `${Le}${X}`; + const qe = String(xe ?? ""); + r.event.value = Le ? `${qe}${De}` : `${De}${qe}`; }, t.AFPercent_Format = (K) => { if (!r) return; const U = Math.max(0, Math.min(10, Math.trunc(Number(K)))); r.event.value = `${(l(r.event.value) * 100).toFixed(U)}%`; }; - const ue = [ + const le = [ "m/d", "m/d/yy", "mm/dd/yy", @@ -41717,67 +41748,67 @@ function pz(e) { "mmmm d, yyyy", "m/d/yy h:MM tt", "m/d/yy HH:MM" - ], le = ["HH:MM", "h:MM tt", "HH:MM:ss", "h:MM:ss tt"], pe = (K) => { + ], ie = ["HH:MM", "h:MM tt", "HH:MM:ss", "h:MM:ss tt"], pe = (K) => { r && (r.uiEffects.push({ type: "alert", message: K, icon: 0 }), r.event.rc = !1); - }, ge = () => pe( + }, ve = () => pe( `The value entered does not match the format of the field [ ${String( r?.event.targetName ?? "" )} ]` - ), Me = (K) => pe( + ), _e = (K) => pe( `Invalid date/time: please ensure that the date/time exists. Field [ ${String( r?.event.targetName ?? "" )} ] should match format ${String(K ?? "")}` ), Be = (K) => { - const U = K ?? r?.event ?? {}, Z = String(U.value ?? ""); - if (U.willCommit) return Z; - const ne = Math.max(0, Math.trunc(Number(U.selStart ?? 0))), xe = Math.max(ne, Math.trunc(Number(U.selEnd ?? 0))); - return Z.slice(0, ne) + String(U.change ?? "") + Z.slice(xe); + const U = K ?? r?.event ?? {}, X = String(U.value ?? ""); + if (U.willCommit) return X; + const re = Math.max(0, Math.trunc(Number(U.selStart ?? 0))), xe = Math.max(re, Math.trunc(Number(U.selEnd ?? 0))); + return X.slice(0, re) + String(U.change ?? "") + X.slice(xe); }; t.AFMergeChange = Be; - const te = (K) => { + const ee = (K) => { if (typeof K == "number") return Number.isFinite(K) ? K : null; let U = String(K ?? "").trim(); if (U === "") return null; U = U.replace(/[^0-9,.\-+eE]/g, ""), U.includes(",") && U.includes(".") ? U = U.lastIndexOf(",") > U.lastIndexOf(".") ? U.replace(/\./g, "").replace(",", ".") : U.replace(/,/g, "") : U.includes(",") && (U = (U.match(/,/g) ?? []).length === 1 ? U.replace(",", ".") : U.replace(/,/g, "")); - const Z = Number(U); - return U !== "" && Number.isFinite(Z) ? Z : null; + const X = Number(U); + return U !== "" && Number.isFinite(X) ? X : null; }; - t.AFMakeNumber = te, t.AFExtractNums = (K) => { + t.AFMakeNumber = ee, t.AFExtractNums = (K) => { const U = String(K ?? "").match(/\d+/g); return U && U.length > 0 ? [...U] : null; }; const he = (K, U) => { - const Z = K.trim(); - return Z === "" ? !0 : (U === 2 || U === 3 ? /^[+-]?(\d+|\d{1,3}(\.\d{3})+)?(,\d*)?$/ : /^[+-]?(\d+|\d{1,3}(,\d{3})+)?(\.\d*)?$/).test(Z) && /\d/.test(Z); + const X = K.trim(); + return X === "" ? !0 : (U === 2 || U === 3 ? /^[+-]?(\d+|\d{1,3}(\.\d{3})+)?(,\d*)?$/ : /^[+-]?(\d+|\d{1,3}(,\d{3})+)?(\.\d*)?$/).test(X) && /\d/.test(X); }; - t.AFNumber_Keystroke = (K, U, Z, ne, xe) => { + t.AFNumber_Keystroke = (K, U, X, re, xe) => { if (!r || !r.event.willCommit) return; - const _e = Be(r.event), Ie = xe ? _e.split(String(xe)).join("") : _e; - he(Ie, Math.trunc(Number(U))) || ge(); + const Le = Be(r.event), Ie = xe ? Le.split(String(xe)).join("") : Le; + he(Ie, Math.trunc(Number(U))) || ve(); }, t.AFPercent_Keystroke = (K, U) => { if (!r || !r.event.willCommit) return; - const Z = Be(r.event).replace(/%\s*$/, ""); - he(Z, Math.trunc(Number(U))) || ge(); + const X = Be(r.event).replace(/%\s*$/, ""); + he(X, Math.trunc(Number(U))) || ve(); }; - const Te = (K) => String(K ?? "").replace(/\D/g, ""), ze = (K) => { + const Te = (K) => String(K ?? "").replace(/\D/g, ""), We = (K) => { if (!r) return; - const U = Te(r.event.value), Z = Math.trunc(Number(K)); - let ne = String(r.event.value ?? ""); - Z === 0 ? ne = U.slice(0, 5) : Z === 1 ? ne = `${U.slice(0, 5)}-${U.slice(5, 9)}` : Z === 2 ? ne = U.length >= 10 ? `(${U.slice(0, 3)}) ${U.slice(3, 6)}-${U.slice(6, 10)}` : `${U.slice(0, 3)}-${U.slice(3, 7)}` : Z === 3 && (ne = `${U.slice(0, 3)}-${U.slice(3, 5)}-${U.slice(5, 9)}`), r.event.value = ne; + const U = Te(r.event.value), X = Math.trunc(Number(K)); + let re = String(r.event.value ?? ""); + X === 0 ? re = U.slice(0, 5) : X === 1 ? re = `${U.slice(0, 5)}-${U.slice(5, 9)}` : X === 2 ? re = U.length >= 10 ? `(${U.slice(0, 3)}) ${U.slice(3, 6)}-${U.slice(6, 10)}` : `${U.slice(0, 3)}-${U.slice(3, 7)}` : X === 3 && (re = `${U.slice(0, 3)}-${U.slice(3, 5)}-${U.slice(5, 9)}`), r.event.value = re; }; - t.AFSpecial_Format = ze, t.AFSpecial_Keystroke = (K) => { + t.AFSpecial_Format = We, t.AFSpecial_Keystroke = (K) => { if (!r || !r.event.willCommit) return; const U = Be(r.event); if (U.trim() === "") return; - const Z = Te(U).length, ne = Math.trunc(Number(K)); - (ne === 0 ? Z === 5 : ne === 1 ? Z === 9 : ne === 2 ? Z === 7 || Z === 10 : Z === 9) || ge(); - }, t.AFRange_Validate = (K, U, Z, ne) => { + const X = Te(U).length, re = Math.trunc(Number(K)); + (re === 0 ? X === 5 : re === 1 ? X === 9 : re === 2 ? X === 7 || X === 10 : X === 9) || ve(); + }, t.AFRange_Validate = (K, U, X, re) => { if (!r) return; - const xe = te(r.event.value); + const xe = ee(r.event.value); if (xe === null) return; - const _e = !!K, Ie = !!Z, Le = Number(U), X = Number(ne); - (!_e || xe >= Le) && (!Ie || xe <= X) || pe( - _e && Ie ? `Invalid value: must be greater than or equal to ${Le} and less than or equal to ${X}.` : _e ? `Invalid value: must be greater than or equal to ${Le}.` : `Invalid value: must be less than or equal to ${X}.` + const Le = !!K, Ie = !!X, De = Number(U), qe = Number(re); + (!Le || xe >= De) && (!Ie || xe <= qe) || pe( + Le && Ie ? `Invalid value: must be greater than or equal to ${De} and less than or equal to ${qe}.` : Le ? `Invalid value: must be greater than or equal to ${De}.` : `Invalid value: must be less than or equal to ${qe}.` ); }; const ae = () => { @@ -41792,52 +41823,52 @@ function pz(e) { M: 0, S: 0 }; - }, me = (K) => { + }, ge = (K) => { const U = r?.input.environment ?? {}; return new n( n.UTC(K.y, K.m - 1, K.d, K.H, K.M, K.S) - Number(U.utcOffsetMinutes ?? 0) * 6e4 ); - }, W = (K, U, Z) => { - const ne = String(K ?? "").trim(); - if (ne === "") return null; - const xe = ne.toLowerCase(); - let _e = null; - for (let pn = 0; pn < 12; pn += 1) - if (xe.indexOf(I[pn].toLowerCase()) >= 0) { - _e = pn + 1; + }, W = (K, U, X) => { + const re = String(K ?? "").trim(); + if (re === "") return null; + const xe = re.toLowerCase(); + let Le = null; + for (let $t = 0; $t < 12; $t += 1) + if (xe.indexOf(I[$t].toLowerCase()) >= 0) { + Le = $t + 1; break; } - const Ie = /(\d{1,2}):(\d{2})(?::(\d{2}))?\s*(am|pm)?/i.exec(ne); - let Le = 0, X = 0, ie = 0; + const Ie = /(\d{1,2}):(\d{2})(?::(\d{2}))?\s*(am|pm)?/i.exec(re); + let De = 0, qe = 0, Me = 0; if (Ie) { - Le = Number(Ie[1]), X = Number(Ie[2]), ie = Number(Ie[3] ?? 0); - const pn = String(Ie[4] ?? "").toLowerCase(); - if (pn === "pm" && Le < 12 && (Le += 12), pn === "am" && Le === 12 && (Le = 0), Le > 23 || X > 59 || ie > 59) return null; - } - const He = ((Ie ? ne.slice(0, Ie.index) + ne.slice(Ie.index + Ie[0].length) : ne).match(/\d+/g) ?? []).map((pn) => Number(pn)), ut = []; - for (const pn of String(U ?? "").match(/yyyy|mmmm|mmm|yy|mm|dd|m|d/g) ?? []) { - const Jo = pn[0] === "y" ? "y" : pn[0] === "m" ? "m" : "d"; - ut.indexOf(Jo) < 0 && ut.push(Jo); - } - let $e = null, gt = _e, qt = null, $t = 0; - for (const pn of ut) { - if (pn === "m" && _e !== null) continue; - if ($t >= He.length) break; - const Jo = He[$t]; - $t += 1, pn === "y" ? $e = Jo : pn === "m" ? gt = Jo : qt = Jo; - } - if ($e === null && gt === null && qt === null && !Ie || ($e === null ? $e = Z.y : $e < 100 && ($e = $e < 50 ? 2e3 + $e : 1900 + $e), gt === null && (gt = Z.m), qt === null && (qt = 1), gt < 1 || gt > 12 || qt < 1 || qt > 31)) return null; - const nn = new n(n.UTC($e, gt - 1, qt)); - return nn.getUTCFullYear() !== $e || nn.getUTCMonth() !== gt - 1 || nn.getUTCDate() !== qt ? null : { y: $e, m: gt, d: qt, H: Le, M: X, S: ie }; + De = Number(Ie[1]), qe = Number(Ie[2]), Me = Number(Ie[3] ?? 0); + const $t = String(Ie[4] ?? "").toLowerCase(); + if ($t === "pm" && De < 12 && (De += 12), $t === "am" && De === 12 && (De = 0), De > 23 || qe > 59 || Me > 59) return null; + } + const rt = ((Ie ? re.slice(0, Ie.index) + re.slice(Ie.index + Ie[0].length) : re).match(/\d+/g) ?? []).map(($t) => Number($t)), Z = []; + for (const $t of String(U ?? "").match(/yyyy|mmmm|mmm|yy|mm|dd|m|d/g) ?? []) { + const Fr = $t[0] === "y" ? "y" : $t[0] === "m" ? "m" : "d"; + Z.indexOf(Fr) < 0 && Z.push(Fr); + } + let fe = null, Fe = Le, ht = null, At = 0; + for (const $t of Z) { + if ($t === "m" && Le !== null) continue; + if (At >= rt.length) break; + const Fr = rt[At]; + At += 1, $t === "y" ? fe = Fr : $t === "m" ? Fe = Fr : ht = Fr; + } + if (fe === null && Fe === null && ht === null && !Ie || (fe === null ? fe = X.y : fe < 100 && (fe = fe < 50 ? 2e3 + fe : 1900 + fe), Fe === null && (Fe = X.m), ht === null && (ht = 1), Fe < 1 || Fe > 12 || ht < 1 || ht > 31)) return null; + const Nt = new n(n.UTC(fe, Fe - 1, ht)); + return Nt.getUTCFullYear() !== fe || Nt.getUTCMonth() !== Fe - 1 || Nt.getUTCDate() !== ht ? null : { y: fe, m: Fe, d: ht, H: De, M: qe, S: Me }; }, Se = (K, U) => W(K, U, ae()); Object.defineProperty(t, "__acrojsParseDate", { configurable: !1, writable: !1, - value: (K, U, Z) => { - const ne = Z ?? {}, xe = W(K, U, { - y: Number(ne.year), - m: Number(ne.month), - d: Number(ne.day) + value: (K, U, X) => { + const re = X ?? {}, xe = W(K, U, { + y: Number(re.year), + m: Number(re.month), + d: Number(re.day) }); return xe && { year: xe.y, @@ -41853,27 +41884,27 @@ function pz(e) { if (!r) return; const U = String(r.event.value ?? ""); if (U.trim() === "") return; - const Z = Se(U, K), ne = Z ? me(Z) : new H(U); - Number.isNaN(ne.getTime()) || (r.event.value = T(K, ne)); + const X = Se(U, K), re = X ? ge(X) : new H(U); + Number.isNaN(re.getTime()) || (r.event.value = T(K, re)); }; - t.AFDate_FormatEx = Ae, t.AFDate_Format = (K) => Ae(ue[Math.trunc(Number(K))] ?? "m/d/yy"); + t.AFDate_FormatEx = Ae, t.AFDate_Format = (K) => Ae(le[Math.trunc(Number(K))] ?? "m/d/yy"); const ce = (K) => { if (!r || !r.event.willCommit) return; const U = Be(r.event); - U.trim() !== "" && (Se(U, K) || Me(K)); + U.trim() !== "" && (Se(U, K) || _e(K)); }; - t.AFDate_KeystrokeEx = ce, t.AFDate_Keystroke = (K) => ce(ue[Math.trunc(Number(K))] ?? "m/d/yy"); + t.AFDate_KeystrokeEx = ce, t.AFDate_Keystroke = (K) => ce(le[Math.trunc(Number(K))] ?? "m/d/yy"); const Ne = (K) => { if (!r) return; const U = String(r.event.value ?? ""); if (U.trim() === "") return; - const Z = Se(U, K); - Z && (r.event.value = T(K, me(Z))); + const X = Se(U, K); + X && (r.event.value = T(K, ge(X))); }; - t.AFTime_FormatEx = Ne, t.AFTime_Format = (K) => Ne(le[Math.trunc(Number(K))] ?? "HH:MM"), t.AFTime_Keystroke = (K) => { + t.AFTime_FormatEx = Ne, t.AFTime_Format = (K) => Ne(ie[Math.trunc(Number(K))] ?? "HH:MM"), t.AFTime_Keystroke = (K) => { if (!r || !r.event.willCommit) return; const U = Be(r.event); - U.trim() !== "" && (Se(U, le[Math.trunc(Number(K))] ?? "HH:MM") || Me(le[Math.trunc(Number(K))] ?? "HH:MM")); + U.trim() !== "" && (Se(U, ie[Math.trunc(Number(K))] ?? "HH:MM") || _e(ie[Math.trunc(Number(K))] ?? "HH:MM")); }, t.fetch = void 0, t.XMLHttpRequest = void 0, t.WebSocket = void 0; } const BDe = `(${pz.toString()})(globalThis);`; @@ -41966,16 +41997,16 @@ function M0e(e, { store: t, geometry: n }) { continue; } const l = t.model().byId[`obj:${c.annotObjectNumber}`], u = l?.annotation.page.objectNumber ?? c.page?.objectNumber; - let d = Sn(l), f = l?.annotation.subtype; - if ((!d || !f) && u !== void 0) + let f = Sn(l), d = l?.annotation.subtype; + if ((!f || !d) && u !== void 0) try { - const { annotations: g } = await s.page(Lt(u)).annotations.list(), p = g.find( + const { annotations: g } = await s.page(Ft(u)).annotations.list(), p = g.find( (m) => m.ref.kind === "objectNumber" && m.ref.objectNumber === c.annotObjectNumber ); - p && (d = p.ref, f = p.subtype); + p && (f = p.ref, d = p.subtype); } catch { } - if (u === void 0 || !d || !f) { + if (u === void 0 || !f || !d) { i.push({ annotObjectNumber: c.annotObjectNumber, status: "failed", @@ -41983,7 +42014,7 @@ function M0e(e, { store: t, geometry: n }) { }); continue; } - const h = T0e(f, c.patch, n.cropOf(u)); + const h = T0e(d, c.patch, n.cropOf(u)); if (h instanceof Error) { i.push({ annotObjectNumber: c.annotObjectNumber, @@ -41993,7 +42024,7 @@ function M0e(e, { store: t, geometry: n }) { continue; } try { - await Va(t.apply([{ type: "update", ref: d, patch: h }])), i.push({ annotObjectNumber: c.annotObjectNumber, status: "applied" }); + await Va(t.apply([{ type: "update", ref: f, patch: h }])), i.push({ annotObjectNumber: c.annotObjectNumber, status: "applied" }); } catch (g) { a = !0, i.push({ annotObjectNumber: c.annotObjectNumber, @@ -42006,7 +42037,7 @@ function M0e(e, { store: t, geometry: n }) { } } }; } -const dh = 10; +const hh = 10; function B0e(e, { store: t, authority: n, @@ -42014,8 +42045,8 @@ function B0e(e, { behaviors: o, lending: s, geometry: i -}, a, c, l, u, d) { - const f = () => iO(t.model(), t.model().selected), h = (w) => { +}, a, c, l, u, f) { + const d = () => iO(t.model(), t.model().selected), h = (w) => { const y = [], x = []; for (const A of w) (s.owns(oe(A)) ? x : y).push(A); return { own: y, lent: x }; @@ -42023,10 +42054,10 @@ function B0e(e, { const w = a.selectedRecords().flatMap(({ annotation: x }) => { const A = i.pageBoxOf(x.page.objectNumber); return A ? [{ rect: x.rect, page: A }] : []; - }), y = (x, A) => w.some(({ rect: b, page: E }) => b[x] + b[A] + dh > E[A]) && w.every(({ rect: b }) => b[x] - dh >= 0); + }), y = (x, A) => w.some(({ rect: b, page: E }) => b[x] + b[A] + hh > E[A]) && w.every(({ rect: b }) => b[x] - hh >= 0); return { - x: y("x", "width") ? -dh : dh, - y: y("y", "height") ? -dh : dh + x: y("x", "width") ? -hh : hh, + y: y("y", "height") ? -hh : hh }; }, p = () => { const w = {}; @@ -42036,7 +42067,7 @@ function B0e(e, { } return w; }, m = async (w, y) => { - const x = f(), A = await e.cancellable( + const x = d(), A = await e.cancellable( y, Promise.all(w().map((b) => b.written)) ); @@ -42056,7 +42087,7 @@ function B0e(e, { u.styleTyping(E, T); else if (Object.keys(T).length) { const M = FH( - { paragraphs: Yl(I.annotation, r).paragraphs }, + { paragraphs: Ql(I.annotation, r).paragraphs }, x, T ); @@ -42132,7 +42163,7 @@ function B0e(e, { O && await N(I, { to: O, type: "group" }, w); }, ungroup: async (w = {}) => { - const y = t.model(), x = VS(y, y.selected).map((A) => y.byId[A]).filter((A) => !!A && !!Tf(A.annotation)); + const y = t.model(), x = VS(y, y.selected).map((A) => y.byId[A]).filter((A) => !!A && !!Bf(A.annotation)); await N(x, null, w); }, canGroup: () => { @@ -42148,7 +42179,7 @@ function B0e(e, { return !(x.size === 1 && !x.has(null)); }, canUngroup: () => { - const w = t.model(), y = VS(w, w.selected).map((x) => w.byId[x]).filter((x) => !!x && !!Tf(x.annotation)); + const w = t.model(), y = VS(w, w.selected).map((x) => w.byId[x]).filter((x) => !!x && !!Bf(x.annotation)); return y.length > 0 && y.every((x) => { const A = Sn(x); return A != null && n.allowsMutation("update", A); @@ -42159,8 +42190,8 @@ function B0e(e, { // A lent record (a form's widget) is its lender's to copy, in the same // change: what a person does to the selection goes to each record's owner. duplicate: (w = {}) => { - const { own: y, lent: x } = h(f()); - return d.duplicate( + const { own: y, lent: x } = h(d()); + return f.duplicate( y, { offset: w.offset ?? g(), @@ -42171,7 +42202,7 @@ function B0e(e, { ); }, canDuplicate: () => { - const { own: w, lent: y } = h(f()); + const { own: w, lent: y } = h(d()); if (!w.length && !y.length || w.length && !n.canDuplicate(w)) return !1; const x = s.lender(), A = t.model(); return y.every((b) => { @@ -42194,7 +42225,7 @@ function yz(e, t = 4096) { const n = Math.max(128, Math.ceil(e)); return Math.min(t, 2 ** Math.ceil(Math.log2(n))); } -const _n = vt, aO = () => new re( +const _n = vt, aO = () => new te( "invalid-input", "annotation", "a stamp must be PNG, JPEG, or one-page PDF bytes" @@ -42215,7 +42246,7 @@ const _n = vt, aO = () => new re( async function cO(e, t, n) { if (typeof e.preview == "function") return _0e(e.preview); if (e.preview) { - const r = await Vo(e.preview); + const r = await $o(e.preview); return VD(new Uint8Array(r.bytes), r.mimeType); } return n === "application/pdf" ? null : VD(new Uint8Array(t), n); @@ -42225,7 +42256,7 @@ const lO = (e, t, n) => { return t === void 0 ? r : { width: t, height: t * (r.height / r.width) }; }; async function $D(e) { - const t = await Vo(e), n = im(t.bytes); + const t = await $o(e), n = am(t.bytes); if (!n) return console.error("[annotation]", aO().message), null; const r = await cO({}, t.bytes, n.mimeType); @@ -42240,7 +42271,7 @@ function D0e(e, { afterCreate: s }) { let i = null; - const a = /* @__PURE__ */ new Map(), c = (b) => b.unconfirmed ? a.get(b.id) ?? null : (a.delete(b.id), null), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = (b) => { + const a = /* @__PURE__ */ new Map(), c = (b) => b.unconfirmed ? a.get(b.id) ?? null : (a.delete(b.id), null), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), f = (b) => { const E = b.source; if (E?.kind !== "bytes") return L0e; const { source: I } = E; @@ -42249,7 +42280,7 @@ function D0e(e, { (T) => (u.set(I, T), e.notify(), T), (T) => (l.delete(I), console.error("[annotation] stamp bytes could not be read:", T), null) ), l.set(I, O)), O; - }, f = (b) => { + }, d = (b) => { if (i) return i; const E = b.source; return E?.kind === "bytes" ? u.get(E.source) ?? null : null; @@ -42258,7 +42289,7 @@ function D0e(e, { const p = () => { e.state.update(rO, null), e.state.update(iz, null), e.notify(); }, m = async (b, E = {}) => { - const I = await e.cancellable(E.signal, Vo(b.source)), O = im(I.bytes); + const I = await e.cancellable(E.signal, $o(b.source)), O = am(I.bytes); if (!O) throw aO(); const T = await cO(b, I.bytes, O.mimeType); i = { @@ -42274,21 +42305,21 @@ function D0e(e, { ...b.subject !== void 0 ? { subject: b.subject } : {} }; const R = e.tryGet(yr); - R && g === null && (g = R.getActiveToolId()), p(), R?.activateTool(Vd); + R && g === null && (g = R.getActiveToolId()), p(), R?.activateTool(Ud); }, v = () => { if (!i) return; const b = g; i = null, h = null, g = null, p(); const E = e.tryGet(yr); - !E || b === null || E.getActiveToolId() !== Vd || b !== Vd && (E.hasTool(b) ? E.activateTool(b) : E.activateDefaultTool()); + !E || b === null || E.getActiveToolId() !== Ud || b !== Ud && (E.hasTool(b) ? E.activateTool(b) : E.activateDefaultTool()); }, S = (b, E, I, O, T, R = 0, M = {}, F = !1) => { - const B = e.doc, $ = n.sizeOf(b); - if (!B || !$) return null; - const D = WR(E, O, $, R), _ = t.applyWhenNumbered( + const _ = e.doc, $ = n.sizeOf(b); + if (!_ || !$) return null; + const D = WR(E, O, $, R), B = t.applyWhenNumbered( [ { type: "create", - page: Lt(b), + page: Ft(b), draft: { subtype: "stamp", // Its box before any turn, and the turn (`null` upright, so none is kept). @@ -42303,17 +42334,17 @@ function D0e(e, { ], { select: F } ); - return T && _.then(({ ids: [L] }) => { + return T && B.then(({ ids: [L] }) => { L !== void 0 && (a.set(L, T), e.notify()); - }), _; + }), B; }, C = (b, E, I, O, T, R = 0, M = {}) => { const F = S(b, E, I, O, T, R, M); if (!F) return !1; - const B = r.activeTool()?.id; - return F.then(($) => (s.placed(B, $.ids), ym($))).catch(($) => console.error("[annotation] stamp placement failed:", $)), !0; + const _ = r.activeTool()?.id; + return F.then(($) => (s.placed(_, $.ids), bm($))).catch(($) => console.error("[annotation] stamp placement failed:", $)), !0; }, k = async (b, E, I = {}) => { e.assertAllowed("annotations:create", "annotation.stamps.place"); - const { ref: O } = e.pageOf(E.page), T = await e.cancellable(I.signal, Vo(b.source)), R = im(T.bytes); + const { ref: O } = e.pageOf(E.page), T = await e.cancellable(I.signal, $o(b.source)), R = am(T.bytes); if (!R) throw aO(); const M = await e.cancellable( I.signal, @@ -42332,18 +42363,18 @@ function D0e(e, { E.select ?? !1 ); if (!F) - throw new re( + throw new te( "not-ready", "annotation", `page ${O.objectNumber} isn't laid out yet` ); - const B = await e.cancellable( + const _ = await e.cancellable( I.signal, - F.then(($) => ym($)) + F.then(($) => bm($)) ); - if (!B) - throw new re("operation-failed", "annotation", "the stamp could not be placed"); - return { annotation: B }; + if (!_) + throw new te("operation-failed", "annotation", "the stamp could not be placed"); + return { annotation: _ }; }, N = (b, E, I) => { const O = i; return O ? C( @@ -42364,19 +42395,19 @@ function D0e(e, { const O = r.activeTool(), T = O?.source; if (!T) return !1; const R = r.uprightRotFor(O.upright ? I : void 0); - return T.kind === "bytes" ? (d(O).then( + return T.kind === "bytes" ? (f(O).then( (M) => w(b, E, M, R) ), !0) : o.promptAt(O, b, E, (M) => { const F = M.data instanceof ArrayBuffer ? new Uint8Array(M.data) : M.data; $D(F).then( - (B) => w(b, E, B, R) + (_) => w(b, E, _, R) ); }); }; return { armed: () => i, - clickStamp: f, - readToolStamp: d, + clickStamp: d, + readToolStamp: f, lookOf: c, placeArmedStamp: N, requestStampAt: y, @@ -42398,64 +42429,64 @@ const j0e = 250; function F0e(e, { store: t, fonts: n, textFonts: r }, o) { let s = null; const i = async () => { - const f = s; - f && (s = null, f.cancelPause(), f.hold.send(), await f.written); - }, a = (f, h) => { - s && (s.id !== f || !s.hold.open) && i(), s ?? (s = { - id: f, + const d = s; + d && (s = null, d.cancelPause(), d.hold.send(), await d.written); + }, a = (d, h) => { + s && (s.id !== d || !s.hold.open) && i(), s ?? (s = { + id: d, // Every pause of typing into one text box is one step of the history. - hold: t.hold({ key: "annotation.text" }, { merge: `annotation.text:${f}` }), + hold: t.hold({ key: "annotation.text" }, { merge: `annotation.text:${d}` }), written: null, cancelPause: () => { } }); const g = s, p = t.commit(h, { into: g.hold }); - return r.typed(f), g.written = p.written, g.cancelPause(), g.cancelPause = e.clock.after(j0e, () => { + return r.typed(d), g.written = p.written, g.cancelPause(), g.cancelPause = e.clock.after(j0e, () => { s === g && i(); }), p; - }, c = (f, h) => { + }, c = (d, h) => { const g = e.state.get().textSelection; - g?.id !== f || g.start !== g.end || e.state.update(_1, { ...g, typing: { ...g.typing, ...h } }); - }, l = (f, h) => { - const g = e.state.get().textSelection, p = t.model().byId[f]; - if (!g?.typing || g.id !== f || !p) return h; - const m = Yl(p.annotation, n), v = _ye(m, { paragraphs: h }, g.start, g.typing), S = v ? { id: f, start: v.caret, end: v.caret, ...v.style && { typing: v.style } } : { id: f, start: g.start, end: g.end }; + g?.id !== d || g.start !== g.end || e.state.update(_1, { ...g, typing: { ...g.typing, ...h } }); + }, l = (d, h) => { + const g = e.state.get().textSelection, p = t.model().byId[d]; + if (!g?.typing || g.id !== d || !p) return h; + const m = Ql(p.annotation, n), v = _ye(m, { paragraphs: h }, g.start, g.typing), S = v ? { id: d, start: v.caret, end: v.caret, ...v.style && { typing: v.style } } : { id: d, start: g.start, end: g.end }; return e.state.update(_1, S), v?.doc.paragraphs ?? h; }; - return t.onEffect("text", (f, h) => { - const g = h.byId[f.id], p = Sn(g); + return t.onEffect("text", (d, h) => { + const g = h.byId[d.id], p = Sn(g); if (!g || !p) return; - const m = dwe(g, Yl(g.annotation, n).paragraphs, n); + const m = dwe(g, Ql(g.annotation, n).paragraphs, n); return [{ type: "annotations.update", ref: p, patch: { subtype: "free-text", ...m } }]; }), { type: a, styleTyping: c, sendTyping: i, text: { - begin: (f) => { - t.commit({ type: "beginTextEdit", id: oe(f) }); + begin: (d) => { + t.commit({ type: "beginTextEdit", id: oe(d) }); }, - end: async (f = {}) => { + end: async (d = {}) => { const h = i(); - e.state.get().textSelection && e.state.update(_1, null), t.commit({ type: "endTextEdit" }), await e.cancellable(f.signal, h); + e.state.get().textSelection && e.state.update(_1, null), t.commit({ type: "endTextEdit" }), await e.cancellable(d.signal, h); } }, api: { - beginTextEditAt: (f, h, g, p, m) => { - const v = o.textBoxAt(f, h, { scale: g, rotation: p, zoom: m }); + beginTextEditAt: (d, h, g, p, m) => { + const v = o.textBoxAt(d, h, { scale: g, rotation: p, zoom: m }); return v != null && (t.commit({ type: "beginTextEdit", id: v }), t.model().editing === v); }, getEditingId: () => t.model().editing, - draftContents: (f, h) => { - const g = oe(f); + draftContents: (d, h) => { + const g = oe(d); a(g, { type: "setText", id: g, text: h }); }, - draftRichText: (f, h) => { - const g = oe(f), p = { paragraphs: l(g, h.paragraphs) }; + draftRichText: (d, h) => { + const g = oe(d), p = { paragraphs: l(g, h.paragraphs) }; return a(g, { type: "setRichText", id: g, doc: p }), p; }, // A selection that moves is a new one: the style chosen at the caret stays only while it doesn't. - setTextSelection: (f, h) => { - const g = oe(f), p = e.state.get().textSelection, m = h ? { id: g, start: h.start, end: h.end } : null; + setTextSelection: (d, h) => { + const g = oe(d), p = e.state.get().textSelection, m = h ? { id: g, start: h.start, end: h.end } : null; p === null == (m === null) && (!p || !m || p.id === m.id && p.start === m.start && p.end === m.end) || e.state.update(_1, m); }, - getCssFontFamily: (f, h) => r.faceCss(h, f).fontFamily, - getFamilyOfCss: (f) => r.familyOfCss(f) ?? f + getCssFontFamily: (d, h) => r.faceCss(h, d).fontFamily, + getFamilyOfCss: (d) => r.familyOfCss(d) ?? d } }; } function V0e(e) { @@ -42463,17 +42494,17 @@ function V0e(e) { e.state.update(vD, c.get().snap), e.state.update(kD, c.get().editable), c.api.onSettingsChanged(({ settings: O, changedKeys: T }) => { T.includes("snap") && e.state.update(vD, O.snap), T.includes("editable") && e.state.update(kD, O.editable); }); - const l = iwe(e, t), u = cwe(e, t), d = ywe(e, t); + const l = iwe(e, t), u = cwe(e, t), f = ywe(e, t); c0e(e, t, a0e(n)); - const f = F0e(e, t, u), h = async () => { - await f.sendTyping(), await t.store.whenWritten(); + const d = F0e(e, t, u), h = async () => { + await d.sendTyping(), await t.store.whenWritten(); }; c.api.onSettingsChanged(({ changedKeys: O }) => { if (!O.includes("editable")) return; const T = t.store.model(), R = T.editing === null ? void 0 : T.byId[T.editing]; - R && !HK(T, R) && f.text.end(); + R && !HK(T, R) && d.text.end(); const M = T.draft; - (M && "ids" in M ? M.ids : M && "id" in M ? [M.id] : []).some((B) => T.byId[B] && !Ii(T, T.byId[B])) && t.store.commit({ type: "cancel" }); + (M && "ids" in M ? M.ids : M && "id" in M ? [M.id] : []).some((_) => T.byId[_] && !Ii(T, T.byId[_])) && t.store.commit({ type: "cancel" }); }); const g = b0e(e, t); k0e(t); @@ -42481,18 +42512,18 @@ function V0e(e) { e, t, l, - d, - u, f, + u, + d, p - ), N = v0e(e, t), w = m0e(e, t, l), y = S0e(e, t, u, N, w), x = w0e(e, t, l), A = M0e(e, t), b = Wbe(e, t), E = zbe(e, t, b, p), I = tu("annotation", [ + ), N = v0e(e, t), w = m0e(e, t, l), y = S0e(e, t, u, N, w), x = w0e(e, t, l), A = M0e(e, t), b = Wbe(e, t), E = zbe(e, t, b, p), I = nu("annotation", [ c.api, l.api, u.api, S.api, i.api, a.api, - f.api, + d.api, g.api, p.api, m.api, @@ -42509,7 +42540,7 @@ function V0e(e) { selection: k.selection, draft: w.draft, text: { - ...f.text, + ...d.text, getEditing: l.getEditing, toggleFormat: k.toggleFormat }, @@ -42553,16 +42584,16 @@ const $0e = (e) => ({ token: _n, scope: "document", requires: [Cn], - optional: [ja, Lr, Wo, Xa], + optional: [ja, Lr, qo, Xa], state: rwe, settings: { defaults: lce, registered: e, whole: ["chrome.marquee"] }, create: V0e }); function D2(e) { - const [t] = De(() => sse()); + const [t] = je(() => sse()); Ke(() => () => t.release(), [t]), Ke(() => t.mount(e)); } -const U0e = wo(Qae), wz = jm(vt), w5 = Number.parseInt(Are, 10) >= 19 ? { inert: !0 } : { inert: "true" }; +const U0e = vo(Qae), wz = Fm(vt), w5 = Number.parseInt(Are, 10) >= 19 ? { inert: !0 } : { inert: "true" }; function vz({ shapes: e }) { return D2(yie(e)), /* @__PURE__ */ P(nt, { children: Az(e) }); } @@ -42591,7 +42622,7 @@ function Az(e) { ); } function z0e({ children: e, gap: t = 15, placement: n = "top" }) { - const { projector: r } = C9(), o = zt( + const { projector: r } = C9(), o = Gt( _n, (s) => { const i = s.selection.getAnchor(); @@ -42621,7 +42652,7 @@ function W0e({ gap: t = 16, placement: n = "right" }) { - const r = zt( + const r = Gt( vt, (s) => s.selection.getRotationAnchor(), null, @@ -42643,8 +42674,8 @@ function W0e({ padding: "2px 6px", fontFamily: yv("font-mono"), fontSize: 12, - background: pt("readout-background", o.background), - color: pt("readout-color", o.color) + background: gt("readout-background", o.background), + color: gt("readout-color", o.color) }, children: [ r.angle, @@ -42741,7 +42772,7 @@ function Q0e({ page: e }) { const t = wt( _n, (a) => a.getImageGhost(e.ref) - ), n = t?.preview ?? null, [r, o] = De(null), s = t ? yz(t.box.width * e.transform.renderScale) : 0; + ), n = t?.preview ?? null, [r, o] = je(null), s = t ? yz(t.box.width * e.transform.renderScale) : 0; if (Ke(() => { if (!n || !s) { o(null); @@ -42749,7 +42780,7 @@ function Q0e({ page: e }) { } return Bie(() => n(s), o); }, [n, s]), !t || !r) return null; - const i = zo(t.box, e.transform); + const i = Wo(t.box, e.transform); return /* @__PURE__ */ P( "img", { @@ -42776,7 +42807,7 @@ function Q0e({ page: e }) { ); } function Sz() { - const e = wz((r) => r.chrome), t = nu((r) => r.accent), n = ft(() => Aie(e, t), [e, t]); + const e = wz((r) => r.chrome), t = ru((r) => r.accent), n = ft(() => Aie(e, t), [e, t]); return { chrome: e, painted: n }; } function X0e({ @@ -42805,29 +42836,29 @@ function Z0e({ }) { const n = e.transform.viewScale, r = e.transform.rotation, o = e.transform.zoom, s = wt( _n, - (f) => f.listChromeNodes(e.ref, n, r, o), + (d) => d.listChromeNodes(e.ref, n, r, o), pi - ), { chrome: i, painted: a } = Sz(), c = t?.Handle, l = t?.RotationHandle, u = [], d = Sie(s, e.transform).map((f, h) => { - switch (f.kind) { + ), { chrome: i, painted: a } = Sz(), c = t?.Handle, l = t?.RotationHandle, u = [], f = Sie(s, e.transform).map((d, h) => { + switch (d.kind) { case "handle": return c ? (u.push( /* @__PURE__ */ P( c, { - at: f.at, + at: d.at, size: i.handles.size, - rotation: f.rotation, - kind: f.role, - active: f.active + rotation: d.rotation, + kind: d.role, + active: d.active }, h ) ), null) : /* @__PURE__ */ P( X0e, { - at: f.at, + at: d.at, size: i.handles.size, - rotation: f.rotation, + rotation: d.rotation, shape: i.handles.shape, style: a.handle }, @@ -42837,19 +42868,19 @@ function Z0e({ return /* @__PURE__ */ P( "line", { - x1: f.from.x, - y1: f.from.y, - x2: f.to.x, - y2: f.to.y, + x1: d.from.x, + y1: d.from.y, + x2: d.to.x, + y2: d.to.y, shapeRendering: "crispEdges", style: a.guide }, h ); case "turned-outline": - return /* @__PURE__ */ P("polygon", { points: f.points, fill: "none", style: a.outline }, h); + return /* @__PURE__ */ P("polygon", { points: d.points, fill: "none", style: a.outline }, h); case "rotation-guides": - return /* @__PURE__ */ P("g", { children: f.lines.map((g, p) => /* @__PURE__ */ P( + return /* @__PURE__ */ P("g", { children: d.lines.map((g, p) => /* @__PURE__ */ P( "line", { x1: g.from.x, @@ -42866,8 +42897,8 @@ function Z0e({ /* @__PURE__ */ P( l, { - at: f.at, - from: f.from, + at: d.at, + from: d.from, size: i.rotationHandle.size, rotation: 0, active: !1 @@ -42878,10 +42909,10 @@ function Z0e({ i.rotationHandle.stalk && /* @__PURE__ */ P( "line", { - x1: f.from.x, - y1: f.from.y, - x2: f.at.x, - y2: f.at.y, + x1: d.from.x, + y1: d.from.y, + x2: d.at.x, + y2: d.at.y, strokeWidth: 1, style: { stroke: a.rotationHandle.stroke } } @@ -42889,8 +42920,8 @@ function Z0e({ /* @__PURE__ */ P( "circle", { - cx: f.at.x, - cy: f.at.y, + cx: d.at.x, + cy: d.at.y, r: i.rotationHandle.size / 2, strokeWidth: 1.5, style: a.rotationHandle @@ -42903,10 +42934,10 @@ function Z0e({ return /* @__PURE__ */ P( "rect", { - x: f.box.left, - y: f.box.top, - width: f.box.width, - height: f.box.height, + x: d.box.left, + y: d.box.top, + width: d.box.width, + height: d.box.height, strokeWidth: 1, strokeDasharray: "4 3", style: a.marquee @@ -42917,10 +42948,10 @@ function Z0e({ return /* @__PURE__ */ P( "rect", { - x: f.box.left, - y: f.box.top, - width: f.box.width, - height: f.box.height, + x: d.box.left, + y: d.box.top, + width: d.box.width, + height: d.box.height, fill: "none", style: a.outline }, @@ -42929,12 +42960,12 @@ function Z0e({ } }); return /* @__PURE__ */ P(nt, { children: [ - /* @__PURE__ */ P("svg", { style: { position: "absolute", inset: 0, overflow: "visible", pointerEvents: "none" }, children: d }), + /* @__PURE__ */ P("svg", { style: { position: "absolute", inset: 0, overflow: "visible", pointerEvents: "none" }, children: f }), u.length > 0 && /* @__PURE__ */ P("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: u }) ] }); } function eve(e, t) { - const n = bt(_n), [r, o] = De(null), [s] = De(() => Eie()); + const n = bt(_n), [r, o] = je(null), [s] = je(() => Eie()); return Ke( () => s.follow(r, n, e, t), [s, n, r, e, t] @@ -42949,7 +42980,7 @@ function tve({ item: e, page: t }) { function nve(e, t, n) { const r = Re(t); r.current = t; - const [, o] = De(0); + const [, o] = je(0); Ke(() => { if (!n) return; const s = Oie(e, n, () => r.current()); @@ -42957,9 +42988,9 @@ function nve(e, t, n) { }, [e, n]); } function rve({ renderers: e, components: t } = {}) { - const n = qo(), r = bt(_n); - zt(yr, (v) => v.getActiveToolId(), ""); - const o = Rt(yr), s = n.transform.zoom, i = n.transform.rotation, a = nu((v) => v.accent), c = wt( + const n = Go(), r = bt(_n); + Gt(yr, (v) => v.getActiveToolId(), ""); + const o = Bt(yr), s = n.transform.zoom, i = n.transform.rotation, a = ru((v) => v.accent), c = wt( _n, (v) => v.listPageItems(n.ref, { zoom: s, rotation: i }), pi @@ -42967,8 +42998,8 @@ function rve({ renderers: e, components: t } = {}) { _n, (v) => v.listTextItems(n.ref, { zoom: s, rotation: i }), pi - ), [u, d] = De(null), [f] = De(KU); - Ke(() => () => f.release(), [f]), nve(r, () => o?.getActiveToolId() ?? "", e), M9(n.ref, "annotations"); + ), [u, f] = je(null), [d] = je(KU); + Ke(() => () => d.release(), [d]), nve(r, () => o?.getActiveToolId() ?? "", e), M9(n.ref, "annotations"); const h = Re(e); e && h.current && e !== h.current && pi(e, h.current) && bv( "annotation-renderers-inline", @@ -42977,19 +43008,19 @@ function rve({ renderers: e, components: t } = {}) { const g = wt( _n, (v) => v.getAppearanceEpoch(n.ref) - ), p = zt( + ), p = Gt( Pr, (v) => v.getAppearanceScale(n.transform.renderScale), n.transform.renderScale ); Ke( () => HU( - f, + d, (v) => r.renderAppearances(n.ref, p, v), oe, - d + f ), - [f, r, n.ref, p, g] + [d, r, n.ref, p, g] ); const m = Tie(l, oe); return /* @__PURE__ */ P("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: [ @@ -43095,7 +43126,7 @@ function rve({ renderers: e, components: t } = {}) { } const ove = qoe; function sve(e = ove) { - const t = Rt(vt); + const t = Bt(vt); Ke(() => { if (t) return Goe( @@ -43113,7 +43144,7 @@ function ive() { } const ave = {}; function cve(e) { - return zt( + return Gt( vt, (t) => t.tools.getDefaults(e), ave @@ -43121,7 +43152,7 @@ function cve(e) { } const lve = { properties: [], values: {}, mixed: [] }; function _De(e) { - return zt( + return Gt( vt, (t) => e === void 0 ? t.selection.getProperties() : t.tools.getProperties(e), lve @@ -43132,16 +43163,16 @@ function LDe() { } const uve = [], dve = []; function DDe() { - const e = ar(), t = zt( + const e = cr(), t = Gt( vt, (r) => r.comments.listThreads(), dve - ), n = en( + ), n = nn( (r) => e ? r.documents.listPages(e) : uve ); return ft(() => Die(t, n), [t, n]); } -const Qn = sn("stamp", { +const Qn = an("stamp", { hint: "add stampPlugin() from '@embedpdf/plugin-stamp' to your plugins list" }); function fve(e) { @@ -43200,18 +43231,18 @@ const yve = { fonts: [], previewWidth: 256, dynamic: !0 -}, xt = (e, t) => new re(e, "stamp", t), Rs = (e, t) => xt("not-found", `unknown ${e} '${t}'`), Cz = (e, t) => new re("permission-denied", "stamp", `${t} requires ${e}`, { +}, Et = (e, t) => new te(e, "stamp", t), Rs = (e, t) => Et("not-found", `unknown ${e} '${t}'`), Cz = (e, t) => new te("permission-denied", "stamp", `${t} requires ${e}`, { permission: e }), bn = (e) => { if (e?.aborted) - throw new re("operation-cancelled", "stamp", "operation cancelled", { + throw new te("operation-cancelled", "stamp", "operation cancelled", { cause: e.reason }); -}, Wr = (e) => async (...t) => { +}, qr = (e) => async (...t) => { try { return await e(...t); } catch (n) { - throw qe("stamp", n); + throw ze("stamp", n); } }; function bve(e, { @@ -43220,58 +43251,58 @@ function bve(e, { ghosts: r, targets: o }) { - const { binaries: s, libraryBinaries: i } = t, { ghostProvider: a } = r, { documentIdOf: c } = o, l = (f) => { + const { binaries: s, libraryBinaries: i } = t, { ghostProvider: a } = r, { documentIdOf: c } = o, l = (d) => { const h = e.state.get(); - return (f?.libraryId ? [f.libraryId] : h.libraryOrder).flatMap( + return (d?.libraryId ? [d.libraryId] : h.libraryOrder).flatMap( (p) => (h.libraries[p]?.assetIds ?? []).map((m) => h.assets[m]) ).filter( - (p) => p != null && (!f?.kind || p.kind === f.kind) && (!f?.category || (p.categories ?? []).includes(f.category)) + (p) => p != null && (!d?.kind || p.kind === d.kind) && (!d?.category || (p.categories ?? []).includes(d.category)) ); - }, u = (f) => { - const h = c(f); + }, u = (d) => { + const h = c(d); return h ? e.tryForDocument(vt, h)?.canCreate() ?? !1 : !1; - }, d = (f) => { - const h = c(f); - return h !== null && e.get(It).canDownload(h); + }, f = (d) => { + const h = c(d); + return h !== null && e.get(Pt).canDownload(h); }; return { canPlace: u, - canCreateFromAnnotations: d, + canCreateFromAnnotations: f, api: { - listLibraries: (f) => { - const h = e.state.get(), g = f?.kind === void 0 ? null : new Set(typeof f.kind == "string" ? [f.kind] : f.kind); + listLibraries: (d) => { + const h = e.state.get(), g = d?.kind === void 0 ? null : new Set(typeof d.kind == "string" ? [d.kind] : d.kind); return h.libraryOrder.map((p) => h.libraries[p]).filter( (p) => p != null && (g === null || g.has(p.kind)) ); }, - getLibrary: (f) => e.state.get().libraries[f] ?? null, + getLibrary: (d) => e.state.get().libraries[d] ?? null, listAssets: l, - getAsset: (f) => e.state.get().assets[f] ?? null, - getAssetPreview: (f) => s.get(f)?.preview ?? null, - renderAssetPreview: Wr( - async (f, { width: h, signal: g }) => { + getAsset: (d) => e.state.get().assets[d] ?? null, + getAssetPreview: (d) => s.get(d)?.preview ?? null, + renderAssetPreview: qr( + async (d, { width: h, signal: g }) => { bn(g); - const p = s.get(f); - if (!p) throw Rs("asset", f); + const p = s.get(d); + if (!p) throw Rs("asset", d); const m = await e.cancellable( g, - a(p.bytes, p.preview, f)(h) + a(p.bytes, p.preview, d)(h) ); return m ? { bytes: m.bytes, mimeType: m.mimeType ?? "image/png" } : null; } ), - getAssetBytes: (f) => { - const h = s.get(f)?.bytes; + getAssetBytes: (d) => { + const h = s.get(d)?.bytes; return h ? new Uint8Array(h) : null; }, - exportLibrary: async (f, h) => { + exportLibrary: async (d, h) => { bn(h?.signal); - const g = i.get(f); - if (!g) throw Rs("library", f); + const g = i.get(d); + if (!g) throw Rs("library", d); return new Uint8Array(g); }, canPlace: u, - canCreateFromAnnotations: d, + canCreateFromAnnotations: f, canImport: n.canImport } }; @@ -43282,43 +43313,43 @@ function vve(e) { const t = e.settings(); let n = null, r = null; const o = [], s = () => { - const d = t.get().assetEngine; - if (r?.from !== d) { - const f = d ? typeof d == "function" ? d() : d : e.engine; - typeof d == "function" && o.push(f), r = { from: d, engine: f }, n = null; + const f = t.get().assetEngine; + if (r?.from !== f) { + const d = f ? typeof f == "function" ? f() : f : e.engine; + typeof f == "function" && o.push(d), r = { from: f, engine: d }, n = null; } return r.engine; - }, i = /* @__PURE__ */ new WeakMap(), a = async (d) => { - const f = t.get().fonts.find((m) => m.key === d); - if (!f) return; + }, i = /* @__PURE__ */ new WeakMap(), a = async (f) => { + const d = t.get().fonts.find((m) => m.key === f); + if (!d) return; const h = await s(); if (!C0(h)) return; let g = i.get(h); g || i.set(h, g = /* @__PURE__ */ new Map()); - let p = g.get(d); + let p = g.get(f); if (!p) { const m = g; - p = f.load().then((v) => h.fonts.register({ key: d, data: v })).then(() => { - }), m.set(d, p), p.catch(() => m.delete(d)); + p = d.load().then((v) => h.fonts.register({ key: f, data: v })).then(() => { + }), m.set(f, p), p.catch(() => m.delete(f)); } return p; - }, c = async (d) => { - const f = await s(); - if (!C0(f)) - throw n !== !1 && (n = !1, e.notify()), xt( + }, c = async (f) => { + const d = await s(); + if (!C0(d)) + throw n !== !1 && (n = !1, e.notify()), Et( "unsupported", t.get().assetEngine ? "the stamp plugin's assetEngine must be a local engine (createLocalEngine())" : "importing a library PDF needs a local engine, and this viewer's engine is a cloud engine. Pass stampPlugin({ assetEngine: () => import('@embedpdf/engine').then((module) => module.createLocalEngine()) }): it loads lazily, on first import." ); - return f.open({ kind: "bytes", id: Iz("stamp-import"), bytes: d }, { scope: ["*"] }); - }, l = (d) => { - if (d.source.kind !== "bytes") - throw xt( + return d.open({ kind: "bytes", id: Iz("stamp-import"), bytes: f }, { scope: ["*"] }); + }, l = (f) => { + if (f.source.kind !== "bytes") + throw Et( "unsupported", "the asset engine returned a URL-sourced render; asset engines must be local" ); - return { bytes: d.source.bytes, mimeType: d.mimeType }; - }, u = async (d) => l( - await d.render.image({ + return { bytes: f.source.bytes, mimeType: f.mimeType }; + }, u = async (f) => l( + await f.render.image({ viewport: { kind: "width", width: t.get().previewWidth }, background: "transparent", includeAnnotations: !0, @@ -43327,8 +43358,8 @@ function vve(e) { ); return e.cleanup(() => { r = null; - for (const d of o.splice(0)) - Promise.resolve(d).then((f) => f.destroy()).catch(() => { + for (const f of o.splice(0)) + Promise.resolve(f).then((d) => d.destroy()).catch(() => { }); }), { openAssetDocument: c, @@ -43346,15 +43377,15 @@ function kve(e) { }), { binaries: t, libraryBinaries: n, ghostRenders: o, mutateLibrary: r }; } function Ave(e) { - const t = () => e.get(It), n = (s) => s ?? t().getActiveId(); + const t = () => e.get(Pt), n = (s) => s ?? t().getActiveId(); return { documentIdOf: n, targetOf: (s) => { const i = n(s?.documentId); - if (!i) throw xt("not-ready", "no document is open"); + if (!i) throw Et("not-ready", "no document is open"); return i; }, pageOf: (s, i) => { const a = t().getPage(i, s); if (!a) - throw xt( + throw Et( "not-found", `no page ${typeof i == "number" ? i : i.objectNumber} in document '${s}'` ); @@ -43397,7 +43428,7 @@ function xve({ const c = a ? n.get(a) ?? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map(); return a && n.set(a, c), (l) => { let u = c.get(l); - return u || (u = r(s, l).catch((d) => (globalThis.console?.warn("[stamp] ghost render failed, using the thumbnail:", d), i)), c.set(l, u)), u; + return u || (u = r(s, l).catch((f) => (globalThis.console?.warn("[stamp] ghost render failed, using the thumbnail:", f), i)), c.set(l, u)), u; }; } }; } @@ -43484,106 +43515,106 @@ function Tve(e, { assetEngine: r, targets: o }, { resolveAssetSource: s }, { createLibrary: i }, { canCreateFromAnnotations: a }) { - const { libraryChanged: c, assetCreated: l, assetUpdated: u, assetDeleted: d } = t, { binaries: f, libraryBinaries: h, ghostRenders: g, mutateLibrary: p } = n, { openAssetDocument: m, renderThumbnail: v } = r, { targetOf: S, pageOf: C } = o, k = async (b, E) => { + const { libraryChanged: c, assetCreated: l, assetUpdated: u, assetDeleted: f } = t, { binaries: d, libraryBinaries: h, ghostRenders: g, mutateLibrary: p } = n, { openAssetDocument: m, renderThumbnail: v } = r, { targetOf: S, pageOf: C } = o, k = async (b, E) => { const I = E?.signal; if (bn(I), b.libraryId && !e.state.get().libraries[b.libraryId]) throw Rs("library", b.libraryId); - const O = await e.cancellable(I, s(b)), T = im(O.bytes); + const O = await e.cancellable(I, s(b)), T = am(O.bytes); if (!T) - throw xt("invalid-input", "asset source must be PNG, JPEG, or single-page PDF bytes"); + throw Et("invalid-input", "asset source must be PNG, JPEG, or single-page PDF bytes"); const R = T.mimeType === "application/pdf", M = b.name ?? hve(), F = b.label ?? M; if (M.length === 0 || M.includes("=")) - throw xt( + throw Et( "invalid-input", `invalid stamp identifier '${M}': must be non-empty and contain no '='` ); - const B = b.size ?? ("width" in T ? { width: T.width, height: T.height } : null); - if (!R && (!B || B.width <= 0 || B.height <= 0)) - throw xt( + const _ = b.size ?? ("width" in T ? { width: T.width, height: T.height } : null); + if (!R && (!_ || _.width <= 0 || _.height <= 0)) + throw Et( "invalid-input", "a raster asset needs a positive `size` (its page size in points)" ); let $ = null; if (b.preview) { - const _ = await Vo(b.preview); + const B = await $o(b.preview); $ = { - bytes: new Uint8Array(_.bytes), - mimeType: _.mimeType ?? "image/png" + bytes: new Uint8Array(B.bytes), + mimeType: B.mimeType ?? "image/png" }; } const D = b.libraryId ?? (await i(F, { signal: I })).library.id; return p( D, async () => { - const _ = e.state.get().libraries[D]; - if (!_) - throw xt("not-found", `library '${D}' no longer exists`); - const L = xz(_.id, M); + const B = e.state.get().libraries[D]; + if (!B) + throw Et("not-found", `library '${D}' no longer exists`); + const L = xz(B.id, M); if (e.state.get().assets[L]) - throw xt( + throw Et( "invalid-input", - `library '${_.name}' already has a stamp named '${M}'` + `library '${B.name}' already has a stamp named '${M}'` ); - const j = h.get(_.id); + const j = h.get(B.id); if (!j) - throw xt( + throw Et( "operation-failed", - `canonical bytes are missing for library '${_.id}'` + `canonical bytes are missing for library '${B.id}'` ); const H = await e.cancellable(I, m(j)); let Y; try { - let ue; + let le; if (R) { - const te = await H.pages.insert(new Uint8Array(O.bytes)); - if (te.insertedPages.length !== 1) - throw xt("invalid-input", "a library asset must be a single-page PDF"); - ue = te.insertedPages[0]; + const ee = await H.pages.insert(new Uint8Array(O.bytes)); + if (ee.insertedPages.length !== 1) + throw Et("invalid-input", "a library asset must be a single-page PDF"); + le = ee.insertedPages[0]; } else { if (!H.pages.flatten) - throw xt( + throw Et( "unsupported", "raster assets need an asset engine with pages.flatten" ); - if (ue = (await H.pages.insertBlank({ size: B })).insertedPages[0], await H.page(ue).annotations.create( + if (le = (await H.pages.insertBlank({ size: _ })).insertedPages[0], await H.page(le).annotations.create( { subtype: "stamp", - box: { x: 0, y: 0, width: B.width, height: B.height }, + box: { x: 0, y: 0, width: _.width, height: _.height }, fit: "fill" }, { resources: { appearance: new Uint8Array(O.bytes) } } - ), (await H.pages.flatten([ue], { usage: "display" })).results.some(({ status: Te }) => Te !== "applied")) - throw xt("operation-failed", "flattening the raster into its page failed"); + ), (await H.pages.flatten([le], { usage: "display" })).results.some(({ status: Te }) => Te !== "applied")) + throw Et("operation-failed", "flattening the raster into its page failed"); } - const le = (await H.pages.list()).pages.find( - (te) => te.ref.objectNumber === ue.objectNumber - ), pe = H.page(ue); - if (!le) - throw xt("operation-failed", "the new page is missing from the library layout"); - await H.pages.setName({ name: sA(M, F), page: ue }); - const ge = { + const ie = (await H.pages.list()).pages.find( + (ee) => ee.ref.objectNumber === le.objectNumber + ), pe = H.page(le); + if (!ie) + throw Et("operation-failed", "the new page is missing from the library layout"); + await H.pages.setName({ name: sA(M, F), page: le }); + const ve = { id: L, - libraryId: _.id, + libraryId: B.id, kind: b.kind ?? "stamp", name: M, label: F, - size: { width: le.size.width, height: le.size.height }, - page: ue, + size: { width: ie.size.width, height: ie.size.height }, + page: le, ...b.subject !== void 0 ? { subject: b.subject } : {}, ...b.categories !== void 0 ? { categories: b.categories } : {} }; await pe.pieceInfo.update( o0, - uO(ge.kind, { subject: ge.subject, categories: ge.categories }) + uO(ve.kind, { subject: ve.subject, categories: ve.categories }) ); - const Me = await H.pages.extract([ue]), Be = $ ?? await v(pe); - Y = { asset: ge, bytes: Me, preview: Be, canonical: await H.download() }; + const _e = await H.pages.extract([le]), Be = $ ?? await v(pe); + Y = { asset: ve, bytes: _e, preview: Be, canonical: await H.download() }; } finally { await H.close(); } - return bn(I), h.set(_.id, Y.canonical), f.set(Y.asset.id, { bytes: Y.bytes, preview: Y.preview }), e.state.update(Nz, Y.asset), c.emit({ libraryId: _.id, type: "asset-created" }), l.emit({ + return bn(I), h.set(B.id, Y.canonical), d.set(Y.asset.id, { bytes: Y.bytes, preview: Y.preview }), e.state.update(Nz, Y.asset), c.emit({ libraryId: B.id, type: "asset-created" }), l.emit({ assetId: Y.asset.id, - libraryId: _.id, + libraryId: B.id, asset: Y.asset }), { asset: Y.asset }; }, @@ -43596,9 +43627,9 @@ function Tve(e, { if (!a(R)) throw Cz("doc.download", "stamp.createAssetFromAnnotations"); const M = e.documentHandle(R); - if (!M) throw xt("not-found", `document '${R}' is not open`); - const F = M.page(C(R, b).ref), B = await e.cancellable(T, F.annotations.exportAppearance([...E])); - return k({ ...I, source: B }, { signal: T }); + if (!M) throw Et("not-found", `document '${R}' is not open`); + const F = M.page(C(R, b).ref), _ = await e.cancellable(T, F.annotations.exportAppearance([...E])); + return k({ ...I, source: _ }, { signal: T }); }, w = async (b, E) => { const I = E?.signal; bn(I); @@ -43613,18 +43644,18 @@ function Tve(e, { if (!R) return; const M = h.get(R.id); if (!M) - throw xt( + throw Et( "operation-failed", `canonical bytes are missing for library '${R.id}'` ); const F = await e.cancellable(I, m(M)); - let B; + let _; try { - await F.pages.delete([T.page]), B = await F.download(); + await F.pages.delete([T.page]), _ = await F.download(); } finally { await F.close(); } - bn(I), h.set(R.id, B), f.delete(b), g.delete(b), e.state.update(Rve, b), c.emit({ libraryId: R.id, type: "asset-deleted" }), d.emit({ assetId: b, libraryId: R.id, asset: null }); + bn(I), h.set(R.id, _), d.delete(b), g.delete(b), e.state.update(Rve, b), c.emit({ libraryId: R.id, type: "asset-deleted" }), f.emit({ assetId: b, libraryId: R.id, asset: null }); }, I ); @@ -43638,30 +43669,30 @@ function Tve(e, { async () => { const R = e.state.get().assets[b], M = R ? e.state.get().libraries[R.libraryId] : void 0; if (!R || !M) throw Rs("asset", b); - const { subject: F, ...B } = R, $ = { - ...E.subject === null ? B : R, + const { subject: F, ..._ } = R, $ = { + ...E.subject === null ? _ : R, ...E.label !== void 0 ? { label: E.label } : {}, ...E.categories !== void 0 ? { categories: E.categories } : {}, ...E.subject !== void 0 && E.subject !== null ? { subject: E.subject } : {} }, D = h.get(M.id); if (!D) - throw xt( + throw Et( "operation-failed", `canonical bytes are missing for library '${M.id}'` ); - const _ = await e.cancellable(O, m(D)); + const B = await e.cancellable(O, m(D)); let L; try { - $.label !== R.label && await _.pages.setName({ + $.label !== R.label && await B.pages.setName({ name: sA(R.name, $.label), page: R.page, replace: sA(R.name, R.label) - }), await _.page(R.page).pieceInfo.update( + }), await B.page(R.page).pieceInfo.update( o0, uO($.kind, { subject: $.subject, categories: $.categories }) - ), L = await _.download(); + ), L = await B.download(); } finally { - await _.close(); + await B.close(); } return bn(O), h.set(M.id, L), e.state.update(Pve, $), c.emit({ libraryId: M.id, type: "asset-updated" }), u.emit({ assetId: $.id, libraryId: M.id, asset: $ }), { asset: $ }; }, @@ -43670,7 +43701,7 @@ function Tve(e, { }, x = async (b, E, I) => { const O = I?.signal; bn(O); - const T = e.state.get().assets[b], R = f.get(b); + const T = e.state.get().assets[b], R = d.get(b); if (!T || !R) throw Rs("asset", b); if (E.libraryId === T.libraryId) return { asset: T }; const M = await k( @@ -43688,7 +43719,7 @@ function Tve(e, { return await w(b), M; }, A = async (b, E) => { bn(E?.signal); - const I = e.state.get().assets[b], O = f.get(b); + const I = e.state.get().assets[b], O = d.get(b); if (!I || !O) throw Rs("asset", b); return k( { @@ -43705,12 +43736,12 @@ function Tve(e, { }; return { api: { - createAsset: Wr(k), - createAssetFromAnnotations: Wr(N), - updateAsset: Wr(y), - deleteAsset: Wr(w), - moveAsset: Wr(x), - duplicateAsset: Wr(A) + createAsset: qr(k), + createAssetFromAnnotations: qr(N), + updateAsset: qr(y), + deleteAsset: qr(w), + moveAsset: qr(x), + duplicateAsset: qr(A) } }; } @@ -43745,7 +43776,7 @@ ${n} %%EOF `, F1 = new TextEncoder().encode(e), new Uint8Array(F1); } -const fh = (e, t) => { +const ph = (e, t) => { const n = e[t]; return n?.type === "string" && n.value.length > 0 ? n.value : void 0; }, zD = (e, t) => { @@ -43774,7 +43805,7 @@ const fh = (e, t) => { return n.add(r), r; }; function Bve(e, { events: t, binaries: n, assetEngine: r }) { - const { libraryChanged: o, libraryCreated: s, libraryUpdated: i, libraryDeleted: a, assetCreated: c } = t, { binaries: l, libraryBinaries: u, ghostRenders: d, mutateLibrary: f } = n, { openAssetDocument: h, renderThumbnail: g } = r, p = async (k, N) => { + const { libraryChanged: o, libraryCreated: s, libraryUpdated: i, libraryDeleted: a, assetCreated: c } = t, { binaries: l, libraryBinaries: u, ghostRenders: f, mutateLibrary: d } = n, { openAssetDocument: h, renderThumbnail: g } = r, p = async (k, N) => { const w = N?.signal; bn(w); const y = N?.kind ?? v5, x = new Set(Object.keys(e.state.get().libraries)), A = qD(N?.id, "stamp-lib", x), b = await e.cancellable(w, h(Oz())); @@ -43799,9 +43830,9 @@ function Bve(e, { events: t, binaries: n, assetEngine: r }) { }, m = async (k, N) => { const w = N?.signal; bn(w); - const y = await e.cancellable(w, Vo(k)); - if (im(y.bytes)?.mimeType !== "application/pdf") - throw xt( + const y = await e.cancellable(w, $o(k)); + if (am(y.bytes)?.mimeType !== "application/pdf") + throw Et( "invalid-input", "importLibrary needs PDF bytes (use createAsset for a raster image)" ); @@ -43810,53 +43841,53 @@ function Bve(e, { events: t, binaries: n, assetEngine: r }) { try { const E = await A.pages.list(); if (E.pageCount === 0) - throw xt( + throw Et( "invalid-input", "a canonical stamp library PDF must contain at least one page" ); const I = new Map( E.pages.map((Y) => [Y.ref.objectNumber, Y]) ), O = (await A.pieceInfo.get(j1))?.entries ?? {}, T = new Set(Object.keys(e.state.get().libraries)), R = qD( - N?.id ?? fh(O, "Id"), + N?.id ?? ph(O, "Id"), "stamp-lib", T - ), M = await A.metadata.get(), F = (M.title && M.title.length > 0 ? M.title : void 0) ?? fh(O, "Name") ?? N?.name ?? "Stamps"; + ), M = await A.metadata.get(), F = (M.title && M.title.length > 0 ? M.title : void 0) ?? ph(O, "Name") ?? N?.name ?? "Stamps"; M.title || await A.metadata.update({ title: F }); - const B = N?.categories ?? WD(O, "Categories"), $ = fh(O, "Locale"), D = N?.libraryKind ?? gve(zD(O, "Kind")), _ = (E.namedPages ?? []).filter( + const _ = N?.categories ?? WD(O, "Categories"), $ = ph(O, "Locale"), D = N?.libraryKind ?? gve(zD(O, "Kind")), B = (E.namedPages ?? []).filter( (Y) => Y.target.kind === "page" ), L = (E.namedPages ?? []).filter((Y) => Y.target.kind !== "page"); L.length > 0 && globalThis.console?.warn( `[stamp] library '${F}' carries ${L.length} hidden-template or dangling registration(s); they are not stamps and were ignored` ); let j; - if (_.length > 0) { + if (B.length > 0) { const Y = /* @__PURE__ */ new Set(); - j = _.map((ue) => { - const { name: le, label: pe } = fve(ue.name); - if (!le) - throw xt( + j = B.map((le) => { + const { name: ie, label: pe } = fve(le.name); + if (!ie) + throw Et( "invalid-input", - `library '${F}': empty stamp identifier in key '${ue.name}'` + `library '${F}': empty stamp identifier in key '${le.name}'` ); - if (Y.has(le)) - throw xt( + if (Y.has(ie)) + throw Et( "invalid-input", - `library '${F}': duplicate stamp identifier '${le}'` + `library '${F}': duplicate stamp identifier '${ie}'` ); - Y.add(le); - const ge = I.get(ue.target.page.objectNumber); - return { page: ge.ref, index: ge.index, name: le, label: pe }; - }), j.sort((ue, le) => ue.index - le.index); + Y.add(ie); + const ve = I.get(le.target.page.objectNumber); + return { page: ve.ref, index: ve.index, name: ie, label: pe }; + }), j.sort((le, ie) => le.index - ie.index); } else { if (E.namedPages === void 0) - throw xt( + throw Et( "unsupported", "the asset engine reports no named-page registry; an engine with named pages is needed to import libraries" ); j = []; for (const Y of E.pages) { - const ue = (await A.page(Y.ref).pieceInfo.get(o0))?.entries, le = (ue && fh(ue, "Name")) ?? `Stamp${Y.index + 1}`, pe = (ue && fh(ue, "Subject")) ?? N?.assetName?.(Y.index) ?? le; - j.push({ page: Y.ref, index: Y.index, name: le, label: pe }); + const le = (await A.page(Y.ref).pieceInfo.get(o0))?.entries, ie = (le && ph(le, "Name")) ?? `Stamp${Y.index + 1}`, pe = (le && ph(le, "Subject")) ?? N?.assetName?.(Y.index) ?? ie; + j.push({ page: Y.ref, index: Y.index, name: ie, label: pe }); } for (const Y of j) await A.pages.setName({ @@ -43868,13 +43899,13 @@ function Bve(e, { events: t, binaries: n, assetEngine: r }) { j1, PC(R, { kind: D, - categories: B, + categories: _, locale: $ }) ); const H = []; for (const Y of j) { - const ue = A.page(Y.page), le = (await ue.pieceInfo.get(o0))?.entries ?? {}, pe = N?.assetKind ?? Mve(zD(le, "Kind")) ?? "stamp", ge = fh(le, "SubjectOverride"), Me = WD(le, "Categories"), Be = I.get(Y.page.objectNumber), te = { + const le = A.page(Y.page), ie = (await le.pieceInfo.get(o0))?.entries ?? {}, pe = N?.assetKind ?? Mve(zD(ie, "Kind")) ?? "stamp", ve = ph(ie, "SubjectOverride"), _e = WD(ie, "Categories"), Be = I.get(Y.page.objectNumber), ee = { id: xz(R, Y.name), libraryId: R, kind: pe, @@ -43882,15 +43913,15 @@ function Bve(e, { events: t, binaries: n, assetEngine: r }) { label: Y.label, size: { width: Be.size.width, height: Be.size.height }, page: Y.page, - ...ge !== void 0 ? { subject: ge } : {}, - ...Me !== void 0 ? { categories: Me } : {} + ...ve !== void 0 ? { subject: ve } : {}, + ..._e !== void 0 ? { categories: _e } : {} }; - await ue.pieceInfo.update( + await le.pieceInfo.update( o0, - uO(pe, { subject: ge, categories: Me }) + uO(pe, { subject: ve, categories: _e }) ); const he = await A.pages.extract([Y.page]); - H.push({ asset: te, bytes: he, preview: await g(ue) }); + H.push({ asset: ee, bytes: he, preview: await g(le) }); } b = { library: { @@ -43898,7 +43929,7 @@ function Bve(e, { events: t, binaries: n, assetEngine: r }) { name: F, kind: D, ...$ ? { locale: $ } : {}, - categories: B, + categories: _, assetIds: [] }, canonicalBytes: await A.download(), @@ -43918,9 +43949,9 @@ function Bve(e, { events: t, binaries: n, assetEngine: r }) { const N = e.state.get().libraries[k]; if (N) for (const w of N.assetIds) - l.delete(w), d.delete(w); + l.delete(w), f.delete(w); u.delete(k), e.state.update(Ove, k); - }, S = (k, N) => f( + }, S = (k, N) => d( k, async () => { const w = e.state.get().libraries[k] !== void 0; @@ -43930,14 +43961,14 @@ function Bve(e, { events: t, binaries: n, assetEngine: r }) { ), C = async (k, N, w) => { const y = w?.signal; if (bn(y), !e.state.get().libraries[k]) throw Rs("library", k); - return f( + return d( k, async () => { const x = e.state.get().libraries[k]; if (!x) throw Rs("library", k); const A = u.get(k); if (!A) - throw xt("operation-failed", `canonical bytes are missing for library '${k}'`); + throw Et("operation-failed", `canonical bytes are missing for library '${k}'`); const b = { ...x, ...N.name !== void 0 ? { name: N.name } : {}, @@ -43964,24 +43995,24 @@ function Bve(e, { events: t, binaries: n, assetEngine: r }) { return { createLibrary: p, api: { - createLibrary: Wr(p), - updateLibrary: Wr(C), - importLibrary: Wr(m), - deleteLibrary: Wr(S) + createLibrary: qr(p), + updateLibrary: qr(C), + importLibrary: qr(m), + deleteLibrary: qr(S) } }; } const _ve = (e) => { const t = e.trim(); if (!/^#[0-9a-f]{6}$/i.test(t)) - throw xt("invalid-input", `mark color must be #rrggbb, got '${e}'`); + throw Et("invalid-input", `mark color must be #rrggbb, got '${e}'`); return t; }, GD = (e) => { const t = new ArrayBuffer(e.byteLength); return new Uint8Array(t).set(e), t; }, Lve = (e) => { if (!e.some((t) => t.length > 0)) - throw xt("invalid-input", "an ink mark needs at least one point"); + throw Et("invalid-input", "an ink mark needs at least one point"); return e.map((t) => t.map(({ x: n, y: r }) => ({ x: n, y: r }))); }, Dve = (e, t) => ({ x: 0, @@ -43995,11 +44026,11 @@ function jve({ assetEngine: e }) { const a = await t(Oz()); try { const l = (await a.pages.list()).pages[0]; - if (!l) throw xt("operation-failed", "the scratch document has no page"); - const u = a.page(l.ref), d = _ve(i.color ?? "#1d2b53"), f = i.kind === "ink" ? await u.annotations.create({ + if (!l) throw Et("operation-failed", "the scratch document has no page"); + const u = a.page(l.ref), f = _ve(i.color ?? "#1d2b53"), d = i.kind === "ink" ? await u.annotations.create({ subtype: "ink", inkList: Lve(i.strokes), - color: d, + color: f, strokeWidth: i.strokeWidth ?? 2 }) : await u.annotations.create({ subtype: "free-text", @@ -44010,10 +44041,10 @@ function jve({ assetEngine: e }) { textAlign: "center", verticalAlign: "middle", box: Dve(i.text, i.fontSize ?? 36), - fontColor: d, + fontColor: f, strokeWidth: 0 }); - return new Uint8Array(await u.annotations.exportAppearance([f.annotation.ref])); + return new Uint8Array(await u.annotations.exportAppearance([d.annotation.ref])); } finally { await a.close(); } @@ -44022,7 +44053,7 @@ function jve({ assetEngine: e }) { try { const l = await c.pages.list(), u = l.pages[a]; if (!u) - throw xt( + throw Et( "invalid-input", `the PDF has no page ${a} (${l.pageCount} pages)` ); @@ -44033,14 +44064,14 @@ function jve({ assetEngine: e }) { }; return { resolveAssetSource: async (i) => { if (i.source === void 0 == (i.mark === void 0)) - throw xt("invalid-input", "createAsset takes exactly one of `source` / `mark`"); - if (i.source !== void 0) return Vo(i.source); + throw Et("invalid-input", "createAsset takes exactly one of `source` / `mark`"); + if (i.source !== void 0) return $o(i.source); const a = i.mark; switch (a.kind) { case "image": - return Vo(a.source); + return $o(a.source); case "pdf": { - const c = await Vo(a.source); + const c = await $o(a.source); return a.pageIndex === void 0 ? c : { bytes: GD(await o(new Uint8Array(c.bytes), a.pageIndex)) }; @@ -44051,7 +44082,7 @@ function jve({ assetEngine: e }) { } } }; } -const bm = (e) => e.kind === "objectNumber" ? `obj:${e.objectNumber}` : `fqn:${e.name}`, Ft = (e) => bm(e.ref), Pz = () => ({ +const wm = (e) => e.kind === "objectNumber" ? `obj:${e.objectNumber}` : `fqn:${e.name}`, Kt = (e) => wm(e.ref), Pz = () => ({ snapshot: null, byKey: {}, byName: {}, @@ -44063,42 +44094,42 @@ function k5(e, t = {}) { const n = {}, r = {}, o = {}, s = {}; return e.fields.forEach((i, a) => { var c; - n[Ft(i)] = a, r[c = i.name] ?? (r[c] = a); + n[Kt(i)] = a, r[c = i.name] ?? (r[c] = a); for (const l of i.widgets) l.objectNumber > 0 && (o[l.objectNumber] = a); }), e.widgets.forEach((i, a) => { i.ref.kind === "objectNumber" && (s[i.ref.objectNumber] = a); }), { snapshot: e, byKey: n, byName: r, byWidget: o, rowByWidget: s, pictureVersions: t }; } -const Yf = (e, t) => k5(t, e.pictureVersions); +const Xf = (e, t) => k5(t, e.pictureVersions); function Rz(e, t) { const n = {}; for (const [r, o] of Object.entries(e.pictureVersions)) n[Number(r)] = o + 1; for (const r of t.widgets) { - const o = El(r); + const o = Cl(r); o > 0 && (n[o] ?? (n[o] = 0)); } return k5(t, n); } const dO = (e, t) => e.pictureVersions[t] ?? 0; -function uo(e, t) { +function fo(e, t) { if (!e.snapshot || t.length === 0) return e; const n = e.snapshot.fields.slice(); for (const r of t) { - const o = e.byKey[Ft(r)]; + const o = e.byKey[Kt(r)]; o === void 0 ? n.push(r) : n[o] = r; } - return Yf(e, { ...e.snapshot, fields: n }); + return Xf(e, { ...e.snapshot, fields: n }); } -const El = (e) => e.ref.kind === "objectNumber" ? e.ref.objectNumber : 0; -function fo(e, t) { +const Cl = (e) => e.ref.kind === "objectNumber" ? e.ref.objectNumber : 0; +function ho(e, t) { if (!e.snapshot || t.length === 0) return e; - const n = new Map(t.map((o) => [El(o), o])), r = e.snapshot.widgets.map((o) => { - const s = n.get(El(o)); - return s && n.delete(El(o)), s ?? o; + const n = new Map(t.map((o) => [Cl(o), o])), r = e.snapshot.widgets.map((o) => { + const s = n.get(Cl(o)); + return s && n.delete(Cl(o)), s ?? o; }); - return Yf(e, { ...e.snapshot, widgets: [...r, ...n.values()] }); + return Xf(e, { ...e.snapshot, widgets: [...r, ...n.values()] }); } function Tz(e, t, n) { if (!e.snapshot) return e; @@ -44108,19 +44139,19 @@ function Tz(e, t, n) { n.map(oe), (o) => oe(o.ref) ); - return Yf(e, { ...e.snapshot, widgets: r }); + return Xf(e, { ...e.snapshot, widgets: r }); } -function wm(e, t) { +function vm(e, t) { if (!e.snapshot || t.length === 0) return e; - const n = new Set(t.map((o) => o.objectNumber)), r = e.snapshot.widgets.filter((o) => !n.has(El(o))); - return r.length === e.snapshot.widgets.length ? e : Yf(e, { ...e.snapshot, widgets: r }); + const n = new Set(t.map((o) => o.objectNumber)), r = e.snapshot.widgets.filter((o) => !n.has(Cl(o))); + return r.length === e.snapshot.widgets.length ? e : Xf(e, { ...e.snapshot, widgets: r }); } function Mz(e, t) { if (!e.snapshot) return e; const n = e.snapshot.fields.filter( (r) => t.kind === "objectNumber" ? !(r.ref.kind === "objectNumber" && r.ref.objectNumber === t.objectNumber) : r.name !== t.name ); - return n.length === e.snapshot.fields.length ? e : Yf(e, { ...e.snapshot, fields: n }); + return n.length === e.snapshot.fields.length ? e : Xf(e, { ...e.snapshot, fields: n }); } function Fve(e, t) { return Hve($ve(e, Vve(t)), t); @@ -44139,7 +44170,7 @@ function $ve(e, t) { if (o.objectNumber) n.add(o.objectNumber); else if (o.page) for (const s of e.snapshot?.widgets ?? []) - s.page.objectNumber === o.page.objectNumber && n.add(El(s)); + s.page.objectNumber === o.page.objectNumber && n.add(Cl(s)); if (n.size === 0) return e; const r = { ...e.pictureVersions }; for (const o of n) r[o] = (r[o] ?? 0) + 1; @@ -44150,11 +44181,11 @@ function Uve(e, t) { const n = t.ref.objectNumber; if (t.widgets.some((o) => o.objectNumber === n)) return e; const r = xn(e, n); - return r ? wm(e, [{ ref: r.ref, objectNumber: n, page: r.page }]) : e; + return r ? vm(e, [{ ref: r.ref, objectNumber: n, page: r.page }]) : e; } function Kve(e, t) { - const n = new Set(t.widgets.map(El)); - return wm( + const n = new Set(t.widgets.map(Cl)); + return vm( e, t.meta.changedWidgets.filter((r) => !n.has(r.objectNumber)) ); @@ -44163,47 +44194,47 @@ function Hve(e, t) { switch (t.type) { case "forms.widgetAdded": return Uve( - fo(uo(e, [t.field]), t.widgets), + ho(fo(e, [t.field]), t.widgets), t.field ); case "forms.widgetRemoved": - return fo( - Kve(uo(e, [t.field]), t), + return ho( + Kve(fo(e, [t.field]), t), t.widgets ); case "forms.valueSet": case "forms.restored": - return fo(uo(e, [t.field]), t.widgets); + return ho(fo(e, [t.field]), t.widgets); case "forms.updated": - return Rd( - fo(uo(e, [t.field]), t.widgets), + return Md( + ho(fo(e, [t.field]), t.widgets), t.calculationOrder ); case "forms.created": { - const n = fo(uo(e, [t.field]), t.widgets); - return Rd( - n.snapshot?.formKind === "none" ? Yf(n, { ...n.snapshot, formKind: "acroform" }) : n, + const n = ho(fo(e, [t.field]), t.widgets); + return Md( + n.snapshot?.formKind === "none" ? Xf(n, { ...n.snapshot, formKind: "acroform" }) : n, t.calculationOrder ); } case "forms.calculationsReordered": - return Rd(e, t.calculationOrder); + return Md(e, t.calculationOrder); case "forms.widgetDeleted": { - const n = wm(e, t.meta.changedWidgets); - return t.field ? uo(n, [t.field]) : n; + const n = vm(e, t.meta.changedWidgets); + return t.field ? fo(n, [t.field]) : n; } case "forms.widgetRestored": - return fo(t.field ? uo(e, [t.field]) : e, t.widgets); + return ho(t.field ? fo(e, [t.field]) : e, t.widgets); case "forms.widgetUpdated": return QS( - fo(e, [t.widget]), - wn(e, El(t.widget)) + ho(e, [t.widget]), + wn(e, Cl(t.widget)) ); case "forms.widgetsReordered": return Tz(e, t.page, t.order); case "forms.deleted": - return t.deleted ? Rd( - wm(Mz(e, t.deleted), t.meta.changedWidgets), + return t.deleted ? Md( + vm(Mz(e, t.deleted), t.meta.changedWidgets), t.calculationOrder ) : os(); // A repair reports only counts; the others add or remove pages, or paint their @@ -44225,27 +44256,27 @@ function JD(e) { ({ actions: t }) => !!(t?.keystroke || t?.validate || t?.calculate || t?.format) ); } -function Rd(e, t) { - return !t || !e.snapshot ? e : Yf(e, { ...e.snapshot, calculationOrder: [...t] }); +function Md(e, t) { + return !t || !e.snapshot ? e : Xf(e, { ...e.snapshot, calculationOrder: [...t] }); } const Ya = (e, t) => { const n = e.byKey[t]; return n === void 0 ? null : e.snapshot?.fields[n] ?? null; }; function yt(e, t) { - const n = t.kind === "fqn" ? e.byName[t.name] : e.byKey[bm(t)]; + const n = t.kind === "fqn" ? e.byName[t.name] : e.byKey[wm(t)]; return n === void 0 ? null : e.snapshot?.fields[n] ?? null; } const YS = (e, t) => { const n = yt(e, t); - return n ? Ft(n) : bm(t); + return n ? Kt(n) : wm(t); }, wn = (e, t) => { const n = e.byWidget[t]; return n === void 0 ? null : e.snapshot?.fields[n] ?? null; }; function zve(e, t) { return (t.snapshot?.fields ?? []).filter((n) => { - const r = Ya(e, Ft(n)); + const r = Ya(e, Kt(n)); return !r || JSON.stringify(YD(r)) !== JSON.stringify(YD(n)); }); } @@ -44253,14 +44284,14 @@ const YD = (e) => "valueEntry" in e ? e.valueEntry : null, Bz = (e) => ({ box: e.box ?? e.rect, rotation: e.box ? e.rotation ?? 0 : 0, rect: e.rect -}), fO = (e) => e.rect.width > 0 && e.rect.height > 0, j2 = (e) => !e.hidden && !e.noView && fO(e), au = (e) => e.kind === "pushbutton" && e.takesImage; +}), fO = (e) => e.rect.width > 0 && e.rect.height > 0, j2 = (e) => !e.hidden && !e.noView && fO(e), cu = (e) => e.kind === "pushbutton" && e.takesImage; function QS(e, t) { - const n = t && Ya(e, Ft(t)); + const n = t && Ya(e, Kt(t)); if (n?.kind !== "pushbutton") return e; const r = c6( n.widgets.map((o) => xn(e, o.objectNumber)?.actions ?? null) ); - return r === n.takesImage ? e : uo(e, [{ ...n, takesImage: r }]); + return r === n.takesImage ? e : fo(e, [{ ...n, takesImage: r }]); } function Wve(e, t) { const n = {}; @@ -44305,7 +44336,7 @@ function Yve(e, t, n) { for (const [o, { box: s, rotation: i, rect: a }] of Object.entries(t)) { if (!Jve(a, n)) continue; const c = Number(o), l = wn(e, c); - l && (!r || a.width * a.height < r.rect.width * r.rect.height) && (r = { annotObjectNumber: c, field: l, box: s, rotation: i, rect: a, imageBox: au(l) }); + l && (!r || a.width * a.height < r.rect.width * r.rect.height) && (r = { annotObjectNumber: c, field: l, box: s, rotation: i, rect: a, imageBox: cu(l) }); } return r; } @@ -44323,17 +44354,17 @@ function e1e(e, t) { function QD(e, t) { return w0(e.designAssignment, t) ? e : { ...e, designAssignment: Object.freeze({ ...t }) }; } -const Ts = (e) => e.kind === "objectNumber" ? `obj:${e.objectNumber}` : `fqn:${e.name}`, x5 = (e, t) => Ts(e) === Ts(t), hl = (e) => Array.isArray(e) ? [...e] : e, XD = (e, t) => Array.isArray(e) && Array.isArray(t) ? e.length === t.length && e.every((n, r) => n === t[r]) : e === t; +const Ts = (e) => e.kind === "objectNumber" ? `obj:${e.objectNumber}` : `fqn:${e.name}`, x5 = (e, t) => Ts(e) === Ts(t), pl = (e) => Array.isArray(e) ? [...e] : e, XD = (e, t) => Array.isArray(e) && Array.isArray(t) ? e.length === t.length && e.every((n, r) => n === t[r]) : e === t; function t1e(e) { return e.map((t) => ({ ...t, ref: { ...t.ref }, - value: hl(t.value), - defaultValue: hl(t.defaultValue), + value: pl(t.value), + defaultValue: pl(t.defaultValue), ...t.options ? { options: t.options.map((n) => ({ ...n })) } : {} })); } -function Td(e, t) { +function Bd(e, t) { return e.find((n) => x5(n.ref, t)); } function my(e, t) { @@ -44384,16 +44415,16 @@ function n1e(e) { return null; } } -function bu(e, t) { +function wu(e, t) { for (const n of t) { if (n.kind === "reset") { for (const s of n.refs) { - const i = Td(e.fields, s); - i && (i.value = hl(i.defaultValue), e.resetKeys.add(Ts(s))); + const i = Bd(e.fields, s); + i && (i.value = pl(i.defaultValue), e.resetKeys.add(Ts(s))); } continue; } - const r = Td(e.fields, n.ref); + const r = Bd(e.fields, n.ref); if (!r) continue; const o = Ts(n.ref); n.kind === "setValue" ? (r.value = jz(r, n.value), e.resetKeys.delete(o)) : n.kind === "setDisplay" ? r.display = n.display : e.appearances.set(o, { ref: n.ref, text: n.text }); @@ -44402,7 +44433,7 @@ function bu(e, t) { function ZD(e) { const t = [], n = []; for (const r of e.fields) { - const o = Td(e.original, r.ref); + const o = Bd(e.original, r.ref); if (o) { if (!XD(o.value, r.value)) { const s = Ts(r.ref); @@ -44424,7 +44455,7 @@ function ZD(e) { })) ), t; } -function to(e) { +function no(e) { return { kind: "invalid-output", message: e }; } function r1e(e) { @@ -44444,7 +44475,7 @@ function e8(e, t) { function t8(e, t) { const n = [], r = []; let o = 0, s = 0; - const i = (l, u) => (s += r1e(JSON.stringify(l)), n.push(...l.uiEffects.map((d) => ({ ...d, phase: u }))), r.push(...l.diagnostics), s > t.maxOutputBytes ? { + const i = (l, u) => (s += r1e(JSON.stringify(l)), n.push(...l.uiEffects.map((f) => ({ ...f, phase: u }))), r.push(...l.diagnostics), s > t.maxOutputBytes ? { kind: "budget", message: `Form script transaction output exceeded ${t.maxOutputBytes} bytes` } : l.error ?? null), a = () => { @@ -44452,20 +44483,20 @@ function t8(e, t) { return l <= 0 ? null : { ...t, maxExecutionMs: l }; }; return { uiEffects: n, diagnostics: r, consume: i, run: async (l, u) => { - const d = a(); - if (!d) + const f = a(); + if (!f) return { error: { kind: "budget", message: "Form script transaction timed out" } }; - let f; + let d; try { const g = Date.now(); - f = await e.run(l, u, d), o += Date.now() - g; + d = await e.run(l, u, f), o += Date.now() - g; } catch (g) { return { - error: to(g instanceof Error ? g.message : String(g)) + error: no(g instanceof Error ? g.message : String(g)) }; } - const h = i(f, "user"); - return h ? { error: h } : { output: f }; + const h = i(d, "user"); + return h ? { error: h } : { output: d }; } }; } function o1e(e) { @@ -44532,25 +44563,25 @@ class s1e { return { status: "accepted", effects: [], bootEffects: [], uiEffects: [], diagnostics: [] }; const a = my(n, i); if (!a) - return this.failed([], [], to(`Form field '${Ts(i)}' no longer exists`)); + return this.failed([], [], no(`Form field '${Ts(i)}' no longer exists`)); const c = a.ref, l = oA(n), u = { original: l, fields: t1e(l), resetKeys: /* @__PURE__ */ new Set(), appearances: /* @__PURE__ */ new Map() - }, d = Td(u.fields, c); - if (!d) - return this.failed([], [], to(`Form field '${Ts(c)}' has no script view`)); - const f = o !== void 0; - let h = hl(d.value); + }, f = Bd(u.fields, c); + if (!f) + return this.failed([], [], no(`Form field '${Ts(c)}' has no script view`)); + const d = o !== void 0; + let h = pl(f.value); if (o) try { - h = jz(d, o); + h = jz(f, o); } catch (A) { return this.failed( [], [], - to(A instanceof Error ? A.message : String(A)) + no(A instanceof Error ? A.message : String(A)) ); } const g = this.options.document(), p = e8(g, a), m = this.transactionBudget ?? r0, { uiEffects: v, diagnostics: S, consume: C, run: k } = t8(t, m), N = (A, b) => ({ @@ -44573,19 +44604,19 @@ class s1e { b ? S.push({ code: "script-error", message: `Document boot script failed (continuing without it): ${b.message}` - }) : bu(u, A.formEffects); + }) : wu(u, A.formEffects); } } const w = ZD(u); if (s) { let A; try { - A = ol(s); + A = sl(s); } catch (b) { return this.failed( v, S, - to(b instanceof Error ? b.message : String(b)) + no(b instanceof Error ? b.message : String(b)) ); } if (A) { @@ -44595,26 +44626,26 @@ class s1e { kind: "widget-activate", target: c, source: c, - value: d.value + value: f.value }) ); if (b.error) return this.failed(v, S, b.error); - bu(u, b.output.formEffects); + wu(u, b.output.formEffects); } } - if (!s && f && a.actions?.keystroke && a.kind === "text") { + if (!s && d && a.actions?.keystroke && a.kind === "text") { let A; try { - A = ol(a.actions.keystroke); + A = sl(a.actions.keystroke); } catch (b) { return this.failed( v, S, - to(b instanceof Error ? b.message : String(b)) + no(b instanceof Error ? b.message : String(b)) ); } if (A) { - const b = String(d.value ?? ""), E = await k( + const b = String(f.value ?? ""), E = await k( A, N(u.fields, { kind: "field-keystroke", @@ -44637,7 +44668,7 @@ class s1e { else { if (!E.output.event.rc) return this.rejected(w, v, S); - bu(u, E.output.formEffects); + wu(u, E.output.formEffects); const O = E.output.event, T = String(O.value ?? ""); h = T.slice(0, O.selStart) + O.change + T.slice(Math.max(O.selStart, O.selEnd)); } @@ -44664,19 +44695,19 @@ class s1e { else { if (!I.output.event.rc) return this.rejected(w, v, S); - bu(u, I.output.formEffects), h = hl(I.output.event.value); + wu(u, I.output.formEffects), h = pl(I.output.event.value); } } } - if (!s && f && (d.value = hl(h), u.resetKeys.delete(Ts(c))), !s && f && a.actions?.validate) { + if (!s && d && (f.value = pl(h), u.resetKeys.delete(Ts(c))), !s && d && a.actions?.validate) { let A; try { - A = ol(a.actions.validate); + A = sl(a.actions.validate); } catch (b) { return this.failed( v, S, - to(b instanceof Error ? b.message : String(b)) + no(b instanceof Error ? b.message : String(b)) ); } if (A) { @@ -44700,33 +44731,33 @@ class s1e { else { if (!b.output.event.rc) return this.rejected(w, v, S); - d.value = hl(b.output.event.value), bu(u, b.output.formEffects); + f.value = pl(b.output.event.value), wu(u, b.output.formEffects); } } } - const y = !s && f ? [c] : []; + const y = !s && d ? [c] : []; for (const A of s ? [] : n.calculationOrder) { if (!A) continue; const b = my(n, A), E = b?.actions?.calculate; if (!b || !E) continue; let I; try { - I = ol(E); + I = sl(E); } catch (T) { return this.failed( v, S, - to(T instanceof Error ? T.message : String(T)) + no(T instanceof Error ? T.message : String(T)) ); } - const O = Td(u.fields, A); + const O = Bd(u.fields, A); if (I && O) { const T = await k( I, N(u.fields, { kind: "field-calculate", target: A, - ...f ? { source: c } : {}, + ...d ? { source: c } : {}, value: O.value }) ); @@ -44735,21 +44766,21 @@ class s1e { T.error ? S.push({ code: "script-error", message: `Calculate script failed (field left unchanged): ${T.error.message}` - }) : bu(u, T.output.formEffects); + }) : wu(u, T.output.formEffects); } y.some((T) => x5(T, A)) || y.push(A); } for (const A of y) { - const b = my(n, A), E = b?.actions?.format, I = Td(u.fields, A); + const b = my(n, A), E = b?.actions?.format, I = Bd(u.fields, A); if (!b || !E || !I) continue; let O; try { - O = ol(E); + O = sl(E); } catch (M) { return this.failed( v, S, - to(M instanceof Error ? M.message : String(M)) + no(M instanceof Error ? M.message : String(M)) ); } if (!O) continue; @@ -44758,7 +44789,7 @@ class s1e { N(u.fields, { kind: "field-format", target: A, - ...f ? { source: c } : {}, + ...d ? { source: c } : {}, value: T }) ); @@ -44771,7 +44802,7 @@ class s1e { }); continue; } - bu(u, R.output.formEffects); + wu(u, R.output.formEffects); } const x = ZD(u); return x.length + v.length > m.maxEffects ? this.failed(v, S, { @@ -44793,9 +44824,9 @@ class s1e { message: null, error: h }), s = my(n, r); - if (!s) return o(to(`Form field '${Ts(r)}' no longer exists`)); - const i = s.ref, a = oA(n), c = Td(a, i); - if (!c) return o(to(`Form field '${Ts(i)}' has no script view`)); + if (!s) return o(no(`Form field '${Ts(r)}' no longer exists`)); + const i = s.ref, a = oA(n), c = Bd(a, i); + if (!c) return o(no(`Form field '${Ts(i)}' has no script view`)); const l = [], u = s.kind === "text" ? s.actions?.keystroke : void 0; if (u) { const h = String(c.value ?? ""), g = { kind: "field-keystroke", target: i, source: i }; @@ -44816,20 +44847,20 @@ class s1e { kind: "field-validate", target: i, source: i, - value: hl(c.value), + value: pl(c.value), willCommit: !0 } }); - const d = e8(this.options.document(), s), { run: f } = t8(t, this.transactionBudget ?? r0); + const f = e8(this.options.document(), s), { run: d } = t8(t, this.transactionBudget ?? r0); for (const { tree: h, event: g } of l) { let p; try { - p = ol(h); + p = sl(h); } catch (v) { - return o(to(v instanceof Error ? v.message : String(v))); + return o(no(v instanceof Error ? v.message : String(v))); } if (!p) continue; - const m = await f(p, { fields: a, pageNumber: d, event: g }); + const m = await d(p, { fields: a, pageNumber: f, event: g }); if (m.error && m.error.kind !== "exception") return o(m.error); if (!m.error && !m.output.event.rc) return { status: "rejected", message: o1e(m.output) }; @@ -44853,7 +44884,7 @@ function i1e(e, { ghosts: r, targets: o }, { canPlace: s }) { - const { binaries: i, libraryBinaries: a } = t, { openAssetDocument: c, imageToPreview: l } = n, { ghostProvider: u } = r, { documentIdOf: d, targetOf: f, pageOf: h } = o, g = e.settings(), p = () => Object.keys(e.state.get().armed).filter( + const { binaries: i, libraryBinaries: a } = t, { openAssetDocument: c, imageToPreview: l } = n, { ghostProvider: u } = r, { documentIdOf: f, targetOf: d, pageOf: h } = o, g = e.settings(), p = () => Object.keys(e.state.get().armed).filter( (b) => !e.tryForDocument(_n, b)?.stamps.isArmed() ).join(` `); @@ -44869,62 +44900,62 @@ function i1e(e, { subject: b.subject ?? b.label }), v = async (b, E, I) => { if (!g.get().dynamic) return I; - const O = e.tryForDocument(Dm, b), T = O?.createDetachedScriptRealm; + const O = e.tryForDocument(jm, b), T = O?.createDetachedScriptRealm; if (!O || !T) return I; - const R = e.get(It), M = R.get(b); + const R = e.get(Pt), M = R.get(b); if (M?.status !== "ready") - throw xt("not-found", `document '${b}' is not open`); + throw Et("not-found", `document '${b}' is not open`); const F = { name: M.name, pageCount: M.pageCount, pages: R.listPages(b) - }, B = a.get(E.libraryId), $ = B ?? I.bytes, D = await c(new Uint8Array($)); - let _ = null, L = null; + }, _ = a.get(E.libraryId), $ = _ ?? I.bytes, D = await c(new Uint8Array($)); + let B = null, L = null; try { const j = await D.pages.list(), H = E.page === void 0 ? j.pageCount === 1 ? j.pages[0] : void 0 : j.pages.find(({ ref: Be }) => Be.objectNumber === E.page.objectNumber); if (!H) - throw xt( + throw Et( "invalid-input", - B ? `canonical page ${E.page?.objectNumber ?? "unknown"} no longer exists` : "a loose dynamic stamp asset must contain exactly one page" + _ ? `canonical page ${E.page?.objectNumber ?? "unknown"} no longer exists` : "a loose dynamic stamp asset must contain exactly one page" ); const Y = await D.forms.list(); if (!Y.fields.some( - (Be) => Be.widgets.some(({ page: te }) => te?.objectNumber === H.ref.objectNumber) + (Be) => Be.widgets.some(({ page: ee }) => ee?.objectNumber === H.ref.objectNumber) )) return I; if (!D.pages.flatten || !D.pages.extract) - throw xt( + throw Et( "unsupported", "dynamic PDF stamps need an asset engine with pages.flatten and pages.extract" ); - _ = T.call(O, { + B = T.call(O, { doc: D, document: () => F, - bootSources: async () => (D.actions ? await D.actions.get() : null)?.nameTreeScripts.map(({ action: te }) => ol(te)) ?? [] + bootSources: async () => (D.actions ? await D.actions.get() : null)?.nameTreeScripts.map(({ action: ee }) => sl(ee)) ?? [] }), L = hO({ document: () => F, - transaction: _.transaction.bind(_), - budget: _.budget + transaction: B.transaction.bind(B), + budget: B.budget }); - const le = await L.transaction(async (Be) => { - const te = await Be.recalculate(Y); - return te.status === "accepted" && te.effects.length > 0 && await D.apply({ ops: qw(te.effects) }), te; + const ie = await L.transaction(async (Be) => { + const ee = await Be.recalculate(Y); + return ee.status === "accepted" && ee.effects.length > 0 && await D.apply({ ops: qw(ee.effects) }), ee; }); - if (O.surfaceScriptCommit(le, { origin: "user", realm: "detached" }), le.status === "failed") - throw xt( + if (O.surfaceScriptCommit(ie, { origin: "user", realm: "detached" }), ie.status === "failed") + throw Et( "operation-failed", - `dynamic stamp scripting failed: ${le.error?.message ?? "native form effect failed"}` + `dynamic stamp scripting failed: ${ie.error?.message ?? "native form effect failed"}` ); const pe = H.ref; await D.pages.flatten([pe], { usage: "display" }); - const ge = await D.pages.extract([pe]), Me = await D.page(pe).render.image({ + const ve = await D.pages.extract([pe]), _e = await D.page(pe).render.image({ viewport: { kind: "width", width: g.get().previewWidth }, background: "transparent", includeAnnotations: !1, format: "png" }); - return { bytes: ge, preview: l(Me) }; + return { bytes: ve, preview: l(_e) }; } finally { - L?.destroy(), _?.destroy(), await D.close(); + L?.destroy(), B?.destroy(), await D.close(); } }, S = (b) => { const E = e.state.get().assets[b], I = i.get(b); @@ -44935,7 +44966,7 @@ function i1e(e, { }, k = async (b, E) => { const I = E?.signal; bn(I); - const O = f(E), { asset: T, binary: R } = S(b); + const O = d(E), { asset: T, binary: R } = S(b); C(O, "stamp.armAsset"); const M = await e.cancellable( I, @@ -44949,10 +44980,10 @@ function i1e(e, { { signal: I } ), e.state.update(Ive, O, b); }, N = (b) => { - const E = d(b), I = E === null ? void 0 : e.state.get().armed[E]; + const E = f(b), I = E === null ? void 0 : e.state.get().armed[E]; return E === null || I === void 0 || !e.tryForDocument(_n, E)?.stamps.isArmed() ? null : e.state.get().assets[I] ?? null; }, w = (b) => { - const E = d(b); + const E = f(b); E !== null && (e.tryForDocument(vt, E)?.stamps.disarm(), e.state.update(KD, [E])); }, y = async (b, E, I, O) => { const { asset: T, binary: R } = S(E), M = await e.cancellable( @@ -44966,50 +44997,50 @@ function i1e(e, { ); }, x = async (b, E, I) => { bn(I?.signal); - const O = f(I); + const O = d(I); return S(b), C(O, "stamp.placeAsset"), y(O, b, E, I?.signal); }, A = async (b, E, I, O) => { const T = O?.signal; bn(T); - const R = f(O); + const R = d(O); S(b), C(R, "stamp.placeAssetOnPages"); - const M = E === "all" ? e.get(It).listPages(R).map(($) => $.ref) : E.map(($) => h(R, $).ref), F = [], B = []; + const M = E === "all" ? e.get(Pt).listPages(R).map(($) => $.ref) : E.map(($) => h(R, $).ref), F = [], _ = []; for (const $ of M) try { const D = await y(R, b, { ...I, page: $ }, T); F.push(D.annotation); } catch (D) { - const _ = qe("stamp", D); - if (_.code === "operation-cancelled") throw _; - B.push({ ref: $, error: Br(_) }); + const B = ze("stamp", D); + if (B.code === "operation-cancelled") throw B; + _.push({ ref: $, error: Br(B) }); } - return { applied: F, skipped: [], failed: B }; + return { applied: F, skipped: [], failed: _ }; }; return { api: { - armAsset: Wr(k), + armAsset: qr(k), disarm: w, getArmedAsset: N, - placeAsset: Wr(x), - placeAssetOnPages: Wr(A) + placeAsset: qr(x), + placeAssetOnPages: qr(A) } }; } function a1e(e) { const t = Eve(e), { events: n } = t, r = e.settings(); - e.state.onChange(({ previous: u, next: d }) => { - if (u.armed === d.armed) return; - const f = /* @__PURE__ */ new Set([...Object.keys(u.armed), ...Object.keys(d.armed)]); - for (const h of f) { - const g = d.armed[h]; + e.state.onChange(({ previous: u, next: f }) => { + if (u.armed === f.armed) return; + const d = /* @__PURE__ */ new Set([...Object.keys(u.armed), ...Object.keys(f.armed)]); + for (const h of d) { + const g = f.armed[h]; u.armed[h] !== g && n.armChanged.emit({ documentId: h, - asset: g === void 0 ? null : d.assets[g] ?? null + asset: g === void 0 ? null : f.assets[g] ?? null }); } }); const o = bve(e, t), s = jve(t), i = Bve(e, t), a = Tve(e, t, s, i, o), c = i1e(e, t, o); - return { api: tu("stamp", [ + return { api: nu("stamp", [ r.api, o.api, i.api, @@ -45086,8 +45117,8 @@ function d1e(e, t, n = {}) { try { l.step === "save" ? await t.put(i, await e.exportLibrary(i)) : await t.delete(i); } catch (u) { - const d = l.step === "save" ? "persisting" : "deleting stored"; - globalThis.console?.warn(`[stamp] ${d} library '${i}' failed:`, u); + const f = l.step === "save" ? "persisting" : "deleting stored"; + globalThis.console?.warn(`[stamp] ${f} library '${i}' failed:`, u); } o.delete(i), l.next && s(i, l.next); }); @@ -45099,7 +45130,7 @@ function d1e(e, t, n = {}) { function E5() { return bt(Qn); } -const f1e = wo(l1e); +const f1e = vo(l1e); function h1e(e) { const t = e?.kind === void 0 ? void 0 : [].concat(e.kind).join("\0"); return wt( @@ -45117,7 +45148,7 @@ function Fz(e) { ); } function p1e(e) { - const t = E5(), [n, r] = De(null); + const t = E5(), [n, r] = je(null); return Ke(() => { const o = e ? t.getAssetPreview(e) : null; if (!o) { @@ -45143,16 +45174,16 @@ const g1e = [ ], Vz = (e, t = 1) => typeof e == "object" ? e : f7(1, 1, e === "imperial" ? "ft" : "m", { userUnit: t }); function m1e(e, t, n = s6(t)) { const r = e.x[0]?.unit.trim(); - if (!(r in Do)) + if (!(r in jo)) throw new RangeError("This scale has an unknown base unit; calibrate it first"); const o = e.distance[e.distance.length - 1], s = o?.fraction === "fraction" ? 100 : o?.precision ?? 100; return { ...e, - distance: [{ unit: t, conversion: Do[r] / Do[t], precision: s, fraction: "decimal" }], + distance: [{ unit: t, conversion: jo[r] / jo[t], precision: s, fraction: "decimal" }], area: [ { unit: a6(n), - conversion: Do[r] ** 2 / i6(n), + conversion: jo[r] ** 2 / i6(n), precision: s, fraction: "decimal" } @@ -45169,7 +45200,7 @@ function y1e(e, t) { } function b1e(e, t) { const n = e.x[0]?.unit.trim(); - if (!(n in Do)) + if (!(n in jo)) throw new RangeError("This scale has an unknown base unit; calibrate it first"); const r = e.area[e.area.length - 1], o = r?.fraction === "fraction" ? 100 : r?.precision ?? 100; return { @@ -45177,14 +45208,14 @@ function b1e(e, t) { area: [ { unit: a6(t), - conversion: Do[n] ** 2 / i6(t), + conversion: jo[n] ** 2 / i6(t), precision: o, fraction: "decimal" } ] }; } -const gi = sn("measurement", { +const gi = an("measurement", { hint: "add measurementPlugin() from '@embedpdf/plugin-measurement' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -45207,7 +45238,7 @@ const gi = sn("measurement", { source: "default", ready: !1, persistent: !1 -}), k1e = Object.freeze({ unavailable: "not-dimension" }), $z = Object.keys(Do), A1e = [...$z.map(s6), "ha", "acre"]; +}), k1e = Object.freeze({ unavailable: "not-dimension" }), $z = Object.keys(jo), A1e = [...$z.map(s6), "ha", "acre"]; function S1e(e, { siblings: t }, { scaleOf: n }) { const { annotation: r } = t, o = e.settings(), s = () => e.state.get(), i = /* @__PURE__ */ new WeakMap(); return { @@ -45220,22 +45251,22 @@ function S1e(e, { siblings: t }, { scaleOf: n }) { listUnits: () => $z, listAreaUnits: () => A1e, getReadout: (u) => { - const d = r.get(u); - if (!d) return k1e; - let f = i.get(d); - return f || (f = Ba(d), i.set(d, f)), f; + const f = r.get(u); + if (!f) return k1e; + let d = i.get(f); + return d || (d = Ba(f), i.set(f, d)), d; }, - measureDistance: (u, d, f) => Ba({ + measureDistance: (u, f, d) => Ba({ subtype: "line", intent: "line-dimension", measure: n(u).measure, - linePoints: { start: d, end: f } + linePoints: { start: f, end: d } }), - measureArea: (u, d) => Ba({ + measureArea: (u, f) => Ba({ subtype: "polygon", intent: "polygon-dimension", measure: n(u).measure, - vertices: [...d] + vertices: [...f] }), getCalibrationRequest: () => s().calibration } @@ -45287,32 +45318,32 @@ const n8 = Object.freeze({ persistent: !1 }), TC = Object.freeze([]); function B1e(e, { siblings: t }) { - const { annotation: n } = t, r = e.settings(), o = (d) => Vz(r.get().defaultScale, d.userUnit), s = (d) => e.doc.page(d).measure !== void 0, i = (d) => s(d.ref) ? d.viewports ?? TC : e.state.get().localViewports[d.ref.objectNumber] ?? TC, a = Mn( - (d) => { - const f = e.getPage(Lt(d)); + const { annotation: n } = t, r = e.settings(), o = (f) => Vz(r.get().defaultScale, f.userUnit), s = (f) => e.doc.page(f).measure !== void 0, i = (f) => s(f.ref) ? f.viewports ?? TC : e.state.get().localViewports[f.ref.objectNumber] ?? TC, a = Mn( + (f) => { + const d = e.getPage(Ft(f)); return [ - f, - f ? i(f) : TC, - f ? s(f.ref) : !1, + d, + d ? i(d) : TC, + d ? s(d.ref) : !1, r.get().defaultScale ]; }, - (d, f, h, g) => f ? M1e(h, f.size, o(f), g) : n8 + (f, d, h, g) => d ? M1e(h, d.size, o(d), g) : n8 ); - return { ensureLoaded: (d) => e.getPage(d) ? Promise.resolve() : Promise.reject(new re("not-found", "measurement", "no such page")), scaleOf: (d) => { - if (typeof d != "number") return a(d.objectNumber); - const f = e.getPage(d); - return f ? a(f.ref.objectNumber) : n8; + return { ensureLoaded: (f) => e.getPage(f) ? Promise.resolve() : Promise.reject(new te("not-found", "measurement", "no such page")), scaleOf: (f) => { + if (typeof f != "number") return a(f.objectNumber); + const d = e.getPage(f); + return d ? a(d.ref.objectNumber) : n8; }, isPersistent: s, connect: () => { - const d = /* @__PURE__ */ new Map(), f = (g, p = !1) => { + const f = /* @__PURE__ */ new Map(), d = (g, p = !1) => { const m = i(g); - !p && d.get(g.ref.objectNumber) === m || (d.set(g.ref.objectNumber, m), n.setPageViewports(g.ref, [...m], o(g))); + !p && f.get(g.ref.objectNumber) === m || (f.set(g.ref.objectNumber, m), n.setPageViewports(g.ref, [...m], o(g))); }, h = () => { - for (const g of e.document()?.pages ?? []) f(g); + for (const g of e.document()?.pages ?? []) d(g); }; h(), e.watch(() => e.document()?.pages, h), e.watch(() => e.state.get().localViewports, h), e.listen(r.api.onSettingsChanged, ({ changedKeys: g }) => { if (g.includes("defaultScale")) - for (const p of e.document()?.pages ?? []) f(p, !0); + for (const p of e.document()?.pages ?? []) d(p, !0); }); } }; } @@ -45320,11 +45351,11 @@ function _1e(e, { events: t, store: n, siblings: r }) { const { calibrationRequested: o, calibrationDismissed: s } = t, { canCalibrate: i } = n, { annotation: a, interaction: c } = r; return { connect: () => { - e.listen(a.onDraftCaptured, (f) => { - if (f.tool !== "calibrate" || !i()) return; - const h = If(f.from), g = If(f.to), p = Math.hypot(g.x - h.x, g.y - h.y); + e.listen(a.onDraftCaptured, (d) => { + if (d.tool !== "calibrate" || !i()) return; + const h = Of(d.from), g = Of(d.to), p = Math.hypot(g.x - h.x, g.y - h.y); if (!(p > 0)) return; - const m = { page: f.page, from: h, to: g, userSpaceLength: p }; + const m = { page: d.page, from: h, to: g, userSpaceLength: p }; c.activateTool("pointer"), e.state.update(iA, m), o.emit({ request: m }); }); }, @@ -45346,15 +45377,15 @@ function L1e(e, { siblings: t }, { scaleOf: n }) { }; switch (i.kind) { case "distance": { - const [d, f] = i.points; - return !d || !f || i.points.length !== 2 ? new re( + const [f, d] = i.points; + return !f || !d || i.points.length !== 2 ? new te( "invalid-input", "measurement", "a distance needs exactly two points" ) : { subtype: "line", intent: "line-dimension", - linePoints: { start: d, end: f }, + linePoints: { start: f, end: d }, lineEndings: l.lineEndings, // The arrowheads fill with the line's color unless the tool sets a fill. interiorColor: l.interiorColor ?? l.color, @@ -45385,14 +45416,14 @@ function L1e(e, { siblings: t }, { scaleOf: n }) { e.assertAllowed("annotations:create", "measurement.createMeasurement"); const c = e.pageOf(i.page).ref; if (!n(c).ready) - throw new re("not-ready", "measurement", "the page scale is not known yet"); + throw new te("not-ready", "measurement", "the page scale is not known yet"); const l = o(i, c, i.tool ?? i.kind); if (l instanceof Error) throw l; return r.create(c, l, void 0, { signal: a?.signal }); } } }; } function D1e(e, { events: t, store: n, siblings: r }, { scaleOf: o, isPersistent: s }) { - const { scaleChanged: i, calibrationCompleted: a } = t, { requirePage: c, targets: l } = n, { annotation: u } = r, d = e.settings(), f = (k, N) => N ?? Vz(d.get().defaultScale, c(k).userUnit), h = ({ page: k, scale: N }) => { + const { scaleChanged: i, calibrationCompleted: a } = t, { requirePage: c, targets: l } = n, { annotation: u } = r, f = e.settings(), d = (k, N) => N ?? Vz(f.get().defaultScale, c(k).userUnit), h = ({ page: k, scale: N }) => { const w = c(k), y = e.state.get().localViewports[k.objectNumber] ?? []; e.state.update( T1e, @@ -45423,7 +45454,7 @@ function D1e(e, { events: t, store: n, siblings: r }, { scaleOf: o, isPersistent ) }) : null, reports: k.map(({ page: b, scale: E }) => { - const I = f(b, E); + const I = d(b, E); return N ? u.stageRemeasure(b, I) : { page: b, scale: I, updated: [], skipped: [], failed: [] }; }) })); @@ -45438,7 +45469,7 @@ function D1e(e, { events: t, store: n, siblings: r }, { scaleOf: o, isPersistent e.assertAllowed(XS, "changing a scale"); const y = l(k), { signal: x } = w; if (x?.aborted) - throw new re("operation-cancelled", "measurement", "operation cancelled", { + throw new te("operation-cancelled", "measurement", "operation cancelled", { cause: x.reason }); const A = k === "all" || y.length > 1, b = w.recalculate !== !1; @@ -45451,7 +45482,7 @@ function D1e(e, { events: t, store: n, siblings: r }, { scaleOf: o, isPersistent const R = N(T); R && XP(R), I.push({ page: T, scale: R }); } catch (R) { - const M = qe("measurement", R); + const M = ze("measurement", R); if (!A) throw M; E.set(T.objectNumber, m(T, M)); } @@ -45460,7 +45491,7 @@ function D1e(e, { events: t, store: n, siblings: r }, { scaleOf: o, isPersistent for (const T of await p(I, b, x)) E.set(T.page.objectNumber, T); } catch (T) { - const R = qe("measurement", T); + const R = ze("measurement", T); if (!A || R.code === "operation-cancelled") throw R; for (const { page: M } of I) E.set(M.objectNumber, m(M, R)); @@ -45475,7 +45506,7 @@ function D1e(e, { events: t, store: n, siblings: r }, { scaleOf: o, isPersistent }, S = (k) => { const N = o(k).measure; if (!N || N.subtype !== "rectilinear") - throw new re( + throw new te( "not-ready", "measurement", "calibrate this page before changing its units or precision" @@ -45486,25 +45517,25 @@ function D1e(e, { events: t, store: n, siblings: r }, { scaleOf: o, isPersistent api: { setScale: (k, N, w) => v(k, () => N, w), calibrate: async (k, N = {}) => { - const w = If(k.from), y = If(k.to); + const w = Of(k.from), y = Of(k.to); let x; try { x = KX(Math.hypot(y.x - w.x, y.y - w.y), k.distance); } catch (T) { - throw new re( + throw new te( "invalid-input", "measurement", String(T.message ?? T) ); } const { applyTo: A, ...b } = N, E = c(k.page).ref, I = await v(A ?? E, () => x, b), O = e.state.get().calibration; - return O && Vf(O.page, E) && e.state.update(iA, null), a.emit({ page: E }), I; + return O && Uf(O.page, E) && e.state.update(iA, null), a.emit({ page: E }), I; }, setUnit: (k, N, w) => v(k, (y) => m1e(S(y), N), w), setAreaUnit: (k, N, w) => v(k, (y) => b1e(S(y), N), w), setPrecision: (k, N, w) => v(k, (y) => y1e(S(y), N), w), setPreset: (k, N, w) => { - const y = d.get().presets.find((x) => x.id === N); + const y = f.get().presets.find((x) => x.id === N); return y ? v( k, (x) => f7(y.paper, y.real, y.unit, { @@ -45512,7 +45543,7 @@ function D1e(e, { events: t, store: n, siblings: r }, { scaleOf: o, isPersistent }), w ) : Promise.reject( - new re("not-found", "measurement", `unknown scale preset '${N}'`) + new te("not-found", "measurement", `unknown scale preset '${N}'`) ); }, clearScale: (k, N) => v(k, () => null, N) @@ -45522,7 +45553,7 @@ function D1e(e, { events: t, store: n, siblings: r }, { scaleOf: o, isPersistent function j1e(e) { const t = I1e(e), { events: n, store: r } = t, o = e.settings(), s = B1e(e, t), i = S1e(e, t, s), a = D1e(e, t, s), c = _1e(e, t), l = L1e(e, t, s); return { - api: tu("measurement", [ + api: nu("measurement", [ o.api, i.api, a.api, @@ -45566,12 +45597,12 @@ const F1e = (e) => ({ function jDe() { return bt(gi); } -const $1e = wo(V1e); +const $1e = vo(V1e); function U1e(e) { const t = vi(); - return en((n) => e === null ? null : n.tryCapability(gi, t ?? void 0)?.getPageScale(e) ?? v1e); + return nn((n) => e === null ? null : n.tryCapability(gi, t ?? void 0)?.getPageScale(e) ?? v1e); } -const Oi = sn("search", { +const Oi = an("search", { hint: "add searchPlugin() from '@embedpdf/plugin-search' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -45583,7 +45614,7 @@ const Oi = sn("search", { }), K1e = { reveal: { align: { y: 0.35 }, behavior: "smooth" }, highlight: { color: "#ffd500", activeColor: "#ff9632", blendMode: "multiply" } -}, oa = sn("redaction", { +}, oa = an("redaction", { hint: "add redactionPlugin() from '@embedpdf/plugin-redaction' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -45615,36 +45646,36 @@ const Oi = sn("search", { }); function W1e(e, { store: t, siblings: n }) { const { pages: r, pageIndexOf: o } = t, { annotation: s } = n, i = Mn( - (f) => { - const h = Lt(f); + (d) => { + const h = Ft(d); return [s.list({ pages: [h] }), o(h)]; }, - (f, h, g) => { + (d, h, g) => { const p = h.flatMap( (m) => m.subtype === "redact" ? [r8(m, g)] : [] ); return p.length ? p : MC; } ), a = tt( - () => r().map((f) => i(f.objectNumber)), - (...f) => f.some((h) => h.length) ? f.flat() : MC - ), c = (f) => { - if (f?.page === void 0) return a(); - const h = e.getPage(f.page); + () => r().map((d) => i(d.objectNumber)), + (...d) => d.some((h) => h.length) ? d.flat() : MC + ), c = (d) => { + if (d?.page === void 0) return a(); + const h = e.getPage(d.page); return h ? i(h.ref.objectNumber) : MC; }; return { listPending: c, - markFor: (f) => f.subtype === "redact" ? r8(f, o(f.ref.page)) : null, + markFor: (d) => d.subtype === "redact" ? r8(d, o(d.ref.page)) : null, api: { listPending: c, - getPending: (f) => { - const h = oe(f); + getPending: (d) => { + const h = oe(d); return c().find((g) => oe(g.ref) === h) ?? null; }, - getPendingCount: (f) => c(f === void 0 ? void 0 : { page: f }).length, - estimateCollateral: (f) => { - const h = f ? new Set(f.map(oe)) : null, g = []; + getPendingCount: (d) => c(d === void 0 ? void 0 : { page: d }).length, + estimateCollateral: (d) => { + const h = d ? new Set(d.map(oe)) : null, g = []; for (const p of r()) { const m = s.list({ pages: [p] }), v = m.filter( (C) => C.subtype === "redact" && (!h || h.has(oe(C.ref))) @@ -45681,7 +45712,7 @@ function Y1e(e) { const t = () => { const i = e.doc.redaction; if (!i) - throw new re("unsupported", "redaction", "this engine has no redaction service"); + throw new te("unsupported", "redaction", "this engine has no redaction service"); return i; }, n = () => (e.document()?.pages ?? []).map((i) => i.ref), r = tt( () => [e.document()?.pages], @@ -45723,38 +45754,38 @@ function oke(e, { siblings: t }) { function ske(e, { store: t }, { listPending: n }) { const { requireService: r, pages: o } = t, s = e.serialQueue("apply"); e.onSettle(() => s.idle()); - const i = (u, d) => s( + const i = (u, f) => s( async () => { - const f = r(), h = u(); + const d = r(), h = u(); e.state.update(Z1e); try { - return await e.cancellable(d?.signal, f.apply(h)); + return await e.cancellable(f?.signal, d.apply(h)); } finally { e.state.update(eke); } }, - { signal: d?.signal } + { signal: f?.signal } ); - return { api: { apply: (u, d) => i(() => { - const f = new Set(u.map(oe)), h = n().filter((g) => f.has(oe(g.ref))).map((g) => g.ref); + return { api: { apply: (u, f) => i(() => { + const d = new Set(u.map(oe)), h = n().filter((g) => d.has(oe(g.ref))).map((g) => g.ref); if (h.length === 0) - throw new re("not-found", "redaction", "no matching pending marks"); + throw new te("not-found", "redaction", "no matching pending marks"); return { annotations: h }; - }, d), applyPages: async (u, d) => { + }, f), applyPages: async (u, f) => { if (u.length === 0) - throw new re("invalid-input", "redaction", "no pages given"); - const f = u.map((h) => e.pageOf(h).ref); - return i(() => ({ pages: f }), d); + throw new te("invalid-input", "redaction", "no pages given"); + const d = u.map((h) => e.pageOf(h).ref); + return i(() => ({ pages: d }), f); }, applyAll: (u) => i(() => { - const d = o(); - if (d.length === 0) - throw new re("not-ready", "redaction", "the document has no pages"); - return { pages: d }; + const f = o(); + if (f.length === 0) + throw new te("not-ready", "redaction", "the document has no pages"); + return { pages: f }; }, u) } }; } const o8 = (e) => { if (e?.aborted) - throw new re("operation-cancelled", "redaction", "operation cancelled", { + throw new te("operation-cancelled", "redaction", "operation cancelled", { cause: e.reason }); }; @@ -45772,15 +45803,15 @@ function ike(e, { siblings: t }, { listPending: n, markFor: r }) { }; }, c = (k) => { const N = r(k); - if (!N) throw new re("operation-failed", "redaction", "the record is not a mark"); + if (!N) throw new te("operation-failed", "redaction", "the record is not a mark"); return N; }, l = (k) => { const N = oe(k); return n().some((w) => oe(w.ref) === N); - }, u = (k) => l(k) && o.canDelete(k), d = (k) => l(k) && o.canUpdate(k), f = async (k) => { + }, u = (k) => l(k) && o.canDelete(k), f = (k) => l(k) && o.canUpdate(k), d = async (k) => { e.assertAllowed("annotations:create", "redaction.markSelection"); const N = s(); - if (!N) throw new re("unsupported", "redaction", "no selection plugin"); + if (!N) throw new te("unsupported", "redaction", "no selection plugin"); if (!N.hasSelection()) return { marks: [] }; const { annotations: w } = await o.createFromSelection("redact", { clear: !0, @@ -45806,7 +45837,7 @@ function ike(e, { siblings: t }, { listPending: n, markFor: r }) { }, m = async (k, N) => { e.assertAllowed("annotations:create", "redaction.markMatches"); const w = N?.signal, y = i(); - if (!y) throw new re("unsupported", "redaction", "no search plugin"); + if (!y) throw new te("unsupported", "redaction", "no search plugin"); const x = N?.pages ? new Set(N.pages.map((b) => e.pageOf(b).ref.objectNumber)) : null; await y.search(k, { signal: w }); const A = []; @@ -45829,7 +45860,7 @@ function ike(e, { siblings: t }, { listPending: n, markFor: r }) { continue; } if (!o.canDelete(b)) { - const E = new re( + const E = new te( "permission-denied", "redaction", "redaction.unmark requires annotations:delete", @@ -45841,7 +45872,7 @@ function ike(e, { siblings: t }, { listPending: n, markFor: r }) { try { await o.delete(b, { signal: w }), y.push(b); } catch (E) { - const I = qe("redaction", E); + const I = ze("redaction", E); if (I.code === "operation-cancelled") throw I; A.push({ ref: b, error: Br(I) }); } @@ -45851,8 +45882,8 @@ function ike(e, { siblings: t }, { listPending: n, markFor: r }) { return { api: { canUnmark: u, - canUpdateLabel: d, - markSelection: f, + canUpdateLabel: f, + markSelection: d, markArea: g, markPage: p, markMatches: m, @@ -45864,9 +45895,9 @@ function ike(e, { siblings: t }, { listPending: n, markFor: r }) { updateLabel: async (k, N, w) => { const y = o.get(k); if (!y || y.subtype !== "redact") - throw new re("not-found", "redaction", "the target is not a redaction mark"); + throw new te("not-found", "redaction", "the target is not a redaction mark"); if (!o.canUpdate(k)) - throw new re( + throw new te( "permission-denied", "redaction", "redaction.updateLabel requires annotations:update", @@ -45889,7 +45920,7 @@ function ike(e, { siblings: t }, { listPending: n, markFor: r }) { ); return { mark: c(x.annotation) }; } catch (x) { - throw qe("redaction", x); + throw ze("redaction", x); } } } @@ -45898,7 +45929,7 @@ function ike(e, { siblings: t }, { listPending: n, markFor: r }) { function ake(e) { const t = Q1e(e), { events: n, store: r } = t, o = e.settings(), s = W1e(e, t), i = ike(e, t, s), a = ske(e, t, s); return { - api: tu("redaction", [ + api: nu("redaction", [ o.api, s.api, i.api, @@ -45928,7 +45959,7 @@ const cke = (e) => ({ state: X1e, settings: { defaults: H1e, registered: e }, create: ake -}), Ss = sn("form", { +}), Ss = an("form", { hint: "add formPlugin() from '@embedpdf/plugin-form' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -45982,7 +46013,7 @@ const cke = (e) => ({ }, fillable: !0, tools: [] -}, C5 = "form-design", s8 = ["form-place", "annotation-edit", C5], fc = { +}, C5 = "form-design", s8 = ["form-place", "annotation-edit", C5], hc = { interiorColor: "#ffffff", color: "#6b7280", strokeWidth: 1 @@ -45996,7 +46027,7 @@ const cke = (e) => ({ visualKind: "widget-text", clickCreate: { width: 160, height: 24 }, upright: !0, - defaults: { ...fc, fontSize: 12 }, + defaults: { ...hc, fontSize: 12 }, cursor: "crosshair" }, { @@ -46005,7 +46036,7 @@ const cke = (e) => ({ visualKind: "widget-toggle", clickCreate: { width: 18, height: 18 }, upright: !0, - defaults: fc, + defaults: hc, cursor: "crosshair" }, { @@ -46015,7 +46046,7 @@ const cke = (e) => ({ visualKind: "widget-radio", clickCreate: { width: 18, height: 18 }, upright: !0, - defaults: fc, + defaults: hc, cursor: "crosshair" }, { @@ -46024,7 +46055,7 @@ const cke = (e) => ({ visualKind: "widget-choice", clickCreate: { width: 140, height: 24 }, upright: !0, - defaults: { ...fc, fontSize: 12 }, + defaults: { ...hc, fontSize: 12 }, cursor: "crosshair" }, { @@ -46033,7 +46064,7 @@ const cke = (e) => ({ visualKind: "widget-choice", clickCreate: { width: 140, height: 72 }, upright: !0, - defaults: { ...fc, fontSize: 12 }, + defaults: { ...hc, fontSize: 12 }, cursor: "crosshair" }, // A push button: its caption is its text; what it does is its actions. @@ -46043,7 +46074,7 @@ const cke = (e) => ({ visualKind: "widget-button", clickCreate: { width: 100, height: 28 }, upright: !0, - defaults: { ...fc, interiorColor: "#e5e7eb", fontSize: 12 }, + defaults: { ...hc, interiorColor: "#e5e7eb", fontSize: 12 }, cursor: "crosshair" }, // A signature field: the bare widget box every non-text kind ingests @@ -46056,7 +46087,7 @@ const cke = (e) => ({ visualKind: "widget-box", clickCreate: { width: 160, height: 48 }, upright: !0, - defaults: fc, + defaults: hc, cursor: "crosshair", field: { purpose: "signature" } }, @@ -46069,7 +46100,7 @@ const cke = (e) => ({ visualKind: "widget-button", clickCreate: { width: 120, height: 90 }, upright: !0, - defaults: { ...fc, layout: "image" }, + defaults: { ...hc, layout: "image" }, cursor: "crosshair", field: { takesImage: !0 } }, @@ -46181,8 +46212,8 @@ function pke(e, t) { return o.width < 1 || o.height < 1 ? null : o; } function gke(e, t) { - const { box: n, rotation: r } = Qme(e), o = r ?? 0, s = pke(fm(n, o), t); - return s ? { box: fm(s, o), ...o ? { rotation: o } : {} } : null; + const { box: n, rotation: r } = Qme(e), o = r ?? 0, s = pke(hm(n, o), t); + return s ? { box: hm(s, o), ...o ? { rotation: o } : {} } : null; } function Wz(e, t, n, r = F2) { const o = { ...mke(e, t, n), ...e.field }; @@ -46223,8 +46254,8 @@ function yke(e, t, n, r = uke) { return !l || !e.canDesign() || e.getDesignAssignment().kind === "anyone" && !qz(l) ? null : l; }, a = () => { o = null, n?.clearPlacementPreview(), n?.clearGhost(); - }, c = async (l, u, d) => { - const f = e.getPageBox(u), h = f ? gke(d, f) : null; + }, c = async (l, u, f) => { + const d = e.getPageBox(u), h = d ? gke(f, d) : null; if (!h) return; const g = zz(l, n), p = hke(l.fieldKind, new Set(e.list().map((k) => k.name))), m = e.create( Wz(l, p, { page: u, ...h, ...g }, e.getDesignAssignment()) @@ -46273,14 +46304,14 @@ function yke(e, t, n, r = uke) { if (!o) return; const u = o; a(); - const d = r.get(t.getActiveToolId()); - if (!d) return; - const f = T0(l, u.page) ?? u.last, h = B2("box", u.start, f, d.clickCreate, { + const f = r.get(t.getActiveToolId()); + if (!f) return; + const d = T0(l, u.page) ?? u.last, h = B2("box", u.start, d, f.clickCreate, { pageBox: e.getPageBox(u.page) ?? void 0, - upright: s(d), + upright: s(f), displayRotation: u.displayRotation }); - h?.kind === "box" && c(d, u.page, h).catch((g) => { + h?.kind === "box" && c(f, u.page, h).catch((g) => { globalThis.console?.error("[form] placing the field failed:", g); }); }, @@ -46324,7 +46355,7 @@ function bke(e, t, n, r) { e.cleanup( o.registerHandler(yke(t, o, s, r)) ), s && e.allows("doc.forms.modify") && e.cleanup(s.lend(n)); - const i = e.tryGet(Dm); + const i = e.tryGet(jm); i && (e.cleanup(i.registerFormCommitSink((a) => t.commitScriptFormEffects(a))), e.cleanup(i.registerFormReader(() => t.getSnapshot())), e.cleanup(i.registerFormFocus((a) => t.focus(PY(a)))), e.cleanup( i.registerSubmitResolver( (a, c, l) => t.resolveSubmitDataset(a, c, l) @@ -46392,7 +46423,7 @@ function N5(e, t) { case "signature": return e.valueEntry.kind === "none" && !t; case "pushbutton": - return au(e) && !e.hasImage; + return cu(e) && !e.hasImage; default: return !1; } @@ -46403,7 +46434,7 @@ function Ake(e, { fields: t, rights: n, siblings: r }) { if (!p) return o(); const m = p.page === void 0 ? void 0 : e.getPage(p.page)?.ref; return p.page !== void 0 && !m ? i8 : o().filter( - (v) => (!p.kind || v.kind === p.kind) && (p.name === void 0 || v.name === p.name) && (!m || v.widgets.some((S) => S.page && Vf(S.page, m))) + (v) => (!p.kind || v.kind === p.kind) && (p.name === void 0 || v.name === p.name) && (!m || v.widgets.some((S) => S.page && Uf(S.page, m))) ); }, i = Mn( (p) => { @@ -46434,21 +46465,21 @@ function Ake(e, { fields: t, rights: n, siblings: r }) { return [v ? e.getPage(v.page)?.index ?? 1 / 0 : 1 / 0, v?.rect.y ?? 0, v?.rect.x ?? 0]; }, u = (p) => p.map((m) => ({ field: m, place: l(m) })).sort( (m, v) => m.place[0] - v.place[0] || m.place[1] - v.place[1] || m.place[2] - v.place[2] - ).map(({ field: m }) => m), d = (p) => { + ).map(({ field: m }) => m), f = (p) => { const m = u( (p.snapshot?.fields ?? []).filter( (S) => Dz(S) && n.mayFillOrSign(S) ) ), v = m.filter((S) => $2(p, S)); return { valid: v.length === 0, missing: v, required: m }; - }, f = tt(() => [t.view(), e.document(), n.key()], d), h = tt( + }, d = tt(() => [t.view(), e.document(), n.key()], f), h = tt( () => [t.view(), r.annotation()?.selection.getSelected() ?? a8], (p, m) => { let v = null; for (const S of m) { if (!S.subtype.startsWith("widget")) return null; const C = wn(p, yn(S.ref)); - if (!C || v && Ft(v) !== Ft(C)) return null; + if (!C || v && Kt(v) !== Kt(C)) return null; v = C; } return v; @@ -46460,7 +46491,7 @@ function Ake(e, { fields: t, rights: n, siblings: r }) { for (const S of m) { if (!S.subtype.startsWith("widget")) continue; const C = wn(p, yn(S.ref)); - C && !v.has(Ft(C)) && v.set(Ft(C), C); + C && !v.has(Kt(C)) && v.set(Kt(C), C); } return v.size === 0 ? wke : Object.freeze([...v.values()]); } @@ -46469,7 +46500,7 @@ function Ake(e, { fields: t, rights: n, siblings: r }) { /** Fields in page order, for the reads that list some (read/value-checks.ts). */ inPageOrder: u, /** The required-field check of one form, for a check that answers of that form alone. */ - validationOf: d, + validationOf: f, api: { getSnapshot: () => t.view().snapshot, getStatus: t.getStatus, @@ -46483,26 +46514,26 @@ function Ake(e, { fields: t, rights: n, siblings: r }) { getValue: (p) => i(YS(t.view(), p)), getSelectedField: h, listSelectedFields: g, - validate: f, + validate: d, exportValues: c } }; } -const Ske = (e, t) => t === "" ? e : `${e}: ${t}`, c8 = (e, t) => t === null ? e : `${e}, ${t}`, Gz = (e) => e.kind === "text" || e.kind === "combobox" || e.kind === "signature" || au(e); +const Ske = (e, t) => t === "" ? e : `${e}: ${t}`, c8 = (e, t) => t === null ? e : `${e}, ${t}`, Gz = (e) => e.kind === "text" || e.kind === "combobox" || e.kind === "signature" || cu(e); function Jz(e, t, n) { const r = e.placeholder ?? t; return r === null || !N5(e, n) ? null : Gz(e) ? r : null; } function Yz(e, t) { - return e.kind === "signature" || au(e) ? "center" : t; + return e.kind === "signature" || cu(e) ? "center" : t; } -const Qz = (e) => (e.kind !== "pushbutton" || au(e)) && !e.readOnly && !(e.kind === "signature" && e.valueEntry.kind !== "none"), xke = Object.freeze({}); +const Qz = (e) => (e.kind !== "pushbutton" || cu(e)) && !e.readOnly && !(e.kind === "signature" && e.valueEntry.kind !== "none"), xke = Object.freeze({}); function Eke(e, t, n, r, o, s = xke) { - const i = Ft(e), a = s.owner ?? null, c = s.inGroup ?? null, l = s.marked ?? n.hasMark, u = r && Qz(e), d = { + const i = Kt(e), a = s.owner ?? null, c = s.inGroup ?? null, l = s.marked ?? n.hasMark, u = r && Qz(e), f = { key: i, fieldRef: e.ref, annotObjectNumber: t, - annotationRef: e.widgets.find((f) => f.objectNumber === t)?.ref ?? null, + annotationRef: e.widgets.find((d) => d.objectNumber === t)?.ref ?? null, ref: n.ref, groupId: e.groupId, assignment: e.assignment, @@ -46526,7 +46557,7 @@ function Eke(e, t, n, r, o, s = xke) { switch (e.kind) { case "text": return { - ...d, + ...f, control: "text", value: e.value, multiline: e.multiline, @@ -46535,34 +46566,34 @@ function Eke(e, t, n, r, o, s = xke) { comb: e.comb }; case "checkbox": { - const f = e.widgets.find( + const d = e.widgets.find( (h) => h.objectNumber === t ); return { - ...d, + ...f, control: "toggle", kind: "checkbox", checked: e.checked, - exportValue: f && "exportValue" in f ? f.exportValue : e.exportValue + exportValue: d && "exportValue" in d ? d.exportValue : e.exportValue }; } case "radio": { - const f = e.widgets.find( + const d = e.widgets.find( (g) => g.objectNumber === t - ), h = f && "exportValue" in f ? f.exportValue : ""; + ), h = d && "exportValue" in d ? d.exportValue : ""; return { - ...d, + ...f, label: c8(Ske(e.alternateName ?? e.name, h), a), control: "toggle", kind: "radio", - checked: f && "checked" in f ? f.checked : !1, + checked: d && "checked" in d ? d.checked : !1, exportValue: h, inGroup: c }; } case "combobox": return { - ...d, + ...f, control: "choice", kind: "combo", edit: e.edit, @@ -46572,7 +46603,7 @@ function Eke(e, t, n, r, o, s = xke) { }; case "listbox": return { - ...d, + ...f, control: "choice", kind: "list", edit: !1, @@ -46581,9 +46612,9 @@ function Eke(e, t, n, r, o, s = xke) { selected: e.selectedValues }; case "pushbutton": - return au(e) ? { ...d, control: "image", hasImage: e.hasImage } : { ...d, control: "button" }; + return cu(e) ? { ...f, control: "image", hasImage: e.hasImage } : { ...f, control: "button" }; case "signature": - return { ...d, control: "signature", signed: e.valueEntry.kind !== "none" }; + return { ...f, control: "signature", signed: e.valueEntry.kind !== "none" }; default: return null; } @@ -46815,7 +46846,7 @@ function Fke({ } function $a(e) { if (e?.signal?.aborted) - throw new re("operation-cancelled", "form", "operation cancelled", { + throw new te("operation-cancelled", "form", "operation cancelled", { cause: e.signal.reason }); } @@ -46857,18 +46888,18 @@ function Kke(e, { }, s) { const i = async () => { if (t.getStatus() !== "ready" && (await t.settled(), t.getStatus() !== "ready" && (await t.ensureLoaded(), t.getStatus() !== "ready"))) - throw e.assertAllowed("doc.forms.read", $ke), new re("not-ready", "form", "the form has not been read"); - }, a = (f) => s.inPageOrder( - (f.snapshot?.fields ?? []).filter( - (h) => n.mayFill(h) && !S5(h) && !$2(f, h) + throw e.assertAllowed("doc.forms.read", $ke), new te("not-ready", "form", "the form has not been read"); + }, a = (d) => s.inPageOrder( + (d.snapshot?.fields ?? []).filter( + (h) => n.mayFill(h) && !S5(h) && !$2(d, h) ) - ), c = (f) => { - const h = I5(f), g = h ? gO(f, h, e.clock.today()) : null; - return g?.status === "rejected" ? { field: f, message: g.message } : null; - }, l = async (f, h) => { - const g = f.snapshot; + ), c = (d) => { + const h = I5(d), g = h ? gO(d, h, e.clock.today()) : null; + return g?.status === "rejected" ? { field: d, message: g.message } : null; + }, l = async (d, h) => { + const g = d.snapshot; if (!g) return []; - const p = a(f), m = r.checker(f); + const p = a(d), m = r.checker(d); if (!m) return p.flatMap((C) => { const k = c(C); @@ -46885,7 +46916,7 @@ function Kke(e, { $a(h); const N = await C.check(g, k.ref); if (N.status === "failed") - throw new re( + throw new te( "operation-failed", "form", N.error?.message ?? `the rules of field '${k.name}' could not be run` @@ -46895,28 +46926,28 @@ function Kke(e, { }), p.flatMap((C) => v.get(C) ?? []); }; return { - api: { validateValues: async (f) => { - $a(f); + api: { validateValues: async (d) => { + $a(d); try { - return t.view().snapshot || await e.cancellable(f?.signal, t.settled()), await e.cancellable( - f?.signal, + return t.view().snapshot || await e.cancellable(d?.signal, t.settled()), await e.cancellable( + d?.signal, o(async () => { await i(); - const h = t.view(), g = s.validationOf(h), p = await l(h, f); + const h = t.view(), g = s.validationOf(h), p = await l(h, d); return { ...g, valid: g.valid && p.length === 0, invalid: p }; - }, f) + }, d) ); } catch (h) { - throw qe("form", h); + throw ze("form", h); } } }, - host: { validateConfirmed: async (f) => { - $a(f); + host: { validateConfirmed: async (d) => { + $a(d); try { - const h = await e.cancellable(f?.signal, e.doc.forms.list()), g = Rz(Pz(), h), p = s.validationOf(g), m = await l(g, f); + const h = await e.cancellable(d?.signal, e.doc.forms.list()), g = Rz(Pz(), h), p = s.validationOf(g), m = await l(g, d); return { ...p, valid: p.valid && m.length === 0, invalid: m, snapshot: h }; } catch (h) { - throw qe("form", h); + throw ze("form", h); } } } }; @@ -46934,19 +46965,19 @@ function Wke(e, { groups: l, purposes: u }) { - const d = (C) => t.settled(), f = Mn( + const f = (C) => t.settled(), d = Mn( (C) => [t.view()], (C, k) => Wve(k, C) ), h = (C, k) => { const N = e.getPage(C)?.ref; - return N ? Yve(t.view(), f(N.objectNumber), k) : null; + return N ? Yve(t.view(), d(N.objectNumber), k) : null; }, g = (C) => { - const k = i.annotation()?.getImageGhost(Lt(C))?.into; + const k = i.annotation()?.getImageGhost(Ft(C))?.into; return k ? yn(k) : null; }, p = Mn( (C) => [ t.view(), - f(C), + d(C), g(C), n.key(), e.settings().get().fillable, @@ -46995,7 +47026,7 @@ function Wke(e, { getWidgetPainting: r.getWidgetPainting, getTextEditorLayout: r.getTextEditorLayout, getWidgetFontCss: r.getWidgetFontCss, - ensureLoaded: d, + ensureLoaded: f, getWidgetAt: h, getPageBox: m, getWidgetAnchor: S, @@ -47014,9 +47045,9 @@ const s0 = (e, t) => ({ field: t, widgets: U2(e, t) }); -function Md(e, t) { - return t.length === 0 ? e : fo( - uo( +function _d(e, t) { + return t.length === 0 ? e : ho( + fo( e, t.map((n) => n.field) ), @@ -47037,30 +47068,30 @@ function Gke(e, t) { switch (t.type) { case "forms.setValue": { const n = yt(e, t.field); - return n ? Md(e, [P7(s0(e, n), t.value)]) : e; + return n ? _d(e, [P7(s0(e, n), t.value)]) : e; } case "forms.reset": { const n = t.fields ? t.fields.flatMap((r) => yt(e, r) ?? []) : tW(e); - return Md( + return _d( e, n.map((r) => FZ(s0(e, r))) ); } case "forms.setDisplay": { const n = yt(e, t.field); - return n ? fo(e, VZ(U2(e, n), t.display)) : e; + return n ? ho(e, VZ(U2(e, n), t.display)) : e; } // The engine predicts no image; the field holds one, or none, as the op says. The picture // shows once the engine has drawn it. case "forms.setButtonImage": { const n = yt(e, t.field); - return n?.kind === "pushbutton" ? uo(e, [{ ...n, hasImage: t.image !== null }]) : e; + return n?.kind === "pushbutton" ? fo(e, [{ ...n, hasImage: t.image !== null }]) : e; } case "forms.restore": - return Md(e, [t]); + return _d(e, [t]); case "forms.restoreWidget": { - const n = fo(e, [t.widget]); - return t.field ? uo(n, [t.field]) : n; + const n = ho(e, [t.widget]); + return t.field ? fo(n, [t.field]) : n; } case "forms.create": return nW(e, t); @@ -47074,13 +47105,13 @@ function Gke(e, t) { return e; case "forms.update": { const n = yt(e, t.field); - return n ? Md(e, [UZ(s0(e, n), t.patch)]) : e; + return n ? _d(e, [UZ(s0(e, n), t.patch)]) : e; } case "forms.delete": { const n = yt(e, t.field); if (!n || !e.snapshot) return e; - const r = wm(Mz(e, n.ref), n.widgets); - return Rd( + const r = vm(Mz(e, n.ref), n.widgets); + return Md( r, e.snapshot.calculationOrder.filter((o) => !Jke(o, n.ref)) ); @@ -47088,17 +47119,17 @@ function Gke(e, t) { case "forms.updateWidget": { const n = ZS(e, t.widget); return n ? QS( - fo(e, [N7(n, t.patch)]), + ho(e, [N7(n, t.patch)]), wn(e, mO(n)) ) : e; } case "forms.deleteWidget": { const n = ZS(e, t.widget); if (!n) return e; - const r = mO(n), o = wn(e, r), s = wm(e, [{ objectNumber: r, page: n.page }]); + const r = mO(n), o = wn(e, r), s = vm(e, [{ objectNumber: r, page: n.page }]); if (!o) return s; const i = o.widgets.filter((a) => a.objectNumber !== r); - return QS(uo(s, [{ ...o, widgets: i }]), o); + return QS(fo(s, [{ ...o, widgets: i }]), o); } case "forms.reorderWidgets": { if (!e.snapshot) return e; @@ -47110,9 +47141,9 @@ function Gke(e, t) { const n = e.snapshot.calculationOrder.filter( (r) => r !== null ); - return Rd( + return Md( e, - iS(n, t.fields, t.position, bm) + iS(n, t.fields, t.position, wm) ); } default: @@ -47122,7 +47153,7 @@ function Gke(e, t) { return e; } } -const ZS = (e, t) => t.kind === "objectNumber" ? xn(e, t.objectNumber) : null, Jke = (e, t) => e !== null && bm(e) === bm(t); +const ZS = (e, t) => t.kind === "objectNumber" ? xn(e, t.objectNumber) : null, Jke = (e, t) => e !== null && wm(e) === wm(t); function nW(e, t) { const n = t.draft.widgets ?? [], r = t.widgetObjectNumbers ?? []; if (t.objectNumber === void 0 || r.length !== n.length) return e; @@ -47136,8 +47167,8 @@ function nW(e, t) { page: c.page, objectNumber: r[l] })) - }), i = o.formKind === "none" ? k5({ ...o, formKind: "acroform" }, e.pictureVersions) : e, a = Md(i, [s]); - return t.draft.actions?.calculate ? Rd(a, [...o.calculationOrder, s.field.ref]) : a; + }), i = o.formKind === "none" ? k5({ ...o, formKind: "acroform" }, e.pictureVersions) : e, a = _d(i, [s]); + return t.draft.actions?.calculate ? Md(a, [...o.calculationOrder, s.field.ref]) : a; } function rW(e, t) { const { snapshot: n } = e; @@ -47180,10 +47211,10 @@ function Yke(e, t) { widgetObjectNumbers: r.widgetObjectNumbers }); const s = yt(n, o); - s && (n = fo( + s && (n = ho( n, U2(n, s).map((i, a) => N7(i, r.flags[a] ?? {})) - ), r.value && (n = Md(n, [P7(s0(n, s), r.value)]))); + ), r.value && (n = _d(n, [P7(s0(n, s), r.value)]))); } return n; } @@ -47191,7 +47222,7 @@ function Qke(e, t) { if (t.objectNumber === void 0 || t.splitObjectNumber !== void 0) return e; const n = yt(e, t.field); if (!n || n.kind === "unknown" || n.ref.kind !== "objectNumber" || xn(e, t.objectNumber)) return e; - const r = "options" in n ? { options: n.options.map(({ label: c, value: l }) => ({ label: c, value: l })) } : {}, o = au(n) ? { ...t.placement, actions: y7(t.placement.actions) } : t.placement, s = f6( + const r = "options" in n ? { options: n.options.map(({ label: c, value: l }) => ({ label: c, value: l })) } : {}, o = cu(n) ? { ...t.placement, actions: y7(t.placement.actions) } : t.placement, s = f6( { kind: n.kind, name: n.name, ...r, widgets: [o] }, { objectNumber: n.ref.objectNumber, @@ -47199,8 +47230,8 @@ function Qke(e, t) { } ), [i] = s.field.widgets, [a] = s.widgets; return !i || !a ? e : QS( - fo( - uo(e, [{ ...n, widgets: [...n.widgets, i] }]), + ho( + fo(e, [{ ...n, widgets: [...n.widgets, i] }]), [a] ), n @@ -47208,7 +47239,7 @@ function Qke(e, t) { } function Wy(e, t) { const n = /* @__PURE__ */ new Map(), r = (o) => { - o && !n.has(Ft(o)) && n.set(Ft(o), o); + o && !n.has(Kt(o)) && n.set(Kt(o), o); }; for (const o of t) switch (o.type) { @@ -47226,10 +47257,10 @@ function Wy(e, t) { return [...n.values()]; } function Xke(e, t, n) { - return Md( + return _d( e, n.flatMap((r) => { - const o = Ya(t, Ft(r)); + const o = Ya(t, Kt(r)); return o ? [s0(t, o)] : []; }) ); @@ -47301,7 +47332,7 @@ function Zke(e, t) { return Wy(e, [t]).map((n) => _C(e, n)); } } -function kl(e, t) { +function Al(e, t) { const n = []; let r = e; for (const o of t) @@ -47355,48 +47386,48 @@ const tAe = 2e3, oW = (e) => e.takesCursor?.() ?? !0, LC = (e, t) => oW(e) && e. function nAe(e, t, n) { const r = /* @__PURE__ */ new Map(); let o = null, s = null, i = null; - const a = (d) => { - const f = e.state.get().focused; - if (f?.widget === d?.widget && f?.field === d?.field) return; - e.state.update((p) => ({ ...p, focused: d })); - const h = d ? Ya(t.view(), d.field) : null, g = d ? xn(t.view(), d.widget) : null; + const a = (f) => { + const d = e.state.get().focused; + if (d?.widget === f?.widget && d?.field === f?.field) return; + e.state.update((p) => ({ ...p, focused: f })); + const h = f ? Ya(t.view(), f.field) : null, g = f ? xn(t.view(), f.widget) : null; n.focusChanged.emit({ field: h, widget: g?.ref ?? null }); }, c = () => { o?.expire(), o?.settle?.(), o = null; - }, l = (d) => { - d.settle ?? (d.settle = e.clock.after(0, () => { - if (d.settle = null, o !== d) return; - const f = r.get(d.widget); - f && (c(), LC(f, d.select) || d.onward?.()); + }, l = (f) => { + f.settle ?? (f.settle = e.clock.after(0, () => { + if (f.settle = null, o !== f) return; + const d = r.get(f.widget); + d && (c(), LC(d, f.select) || f.onward?.()); })); - }, u = (d, f) => { - LC(f, d.select) ? o === d && c() : l(d); + }, u = (f, d) => { + LC(d, f.select) ? o === f && c() : l(f); }; return { focused: () => e.state.get().focused, last: () => i, - note(d, f, h) { + note(f, d, h) { const g = yn(h); - if (d === "focus") { + if (f === "focus") { s?.(), s = null, o && o.widget !== g && c(); - const p = yt(t.view(), f); - i = g, a(p ? { field: Ft(p), widget: g } : null); + const p = yt(t.view(), d); + i = g, a(p ? { field: Kt(p), widget: g } : null); } else e.state.get().focused?.widget === g && (s?.(), s = e.clock.after(0, () => { s = null, a(null); })); }, - goTo(d, f, h) { - const g = yn(d.ref), p = r.get(g); + goTo(f, d, h) { + const g = yn(f.ref), p = r.get(g); if (p && !oW(p)) return "declined"; - const m = e.tryGet(Zt); - m?.reveal(d.page, { rect: d.rect }), c(); + const m = e.tryGet(tn); + m?.reveal(f.page, { rect: f.rect }), c(); const v = r.get(g); - if (v && LC(v, f)) return "taken"; + if (v && LC(v, d)) return "taken"; if (v && v === p) return "declined"; if (!m) return "unreachable"; const S = { widget: g, - select: f, + select: d, onward: h ?? null, expire: e.clock.after(tAe, () => { o === S && c(); @@ -47405,10 +47436,10 @@ function nAe(e, t, n) { }; return o = S, v && l(S), "taken"; }, - attach(d, f) { - const h = yn(d); - return r.set(h, f), o?.widget === h && u(o, f), () => { - r.get(h) === f && r.delete(h); + attach(f, d) { + const h = yn(f); + return r.set(h, d), o?.widget === h && u(o, d), () => { + r.get(h) === d && r.delete(h); }; } }; @@ -47434,7 +47465,7 @@ function oAe(e) { }; return e.state.onChange(({ previous: n, next: r }) => { n.designAssignment !== r.designAssignment && t.designGroupChanged.emit({ - groupId: nm(r.designAssignment), + groupId: rm(r.designAssignment), assignment: r.designAssignment }); }), t; @@ -47473,14 +47504,14 @@ function cAe(e, t) { if (i.type !== "forms.setAppearanceText") continue; const a = yt(s, i.field), c = a ? f8(a) : null; if (!a || c === null) continue; - const l = Ft(a), u = n.get(l) ?? /* @__PURE__ */ new Map(); + const l = Kt(a), u = n.get(l) ?? /* @__PURE__ */ new Map(); for (u.delete(c), u.set(c, i.text); u.size > aAe; ) u.delete(u.keys().next().value); n.set(l, u), r += 1; } }), { textOf(o) { const s = f8(o); - return s === null ? null : n.get(Ft(o))?.get(s) ?? null; + return s === null ? null : n.get(Kt(o))?.get(s) ?? null; }, version: () => r }; @@ -47495,16 +47526,16 @@ const h8 = Object.freeze([ "#ca8a04", "#65a30d" ]), V1 = "doc.forms.modify", p8 = "Anyone", lAe = "form.fields.tintColor", uAe = "form.fields.anyoneTintColor", dAe = /* @__PURE__ */ new Map(); -function Hd(e) { +function Wd(e) { try { return KF({ kind: "text", assignment: e ?? null }); } catch (t) { - throw qe("form", t); + throw ze("form", t); } } const fAe = (e) => { try { - return Hd(e), !0; + return Wd(e), !0; } catch { return !1; } @@ -47546,14 +47577,14 @@ function hAe(e, t, n) { ), a = tt( () => [e.settings().get().fields.anyoneTintColor, e.settings().get().fields.tint], (h, g) => h !== null && g > 0 ? Object.freeze({ color: h, strength: g, setting: uAe }) : null - ), c = e.tryGet(vo), l = tt( + ), c = e.tryGet(ko), l = tt( () => [c?.getTranslator() ?? null], (h) => h?.("form.anyone", { fallback: p8 }) ?? p8 ); e.state.onChange(({ previous: h, next: g }) => { h.groups !== g.groups && n.groupsChanged.emit({ groups: o() }); }); - const u = (h) => e.doc.security.allowsField("set-group", { groupId: h }), d = () => e.doc.security.fieldRights().setGroup.all, f = (h, g) => new re("permission-denied", "form", `${h} requires ${g}`, { + const u = (h) => e.doc.security.allowsField("set-group", { groupId: h }), f = () => e.doc.security.fieldRights().setGroup.all, d = (h, g) => new te("permission-denied", "form", `${h} requires ${g}`, { permission: g }); return { @@ -47563,35 +47594,35 @@ function hAe(e, t, n) { anyoneLabel: l, maySet: (h) => e.allows(V1) && u(h), assertMaySet: (h, g) => { - if (e.assertAllowed(V1, g), !u(h)) throw f(g, `fields:set-group:group=${h}`); + if (e.assertAllowed(V1, g), !u(h)) throw d(g, `fields:set-group:group=${h}`); }, - mayAssign: (h) => fAe(h) && e.allows(V1) && (h.kind === "group" ? u(h.groupId) : h.kind === "anyone" ? d() : !0), + mayAssign: (h) => fAe(h) && e.allows(V1) && (h.kind === "group" ? u(h.groupId) : h.kind === "anyone" ? f() : !0), assertMayAssign: (h, g) => { e.assertAllowed(V1, g); - const p = Hd(h); + const p = Wd(h); if (p.kind === "group" && !u(p.groupId)) - throw f(g, `fields:set-group:group=${p.groupId}`); - if (p.kind === "anyone" && !d()) - throw f(g, "fields:set-group:all"); + throw d(g, `fields:set-group:group=${p.groupId}`); + if (p.kind === "anyone" && !f()) + throw d(g, "fields:set-group:all"); } }; } -const lt = Math.fround, pAe = [3]; -function yo(e, t, n = t) { +const ut = Math.fround, pAe = [3]; +function bo(e, t, n = t) { const r = Math.min(e.left, e.right), o = Math.max(e.left, e.right), s = Math.min(e.bottom, e.top), i = Math.max(e.bottom, e.top); - return { left: lt(r + t), bottom: lt(s + n), right: lt(o - t), top: lt(i - n) }; + return { left: ut(r + t), bottom: ut(s + n), right: ut(o - t), top: ut(i - n) }; } const ys = (e) => ({ op: "rect", x: e.left, y: e.bottom, - width: lt(e.right - e.left), - height: lt(e.top - e.bottom) -}), kg = (e) => [ + width: ut(e.right - e.left), + height: ut(e.top - e.bottom) +}), Ag = (e) => [ parseInt(e.slice(1, 3), 16) / 255, parseInt(e.slice(3, 5), 16) / 255, parseInt(e.slice(5, 7), 16) / 255 -], Lf = [0, 0, 0]; +], jf = [0, 0, 0]; function sW(e) { const t = e.borderStyle ?? "solid", n = e.strokeWidth ?? 1; return { @@ -47603,13 +47634,13 @@ function sW(e) { function P5(e, t, n) { const r = t.width; if (r <= 0) return []; - const { left: o, bottom: s, right: i, top: a } = e, c = lt(r / 2), l = (d, f) => ({ x: d, y: f }), u = (d) => d.map((f, h) => ({ op: h === 0 ? "move" : "line", x: f.x, y: f.y })); + const { left: o, bottom: s, right: i, top: a } = e, c = ut(r / 2), l = (f, d) => ({ x: f, y: d }), u = (f) => f.map((d, h) => ({ op: h === 0 ? "move" : "line", x: d.x, y: d.y })); switch (t.style) { case "solid": return n ? [ { kind: "fill", - path: [ys(e), ys(yo(e, r))], + path: [ys(e), ys(bo(e, r))], color: n, evenOdd: !0 } @@ -47619,11 +47650,11 @@ function P5(e, t, n) { { kind: "stroke", path: u([ - l(lt(o + c), lt(s + c)), - l(lt(o + c), lt(a - c)), - l(lt(i - c), lt(a - c)), - l(lt(i - c), lt(s + c)), - l(lt(o + c), lt(s + c)) + l(ut(o + c), ut(s + c)), + l(ut(o + c), ut(a - c)), + l(ut(i - c), ut(a - c)), + l(ut(i - c), ut(s + c)), + l(ut(o + c), ut(s + c)) ]), color: n, width: r, @@ -47632,32 +47663,32 @@ function P5(e, t, n) { ] : []; case "beveled": case "inset": { - const d = t.style === "beveled", f = d ? 1 : 0.5, h = d ? 0.5 : 0.75, g = [ + const f = t.style === "beveled", d = f ? 1 : 0.5, h = f ? 0.5 : 0.75, g = [ { kind: "fill", path: [ ...u([ - l(lt(o + c), lt(s + c)), - l(lt(o + c), lt(a - c)), - l(lt(i - c), lt(a - c)), - l(lt(i - r), lt(a - r)), - l(lt(o + r), lt(a - r)), - l(lt(o + r), lt(s + r)) + l(ut(o + c), ut(s + c)), + l(ut(o + c), ut(a - c)), + l(ut(i - c), ut(a - c)), + l(ut(i - r), ut(a - r)), + l(ut(o + r), ut(a - r)), + l(ut(o + r), ut(s + r)) ]) ], - color: [f, f, f], + color: [d, d, d], evenOdd: !1 }, { kind: "fill", path: [ ...u([ - l(lt(i - c), lt(a - c)), - l(lt(i - c), lt(s + c)), - l(lt(o + c), lt(s + c)), - l(lt(o + r), lt(s + r)), - l(lt(i - r), lt(s + r)), - l(lt(i - r), lt(a - r)) + l(ut(i - c), ut(a - c)), + l(ut(i - c), ut(s + c)), + l(ut(o + c), ut(s + c)), + l(ut(o + r), ut(s + r)), + l(ut(i - r), ut(s + r)), + l(ut(i - r), ut(a - r)) ]) ], color: [h, h, h], @@ -47666,7 +47697,7 @@ function P5(e, t, n) { ]; return n && g.push({ kind: "fill", - path: [ys(e), ys(yo(e, c))], + path: [ys(e), ys(bo(e, c))], color: n, evenOdd: !0 }), g; @@ -47675,7 +47706,7 @@ function P5(e, t, n) { return n ? [ { kind: "stroke", - path: u([l(o, lt(s + c)), l(i, lt(s + c))]), + path: u([l(o, ut(s + c)), l(i, ut(s + c))]), color: n, width: r, dash: null @@ -47684,14 +47715,14 @@ function P5(e, t, n) { } } function R5(e, t, n, r) { - const o = t.width, s = o > 0 ? yo(e, lt(o / 2)) : e, i = []; + const o = t.width, s = o > 0 ? bo(e, ut(o / 2)) : e, i = []; return n && i.push({ kind: "fill", path: [ys(s)], color: n, evenOdd: !0 }), r && o > 0 && i.push({ kind: "stroke", path: [ys(s)], color: r, width: o, dash: null }), i; } function iW(e, t, n, r) { const o = t.width, s = []; return n && s.push({ kind: "fill", path: [ys(e)], color: n, evenOdd: !0 }), t.style !== "solid" ? s.push(...P5(e, t, r)) : r && o > 0 && s.push({ kind: "stroke", - path: [ys(yo(e, lt(o / 2)))], + path: [ys(bo(e, ut(o / 2)))], color: r, width: o, dash: null @@ -47716,7 +47747,7 @@ const Tn = Math.fround, T5 = (e) => e < 1e-4 && e > -1e-4, g8 = (e, t) => e > t runs: mAe(e) }), M5 = { multiline: !1, password: !1, limit: 0, cells: 0 }; function yO(e, t) { - const n = e.border.width, r = yo(e.bbox, Tn(2 * n), n), o = t.maxLength ?? 0, s = K2(e, t.value, { + const n = e.border.width, r = bo(e.bbox, Tn(2 * n), n), o = t.maxLength ?? 0, s = K2(e, t.value, { plate: r, alignment: e.alignment, multiline: t.multiline, @@ -47729,10 +47760,10 @@ function yO(e, t) { return { plate: r, laid: s }; } function yAe(e, t) { - const { bbox: n, border: r } = e, o = r.width, s = iW(n, r, e.background, e.borderColor), { laid: i } = yO(e, t), a = H0(i, e.textColor ?? Lf); + const { bbox: n, border: r } = e, o = r.width, s = iW(n, r, e.background, e.borderColor), { laid: i } = yO(e, t), a = H0(i, e.textColor ?? jf); return s.push({ kind: "clip", - rect: yo(n, o), + rect: bo(n, o), ops: B5(a) ? [a] : [] }), { ops: s, missing: i.missing }; } @@ -47740,23 +47771,23 @@ const B5 = (e) => e.kind === "text" && e.runs.length > 0; function bAe(e, t) { const { bbox: n, border: r } = e, o = []; e.background && o.push({ kind: "fill", path: [ys(n)], color: e.background, evenOdd: !1 }), o.push(...P5(n, r, e.borderColor)); - const s = yo(n, r.width, r.width), i = y8({ ...s, left: Tn(s.right - 13) }), a = yo(y8({ ...s, right: i.left }), 4, 0), c = K2(e, t.value, { + const s = bo(n, r.width, r.width), i = y8({ ...s, left: Tn(s.right - 13) }), a = bo(y8({ ...s, right: i.left }), 4, 0), c = K2(e, t.value, { ...M5, plate: a, alignment: 0, centered: !0 - }), l = H0(c, e.textColor ?? Lf); + }), l = H0(c, e.textColor ?? jf); if (B5(l) && o.push({ kind: "clip", rect: a, ops: [l] }), !AAe(i)) { - const u = Tn(Tn(i.left + i.right) / 2), d = Tn(Tn(i.top + i.bottom) / 2), f = Tn(i.right - i.left), h = Tn(i.top - i.bottom); - g8(f, 6) && g8(h, 6) && o.push({ + const u = Tn(Tn(i.left + i.right) / 2), f = Tn(Tn(i.top + i.bottom) / 2), d = Tn(i.right - i.left), h = Tn(i.top - i.bottom); + g8(d, 6) && g8(h, 6) && o.push({ kind: "fill", path: [ - { op: "move", x: Tn(u - 3), y: Tn(d + 1.5) }, - { op: "line", x: Tn(u + 3), y: Tn(d + 1.5) }, - { op: "line", x: u, y: Tn(d - 1.5) }, - { op: "line", x: Tn(u - 3), y: Tn(d + 1.5) } + { op: "move", x: Tn(u - 3), y: Tn(f + 1.5) }, + { op: "line", x: Tn(u + 3), y: Tn(f + 1.5) }, + { op: "line", x: u, y: Tn(f - 1.5) }, + { op: "line", x: Tn(u - 3), y: Tn(f + 1.5) } ], - color: Lf, + color: jf, evenOdd: !1 }); } @@ -47766,11 +47797,11 @@ const wAe = [0, 51 / 255, 113 / 255], m8 = [1, 1, 1]; function vAe(e, t) { const { bbox: n, border: r } = e, o = []; e.background && o.push({ kind: "fill", path: [ys(n)], color: e.background, evenOdd: !1 }), o.push(...P5(n, r, e.borderColor)); - const s = yo(n, r.width, r.width), i = [], a = /* @__PURE__ */ new Set(); - let c = s.top, l = Lf; + const s = bo(n, r.width, r.width), i = [], a = /* @__PURE__ */ new Set(); + let c = s.top, l = jf; const u = t.topIndex < 0 ? t.options.length : t.topIndex; - for (let d = u; d < t.options.length && !gAe(c, s.bottom); d += 1) { - const f = t.options[d], h = K2(e, f.label, { + for (let f = u; f < t.options.length && !gAe(c, s.bottom); f += 1) { + const d = t.options[f], h = K2(e, d.label, { ...M5, plate: { left: s.left, bottom: c, right: s.right, top: c }, fontSize: e.fontSize === 0 || T5(e.fontSize) ? 12 : e.fontSize, @@ -47779,7 +47810,7 @@ function vAe(e, t) { }); for (const p of h.missing) a.add(p); const g = h.contentHeight; - f.selected ? (i.push({ + d.selected ? (i.push({ kind: "fill", path: [ys({ left: s.left, bottom: Tn(c - g), right: s.right, top: c })], color: wAe, @@ -47791,8 +47822,8 @@ function vAe(e, t) { function kAe(e, t) { const { bbox: n, border: r } = e, o = R5(n, r, e.background, e.borderColor); if (!t) return { ops: o, missing: [] }; - const s = yo(n, Tn(2 * r.width), r.width), i = K2(e, t, { ...M5, plate: s, alignment: 1, centered: !0 }), a = H0(i, e.textColor ?? Lf); - return B5(a) && o.push({ kind: "clip", rect: yo(n, r.width), ops: [a] }), { ops: o, missing: i.missing }; + const s = bo(n, Tn(2 * r.width), r.width), i = K2(e, t, { ...M5, plate: s, alignment: 1, centered: !0 }), a = H0(i, e.textColor ?? jf); + return B5(a) && o.push({ kind: "clip", rect: bo(n, r.width), ops: [a] }), { ops: o, missing: i.missing }; } function y8(e) { return { @@ -47802,11 +47833,11 @@ function y8(e) { top: Math.max(e.bottom, e.top) }; } -const AAe = (e) => e.left >= e.right || e.bottom >= e.top, ve = Math.fround, Oo = ve(0.5522847498308), b8 = ve(0.5523); +const AAe = (e) => e.left >= e.right || e.bottom >= e.top, we = Math.fround, Po = we(0.5522847498308), b8 = we(0.5523); function SAe(e, t) { const n = R5(e.bbox, e.border, e.background, e.borderColor); if (!t) return n; - const r = e.checkStyle ?? "check", o = yo(e.bbox, e.border.width); + const r = e.checkStyle ?? "check", o = bo(e.bbox, e.border.width); return n.push(cW(e, r, aW(o, r, !1))), n; } function xAe(e, t) { @@ -47814,88 +47845,88 @@ function xAe(e, t) { if (n !== "circle") { const h = R5(e.bbox, e.border, e.background, e.borderColor); return t && h.push( - cW(e, n, aW(yo(e.bbox, e.border.width), n, !0)) + cW(e, n, aW(bo(e.bbox, e.border.width), n, !0)) ), h; } - const { bbox: r, border: o } = e, s = o.width, i = ve(s / 2), a = ve(ve(r.left + r.right) / 2), c = ve(ve(r.bottom + r.top) / 2), l = ve(ve(r.right - r.left) / 2), u = ve(ve(r.top - r.bottom) / 2), d = [], f = w8(a, c, ve(l - i), ve(u - i)); - return e.background && d.push({ kind: "fill", path: f, color: e.background, evenOdd: !0 }), e.borderColor && s > 0 && d.push({ kind: "stroke", path: f, color: e.borderColor, width: s, dash: null }), t && d.push({ + const { bbox: r, border: o } = e, s = o.width, i = we(s / 2), a = we(we(r.left + r.right) / 2), c = we(we(r.bottom + r.top) / 2), l = we(we(r.right - r.left) / 2), u = we(we(r.top - r.bottom) / 2), f = [], d = w8(a, c, we(l - i), we(u - i)); + return e.background && f.push({ kind: "fill", path: d, color: e.background, evenOdd: !0 }), e.borderColor && s > 0 && f.push({ kind: "stroke", path: d, color: e.borderColor, width: s, dash: null }), t && f.push({ kind: "fill", path: w8( a, c, - ve(ve(l - s) * 0.5), - ve(ve(u - s) * 0.5) + we(we(l - s) * 0.5), + we(we(u - s) * 0.5) ), - color: e.symbolColor ?? Lf, + color: e.symbolColor ?? jf, evenOdd: !0 - }), d; + }), f; } function w8(e, t, n, r) { - const o = ve(b8 * n), s = ve(b8 * r); + const o = we(b8 * n), s = we(b8 * r); return [ - { op: "move", x: e, y: ve(t + r) }, + { op: "move", x: e, y: we(t + r) }, { op: "curve", - x1: ve(e + o), - y1: ve(t + r), - x2: ve(e + n), - y2: ve(t + s), - x: ve(e + n), + x1: we(e + o), + y1: we(t + r), + x2: we(e + n), + y2: we(t + s), + x: we(e + n), y: t }, { op: "curve", - x1: ve(e + n), - y1: ve(t - s), - x2: ve(e + o), - y2: ve(t - r), + x1: we(e + n), + y1: we(t - s), + x2: we(e + o), + y2: we(t - r), x: e, - y: ve(t - r) + y: we(t - r) }, { op: "curve", - x1: ve(e - o), - y1: ve(t - r), - x2: ve(e - n), - y2: ve(t - s), - x: ve(e - n), + x1: we(e - o), + y1: we(t - r), + x2: we(e - n), + y2: we(t - s), + x: we(e - n), y: t }, { op: "curve", - x1: ve(e - n), - y1: ve(t + s), - x2: ve(e - o), - y2: ve(t + r), + x1: we(e - n), + y1: we(t + s), + x2: we(e - o), + y2: we(t + r), x: e, - y: ve(t + r) + y: we(t + r) }, { op: "close" } ]; } function aW(e, t, n) { - const r = ve(e.right - e.left), o = ve(e.top - e.bottom), s = r > o ? ve(o / 2) : ve(r / 2), i = ve(ve(e.left + e.right) / 2), a = ve(ve(e.top + e.bottom) / 2), c = { - left: ve(i - s), - bottom: ve(a - s), - right: ve(i + s), - top: ve(a + s) - }, l = t === "circle" ? ve(n ? 1 / 2 : 2 / 3) : t === "check" || t === "cross" ? 1 : ve(2 / 3); + const r = we(e.right - e.left), o = we(e.top - e.bottom), s = r > o ? we(o / 2) : we(r / 2), i = we(we(e.left + e.right) / 2), a = we(we(e.top + e.bottom) / 2), c = { + left: we(i - s), + bottom: we(a - s), + right: we(i + s), + top: we(a + s) + }, l = t === "circle" ? we(n ? 1 / 2 : 2 / 3) : t === "check" || t === "cross" ? 1 : we(2 / 3); if (l === 1) return c; - const u = ve(ve(c.right - c.left) / 2), d = ve(ve(c.top - c.bottom) / 2), f = ve(ve(c.left + c.right) / 2), h = ve(ve(c.top + c.bottom) / 2); + const u = we(we(c.right - c.left) / 2), f = we(we(c.top - c.bottom) / 2), d = we(we(c.left + c.right) / 2), h = we(we(c.top + c.bottom) / 2); return { - left: ve(f - ve(u * l)), - bottom: ve(h - ve(d * l)), - right: ve(f + ve(u * l)), - top: ve(h + ve(d * l)) + left: we(d - we(u * l)), + bottom: we(h - we(f * l)), + right: we(d + we(u * l)), + top: we(h + we(f * l)) }; } function cW(e, t, n) { - const r = e.symbolColor ?? Lf, o = ve(ve(n.left + n.right) / 2), s = ve(ve(n.bottom + n.top) / 2); + const r = e.symbolColor ?? jf, o = we(we(n.left + n.right) / 2), s = we(we(n.bottom + n.top) / 2); switch (t) { case "check": return { kind: "fill", path: CAe(n), color: r, evenOdd: !1 }; case "circle": { - const i = ve(ve(n.right - n.left) / 2), a = ve(ve(n.top - n.bottom) / 2), c = { x: n.left, y: s }, l = { x: o, y: n.top }, u = { x: n.right, y: s }, d = { x: o, y: n.bottom }; + const i = we(we(n.right - n.left) / 2), a = we(we(n.top - n.bottom) / 2), c = { x: n.left, y: s }, l = { x: o, y: n.top }, u = { x: n.right, y: s }, f = { x: o, y: n.bottom }; return { kind: "fill", path: [ @@ -47903,36 +47934,36 @@ function cW(e, t, n) { { op: "curve", x1: c.x, - y1: ve(c.y + ve(a * Oo)), - x2: ve(l.x - ve(i * Oo)), + y1: we(c.y + we(a * Po)), + x2: we(l.x - we(i * Po)), y2: l.y, x: l.x, y: l.y }, { op: "curve", - x1: ve(l.x + ve(i * Oo)), + x1: we(l.x + we(i * Po)), y1: l.y, x2: u.x, - y2: ve(u.y + ve(a * Oo)), + y2: we(u.y + we(a * Po)), x: u.x, y: u.y }, { op: "curve", x1: u.x, - y1: ve(u.y - ve(a * Oo)), - x2: ve(d.x + ve(i * Oo)), - y2: d.y, - x: d.x, - y: d.y + y1: we(u.y - we(a * Po)), + x2: we(f.x + we(i * Po)), + y2: f.y, + x: f.x, + y: f.y }, { op: "curve", - x1: ve(d.x - ve(i * Oo)), - y1: d.y, + x1: we(f.x - we(i * Po)), + y1: f.y, x2: c.x, - y2: ve(c.y - ve(a * Oo)), + y2: we(c.y - we(a * Po)), x: c.x, y: c.y } @@ -47979,13 +48010,13 @@ function cW(e, t, n) { evenOdd: !1 }; case "star": { - const i = ve(ve(n.top - n.bottom) / ve(1 + ve(Math.cos(Math.PI / 5)))), a = []; - let c = ve(Math.PI / 10); + const i = we(we(n.top - n.bottom) / we(1 + we(Math.cos(Math.PI / 5)))), a = []; + let c = we(Math.PI / 10); for (let l = 0; l < 5; l += 1) a.push([ - ve(o + ve(i * ve(Math.cos(c)))), - ve(s + ve(i * ve(Math.sin(c)))) - ]), c = ve(c + ve(Math.PI * 2 / 5)); + we(o + we(i * we(Math.cos(c)))), + we(s + we(i * we(Math.sin(c)))) + ]), c = we(c + we(Math.PI * 2 / 5)); return { kind: "fill", path: DC([a[0], a[2], a[4], a[1], a[3]]), @@ -48044,19 +48075,19 @@ const EAe = [ ] ]; function CAe(e) { - const t = ve(e.right - e.left), n = ve(e.top - e.bottom), r = EAe.map( + const t = we(e.right - e.left), n = we(e.top - e.bottom), r = EAe.map( (s) => s.map( - ([i, a]) => [ve(ve(ve(i) * t) + e.left), ve(ve(ve(a) * n) + e.bottom)] + ([i, a]) => [we(we(we(i) * t) + e.left), we(we(we(a) * n) + e.bottom)] ) ), o = [{ op: "move", x: r[0][0][0], y: r[0][0][1] }]; for (let s = 0; s < r.length; s += 1) { - const i = r[s], a = r[(s + 1) % r.length][0], [c, l] = i[0], u = ve(i[1][0] - c), d = ve(i[1][1] - l), f = ve(i[2][0] - a[0]), h = ve(i[2][1] - a[1]); + const i = r[s], a = r[(s + 1) % r.length][0], [c, l] = i[0], u = we(i[1][0] - c), f = we(i[1][1] - l), d = we(i[2][0] - a[0]), h = we(i[2][1] - a[1]); o.push({ op: "curve", - x1: ve(c + ve(u * Oo)), - y1: ve(l + ve(d * Oo)), - x2: ve(a[0] + ve(f * Oo)), - y2: ve(a[1] + ve(h * Oo)), + x1: we(c + we(u * Po)), + y1: we(l + we(f * Po)), + x2: we(a[0] + we(d * Po)), + y2: we(a[1] + we(h * Po)), x: a[0], y: a[1] }); @@ -48070,11 +48101,11 @@ function lW(e, t) { look: { bbox: { left: 0, bottom: 0, right: n.width, top: n.height }, border: sW(e), - background: e.interiorColor ? kg(e.interiorColor) : null, - borderColor: e.color ? kg(e.color) : null, + background: e.interiorColor ? Ag(e.interiorColor) : null, + borderColor: e.color ? Ag(e.color) : null, fonts: t ?? n5(e.fontFamily), fontSize: e.fontSize ?? 0, - textColor: e.fontColor ? kg(e.fontColor) : null, + textColor: e.fontColor ? Ag(e.fontColor) : null, alignment: IAe[e.textAlign ?? "left"] }, approximate: o === "symbol" || o === "zapf-dingbats" ? "symbolic-font" : o || t ? null : "font" @@ -48108,7 +48139,7 @@ function v8(e, t, n = {}) { } function OAe(e, t, n = {}, r) { if (!uW(t)) return null; - const o = e.box ?? e.rect, s = { left: 0, bottom: 0, right: o.width, top: o.height }, i = sW(e), a = e.interiorColor ? kg(e.interiorColor) : null, c = e.color ? kg(e.color) : null, l = e.fontColor ? kg(e.fontColor) : null, u = (p, m = null) => ({ + const o = e.box ?? e.rect, s = { left: 0, bottom: 0, right: o.width, top: o.height }, i = sW(e), a = e.interiorColor ? Ag(e.interiorColor) : null, c = e.color ? Ag(e.color) : null, l = e.fontColor ? Ag(e.fontColor) : null, u = (p, m = null) => ({ width: o.width, height: o.height, ops: p, @@ -48129,19 +48160,19 @@ function OAe(e, t, n = {}, r) { t.kind === "checkbox" ? SAe(p, m) : xAe(p, m) ); } - const d = lW(e, r), f = d.look; - let h = d.approximate; - const g = t.kind === "text" ? yAe(f, { + const f = lW(e, r), d = f.look; + let h = f.approximate; + const g = t.kind === "text" ? yAe(d, { value: n.text ?? t.value, multiline: t.multiline, password: t.password, comb: t.comb, maxLength: t.maxLength - }) : t.kind === "combobox" ? bAe(f, { value: n.text ?? t.value }) : t.kind === "listbox" ? vAe(f, { options: t.options, topIndex: t.topIndex }) : kAe(f, e.caption ?? null); + }) : t.kind === "combobox" ? bAe(d, { value: n.text ?? t.value }) : t.kind === "listbox" ? vAe(d, { options: t.options, topIndex: t.topIndex }) : kAe(d, e.caption ?? null); return g.missing.length > 0 && !r && (h ?? (h = "glyph")), u(g.ops, h); } function PAe(e, t) { - const n = O2(Gf(e.face.key)); + const n = O2(Yf(e.face.key)); return [...t.map((r) => `"${r.family}"`), n].join(", "); } function RAe(e, t) { @@ -48159,9 +48190,9 @@ function TAe(e, t, n, r) { password: t.password, comb: t.comb, maxLength: t.maxLength - }, { plate: i, laid: a } = yO(o, { ...s, value: n }), { bbox: c } = o, { face: l } = o.fonts, u = a.fontSize, d = RAe(o.fonts, a), f = { - programs: d, - fontFamily: PAe(o.fonts, d), + }, { plate: i, laid: a } = yO(o, { ...s, value: n }), { bbox: c } = o, { face: l } = o.fonts, u = a.fontSize, f = RAe(o.fonts, a), d = { + programs: f, + fontFamily: PAe(o.fonts, f), fontWeight: l.fontWeight, fontStyle: l.fontStyle, fontSize: u, @@ -48174,11 +48205,11 @@ function TAe(e, t, n, r) { left: i.left - c.left } }, h = t.comb ? t.maxLength ?? 0 : 0; - if (h === 0) return { ...f, letterSpacing: 0, comb: !1 }; + if (h === 0) return { ...d, letterSpacing: 0, comb: !1 }; const p = (n ? a : yO(o, { ...s, value: "0" }).laid).lines.flatMap((S) => S.runs), m = p.reduce((S, C) => S + C.width, 0) / Math.max(1, p.length), v = (i.right - i.left) / h; return { - ...f, - padding: { ...f.padding, left: (p[0]?.x ?? i.left) - c.left }, + ...d, + padding: { ...d.padding, left: (p[0]?.x ?? i.left) - c.left }, letterSpacing: v - m, comb: !0 }; @@ -48187,8 +48218,8 @@ const jC = (e) => `#${[...e].map( (t) => Math.round(Math.min(1, Math.max(0, t)) * 255).toString(16).padStart(2, "0") ).join("")}`, $1 = (e) => Number(e.toFixed(3)); function MAe(e, t) { - const { box: n } = t, r = ((t.rotation ?? 0) % 360 + 360) % 360, o = n.x + n.width / 2, s = n.y + n.height / 2, i = (d, f) => { - const h = n.x + d - o, g = n.y + (e.height - f) - s; + const { box: n } = t, r = ((t.rotation ?? 0) % 360 + 360) % 360, o = n.x + n.width / 2, s = n.y + n.height / 2, i = (f, d) => { + const h = n.x + f - o, g = n.y + (e.height - d) - s; switch (r) { case 90: return { x: o - g, y: s + h }; @@ -48199,38 +48230,38 @@ function MAe(e, t) { default: return { x: o + h, y: s + g }; } - }, a = (d) => { - const f = (h, g) => { + }, a = (f) => { + const d = (h, g) => { const p = i(h, g); return `${$1(p.x)} ${$1(p.y)}`; }; - return d.map((h) => { + return f.map((h) => { switch (h.op) { case "rect": { const { x: g, y: p, width: m, height: v } = h; - return `M ${f(g, p)} L ${f(g + m, p)} L ${f(g + m, p + v)} L ${f(g, p + v)} Z`; + return `M ${d(g, p)} L ${d(g + m, p)} L ${d(g + m, p + v)} L ${d(g, p + v)} Z`; } case "move": - return `M ${f(h.x, h.y)}`; + return `M ${d(h.x, h.y)}`; case "line": - return `L ${f(h.x, h.y)}`; + return `L ${d(h.x, h.y)}`; case "curve": - return `C ${f(h.x1, h.y1)} ${f(h.x2, h.y2)} ${f(h.x, h.y)}`; + return `C ${d(h.x1, h.y1)} ${d(h.x2, h.y2)} ${d(h.x, h.y)}`; case "close": return "Z"; } }).join(" "); - }, c = (d) => { - const f = i(d.left, d.bottom), h = i(d.right, d.top); + }, c = (f) => { + const d = i(f.left, f.bottom), h = i(f.right, f.top); return { - x: Math.min(f.x, h.x), - y: Math.min(f.y, h.y), - width: Math.abs(h.x - f.x), - height: Math.abs(h.y - f.y) + x: Math.min(d.x, h.x), + y: Math.min(d.y, h.y), + width: Math.abs(h.x - d.x), + height: Math.abs(h.y - d.y) }; - }, l = [], u = (d, f) => { - for (const h of d) { - const g = f ? { clip: f } : {}; + }, l = [], u = (f, d) => { + for (const h of f) { + const g = d ? { clip: d } : {}; switch (h.kind) { case "fill": { const p = { @@ -48280,7 +48311,7 @@ function MAe(e, t) { }; return u(e.ops, void 0), l; } -const BAe = Object.freeze([]), hh = (e) => e.kind === "objectNumber" ? e.objectNumber : -1; +const BAe = Object.freeze([]), gh = (e) => e.kind === "objectNumber" ? e.objectNumber : -1; function _Ae({ fields: e, formatted: t, @@ -48329,21 +48360,21 @@ function _Ae({ }, c = Mn( (m) => [e.view(), e.get(), t.version(), n.lending(), o()], (m, v, S, C, k) => k ? BAe : Gve(v, m, (N) => { - const w = hh(N.ref); + const w = gh(N.ref); return { pending: a(v, w) !== a(S, w), pictureVersion: dO(S, w) }; }) ), l = (m, v, S, C = !1) => { - const k = wn(e.view(), hh(m.ref)); + const k = wn(e.view(), gh(m.ref)); return k ? u(m, k, v, S, C) : null; }, u = (m, v, S, C, k) => { const N = t.textOf(v), w = N === null ? {} : { text: N }, y = s(m, v8(m, v, w)); if (y === null && !k) return null; const x = OAe({ ...m, box: S }, v, w, y ?? void 0); return x && MAe(x, { box: S, rotation: C }); - }, d = Mn( + }, f = Mn( (m) => { const v = e.view(), S = xn(v, m), C = S ? wn(v, m) : null; return [S, C, C ? t.textOf(C) : null, o()]; @@ -48352,9 +48383,9 @@ function _Ae({ const S = v && l(v, v.box ?? v.rect, v.rotation); return S ? { scene: S } : null; } - ), f = (m) => r()?.getFontCss(m) ?? hm(Gf(m)), h = (m, v) => { + ), d = (m) => r()?.getFontCss(m) ?? pm(Yf(m)), h = (m, v) => { if (!r() || !v || gs(v)) return m; - const S = f(v); + const S = d(v); return { ...m, programs: S.programs, @@ -48365,10 +48396,10 @@ function _Ae({ }, g = /* @__PURE__ */ new WeakMap(); return { listShownWidgets: (m) => c(m), - getWidgetPainting: (m) => d(hh(m)), + getWidgetPainting: (m) => f(gh(m)), /** The widget's look in the view isn't its confirmed look yet: it draws live until its picture is. */ isPending: (m) => { - const v = hh(m); + const v = gh(m); return a(e.view(), v) !== a(e.get(), v); }, /** @@ -48384,14 +48415,14 @@ function _Ae({ return g.set(m, { field: v, painter: C }), C; }, getTextEditorLayout: (m, v) => { - const S = e.view(), C = hh(m), k = xn(S, C), N = k ? wn(S, C) : null; + const S = e.view(), C = gh(m), k = xn(S, C), N = k ? wn(S, C) : null; if (!k || !N) return null; const w = s(k, v8(k, N, { text: v })), y = TAe(k, N, v, w ?? void 0); return y && (w ? y : h(y, k.fontFamily ?? null)); }, getWidgetFontCss: (m) => { - const v = xn(e.view(), hh(m)); - return v ? f(v.fontFamily ?? "helvetica") : null; + const v = xn(e.view(), gh(m)); + return v ? d(v.fontFamily ?? "helvetica") : null; } }; } @@ -48440,7 +48471,7 @@ const k8 = { return t?.kind === "date" ? t.pattern : VAe; }, UAe = (e) => Kz.includes(e), A8 = "Filled in when you sign"; function KAe(e) { - const t = e.tryGet(vo), n = tt( + const t = e.tryGet(ko), n = tt( () => [t?.getTranslator() ?? null], (i) => Object.freeze( Kz.map( @@ -48505,15 +48536,15 @@ function HAe(e, t) { * before it. What the open scripts ask for is dropped with the realm. */ checker: (l) => { - const { snapshot: u } = l, d = t.actions()?.createScratchScriptRealm; - return !u || !d || !JD(l) ? null : async (f) => { - const h = d(), g = hO({ + const { snapshot: u } = l, f = t.actions()?.createScratchScriptRealm; + return !u || !f || !JD(l) ? null : async (d) => { + const h = f(), g = hO({ document: () => e.document(), transaction: h.transaction.bind(h), budget: h.budget }); try { - return await g.warm(u), await g.transaction(f); + return await g.warm(u), await g.transaction(d); } finally { g.destroy(), h.destroy(); } @@ -48538,7 +48569,7 @@ function zAe(e) { /** The annotation plugin: design mode's selection, tools, ghosts and placement previews. */ annotation: () => e.tryGet(_n), /** The script realm owner and the one surface port for script results. */ - actions: () => e.tryGet(Dm), + actions: () => e.tryGet(jm), /** The page renderer: the widgets' pictures, shared by the form layer and design mode. */ render: () => e.tryGet(Pr) }; @@ -48554,8 +48585,8 @@ function WAe(e, t) { for (const c of s) { const l = yn(c.ref), u = wn(o, l); if (u?.kind !== "radio") continue; - const d = Ft(u), f = i.get(d); - f ? f.push(l) : i.set(d, [l]); + const f = Kt(u), d = i.get(f); + d ? d.push(l) : i.set(f, [l]); } const a = /* @__PURE__ */ new Map(); for (const c of i.values()) @@ -48593,7 +48624,7 @@ function qAe(e) { }; } function GAe(e, t, { fill: n }) { - const { fields: r, scripting: o, cursor: s } = t, i = async (f) => (await r.settled(), (f.kind === "objectNumber" ? xn(r.view(), f.objectNumber) : null)?.actions?.activate ?? null), a = async (f, h, g) => { + const { fields: r, scripting: o, cursor: s } = t, i = async (d) => (await r.settled(), (d.kind === "objectNumber" ? xn(r.view(), d.objectNumber) : null)?.actions?.activate ?? null), a = async (d, h, g) => { if (!o.controller()) return { status: "unchanged", @@ -48610,19 +48641,19 @@ function GAe(e, t, { fill: n }) { diagnostics: [] }; const { result: v } = await n( - { ops: [], scripts: { kind: "activate", field: f, action: m }, origin: "user" }, + { ops: [], scripts: { kind: "activate", field: d, action: m }, origin: "user" }, g ); return v; - }, c = (f, h) => ({ + }, c = (d, h) => ({ kind: "widget", - field: f, + field: d, annotation: h, page: h.page }); let l = null; - const u = (f) => (l ?? (l = gR(f.dispatch)), l), d = (f) => { - const h = f.kind === "objectNumber" ? xn(r.view(), f.objectNumber) : null; + const u = (d) => (l ?? (l = gR(d.dispatch)), l), f = (d) => { + const h = d.kind === "objectNumber" ? xn(r.view(), d.objectNumber) : null; return h ? { enter: !!h.actions?.cursorEnter?.root, exit: !!h.actions?.cursorExit?.root @@ -48630,38 +48661,38 @@ function GAe(e, t, { fill: n }) { }; return { api: { - activateWidget: async (f, h) => { - const g = wn(r.view(), yn(f)); - if (!g) throw new re("not-found", "form", "no form field owns this widget"); + activateWidget: async (d, h) => { + const g = wn(r.view(), yn(d)); + if (!g) throw new te("not-found", "form", "no form field owns this widget"); const p = e.tryGet(Lr); if (p) { const m = await e.cancellable( h?.signal, p.dispatch({ type: "activate", - annotation: f, - page: f.page, - source: c(g.ref, f) + annotation: d, + page: d.page, + source: c(g.ref, d) }) ); if (!(m.status === "inert" && m.steps.length === 0 && m.diagnostics.length === 0)) return { status: "dispatched", result: m }; } return { status: "form", - result: await a(g.ref, f, h) + result: await a(g.ref, d, h) }; }, - notifyWidgetEvent: (f, h, g) => { - (g === "focus" || g === "blur") && s.note(g, f, h); + notifyWidgetEvent: (d, h, g) => { + (g === "focus" || g === "blur") && s.note(g, d, h); const p = e.tryGet(Lr); if (!p) return; - const m = c(f, h); + const m = c(d, h); if (g === "cursorEnter" || g === "cursorExit") { if (g === "cursorExit") { u(p).hover(null); return; } - const v = d(h); + const v = f(h); if (v && !v.enter && !v.exit) return; u(p).hover({ ref: h, @@ -48713,22 +48744,22 @@ function QAe(e, t, n, r) { const { snapshot: o } = e, s = n.offset ?? { x: 0, y: 0 }, i = [], a = t.map((m) => { const v = xn(e, S8(m)); if (!v || !o) - throw new re("not-found", "form", `no widget ${oe(m)}`); + throw new te("not-found", "form", `no widget ${oe(m)}`); return v; - }), c = [], l = [], u = [], d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Set(); + }), c = [], l = [], u = [], f = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set(); for (const m of a) { const v = wn(e, S8(m.ref)); if (!v) { i.push({ ref: null, widget: m.ref, reason: "no-field" }); continue; } - const S = Ft(v); + const S = Kt(v); if (v.kind !== "radio") { - c.some((w) => Ft(w) === S) || c.push(v), l.push(m.ref); + c.some((w) => Kt(w) === S) || c.push(v), l.push(m.ref); continue; } - const C = d.get(S) ?? v.widgets.map((w) => w.exportValue), k = dW(C); - d.set(S, [...C, k]); + const C = f.get(S) ?? v.widgets.map((w) => w.exportValue), k = dW(C); + f.set(S, [...C, k]); const N = q7(v, m, (w) => w, r.mayScript, i); u.push({ row: m, @@ -48740,8 +48771,8 @@ function QAe(e, t, n, r) { exportValue: k }, // Only the first button added splits a merged group. - split: fW(v) && !f.has(S) - }), f.add(S); + split: fW(v) && !d.has(S) + }), d.add(S); } let h = null; c.length > 0 && o && (h = A6({ @@ -48808,7 +48839,7 @@ function XAe(e, t) { if (!n) return { x: 0, y: 0, width: 0, height: 0 }; const { width: r, height: o } = n, s = e.at(-2), i = s && (s.x !== n.x || s.y !== n.y) ? { x: n.x - s.x, y: n.y - s.y } : { x: 0, y: o * 1.5 }, a = { x: n.x + i.x, y: n.y + i.y, width: r, height: o }; if (x8(a, t)) return a; - const c = Math.abs(i.y) >= Math.abs(i.x), l = Math.min(...e.map((p) => p.x)), u = Math.min(...e.map((p) => p.y)), d = Math.max(...e.map((p) => p.x + p.width)), f = Math.max(...e.map((p) => p.y + p.height)), h = Math.max(c ? Math.abs(i.y) - o : Math.abs(i.x) - r, 0), g = c ? { x: d + (h || r / 2), y: u, width: r, height: o } : { x: l, y: f + (h || o / 2), width: r, height: o }; + const c = Math.abs(i.y) >= Math.abs(i.x), l = Math.min(...e.map((p) => p.x)), u = Math.min(...e.map((p) => p.y)), f = Math.max(...e.map((p) => p.x + p.width)), d = Math.max(...e.map((p) => p.y + p.height)), h = Math.max(c ? Math.abs(i.y) - o : Math.abs(i.x) - r, 0), g = c ? { x: f + (h || r / 2), y: u, width: r, height: o } : { x: l, y: d + (h || o / 2), width: r, height: o }; return x8(g, t) ? g : { x: Math.min(Math.max(a.x, 0), Math.max(t.width - r, 0)), y: Math.min(Math.max(a.y, 0), Math.max(t.height - o, 0)), @@ -48875,28 +48906,28 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { try { Ux(A.purpose), Lx(A.placeholder), b !== void 0 && _x(A, b); } catch (E) { - throw qe("form", E); + throw ze("form", E); } }, i = (A, b) => { if (!(b?.kind !== "anyone" || V2(A))) - throw new re("invalid-input", "form", Xve(A)); + throw new te("invalid-input", "form", Xve(A)); }, a = (A, b = !1) => { e.assertAllowed(E8, A), b && e.assertAllowed(C8, A); }, c = (A, b) => e.changes.stage({ label: { key: `form.${A}` }, ops: [b], - undo: kl(t.view(), [b]) + undo: Al(t.view(), [b]) }), l = (A, b) => e.changes.stage({ label: { key: `form.${A}` }, ops: [...b], - undo: kl(t.view(), b) + undo: Al(t.view(), b) }), u = async (A, b) => { try { return (await e.cancellable(b?.signal, A.result)).items[0]; } catch (E) { - throw qe("form", E); + throw ze("form", E); } - }, d = async (A, b) => { + }, f = async (A, b) => { a("form.create", U7(A)), typeof A.groupId == "string" && r.assertMaySet(A.groupId, "form.create"), A.assignment !== void 0 && r.assertMayAssign(A.assignment, "form.create"), s(A, A.kind), i(A, A.assignment); const E = 1 + (A.widgets?.length ?? 0), [I, ...O] = o.takeNow(E) ?? await o.take(E), T = c("create", { type: "forms.create", @@ -48905,29 +48936,29 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { widgetObjectNumbers: O }); return { field: (await u(T, b)).field }; - }, f = async (A, b = {}, E) => { - a("form.addWidget", Fd(b.actions)); + }, d = async (A, b = {}, E) => { + a("form.addWidget", $d(b.actions)); const I = t.view(), O = yt(I, A); - if (!O) throw new re("not-found", "form", "no form field has this ref"); - const T = O.widgets.map((le) => xn(I, le.objectNumber)).filter((le) => le !== null), R = T.at(-1), M = b.page ?? R?.page; + if (!O) throw new te("not-found", "form", "no form field has this ref"); + const T = O.widgets.map((ie) => xn(I, ie.objectNumber)).filter((ie) => ie !== null), R = T.at(-1), M = b.page ?? R?.page; if (!M) - throw new re( + throw new te( "invalid-input", "form", "the field shows on no page: give `page` and `rect`" ); - const F = e.getPage(M)?.size, B = T.filter((le) => le.page.objectNumber === M.objectNumber), $ = b.rect ?? b.box ?? (F && B.length > 0 ? XAe( + const F = e.getPage(M)?.size, _ = T.filter((ie) => ie.page.objectNumber === M.objectNumber), $ = b.rect ?? b.box ?? (F && _.length > 0 ? XAe( // Where each stands: the next one takes its place in line, and the last one's turn. - B.map((le) => le.rect), + _.map((ie) => ie.rect), F ) : void 0); if (!$) - throw new re( + throw new te( "invalid-input", "form", "no widget of the field on that page: give `rect`" ); - const D = b.exportValue ?? nSe(O), _ = fW(O), [L, j] = o.takeNow(_ ? 2 : 1) ?? await o.take(_ ? 2 : 1), H = c("addWidget", { + const D = b.exportValue ?? nSe(O), B = fW(O), [L, j] = o.takeNow(B ? 2 : 1) ?? await o.take(B ? 2 : 1), H = c("addWidget", { type: "forms.addWidget", field: O.ref, placement: { @@ -48938,11 +48969,11 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { ...D === void 0 ? {} : { exportValue: D } }, objectNumber: L, - ..._ ? { splitObjectNumber: j } : {} - }), Y = await u(H, E), ue = Y.widgets.find( - (le) => le.ref.kind === "objectNumber" && le.ref.objectNumber === L + ...B ? { splitObjectNumber: j } : {} + }), Y = await u(H, E), le = Y.widgets.find( + (ie) => ie.ref.kind === "objectNumber" && ie.ref.objectNumber === L ) ?? Y.widgets.at(-1); - return { field: Y.field, widget: ue }; + return { field: Y.field, widget: le }; }, h = (A) => ({ ...A.page === void 0 ? {} : { page: e.pageOf(A.page).ref }, ...A.offset ? { offset: A.offset } : {} @@ -48954,14 +48985,14 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { mayScript: e.allows(C8) }); } catch (T) { - throw qe("form", T); + throw ze("form", T); } const O = I.needs ? o.takeNow(I.needs) ?? await o.take(I.needs) : []; return { ...I.build(O), dropped: I.dropped }; }, p = async (A, b = {}) => { if (a("form.duplicate"), A.length === 0) return { fields: [], widgets: [], dropped: [] }; const E = h(b), I = b.values ?? !1, { snapshot: O } = t.view(); - if (!O) throw new re("not-ready", "form", "the form is still loading"); + if (!O) throw new te("not-ready", "form", "the form is still loading"); let T; try { T = A6({ @@ -48971,8 +49002,8 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { values: I, mayScript: !0 }).creates.reduce(($, D) => $ + 1 + D.widgets.length, 0); - } catch (B) { - throw qe("form", B); + } catch (_) { + throw ze("form", _); } const R = T ? o.takeNow(T) ?? await o.take(T) : [], M = l("duplicate", [ { type: "forms.copy", fields: A, ...E, values: I, objectNumbers: R } @@ -48987,21 +49018,21 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { try { O = (await e.cancellable(b.signal, I.result)).items; } catch (T) { - throw qe("form", T); + throw ze("form", T); } return oSe(O, E.copies, E.dropped); }, v = (A) => { if (A === "all") return e.document()?.pages ?? []; if (!Array.isArray(A)) - throw new re("invalid-input", "form", "repeat: `pages` is 'all' or a list of pages"); + throw new te("invalid-input", "form", "repeat: `pages` is 'all' or a list of pages"); return A.map((b) => e.pageOf(b)); }, S = async (A, b) => { a("form.repeat"); const { as: E } = b; if (E !== void 0 && E !== "boxes" && E !== "fields") - throw new re("invalid-input", "form", "repeat: `as` is 'boxes' or 'fields'"); + throw new te("invalid-input", "form", "repeat: `as` is 'boxes' or 'fields'"); const { snapshot: I } = t.view(); - if (!I) throw new re("not-ready", "form", "the form is still loading"); + if (!I) throw new te("not-ready", "form", "the form is still loading"); const O = v(b.pages); let T; try { @@ -49013,7 +49044,7 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { ...E ? { as: E } : {} }); } catch (F) { - throw qe("form", F); + throw ze("form", F); } if (T.count === 0) return { fields: [], widgets: [], dropped: [] }; const R = c("repeat", { @@ -49031,12 +49062,12 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { const b = t.view(); return A.map((E) => { const I = yt(b, E); - if (!I) throw new re("not-found", "form", "no form field has this ref"); + if (!I) throw new te("not-found", "form", "no form field has this ref"); return I; }); }, N = async (A, b, E, I) => { const O = /* @__PURE__ */ new Map(); - for (const F of A) b(F) && O.set(Ft(F), F); + for (const F of A) b(F) && O.set(Kt(F), F); if (O.size === 0) return { fields: A }; const T = l( "update", @@ -49048,12 +49079,12 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { try { R = (await e.cancellable(I?.signal, T.result)).items; } catch (F) { - throw qe("form", F); + throw ze("form", F); } const M = /* @__PURE__ */ new Map(); for (const F of R) - F.type === "forms.update" && M.set(Ft(F.field), F.field); - return { fields: A.map((F) => M.get(Ft(F)) ?? F) }; + F.type === "forms.update" && M.set(Kt(F.field), F.field); + return { fields: A.map((F) => M.get(Kt(F)) ?? F) }; }, w = async (A, b, E, I, O) => { a(A), r.assertMayAssign(E, A); const T = k(b); @@ -49068,25 +49099,25 @@ function rSe(e, { fields: t, enqueue: n, groups: r }) { return { copyOps: g, api: { - create: d, - addWidget: f, + create: f, + addWidget: d, duplicate: p, duplicateWidgets: m, repeat: S, canRepeat: C, moveToGroup: async (A, b, E) => { - const I = Hd(iv(b)); + const I = Wd(iv(b)); return w("form.moveToGroup", A, I, { groupId: b }, E); }, assign: async (A, b, E) => { - const I = Hd(b); + const I = Wd(b); return w("form.assign", A, I, { assignment: I }, E); }, update: async (A, b, E) => { - a("form.update", Fd(b.actions)); + a("form.update", $d(b.actions)); const I = yt(t.view(), A); if (typeof b.groupId == "string" && b.groupId !== I?.groupId && r.assertMaySet(b.groupId, "form.update"), b.assignment !== void 0) { - const T = Hd(b.assignment); + const T = Wd(b.assignment); I && w0(I.assignment, T) || r.assertMayAssign(T, "form.update"); } s(b, I?.kind), I && (b.assignment !== void 0 || b.purpose !== void 0) && i( @@ -49141,9 +49172,9 @@ function oSe(e, t, n) { }; for (const a of e) if (a.type === "forms.copy") { - for (const c of a.fields) r.set(Ft(c), c); + for (const c of a.fields) r.set(Kt(c), c); a.widgets.forEach(i), s.push(...a.dropped); - } else a.type === "forms.addWidget" ? (r.set(Ft(a.field), a.field), a.widgets.forEach(i)) : a.type === "forms.updateWidget" && i(a.widget); + } else a.type === "forms.addWidget" ? (r.set(Kt(a.field), a.field), a.widgets.forEach(i)) : a.type === "forms.updateWidget" && i(a.widget); return { fields: [...r.values()], widgets: t.flatMap( @@ -49158,29 +49189,29 @@ function uSe(e, { fields: t, scripting: n, enqueue: r }) { const y = t.view(), x = w.ops.reduce(O5, y); if (w.ops.length === 0) return { request: w, before: y, shown: x, hold: null }; const A = e.changes.hold(o(w, y, w.ops)); - return A.set(w.ops, kl(y, w.ops)), { request: w, before: y, shown: x, hold: A }; + return A.set(w.ops, Al(y, w.ops)), { request: w, before: y, shown: x, hold: A }; }, i = ({ request: w, before: y }) => Xke(t.view(), y, Wy(y, w.ops)), a = ({ hold: w }) => w !== null && !w.open && !!w.change, c = ({ request: w, shown: y }) => { const x = t.view(); return Wy(y, w.ops).every( - (A) => lSe(Ya(x, Ft(A)), A) + (A) => lSe(Ya(x, Kt(A)), A) ); }, l = (w, y, x) => { const { request: A, hold: b } = w; if (y.length === 0) return b?.cancel(), { script: x, changes: [], after: t.view() }; if (!b) { - const T = o(A, t.view(), y), R = e.changes.stage({ label: T, ops: y, undo: kl(i(w), y) }); + const T = o(A, t.view(), y), R = e.changes.stage({ label: T, ops: y, undo: Al(i(w), y) }); return { script: x, changes: [R], after: t.view() }; } if (b.open) { - b.set(y, kl(i(w), y)); + b.set(y, Al(i(w), y)); const T = b.send(); return { script: x, changes: T ? [T] : [], after: t.view() }; } const E = b.change, I = y.filter((T) => !E?.shows.some((R) => cSe(R, T))), O = E ? [E] : []; if (I.length > 0) { const T = o(A, t.view(), I); - O.push(e.changes.stage({ label: T, ops: I, undo: kl(t.view(), I) })); + O.push(e.changes.stage({ label: T, ops: I, undo: Al(t.view(), I) })); } return { script: x, changes: O, after: t.view() }; }, u = ({ request: w, before: y }) => { @@ -49189,7 +49220,7 @@ function uSe(e, { fields: t, scripting: n, enqueue: r }) { return b ? [{ type: "forms.setValue", field: A.ref, value: b }] : []; }); x.length !== 0 && e.changes.stage({ label: o(w, y, x), ops: x, history: !1 }); - }, d = async (w, y) => { + }, f = async (w, y) => { const x = t.view().snapshot; if (!x) return; const A = await w.recalculate(x); @@ -49198,7 +49229,7 @@ function uSe(e, { fields: t, scripting: n, enqueue: r }) { ops: qw(A.effects), history: !1 }); - }, f = (w, y, x) => { + }, d = (w, y, x) => { const A = t.view().snapshot; if (!A) return null; switch (x.kind) { @@ -49246,7 +49277,7 @@ function uSe(e, { fields: t, scripting: n, enqueue: r }) { if (E) return E; try { return await b.transaction(async (I) => { - const O = f(I, w, A); + const O = d(I, w, A); if (!O) return l(w, y.ops, null); const T = await O; n.surface(T, y.origin); @@ -49258,7 +49289,7 @@ function uSe(e, { fields: t, scripting: n, enqueue: r }) { history: !1 }), { script: T, changes: [], after: t.view() }; if (R && !c(w)) - return await d(I, y.origin), { script: T, changes: [x.change], after: t.view() }; + return await f(I, y.origin), { script: T, changes: [x.change], after: t.view() }; const M = qw(T.effects); return l( w, @@ -49287,7 +49318,7 @@ function uSe(e, { fields: t, scripting: n, enqueue: r }) { try { I = (await O.result).meta.undoable || I; } catch (T) { - throw qe("form", T); + throw ze("form", T); } return E(I ? "applied" : "unchanged"); }, S = async (w, y) => { @@ -49296,16 +49327,16 @@ function uSe(e, { fields: t, scripting: n, enqueue: r }) { try { A = await r(() => m(x), y); } catch (b) { - throw x.hold?.cancel(), qe("form", b); + throw x.hold?.cancel(), ze("form", b); } return e.cancellable(y?.signal, v(x, A)); }, C = (w) => { const y = s(w); r(() => m(y)).catch((x) => { y.hold?.cancel(); - const A = qe("form", x).message; + const A = ze("form", x).message; n.surface( - { uiEffects: [], diagnostics: [], error: to(A) }, + { uiEffects: [], diagnostics: [], error: no(A) }, w.origin ); }); @@ -49314,7 +49345,7 @@ function uSe(e, { fields: t, scripting: n, enqueue: r }) { const N = () => r(async () => { k = !1; const w = n.controller(); - w && await w.transaction((y) => d(y, "user")); + w && await w.transaction((y) => f(y, "user")); }); return e.changes.onSettled((w) => { if (w.status !== "refused" || w.change.undoOf !== null || !aSe.has(w.change.label.key) || k) return; @@ -49326,7 +49357,7 @@ function uSe(e, { fields: t, scripting: n, enqueue: r }) { }), { fill: S, fillSoon: C }; } function I8(e) { - return new re( + return new te( "operation-failed", "form", e.error?.message ?? e.diagnostics[0]?.message ?? "the write failed" @@ -49350,7 +49381,7 @@ function fSe(e, { const y = wn(p, w); if (!(!y || !n.takesInput(y))) { if (y.kind === "radio") { - const x = `${Ft(y)}@${k.page.objectNumber}`; + const x = `${Kt(y)}@${k.page.objectNumber}`; if (C.has(x)) return; C.add(x); } @@ -49382,18 +49413,18 @@ function fSe(e, { if (N !== "declined") return N === "taken"; } return !1; - }, d = (p, m, v = dSe) => { + }, f = (p, m, v = dSe) => { const { backward: S, empty: C, required: k, wrap: N } = m, w = t.view(), { position: y, stops: x } = a(), A = p === null ? null : wn(w, p), b = p === null ? null : xn(w, p)?.page.objectNumber, E = A?.kind === "radio" ? x.find(($) => $.field === A && $.row.page.objectNumber === b) : void 0, I = p === null ? void 0 : y.get(p), O = I === void 0 ? null : E?.at ?? I, T = x.filter( ($) => (!C || $2(w, $.field)) && (!k || Dz($.field)) && $ !== E && !v.has(yn($.row.ref)) - ), R = ($) => O === null ? !0 : S ? $.at < O : $.at > O, M = T.filter(R), F = N ? T.filter(($) => !R($)) : [], B = S ? [...M.reverse(), ...F.reverse()] : [...M, ...F]; - for (const $ of B) { - const D = yn($.row.ref), _ = () => void d(D, m, /* @__PURE__ */ new Set([...v, D])), L = o.goTo(l($, S), !0, _); + ), R = ($) => O === null ? !0 : S ? $.at < O : $.at > O, M = T.filter(R), F = N ? T.filter(($) => !R($)) : [], _ = S ? [...M.reverse(), ...F.reverse()] : [...M, ...F]; + for (const $ of _) { + const D = yn($.row.ref), B = () => void f(D, m, /* @__PURE__ */ new Set([...v, D])), L = o.goTo(l($, S), !0, B); if (L !== "declined") return L === "taken"; } return !1; - }, f = (p = {}) => { + }, d = (p = {}) => { const { position: m } = a(), v = p.from ? yt(t.view(), p.from) : null, S = p.from ? v?.widgets.map(({ objectNumber: C }) => C).find((C) => m.has(C)) ?? null : o.focused()?.widget ?? o.last(); - return d(S, { + return f(S, { backward: p.backward ?? !1, empty: p.empty ?? !1, required: p.required ?? !1, @@ -49420,7 +49451,7 @@ function fSe(e, { return { api: { focus: u, - focusNext: f, + focusNext: d, getFocusedField: g, onFocusChanged: r.focusChanged.on, moveInGroup: h, @@ -49444,14 +49475,14 @@ function pSe(e, { groups: t }) { setGroups: (n) => { e.state.update(e1e, hSe(n)); }, - getDesignGroup: () => nm(e.state.get().designAssignment), + getDesignGroup: () => rm(e.state.get().designAssignment), getDesignAssignment: () => e.state.get().designAssignment, setDesignGroup: (n) => { - const r = Hd(iv(n)); + const r = Wd(iv(n)); n !== null && t.assertMaySet(n, "form.setDesignGroup"), e.state.update(QD, r); }, setDesignAssignment: (n) => { - const r = Hd(n); + const r = Wd(n); r.kind !== "unassigned" && t.assertMayAssign(r, "form.setDesignAssignment"), e.state.update(QD, r); }, canSetGroup: t.maySet, @@ -49463,28 +49494,28 @@ function gSe(e, { fields: t, rights: n }) { return { api: { setButtonImage: async (o, s, i) => { t.view().snapshot || await t.settled(); const a = yt(t.view(), o); - if (!a) throw new re("not-found", "form", "no form field has this ref"); + if (!a) throw new te("not-found", "form", "no form field has this ref"); if (a.kind !== "pushbutton") - throw new re("invalid-input", "form", `'${a.name}' is no push button`); - if (!au(a)) - throw new re( + throw new te("invalid-input", "form", `'${a.name}' is no push button`); + if (!cu(a)) + throw new te( "invalid-input", "form", `'${a.name}' is a push button that takes no image: only an image field does (\`takesImage\`)` ); n.assertMayFill(a, "form.setButtonImage"); - const c = s === null ? null : new Uint8Array((await Vo(s.source)).bytes); + const c = s === null ? null : new Uint8Array((await $o(s.source)).bytes); $a(i); const l = { type: "forms.setButtonImage", field: a.ref, image: c }, u = e.changes.stage({ label: { key: "form.setButtonImage" }, ops: [l], - undo: kl(t.view(), [l]) + undo: Al(t.view(), [l]) }); try { - const { items: d } = await e.cancellable(i?.signal, u.result), f = d[0]; - return { field: f?.type === "forms.setButtonImage" ? f.field : a }; - } catch (d) { - throw qe("form", d); + const { items: f } = await e.cancellable(i?.signal, u.result), d = f[0]; + return { field: d?.type === "forms.setButtonImage" ? d.field : a }; + } catch (f) { + throw ze("form", f); } } } }; } @@ -49507,7 +49538,7 @@ function mSe(e, t) { }, import: async (i, a = {}) => { const { signal: c, history: l, ...u } = a; return e.assertAllowed("doc.forms.modify", "form.import"), (u.attribution ?? "restore") === "restore" && e.assertAllowed("doc.forms.import", "form.import"), n(async () => { - const d = e.changes.stage({ + const f = e.changes.stage({ label: { key: "form.import" }, opId: u.opId, history: l, @@ -49515,7 +49546,7 @@ function mSe(e, t) { items: [{ type: "forms.import", ...v }], meta: v.meta })) - }), { items: f } = await d.result, h = f[0], g = r.annotation(); + }), { items: d } = await f.result, h = d[0], g = r.annotation(); return g && await g.whenSynced(), { fields: h.fields, refMap: h.refMap, dropped: h.dropped }; }, a); } } @@ -49546,7 +49577,7 @@ function wSe(e, { e.settings().get().fields.placeholder ], (v, S, C) => v && S && C ? { confirmed: S.widgets.filter(fO), shown: C.widgets.filter(fO) } : null - ), d = (v) => { + ), f = (v) => { const S = t.view(), C = [], k = /* @__PURE__ */ new Map(); for (const N of v) { const w = wn(S, FC(N.ref)); @@ -49554,8 +49585,8 @@ function wSe(e, { C.push({ type: "forms.deleteWidget", widget: N.ref }); continue; } - const y = k.get(Ft(w)) ?? { field: w, widgets: [] }; - y.widgets.push(N), k.set(Ft(w), y); + const y = k.get(Kt(w)) ?? { field: w, widgets: [] }; + y.widgets.push(N), k.set(Kt(w), y); } for (const { field: N, widgets: w } of k.values()) { const y = new Set(w.map((x) => FC(x.ref))); @@ -49565,7 +49596,7 @@ function wSe(e, { } return C; }; - function f(v) { + function d(v) { const S = t.view(), C = FC(v.ref), k = wn(S, C), N = xn(S, C); return k && N ? { field: k, row: N } : null; } @@ -49609,9 +49640,9 @@ function wSe(e, { const y = C.byId[w.id]; y && N.push(y.annotation); } - return [...k, ...d(N)]; + return [...k, ...f(N)]; }, - undoOf: (v) => kl(t.view(), v), + undoOf: (v) => Al(t.view(), v), reorderOps: (v, S, C) => [ { type: "forms.reorderWidgets", page: v, widgets: [...S], position: C } ], @@ -49630,7 +49661,7 @@ function wSe(e, { // confirmed (a restyle, a resize, a field just placed), and until its new picture is there. isPending: o.isPending, paintOf: (v) => { - const S = f(v); + const S = d(v); return S ? m(S.field, S.row) : null; }, toolPaintOf: (v, S) => { @@ -49665,20 +49696,20 @@ function vSe(e, { fields: t, rights: n, purposes: r }, o) { g !== void 0 && (h.assignment.kind === "anyone" ? l.push({ ref: h.ref, reason: "for-anyone" }) : $2(u, h) ? g === null || g === "" ? l.push({ ref: h.ref, reason: "no-value" }) : c.push({ ref: h.ref, value: { value: g } }) : l.push({ ref: h.ref, reason: "filled" })); } if (c.length === 0) return { applied: [], skipped: l, failed: [] }; - const { applied: d, failed: f } = await o(c, a, "form.prefill"); - return { applied: d, skipped: l, failed: f }; + const { applied: f, failed: d } = await o(c, a, "form.prefill"); + return { applied: f, skipped: l, failed: d }; } }, host: { setSigningDate: async (a) => { $a(a), t.view().snapshot || await t.settled(); const c = [], l = []; - for (const f of t.view().snapshot?.fields ?? []) { - if (f.purpose !== "date-signed" || f.kind !== "text" && f.kind !== "combobox" || !n.mayFill(f)) continue; - const h = r.valueFor(f); - typeof h == "string" && (f.assignment.kind === "anyone" ? l.push({ ref: f.ref, reason: "for-anyone" }) : f.value === h ? l.push({ ref: f.ref, reason: "filled" }) : c.push({ ref: f.ref, value: { value: h } })); + for (const d of t.view().snapshot?.fields ?? []) { + if (d.purpose !== "date-signed" || d.kind !== "text" && d.kind !== "combobox" || !n.mayFill(d)) continue; + const h = r.valueFor(d); + typeof h == "string" && (d.assignment.kind === "anyone" ? l.push({ ref: d.ref, reason: "for-anyone" }) : d.value === h ? l.push({ ref: d.ref, reason: "filled" }) : c.push({ ref: d.ref, value: { value: h } })); } if (c.length === 0) return { applied: [], skipped: l, failed: [] }; - const { applied: u, failed: d } = await o(c, a, "form.setSigningDate"); - return { applied: u, skipped: l, failed: d }; + const { applied: u, failed: f } = await o(c, a, "form.setSigningDate"); + return { applied: u, skipped: l, failed: f }; } } }; } @@ -49720,13 +49751,13 @@ const hW = (e, t, n) => { diagnostics: [] }, SSe = (e) => e.kind === "objectNumber" ? { kind: "objectNumber", objectNumber: e.objectNumber } : { kind: "name", name: e.name }; function xSe(e, t, { fill: n }) { - const { fields: r, rights: o } = t, s = (c) => c.kind !== "pushbutton" && c.kind !== "signature" && o.mayFill(c), i = async (c, l, u, d) => { + const { fields: r, rights: o } = t, s = (c) => c.kind !== "pushbutton" && c.kind !== "signature" && o.mayFill(c), i = async (c, l, u, f) => { r.view().snapshot || await r.settled(); - const { selected: f } = hW( + const { selected: d } = hW( r.view().snapshot?.fields ?? [], c, l - ), h = f.filter(s).map((g) => g.ref); + ), h = d.filter(s).map((g) => g.ref); return h.length === 0 ? null : n( { label: { key: "form.reset", count: h.length }, @@ -49734,25 +49765,25 @@ function xSe(e, t, { fill: n }) { scripts: { kind: "recalculate" }, origin: u }, - d + f ); }; return { api: { reset: async (c, l) => { - for (const d of c ?? []) { - const f = yt(r.view(), d); - f && o.assertMayFill(f, "form.reset"); + for (const f of c ?? []) { + const d = yt(r.view(), f); + d && o.assertMayFill(d, "form.reset"); } if (c && c.length === 0) return { fields: [] }; const u = await i(c ? c.map(SSe) : null, !1, "user", l); return { fields: u ? zve(u.before, u.after) : [] }; }, resetFormAction: async (c, l, u = "user") => { - const d = await i(c, l, u); - if (!d) return ASe; - const { result: f } = d; - return f.status === "unchanged" ? { ...f, status: "applied" } : f; + const f = await i(c, l, u); + if (!f) return ASe; + const { result: d } = f; + return d.status === "unchanged" ? { ...d, status: "applied" } : d; } } }; @@ -49796,16 +49827,16 @@ function ISe(e, { keyOf: t, fields: n }, r) { const o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new WeakSet(), a = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = (S) => { const C = yt(n.view(), S), k = yt(n.get(), S); return C && k ? [O8(C), O8(k)] : null; - }, u = (S, C) => s.get(S)?.draft === C, d = (S, C) => { + }, u = (S, C) => s.get(S)?.draft === C, f = (S, C) => { o.get(S) === C && o.delete(S); - }, f = (S, C) => { + }, d = (S, C) => { if (!i.has(C) || !a.has(C) || u(S, C)) return !1; const k = c.get(C); if (!k) return !1; const N = l(C.field); return !N || N.every((w) => !k.includes(w)); }, h = () => { - for (const [S, C] of o) f(S, C) && o.delete(S); + for (const [S, C] of o) d(S, C) && o.delete(S); return [...o]; }, g = (S, C) => { const k = s.get(S); @@ -49821,13 +49852,13 @@ function ISe(e, { keyOf: t, fields: n }, r) { }, p = async (S, C) => { try { const k = await g(S, C); - return k.status === "rejected" ? a.set(C, k) : d(S, C), k; + return k.status === "rejected" ? a.set(C, k) : f(S, C), k; } catch (k) { - throw i.has(C) && d(S, C), k; + throw i.has(C) && f(S, C), k; } }, m = async (S) => { const C = t(S), k = o.get(C); - return k ? f(C, k) ? (o.delete(C), null) : (i.add(k), p(C, k)) : null; + return k ? d(C, k) ? (o.delete(C), null) : (i.add(k), p(C, k)) : null; }, v = async () => Promise.all( h().map(([S, C]) => { const k = a.get(C); @@ -49861,35 +49892,35 @@ const P8 = (e, t) => ({ value: t }); function NSe(e, t, { fill: n }) { - const { validationRejected: r } = t.events, { fields: o, rights: s } = t, i = async (u, d, f, h) => { + const { validationRejected: r } = t.events, { fields: o, rights: s } = t, i = async (u, f, d, h) => { o.view().snapshot || await o.settled(); const g = yt(o.view(), u); - g && s.assertMayFill(g, f); + g && s.assertMayFill(g, d); const { result: p } = await n( { - ops: [P8(u, d)], - scripts: { kind: "commit", field: u, value: d }, + ops: [P8(u, f)], + scripts: { kind: "commit", field: u, value: f }, origin: "user" }, h ); if (p.status === "failed") throw I8(p); const m = yt(o.get(), u); - if (!m) throw new re("not-found", "form", "no form field has this ref"); + if (!m) throw new te("not-found", "form", "no form field has this ref"); return p.status === "rejected" ? (r.emit({ field: m, issues: p.diagnostics }), { field: m, status: "rejected" }) : { field: m, status: p.status }; - }, a = async (u, d, f = "form.setValues") => { + }, a = async (u, f, d = "form.setValues") => { o.view().snapshot || await o.settled(); const h = o.view(), g = [], p = []; for (const m of u) try { const v = yt(h, m.ref); - if (!v) throw new re("not-found", "form", "no form field has this ref"); - s.assertMayFill(v, f), C7(v, m.value), g.push({ ref: v.ref, value: m.value }); + if (!v) throw new te("not-found", "form", "no form field has this ref"); + s.assertMayFill(v, d), C7(v, m.value), g.push({ ref: v.ref, value: m.value }); } catch (v) { - p.push({ ref: m.ref, error: Br(qe("form", v)) }); + p.push({ ref: m.ref, error: Br(ze("form", v)) }); } if (g.length === 0) return { applied: [], failed: p }; - $a(d); + $a(f); try { const { result: m } = await n( { @@ -49897,12 +49928,12 @@ function NSe(e, t, { fill: n }) { scripts: { kind: "recalculate" }, origin: "user" }, - d + f ); if (m.status === "failed") throw I8(m); return { applied: g.map((v) => v.ref), failed: p }; } catch (m) { - const v = Br(qe("form", m)); + const v = Br(ze("form", m)); return { applied: [], failed: [...p, ...g.map(({ ref: S }) => ({ ref: S, error: v }))] @@ -49913,19 +49944,19 @@ function NSe(e, t, { fill: n }) { /** Several fields' plain values as one change, for the verbs that write them (write/prefill.ts). */ fillPlain: a, /** A text field's write, for the text being typed (write/typing.ts). */ - setText: (u, d) => i(u, { value: d }, "form.setValue"), + setText: (u, f) => i(u, { value: f }, "form.setValue"), api: { - setValue: (u, d, f) => i(u, d, "form.setValue", f), - setValues: async (u, d) => { - $a(d); - const { applied: f, failed: h } = await a(u, d); - return { applied: f, skipped: [], failed: h }; + setValue: (u, f, d) => i(u, f, "form.setValue", d), + setValues: async (u, f) => { + $a(f); + const { applied: d, failed: h } = await a(u, f); + return { applied: d, skipped: [], failed: h }; }, - importValues: async (u, d) => { - $a(d), o.view().snapshot || await o.settled(); - const f = o.view(), h = [], g = [], p = /* @__PURE__ */ new Map(); + importValues: async (u, f) => { + $a(f), o.view().snapshot || await o.settled(); + const d = o.view(), h = [], g = [], p = /* @__PURE__ */ new Map(); for (const [S, C] of Object.entries(u)) { - const k = yt(f, { kind: "fqn", name: S }); + const k = yt(d, { kind: "fqn", name: S }); if (!k) { h.push({ ref: S, reason: "the form has no field with this name" }); continue; @@ -49941,7 +49972,7 @@ function NSe(e, t, { fill: n }) { } g.push({ ref: k.ref, value: N }), p.set(JSON.stringify(k.ref), S); } - const { applied: m, failed: v } = await a(g, d); + const { applied: m, failed: v } = await a(g, f); return { applied: m, skipped: h, @@ -49958,10 +49989,10 @@ function OSe(e) { const t = qAe(e), { events: n, rights: r } = t, o = e.settings(), s = Ake(e, t), i = Wke(e, t), a = Fke(t), c = Kke(e, t, { validationOf: s.validationOf, inPageOrder: s.inPageOrder - }), l = uSe(e, t), u = NSe(e, t, l), d = ISe(e, t, u.setText), f = vSe(e, t, u.fillPlain), h = gSe(e, t), g = xSe(e, t, l), p = rSe(e, t), m = pSe(e, t), v = mSe(e, t), S = GAe(e, t, l), C = CSe(e, t, l), k = fSe(e, t, { + }), l = uSe(e, t), u = NSe(e, t, l), f = ISe(e, t, u.setText), d = vSe(e, t, u.fillPlain), h = gSe(e, t), g = xSe(e, t, l), p = rSe(e, t), m = pSe(e, t), v = mSe(e, t), S = GAe(e, t, l), C = CSe(e, t, l), k = fSe(e, t, { setValue: u.api.setValue, activateWidget: S.api.activateWidget - }), N = tu("form", [ + }), N = nu("form", [ o.api, s.api, i.api, @@ -49969,9 +50000,9 @@ function OSe(e) { c.api, c.host, u.api, - d.api, f.api, - f.host, + d.api, + d.host, h.api, g.api, p.api, @@ -50012,7 +50043,7 @@ const Ln = Ss, PSe = (e) => ({ token: Ln, scope: "document", requires: [Cn], - optional: [vt, Lr, Wo, Xa, Zt, vo], + optional: [vt, Lr, qo, Xa, tn, ko], state: Zve, settings: { defaults: lke, registered: e }, create: OSe @@ -50041,7 +50072,7 @@ const Ln = Ss, PSe = (e) => ({ designAssignment: F2, designing: !1 } -}), vs = sn("signature", { +}), vs = an("signature", { hint: "add signaturePlugin() from '@embedpdf/plugin-signature' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -50094,17 +50125,17 @@ function LSe({ onBlur: c, style: l }) { - const [u] = De(() => Yie(s)), d = wi(u.subscribe, u.get, u.get), f = Re(null); - return Ke(() => f.current ? die(f.current) : void 0, []), Ke(() => u.setConfirmed(s), [u, s]), /* @__PURE__ */ P( + const [u] = je(() => Yie(s)), f = wi(u.subscribe, u.get, u.get), d = Re(null); + return Ke(() => d.current ? die(d.current) : void 0, []), Ke(() => u.setConfirmed(s), [u, s]), /* @__PURE__ */ P( "select", { - ref: f, + ref: d, "aria-label": e, ...e2(t), multiple: r, size: Math.max(2, o.length), disabled: n, - value: r ? d : d[0] ?? "", + value: r ? f : f[0] ?? "", onFocus: a, onBlur: c, onChange: (h) => u.choose( @@ -50116,11 +50147,11 @@ function LSe({ } ); } -function zm({ visible: e, color: t }) { +function Wm({ visible: e, color: t }) { return e ? /* @__PURE__ */ P("span", { "aria-hidden": "true", "data-embedpdf-form-focus-ring": "", style: Zie(t) }) : null; } function DSe() { - const e = nu((r) => r.accent), t = M8((r) => r.focus), n = M8((r) => r.fields); + const e = ru((r) => r.accent), t = M8((r) => r.focus), n = M8((r) => r.fields); return ft(() => jie({ focus: t, fields: n }, e), [e, t, n]); } function jSe(e, t = !0) { @@ -50152,14 +50183,14 @@ function FSe(e, t) { }; }, [n, e]); } -function Wm(e) { +function qm(e) { const t = bt(Ln), n = Re(e); return n.current = e, fi(() => { const r = n.current; r && t.activateWidget(r); }, [t]); } -function cu({ +function lu({ item: e, page: t, colors: n, @@ -50170,7 +50201,7 @@ function cu({ children: a, ...c }) { - const l = bt(Ln), u = Et(pW), { onPress: d, ...f } = FSe(e.fieldRef, e.annotationRef), h = jSe(d, !u), g = zo(e.box, t.transform), p = e.annotationRef, m = wt(Ln, (C) => C.getLayerMode() === "fill"), v = !e.disabled && !u && m, S = e.control === "toggle" && e.kind === "radio"; + const l = bt(Ln), u = Ct(pW), { onPress: f, ...d } = FSe(e.fieldRef, e.annotationRef), h = jSe(f, !u), g = Wo(e.box, t.transform), p = e.annotationRef, m = wt(Ln, (C) => C.getLayerMode() === "fill"), v = !e.disabled && !u && m, S = e.control === "toggle" && e.kind === "radio"; return Ke( () => h.current && p && v ? Vae(h.current, l, p, { radio: S, custom: s, focusable: o }) : void 0, [h, l, p, v, S, s, o] @@ -50206,13 +50237,13 @@ function cu({ "div", { ref: h, - ...f, + ...d, ...c, onFocus: (C) => { - f.onFocus?.(C), c.onFocus?.(C); + d.onFocus?.(C), c.onFocus?.(C); }, onBlur: (C) => { - f.onBlur?.(C), c.onBlur?.(C); + d.onBlur?.(C), c.onBlur?.(C); }, onClick: i, style: { ...LB(e, g, n, { edge: r }), ...c.style }, @@ -50221,7 +50252,7 @@ function cu({ ); } function H2({ item: e, page: t }) { - const n = wt(Ln, (o) => o.getSettings().fields.placeholder), r = zo(e.box, t.transform); + const n = wt(Ln, (o) => o.getSettings().fields.placeholder), r = Wo(e.box, t.transform); return /* @__PURE__ */ P( "span", { @@ -50233,13 +50264,13 @@ function H2({ item: e, page: t }) { ); } function gW(e) { - const [t, n] = De(!1); + const [t, n] = je(!1); return Ke(() => { e || n(!1); }, [e]), [t && e, n]; } const VSe = Ei(function({ item: t, page: n, colors: r }) { - const o = bt(Ln), s = Wm(t.annotationRef), i = ft( + const o = bt(Ln), s = qm(t.annotationRef), i = ft( () => Jie(o, t.fieldRef, t.value), // eslint-disable-next-line react-hooks/exhaustive-deps [o, t.key] @@ -50249,11 +50280,11 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { i.getState ); Ke(() => i.setValue(t.value), [i, t.value]); - const l = zo(t.box, n.transform); - zt(Xa, (f) => f.getPaintFontsEpoch(), 0); + const l = Wo(t.box, n.transform); + Gt(Xa, (d) => d.getPaintFontsEpoch(), 0); const u = t.annotationRef ? o.getTextEditorLayout(t.annotationRef, c) : null; D2(u ? u.programs : bW); - const d = { + const f = { value: c, maxLength: t.maxLength ?? void 0, "aria-label": t.label, @@ -50265,10 +50296,10 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { ...e2(t.required), disabled: t.disabled, onFocus: i.focus, - onChange: (f) => i.input(f.target.value), + onChange: (d) => i.input(d.target.value), onBlur: i.blur, - onKeyDown: (f) => { - i.keyDown(f.key, t.multiline) && f.currentTarget.blur(); + onKeyDown: (d) => { + i.keyDown(d.key, t.multiline) && d.currentTarget.blur(); }, style: Qie(t, l, r, a, u) }; @@ -50276,7 +50307,7 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { // A click runs the widget's action too, as in Acrobat: the editor's // focus click bubbles here, a read-only field's lands here directly. /* @__PURE__ */ P( - cu, + lu, { item: t, page: n, @@ -50284,7 +50315,7 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { onClick: s, title: t.hint ?? void 0, children: [ - t.multiline ? /* @__PURE__ */ P("textarea", { ...d }) : /* @__PURE__ */ P("input", { ...d, type: t.password ? "password" : "text" }), + t.multiline ? /* @__PURE__ */ P("textarea", { ...f }) : /* @__PURE__ */ P("input", { ...f, type: t.password ? "password" : "text" }), t.placeholder !== null && c === "" ? /* @__PURE__ */ P(H2, { item: t, page: n }) : null ] } @@ -50295,9 +50326,9 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { page: n, colors: r }) { - const o = bt(Ln), s = Wm(t.annotationRef), [i, a] = De(!1), c = () => Gie(o, t, s), l = t.kind === "radio" ? t.inGroup : null; + const o = bt(Ln), s = qm(t.annotationRef), [i, a] = je(!1), c = () => Gie(o, t, s), l = t.kind === "radio" ? t.inGroup : null; return /* @__PURE__ */ P( - cu, + lu, { item: t, page: n, @@ -50316,7 +50347,7 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { (u.key === " " || u.key === "Enter") && (u.preventDefault(), c()); }, style: { cursor: t.disabled ? "default" : "pointer", outline: "none" }, - children: /* @__PURE__ */ P(zm, { visible: i, color: r.focus }) + children: /* @__PURE__ */ P(Wm, { visible: i, color: r.focus }) } ); }), USe = Ei(function({ @@ -50324,9 +50355,9 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { page: n, colors: r }) { - const o = bt(Ln), s = Wm(t.annotationRef), [i, a] = De(!1); + const o = bt(Ln), s = qm(t.annotationRef), [i, a] = je(!1); return /* @__PURE__ */ P( - cu, + lu, { item: t, page: n, @@ -50358,7 +50389,7 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { } ), t.placeholder !== null ? /* @__PURE__ */ P(H2, { item: t, page: n }) : null, - /* @__PURE__ */ P(zm, { visible: i, color: r.focus }) + /* @__PURE__ */ P(Wm, { visible: i, color: r.focus }) ] } ); @@ -50367,11 +50398,11 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { page: n, colors: r }) { - const o = bt(Ln), s = Wm(t.annotationRef), [i, a] = De(!1), c = zo(t.box, n.transform), l = wt( + const o = bt(Ln), s = qm(t.annotationRef), [i, a] = je(!1), c = Wo(t.box, n.transform), l = wt( Ln, (u) => t.annotationRef ? u.getWidgetFontCss(t.annotationRef) : null ); - return D2(l ? l.programs : bW), /* @__PURE__ */ P(cu, { item: t, page: n, colors: r, edge: !1, onClick: s, children: [ + return D2(l ? l.programs : bW), /* @__PURE__ */ P(lu, { item: t, page: n, colors: r, edge: !1, onClick: s, children: [ /* @__PURE__ */ P( LSe, { @@ -50389,16 +50420,16 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { style: Xie(t, c, r, l) } ), - /* @__PURE__ */ P(zm, { visible: i, color: r.focus }) + /* @__PURE__ */ P(Wm, { visible: i, color: r.focus }) ] }); }), HSe = Ei(function({ item: t, page: n, colors: r }) { - const o = Wm(t.annotationRef), [s, i] = De(!1); + const o = qm(t.annotationRef), [s, i] = je(!1); return /* @__PURE__ */ P( - cu, + lu, { item: t, page: n, @@ -50422,7 +50453,7 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { } } ), - /* @__PURE__ */ P(zm, { visible: s && !t.disabled, color: r.focus }) + /* @__PURE__ */ P(Wm, { visible: s && !t.disabled, color: r.focus }) ] } ); @@ -50431,13 +50462,13 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { page: n, colors: r }) { - const o = Rt(vs), s = t.fieldRef, i = zt( + const o = Bt(vs), s = t.fieldRef, i = Gt( vs, (u) => u.getSignature(s)?.signed ?? t.signed, t.signed ), a = o !== null && (i || !t.disabled), [c, l] = gW(a); return /* @__PURE__ */ P( - cu, + lu, { item: t, page: n, @@ -50458,7 +50489,7 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { } ) : null, t.placeholder !== null ? /* @__PURE__ */ P(H2, { item: t, page: n }) : null, - /* @__PURE__ */ P(zm, { visible: c, color: r.focus }) + /* @__PURE__ */ P(Wm, { visible: c, color: r.focus }) ] } ); @@ -50467,9 +50498,9 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { page: n, colors: r }) { - const o = Rt(vs), s = o !== null && !t.disabled, [i, a] = gW(s); + const o = Bt(vs), s = o !== null && !t.disabled, [i, a] = gW(s); return /* @__PURE__ */ P( - cu, + lu, { item: t, page: n, @@ -50490,7 +50521,7 @@ const VSe = Ei(function({ item: t, page: n, colors: r }) { } ) : null, t.placeholder !== null ? /* @__PURE__ */ P(H2, { item: t, page: n }) : null, - /* @__PURE__ */ P(zm, { visible: i, color: r.focus }) + /* @__PURE__ */ P(Wm, { visible: i, color: r.focus }) ] } ); @@ -50518,20 +50549,20 @@ const qSe = (e, t) => e === t ? !0 : !e || !t ? !1 : e.kind === "picture" ? t.ki colors: o, look: s }) { - const i = bt(Ln), a = Wm(t.annotationRef), c = wt(Ln, (g) => g.isWidgetFocused(t.ref)), l = Uae(t, r.transform), u = Re({ form: i, field: t.fieldRef, activate: a }); + const i = bt(Ln), a = qm(t.annotationRef), c = wt(Ln, (g) => g.isWidgetFocused(t.ref)), l = Uae(t, r.transform), u = Re({ form: i, field: t.fieldRef, activate: a }); u.current = { form: i, field: t.fieldRef, activate: a }; - const d = ft( + const f = ft( () => Hae( (g) => u.current.form.setValue(u.current.field, g), () => u.current.activate() ), [] - ), f = n.component, h = /* @__PURE__ */ P("div", { style: l.nativeStyle, children: [ + ), d = n.component, h = /* @__PURE__ */ P("div", { style: l.nativeStyle, children: [ s && yW(s, t.rect, l.pictureStyle), /* @__PURE__ */ P(pW.Provider, { value: !0, children: mW(t, r, o) }) ] }); return /* @__PURE__ */ P( - cu, + lu, { item: t, page: r, @@ -50539,15 +50570,15 @@ const qSe = (e, t) => e === t ? !0 : !e || !t ? !1 : e.kind === "picture" ? t.ki edge: !1, custom: !0, onClick: (g) => { - !Wae(g.nativeEvent) && Kae(t) && d.click(); + !Wae(g.nativeEvent) && Kae(t) && f.click(); }, children: /* @__PURE__ */ P("div", { style: l.frameStyle, children: /* @__PURE__ */ P( - f, + d, { widget: t, frame: l.frame, native: h, - setValue: d.setValue, + setValue: f.setValue, focused: c } ) }) @@ -50558,27 +50589,27 @@ function JSe(e, t) { return e.item === t.item && e.control === t.control && e.page === t.page && e.colors === t.colors && qSe(e.look, t.look); } function YSe({ controls: e }) { - const t = qo(), n = bt(Ln), r = DSe(), o = wt(Ln, (d) => d.getLayerMode()); + const t = Go(), n = bt(Ln), r = DSe(), o = wt(Ln, (f) => f.getLayerMode()); M9(t.ref, "formFields"), Ke(() => { n.ensureLoaded(t.ref); }, [n, t.ref]); const s = wt( Ln, - (d) => d.listWidgets(t.ref), + (f) => f.listWidgets(t.ref), pi ), i = ZSe(t), a = o === "design" ? QSe : s, c = ft(() => { - const d = /* @__PURE__ */ new Map(); + const f = /* @__PURE__ */ new Map(); if (e?.length) - for (const f of a) { - const h = $ae(f, e); - h && d.set(oe(f.ref), h); + for (const d of a) { + const h = $ae(d, e); + h && f.set(oe(d.ref), h); } - return d; + return f; }, [a, e]), l = ft( - () => c.size === 0 ? i : i.filter(({ key: d }) => !c.has(d)), + () => c.size === 0 ? i : i.filter(({ key: f }) => !c.has(f)), [i, c] ), u = ft( - () => c.size === 0 ? XSe : new Map(i.map(({ key: d, look: f }) => [d, f])), + () => c.size === 0 ? XSe : new Map(i.map(({ key: f, look: d }) => [f, d])), [i, c] ); return /* @__PURE__ */ P( @@ -50588,19 +50619,19 @@ function YSe({ controls: e }) { ...o === "show" ? w5 : {}, children: [ /* @__PURE__ */ P(exe, { page: t, looks: l }), - a.map((d) => { - const f = `${d.key}:${d.annotObjectNumber}`, h = oe(d.ref), g = c.get(h); + a.map((f) => { + const d = `${f.key}:${f.annotObjectNumber}`, h = oe(f.ref), g = c.get(h); return g ? /* @__PURE__ */ P( GSe, { - item: d, + item: f, control: g, page: t, colors: r, look: u.get(h) ?? null }, - f - ) : mW(d, t, r, f); + d + ) : mW(f, t, r, d); }) ] } @@ -50612,11 +50643,11 @@ function ZSe(e) { Ln, (c) => c.listShownWidgets(e.ref), pi - ), r = wt(Ln, (c) => c.getAppearanceEpoch(e.ref)), o = zt( + ), r = wt(Ln, (c) => c.getAppearanceEpoch(e.ref)), o = Gt( Pr, (c) => c.getAppearanceScale(e.transform.renderScale), 0 - ), [s, i] = De(null), [a] = De(KU); + ), [s, i] = je(null), [a] = je(KU); return Ke(() => () => a.release(), [a]), Ke(() => { if (o) return HU( @@ -50649,7 +50680,7 @@ const exe = Ei(function({ }) { return /* @__PURE__ */ P(nt, { children: n.map(({ key: r, widget: o, look: s }) => { if (!s) return null; - const i = zo(o.rect, t.transform); + const i = Wo(o.rect, t.transform); return yW( s, o.rect, @@ -50695,8 +50726,8 @@ function yW(e, t, n, r) { ); } const bW = Object.freeze([]); -wo(TSe); -const M8 = jm(Ss); +vo(TSe); +const M8 = Fm(Ss); function txe(e) { const t = e.borderStyle === "beveled" || e.borderStyle === "inset"; return Math.max(0, e.borderWidth) * (t ? 2 : 1); @@ -50722,34 +50753,34 @@ function nxe(e, t) { } const rxe = "signature:armed-mark", oxe = 30, sxe = (e, t) => e.page.objectNumber === t.page.objectNumber && e.rot === t.rot && (e.into && oe(e.into)) === (t.into && oe(t.into)) && e.box.x === t.box.x && e.box.y === t.box.y && e.box.width === t.box.width && e.box.height === t.box.height; function ixe(e, t, n, r, o = null, s = null) { - const i = (d, f) => n.listWidgets(d).find((h) => h.annotObjectNumber === f.annotObjectNumber) ?? null, a = (d, f) => f.field.kind === "signature" && (t.getSignature(f.field.ref)?.signed === !0 || f.field.valueEntry.kind !== "none") || (i(d, f)?.disabled ?? !0), c = (d) => { - if (!d.page) return null; - const f = r.getArmedAsset(e); - if (!f || r.getLibrary(f.libraryId)?.kind !== _5) + const i = (f, d) => n.listWidgets(f).find((h) => h.annotObjectNumber === d.annotObjectNumber) ?? null, a = (f, d) => d.field.kind === "signature" && (t.getSignature(d.field.ref)?.signed === !0 || d.field.valueEntry.kind !== "none") || (i(f, d)?.disabled ?? !0), c = (f) => { + if (!f.page) return null; + const d = r.getArmedAsset(e); + if (!d || r.getLibrary(d.libraryId)?.kind !== _5) return null; - const h = n.getWidgetAt(d.page.ref, d.page.point); - return h && (h.field.kind === "signature" || h.imageBox) ? { page: d.page.ref, hit: h, assetId: f.id } : null; + const h = n.getWidgetAt(f.page.ref, f.page.point); + return h && (h.field.kind === "signature" || h.imageBox) ? { page: f.page.ref, hit: h, assetId: d.id } : null; }; let l = null; - const u = (d, f) => { - (d === null || l === null || !sxe(d, l)) && (l = d), o?.hoverGhostIn(l), s?.claimCursor(rxe, f ? "not-allowed" : null, oxe); + const u = (f, d) => { + (f === null || l === null || !sxe(f, l)) && (l = f), o?.hoverGhostIn(l), s?.claimCursor(rxe, d ? "not-allowed" : null, oxe); }; return { id: "signature:armed-mark-on-field", priority: rz + 1, - enabledFor: (d) => d.id === Vd, - onHover: (d) => { - const f = c(d); - if (!f) return u(null, !1); - const { page: h, hit: g } = f; + enabledFor: (f) => f.id === Ud, + onHover: (f) => { + const d = c(f); + if (!d) return u(null, !1); + const { page: h, hit: g } = d; if (a(h, g)) return u(null, !0); const p = i(h, g), m = o?.getArmedStamp(), v = p && m ? nxe(p, m) : null; u(v && p && { page: h, box: v.box, rot: v.rot, into: p.ref }, !1); }, - onPointerDown: (d) => { - const f = c(d); - if (!f) return !1; - const { page: h, hit: g, assetId: p } = f; + onPointerDown: (f) => { + const d = c(f); + if (!d) return !1; + const { page: h, hit: g, assetId: p } = d; return a(h, g) || (r.disarm(e), t.placeMark({ assetId: p }, { field: g.field.ref }).catch((m) => globalThis.console?.error("[signature] placing the mark failed:", m))), !0; } }; @@ -50769,34 +50800,33 @@ function axe(e, t) { ) ); } -const qr = (e) => async (...t) => { +const Gr = (e) => async (...t) => { try { return await e(...t); } catch (n) { - throw qe("signature", n); + throw ze("signature", n); } }; -function cxe(e, { store: t }, { validate: n }, r, { findSignature: o, getVerdict: s }) { +function cxe(e, { store: t }, { validate: n }, r, { findSignature: o, findVerdict: s }) { const { requireSignatures: i } = t; return { api: { - refresh: qr(async (a) => { + refresh: Gr(async (a) => { await e.cancellable(a?.signal, r.refresh()); }), - validate: qr(n), - validateField: qr( + validate: Gr(n), + validateField: Gr( async (a, c) => { - await n(c); - const l = s(a); + const l = s(a, await n(c)); if (!l) - throw new re("not-found", "signature", "no signed field at that address"); + throw new te("not-found", "signature", "no signed field at that address"); return l; } ), - analyzeChanges: qr( + analyzeChanges: Gr( async (a, c) => e.cancellable(c?.signal, i().analyze(a)) ), - readRevision: qr( + readRevision: Gr( async (a, c) => { e.assertAllowed("doc.download", "signature.readRevision"); const l = i(); @@ -50804,10 +50834,10 @@ function cxe(e, { store: t }, { validate: n }, r, { findSignature: o, getVerdict if ("revisionIndex" in a) u = a.revisionIndex; else { - const d = o(a); - if (!d?.signed || d.revisionIndex === null) - throw new re("not-found", "signature", "no signed revision at that address"); - u = d.revisionIndex; + const f = o(a); + if (!f?.signed || f.revisionIndex === null) + throw new te("not-found", "signature", "no signed revision at that address"); + u = f.revisionIndex; } return e.cancellable(c?.signal, l.downloadRevision(u)); } @@ -50880,45 +50910,45 @@ const L8 = [], yxe = [], bxe = (e) => !("kind" in e) || e.kind === "objectNumber function vxe(e, { authority: t, siblings: n }, r) { const { form: o } = n, s = () => r.get().snapshot, i = tt( () => [s(), e.state.get().verdicts], - (d, f) => { + (d, h) => { if (!d) return { all: L8, signed: L8, unsigned: yxe }; - const h = (p) => f?.find((m) => m.signature.index === p.index) ?? null, g = d.signatures.map( - (p) => ({ ...p, verdict: h(p) }) + const g = (m) => h?.find((v) => v.signature.index === m.index) ?? null, p = d.signatures.map( + (m) => ({ ...m, verdict: g(m) }) ); return { - all: g, - signed: g.filter((p) => p.signed), - unsigned: d.signatures.filter((p) => !p.signed).map((p) => p.field) + all: p, + signed: p.filter((m) => m.signed), + unsigned: d.signatures.filter((m) => !m.signed).map((m) => m.field) }; } ), a = () => i().unsigned.filter((d) => t.canSign(d)), c = (d) => { - const f = s(); - if (!f) return null; - const h = bxe(d); - if (h) { - const g = f.signatures.find( - (m) => m.widget?.objectNumber === h.objectNumber + const h = s(); + if (!h) return null; + const g = bxe(d); + if (g) { + const p = h.signatures.find( + (v) => v.widget?.objectNumber === g.objectNumber ); - if (g) return g; - const p = o.getFieldForWidget(h); - return p ? c(p.ref) : null; + if (p) return p; + const m = o.getFieldForWidget(g); + return m ? c(m.ref) : null; } - return wxe(d) ? f.signatures.find( - (g) => d.kind === "fqn" ? g.fieldName === d.name : Rv(g.field, d) + return wxe(d) ? h.signatures.find( + (p) => d.kind === "fqn" ? p.fieldName === d.name : Rv(p.field, d) ) ?? null : null; }, l = (d) => { - const f = c(d); - return f ? i().all.find((h) => h.index === f.index) ?? null : null; - }, u = (d) => { - const f = c(d); - return f ? e.state.get().verdicts?.find((h) => h.signature.index === f.index) ?? null : null; - }; + const h = c(d); + return h ? i().all.find((g) => g.index === h.index) ?? null : null; + }, u = (d, h) => { + const g = c(d); + return g ? h?.find((p) => p.signature.index === g.index) ?? null : null; + }, f = (d) => u(d, e.state.get().verdicts); return { snapshot: s, findSignature: c, listOwnUnsigned: a, - getVerdict: u, + findVerdict: u, api: { getSnapshot: s, getStatus: r.getStatus, @@ -50926,7 +50956,7 @@ function vxe(e, { authority: t, siblings: n }, r) { listUnsignedFields: () => i().unsigned, getSignature: l, listVerdicts: () => e.state.get().verdicts, - getVerdict: u, + getVerdict: f, getProtection: () => s()?.protection ?? null, getPending: () => r.get().pending, isBusy: () => e.state.get().busy, @@ -50943,24 +50973,24 @@ function kxe(e, { form: t }) { }, o = async (l) => { const u = l ?? n.get().signingKey; if (!u) - throw new re( + throw new te( "invalid-input", "signature", "no key: set the `key` setting or pass one with the call" ); return typeof u == "function" ? u() : u; }, s = (l) => l === void 0 ? n.get().timestampAuthority : l, i = () => n.get().trust ?? void 0, a = (l, u) => { - const d = t.get(u); - return d !== null && e.allowsField(l, d); + const f = t.get(u); + return f !== null && e.allowsField(l, f); }; return { mode: r, resolveKey: o, resolveTimestampAuthority: s, timestampTrust: i, - assertAllowedField: (l, u, d) => { - const f = t.get(u); - f && e.assertAllowedField(l, f, d); + assertAllowedField: (l, u, f) => { + const d = t.get(u); + d && e.assertAllowedField(l, d, f); }, canSign: (l) => a("sign", l), // A mark in a signature field is its signer's to place: what the engine asks for. @@ -50996,11 +51026,11 @@ function Axe(e) { }), t; } function Sxe({ stamp: e }) { - const t = async (r) => new Uint8Array((await Vo(r)).bytes); + const t = async (r) => new Uint8Array((await $o(r)).bytes); return { bytesOf: t, markBytes: async (r) => { if ("assetId" in r) { const o = e()?.getAssetBytes(r.assetId); - if (!o) throw new re("not-found", "signature", `unknown mark '${r.assetId}'`); + if (!o) throw new te("not-found", "signature", `unknown mark '${r.assetId}'`); return o; } return t(r.source); @@ -51025,7 +51055,7 @@ function Exe(e) { }, requireSignatures: () => { const s = e.doc.signatures; if (!s) - throw new re( + throw new te( "unsupported", "signature", "this engine does not implement signatures" @@ -51033,7 +51063,7 @@ function Exe(e) { return s; }, documentId: () => { const s = e.documentId; - if (!s) throw new re("not-ready", "signature", "no document id"); + if (!s) throw new te("not-ready", "signature", "no document id"); return s; } }; } @@ -51071,13 +51101,13 @@ function Pxe(e, { events: t }, { validateNow: n, revalidateSoon: r }) { }; }, fold: mxe, - onChanged: ({ cause: c, event: l, previous: u, next: d }) => { - const f = d.snapshot?.protection ?? null; - f && !Oxe(u.snapshot?.protection ?? null, f) && s.emit({ protection: f }), l?.type === "signatures.completed" && o.emit({ + onChanged: ({ cause: c, event: l, previous: u, next: f }) => { + const d = f.snapshot?.protection ?? null; + d && !Oxe(u.snapshot?.protection ?? null, d) && s.emit({ protection: d }), l?.type === "signatures.completed" && o.emit({ field: l.signature.field, result: hxe(l), origin: l.origin - }), bO(d.snapshot) && (c === "load" ? n() : u.snapshot !== d.snapshot && r()); + }), bO(f.snapshot) && (c === "load" ? n() : u.snapshot !== f.snapshot && r()); } }); return { @@ -51098,39 +51128,54 @@ function Pxe(e, { events: t }, { validateNow: n, revalidateSoon: r }) { } const Rxe = 300; function Txe(e, { events: t }) { - const { validated: n } = t, r = e.settings(), o = async (c) => { - if (!e.doc.signatures) return []; - const { validateSignatures: l } = await e.cancellable( - c?.signal, - import("./index-BCXWVSWX.js") - ), u = await e.cancellable( - c?.signal, - l(e.doc, { + const { validated: n } = t, r = e.settings(), o = e.latest("validation"), s = (d, h) => e.cancellable(d, e.whileOpen(h)), i = async (d) => { + if (!e.doc.signatures) return null; + const { validateSignatures: h } = await s( + d.signal, + import("./index-Cp6ojw-X.js") + ); + return s( + d.signal, + h(e.doc, { trust: r.get().trust, - validationTime: c?.validationTime, - until: c?.until ?? "working-copy" + validationTime: d.validationTime, + until: d.until ?? "working-copy" }) ); - return e.state.update(uxe, u), n.emit({ verdicts: u }), u; + }, a = (d) => { + e.state.update(uxe, d), e.isOpen() && n.emit({ verdicts: d }); + }, c = async (d = {}) => { + const h = await i(d); + if (!h) return []; + if (!e.isOpen()) + throw new te( + "instance-closed", + "signature", + "the document closed during validate()" + ); + return a(h), h; }; - let s = null; - const i = () => { - s?.(), s = null; - }, a = () => { - o().catch( - (c) => globalThis.console?.error("[signature] validation failed:", c) - ); + let l = null; + const u = () => { + l?.(), l = null; + }, f = () => { + o.run(async (d) => { + const h = await i({ signal: d.signal }); + h && d.commit(() => a(h)); + }).catch((d) => { + Xn(d, "operation-cancelled") || Xn(d, "instance-closed") || globalThis.console?.error("[signature] validation failed:", d); + }); }; return { - validate: o, + validate: c, /** Judge now; a scheduled re-judgement is superseded. */ validateNow: () => { - i(), a(); + u(), f(); }, /** Judge once the edits pause. */ revalidateSoon: () => { - i(), s = e.clock.after(Rxe, () => { - s = null, a(); + u(), l = e.clock.after(Rxe, () => { + l = null, f(); }); } }; @@ -51142,35 +51187,35 @@ function Mxe(e, { authority: o, siblings: s }, { findSignature: i }, a) { - const { filled: c, cleared: l } = t, { withBusy: u } = n, { markBytes: d } = r, f = async (m, v, S) => { + const { filled: c, cleared: l } = t, { withBusy: u } = n, { markBytes: f } = r, d = async (m, v, S) => { if (!e.doc.forms.setSignatureAppearance) - throw new re( + throw new te( "unsupported", "signature", "this engine cannot draw into a signature field" ); const k = i(m); if (k?.signed) - throw new re("conflict", "signature", `'${k.fieldName}' is signed`); + throw new te("conflict", "signature", `'${k.fieldName}' is signed`); if (S?.signal?.aborted) - throw new re("operation-cancelled", "signature", "cancelled", { + throw new te("operation-cancelled", "signature", "cancelled", { cause: S.signal.reason }); const N = { type: "forms.setSignatureAppearance", field: m, appearance: v }, w = { key: v ? "signature.fillField" : "signature.clearField" }; await e.cancellable(S?.signal, e.changes.stage({ label: w, ops: [N] }).result); }, h = async (m, v, S) => (o.assertAllowedField("sign", m, "signature.fillField"), u(async () => { - await f(m, await d(v), S), a.clearIfTarget(m), c.emit({ field: m }); + await d(m, await f(v), S), a.clearIfTarget(m), c.emit({ field: m }); })), g = async (m, v, S) => u(async () => { - await s.form.setButtonImage(m, { source: await d(v) }, S), a.clearIfTarget(m), c.emit({ field: m }); + await s.form.setButtonImage(m, { source: await f(v) }, S), a.clearIfTarget(m), c.emit({ field: m }); }), p = async (m, v) => (o.assertAllowedField("sign", m, "signature.clearField"), u(async () => { - await f(m, null, v), l.emit({ field: m }); + await d(m, null, v), l.emit({ field: m }); })); return { fillField: h, fillImageField: g, api: { - fillField: qr(h), - clearField: qr(p) + fillField: Gr(h), + clearField: Gr(p) } }; } @@ -51190,20 +51235,20 @@ const j8 = (e) => e.filter( function Dxe(e, { store: t, siblings: n, authority: r }, { snapshot: o, findSignature: s, listOwnUnsigned: i, api: a }, { mirror: c }, { seal: l, writeTyping: u, - assertMaySign: d, - cancelled: f + assertMaySign: f, + cancelled: d }) { const { withBusy: h } = t, { form: g } = n, { resolveKey: p } = r, m = e.settings(); let v = !1; const S = (b) => { const E = b ?? i()[0]; if (!E) - throw new re("not-found", "signature", "no signature field is left for you to sign"); + throw new te("not-found", "signature", "no signature field is left for you to sign"); const I = s(E); if (!I) - throw new re("not-found", "signature", "no signature field at that address"); + throw new te("not-found", "signature", "no signature field at that address"); if (I.signed) - throw new re("conflict", "signature", `'${I.fieldName}' is signed`); + throw new te("conflict", "signature", `'${I.fieldName}' is signed`); return { field: I.field, name: I.fieldName }; }, C = (b, E, I) => { const O = E && !b.missing.some((R) => R.name === E.name) ? [...b.missing, E] : b.missing, T = [ @@ -51217,7 +51262,7 @@ function Dxe(e, { store: t, siblings: n, authority: r }, { snapshot: o, findSign }, N = async (b) => { const I = (await g.setSigningDate({ signal: b })).failed[0]; if (I) - throw new re(I.error.code, "signature", I.error.message, { + throw new te(I.error.code, "signature", I.error.message, { details: { field: I.ref } }); }, w = (b, E, I) => { @@ -51228,8 +51273,8 @@ function Dxe(e, { store: t, siblings: n, authority: r }, { snapshot: o, findSign const T = I ?? j8(g.getSnapshot()?.fields ?? []); return { lock: T.length > 0 ? { action: "include", fields: [...T] } : void 0, own: T }; }, y = async (b, E, I) => { - const O = await g.validateConfirmed({ signal: I }), { fields: T } = O.snapshot, R = T.find((B) => B.name === b); - if (!R) throw new re("not-found", "signature", `'${b}' is no longer a field`); + const O = await g.validateConfirmed({ signal: I }), { fields: T } = O.snapshot, R = T.find((_) => _.name === b); + if (!R) throw new te("not-found", "signature", `'${b}' is no longer a field`); const M = C( O, Lxe(O.snapshot, R) ? null : R, @@ -51239,8 +51284,8 @@ function Dxe(e, { store: t, siblings: n, authority: r }, { snapshot: o, findSign const F = j8(T); return E.own && !_xe(E.own, F) ? { status: "changed", filled: F } : null; }, x = async (b, E, I, { lock: O, signal: T, ...R }, M) => { - const F = await u(), B = F.length > 0 ? await k(b, T, F) : null; - if (B) return B; + const F = await u(), _ = F.length > 0 ? await k(b, T, F) : null; + if (_) return _; const $ = w(b, O, M); try { const D = await l( @@ -51248,8 +51293,8 @@ function Dxe(e, { store: t, siblings: n, authority: r }, { snapshot: o, findSign { signal: T }, { afterPrepare: async () => { - const _ = await y(E, $, T); - if (_) throw new D8(_); + const B = await y(E, $, T); + if (B) throw new D8(B); } } ); @@ -51259,22 +51304,22 @@ function Dxe(e, { store: t, siblings: n, authority: r }, { snapshot: o, findSign throw D; } }; - return { api: { finish: qr(async (b = {}) => { + return { api: { finish: Gr(async (b = {}) => { const { field: E, signingKey: I, ...O } = b, { signal: T } = O; - if (T?.aborted) throw f(T); + if (T?.aborted) throw d(T); o() || await e.cancellable(T, c.settled()), g.getSnapshot() || await g.refresh({ signal: T }); const { field: R, name: M } = S(E); - if (d({ field: R, certify: O.certify }, "signature.finish"), v) - throw new re("conflict", "signature", "another finish() is running"); + if (f({ field: R, certify: O.certify }, "signature.finish"), v) + throw new te("conflict", "signature", "another finish() is running"); const F = a.getPending(); if (F) - throw new re( + throw new te( "conflict", "signature", `a signing is pending (${F.signingId}); complete or cancel it first` ); if (!I && !m.get().signingKey) - throw new re( + throw new te( "invalid-input", "signature", "no key: set the `key` setting or pass one with the call" @@ -51283,17 +51328,17 @@ function Dxe(e, { store: t, siblings: n, authority: r }, { snapshot: o, findSign try { return await h(async () => { await N(T); - const B = await k(R, T, await u()); - if (B) return B; + const _ = await k(R, T, await u()); + if (_) return _; const $ = await e.cancellable(T, p(I)); - await e.cancellable(T, import("./index-BCXWVSWX.js")), await N(T); + await e.cancellable(T, import("./index-Cp6ojw-X.js")), await N(T); let D = null; - for (let _ = 0; _ < Bxe; _ += 1) { + for (let B = 0; B < Bxe; B += 1) { const L = await x(R, M, $, O, D); if (L.status !== "changed") return L; ({ filled: D } = L); } - throw new re( + throw new te( "conflict", "signature", "the form kept changing while it was being signed; nothing is signed" @@ -51330,13 +51375,13 @@ function Fxe(e, { fillField: a, fillImageField: c }) { - const { signRequested: l } = t, { documentId: u } = n, { mode: d } = r, { stamp: f, annotation: h, form: g } = o, p = e.settings(); - return { api: { placeMark: qr(async (v, S, C) => { + const { signRequested: l } = t, { documentId: u } = n, { mode: f } = r, { stamp: d, annotation: h, form: g } = o, p = e.settings(); + return { api: { placeMark: Gr(async (v, S, C) => { if (!("field" in S)) { if ("assetId" in v) { - const y = f(); + const y = d(); if (!y) - throw new re("unsupported", "signature", "no stamp plugin to place an asset"); + throw new te("unsupported", "signature", "no stamp plugin to place an asset"); return { status: "placed", annotation: (await y.placeAsset(v.assetId, S, { documentId: u(), signal: C?.signal @@ -51344,20 +51389,20 @@ function Fxe(e, { } const N = h(); if (!N) - throw new re("unsupported", "signature", "no annotation plugin to place a mark"); + throw new te("unsupported", "signature", "no annotation plugin to place a mark"); return { status: "placed", annotation: (await N.stamps.place({ source: v.source }, S, C)).annotation.ref }; } const k = g.get(S.field); if (k?.kind === "pushbutton") { if (!k.takesImage) - throw new re( + throw new te( "invalid-input", "signature", `'${k.name}' is a push button that takes no image, so no mark goes into it` ); return await c(S.field, v, C), { status: "filled", field: S.field }; } - switch (d()) { + switch (f()) { case "sign": return p.get().allowCertify && !bO(s()) ? (l.emit({ field: S.field, mark: v }), { status: "requested", field: S.field }) : { status: "signed", @@ -51379,7 +51424,7 @@ function Vxe(e, { marks: r, siblings: o }, { api: s }, i, a, { afterSeal: c }) { - const { withBusy: l, requireSignatures: u } = t, { resolveKey: d, resolveTimestampAuthority: f, timestampTrust: h, assertAllowedField: g } = n, { bytesOf: p, markBytes: m } = r, { form: v } = o, S = /* @__PURE__ */ new Map(), C = 16384, k = (R) => new re("operation-cancelled", "signature", "signing cancelled", { + const { withBusy: l, requireSignatures: u } = t, { resolveKey: f, resolveTimestampAuthority: d, timestampTrust: h, assertAllowedField: g } = n, { bytesOf: p, markBytes: m } = r, { form: v } = o, S = /* @__PURE__ */ new Map(), C = 16384, k = (R) => new te("operation-cancelled", "signature", "signing cancelled", { cause: R.reason }), N = (R) => { const M = u(); @@ -51396,32 +51441,34 @@ function Vxe(e, { const R = await x(); if (R.length === 0) return; const M = R.map((F) => `'${F.name}'`).join(", "); - throw new re( + throw new te( "invalid-input", "signature", `the form refuses what is typed in ${M}; nothing is signed`, { details: { fields: R.map((F) => F.ref) } } ); }, b = async (R, M, F = {}) => { - const B = M?.signal, $ = N(B), { certificateCommonName: D, sign: _ } = await e.cancellable( - B, - import("./index-BCXWVSWX.js") - ), L = await e.cancellable(B, d(R.signingKey)), j = L.kind === "raw" && L.certificateChain[0] ? D(L.certificateChain[0]) : null, H = { ...j ? { name: j } : {}, ...R.signer }, Y = await e.cancellable(B, y(R)), ue = f(R.timestampAuthority); + const _ = M?.signal, $ = N(_), { certificateCommonName: D, sign: B } = await e.cancellable( + _, + import("./index-Cp6ojw-X.js") + ), L = await e.cancellable(_, f(R.signingKey)), j = L.kind === "raw" && L.certificateChain[0] ? D(L.certificateChain[0]) : null, H = { ...j ? { name: j } : {}, ...R.signer }, Y = await e.cancellable(_, y(R)), le = d(R.timestampAuthority); await F.beforePrepare?.(); - const le = B || F.afterPrepare ? async () => { - if (B?.aborted) throw k(B); + const ie = _ || F.afterPrepare ? async () => { + if (_?.aborted) throw k(_); await F.afterPrepare?.(); - } : null, pe = await _($, { + } : null, pe = await B($, { field: R.field, key: L, signer: H, certify: R.certify, lock: R.lock, ...Y ? { appearance: Y } : {}, - ...ue ? { timestampAuthority: ue, timestampTrust: h() } : {}, - ...le ? { afterPrepare: le } : {} + // Left out, `sign()` of core-signature works it out from the key and the authority. + ...R.contentsSizeBytes !== void 0 ? { contentsSizeBytes: R.contentsSizeBytes } : {}, + ...le ? { timestampAuthority: le, timestampTrust: h() } : {}, + ...ie ? { afterPrepare: ie } : {} }); - return i.clearIfTarget(R.field), c(pe, B); + return i.clearIfTarget(R.field), c(pe, _); }, E = async (R, M) => { if (w(R, "signature.sign"), M?.signal?.aborted) throw k(M.signal); return l(() => b(R, M, { beforePrepare: A })); @@ -51430,9 +51477,9 @@ function Vxe(e, { const F = M?.signal; if (F?.aborted) throw k(F); return l(async () => { - const B = u(), $ = await e.cancellable(F, y(R)), D = f(R.timestampAuthority); + const _ = u(), $ = await e.cancellable(F, y(R)), D = d(R.timestampAuthority), B = R.contentsSizeBytes ?? (D ? C : void 0); await A(); - const _ = B.prepare({ + const L = _.prepare({ field: R.field, signer: R.signer, certify: R.certify, @@ -51440,25 +51487,24 @@ function Vxe(e, { subFilter: R.subFilter, digest: R.digest, ...$ ? { appearance: $ } : {}, - // The token has to fit the room reserved now: the completion can't make more. - ...D ? { contentsSizeBytes: C } : {} - }), L = await e.cancellable(F, _); - return S.set(L.signingId, { prepared: L, timestampAuthority: D }), L; + ...B !== void 0 ? { contentsSizeBytes: B } : {} + }), j = await e.cancellable(F, L); + return S.set(j.signingId, { prepared: j, timestampAuthority: D }), j; }); }, O = async (R, M, F) => { if (F?.signal?.aborted) throw k(F.signal); return l(async () => { - const B = u(), $ = S.get(R); + const _ = u(), $ = S.get(R); if (!$) - throw new re( + throw new te( "not-found", "signature", `no signing '${R}' was prepared in this session` ); - const { completeSignature: D } = await import("./index-BCXWVSWX.js"), { timestampAuthority: _ } = $, L = await D({ signatures: B }, { + const { completeSignature: D } = await import("./index-Cp6ojw-X.js"), { timestampAuthority: B } = $, L = await D({ signatures: _ }, { prepared: $.prepared, cms: M, - ..._ ? { timestampAuthority: _, timestampTrust: h() } : {} + ...B ? { timestampAuthority: B, timestampTrust: h() } : {} }); return S.delete(R), i.clearIfTarget(L.signature.field), c(L, F?.signal); }); @@ -51479,38 +51525,38 @@ function Vxe(e, { assertMaySign: w, cancelled: k, api: { - sign: qr(E), - prepareSignature: qr(I), - completeSignature: qr(O), - cancelPending: qr(T) + sign: Gr(E), + prepareSignature: Gr(I), + completeSignature: Gr(O), + cancelPending: Gr(T) } }; } function $xe(e, { store: t, authority: n }, { findSignature: r }, { validateNow: o }) { const s = e.settings(), { withBusy: i } = t, { timestampTrust: a } = n, c = () => { e.assertAllowed("doc.sign", "signature.addValidationInfo"); - const { revocation: f, trust: h, documentTimestamp: g, timestampAuthority: p } = s.get(); - if (!f || !h) - throw new re( + const { revocation: d, trust: h, documentTimestamp: g, timestampAuthority: p } = s.get(); + if (!d || !h) + throw new te( "invalid-input", "signature", "adding validation data needs the `revocation` and `trust` settings" ); if (g && !p) - throw new re( + throw new te( "invalid-input", "signature", "the `documentTimestamp` setting needs the `timestampAuthority` setting" ); - return { revocation: f, trust: h, stampWith: g ? p : null }; - }, l = async (f, h, g) => { - const { revocation: p, trust: m, stampWith: v } = c(), S = await e.cancellable(h, import("./index-BCXWVSWX.js")), { added: C, verdicts: k } = await e.cancellable( + return { revocation: d, trust: h, stampWith: g ? p : null }; + }, l = async (d, h, g) => { + const { revocation: p, trust: m, stampWith: v } = c(), S = await e.cancellable(h, import("./index-Cp6ojw-X.js")), { added: C, verdicts: k } = await e.cancellable( h, - S.addValidationInfo(e.doc, { trust: m, revocation: p, ...f ? { fields: f } : {} }) + S.addValidationInfo(e.doc, { trust: m, revocation: p, ...d ? { fields: d } : {} }) ); if (g?.({ added: C, documentTimestamp: null }), !v) return { added: C, documentTimestamp: null }; const N = k.filter( - ({ signature: x }) => f ? f.some( + ({ signature: x }) => d ? d.some( (A) => A.kind === "fqn" ? x.fieldName === A.name : Rv(x.field, A) ) : x.kind === "signature" ); @@ -51522,27 +51568,27 @@ function $xe(e, { store: t, authority: n }, { findSignature: r }, { validateNow: return { added: C, documentTimestamp: y.signature.field }; }; return { - afterSeal: async (f, h) => { + afterSeal: async (d, h) => { if (!s.get().revocation || !e.allows("doc.sign")) - return { ...f, validationInfo: null, validationInfoError: null }; + return { ...d, validationInfo: null, validationInfoError: null }; let g = null; try { - return g = await l([f.signature.field], h, (p) => { + return g = await l([d.signature.field], h, (p) => { g = p; - }), { ...f, validationInfo: g, validationInfoError: null }; + }), { ...d, validationInfo: g, validationInfoError: null }; } catch (p) { - return { ...f, validationInfo: g, validationInfoError: qe("signature", p) }; + return { ...d, validationInfo: g, validationInfoError: ze("signature", p) }; } finally { o(); } }, api: { - addValidationInfo: qr(async (f, h) => { + addValidationInfo: Gr(async (d, h) => { let g; - if (f) { - const p = r(f); + if (d) { + const p = r(d); if (!p?.signed) - throw new re("not-found", "signature", "no signed field at that address"); + throw new te("not-found", "signature", "no signed field at that address"); g = [p.field]; } return i(async () => { @@ -51557,14 +51603,14 @@ function $xe(e, { store: t, authority: n }, { findSignature: r }, { validateNow: }; } function Uxe(e) { - const t = Cxe(e), { events: n, authority: r } = t, o = e.settings(), s = Txe(e, t), i = Pxe(e, t, s), a = vxe(e, t, i.mirror), c = cxe(e, t, s, i.mirror, a), l = jxe(e, t, a), u = $xe(e, t, a, s), d = Vxe(e, t, a, l, i, u), f = Mxe(e, t, a, l), h = Fxe(e, t, a, d, f), g = Dxe(e, t, a, i, d), p = tu("signature", [ + const t = Cxe(e), { events: n, authority: r } = t, o = e.settings(), s = Txe(e, t), i = Pxe(e, t, s), a = vxe(e, t, i.mirror), c = cxe(e, t, s, i.mirror, a), l = jxe(e, t, a), u = $xe(e, t, a, s), f = Vxe(e, t, a, l, i, u), d = Mxe(e, t, a, l), h = Fxe(e, t, a, f, d), g = Dxe(e, t, a, i, f), p = nu("signature", [ o.api, a.api, c.api, l.api, - d.api, - u.api, f.api, + u.api, + d.api, h.api, g.api, { @@ -51641,7 +51687,7 @@ function Jxe(e) { return typeof t.byteOffset == "number" && typeof t.byteLength == "number" && Tv(t.buffer); } function kW(e) { - const t = ct(e), n = new Uint8Array(t.byteLength); + const t = lt(e), n = new Uint8Array(t.byteLength); return n.set(t), n; } function L5(e) { @@ -51656,13 +51702,13 @@ function Tv(e) { function SW(e) { return Jxe(e); } -function vm(e) { +function km(e) { return Tv(e) || SW(e); } function Mv(e) { - if (!vm(e)) throw new TypeError("Expected ArrayBuffer, SharedArrayBuffer, or ArrayBufferView"); + if (!km(e)) throw new TypeError("Expected ArrayBuffer, SharedArrayBuffer, or ArrayBufferView"); } -function ct(e) { +function lt(e) { return Mv(e), Tv(e) ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength); } function D5(e) { @@ -51671,14 +51717,14 @@ function D5(e) { function br(e) { if (Mv(e), L5(e)) return e; const t = new ArrayBuffer(e.byteLength); - return new Uint8Array(t).set(ct(e)), t; + return new Uint8Array(t).set(lt(e)), t; } function Yxe(e) { return Mv(e), Tv(e) ? e : e.byteOffset === 0 && e.byteLength === e.buffer.byteLength ? e.buffer : kW(e).buffer; } function j5(e, t) { if (Mv(e), ArrayBuffer.isView(e) && e.constructor === t) return e; - const n = ct(e), r = Gxe(t); + const n = lt(e), r = Gxe(t); if (n.byteOffset % r !== 0 || n.byteLength % r !== 0) throw new RangeError(`Cannot create ${t.name} over unaligned byte range`); return vW(t) ? new t(n.buffer, n.byteOffset, n.byteLength) : new t(n.buffer, n.byteOffset, n.byteLength / r); } @@ -51689,7 +51735,7 @@ function xW(e) { const t = []; let n = 0; for (const s of e) { - const i = ct(s); + const i = lt(s); t.push(i), n += i.byteLength; } const r = new Uint8Array(n); @@ -51700,16 +51746,16 @@ function xW(e) { } function Xxe(e, t, ...n) { let r, o; - typeof t == "function" ? (r = Array.from(e), o = t) : vm(e) ? r = [ + typeof t == "function" ? (r = Array.from(e), o = t) : km(e) ? r = [ e, t, ...n - ].filter(vm) : (r = Array.from(e), t && r.push(t), r.push(...n)); + ].filter(km) : (r = Array.from(e), t && r.push(t), r.push(...n)); const s = xW(r); return o ? j5(s, o) : s.buffer; } function Zxe(e, t, n = {}) { - const r = ct(e), o = ct(t); + const r = lt(e), o = lt(t); if (!n.constantTime && r.byteLength !== o.byteLength) return !1; const s = Math.max(r.byteLength, o.byteLength); let i = r.byteLength ^ o.byteLength; @@ -51741,14 +51787,14 @@ function r2e(e) { return new TextEncoder().encode(e); } function z2(e, t) { - return typeof e == "string" ? t?.encoding === "utf8" ? r2e(e) : n2e(e) : ct(e); + return typeof e == "string" ? t?.encoding === "utf8" ? r2e(e) : n2e(e) : lt(e); } function W2(e, t, n) { for (let r = 0; r < t.byteLength; r++) if (e[n + r] !== t[r]) return !1; return !0; } function EW(e, t, n) { - const r = ct(e), o = z2(t, n), [s, i] = e2e(r.byteLength, n); + const r = lt(e), o = z2(t, n), [s, i] = e2e(r.byteLength, n); if (o.byteLength === 0) return s; const a = i - o.byteLength; if (a < s) return -1; @@ -51756,7 +51802,7 @@ function EW(e, t, n) { return -1; } function o2e(e, t, n) { - const r = ct(e), o = z2(t, n), [s, i] = t2e(r.byteLength, n); + const r = lt(e), o = z2(t, n), [s, i] = t2e(r.byteLength, n); if (o.byteLength === 0) return i; const a = i - o.byteLength; if (a < s) return -1; @@ -51767,26 +51813,26 @@ function s2e(e, t, n) { return EW(e, t, n) !== -1; } function i2e(e, t, n) { - const r = ct(e), o = z2(t, n); + const r = lt(e), o = z2(t, n); return o.byteLength > r.byteLength ? !1 : W2(r, o, 0); } function a2e(e, t, n) { - const r = ct(e), o = z2(t, n); + const r = lt(e), o = z2(t, n); return o.byteLength > r.byteLength ? !1 : W2(r, o, r.byteLength - o.byteLength); } function c2e(e, t, n) { - const r = ct(e), o = F8(t, 0, r.byteLength), s = F8(n, r.byteLength, r.byteLength); + const r = lt(e), o = F8(t, 0, r.byteLength), s = F8(n, r.byteLength, r.byteLength); return s <= o ? r.subarray(o, o) : r.subarray(o, s); } function l2e(e, t) { - const n = ct(e), r = Number.isFinite(t) ? Math.max(0, Math.trunc(t)) : 0; + const n = lt(e), r = Number.isFinite(t) ? Math.max(0, Math.trunc(t)) : 0; return r >= n.byteLength ? n : n.subarray(n.byteLength - r); } function u2e(e) { return D5(e); } function d2e(e, t) { - const n = ct(e), r = ct(t), o = Math.min(n.byteLength, r.byteLength); + const n = lt(e), r = lt(t), o = Math.min(n.byteLength, r.byteLength); for (let s = 0; s < o; s++) { if (n[s] < r[s]) return -1; if (n[s] > r[s]) return 1; @@ -51800,7 +51846,7 @@ var V8 = Object.defineProperty, ec = (e, t) => { enumerable: !0 }); return V8(n, Symbol.toStringTag, { value: "Module" }), n; -}, Kt = /* @__PURE__ */ ec({ +}, Wt = /* @__PURE__ */ ec({ assertBufferSource: () => Mv, compare: () => d2e, concat: () => Xxe, @@ -51813,7 +51859,7 @@ var V8 = Object.defineProperty, ec = (e, t) => { isArrayBuffer: () => L5, isArrayBufferLike: () => Tv, isArrayBufferView: () => SW, - isBufferSource: () => vm, + isBufferSource: () => km, isSharedArrayBuffer: () => AW, lastIndexOf: () => o2e, slice: () => c2e, @@ -51821,7 +51867,7 @@ var V8 = Object.defineProperty, ec = (e, t) => { tail: () => l2e, toArrayBuffer: () => br, toArrayBufferLike: () => Yxe, - toUint8Array: () => ct, + toUint8Array: () => lt, toUint8ArrayCopy: () => D5, toView: () => j5, toViewCopy: () => Qxe @@ -51832,7 +51878,7 @@ var V8 = Object.defineProperty, ec = (e, t) => { is: () => CW }); function F5(e) { - const t = ct(e); + const t = lt(e); let n = ""; for (const r of t) n += String.fromCharCode(r); return n; @@ -51850,7 +51896,7 @@ const f2e = { decode: V5, is: CW }; -var Xn = /* @__PURE__ */ ec({ +var Zn = /* @__PURE__ */ ec({ decode: () => U5, encode: () => $5, format: () => OW, @@ -51966,7 +52012,7 @@ function IW(e, t = {}) { } } function $5(e, t = {}) { - const n = ct(e), r = t.case ?? "lower", o = Array.from(n, (i) => { + const n = lt(e), r = t.case ?? "lower", o = Array.from(n, (i) => { const a = i.toString(16).padStart(2, "0"); return r === "upper" ? a.toUpperCase() : a; }); @@ -52034,7 +52080,7 @@ function RW(e) { return new TextEncoder().encode(e); } function TW(e) { - return new TextDecoder("utf-8", { fatal: !1 }).decode(ct(e)); + return new TextDecoder("utf-8", { fatal: !1 }).decode(lt(e)); } const E2e = { encode: RW, @@ -52085,7 +52131,7 @@ function K5(e) { return t === "" || I2e.test(t); } function DW(e, t) { - const n = ct(e), r = _W(); + const n = lt(e), r = _W(); return r ? r.from(n).toString("base64") : btoa(F5(n)); } function jW(e, t) { @@ -52101,7 +52147,7 @@ const tx = { normalize: q2, pad: LW }; -var St = /* @__PURE__ */ ec({ +var xt = /* @__PURE__ */ ec({ base64url: () => P2e, decode: () => VW, encode: () => FW, @@ -52131,7 +52177,7 @@ const P2e = { is: H5, normalize: G2 }; -var Cl = /* @__PURE__ */ ec({ +var Il = /* @__PURE__ */ ec({ decode: () => $W, decodeBigInt: () => q5, encode: () => W5, @@ -52168,7 +52214,7 @@ function W5(e, t = {}) { function q5(e, t = {}) { const n = z5(t.bitsPerByte), r = BigInt(n), o = 1 << n; let s = 0n; - for (const i of ct(e)) { + for (const i of lt(e)) { if (i >= o) throw new RangeError(`Byte 0x${i.toString(16)} exceeds ${n} bits`); s = s << r | BigInt(i); } @@ -52177,7 +52223,7 @@ function q5(e, t = {}) { function $W(e, t = {}) { const n = z5(t.bitsPerByte), r = 2 ** n; let o = 0; - for (const s of ct(e)) { + for (const s of lt(e)) { if (s >= r) throw new RangeError(`Byte 0x${s.toString(16)} exceeds ${n} bits`); if (o > (Number.MAX_SAFE_INTEGER - s) / r) throw new RangeError("Value exceeds Number.MAX_SAFE_INTEGER; use decodeBigInt instead"); o = o * r + s; @@ -52212,7 +52258,7 @@ function UW(e, t = {}) { return W5(s, { length: o }); } function G5(e) { - const t = ct(e); + const t = lt(e); if (!t.byteLength) throw new RangeError("Two's complement input must not be empty"); const n = q5(t); return t[0] & 128 ? n - (1n << BigInt(t.byteLength * 8)) : n; @@ -52223,7 +52269,7 @@ function KW(e) { return Number(t); } function HW(e) { - const t = ct(e); + const t = lt(e); if (t.byteLength < 2) return t.byteLength === 1; const n = t[0] === 0 && (t[1] & 128) === 0, r = t[0] === 255 && (t[1] & 128) !== 0; return !n && !r; @@ -52307,7 +52353,7 @@ function nc(e) { constructor(...r) { super(...r); const o = r[0] || {}; - this.isHexOnly = o.isHexOnly ?? !1, this.valueHexView = o.valueHex ? ct(o.valueHex) : J2; + this.isHexOnly = o.isHexOnly ?? !1, this.valueHexView = o.valueHex ? lt(o.valueHex) : J2; } fromBER(r, o, s, i) { const a = r instanceof ArrayBuffer ? new Uint8Array(r) : r; @@ -52322,12 +52368,12 @@ function nc(e) { return { ...super.toJSON(), isHexOnly: this.isHexOnly, - valueHex: Xn.encode(this.valueHexView) + valueHex: Zn.encode(this.valueHexView) }; } }, t.NAME = "hexBlock", t; } -var Tg, Lv = (Tg = class { +var Mg, Lv = (Mg = class { static blockName() { return this.NAME; } @@ -52338,7 +52384,7 @@ var Tg, Lv = (Tg = class { this.valueBeforeDecodeView = new Uint8Array(t); } constructor({ blockLength: t = 0, error: n = "", warnings: r = [], valueBeforeDecode: o = J2 } = {}) { - this.blockLength = t, this.error = n, this.warnings = r, this.valueBeforeDecodeView = ct(o); + this.blockLength = t, this.error = n, this.warnings = r, this.valueBeforeDecodeView = lt(o); } toJSON() { return { @@ -52346,43 +52392,43 @@ var Tg, Lv = (Tg = class { blockLength: this.blockLength, error: this.error, warnings: this.warnings, - valueBeforeDecode: Xn.encode(this.valueBeforeDecodeView) + valueBeforeDecode: Zn.encode(this.valueBeforeDecodeView) }; } -}, Tg.NAME = "baseBlock", Tg), Mg, Xr = (Mg = class extends Lv { +}, Mg.NAME = "baseBlock", Mg), Bg, Zr = (Bg = class extends Lv { fromBER(t, n, r, o) { throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'"); } toBER(t, n) { throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'"); } -}, Mg.NAME = "valueBlock", Mg); +}, Bg.NAME = "valueBlock", Bg); function J5(e) { try { - return Cl.decode(e, { bitsPerByte: 7 }); + return Il.decode(e, { bitsPerByte: 7 }); } catch { return; } } function nx(e) { try { - return Cl.encode(e, { bitsPerByte: 7 }); + return Il.encode(e, { bitsPerByte: 7 }); } catch { return; } } function zW(e) { if (!e.byteLength) return BigInt(0); - const t = BigInt(`0x${Xn.encode(e)}`); + const t = BigInt(`0x${Zn.encode(e)}`); return e[0] & 128 ? t - (BigInt(1) << BigInt(e.byteLength * 8)) : t; } function V2e(e) { const t = ((e < 0 ? -e - BigInt(1) : e).toString(2).length >> 3) + 1, n = e < 0 ? e + (BigInt(1) << BigInt(t * 8)) : e; - return Xn.decode(n.toString(16).padStart(t * 2, "0")); + return Zn.decode(n.toString(16).padStart(t * 2, "0")); } -var Bg, Dv = (Bg = class extends nc(Lv) { +var _g, Dv = (_g = class extends nc(Lv) { constructor({ idBlock: t = {} } = {}) { - super(), t ? (this.isHexOnly = t.isHexOnly ?? !1, this.valueHexView = t.valueHex ? ct(t.valueHex) : J2, this.tagClass = t.tagClass ?? -1, this.tagNumber = t.tagNumber ?? -1, this.isConstructed = t.isConstructed ?? !1) : (this.tagClass = -1, this.tagNumber = -1, this.isConstructed = !1); + super(), t ? (this.isHexOnly = t.isHexOnly ?? !1, this.valueHexView = t.valueHex ? lt(t.valueHex) : J2, this.tagClass = t.tagClass ?? -1, this.tagNumber = t.tagNumber ?? -1, this.isConstructed = t.isConstructed ?? !1) : (this.tagClass = -1, this.tagNumber = -1, this.isConstructed = !1); } toBER(t = !1) { let n = 0; @@ -52430,7 +52476,7 @@ var Bg, Dv = (Bg = class extends nc(Lv) { return r.buffer; } fromBER(t, n, r) { - const o = ct(t); + const o = lt(t); if (!tc(this, o, n, r)) return -1; const s = Number.isInteger(n) && Number.isInteger(r), i = s ? o : o.subarray(n, n + r), a = s ? n : 0, c = s ? r : i.length; if (c === 0) @@ -52464,10 +52510,10 @@ var Bg, Dv = (Bg = class extends nc(Lv) { if (u++, (i[a + h] & 128) === 0) break; } this.blockLength = u + 1; - const d = this.valueHexView = new Uint8Array(u); - for (let h = 0; h < u; h++) d[h] = i[a + h + 1] & 127; - const f = this.blockLength <= 9 ? J5(d) : void 0; - f !== void 0 ? this.tagNumber = f : (this.isHexOnly = !0, this.warnings.push("Tag too long, represented as hex-coded")); + const f = this.valueHexView = new Uint8Array(u); + for (let h = 0; h < u; h++) f[h] = i[a + h + 1] & 127; + const d = this.blockLength <= 9 ? J5(f) : void 0; + d !== void 0 ? this.tagNumber = d : (this.isHexOnly = !0, this.warnings.push("Tag too long, represented as hex-coded")); } if (this.tagClass === 1 && this.isConstructed) switch (this.tagNumber) { case 1: @@ -52495,14 +52541,14 @@ var Bg, Dv = (Bg = class extends nc(Lv) { isConstructed: this.isConstructed }; } -}, Bg.NAME = "identificationBlock", Bg); +}, _g.NAME = "identificationBlock", _g); const $2e = Dv.prototype.toBER, U2e = Dv.prototype.fromBER; -var _g, jv = (_g = class extends Lv { +var Lg, jv = (Lg = class extends Lv { constructor({ lenBlock: t = {} } = {}) { super(), this.isIndefiniteForm = t.isIndefiniteForm ?? !1, this.longFormUsed = t.longFormUsed ?? !1, this.length = t.length ?? 0; } fromBER(t, n, r) { - const o = ct(t); + const o = lt(t); if (!tc(this, o, n, r)) return -1; const s = Number.isInteger(n) && Number.isInteger(r), i = s ? o : o.subarray(n, n + r), a = s ? n : 0, c = s ? r : i.length; if (c === 0) @@ -52518,10 +52564,10 @@ var _g, jv = (_g = class extends Lv { return this.error = "Too big integer", -1; if (l + 1 > c) return this.error = "End of input reached before message was fully decoded", -1; - const u = n + 1, d = o.subarray(u, u + l); - d[0] === 0 && this.warnings.push("Needlessly long encoded length"); + const u = n + 1, f = o.subarray(u, u + l); + f[0] === 0 && this.warnings.push("Needlessly long encoded length"); try { - this.length = Cl.decode(d); + this.length = Il.decode(f); } catch { return this.error = "Too big integer", -1; } @@ -52534,7 +52580,7 @@ var _g, jv = (_g = class extends Lv { if (this.longFormUsed) { let o; try { - o = Cl.encode(this.length); + o = Il.encode(this.length); } catch { return this.error = "Too big length", ks; } @@ -52550,7 +52596,7 @@ var _g, jv = (_g = class extends Lv { length: this.length }; } -}, _g.NAME = "lengthBlock", _g); +}, Lg.NAME = "lengthBlock", Lg); const K2e = jv.prototype.toBER, H2e = jv.prototype.fromBER, Ue = {}, z2e = Z2e(Uint8Array.prototype, "slice"), W2e = Object.getOwnPropertyDescriptor(Uint8Array.prototype, "constructor")?.value, q2e = Object.getOwnPropertyDescriptor(Array.prototype, Symbol.iterator)?.value, H8 = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), "byteLength")?.get, G2e = 16384, WW = 64; let cA; function J2e(e, t) { @@ -52564,7 +52610,7 @@ function J2e(e, t) { ...e }; } -function dn(e, t) { +function fn(e, t) { const n = Object.getOwnPropertyDescriptor(e, t); if (!(!n || !("value" in n))) return n.value; @@ -52633,7 +52679,7 @@ function eEe(e, t, n) { } return !1; } -function km(e, t, n, r) { +function Am(e, t, n, r) { if (Object.prototype.hasOwnProperty.call(e, n) || Object.getPrototypeOf(e) !== t) return !1; const o = Object.getOwnPropertyDescriptor(t, n); return !!o && "value" in o && o.value === r; @@ -52667,23 +52713,23 @@ function Y5(e, t = !1) { } } function nEe(e, t, n) { - if (Object.getPrototypeOf(e) !== n.LocalIdentificationBlock.prototype || !km(e, n.LocalIdentificationBlock.prototype, "toBER", n.originalIdentificationToBER)) return !1; - const r = dn(e, "tagClass"), o = dn(e, "tagNumber"), s = dn(e, "isConstructed"), i = dn(e, "isHexOnly"), a = dn(e, "valueHexView"); + if (Object.getPrototypeOf(e) !== n.LocalIdentificationBlock.prototype || !Am(e, n.LocalIdentificationBlock.prototype, "toBER", n.originalIdentificationToBER)) return !1; + const r = fn(e, "tagClass"), o = fn(e, "tagNumber"), s = fn(e, "isConstructed"), i = fn(e, "isHexOnly"), a = fn(e, "valueHexView"); return typeof r != "number" || !Number.isInteger(r) || r < 1 || r > 4 || typeof o != "number" || !Number.isInteger(o) || o < 0 || s !== t || typeof i != "boolean" ? !1 : i ? !!Y5(a) : Number.isSafeInteger(o); } function rEe(e, t, n) { - if (Object.getPrototypeOf(e) !== n.LocalLengthBlock.prototype || !km(e, n.LocalLengthBlock.prototype, "toBER", n.originalLengthToBER)) return !1; - const r = dn(e, "isIndefiniteForm"), o = dn(e, "longFormUsed"), s = Object.getOwnPropertyDescriptor(e, "length"), i = s && "value" in s ? s.value : void 0, a = Object.getOwnPropertyDescriptor(e, "longFormUsed"); + if (Object.getPrototypeOf(e) !== n.LocalLengthBlock.prototype || !Am(e, n.LocalLengthBlock.prototype, "toBER", n.originalLengthToBER)) return !1; + const r = fn(e, "isIndefiniteForm"), o = fn(e, "longFormUsed"), s = Object.getOwnPropertyDescriptor(e, "length"), i = s && "value" in s ? s.value : void 0, a = Object.getOwnPropertyDescriptor(e, "longFormUsed"); return typeof r == "boolean" && (r === !1 || t) && typeof o == "boolean" && !!a && "value" in a && a.writable === !0 && !!s && "value" in s && s.writable === !0 && typeof i == "number" && Number.isSafeInteger(i) && i >= 0; } function oEe(e, t, n) { - const r = dn(e, "idBlock"), o = dn(e, "lenBlock"); + const r = fn(e, "idBlock"), o = fn(e, "lenBlock"); return !!r && !!o && nEe(r, t, n) && rEe(o, t, n); } function sEe(e, t) { - const n = dn(e, "valueBlock"); - if (!n || Object.getPrototypeOf(n) !== t.LocalConstructedValueBlock.prototype || !km(n, t.LocalConstructedValueBlock.prototype, "toBER", t.originalConstructedToBER)) return; - const r = dn(n, "value"); + const n = fn(e, "valueBlock"); + if (!n || Object.getPrototypeOf(n) !== t.LocalConstructedValueBlock.prototype || !Am(n, t.LocalConstructedValueBlock.prototype, "toBER", t.originalConstructedToBER)) return; + const r = fn(n, "value"); if (!Array.isArray(r) || Object.getPrototypeOf(r) !== Array.prototype) return; const o = Object.getOwnPropertyDescriptor(r, "length"); if (!o || !("value" in o) || o.value !== 1 || Object.prototype.hasOwnProperty.call(r, Symbol.iterator)) return; @@ -52694,11 +52740,11 @@ function sEe(e, t) { return i.value; } function iEe(e, t) { - const n = dn(e, "valueBlock"); - if (!n || Object.getPrototypeOf(n) !== t.LocalBitStringValueBlock.prototype || !km(n, t.LocalBitStringValueBlock.prototype, "toBER", t.originalBitStringToBER) || dn(n, "isConstructed") !== !1) return; - const r = dn(n, "unusedBits"); + const n = fn(e, "valueBlock"); + if (!n || Object.getPrototypeOf(n) !== t.LocalBitStringValueBlock.prototype || !Am(n, t.LocalBitStringValueBlock.prototype, "toBER", t.originalBitStringToBER) || fn(n, "isConstructed") !== !1) return; + const r = fn(n, "unusedBits"); if (typeof r != "number" || !Number.isInteger(r) || r < 0 || r > 7) return; - const o = Y5(dn(n, "valueHexView"), !0); + const o = Y5(fn(n, "valueHexView"), !0); if (o) return { payload: o, @@ -52706,15 +52752,15 @@ function iEe(e, t) { }; } function aEe(e, t, n) { - const r = dn(e, "valueBlock"); + const r = fn(e, "valueBlock"); if (r) { if (t === "integer") { - if (Object.getPrototypeOf(r) !== n.LocalIntegerValueBlock.prototype || !km(r, n.LocalIntegerValueBlock.prototype, "toBER", n.originalIntegerToBER)) return; + if (Object.getPrototypeOf(r) !== n.LocalIntegerValueBlock.prototype || !Am(r, n.LocalIntegerValueBlock.prototype, "toBER", n.originalIntegerToBER)) return; } else if (t === "octet") { - if (Object.getPrototypeOf(r) !== n.LocalOctetStringValueBlock.prototype || !km(r, n.LocalOctetStringValueBlock.prototype, "toBER", n.originalOctetStringToBER) || dn(r, "isConstructed") !== !1) return; + if (Object.getPrototypeOf(r) !== n.LocalOctetStringValueBlock.prototype || !Am(r, n.LocalOctetStringValueBlock.prototype, "toBER", n.originalOctetStringToBER) || fn(r, "isConstructed") !== !1) return; } else if (Object.getPrototypeOf(r) !== n.LocalPrimitiveValueBlock.prototype || !tEe(r, "toBER", n.originalPrimitiveToBER, n.LocalPrimitiveValueBlock)) return; - if (!(t === "primitive" && dn(r, "isHexOnly") !== !0) && typeof dn(r, "isHexOnly") == "boolean") - return Y5(dn(r, "valueHexView")); + if (!(t === "primitive" && fn(r, "isHexOnly") !== !0) && typeof fn(r, "isHexOnly") == "boolean") + return Y5(fn(r, "valueHexView")); } } function cEe(e, t) { @@ -52740,21 +52786,21 @@ function GW(e, t, n) { if (!cEe(e, n)) return; const r = U1(e, "BitString", n) ? "bit" : U1(e, "Integer", n) ? "integer" : U1(e, "OctetString", n) ? "octet" : U1(e, "Primitive", n) ? "primitive" : void 0, o = r === void 0 && lEe(e, n); if (!r && !o || !oEe(e, o, n)) return; - const s = dn(e, "idBlock"), i = dn(e, "lenBlock"); + const s = fn(e, "idBlock"), i = fn(e, "lenBlock"); if (!s || !i) return; if (r) { - const u = r === "bit" ? iEe(e, n) : void 0, d = r === "bit" ? u?.payload : aEe(e, r, n); - return d ? { + const u = r === "bit" ? iEe(e, n) : void 0, f = r === "bit" ? u?.payload : aEe(e, r, n); + return f ? { block: e, kind: r, idBlock: s, lenBlock: i, indefinite: !1, - payload: d, + payload: f, prefix: u?.prefix } : void 0; } - const a = sEe(e, n), c = a && GW(a, t + 1, n), l = dn(i, "isIndefiniteForm"); + const a = sEe(e, n), c = a && GW(a, t + 1, n), l = fn(i, "isIndefiniteForm"); return c ? { block: e, kind: "constructed", @@ -52799,9 +52845,9 @@ function uEe(e, t = !1) { const o = JW(r, t, n), s = new Uint8Array(o.total); return YW(o, s, 0, t), s.buffer; } -var Lg, ir = (Lg = class extends Lv { +var Dg, ar = (Dg = class extends Lv { constructor({ name: t = "", optional: n = !1, primitiveSchema: r, ...o } = {}, s) { - super(o), this.name = t, this.optional = n, r && (this.primitiveSchema = r), this.idBlock = new Dv(o), this.lenBlock = new jv(o), this.valueBlock = s ? new s(o) : new Xr(o); + super(o), this.name = t, this.optional = n, r && (this.primitiveSchema = r), this.idBlock = new Dv(o), this.lenBlock = new jv(o), this.valueBlock = s ? new s(o) : new Zr(o); } fromBER(t, n, r, o) { const s = this.valueBlock.fromBER(t, n, this.lenBlock.isIndefiniteForm ? r : this.lenBlock.length, o); @@ -52836,25 +52882,25 @@ var Lg, ir = (Lg = class extends Lv { return this.primitiveSchema && (t.primitiveSchema = this.primitiveSchema.toJSON()), t; } toString(t = "ascii") { - return t === "ascii" ? this.onAsciiEncoding() : Xn.encode(this.toBER()); + return t === "ascii" ? this.onAsciiEncoding() : Zn.encode(this.toBER()); } onAsciiEncoding() { - return `${this.constructor.NAME} : ${Xn.encode(this.valueBlock.valueBeforeDecodeView)}`; + return `${this.constructor.NAME} : ${Zn.encode(this.valueBlock.valueBeforeDecodeView)}`; } isEqual(t) { if (this === t) return !0; if (!(t instanceof this.constructor)) return !1; const n = this.toBER(), r = t.toBER(); - return Kt.equal(n, r); + return Wt.equal(n, r); } -}, Lg.NAME = "BaseBlock", Lg); -const dEe = ir.prototype.toBER; +}, Dg.NAME = "BaseBlock", Dg); +const dEe = ar.prototype.toBER; function QW(e) { if (e instanceof Ue.Constructed) for (const t of e.valueBlock.value) QW(t) && (e.lenBlock.isIndefiniteForm = !0); return !!e.lenBlock?.isIndefiniteForm; } -var Dg, fEe = (Dg = class extends ir { +var jg, fEe = (jg = class extends ar { getValue() { return this.valueBlock.value; } @@ -52877,17 +52923,17 @@ var Dg, fEe = (Dg = class extends ir { onAsciiEncoding() { return `${this.constructor.NAME} : '${this.valueBlock.value}'`; } -}, Dg.NAME = "BaseStringBlock", Dg), jg, Q5 = (jg = class extends nc(Xr) { +}, jg.NAME = "BaseStringBlock", jg), Fg, Q5 = (Fg = class extends nc(Zr) { constructor({ isHexOnly: t = !0, ...n } = {}) { super(n), this.isHexOnly = t; } -}, jg.NAME = "PrimitiveValueBlock", jg); +}, Fg.NAME = "PrimitiveValueBlock", Fg); const hEe = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Q5.prototype), "toBER")?.value; -var Wd, Je = (Wd = class extends ir { +var Gd, Je = (Gd = class extends ar { constructor(t = {}) { super(t, Q5), this.idBlock.isConstructed = !1; } -}, Ue.Primitive = Wd, Wd.NAME = "PRIMITIVE", Wd); +}, Ue.Primitive = Gd, Gd.NAME = "PRIMITIVE", Gd); let XW; function pEe(e) { XW = { @@ -52914,8 +52960,8 @@ function yEe(e, t, n, r) { if (l !== 2 && l !== 5 && l !== 48 || (i = e[t + 1], i >= 128 || i > n - 2) || l === 5 && i !== 0 || !gEe(r) || i > Object.getOwnPropertyDescriptor(r, "maxContentLength").value) return; const u = l === 2 ? "Integer" : l === 5 ? "Null" : "Sequence"; if (s = o[u], !mEe(Ue, u, s)) return; - const d = Object.getOwnPropertyDescriptor(Dv.prototype, "fromBER"), f = Object.getOwnPropertyDescriptor(jv.prototype, "fromBER"); - if (!d || !("value" in d) || d.value !== U2e || !f || !("value" in f) || f.value !== H2e) return; + const f = Object.getOwnPropertyDescriptor(Dv.prototype, "fromBER"), d = Object.getOwnPropertyDescriptor(jv.prototype, "fromBER"); + if (!f || !("value" in f) || f.value !== U2e || !d || !("value" in d) || d.value !== H2e) return; } catch { return; } @@ -52940,7 +52986,7 @@ function Fv(e = {}) { }; } function kEe(e) { - const t = new ir({}, Xr); + const t = new ar({}, Zr); return t.error = e, { offset: -1, result: t @@ -52971,7 +53017,7 @@ function Z5(e, t = 0, n = e.length, r = Fv()) { const o = yEe(e, t, n, r); if (o) return o; const s = t; - let i = new ir({}, Xr); + let i = new ar({}, Zr); if (!tc(i, e, t, n)) return { offset: -1, result: i @@ -53010,7 +53056,7 @@ function Z5(e, t = 0, n = e.length, r = Fv()) { offset: -1, result: i }; - let d = ir; + let f = ar; switch (i.idBlock.tagClass) { case 1: if (i.idBlock.tagNumber >= 37 && i.idBlock.isHexOnly === !1) @@ -53025,37 +53071,37 @@ function Z5(e, t = 0, n = e.length, r = Fv()) { offset: -1, result: i }; - d = Ue.EndOfContent; + f = Ue.EndOfContent; break; case 1: - d = Ue.Boolean; + f = Ue.Boolean; break; case 2: - d = Ue.Integer; + f = Ue.Integer; break; case 3: - d = Ue.BitString; + f = Ue.BitString; break; case 4: - d = Ue.OctetString; + f = Ue.OctetString; break; case 5: - d = Ue.Null; + f = Ue.Null; break; case 6: - d = Ue.ObjectIdentifier; + f = Ue.ObjectIdentifier; break; case 10: - d = Ue.Enumerated; + f = Ue.Enumerated; break; case 12: - d = Ue.Utf8String; + f = Ue.Utf8String; break; case 13: - d = Ue.RelativeObjectIdentifier; + f = Ue.RelativeObjectIdentifier; break; case 14: - d = Ue.TIME; + f = Ue.TIME; break; case 15: return i.error = "[UNIVERSAL 15] is reserved by ASN.1 standard", { @@ -53063,96 +53109,96 @@ function Z5(e, t = 0, n = e.length, r = Fv()) { result: i }; case 16: - d = Ue.Sequence; + f = Ue.Sequence; break; case 17: - d = Ue.Set; + f = Ue.Set; break; case 18: - d = Ue.NumericString; + f = Ue.NumericString; break; case 19: - d = Ue.PrintableString; + f = Ue.PrintableString; break; case 20: - d = Ue.TeletexString; + f = Ue.TeletexString; break; case 21: - d = Ue.VideotexString; + f = Ue.VideotexString; break; case 22: - d = Ue.IA5String; + f = Ue.IA5String; break; case 23: - d = Ue.UTCTime; + f = Ue.UTCTime; break; case 24: - d = Ue.GeneralizedTime; + f = Ue.GeneralizedTime; break; case 25: - d = Ue.GraphicString; + f = Ue.GraphicString; break; case 26: - d = Ue.VisibleString; + f = Ue.VisibleString; break; case 27: - d = Ue.GeneralString; + f = Ue.GeneralString; break; case 28: - d = Ue.UniversalString; + f = Ue.UniversalString; break; case 29: - d = Ue.CharacterString; + f = Ue.CharacterString; break; case 30: - d = Ue.BmpString; + f = Ue.BmpString; break; case 31: - d = Ue.DATE; + f = Ue.DATE; break; case 32: - d = Ue.TimeOfDay; + f = Ue.TimeOfDay; break; case 33: - d = Ue.DateTime; + f = Ue.DateTime; break; case 34: - d = Ue.Duration; + f = Ue.Duration; break; default: { - const f = i.idBlock.isConstructed ? new Ue.Constructed() : new Ue.Primitive(); - f.idBlock = i.idBlock, f.lenBlock = i.lenBlock, f.warnings = i.warnings, i = f; + const d = i.idBlock.isConstructed ? new Ue.Constructed() : new Ue.Primitive(); + d.idBlock = i.idBlock, d.lenBlock = i.lenBlock, d.warnings = i.warnings, i = d; } } break; default: - d = i.idBlock.isConstructed ? Ue.Constructed : Ue.Primitive; + f = i.idBlock.isConstructed ? Ue.Constructed : Ue.Primitive; } - return i = xEe(i, d), c = i.fromBER(e, t, l, r), i.valueBeforeDecodeView = e.subarray(s, s + i.blockLength), { + return i = xEe(i, f), c = i.fromBER(e, t, l, r), i.valueBeforeDecodeView = e.subarray(s, s + i.blockLength), { offset: c, result: i }; } -function hn(e, t = {}) { +function pn(e, t = {}) { if (!e.byteLength) { - const r = new ir({}, Xr); + const r = new ar({}, Zr); return r.error = "Input buffer has zero length", { offset: -1, result: r }; } - const n = ct(e); + const n = lt(e); return Z5(t.copyInput === !1 ? n : n.slice(), 0, e.byteLength, Fv(t)); } function EEe(e, t) { return e ? 1 : t; } -var Fg, Ua = (Fg = class extends Xr { +var Vg, Ua = (Vg = class extends Zr { constructor({ value: t = [], isIndefiniteForm: n = !1, ...r } = {}) { super(r), this.value = t, this.isIndefiniteForm = n; } fromBER(t, n, r, o) { - const s = ct(t), i = o ?? Fv(); + const s = lt(t), i = o ?? Fv(); if (!tc(this, s, n, r)) return -1; if (this.valueBeforeDecodeView = s.subarray(n, n + r), this.valueBeforeDecodeView.length === 0) return this.warnings.push("Zero buffer length"), n; @@ -53179,9 +53225,9 @@ var Fg, Ua = (Fg = class extends Xr { for (const n of this.value) t.value.push(n.toJSON()); return t; } -}, Fg.NAME = "ConstructedValueBlock", Fg); +}, Vg.NAME = "ConstructedValueBlock", Vg); const CEe = Ua.prototype.toBER; -var qd, ee = (qd = class extends ir { +var Jd, ne = (Jd = class extends ar { constructor(t = {}) { super(t, Ua), this.idBlock.isConstructed = !0; } @@ -53200,22 +53246,22 @@ var qd, ee = (qd = class extends ir { ${t.join(` `)}` : `${n} :`; } -}, Ue.Constructed = qd, qd.NAME = "CONSTRUCTED", qd), Vg, IEe = (Vg = class extends Xr { +}, Ue.Constructed = Jd, Jd.NAME = "CONSTRUCTED", Jd), $g, IEe = ($g = class extends Zr { fromBER(t, n, r) { return n; } toBER(t) { return ks; } -}, Vg.override = "EndOfContentValueBlock", Vg), Gd; -Gd = class extends ir { +}, $g.override = "EndOfContentValueBlock", $g), Yd; +Yd = class extends ar { constructor(t = {}) { super(t, IEe), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 0; } -}, Ue.EndOfContent = Gd, Gd.NAME = D2e; -var Jd, fn = (Jd = class extends ir { +}, Ue.EndOfContent = Yd, Yd.NAME = D2e; +var Qd, hn = (Qd = class extends ar { constructor(t = {}) { - super(t, Xr), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 5; + super(t, Zr), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 5; } fromBER(t, n, r) { return this.lenBlock.length > 0 && this.warnings.push("Non-zero length of value block for Null type"), this.idBlock.error.length || (this.blockLength += this.idBlock.blockLength), this.lenBlock.error.length || (this.blockLength += this.lenBlock.blockLength), this.blockLength += r, n + r > t.byteLength ? (this.error = "End of input reached before message was fully decoded (inconsistent offset and length values)", -1) : n + r; @@ -53231,7 +53277,7 @@ var Jd, fn = (Jd = class extends ir { onAsciiEncoding() { return `${this.constructor.NAME}`; } -}, Ue.Null = Jd, Jd.NAME = "NULL", Jd), $g, NEe = ($g = class extends nc(Xr) { +}, Ue.Null = Qd, Qd.NAME = "NULL", Qd), Ug, NEe = (Ug = class extends nc(Zr) { get value() { for (const t of this.valueHexView) if (t > 0) return !0; return !1; @@ -53240,10 +53286,10 @@ var Jd, fn = (Jd = class extends ir { this.valueHexView[0] = t ? 255 : 0; } constructor({ value: t, ...n } = {}) { - super(n), n.valueHex ? this.valueHexView = ct(n.valueHex) : this.valueHexView = /* @__PURE__ */ new Uint8Array(1), t && (this.value = t); + super(n), n.valueHex ? this.valueHexView = lt(n.valueHex) : this.valueHexView = /* @__PURE__ */ new Uint8Array(1), t && (this.value = t); } fromBER(t, n, r) { - const o = ct(t); + const o = lt(t); return tc(this, o, n, r) ? (this.valueHexView = o.subarray(n, n + r), r > 1 && this.warnings.push("Boolean value encoded in more then 1 octet"), this.isHexOnly = !0, r > 1 && !aA.isMinimal(this.valueHexView) && this.warnings.push("Needlessly long format"), this.blockLength = r, n + r) : -1; } toBER() { @@ -53255,7 +53301,7 @@ var Jd, fn = (Jd = class extends ir { value: this.value }; } -}, $g.NAME = "BooleanValueBlock", $g), Yd, Ql = (Yd = class extends ir { +}, Ug.NAME = "BooleanValueBlock", Ug), Xd, Xl = (Xd = class extends ar { getValue() { return this.valueBlock.value; } @@ -53268,7 +53314,7 @@ var Jd, fn = (Jd = class extends ir { onAsciiEncoding() { return `${this.constructor.NAME} : ${this.getValue}`; } -}, Ue.Boolean = Yd, Yd.NAME = "BOOLEAN", Yd), Ug, eT = (Ug = class extends nc(Ua) { +}, Ue.Boolean = Xd, Xd.NAME = "BOOLEAN", Xd), Kg, eT = (Kg = class extends nc(Ua) { constructor({ isConstructed: t = !1, ...n } = {}) { super(n), this.isConstructed = t; } @@ -53298,9 +53344,9 @@ var Jd, fn = (Jd = class extends ir { isConstructed: this.isConstructed }; } -}, Ug.NAME = "OctetStringValueBlock", Ug); +}, Kg.NAME = "OctetStringValueBlock", Kg); const OEe = eT.prototype.toBER; -var Nl, Oe = (Nl = class extends ir { +var Ol, Oe = (Ol = class extends ar { constructor({ idBlock: t = {}, lenBlock: n = {}, ...r } = {}) { r.isConstructed ?? (r.isConstructed = !!r.value?.length), super({ idBlock: { @@ -53330,15 +53376,15 @@ var Nl, Oe = (Nl = class extends ir { return super.fromBER(t, n, r, o); } onAsciiEncoding() { - return this.valueBlock.isConstructed || this.valueBlock.value && this.valueBlock.value.length ? ee.prototype.onAsciiEncoding.call(this) : `${this.constructor.NAME} : ${Xn.encode(this.valueBlock.valueHexView)}`; + return this.valueBlock.isConstructed || this.valueBlock.value && this.valueBlock.value.length ? ne.prototype.onAsciiEncoding.call(this) : `${this.constructor.NAME} : ${Zn.encode(this.valueBlock.valueHexView)}`; } getValue() { if (!this.idBlock.isConstructed) return this.valueBlock.valueHexView.slice().buffer; const t = []; - for (const n of this.valueBlock.value) n instanceof Nl && t.push(n.valueBlock.valueHexView); + for (const n of this.valueBlock.value) n instanceof Ol && t.push(n.valueBlock.valueHexView); return z0(t); } -}, Ue.OctetString = Nl, Nl.NAME = j2e, Nl), Kg, tT = (Kg = class extends nc(Ua) { +}, Ue.OctetString = Ol, Ol.NAME = j2e, Ol), Hg, tT = (Hg = class extends nc(Ua) { constructor({ unusedBits: t = 0, isConstructed: n = !1, ...r } = {}) { super(r), this.unusedBits = t, this.isConstructed = n, this.blockLength = this.valueHexView.byteLength; } @@ -53362,7 +53408,7 @@ var Nl, Oe = (Nl = class extends ir { } return s; } - const i = ct(t); + const i = lt(t); if (!tc(this, i, n, r)) return -1; const a = i.subarray(n, n + r); if (this.unusedBits = a[0], this.unusedBits > 7) @@ -53396,9 +53442,9 @@ var Nl, Oe = (Nl = class extends ir { isConstructed: this.isConstructed }; } -}, Kg.NAME = "BitStringValueBlock", Kg); +}, Hg.NAME = "BitStringValueBlock", Hg); const PEe = tT.prototype.toBER; -var Qd, ht = (Qd = class extends ir { +var Zd, pt = (Zd = class extends ar { constructor({ idBlock: t = {}, lenBlock: n = {}, ...r } = {}) { r.isConstructed ?? (r.isConstructed = !!r.value?.length), super({ idBlock: { @@ -53416,7 +53462,7 @@ var Qd, ht = (Qd = class extends ir { return this.valueBlock.isConstructed = this.idBlock.isConstructed, this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm, super.fromBER(t, n, r, o); } onAsciiEncoding() { - if (this.valueBlock.isConstructed || this.valueBlock.value && this.valueBlock.value.length) return ee.prototype.onAsciiEncoding.call(this); + if (this.valueBlock.isConstructed || this.valueBlock.value && this.valueBlock.value.length) return ne.prototype.onAsciiEncoding.call(this); { const t = [], n = this.valueBlock.valueHexView; for (const o of n) t.push(o.toString(2).padStart(8, "0")); @@ -53424,7 +53470,7 @@ var Qd, ht = (Qd = class extends ir { return `${this.constructor.NAME} : ${r.substring(0, r.length - this.valueBlock.unusedBits)}`; } } -}, Ue.BitString = Qd, Qd.NAME = F2e, Qd), Xd, Y2 = (Xd = class extends nc(Xr) { +}, Ue.BitString = Zd, Zd.NAME = F2e, Zd), ef, Y2 = (ef = class extends nc(Zr) { setValueHex() { this.valueHexView.length >= 4 ? (this.warnings.push("Too big Integer for decoding, hex only"), this.isHexOnly = !0, this._valueDec = 0) : (this.isHexOnly = !1, this.valueHexView.length > 0 && (aA.isMinimal(this.valueHexView) || this.warnings.push("Needlessly long format"), this._valueDec = aA.decode(this.valueHexView))); } @@ -53474,16 +53520,16 @@ var Qd, ht = (Qd = class extends ir { toString() { return zW(this.valueHexView).toString(10); } -}, Xd.NAME = "IntegerValueBlock", Object.defineProperty(Xd.prototype, "valueHex", { +}, ef.NAME = "IntegerValueBlock", Object.defineProperty(ef.prototype, "valueHex", { set: function(t) { this.valueHexView = new Uint8Array(t), this.setValueHex(); }, get: function() { return this.valueHexView.slice().buffer; } -}), Xd); +}), ef); const REe = Y2.prototype.toBER, TEe = Y2.prototype.toString; -var Bs, de = (Bs = class extends ir { +var Bs, ue = (Bs = class extends ar { constructor(t = {}) { super(t, Y2), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 2; } @@ -53504,17 +53550,17 @@ var Bs, de = (Bs = class extends ir { onAsciiEncoding() { return `${this.constructor.NAME} : ${this.valueBlock.toString()}`; } -}, Ue.Integer = Bs, Bs.NAME = "INTEGER", Bs), Zd, Df = (Zd = class extends de { +}, Ue.Integer = Bs, Bs.NAME = "INTEGER", Bs), tf, Ff = (tf = class extends ue { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 10; } -}, Ue.Enumerated = Zd, Zd.NAME = "ENUMERATED", Zd), Hg, W8 = (Hg = class extends nc(Xr) { +}, Ue.Enumerated = tf, tf.NAME = "ENUMERATED", tf), zg, W8 = (zg = class extends nc(Zr) { constructor({ valueDec: t = -1, isFirstSid: n = !1, ...r } = {}) { super(r), this.valueDec = t, this.isFirstSid = n; } fromBER(t, n, r) { if (!r) return n; - const o = ct(t); + const o = lt(t); if (!tc(this, o, n, r)) return -1; const s = o.subarray(n, n + r); if (this.blockLength === 0 && Number.isInteger(n) && Number.isInteger(r)) { @@ -53568,7 +53614,7 @@ var Bs, de = (Bs = class extends ir { } toString() { let t = ""; - if (this.isHexOnly) t = Xn.encode(this.valueHexView); + if (this.isHexOnly) t = Zn.encode(this.valueHexView); else if (this.isFirstSid) { let n = this.valueDec; this.valueDec <= 39 ? t = "0." : this.valueDec <= 79 ? (t = "1.", n -= 40) : (t = "2.", n -= 80), t += n.toString(); @@ -53582,7 +53628,7 @@ var Bs, de = (Bs = class extends ir { isFirstSid: this.isFirstSid }; } -}, Hg.NAME = "sidBlock", Hg), zg, MEe = (zg = class extends Xr { +}, zg.NAME = "sidBlock", zg), Wg, MEe = (Wg = class extends Zr { constructor({ value: t = "", ...n } = {}) { super(n), this.value = [], t && this.fromString(t); } @@ -53655,7 +53701,7 @@ var Bs, de = (Bs = class extends ir { for (let n = 0; n < this.value.length; n++) t.sidArray.push(this.value[n].toJSON()); return t; } -}, zg.NAME = "ObjectIdentifierValueBlock", zg), ef, Ve = (ef = class extends ir { +}, Wg.NAME = "ObjectIdentifierValueBlock", Wg), nf, $e = (nf = class extends ar { getValue() { return this.valueBlock.toString(); } @@ -53674,13 +53720,13 @@ var Bs, de = (Bs = class extends ir { value: this.getValue() }; } -}, Ue.ObjectIdentifier = ef, ef.NAME = "OBJECT IDENTIFIER", ef), Wg, q8 = (Wg = class extends nc(Lv) { +}, Ue.ObjectIdentifier = nf, nf.NAME = "OBJECT IDENTIFIER", nf), qg, q8 = (qg = class extends nc(Lv) { constructor({ valueDec: t = 0, ...n } = {}) { super(n), this.valueDec = t; } fromBER(t, n, r) { if (r === 0) return n; - const o = ct(t); + const o = lt(t); if (!tc(this, o, n, r)) return -1; const s = o.subarray(n, n + r); if (this.blockLength === 0 && Number.isInteger(n) && Number.isInteger(r)) { @@ -53725,7 +53771,7 @@ var Bs, de = (Bs = class extends ir { } toString() { let t = ""; - return this.isHexOnly ? t = Xn.encode(this.valueHexView) : t = this.valueDec.toString(), t; + return this.isHexOnly ? t = Zn.encode(this.valueHexView) : t = this.valueDec.toString(), t; } toJSON() { return { @@ -53733,7 +53779,7 @@ var Bs, de = (Bs = class extends ir { valueDec: this.valueDec }; } -}, Wg.NAME = "relativeSidBlock", Wg), qg, BEe = (qg = class extends Xr { +}, qg.NAME = "relativeSidBlock", qg), Gg, BEe = (Gg = class extends Zr { constructor({ value: t = "", ...n } = {}) { super(n), this.value = [], t && this.fromString(t); } @@ -53786,8 +53832,8 @@ var Bs, de = (Bs = class extends ir { for (let n = 0; n < this.value.length; n++) t.sidArray.push(this.value[n].toJSON()); return t; } -}, qg.NAME = "RelativeObjectIdentifierValueBlock", qg), tf; -tf = class extends ir { +}, Gg.NAME = "RelativeObjectIdentifierValueBlock", Gg), rf; +rf = class extends ar { getValue() { return this.valueBlock.toString(); } @@ -53806,16 +53852,16 @@ tf = class extends ir { value: this.getValue() }; } -}, Ue.RelativeObjectIdentifier = tf, tf.NAME = "RelativeObjectIdentifier"; -var nf, z = (nf = class extends ee { +}, Ue.RelativeObjectIdentifier = rf, rf.NAME = "RelativeObjectIdentifier"; +var of, z = (of = class extends ne { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 16; } -}, Ue.Sequence = nf, nf.NAME = "SEQUENCE", nf), rf, An = (rf = class extends ee { +}, Ue.Sequence = of, of.NAME = "SEQUENCE", of), sf, An = (sf = class extends ne { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 17; } -}, Ue.Set = rf, rf.NAME = "SET", rf), Gg, _Ee = (Gg = class extends nc(Xr) { +}, Ue.Set = sf, sf.NAME = "SET", sf), Jg, _Ee = (Jg = class extends nc(Zr) { constructor({ ...t } = {}) { super(t), this.isHexOnly = !0, this.value = ""; } @@ -53825,27 +53871,27 @@ var nf, z = (nf = class extends ee { value: this.value }; } -}, Gg.NAME = "StringValueBlock", Gg), Jg, LEe = (Jg = class extends _Ee { -}, Jg.NAME = "SimpleStringValueBlock", Jg), Yg, Go = (Yg = class extends fEe { +}, Jg.NAME = "StringValueBlock", Jg), Yg, LEe = (Yg = class extends _Ee { +}, Yg.NAME = "SimpleStringValueBlock", Yg), Qg, Jo = (Qg = class extends fEe { constructor({ ...t } = {}) { super(t, LEe); } fromBuffer(t) { - this.valueBlock.value = String.fromCharCode.apply(null, ct(t)); + this.valueBlock.value = String.fromCharCode.apply(null, lt(t)); } fromString(t) { const n = t.length, r = this.valueBlock.valueHexView = new Uint8Array(n); for (let o = 0; o < n; o++) r[o] = t.charCodeAt(o); this.valueBlock.value = t; } -}, Yg.NAME = "SIMPLE STRING", Yg); +}, Qg.NAME = "SIMPLE STRING", Qg); const DEe = new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 }), jEe = /\p{Cs}/u; -var Qg, FEe = (Qg = class extends Go { +var Xg, FEe = (Xg = class extends Jo { fromBuffer(t) { - this.valueBlock.valueHexView = ct(t); + this.valueBlock.valueHexView = lt(t); try { this.valueBlock.value = DEe.decode(this.valueBlock.valueHexView); } catch (n) { @@ -53856,32 +53902,32 @@ var Qg, FEe = (Qg = class extends Go { if (jEe.test(t)) throw new TypeError("The string contains lone surrogates and cannot be encoded as UTF-8"); this.valueBlock.valueHexView = x2e.encode(t), this.valueBlock.value = t; } -}, Qg.NAME = "Utf8StringValueBlock", Qg), of, ki = (of = class extends FEe { +}, Xg.NAME = "Utf8StringValueBlock", Xg), af, ki = (af = class extends FEe { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 12; } -}, Ue.Utf8String = of, of.NAME = "UTF8String", of), Xg, VEe = (Xg = class extends Go { +}, Ue.Utf8String = af, af.NAME = "UTF8String", af), Zg, VEe = (Zg = class extends Jo { checkValue(t) { return t.length % 2 !== 0 ? "BMPString value length must be a multiple of 2" : ""; } fromBuffer(t) { - this.valueBlock.value = K8.decode(t), this.valueBlock.valueHexView = ct(t); + this.valueBlock.value = K8.decode(t), this.valueBlock.valueHexView = lt(t); } fromString(t) { this.valueBlock.value = t, this.valueBlock.valueHexView = K8.encode(t); } -}, Xg.NAME = "BmpStringValueBlock", Xg), sf, kO = (sf = class extends VEe { +}, Zg.NAME = "BmpStringValueBlock", Zg), cf, kO = (cf = class extends VEe { constructor({ ...t } = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 30; } -}, Ue.BmpString = sf, sf.NAME = "BMPString", sf); +}, Ue.BmpString = cf, cf.NAME = "BMPString", cf); const $Ee = 1114111, G8 = 65533; -var Zg, UEe = (Zg = class extends Go { +var em, UEe = (em = class extends Jo { checkValue(t) { return t.length % 4 !== 0 ? "UniversalString value length must be a multiple of 4" : ""; } fromBuffer(t) { - const n = ct(t), r = new DataView(n.buffer, n.byteOffset, n.byteLength), o = n.length >> 2, s = []; + const n = lt(t), r = new DataView(n.buffer, n.byteOffset, n.byteLength), o = n.length >> 2, s = []; for (let a = 0; a < o; a++) { const c = r.getUint32(a * 4); if (c > $Ee) @@ -53897,50 +53943,50 @@ var Zg, UEe = (Zg = class extends Go { } fromString(t) { const n = Array.from(t, (o) => o.codePointAt(0)), r = this.valueBlock.valueHexView = new Uint8Array(n.length * 4); - for (let o = 0; o < n.length; o++) r.set(Cl.encode(n[o], { length: 4 }), o * 4); + for (let o = 0; o < n.length; o++) r.set(Il.encode(n[o], { length: 4 }), o * 4); this.valueBlock.value = t; } -}, Zg.NAME = "UniversalStringValueBlock", Zg), af, AO = (af = class extends UEe { +}, em.NAME = "UniversalStringValueBlock", em), lf, AO = (lf = class extends UEe { constructor({ ...t } = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 28; } -}, Ue.UniversalString = af, af.NAME = "UniversalString", af), cf, lA = (cf = class extends Go { +}, Ue.UniversalString = lf, lf.NAME = "UniversalString", lf), uf, lA = (uf = class extends Jo { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 18; } -}, Ue.NumericString = cf, cf.NAME = "NumericString", cf), lf, ia = (lf = class extends Go { +}, Ue.NumericString = uf, uf.NAME = "NumericString", uf), df, ia = (df = class extends Jo { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 19; } -}, Ue.PrintableString = lf, lf.NAME = "PrintableString", lf), uf, SO = (uf = class extends Go { +}, Ue.PrintableString = df, df.NAME = "PrintableString", df), ff, SO = (ff = class extends Jo { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 20; } -}, Ue.TeletexString = uf, uf.NAME = "TeletexString", uf), df, KEe = (df = class extends Go { +}, Ue.TeletexString = ff, ff.NAME = "TeletexString", ff), hf, KEe = (hf = class extends Jo { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 21; } -}, Ue.VideotexString = df, df.NAME = "VideotexString", df), ff, ZW = (ff = class extends Go { +}, Ue.VideotexString = hf, hf.NAME = "VideotexString", hf), pf, ZW = (pf = class extends Jo { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 22; } -}, Ue.IA5String = ff, ff.NAME = "IA5String", ff), hf, HEe = (hf = class extends Go { +}, Ue.IA5String = pf, pf.NAME = "IA5String", pf), gf, HEe = (gf = class extends Jo { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 25; } -}, Ue.GraphicString = hf, hf.NAME = "GraphicString", hf), pf, eq = (pf = class extends Go { +}, Ue.GraphicString = gf, gf.NAME = "GraphicString", gf), mf, eq = (mf = class extends Jo { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 26; } -}, Ue.VisibleString = pf, pf.NAME = "VisibleString", pf), gf, zEe = (gf = class extends Go { +}, Ue.VisibleString = mf, mf.NAME = "VisibleString", mf), yf, zEe = (yf = class extends Jo { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 27; } -}, Ue.GeneralString = gf, gf.NAME = "GeneralString", gf), mf, WEe = (mf = class extends Go { +}, Ue.GeneralString = yf, yf.NAME = "GeneralString", yf), bf, WEe = (bf = class extends Jo { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 29; } -}, Ue.CharacterString = mf, mf.NAME = "CharacterString", mf), yf, W0 = (yf = class extends eq { +}, Ue.CharacterString = bf, bf.NAME = "CharacterString", bf), wf, W0 = (wf = class extends eq { constructor({ value: t, valueDate: n, ...r } = {}) { if (super(r), this.year = 0, this.month = 0, this.day = 0, this.hour = 0, this.minute = 0, this.second = 0, t) { this.fromString(t), this.valueBlock.valueHexView = new Uint8Array(t.length); @@ -53949,7 +53995,7 @@ var Zg, UEe = (Zg = class extends Go { n && (this.fromDate(n), this.valueBlock.valueHexView = new Uint8Array(this.toBuffer())), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 23; } fromBuffer(t) { - this.fromString(String.fromCharCode.apply(null, ct(t))); + this.fromString(String.fromCharCode.apply(null, lt(t))); } toBuffer() { this.checkYear(); @@ -53996,7 +54042,7 @@ var Zg, UEe = (Zg = class extends Go { second: this.second }; } -}, Ue.UTCTime = yf, yf.NAME = "UTCTime", yf), bf, Yt = (bf = class extends W0 { +}, Ue.UTCTime = wf, wf.NAME = "UTCTime", wf), vf, Xt = (vf = class extends W0 { constructor(t = {}) { super(t), this.millisecond ?? (this.millisecond = 0), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 24; } @@ -54014,30 +54060,30 @@ var Zg, UEe = (Zg = class extends Go { if (t[t.length - 1] === "Z") r = t.substring(0, t.length - 1), n = !0; else { - const d = new Number(t[t.length - 1]); - if (isNaN(d.valueOf())) throw new Error("Wrong input string for conversion"); + const f = new Number(t[t.length - 1]); + if (isNaN(f.valueOf())) throw new Error("Wrong input string for conversion"); r = t; } if (n) { if (r.indexOf("+") !== -1) throw new Error("Wrong input string for conversion"); if (r.indexOf("-") !== -1) throw new Error("Wrong input string for conversion"); } else { - let d = 1, f = r.indexOf("+"), h = ""; - if (f === -1 && (f = r.indexOf("-"), d = -1), f !== -1) { - if (h = r.substring(f + 1), r = r.substring(0, f), h.length !== 2 && h.length !== 4) throw new Error("Wrong input string for conversion"); + let f = 1, d = r.indexOf("+"), h = ""; + if (d === -1 && (d = r.indexOf("-"), f = -1), d !== -1) { + if (h = r.substring(d + 1), r = r.substring(0, d), h.length !== 2 && h.length !== 4) throw new Error("Wrong input string for conversion"); let g = parseInt(h.substring(0, 2), 10); if (isNaN(g.valueOf())) throw new Error("Wrong input string for conversion"); - if (a = d * g, h.length === 4) { + if (a = f * g, h.length === 4) { if (g = parseInt(h.substring(2, 4), 10), isNaN(g.valueOf())) throw new Error("Wrong input string for conversion"); - c = d * g; + c = f * g; } } } let l = r.indexOf("."); if (l === -1 && (l = r.indexOf(",")), l !== -1) { - const d = /* @__PURE__ */ new Number(`0${r.substring(l)}`); - if (isNaN(d.valueOf())) throw new Error("Wrong input string for conversion"); - s = d.valueOf(), o = r.substring(0, l); + const f = /* @__PURE__ */ new Number(`0${r.substring(l)}`); + if (isNaN(f.valueOf())) throw new Error("Wrong input string for conversion"); + s = f.valueOf(), o = r.substring(0, l); } else o = r; switch (!0) { case o.length === 8: @@ -54045,20 +54091,20 @@ var Zg, UEe = (Zg = class extends Go { break; case o.length === 10: if (i = /(\d{4})(\d{2})(\d{2})(\d{2})/gi, l !== -1) { - let d = 60 * s; - this.minute = Math.floor(d), d = 60 * (d - this.minute), this.second = Math.floor(d), d = 1e3 * (d - this.second), this.millisecond = Math.floor(d); + let f = 60 * s; + this.minute = Math.floor(f), f = 60 * (f - this.minute), this.second = Math.floor(f), f = 1e3 * (f - this.second), this.millisecond = Math.floor(f); } break; case o.length === 12: if (i = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi, l !== -1) { - let d = 60 * s; - this.second = Math.floor(d), d = 1e3 * (d - this.second), this.millisecond = Math.floor(d); + let f = 60 * s; + this.second = Math.floor(f), f = 1e3 * (f - this.second), this.millisecond = Math.floor(f); } break; case o.length === 14: if (i = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi, l !== -1) { - const d = 1e3 * s; - this.millisecond = Math.floor(d); + const f = 1e3 * s; + this.millisecond = Math.floor(f); } break; default: @@ -54066,31 +54112,31 @@ var Zg, UEe = (Zg = class extends Go { } const u = i.exec(o); if (u === null) throw new Error("Wrong input string for conversion"); - for (let d = 1; d < u.length; d++) switch (d) { + for (let f = 1; f < u.length; f++) switch (f) { case 1: - this.year = parseInt(u[d], 10); + this.year = parseInt(u[f], 10); break; case 2: - this.month = parseInt(u[d], 10); + this.month = parseInt(u[f], 10); break; case 3: - this.day = parseInt(u[d], 10); + this.day = parseInt(u[f], 10); break; case 4: - this.hour = parseInt(u[d], 10) + a; + this.hour = parseInt(u[f], 10) + a; break; case 5: - this.minute = parseInt(u[d], 10) + c; + this.minute = parseInt(u[f], 10) + c; break; case 6: - this.second = parseInt(u[d], 10); + this.second = parseInt(u[f], 10); break; default: throw new Error("Wrong input string for conversion"); } if (n === !1) { - const d = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond); - this.year = d.getUTCFullYear(), this.month = d.getUTCMonth(), this.day = d.getUTCDay(), this.hour = d.getUTCHours(), this.minute = d.getUTCMinutes(), this.second = d.getUTCSeconds(), this.millisecond = d.getUTCMilliseconds(); + const f = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond); + this.year = f.getUTCFullYear(), this.month = f.getUTCMonth(), this.day = f.getUTCDay(), this.hour = f.getUTCHours(), this.minute = f.getUTCMinutes(), this.second = f.getUTCSeconds(), this.millisecond = f.getUTCMilliseconds(); } } toString(t = "iso") { @@ -54106,45 +54152,45 @@ var Zg, UEe = (Zg = class extends Go { millisecond: this.millisecond }; } -}, Ue.GeneralizedTime = bf, bf.NAME = "GeneralizedTime", bf), wf; -wf = class extends ki { +}, Ue.GeneralizedTime = vf, vf.NAME = "GeneralizedTime", vf), kf; +kf = class extends ki { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 31; } -}, Ue.DATE = wf, wf.NAME = "DATE"; -var vf; -vf = class extends ki { +}, Ue.DATE = kf, kf.NAME = "DATE"; +var Af; +Af = class extends ki { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 32; } -}, Ue.TimeOfDay = vf, vf.NAME = "TimeOfDay"; -var kf; -kf = class extends ki { +}, Ue.TimeOfDay = Af, Af.NAME = "TimeOfDay"; +var Sf; +Sf = class extends ki { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 33; } -}, Ue.DateTime = kf, kf.NAME = "DateTime"; -var Af; -Af = class extends ki { +}, Ue.DateTime = Sf, Sf.NAME = "DateTime"; +var xf; +xf = class extends ki { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 34; } -}, Ue.Duration = Af, Af.NAME = "Duration"; -var Sf; -Sf = class extends ki { +}, Ue.Duration = xf, xf.NAME = "Duration"; +var Ef; +Ef = class extends ki { constructor(t = {}) { super(t), this.idBlock.tagClass = 1, this.idBlock.tagNumber = 14; } -}, Ue.TIME = Sf, Sf.NAME = "TIME"; +}, Ue.TIME = Ef, Ef.NAME = "TIME"; var Xe = class { constructor({ name: e = "", optional: t = !1 } = {}) { this.name = e, this.optional = t; } -}, Xt = class extends Xe { +}, en = class extends Xe { constructor({ value: e = [], ...t } = {}) { super(t), this.value = e; } -}, ot = class extends Xe { +}, st = class extends Xe { constructor({ value: e = new Xe(), local: t = !1, ...n } = {}) { super(n), this.value = e, this.local = t; } @@ -54153,21 +54199,21 @@ var Xe = class { return this.dataView.slice().buffer; } set data(e) { - this.dataView = ct(e); + this.dataView = lt(e); } constructor({ data: e = J2 } = {}) { - this.dataView = ct(e); + this.dataView = lt(e); } fromBER(e, t, n) { const r = t + n; - return this.dataView = ct(e).subarray(t, r), r; + return this.dataView = lt(e).subarray(t, r), r; } toBER(e) { return this.dataView.slice().buffer; } }; function Ee(e, t, n) { - if (n instanceof Xt) { + if (n instanceof en) { for (const o of n.value) if (Ee(e, t, o).verified) return { verified: !0, result: e @@ -54270,7 +54316,7 @@ function Ee(e, t, n) { verified: !1, result: { error: "Unknown error" } }, i = n.valueBlock.value.length; - if (i > 0 && n.valueBlock.value[0] instanceof ot && (i = t.valueBlock.value.length), i === 0) return { + if (i > 0 && n.valueBlock.value[0] instanceof st && (i = t.valueBlock.value.length), i === 0) return { verified: !0, result: e }; @@ -54293,7 +54339,7 @@ function Ee(e, t, n) { }; return e.error = "Inconsistent length between ASN.1 data and schema", n.name && (n.name = n.name.replace(/^\s+|\s+$/g, ""), n.name && (delete e[n.name], c.name = n.name)), c; } - } else if (n.valueBlock.value[0] instanceof ot) { + } else if (n.valueBlock.value[0] instanceof st) { if (s = Ee(e, t.valueBlock.value[a], n.valueBlock.value[0].value), s.verified === !1) if (n.valueBlock.value[0].optional) o++; else @@ -54335,15 +54381,15 @@ function Ee(e, t, n) { }; } J2e({ - BitString: ht, - Integer: de, + BitString: pt, + Integer: ue, OctetString: Oe, Primitive: Je, - Constructed: ee, + Constructed: ne, Sequence: z, Set: An }, { - BaseBlock: ir, + BaseBlock: ar, ViewWriter: _v, LocalIdentificationBlock: Dv, LocalLengthBlock: jv, @@ -54364,11 +54410,11 @@ J2e({ originalPrimitiveToBER: hEe }); pEe({ - Integer: de, - Null: fn, + Integer: ue, + Null: hn, Sequence: z }); -var Co = class xo { +var Io = class Eo { constructor(t = {}) { et(this, "_buffer"); et(this, "_view"); @@ -54436,14 +54482,14 @@ var Co = class xo { return r; } copy(t = 0, n = this.length - t) { - if (!t && !this.length) return new xo(); + if (!t && !this.length) return new Eo(); if (t < 0 || t > this.length - 1) throw new Error(`Wrong start position: ${t}`); - return new xo({ buffer: this._buffer.slice(t, t + n) }); + return new Eo({ buffer: this._buffer.slice(t, t + n) }); } slice(t = 0, n = this.length) { - if (!t && !this.length) return new xo(); + if (!t && !this.length) return new Eo(); if (t < 0 || t > this.length - 1) throw new Error(`Wrong start position: ${t}`); - return new xo({ buffer: this._buffer.slice(t, n) }); + return new Eo({ buffer: this._buffer.slice(t, n) }); } realloc(t) { const n = new ArrayBuffer(t), r = new Uint8Array(n); @@ -54472,13 +54518,13 @@ var Co = class xo { const l = []; for (let u = 0; u < c; u++) l.push(t.view[u]); for (let u = 0; u <= i - c; u++) { - let d = !0; - const f = a ? s - c - u : s + u; - for (let h = 0; h < c; h++) if (this.view[h + f] != l[h]) { - d = !1; + let f = !0; + const d = a ? s - c - u : s + u; + for (let h = 0; h < c; h++) if (this.view[h + d] != l[h]) { + f = !1; break; } - if (d) return a ? s - c - u : s + c + u; + if (f) return a ? s - c - u : s + c + u; } return -1; } @@ -54491,9 +54537,9 @@ var Co = class xo { for (let l = 0; l < t.length; l++) { const u = this.findPattern(t[l], s, i, a); if (u != -1) { - let d = !1; - const f = t[l].length; - a ? u - f >= c.position - c.length && (d = !0) : u - f <= c.position - c.length && (d = !0), d && (c.position = u, c.id = l, c.length = f); + let f = !1; + const d = t[l].length; + a ? u - d >= c.position - c.length && (f = !0) : u - d <= c.position - c.length && (f = !0), f && (c.position = u, c.id = l, c.length = d); } } return c; @@ -54521,8 +54567,8 @@ var Co = class xo { const c = Array.from(t.view); for (let l = 0; l <= s - a; l++) { let u = !0; - const d = o + l; - for (let f = 0; f < a; f++) if (this.view[f + d] != c[f]) { + const f = o + l; + for (let d = 0; d < a; d++) if (this.view[d + f] != c[d]) { u = !1; break; } @@ -54541,16 +54587,16 @@ var Co = class xo { id: -1, position: 0 }, - value: new xo() + value: new Eo() }; let l = i; for (; l > 0; ) { if (c.right = this.findFirstIn(t, a ? s - i + l : s + i - l, l, a), c.right.id == -1) { - i = l, a ? s -= i : s = c.left.position, c.value = new xo({ buffer: this._buffer.slice(s, s + i) }); + i = l, a ? s -= i : s = c.left.position, c.value = new Eo({ buffer: this._buffer.slice(s, s + i) }); break; } if (c.right.position != (a ? c.left.position - t[c.right.id].length : c.left.position + t[c.right.id].length)) { - a ? (s = c.right.position + t[c.right.id].length, i = c.left.position - c.right.position - t[c.right.id].length) : (s = c.left.position, i = c.right.position - c.left.position - t[c.right.id].length), c.value = new xo({ buffer: this._buffer.slice(s, s + i) }); + a ? (s = c.right.position + t[c.right.id].length, i = c.left.position - c.right.position - t[c.right.id].length) : (s = c.left.position, i = c.right.position - c.left.position - t[c.right.id].length), c.value = new Eo({ buffer: this._buffer.slice(s, s + i) }); break; } c.left = c.right, l -= t[c.right.id].length; @@ -54573,7 +54619,7 @@ var Co = class xo { id: -1, position: o }, - value: new xo() + value: new Eo() }; do { const c = a.right.position; @@ -54596,12 +54642,12 @@ var Co = class xo { const c = this.skipNotPatterns(t, s, i, a); if (c == -1) return { position: -1, - value: new xo() + value: new Eo() }; const l = this.skipPatterns(t, c, i - (a ? s - c : c - s), a); return a ? (s = l, i = c - l) : (s = c, i = l - c), { position: l, - value: new xo({ buffer: this._buffer.slice(s, s + i) }) + value: new Eo({ buffer: this._buffer.slice(s, s + i) }) }; } findAllSequences(t, n, r) { @@ -54609,7 +54655,7 @@ var Co = class xo { const i = []; let a = { position: o, - value: new xo() + value: new Eo() }; do { const c = a.position; @@ -54645,7 +54691,7 @@ var Co = class xo { right: u[0] }), l.splice(c - 1, 1), u.splice(0, 1), c = 0; } - return s.sort((d, f) => d.left - f.left), s; + return s.sort((f, d) => f.left - d.left), s; } findPairedArrays(t, n, r, o) { const { start: s, length: i } = this.prepareFindParameters(r, o), a = []; @@ -54670,7 +54716,7 @@ var Co = class xo { right: u[0] }), l.splice(c - 1, 1), u.splice(0, 1), c = 0; } - return a.sort((d, f) => d.left.position - f.left.position), a; + return a.sort((f, d) => f.left.position - d.left.position), a; } replacePattern(t, n, r, o, s = null) { let i = [], a; @@ -54683,24 +54729,24 @@ var Co = class xo { if (i = this.findAllIn([t], l, u), i.length == 0) return c; } else i = s; c.searchPatternPositions.push(...Array.from(i, (g) => g.position)); - const d = t.length - n.length, f = new ArrayBuffer(this.view.length - i.length * d), h = new Uint8Array(f); + const f = t.length - n.length, d = new ArrayBuffer(this.view.length - i.length * f), h = new Uint8Array(d); for (h.set(new Uint8Array(this.buffer, 0, l)), a = 0; a < i.length; a++) { const g = a == 0 ? l : i[a - 1].position; - h.set(new Uint8Array(this.buffer, g, i[a].position - t.length - g), g - a * d), h.set(n.view, i[a].position - t.length - a * d), c.replacePatternPositions.push(i[a].position - t.length - a * d); + h.set(new Uint8Array(this.buffer, g, i[a].position - t.length - g), g - a * f), h.set(n.view, i[a].position - t.length - a * f), c.replacePatternPositions.push(i[a].position - t.length - a * f); } - return a--, h.set(new Uint8Array(this.buffer, i[a].position, this.length - i[a].position), i[a].position - t.length + n.length - a * d), this.buffer = f, this.view = new Uint8Array(this.buffer), c.status = 1, c; + return a--, h.set(new Uint8Array(this.buffer, i[a].position, this.length - i[a].position), i[a].position - t.length + n.length - a * f), this.buffer = d, this.view = new Uint8Array(this.buffer), c.status = 1, c; } skipPatterns(t, n, r, o) { const { start: s, length: i, backward: a } = this.prepareFindParameters(n, r, o); let c = s; for (let l = 0; l < t.length; l++) { - const u = t[l].length, d = a ? c - u : c; - let f = !0; - for (let h = 0; h < u; h++) if (this.view[h + d] != t[l].view[h]) { - f = !1; + const u = t[l].length, f = a ? c - u : c; + let d = !0; + for (let h = 0; h < u; h++) if (this.view[h + f] != t[l].view[h]) { + d = !1; break; } - if (f) { + if (d) { if (l = -1, a) { if (c -= u, c <= 0) return c; } else if (c += u, c >= s + i) return c; @@ -54713,9 +54759,9 @@ var Co = class xo { let c = -1; for (let l = 0; l < i; l++) { for (let u = 0; u < t.length; u++) { - const d = t[u].length, f = a ? s - l - d : s + l; + const f = t[u].length, d = a ? s - l - f : s + l; let h = !0; - for (let g = 0; g < d; g++) if (this.view[g + f] != t[u].view[g]) { + for (let g = 0; g < f; g++) if (this.view[g + d] != t[u].view[g]) { h = !1; break; } @@ -54737,16 +54783,16 @@ var Co = class xo { } }; const qEe = 16777216; -var _d, i0 = (_d = class { +var Dd, i0 = (Dd = class { constructor(t = {}) { - et(this, "_stream", new Co()); + et(this, "_stream", new Io()); et(this, "_length", 0); et(this, "_start", 0); et(this, "backward", !1); et(this, "appendBlock", 0); et(this, "prevLength", 0); et(this, "prevStart", 0); - "view" in t ? this.stream = new Co({ view: t.view }) : "buffer" in t ? this.stream = new Co({ buffer: t.buffer }) : "string" in t ? this.stream = new Co({ string: t.string }) : "hexstring" in t ? this.stream = new Co({ hexstring: t.hexstring }) : "stream" in t ? this.stream = t.stream.slice() : this.stream = new Co(), "backward" in t && t.backward && (this.backward = t.backward, this._start = this.stream.length), "length" in t && t.length > 0 && (this._length = t.length), "start" in t && t.start && t.start > 0 && (this._start = t.start), "appendBlock" in t && t.appendBlock && t.appendBlock > 0 && (this.appendBlock = t.appendBlock); + "view" in t ? this.stream = new Io({ view: t.view }) : "buffer" in t ? this.stream = new Io({ buffer: t.buffer }) : "string" in t ? this.stream = new Io({ string: t.string }) : "hexstring" in t ? this.stream = new Io({ hexstring: t.hexstring }) : "stream" in t ? this.stream = t.stream.slice() : this.stream = new Io(), "backward" in t && t.backward && (this.backward = t.backward, this._start = this.stream.length), "length" in t && t.length > 0 && (this._length = t.length), "start" in t && t.start && t.start > 0 && (this._start = t.start), "appendBlock" in t && t.appendBlock && t.appendBlock > 0 && (this.appendBlock = t.appendBlock); } set stream(t) { this._stream = t, this.prevLength = this._length, this._length = t.length, this.prevStart = this._start, this._start = 0; @@ -54815,7 +54861,7 @@ var _d, i0 = (_d = class { id: -1, position: 0 }, - value: new Co() + value: new Io() }; } else if (r.left.id != -1 && r.left.position > this._start + t[r.left.id].length + n) return { @@ -54827,7 +54873,7 @@ var _d, i0 = (_d = class { id: -1, position: 0 }, - value: new Co() + value: new Io() }; return this.backward ? r.left.id == -1 ? this.start = 0 : this.start = r.left.position : r.right.id == -1 ? this.start = this._start + this._length : this.start = r.right.position, r; } @@ -54842,11 +54888,11 @@ var _d, i0 = (_d = class { if (this.backward) { if (o.position < this._start - o.value.length - r) return { position: -1, - value: new Co() + value: new Io() }; } else if (o.position > this._start + o.value.length + r) return { position: -1, - value: new Co() + value: new Io() }; return this.start = o.position, o; } @@ -54952,9 +54998,9 @@ var _d, i0 = (_d = class { return n & r ? -(r - (n ^ r)) : n; } beforeAppend(t) { - this._start + t > this._stream.length && (t > this.appendBlock && (this.appendBlock = t + _d.APPEND_BLOCK), this._stream.realloc(this._stream.length + this.appendBlock)); + this._start + t > this._stream.length && (t > this.appendBlock && (this.appendBlock = t + Dd.APPEND_BLOCK), this._stream.realloc(this._stream.length + this.appendBlock)); } -}, et(_d, "APPEND_BLOCK", 1e3), _d); +}, et(Dd, "APPEND_BLOCK", 1e3), Dd); const K1 = BigInt(2 ** 32 - 1), J8 = /* @__PURE__ */ BigInt(32); function GEe(e, t = !1) { return t ? { h: Number(e & K1), l: Number(e >> J8 & K1) } : { h: Number(e >> J8 & K1) | 0, l: Number(e & K1) | 0 }; @@ -54973,7 +55019,7 @@ function XEe(e, t, n, r) { const o = YEe(n), s = QEe(n); e.setUint32(t, r ? s : o, r), e.setUint32(t + 4, r ? o : s, r); } -const Y8 = (e, t, n) => e >>> n, Q8 = (e, t, n) => e << 32 - n | t >>> n, ph = (e, t, n) => e >>> n | t << 32 - n, gh = (e, t, n) => e << 32 - n | t >>> n, H1 = (e, t, n) => e << 64 - n | t >>> n - 32, z1 = (e, t, n) => e >>> n - 32 | t << 64 - n; +const Y8 = (e, t, n) => e >>> n, Q8 = (e, t, n) => e << 32 - n | t >>> n, mh = (e, t, n) => e >>> n | t << 32 - n, yh = (e, t, n) => e << 32 - n | t >>> n, H1 = (e, t, n) => e << 64 - n | t >>> n - 32, z1 = (e, t, n) => e >>> n - 32 | t << 64 - n; function Li(e, t, n, r) { const o = (t >>> 0) + (r >>> 0); return { h: e + n + (o / 2 ** 32 | 0) | 0, l: o | 0 }; @@ -55012,7 +55058,7 @@ function aCe(e, t) { if (!(e.length >= n)) throw new RangeError('"output" expected length >= ' + n); } -function Am(...e) { +function Sm(...e) { for (let t = 0; t < e.length; t++) e[t].fill(0); } @@ -55087,8 +55133,8 @@ class rT { const a = t === n ? r : VC(t), c = this.outputLen, l = c / 4, u = this.get(); if (c % 4 || l > u.length) throw new Error("invalid outputLen"); - for (let d = 0; d < l; d++) - a.setUint32(4 * d, u[d], s); + for (let f = 0; f < l; f++) + a.setUint32(4 * f, u[f], s); } digest() { const { buffer: t, outputLen: n } = this; @@ -55153,7 +55199,7 @@ const lCe = /* @__PURE__ */ Uint32Array.from([ 2562383102, 271733878, 3285377520 -]), hc = /* @__PURE__ */ new Uint32Array(80); +]), pc = /* @__PURE__ */ new Uint32Array(80); class fCe extends rT { constructor() { super(64, 20, 8, !1); @@ -55175,23 +55221,23 @@ class fCe extends rT { } process(n, r) { for (let l = 0; l < 16; l++, r += 4) - hc[l] = n.getUint32(r, !1); + pc[l] = n.getUint32(r, !1); for (let l = 16; l < 80; l++) - hc[l] = $C(hc[l - 3] ^ hc[l - 8] ^ hc[l - 14] ^ hc[l - 16], 1); + pc[l] = $C(pc[l - 3] ^ pc[l - 8] ^ pc[l - 14] ^ pc[l - 16], 1); let { A: o, B: s, C: i, D: a, E: c } = this; for (let l = 0; l < 80; l++) { - let u, d; - l < 20 ? (u = nq(s, i, a), d = 1518500249) : l < 40 ? (u = s ^ i ^ a, d = 1859775393) : l < 60 ? (u = rq(s, i, a), d = 2400959708) : (u = s ^ i ^ a, d = 3395469782); - const f = $C(o, 5) + u + c + d + hc[l] | 0; - c = a, a = i, i = $C(s, 30), s = o, o = f; + let u, f; + l < 20 ? (u = nq(s, i, a), f = 1518500249) : l < 40 ? (u = s ^ i ^ a, f = 1859775393) : l < 60 ? (u = rq(s, i, a), f = 2400959708) : (u = s ^ i ^ a, f = 3395469782); + const d = $C(o, 5) + u + c + f + pc[l] | 0; + c = a, a = i, i = $C(s, 30), s = o, o = d; } o = o + this.A | 0, s = s + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, c = c + this.E | 0, this.set(o, s, i, a, c); } roundClean() { - Am(hc); + Sm(pc); } destroy() { - this.destroyed = !0, this.set(0, 0, 0, 0, 0), Am(this.buffer); + this.destroyed = !0, this.set(0, 0, 0, 0, 0), Sm(this.buffer); } } const hCe = /* @__PURE__ */ Q2(() => new fCe()), pCe = /* @__PURE__ */ Uint32Array.from([ @@ -55259,7 +55305,7 @@ const hCe = /* @__PURE__ */ Q2(() => new fCe()), pCe = /* @__PURE__ */ Uint32Arr 2756734187, 3204031479, 3329325298 -]), pc = /* @__PURE__ */ new Uint32Array(64); +]), gc = /* @__PURE__ */ new Uint32Array(64); class gCe extends rT { constructor(n, r) { super(64, n, 8, !1); @@ -55289,24 +55335,24 @@ class gCe extends rT { return (n || (n = new this.constructor())).set(...this.get()), this._cloneIntoMeta(n); } process(n, r) { - for (let f = 0; f < 16; f++, r += 4) - pc[f] = n.getUint32(r, !1); - for (let f = 16; f < 64; f++) { - const h = pc[f - 15], g = pc[f - 2], p = Cs(h, 7) ^ Cs(h, 18) ^ h >>> 3, m = Cs(g, 17) ^ Cs(g, 19) ^ g >>> 10; - pc[f] = m + pc[f - 7] + p + pc[f - 16] | 0; + for (let d = 0; d < 16; d++, r += 4) + gc[d] = n.getUint32(r, !1); + for (let d = 16; d < 64; d++) { + const h = gc[d - 15], g = gc[d - 2], p = Cs(h, 7) ^ Cs(h, 18) ^ h >>> 3, m = Cs(g, 17) ^ Cs(g, 19) ^ g >>> 10; + gc[d] = m + gc[d - 7] + p + gc[d - 16] | 0; } - let { A: o, B: s, C: i, D: a, E: c, F: l, G: u, H: d } = this; - for (let f = 0; f < 64; f++) { - const h = Cs(c, 6) ^ Cs(c, 11) ^ Cs(c, 25), g = d + h + nq(c, l, u) + pCe[f] + pc[f] | 0, m = (Cs(o, 2) ^ Cs(o, 13) ^ Cs(o, 22)) + rq(o, s, i) | 0; - d = u, u = l, l = c, c = a + g | 0, a = i, i = s, s = o, o = g + m | 0; + let { A: o, B: s, C: i, D: a, E: c, F: l, G: u, H: f } = this; + for (let d = 0; d < 64; d++) { + const h = Cs(c, 6) ^ Cs(c, 11) ^ Cs(c, 25), g = f + h + nq(c, l, u) + pCe[d] + gc[d] | 0, m = (Cs(o, 2) ^ Cs(o, 13) ^ Cs(o, 22)) + rq(o, s, i) | 0; + f = u, u = l, l = c, c = a + g | 0, a = i, i = s, s = o, o = g + m | 0; } - o = o + this.A | 0, s = s + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, c = c + this.E | 0, l = l + this.F | 0, u = u + this.G | 0, d = d + this.H | 0, this.set(o, s, i, a, c, l, u, d); + o = o + this.A | 0, s = s + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, c = c + this.E | 0, l = l + this.F | 0, u = u + this.G | 0, f = f + this.H | 0, this.set(o, s, i, a, c, l, u, f); } roundClean() { - Am(pc); + Sm(gc); } destroy() { - this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0), Am(this.buffer); + this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0), Sm(this.buffer); } } class mCe extends gCe { @@ -55395,7 +55441,7 @@ const oq = JEe([ "0x597f299cfc657e2a", "0x5fcb6fab3ad6faec", "0x6c44198c4a475817" -].map((e) => BigInt(e))), yCe = oq[0], bCe = oq[1], gc = /* @__PURE__ */ new Uint32Array(80), mc = /* @__PURE__ */ new Uint32Array(80); +].map((e) => BigInt(e))), yCe = oq[0], bCe = oq[1], mc = /* @__PURE__ */ new Uint32Array(80), yc = /* @__PURE__ */ new Uint32Array(80); class sq extends rT { constructor(n, r) { super(128, n, 16, !1); @@ -55424,37 +55470,37 @@ class sq extends rT { } // prettier-ignore get() { - const { Ah: n, Al: r, Bh: o, Bl: s, Ch: i, Cl: a, Dh: c, Dl: l, Eh: u, El: d, Fh: f, Fl: h, Gh: g, Gl: p, Hh: m, Hl: v } = this; - return [n, r, o, s, i, a, c, l, u, d, f, h, g, p, m, v]; + const { Ah: n, Al: r, Bh: o, Bl: s, Ch: i, Cl: a, Dh: c, Dl: l, Eh: u, El: f, Fh: d, Fl: h, Gh: g, Gl: p, Hh: m, Hl: v } = this; + return [n, r, o, s, i, a, c, l, u, f, d, h, g, p, m, v]; } // prettier-ignore - set(n, r, o, s, i, a, c, l, u, d, f, h, g, p, m, v) { - this.Ah = n | 0, this.Al = r | 0, this.Bh = o | 0, this.Bl = s | 0, this.Ch = i | 0, this.Cl = a | 0, this.Dh = c | 0, this.Dl = l | 0, this.Eh = u | 0, this.El = d | 0, this.Fh = f | 0, this.Fl = h | 0, this.Gh = g | 0, this.Gl = p | 0, this.Hh = m | 0, this.Hl = v | 0; + set(n, r, o, s, i, a, c, l, u, f, d, h, g, p, m, v) { + this.Ah = n | 0, this.Al = r | 0, this.Bh = o | 0, this.Bl = s | 0, this.Ch = i | 0, this.Cl = a | 0, this.Dh = c | 0, this.Dl = l | 0, this.Eh = u | 0, this.El = f | 0, this.Fh = d | 0, this.Fl = h | 0, this.Gh = g | 0, this.Gl = p | 0, this.Hh = m | 0, this.Hl = v | 0; } _cloneInto(n) { return (n || (n = new this.constructor())).set(...this.get()), this._cloneIntoMeta(n); } process(n, r) { for (let k = 0; k < 16; k++, r += 4) - gc[k] = n.getUint32(r), mc[k] = n.getUint32(r += 4); + mc[k] = n.getUint32(r), yc[k] = n.getUint32(r += 4); for (let k = 16; k < 80; k++) { - const N = gc[k - 15] | 0, w = mc[k - 15] | 0, y = ph(N, w, 1) ^ ph(N, w, 8) ^ Y8(N, w, 7), x = gh(N, w, 1) ^ gh(N, w, 8) ^ Q8(N, w, 7), A = gc[k - 2] | 0, b = mc[k - 2] | 0, E = ph(A, b, 19) ^ H1(A, b, 61) ^ Y8(A, b, 6), I = gh(A, b, 19) ^ z1(A, b, 61) ^ Q8(A, b, 6), O = tCe(x, I, mc[k - 7], mc[k - 16]), T = nCe(O, y, E, gc[k - 7], gc[k - 16]); - gc[k] = T | 0, mc[k] = O | 0; + const N = mc[k - 15] | 0, w = yc[k - 15] | 0, y = mh(N, w, 1) ^ mh(N, w, 8) ^ Y8(N, w, 7), x = yh(N, w, 1) ^ yh(N, w, 8) ^ Q8(N, w, 7), A = mc[k - 2] | 0, b = yc[k - 2] | 0, E = mh(A, b, 19) ^ H1(A, b, 61) ^ Y8(A, b, 6), I = yh(A, b, 19) ^ z1(A, b, 61) ^ Q8(A, b, 6), O = tCe(x, I, yc[k - 7], yc[k - 16]), T = nCe(O, y, E, mc[k - 7], mc[k - 16]); + mc[k] = T | 0, yc[k] = O | 0; } - let { Ah: o, Al: s, Bh: i, Bl: a, Ch: c, Cl: l, Dh: u, Dl: d, Eh: f, El: h, Fh: g, Fl: p, Gh: m, Gl: v, Hh: S, Hl: C } = this; + let { Ah: o, Al: s, Bh: i, Bl: a, Ch: c, Cl: l, Dh: u, Dl: f, Eh: d, El: h, Fh: g, Fl: p, Gh: m, Gl: v, Hh: S, Hl: C } = this; for (let k = 0; k < 80; k++) { - const N = ph(f, h, 14) ^ ph(f, h, 18) ^ H1(f, h, 41), w = gh(f, h, 14) ^ gh(f, h, 18) ^ z1(f, h, 41), y = f & g ^ ~f & m, x = h & p ^ ~h & v, A = rCe(C, w, x, bCe[k], mc[k]), b = oCe(A, S, N, y, yCe[k], gc[k]), E = A | 0, I = ph(o, s, 28) ^ H1(o, s, 34) ^ H1(o, s, 39), O = gh(o, s, 28) ^ z1(o, s, 34) ^ z1(o, s, 39), T = o & i ^ o & c ^ i & c, R = s & a ^ s & l ^ a & l; - S = m | 0, C = v | 0, m = g | 0, v = p | 0, g = f | 0, p = h | 0, { h: f, l: h } = Li(u | 0, d | 0, b | 0, E | 0), u = c | 0, d = l | 0, c = i | 0, l = a | 0, i = o | 0, a = s | 0; + const N = mh(d, h, 14) ^ mh(d, h, 18) ^ H1(d, h, 41), w = yh(d, h, 14) ^ yh(d, h, 18) ^ z1(d, h, 41), y = d & g ^ ~d & m, x = h & p ^ ~h & v, A = rCe(C, w, x, bCe[k], yc[k]), b = oCe(A, S, N, y, yCe[k], mc[k]), E = A | 0, I = mh(o, s, 28) ^ H1(o, s, 34) ^ H1(o, s, 39), O = yh(o, s, 28) ^ z1(o, s, 34) ^ z1(o, s, 39), T = o & i ^ o & c ^ i & c, R = s & a ^ s & l ^ a & l; + S = m | 0, C = v | 0, m = g | 0, v = p | 0, g = d | 0, p = h | 0, { h: d, l: h } = Li(u | 0, f | 0, b | 0, E | 0), u = c | 0, f = l | 0, c = i | 0, l = a | 0, i = o | 0, a = s | 0; const M = ZEe(E, O, R); o = eCe(M, b, I, T), s = M | 0; } - ({ h: o, l: s } = Li(this.Ah | 0, this.Al | 0, o | 0, s | 0)), { h: i, l: a } = Li(this.Bh | 0, this.Bl | 0, i | 0, a | 0), { h: c, l } = Li(this.Ch | 0, this.Cl | 0, c | 0, l | 0), { h: u, l: d } = Li(this.Dh | 0, this.Dl | 0, u | 0, d | 0), { h: f, l: h } = Li(this.Eh | 0, this.El | 0, f | 0, h | 0), { h: g, l: p } = Li(this.Fh | 0, this.Fl | 0, g | 0, p | 0), { h: m, l: v } = Li(this.Gh | 0, this.Gl | 0, m | 0, v | 0), { h: S, l: C } = Li(this.Hh | 0, this.Hl | 0, S | 0, C | 0), this.set(o, s, i, a, c, l, u, d, f, h, g, p, m, v, S, C); + ({ h: o, l: s } = Li(this.Ah | 0, this.Al | 0, o | 0, s | 0)), { h: i, l: a } = Li(this.Bh | 0, this.Bl | 0, i | 0, a | 0), { h: c, l } = Li(this.Ch | 0, this.Cl | 0, c | 0, l | 0), { h: u, l: f } = Li(this.Dh | 0, this.Dl | 0, u | 0, f | 0), { h: d, l: h } = Li(this.Eh | 0, this.El | 0, d | 0, h | 0), { h: g, l: p } = Li(this.Fh | 0, this.Fl | 0, g | 0, p | 0), { h: m, l: v } = Li(this.Gh | 0, this.Gl | 0, m | 0, v | 0), { h: S, l: C } = Li(this.Hh | 0, this.Hl | 0, S | 0, C | 0), this.set(o, s, i, a, c, l, u, f, d, h, g, p, m, v, S, C); } roundClean() { - Am(gc, mc); + Sm(mc, yc); } destroy() { - this.destroyed = !0, Am(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + this.destroyed = !0, Sm(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } } class wCe extends sq { @@ -55511,9 +55557,9 @@ const kCe = /* @__PURE__ */ Q2( * */ const Dn = /* @__PURE__ */ new ArrayBuffer(0); -var Ol, Ut = (Ol = class extends TypeError { +var Pl, zt = (Pl = class extends TypeError { constructor(...t) { - super(...t), this.name = Ol.NAME; + super(...t), this.name = Pl.NAME; } static isType(t, n) { if (typeof n == "string") { @@ -55527,12 +55573,12 @@ var Ol, Ut = (Ol = class extends TypeError { static assert(t, n, ...r) { for (const s of r) if (this.isType(t, s)) return; const o = r.map((s) => s instanceof Function && "name" in s ? s.name : `${s}`); - throw new Ol(`Parameter '${n}' is not of type ${o.length > 1 ? `(${o.join(" or ")})` : o[0]}`); + throw new Pl(`Parameter '${n}' is not of type ${o.length > 1 ? `(${o.join(" or ")})` : o[0]}`); } -}, Ol.NAME = "ArgumentError", Ol), aa, Ct = (aa = class extends TypeError { +}, Pl.NAME = "ArgumentError", Pl), aa, Ot = (aa = class extends TypeError { static assert(...t) { let n = null, r, o; - typeof t[0] == "string" ? (n = t[0], r = t[1], o = t.slice(2)) : (r = t[0], o = t.slice(1)), Ut.assert(r, "parameters", "object"); + typeof t[0] == "string" ? (n = t[0], r = t[1], o = t.slice(2)) : (r = t[0], o = t.slice(1)), zt.assert(r, "parameters", "object"); for (const s of o) { const i = r[s]; if (i == null) throw new aa(s, n); @@ -55554,12 +55600,12 @@ var Ol, Ut = (Ol = class extends TypeError { constructor(t) { super(t), this.name = "AsnError"; } -}, em, Ce = (em = class { +}, tm, Ce = (tm = class { static blockName() { return this.CLASS_NAME; } static fromBER(t) { - const n = hn(t); + const n = pn(t); ke.assert(n, this.name); try { return new this({ schema: n.result }); @@ -55586,17 +55632,17 @@ var Ol, Ut = (Ol = class extends TypeError { const r = n.toBER(); switch (t.toLowerCase()) { case "hex": - return Xn.encode(r); + return Zn.encode(r); case "base64": return vO.encode(r); case "base64url": - return St.encode(r); + return xt.encode(r); default: throw new Error(`Unknown type of encoding '${t}'`); } } -}, em.CLASS_NAME = "PkiObject", em); -function sl(e) { +}, tm.CLASS_NAME = "PkiObject", tm); +function il(e) { let t = !1, n = ""; const r = e.trim(); for (let o = 0; o < r.length; o++) r.charCodeAt(o) === 32 ? t === !1 && (t = !0) : (t && (n += " ", t = !1), n += r[o]); @@ -55621,7 +55667,7 @@ var _s, xO = (_s = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.type || "" }), new Xe({ name: n.value || "" })] + value: [new $e({ name: n.type || "" }), new Xe({ name: n.value || "" })] }); } fromSchema(t) { @@ -55633,7 +55679,7 @@ var _s, xO = (_s = class extends Ce { ke.assertSchema(n, this.className), this.type = n.result.type.valueBlock.toString(), this.value = n.result.typeValue; } toSchema() { - return new z({ value: [new Ve({ value: this.type }), this.value] }); + return new z({ value: [new $e({ value: this.type }), this.value] }); } toJSON() { const t = { type: this.type }; @@ -55654,7 +55700,7 @@ var _s, xO = (_s = class extends Ce { zEe.blockName(), WEe.blockName() ]; - if (t instanceof ArrayBuffer) return Kt.equal(this.value.valueBeforeDecodeView, t); + if (t instanceof ArrayBuffer) return Wt.equal(this.value.valueBeforeDecodeView, t); if (t.constructor.blockName() === _s.blockName()) { if (this.type !== t.type) return !1; const r = [!1, !1], o = this.value.constructor.blockName(); @@ -55662,16 +55708,16 @@ var _s, xO = (_s = class extends Ce { o === s && (r[0] = !0), t.value.constructor.blockName() === s && (r[1] = !0); if (r[0] !== r[1]) return !1; if (r[0] && r[1]) { - const s = sl(this.value.valueBlock.value), i = sl(t.value.valueBlock.value); + const s = il(this.value.valueBlock.value), i = il(t.value.valueBlock.value); if (s.localeCompare(i) !== 0) return !1; - } else if (!Kt.equal(this.value.valueBeforeDecodeView, t.value.valueBeforeDecodeView)) return !1; + } else if (!Wt.equal(this.value.valueBeforeDecodeView, t.value.valueBeforeDecodeView)) return !1; return !0; } return !1; } }, _s.CLASS_NAME = "AttributeTypeAndValue", _s); const W1 = "typesAndValues", t4 = "valueBeforeDecode"; -var Ls, Qt = (Ls = class extends Ce { +var Ls, Zt = (Ls = class extends Ce { constructor(t = {}) { super(), this.typesAndValues = t.typesAndValues ?? Ls.defaultValues("typesAndValues"), this.valueBeforeDecode = t.valueBeforeDecode ?? Ls.defaultValues("valueBeforeDecode"), t.schema && this.fromSchema(t.schema); } @@ -55699,9 +55745,9 @@ var Ls, Qt = (Ls = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.repeatedSequence || "", - value: new An({ value: [new ot({ + value: new An({ value: [new st({ name: n.repeatedSet || "", value: xO.schema(n.typeAndValue || {}) })] }) @@ -55718,7 +55764,7 @@ var Ls, Qt = (Ls = class extends Ce { } toSchema() { if (this.valueBeforeDecode.byteLength === 0) return new z({ value: [new An({ value: Array.from(this.typesAndValues, (n) => n.toSchema()) })] }); - const t = hn(this.valueBeforeDecode); + const t = pn(this.valueBeforeDecode); if (ke.assert(t, "RelativeDistinguishedNames"), !(t.result instanceof z)) throw new Error("ASN.1 result should be SEQUENCE"); return t.result; } @@ -55731,7 +55777,7 @@ var Ls, Qt = (Ls = class extends Ce { for (const [n, r] of this.typesAndValues.entries()) if (r.isEqual(t.typesAndValues[n]) === !1) return !1; return !0; } - return t instanceof ArrayBuffer ? Kt.equal(this.valueBeforeDecode, t) : !1; + return t instanceof ArrayBuffer ? Wt.equal(this.valueBeforeDecode, t) : !1; } }, Ls.CLASS_NAME = "RelativeDistinguishedNames", Ls); const n4 = "type", r4 = "value"; @@ -55740,23 +55786,23 @@ function xCe(e = {}, t = !1) { return new z({ optional: t, value: [ - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 2, tagNumber: 1 }, name: n.country_name || "", - value: [new Xt({ value: [new lA(), new ia()] })] + value: [new en({ value: [new lA(), new ia()] })] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 2, tagNumber: 2 }, name: n.administration_domain_name || "", - value: [new Xt({ value: [new lA(), new ia()] })] + value: [new en({ value: [new lA(), new ia()] })] }), new Je({ optional: !0, @@ -55776,14 +55822,14 @@ function xCe(e = {}, t = !1) { name: n.terminal_identifier || "", isHexOnly: !0 }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 2 }, name: n.private_domain_name || "", - value: [new Xt({ value: [new lA(), new ia()] })] + value: [new en({ value: [new lA(), new ia()] })] }), new Je({ optional: !0, @@ -55803,7 +55849,7 @@ function xCe(e = {}, t = !1) { }, isHexOnly: !0 }), - new ee({ + new ne({ optional: !0, name: n.personal_name || "", idBlock: { @@ -55844,14 +55890,14 @@ function xCe(e = {}, t = !1) { }) ] }), - new ee({ + new ne({ optional: !0, name: n.organizational_unit_names || "", idBlock: { tagClass: 3, tagNumber: 6 }, - value: [new ot({ value: new ia() })] + value: [new st({ value: new ia() })] }) ] }); @@ -55872,7 +55918,7 @@ function CCe(e = !1) { tagNumber: 0 }, isHexOnly: !0 - }), new ee({ + }), new ne({ optional: !0, idBlock: { tagClass: 3, @@ -55882,7 +55928,7 @@ function CCe(e = !1) { })] }); } -var ss, Dt = (ss = class extends Ce { +var ss, Vt = (ss = class extends Ce { constructor(t = {}) { super(), this.type = t.type ?? ss.defaultValues("type"), this.value = t.value ?? ss.defaultValues("value"), t.schema && this.fromSchema(t.schema); } @@ -55908,14 +55954,14 @@ var ss, Dt = (ss = class extends Ce { } static schema(t = {}) { const n = t.names ?? {}; - return new Xt({ value: [ - new ee({ + return new en({ value: [ + new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, name: n.blockName || "", - value: [new Ve(), new ee({ + value: [new $e(), new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -55937,7 +55983,7 @@ var ss, Dt = (ss = class extends Ce { tagNumber: 2 } }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 3 @@ -55949,39 +55995,39 @@ var ss, Dt = (ss = class extends Ce { CCe(!0) ] }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 4 }, name: n.blockName || "", - value: [Qt.schema(n.directoryName || {})] + value: [Zt.schema(n.directoryName || {})] }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 5 }, name: n.blockName || "", - value: [new ee({ + value: [new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Xt({ value: [ + value: [new en({ value: [ new SO(), new ia(), new AO(), new ki(), new kO() ] })] - }), new ee({ + }), new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new Xt({ value: [ + value: [new en({ value: [ new SO(), new ia(), new AO(), @@ -56048,7 +56094,7 @@ var ss, Dt = (ss = class extends Ce { { const r = n.result.blockName; r.idBlock.tagClass = 1, r.idBlock.tagNumber = 22; - const o = r.toBER(!1), s = hn(o); + const o = r.toBER(!1), s = pn(o); ke.assert(s, "GeneralName value"), this.value = s.result.valueBlock.value; } break; @@ -56056,7 +56102,7 @@ var ss, Dt = (ss = class extends Ce { this.value = n.result.blockName; break; case 4: - this.value = new Qt({ schema: n.result.directoryName }); + this.value = new Zt({ schema: n.result.directoryName }); break; case 5: this.value = n.result.ediPartyName; @@ -56067,7 +56113,7 @@ var ss, Dt = (ss = class extends Ce { case 8: { const r = n.result.blockName; r.idBlock.tagClass = 1, r.idBlock.tagNumber = 6; - const o = r.toBER(!1), s = hn(o); + const o = r.toBER(!1), s = pn(o); ke.assert(s, "GeneralName registeredID"), this.value = s.result.valueBlock.toString(); } } @@ -56077,7 +56123,7 @@ var ss, Dt = (ss = class extends Ce { case 0: case 3: case 5: - return new ee({ + return new ne({ idBlock: { tagClass: 3, tagNumber: this.type @@ -56091,7 +56137,7 @@ var ss, Dt = (ss = class extends Ce { return t.idBlock.tagClass = 3, t.idBlock.tagNumber = this.type, t; } case 4: - return new ee({ + return new ne({ idBlock: { tagClass: 3, tagNumber: 4 @@ -56103,7 +56149,7 @@ var ss, Dt = (ss = class extends Ce { return t.idBlock.tagClass = 3, t.idBlock.tagNumber = this.type, t; } case 8: { - const t = new Ve({ value: this.value }); + const t = new $e({ value: this.value }); return t.idBlock.tagClass = 3, t.idBlock.tagNumber = this.type, t; } default: @@ -56133,7 +56179,7 @@ var ca, ox = (ca = class extends Ce { case qy: return ""; case Gy: - return new Dt(); + return new Vt(); default: return super.defaultValues(t); } @@ -56142,7 +56188,7 @@ var ca, ox = (ca = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.accessMethod || "" }), Dt.schema(n.accessLocation || {})] + value: [new $e({ name: n.accessMethod || "" }), Vt.schema(n.accessLocation || {})] }); } fromSchema(t) { @@ -56151,10 +56197,10 @@ var ca, ox = (ca = class extends Ce { accessMethod: qy, accessLocation: { names: { blockName: Gy } } } })); - ke.assertSchema(n, this.className), this.accessMethod = n.result.accessMethod.valueBlock.toString(), this.accessLocation = new Dt({ schema: n.result.accessLocation }); + ke.assertSchema(n, this.className), this.accessMethod = n.result.accessMethod.valueBlock.toString(), this.accessLocation = new Vt({ schema: n.result.accessLocation }); } toSchema() { - return new z({ value: [new Ve({ value: this.accessMethod }), this.accessLocation.toSchema()] }); + return new z({ value: [new $e({ value: this.accessMethod }), this.accessLocation.toSchema()] }); } toJSON() { return { @@ -56164,7 +56210,7 @@ var ca, ox = (ca = class extends Ce { } }, ca.CLASS_NAME = "AccessDescription", ca); const q1 = "seconds", G1 = "millis", J1 = "micros"; -var is, mh = (is = class extends Ce { +var is, bh = (is = class extends Ce { constructor(t = {}) { super(), "seconds" in t && (this.seconds = t.seconds ?? is.defaultValues("seconds")), "millis" in t && (this.millis = t.millis ?? is.defaultValues("millis")), "micros" in t && (this.micros = t.micros ?? is.defaultValues("micros")), t.schema && this.fromSchema(t.schema); } @@ -56194,7 +56240,7 @@ var is, mh = (is = class extends Ce { name: n.blockName || "", optional: !0, value: [ - new de({ + new ue({ optional: !0, name: n.seconds || "" }), @@ -56229,18 +56275,18 @@ var is, mh = (is = class extends Ce { micros: J1 } })); if (ke.assertSchema(n, this.className), "seconds" in n.result && (this.seconds = n.result.seconds.valueBlock.valueDec), "millis" in n.result) { - const r = new de({ valueHex: n.result.millis.valueBlock.valueHex }); + const r = new ue({ valueHex: n.result.millis.valueBlock.valueHex }); this.millis = r.valueBlock.valueDec; } if ("micros" in n.result) { - const r = new de({ valueHex: n.result.micros.valueBlock.valueHex }); + const r = new ue({ valueHex: n.result.micros.valueBlock.valueHex }); this.micros = r.valueBlock.valueDec; } } toSchema() { const t = []; - if (this.seconds !== void 0 && t.push(new de({ value: this.seconds })), this.millis !== void 0) { - const n = new de({ value: this.millis }); + if (this.seconds !== void 0 && t.push(new ue({ value: this.seconds })), this.millis !== void 0) { + const n = new ue({ value: this.millis }); t.push(new Je({ idBlock: { tagClass: 3, @@ -56250,7 +56296,7 @@ var is, mh = (is = class extends Ce { })); } if (this.micros !== void 0) { - const n = new de({ value: this.micros }); + const n = new ue({ value: this.micros }); t.push(new Je({ idBlock: { tagClass: 3, @@ -56267,7 +56313,7 @@ var is, mh = (is = class extends Ce { } }, is.CLASS_NAME = "Accuracy", is); const Y1 = "algorithmId", vy = "algorithmParams", aq = "algorithm", EO = "params", NCe = [aq, EO]; -var Ds, fe = (Ds = class extends Ce { +var Ds, de = (Ds = class extends Ce { constructor(t = {}) { super(), this.algorithmId = t[Y1] ?? Ds.defaultValues(Y1), vy in t && (this.algorithmParams = t[vy] ?? Ds.defaultValues(vy)), t.schema && this.fromSchema(t.schema); } @@ -56296,7 +56342,7 @@ var Ds, fe = (Ds = class extends Ce { return new z({ name: n.blockName || "", optional: n.optional || !1, - value: [new Ve({ name: n.algorithmIdentifier || "" }), new Xe({ + value: [new $e({ name: n.algorithmIdentifier || "" }), new Xe({ name: n.algorithmParams || "", optional: !0 })] @@ -56312,7 +56358,7 @@ var Ds, fe = (Ds = class extends Ce { } toSchema() { const t = []; - return t.push(new Ve({ value: this.algorithmId })), this.algorithmParams && !(this.algorithmParams instanceof Xe) && t.push(this.algorithmParams), new z({ value: t }); + return t.push(new $e({ value: this.algorithmId })), this.algorithmParams && !(this.algorithmParams instanceof Xe) && t.push(this.algorithmParams), new z({ value: t }); } toJSON() { const t = { algorithmId: this.algorithmId }; @@ -56322,14 +56368,14 @@ var Ds, fe = (Ds = class extends Ce { return !(t instanceof Ds) || this.algorithmId !== t.algorithmId ? !1 : this.algorithmParams ? t.algorithmParams ? JSON.stringify(this.algorithmParams) === JSON.stringify(t.algorithmParams) : !1 : !t.algorithmParams; } }, Ds.CLASS_NAME = "AlgorithmIdentifier", Ds); -const Mh = "altNames", OCe = [Mh]; -var Pl, o4 = (Pl = class extends Ce { +const Bh = "altNames", OCe = [Bh]; +var Rl, o4 = (Rl = class extends Ce { constructor(t = {}) { - super(), this.altNames = t[Mh] ?? Pl.defaultValues(Mh), t.schema && this.fromSchema(t.schema); + super(), this.altNames = t[Bh] ?? Rl.defaultValues(Bh), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Mh: + case Bh: return []; default: return super.defaultValues(t); @@ -56339,16 +56385,16 @@ var Pl, o4 = (Pl = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.altNames || "", - value: Dt.schema() + value: Vt.schema() })] }); } fromSchema(t) { for (const r of OCe) delete t[r]; - const n = Ee(t, t, Pl.schema({ names: { altNames: Mh } })); - ke.assertSchema(n, this.className), Mh in n.result && (this.altNames = Array.from(n.result.altNames, (r) => new Dt({ schema: r }))); + const n = Ee(t, t, Rl.schema({ names: { altNames: Bh } })); + ke.assertSchema(n, this.className), Bh in n.result && (this.altNames = Array.from(n.result.altNames, (r) => new Vt({ schema: r }))); } toSchema() { return new z({ value: Array.from(this.altNames, (t) => t.toSchema()) }); @@ -56356,17 +56402,17 @@ var Pl, o4 = (Pl = class extends Ce { toJSON() { return { altNames: Array.from(this.altNames, (t) => t.toJSON()) }; } -}, Pl.CLASS_NAME = "AltName", Pl); -const Bh = "type", _h = "values", PCe = [Bh, _h]; +}, Rl.CLASS_NAME = "AltName", Rl); +const _h = "type", Lh = "values", PCe = [_h, Lh]; var la, En = (la = class extends Ce { constructor(t = {}) { - super(), this.type = t[Bh] ?? la.defaultValues(Bh), this.values = t[_h] ?? la.defaultValues(_h), t.schema && this.fromSchema(t.schema); + super(), this.type = t[_h] ?? la.defaultValues(_h), this.values = t[Lh] ?? la.defaultValues(Lh), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Bh: - return ""; case _h: + return ""; + case Lh: return []; default: return super.defaultValues(t); @@ -56374,9 +56420,9 @@ var la, En = (la = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Bh: - return n === ""; case _h: + return n === ""; + case Lh: return n.length === 0; default: return super.defaultValues(t); @@ -56386,9 +56432,9 @@ var la, En = (la = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.type || "" }), new An({ + value: [new $e({ name: n.type || "" }), new An({ name: n.setName || "", - value: [new ot({ + value: [new st({ name: n.values || "", value: new Xe() })] @@ -56398,13 +56444,13 @@ var la, En = (la = class extends Ce { fromSchema(t) { for (const r of PCe) delete t[r]; const n = Ee(t, t, la.schema({ names: { - type: Bh, - values: _h + type: _h, + values: Lh } })); ke.assertSchema(n, this.className), this.type = n.result.type.valueBlock.toString(), this.values = n.result.values; } toSchema() { - return new z({ value: [new Ve({ value: this.type }), new An({ value: this.values })] }); + return new z({ value: [new $e({ value: this.type }), new An({ value: this.values })] }); } toJSON() { return { @@ -56414,7 +56460,7 @@ var la, En = (la = class extends Ce { } }, la.CLASS_NAME = "Attribute", la); const Jy = "notBeforeTime", Yy = "notAfterTime", RCe = [Jy, Yy]; -var ua, Ag = (ua = class extends Ce { +var ua, Sg = (ua = class extends Ce { constructor(t = {}) { super(), this.notBeforeTime = t[Jy] ?? ua.defaultValues(Jy), this.notAfterTime = t[Yy] ?? ua.defaultValues(Yy), t.schema && this.fromSchema(t.schema); } @@ -56431,7 +56477,7 @@ var ua, Ag = (ua = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Yt({ name: n.notBeforeTime || "" }), new Yt({ name: n.notAfterTime || "" })] + value: [new Xt({ name: n.notBeforeTime || "" }), new Xt({ name: n.notAfterTime || "" })] }); } fromSchema(t) { @@ -56443,7 +56489,7 @@ var ua, Ag = (ua = class extends Ce { ke.assertSchema(n, this.className), this.notBeforeTime = n.result.notBeforeTime.toDate(), this.notAfterTime = n.result.notAfterTime.toDate(); } toSchema() { - return new z({ value: [new Yt({ valueDate: this.notBeforeTime }), new Yt({ valueDate: this.notAfterTime })] }); + return new z({ value: [new Xt({ valueDate: this.notBeforeTime }), new Xt({ valueDate: this.notAfterTime })] }); } toJSON() { return { @@ -56453,9 +56499,9 @@ var ua, Ag = (ua = class extends Ce { } }, ua.CLASS_NAME = "AttCertValidityPeriod", ua); const ky = "names", s4 = "generalNames"; -var Rl, hr = (Rl = class extends Ce { +var Tl, pr = (Tl = class extends Ce { constructor(t = {}) { - super(), this.names = t[ky] ?? Rl.defaultValues(ky), t.schema && this.fromSchema(t.schema); + super(), this.names = t[ky] ?? Tl.defaultValues(ky), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -56470,19 +56516,19 @@ var Rl, hr = (Rl = class extends Ce { return new z({ optional: n, name: r.blockName || "", - value: [new ot({ + value: [new st({ name: r.generalNames || "", - value: Dt.schema() + value: Vt.schema() })] }); } fromSchema(t) { for (const r of [ky, s4]) delete t[r]; - const n = Ee(t, t, Rl.schema({ names: { + const n = Ee(t, t, Tl.schema({ names: { blockName: ky, generalNames: s4 } })); - ke.assertSchema(n, this.className), this.names = Array.from(n.result.generalNames, (r) => new Dt({ schema: r })); + ke.assertSchema(n, this.className), this.names = Array.from(n.result.generalNames, (r) => new Vt({ schema: r })); } toSchema() { return new z({ value: Array.from(this.names, (t) => t.toSchema()) }); @@ -56490,24 +56536,24 @@ var Rl, hr = (Rl = class extends Ce { toJSON() { return { names: Array.from(this.names, (t) => t.toJSON()) }; } -}, Rl.CLASS_NAME = "GeneralNames", Rl); -const TCe = "2.5.29.9", MCe = "2.5.29.16", BCe = "2.5.29.17", cq = "2.5.29.18", _Ce = "2.5.29.19", LCe = "2.5.29.20", DCe = "2.5.29.27", jCe = "2.5.29.21", FCe = "2.5.29.24", lq = "2.5.29.28", uq = "2.5.29.29", VCe = "2.5.29.30", dq = "2.5.29.31", oT = "2.5.29.46", $Ce = "2.5.29.32", UCe = "2.5.29.32.0", KCe = "1.3.6.1.4.1.311.21.10", HCe = "2.5.29.33", fq = "2.5.29.35", zCe = "2.5.29.36", WCe = "2.5.29.37", sT = "1.3.6.1.5.5.7.1.1", qCe = "1.3.6.1.5.5.7.1.11", hq = "1.3.6.1.4.1.11129.2.4.2", GCe = "1.3.6.1.4.1.311.21.7", JCe = "1.3.6.1.4.1.311.21.1", YCe = "1.3.6.1.5.5.7.1.3", iT = "1.2.840.113549.1.7.1", QCe = "1.2.840.113549.1.7.2", pq = "1.2.840.113549.1.7.3", gq = "1.2.840.113549.1.7.6", i4 = "1.2.840.113549.1.9.22.1", XCe = "1.2.840.113549.1.9.22.2", a4 = "1.2.840.113549.1.9.22.3", c4 = "1.2.840.113549.1.9.23.1", Cu = "keyIdentifier", Iu = "authorityCertIssuer", Nu = "authorityCertSerialNumber", ZCe = [ - Cu, +}, Tl.CLASS_NAME = "GeneralNames", Tl); +const TCe = "2.5.29.9", MCe = "2.5.29.16", BCe = "2.5.29.17", cq = "2.5.29.18", _Ce = "2.5.29.19", LCe = "2.5.29.20", DCe = "2.5.29.27", jCe = "2.5.29.21", FCe = "2.5.29.24", lq = "2.5.29.28", uq = "2.5.29.29", VCe = "2.5.29.30", dq = "2.5.29.31", oT = "2.5.29.46", $Ce = "2.5.29.32", UCe = "2.5.29.32.0", KCe = "1.3.6.1.4.1.311.21.10", HCe = "2.5.29.33", fq = "2.5.29.35", zCe = "2.5.29.36", WCe = "2.5.29.37", sT = "1.3.6.1.5.5.7.1.1", qCe = "1.3.6.1.5.5.7.1.11", hq = "1.3.6.1.4.1.11129.2.4.2", GCe = "1.3.6.1.4.1.311.21.7", JCe = "1.3.6.1.4.1.311.21.1", YCe = "1.3.6.1.5.5.7.1.3", iT = "1.2.840.113549.1.7.1", QCe = "1.2.840.113549.1.7.2", pq = "1.2.840.113549.1.7.3", gq = "1.2.840.113549.1.7.6", i4 = "1.2.840.113549.1.9.22.1", XCe = "1.2.840.113549.1.9.22.2", a4 = "1.2.840.113549.1.9.22.3", c4 = "1.2.840.113549.1.9.23.1", Iu = "keyIdentifier", Nu = "authorityCertIssuer", Ou = "authorityCertSerialNumber", ZCe = [ Iu, - Nu + Nu, + Ou ]; var js, mq = (js = class extends Ce { constructor(t = {}) { - super(), Cu in t && (this.keyIdentifier = t[Cu] ?? js.defaultValues(Cu)), Iu in t && (this.authorityCertIssuer = t[Iu] ?? js.defaultValues(Iu)), Nu in t && (this.authorityCertSerialNumber = t[Nu] ?? js.defaultValues(Nu)), t.schema && this.fromSchema(t.schema); + super(), Iu in t && (this.keyIdentifier = t[Iu] ?? js.defaultValues(Iu)), Nu in t && (this.authorityCertIssuer = t[Nu] ?? js.defaultValues(Nu)), Ou in t && (this.authorityCertSerialNumber = t[Ou] ?? js.defaultValues(Ou)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Cu: - return new Oe(); case Iu: - return []; + return new Oe(); case Nu: - return new de(); + return []; + case Ou: + return new ue(); default: return super.defaultValues(t); } @@ -56525,15 +56571,15 @@ var js, mq = (js = class extends Ce { tagNumber: 0 } }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new ot({ + value: [new st({ name: n.authorityCertIssuer || "", - value: Dt.schema() + value: Vt.schema() })] }), new Je({ @@ -56550,11 +56596,11 @@ var js, mq = (js = class extends Ce { fromSchema(t) { for (const r of ZCe) delete t[r]; const n = Ee(t, t, js.schema({ names: { - keyIdentifier: Cu, - authorityCertIssuer: Iu, - authorityCertSerialNumber: Nu + keyIdentifier: Iu, + authorityCertIssuer: Nu, + authorityCertSerialNumber: Ou } })); - ke.assertSchema(n, this.className), Cu in n.result && (this.keyIdentifier = new Oe({ valueHex: n.result.keyIdentifier.valueBlock.valueHex })), Iu in n.result && (this.authorityCertIssuer = Array.from(n.result.authorityCertIssuer, (r) => new Dt({ schema: r }))), Nu in n.result && (this.authorityCertSerialNumber = new de({ valueHex: n.result.authorityCertSerialNumber.valueBlock.valueHex })); + ke.assertSchema(n, this.className), Iu in n.result && (this.keyIdentifier = new Oe({ valueHex: n.result.keyIdentifier.valueBlock.valueHex })), Nu in n.result && (this.authorityCertIssuer = Array.from(n.result.authorityCertIssuer, (r) => new Vt({ schema: r }))), Ou in n.result && (this.authorityCertSerialNumber = new ue({ valueHex: n.result.authorityCertSerialNumber.valueBlock.valueHex })); } toSchema() { const t = []; @@ -56564,7 +56610,7 @@ var js, mq = (js = class extends Ce { tagNumber: 0 }, valueHex: this.keyIdentifier.valueBlock.valueHexView - })), this.authorityCertIssuer && t.push(new ee({ + })), this.authorityCertIssuer && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 @@ -56583,14 +56629,14 @@ var js, mq = (js = class extends Ce { return this.keyIdentifier && (t.keyIdentifier = this.keyIdentifier.toJSON()), this.authorityCertIssuer && (t.authorityCertIssuer = Array.from(this.authorityCertIssuer, (n) => n.toJSON())), this.authorityCertSerialNumber && (t.authorityCertSerialNumber = this.authorityCertSerialNumber.toJSON()), t; } }, js.CLASS_NAME = "AuthorityKeyIdentifier", js); -const wu = "pathLenConstraint", vu = "cA"; +const vu = "pathLenConstraint", ku = "cA"; var da, aT = (da = class extends Ce { constructor(t = {}) { - super(), this.cA = t[vu] ?? !1, wu in t && (this.pathLenConstraint = t[wu] ?? 0), t.schema && this.fromSchema(t.schema); + super(), this.cA = t[ku] ?? !1, vu in t && (this.pathLenConstraint = t[vu] ?? 0), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case vu: + case ku: return !1; default: return super.defaultValues(t); @@ -56600,36 +56646,36 @@ var da, aT = (da = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ql({ + value: [new Xl({ optional: !0, name: n.cA || "" - }), new de({ + }), new ue({ optional: !0, name: n.pathLenConstraint || "" })] }); } fromSchema(t) { - for (const r of [vu, wu]) delete t[r]; + for (const r of [ku, vu]) delete t[r]; const n = Ee(t, t, da.schema({ names: { - cA: vu, - pathLenConstraint: wu + cA: ku, + pathLenConstraint: vu } })); - ke.assertSchema(n, this.className), vu in n.result && (this.cA = n.result.cA.valueBlock.value), wu in n.result && (n.result.pathLenConstraint.valueBlock.isHexOnly ? this.pathLenConstraint = n.result.pathLenConstraint : this.pathLenConstraint = n.result.pathLenConstraint.valueBlock.valueDec); + ke.assertSchema(n, this.className), ku in n.result && (this.cA = n.result.cA.valueBlock.value), vu in n.result && (n.result.pathLenConstraint.valueBlock.isHexOnly ? this.pathLenConstraint = n.result.pathLenConstraint : this.pathLenConstraint = n.result.pathLenConstraint.valueBlock.valueDec); } toSchema() { const t = []; - return this.cA !== da.defaultValues(vu) && t.push(new Ql({ value: this.cA })), wu in this && (this.pathLenConstraint instanceof de ? t.push(this.pathLenConstraint) : t.push(new de({ value: this.pathLenConstraint }))), new z({ value: t }); + return this.cA !== da.defaultValues(ku) && t.push(new Xl({ value: this.cA })), vu in this && (this.pathLenConstraint instanceof ue ? t.push(this.pathLenConstraint) : t.push(new ue({ value: this.pathLenConstraint }))), new z({ value: t }); } toJSON() { const t = {}; - return this.cA !== da.defaultValues(vu) && (t.cA = this.cA), wu in this && (this.pathLenConstraint instanceof de ? t.pathLenConstraint = this.pathLenConstraint.toJSON() : t.pathLenConstraint = this.pathLenConstraint), t; + return this.cA !== da.defaultValues(ku) && (t.cA = this.cA), vu in this && (this.pathLenConstraint instanceof ue ? t.pathLenConstraint = this.pathLenConstraint.toJSON() : t.pathLenConstraint = this.pathLenConstraint), t; } }, da.CLASS_NAME = "BasicConstraints", da); const KC = "certificateIndex", HC = "keyIndex"; -var Tl, eIe = (Tl = class extends Ce { +var Ml, eIe = (Ml = class extends Ce { constructor(t = {}) { - super(), this.certificateIndex = t[KC] ?? Tl.defaultValues(KC), this.keyIndex = t[HC] ?? Tl.defaultValues(HC), t.schema && this.fromSchema(t.schema); + super(), this.certificateIndex = t[KC] ?? Ml.defaultValues(KC), this.keyIndex = t[HC] ?? Ml.defaultValues(HC), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -56641,22 +56687,22 @@ var Tl, eIe = (Tl = class extends Ce { } } static schema() { - return new de(); + return new ue(); } fromSchema(t) { - if (t.constructor.blockName() !== de.blockName()) throw new Error("Object's schema was not verified against input data for CAVersion"); + if (t.constructor.blockName() !== ue.blockName()) throw new Error("Object's schema was not verified against input data for CAVersion"); let n = t.valueBlock.valueHex.slice(0); const r = new Uint8Array(n); switch (!0) { case n.byteLength < 4: { - const d = /* @__PURE__ */ new ArrayBuffer(4); - new Uint8Array(d).set(r, 4 - n.byteLength), n = d.slice(0); + const f = /* @__PURE__ */ new ArrayBuffer(4); + new Uint8Array(f).set(r, 4 - n.byteLength), n = f.slice(0); } break; case n.byteLength > 4: { - const d = /* @__PURE__ */ new ArrayBuffer(4); - new Uint8Array(d).set(r.slice(0, 4)), n = d.slice(0); + const f = /* @__PURE__ */ new ArrayBuffer(4); + new Uint8Array(f).set(r.slice(0, 4)), n = f.slice(0); } } const o = n.slice(0, 2), s = new Uint8Array(o); @@ -56678,7 +56724,7 @@ var Tl, eIe = (Tl = class extends Ce { const s = /* @__PURE__ */ new ArrayBuffer(2), i = new Uint16Array(s); i[0] = this.keyIndex; const a = new Uint8Array(s); - return o = a[0], a[0] = a[1], a[1] = o, new de({ valueHex: Kt.concat(s, t) }); + return o = a[0], a[0] = a[1], a[1] = o, new ue({ valueHex: Wt.concat(s, t) }); } toJSON() { return { @@ -56686,7 +56732,7 @@ var Tl, eIe = (Tl = class extends Ce { keyIndex: this.keyIndex }; } -}, Tl.CLASS_NAME = "CAVersion", Tl); +}, Ml.CLASS_NAME = "CAVersion", Ml); const Qy = "policyQualifierId", Xy = "qualifier", tIe = [Qy, Xy]; var fa, l4 = (fa = class extends Ce { constructor(t = {}) { @@ -56706,7 +56752,7 @@ var fa, l4 = (fa = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.policyQualifierId || "" }), new Xe({ name: n.qualifier || "" })] + value: [new $e({ name: n.policyQualifierId || "" }), new Xe({ name: n.qualifier || "" })] }); } fromSchema(t) { @@ -56718,7 +56764,7 @@ var fa, l4 = (fa = class extends Ce { ke.assertSchema(n, this.className), this.policyQualifierId = n.result.policyQualifierId.valueBlock.toString(), this.qualifier = n.result.qualifier; } toSchema() { - return new z({ value: [new Ve({ value: this.policyQualifierId }), this.qualifier] }); + return new z({ value: [new $e({ value: this.policyQualifierId }), this.qualifier] }); } toJSON() { return { @@ -56746,9 +56792,9 @@ var ha, u4 = (ha = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.policyIdentifier || "" }), new z({ + value: [new $e({ name: n.policyIdentifier || "" }), new z({ optional: !0, - value: [new ot({ + value: [new st({ name: n.policyQualifiers || "", value: l4.schema() })] @@ -56765,7 +56811,7 @@ var ha, u4 = (ha = class extends Ce { } toSchema() { const t = []; - return t.push(new Ve({ value: this.policyIdentifier })), this.policyQualifiers && t.push(new z({ value: Array.from(this.policyQualifiers, (n) => n.toSchema()) })), new z({ value: t }); + return t.push(new $e({ value: this.policyIdentifier })), this.policyQualifiers && t.push(new z({ value: Array.from(this.policyQualifiers, (n) => n.toSchema()) })), new z({ value: t }); } toJSON() { const t = { policyIdentifier: this.policyIdentifier }; @@ -56773,9 +56819,9 @@ var ha, u4 = (ha = class extends Ce { } }, ha.CLASS_NAME = "PolicyInformation", ha); const Zy = "certificatePolicies", rIe = [Zy]; -var Ml, d4 = (Ml = class extends Ce { +var Bl, d4 = (Bl = class extends Ce { constructor(t = {}) { - super(), this.certificatePolicies = t[Zy] ?? Ml.defaultValues(Zy), t.schema && this.fromSchema(t.schema); + super(), this.certificatePolicies = t[Zy] ?? Bl.defaultValues(Zy), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -56789,7 +56835,7 @@ var Ml, d4 = (Ml = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.certificatePolicies || "", value: u4.schema() })] @@ -56797,7 +56843,7 @@ var Ml, d4 = (Ml = class extends Ce { } fromSchema(t) { for (const r of rIe) delete t[r]; - const n = Ee(t, t, Ml.schema({ names: { certificatePolicies: Zy } })); + const n = Ee(t, t, Bl.schema({ names: { certificatePolicies: Zy } })); ke.assertSchema(n, this.className), this.certificatePolicies = Array.from(n.result.certificatePolicies, (r) => new u4({ schema: r })); } toSchema() { @@ -56806,7 +56852,7 @@ var Ml, d4 = (Ml = class extends Ce { toJSON() { return { certificatePolicies: Array.from(this.certificatePolicies, (t) => t.toJSON()) }; } -}, Ml.CLASS_NAME = "CertificatePolicies", Ml); +}, Bl.CLASS_NAME = "CertificatePolicies", Bl); const eb = "templateID", ji = "templateMajorVersion", Fi = "templateMinorVersion", oIe = [ eb, ji, @@ -56832,12 +56878,12 @@ var sIe = class tb extends Ce { return new z({ name: n.blockName || "", value: [ - new Ve({ name: n.templateID || "" }), - new de({ + new $e({ name: n.templateID || "" }), + new ue({ name: n.templateMajorVersion || "", optional: !0 }), - new de({ + new ue({ name: n.templateMinorVersion || "", optional: !0 }) @@ -56855,31 +56901,31 @@ var sIe = class tb extends Ce { } toSchema() { const t = []; - return t.push(new Ve({ value: this.templateID })), ji in this && t.push(new de({ value: this.templateMajorVersion })), Fi in this && t.push(new de({ value: this.templateMinorVersion })), new z({ value: t }); + return t.push(new $e({ value: this.templateID })), ji in this && t.push(new ue({ value: this.templateMajorVersion })), Fi in this && t.push(new ue({ value: this.templateMinorVersion })), new z({ value: t }); } toJSON() { const t = { templateID: this.templateID }; return ji in this && (t.templateMajorVersion = this.templateMajorVersion), Fi in this && (t.templateMinorVersion = this.templateMinorVersion), t; } }; -const Ou = "distributionPoint", yq = "distributionPointNames", Pu = "reasons", Ru = "cRLIssuer", bq = "cRLIssuerNames", iIe = [ - Ou, - yq, +const Pu = "distributionPoint", yq = "distributionPointNames", Ru = "reasons", Tu = "cRLIssuer", bq = "cRLIssuerNames", iIe = [ Pu, + yq, Ru, + Tu, bq ]; var Fs, NO = (Fs = class extends Ce { constructor(t = {}) { - super(), Ou in t && (this.distributionPoint = t[Ou] ?? Fs.defaultValues(Ou)), Pu in t && (this.reasons = t[Pu] ?? Fs.defaultValues(Pu)), Ru in t && (this.cRLIssuer = t[Ru] ?? Fs.defaultValues(Ru)), t.schema && this.fromSchema(t.schema); + super(), Pu in t && (this.distributionPoint = t[Pu] ?? Fs.defaultValues(Pu)), Ru in t && (this.reasons = t[Ru] ?? Fs.defaultValues(Ru)), Tu in t && (this.cRLIssuer = t[Tu] ?? Fs.defaultValues(Tu)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Ou: - return []; case Pu: - return new ht(); + return []; case Ru: + return new pt(); + case Tu: return []; default: return super.defaultValues(t); @@ -56890,31 +56936,31 @@ var Fs, NO = (Fs = class extends Ce { return new z({ name: n.blockName || "", value: [ - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Xt({ value: [new ee({ + value: [new en({ value: [new ne({ name: n.distributionPoint || "", optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new ot({ + value: [new st({ name: n.distributionPointNames || "", - value: Dt.schema() + value: Vt.schema() })] - }), new ee({ + }), new ne({ name: n.distributionPoint || "", optional: !0, idBlock: { tagClass: 3, tagNumber: 1 }, - value: Qt.schema().valueBlock.value + value: Zt.schema().valueBlock.value })] })] }), new Je({ @@ -56925,16 +56971,16 @@ var Fs, NO = (Fs = class extends Ce { tagNumber: 1 } }), - new ee({ + new ne({ name: n.cRLIssuer || "", optional: !0, idBlock: { tagClass: 3, tagNumber: 2 }, - value: [new ot({ + value: [new st({ name: n.cRLIssuerNames || "", - value: Dt.schema() + value: Vt.schema() })] }) ] @@ -56943,31 +56989,31 @@ var Fs, NO = (Fs = class extends Ce { fromSchema(t) { for (const r of iIe) delete t[r]; const n = Ee(t, t, Fs.schema({ names: { - distributionPoint: Ou, + distributionPoint: Pu, distributionPointNames: yq, - reasons: Pu, - cRLIssuer: Ru, + reasons: Ru, + cRLIssuer: Tu, cRLIssuerNames: bq } })); - ke.assertSchema(n, this.className), Ou in n.result && (n.result.distributionPoint.idBlock.tagNumber === 0 && (this.distributionPoint = Array.from(n.result.distributionPointNames, (r) => new Dt({ schema: r }))), n.result.distributionPoint.idBlock.tagNumber === 1 && (this.distributionPoint = new Qt({ schema: new z({ value: n.result.distributionPoint.valueBlock.value }) }))), Pu in n.result && (this.reasons = new ht({ valueHex: n.result.reasons.valueBlock.valueHex })), Ru in n.result && (this.cRLIssuer = Array.from(n.result.cRLIssuerNames, (r) => new Dt({ schema: r }))); + ke.assertSchema(n, this.className), Pu in n.result && (n.result.distributionPoint.idBlock.tagNumber === 0 && (this.distributionPoint = Array.from(n.result.distributionPointNames, (r) => new Vt({ schema: r }))), n.result.distributionPoint.idBlock.tagNumber === 1 && (this.distributionPoint = new Zt({ schema: new z({ value: n.result.distributionPoint.valueBlock.value }) }))), Ru in n.result && (this.reasons = new pt({ valueHex: n.result.reasons.valueBlock.valueHex })), Tu in n.result && (this.cRLIssuer = Array.from(n.result.cRLIssuerNames, (r) => new Vt({ schema: r }))); } toSchema() { const t = []; if (this.distributionPoint) { let n; - this.distributionPoint instanceof Array ? n = new ee({ + this.distributionPoint instanceof Array ? n = new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: Array.from(this.distributionPoint, (r) => r.toSchema()) - }) : n = new ee({ + }) : n = new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, value: [this.distributionPoint.toSchema()] - }), t.push(new ee({ + }), t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -56981,7 +57027,7 @@ var Fs, NO = (Fs = class extends Ce { tagNumber: 1 }, valueHex: this.reasons.valueBlock.valueHexView - })), this.cRLIssuer && t.push(new ee({ + })), this.cRLIssuer && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 2 @@ -56995,9 +57041,9 @@ var Fs, NO = (Fs = class extends Ce { } }, Fs.CLASS_NAME = "DistributionPoint", Fs); const nb = "distributionPoints", aIe = [nb]; -var Bl, OO = (Bl = class extends Ce { +var _l, OO = (_l = class extends Ce { constructor(t = {}) { - super(), this.distributionPoints = t[nb] ?? Bl.defaultValues(nb), t.schema && this.fromSchema(t.schema); + super(), this.distributionPoints = t[nb] ?? _l.defaultValues(nb), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -57011,7 +57057,7 @@ var Bl, OO = (Bl = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.distributionPoints || "", value: NO.schema() })] @@ -57019,7 +57065,7 @@ var Bl, OO = (Bl = class extends Ce { } fromSchema(t) { for (const r of aIe) delete t[r]; - const n = Ee(t, t, Bl.schema({ names: { distributionPoints: nb } })); + const n = Ee(t, t, _l.schema({ names: { distributionPoints: nb } })); ke.assertSchema(n, this.className), this.distributionPoints = Array.from(n.result.distributionPoints, (r) => new NO({ schema: r })); } toSchema() { @@ -57028,11 +57074,11 @@ var Bl, OO = (Bl = class extends Ce { toJSON() { return { distributionPoints: Array.from(this.distributionPoints, (t) => t.toJSON()) }; } -}, Bl.CLASS_NAME = "CRLDistributionPoints", Bl); +}, _l.CLASS_NAME = "CRLDistributionPoints", _l); const rb = "keyPurposes", cIe = [rb]; -var _l, sx = (_l = class extends Ce { +var Ll, sx = (Ll = class extends Ce { constructor(t = {}) { - super(), this.keyPurposes = t[rb] ?? _l.defaultValues(rb), t.schema && this.fromSchema(t.schema); + super(), this.keyPurposes = t[rb] ?? Ll.defaultValues(rb), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -57046,28 +57092,28 @@ var _l, sx = (_l = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.keyPurposes || "", - value: new Ve() + value: new $e() })] }); } fromSchema(t) { for (const r of cIe) delete t[r]; - const n = Ee(t, t, _l.schema({ names: { keyPurposes: rb } })); + const n = Ee(t, t, Ll.schema({ names: { keyPurposes: rb } })); ke.assertSchema(n, this.className), this.keyPurposes = Array.from(n.result.keyPurposes, (r) => r.valueBlock.toString()); } toSchema() { - return new z({ value: Array.from(this.keyPurposes, (t) => new Ve({ value: t })) }); + return new z({ value: Array.from(this.keyPurposes, (t) => new $e({ value: t })) }); } toJSON() { return { keyPurposes: Array.from(this.keyPurposes) }; } -}, _l.CLASS_NAME = "ExtKeyUsage", _l); +}, Ll.CLASS_NAME = "ExtKeyUsage", Ll); const Ay = "accessDescriptions"; -var Ll, PO = (Ll = class extends Ce { +var Dl, PO = (Dl = class extends Ce { constructor(t = {}) { - super(), this.accessDescriptions = t[Ay] ?? Ll.defaultValues(Ay), t.schema && this.fromSchema(t.schema); + super(), this.accessDescriptions = t[Ay] ?? Dl.defaultValues(Ay), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -57081,7 +57127,7 @@ var Ll, PO = (Ll = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.accessDescriptions || "", value: ox.schema() })] @@ -57089,7 +57135,7 @@ var Ll, PO = (Ll = class extends Ce { } fromSchema(t) { for (const r of [Ay]) delete t[r]; - const n = Ee(t, t, Ll.schema({ names: { accessDescriptions: Ay } })); + const n = Ee(t, t, Dl.schema({ names: { accessDescriptions: Ay } })); ke.assertSchema(n, this.className), this.accessDescriptions = Array.from(n.result.accessDescriptions, (r) => new ox({ schema: r })); } toSchema() { @@ -57098,34 +57144,34 @@ var Ll, PO = (Ll = class extends Ce { toJSON() { return { accessDescriptions: Array.from(this.accessDescriptions, (t) => t.toJSON()) }; } -}, Ll.CLASS_NAME = "InfoAccess", Ll); -const Tu = "distributionPoint", wq = "distributionPointNames", Ac = "onlyContainsUserCerts", Sc = "onlyContainsCACerts", xc = "onlySomeReasons", Ec = "indirectCRL", Cc = "onlyContainsAttributeCerts", lIe = [ - Tu, +}, Dl.CLASS_NAME = "InfoAccess", Dl); +const Mu = "distributionPoint", wq = "distributionPointNames", Sc = "onlyContainsUserCerts", xc = "onlyContainsCACerts", Ec = "onlySomeReasons", Cc = "indirectCRL", Ic = "onlyContainsAttributeCerts", lIe = [ + Mu, wq, - Ac, Sc, xc, Ec, - Cc + Cc, + Ic ]; var kn, uIe = (kn = class extends Ce { constructor(t = {}) { - super(), Tu in t && (this.distributionPoint = t[Tu] ?? kn.defaultValues(Tu)), this.onlyContainsUserCerts = t[Ac] ?? kn.defaultValues(Ac), this.onlyContainsCACerts = t[Sc] ?? kn.defaultValues(Sc), xc in t && (this.onlySomeReasons = t[xc] ?? kn.defaultValues(xc)), this.indirectCRL = t[Ec] ?? kn.defaultValues(Ec), this.onlyContainsAttributeCerts = t[Cc] ?? kn.defaultValues(Cc), t.schema && this.fromSchema(t.schema); + super(), Mu in t && (this.distributionPoint = t[Mu] ?? kn.defaultValues(Mu)), this.onlyContainsUserCerts = t[Sc] ?? kn.defaultValues(Sc), this.onlyContainsCACerts = t[xc] ?? kn.defaultValues(xc), Ec in t && (this.onlySomeReasons = t[Ec] ?? kn.defaultValues(Ec)), this.indirectCRL = t[Cc] ?? kn.defaultValues(Cc), this.onlyContainsAttributeCerts = t[Ic] ?? kn.defaultValues(Ic), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Tu: + case Mu: return []; - case Ac: - return !1; case Sc: return !1; case xc: - return 0; - case Ec: return !1; + case Ec: + return 0; case Cc: return !1; + case Ic: + return !1; default: return super.defaultValues(t); } @@ -57135,29 +57181,29 @@ var kn, uIe = (kn = class extends Ce { return new z({ name: n.blockName || "", value: [ - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Xt({ value: [new ee({ + value: [new en({ value: [new ne({ name: n.distributionPoint || "", idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new ot({ + value: [new st({ name: n.distributionPointNames || "", - value: Dt.schema() + value: Vt.schema() })] - }), new ee({ + }), new ne({ name: n.distributionPoint || "", idBlock: { tagClass: 3, tagNumber: 1 }, - value: Qt.schema().valueBlock.value + value: Zt.schema().valueBlock.value })] })] }), new Je({ @@ -57206,41 +57252,41 @@ var kn, uIe = (kn = class extends Ce { fromSchema(t) { for (const r of lIe) delete t[r]; const n = Ee(t, t, kn.schema({ names: { - distributionPoint: Tu, + distributionPoint: Mu, distributionPointNames: wq, - onlyContainsUserCerts: Ac, - onlyContainsCACerts: Sc, - onlySomeReasons: xc, - indirectCRL: Ec, - onlyContainsAttributeCerts: Cc + onlyContainsUserCerts: Sc, + onlyContainsCACerts: xc, + onlySomeReasons: Ec, + indirectCRL: Cc, + onlyContainsAttributeCerts: Ic } })); - if (ke.assertSchema(n, this.className), Tu in n.result) switch (!0) { + if (ke.assertSchema(n, this.className), Mu in n.result) switch (!0) { case n.result.distributionPoint.idBlock.tagNumber === 0: - this.distributionPoint = Array.from(n.result.distributionPointNames, (r) => new Dt({ schema: r })); + this.distributionPoint = Array.from(n.result.distributionPointNames, (r) => new Vt({ schema: r })); break; case n.result.distributionPoint.idBlock.tagNumber === 1: - this.distributionPoint = new Qt({ schema: new z({ value: n.result.distributionPoint.valueBlock.value }) }); + this.distributionPoint = new Zt({ schema: new z({ value: n.result.distributionPoint.valueBlock.value }) }); break; default: throw new Error("Unknown tagNumber for distributionPoint: {$asn1.result.distributionPoint.idBlock.tagNumber}"); } - if (Ac in n.result) { + if (Sc in n.result) { const r = new Uint8Array(n.result.onlyContainsUserCerts.valueBlock.valueHex); this.onlyContainsUserCerts = r[0] !== 0; } - if (Sc in n.result) { + if (xc in n.result) { const r = new Uint8Array(n.result.onlyContainsCACerts.valueBlock.valueHex); this.onlyContainsCACerts = r[0] !== 0; } - if (xc in n.result) { + if (Ec in n.result) { const r = new Uint8Array(n.result.onlySomeReasons.valueBlock.valueHex); this.onlySomeReasons = r[0]; } - if (Ec in n.result) { + if (Cc in n.result) { const r = new Uint8Array(n.result.indirectCRL.valueBlock.valueHex); this.indirectCRL = r[0] !== 0; } - if (Cc in n.result) { + if (Ic in n.result) { const r = new Uint8Array(n.result.onlyContainsAttributeCerts.valueBlock.valueHex); this.onlyContainsAttributeCerts = r[0] !== 0; } @@ -57249,13 +57295,13 @@ var kn, uIe = (kn = class extends Ce { const t = []; if (this.distributionPoint) { let n; - this.distributionPoint instanceof Array ? n = new ee({ + this.distributionPoint instanceof Array ? n = new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: Array.from(this.distributionPoint, (r) => r.toSchema()) - }) : (n = this.distributionPoint.toSchema(), n.idBlock.tagClass = 3, n.idBlock.tagNumber = 1), t.push(new ee({ + }) : (n = this.distributionPoint.toSchema(), n.idBlock.tagClass = 3, n.idBlock.tagNumber = 1), t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -57263,13 +57309,13 @@ var kn, uIe = (kn = class extends Ce { value: [n] })); } - if (this.onlyContainsUserCerts !== kn.defaultValues(Ac) && t.push(new Je({ + if (this.onlyContainsUserCerts !== kn.defaultValues(Sc) && t.push(new Je({ idBlock: { tagClass: 3, tagNumber: 1 }, valueHex: new Uint8Array([255]).buffer - })), this.onlyContainsCACerts !== kn.defaultValues(Sc) && t.push(new Je({ + })), this.onlyContainsCACerts !== kn.defaultValues(xc) && t.push(new Je({ idBlock: { tagClass: 3, tagNumber: 2 @@ -57285,13 +57331,13 @@ var kn, uIe = (kn = class extends Ce { valueHex: n })); } - return this.indirectCRL !== kn.defaultValues(Ec) && t.push(new Je({ + return this.indirectCRL !== kn.defaultValues(Cc) && t.push(new Je({ idBlock: { tagClass: 3, tagNumber: 4 }, valueHex: new Uint8Array([255]).buffer - })), this.onlyContainsAttributeCerts !== kn.defaultValues(Cc) && t.push(new Je({ + })), this.onlyContainsAttributeCerts !== kn.defaultValues(Ic) && t.push(new Je({ idBlock: { tagClass: 3, tagNumber: 5 @@ -57301,25 +57347,25 @@ var kn, uIe = (kn = class extends Ce { } toJSON() { const t = {}; - return this.distributionPoint && (this.distributionPoint instanceof Array ? t.distributionPoint = Array.from(this.distributionPoint, (n) => n.toJSON()) : t.distributionPoint = this.distributionPoint.toJSON()), this.onlyContainsUserCerts !== kn.defaultValues(Ac) && (t.onlyContainsUserCerts = this.onlyContainsUserCerts), this.onlyContainsCACerts !== kn.defaultValues(Sc) && (t.onlyContainsCACerts = this.onlyContainsCACerts), xc in this && (t.onlySomeReasons = this.onlySomeReasons), this.indirectCRL !== kn.defaultValues(Ec) && (t.indirectCRL = this.indirectCRL), this.onlyContainsAttributeCerts !== kn.defaultValues(Cc) && (t.onlyContainsAttributeCerts = this.onlyContainsAttributeCerts), t; + return this.distributionPoint && (this.distributionPoint instanceof Array ? t.distributionPoint = Array.from(this.distributionPoint, (n) => n.toJSON()) : t.distributionPoint = this.distributionPoint.toJSON()), this.onlyContainsUserCerts !== kn.defaultValues(Sc) && (t.onlyContainsUserCerts = this.onlyContainsUserCerts), this.onlyContainsCACerts !== kn.defaultValues(xc) && (t.onlyContainsCACerts = this.onlyContainsCACerts), Ec in this && (t.onlySomeReasons = this.onlySomeReasons), this.indirectCRL !== kn.defaultValues(Cc) && (t.indirectCRL = this.indirectCRL), this.onlyContainsAttributeCerts !== kn.defaultValues(Ic) && (t.onlyContainsAttributeCerts = this.onlyContainsAttributeCerts), t; } }, kn.CLASS_NAME = "IssuingDistributionPoint", kn); -const ob = "base", Lh = "minimum", Ic = "maximum", dIe = [ +const ob = "base", Dh = "minimum", Nc = "maximum", dIe = [ ob, - Lh, - Ic + Dh, + Nc ]; var Vs, Q1 = (Vs = class extends Ce { constructor(t = {}) { - super(), this.base = t[ob] ?? Vs.defaultValues(ob), this.minimum = t[Lh] ?? Vs.defaultValues(Lh), Ic in t && (this.maximum = t[Ic] ?? Vs.defaultValues(Ic)), t.schema && this.fromSchema(t.schema); + super(), this.base = t[ob] ?? Vs.defaultValues(ob), this.minimum = t[Dh] ?? Vs.defaultValues(Dh), Nc in t && (this.maximum = t[Nc] ?? Vs.defaultValues(Nc)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case ob: - return new Dt(); - case Lh: + return new Vt(); + case Dh: return 0; - case Ic: + case Nc: return 0; default: return super.defaultValues(t); @@ -57330,22 +57376,22 @@ var Vs, Q1 = (Vs = class extends Ce { return new z({ name: n.blockName || "", value: [ - Dt.schema(n.base || {}), - new ee({ + Vt.schema(n.base || {}), + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new de({ name: n.minimum || "" })] + value: [new ue({ name: n.minimum || "" })] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new de({ name: n.maximum || "" })] + value: [new ue({ name: n.maximum || "" })] }) ] }); @@ -57354,16 +57400,16 @@ var Vs, Q1 = (Vs = class extends Ce { for (const r of dIe) delete t[r]; const n = Ee(t, t, Vs.schema({ names: { base: { names: { blockName: ob } }, - minimum: Lh, - maximum: Ic + minimum: Dh, + maximum: Nc } })); - ke.assertSchema(n, this.className), this.base = new Dt({ schema: n.result.base }), Lh in n.result && (n.result.minimum.valueBlock.isHexOnly ? this.minimum = n.result.minimum : this.minimum = n.result.minimum.valueBlock.valueDec), Ic in n.result && (n.result.maximum.valueBlock.isHexOnly ? this.maximum = n.result.maximum : this.maximum = n.result.maximum.valueBlock.valueDec); + ke.assertSchema(n, this.className), this.base = new Vt({ schema: n.result.base }), Dh in n.result && (n.result.minimum.valueBlock.isHexOnly ? this.minimum = n.result.minimum : this.minimum = n.result.minimum.valueBlock.valueDec), Nc in n.result && (n.result.maximum.valueBlock.isHexOnly ? this.maximum = n.result.maximum : this.maximum = n.result.maximum.valueBlock.valueDec); } toSchema() { const t = []; if (t.push(this.base.toSchema()), this.minimum !== 0) { let n = 0; - this.minimum instanceof de ? n = this.minimum : n = new de({ value: this.minimum }), t.push(new ee({ + this.minimum instanceof ue ? n = this.minimum : n = new ue({ value: this.minimum }), t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -57372,9 +57418,9 @@ var Vs, Q1 = (Vs = class extends Ce { value: [n] })); } - if (Ic in this) { + if (Nc in this) { let n = 0; - this.maximum instanceof de ? n = this.maximum : n = new de({ value: this.maximum }), t.push(new ee({ + this.maximum instanceof ue ? n = this.maximum : n = new ue({ value: this.maximum }), t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -57390,15 +57436,15 @@ var Vs, Q1 = (Vs = class extends Ce { return this.minimum !== 0 && (typeof this.minimum == "number" ? t.minimum = this.minimum : t.minimum = this.minimum.toJSON()), this.maximum !== void 0 && (typeof this.maximum == "number" ? t.maximum = this.maximum : t.maximum = this.maximum.toJSON()), t; } }, Vs.CLASS_NAME = "GeneralSubtree", Vs); -const Mu = "permittedSubtrees", Bu = "excludedSubtrees", fIe = [Mu, Bu]; +const Bu = "permittedSubtrees", _u = "excludedSubtrees", fIe = [Bu, _u]; var pa, hIe = (pa = class extends Ce { constructor(t = {}) { - super(), Mu in t && (this.permittedSubtrees = t[Mu] ?? pa.defaultValues(Mu)), Bu in t && (this.excludedSubtrees = t[Bu] ?? pa.defaultValues(Bu)), t.schema && this.fromSchema(t.schema); + super(), Bu in t && (this.permittedSubtrees = t[Bu] ?? pa.defaultValues(Bu)), _u in t && (this.excludedSubtrees = t[_u] ?? pa.defaultValues(_u)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Mu: case Bu: + case _u: return []; default: return super.defaultValues(t); @@ -57408,23 +57454,23 @@ var pa, hIe = (pa = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ee({ + value: [new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new ot({ + value: [new st({ name: n.permittedSubtrees || "", value: Q1.schema() })] - }), new ee({ + }), new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new ot({ + value: [new st({ name: n.excludedSubtrees || "", value: Q1.schema() })] @@ -57434,20 +57480,20 @@ var pa, hIe = (pa = class extends Ce { fromSchema(t) { for (const r of fIe) delete t[r]; const n = Ee(t, t, pa.schema({ names: { - permittedSubtrees: Mu, - excludedSubtrees: Bu + permittedSubtrees: Bu, + excludedSubtrees: _u } })); - ke.assertSchema(n, this.className), Mu in n.result && (this.permittedSubtrees = Array.from(n.result.permittedSubtrees, (r) => new Q1({ schema: r }))), Bu in n.result && (this.excludedSubtrees = Array.from(n.result.excludedSubtrees, (r) => new Q1({ schema: r }))); + ke.assertSchema(n, this.className), Bu in n.result && (this.permittedSubtrees = Array.from(n.result.permittedSubtrees, (r) => new Q1({ schema: r }))), _u in n.result && (this.excludedSubtrees = Array.from(n.result.excludedSubtrees, (r) => new Q1({ schema: r }))); } toSchema() { const t = []; - return this.permittedSubtrees && t.push(new ee({ + return this.permittedSubtrees && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: Array.from(this.permittedSubtrees, (n) => n.toSchema()) - })), this.excludedSubtrees && t.push(new ee({ + })), this.excludedSubtrees && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 @@ -57505,24 +57551,24 @@ var ga, gIe = (ga = class extends Ce { if (ke.assertSchema(n, this.className), Vi in n.result) { const r = n.result.requireExplicitPolicy; r.idBlock.tagClass = 1, r.idBlock.tagNumber = 2; - const o = r.toBER(!1), s = hn(o); + const o = r.toBER(!1), s = pn(o); ke.assert(s, "Integer"), this.requireExplicitPolicy = s.result.valueBlock.valueDec; } if ($i in n.result) { const r = n.result.inhibitPolicyMapping; r.idBlock.tagClass = 1, r.idBlock.tagNumber = 2; - const o = r.toBER(!1), s = hn(o); + const o = r.toBER(!1), s = pn(o); ke.assert(s, "Integer"), this.inhibitPolicyMapping = s.result.valueBlock.valueDec; } } toSchema() { const t = []; if (Vi in this) { - const n = new de({ value: this.requireExplicitPolicy }); + const n = new ue({ value: this.requireExplicitPolicy }); n.idBlock.tagClass = 3, n.idBlock.tagNumber = 0, t.push(n); } if ($i in this) { - const n = new de({ value: this.inhibitPolicyMapping }); + const n = new ue({ value: this.inhibitPolicyMapping }); n.idBlock.tagClass = 3, n.idBlock.tagNumber = 1, t.push(n); } return new z({ value: t }); @@ -57551,7 +57597,7 @@ var ma, f4 = (ma = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.issuerDomainPolicy || "" }), new Ve({ name: n.subjectDomainPolicy || "" })] + value: [new $e({ name: n.issuerDomainPolicy || "" }), new $e({ name: n.subjectDomainPolicy || "" })] }); } fromSchema(t) { @@ -57563,7 +57609,7 @@ var ma, f4 = (ma = class extends Ce { ke.assertSchema(n, this.className), this.issuerDomainPolicy = n.result.issuerDomainPolicy.valueBlock.toString(), this.subjectDomainPolicy = n.result.subjectDomainPolicy.valueBlock.toString(); } toSchema() { - return new z({ value: [new Ve({ value: this.issuerDomainPolicy }), new Ve({ value: this.subjectDomainPolicy })] }); + return new z({ value: [new $e({ value: this.issuerDomainPolicy }), new $e({ value: this.subjectDomainPolicy })] }); } toJSON() { return { @@ -57573,9 +57619,9 @@ var ma, f4 = (ma = class extends Ce { } }, ma.CLASS_NAME = "PolicyMapping", ma); const ab = "mappings", yIe = [ab]; -var Dl, bIe = (Dl = class extends Ce { +var jl, bIe = (jl = class extends Ce { constructor(t = {}) { - super(), this.mappings = t[ab] ?? Dl.defaultValues(ab), t.schema && this.fromSchema(t.schema); + super(), this.mappings = t[ab] ?? jl.defaultValues(ab), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -57589,7 +57635,7 @@ var Dl, bIe = (Dl = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.mappings || "", value: f4.schema() })] @@ -57597,7 +57643,7 @@ var Dl, bIe = (Dl = class extends Ce { } fromSchema(t) { for (const r of yIe) delete t[r]; - const n = Ee(t, t, Dl.schema({ names: { mappings: ab } })); + const n = Ee(t, t, jl.schema({ names: { mappings: ab } })); ke.assertSchema(n, this.className), this.mappings = Array.from(n.result.mappings, (r) => new f4({ schema: r })); } toSchema() { @@ -57606,18 +57652,18 @@ var Dl, bIe = (Dl = class extends Ce { toJSON() { return { mappings: Array.from(this.mappings, (t) => t.toJSON()) }; } -}, Dl.CLASS_NAME = "PolicyMappings", Dl); -const Nc = "notBefore", Oc = "notAfter", wIe = [Nc, Oc]; +}, jl.CLASS_NAME = "PolicyMappings", jl); +const Oc = "notBefore", Pc = "notAfter", wIe = [Oc, Pc]; var ya, vIe = (ya = class extends Ce { constructor(t = {}) { - super(), Nc in t && (this.notBefore = t[Nc] ?? ya.defaultValues(Nc)), Oc in t && (this.notAfter = t[Oc] ?? ya.defaultValues(Oc)), t.schema && this.fromSchema(t.schema); + super(), Oc in t && (this.notBefore = t[Oc] ?? ya.defaultValues(Oc)), Pc in t && (this.notAfter = t[Pc] ?? ya.defaultValues(Pc)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Nc: - return /* @__PURE__ */ new Date(); case Oc: return /* @__PURE__ */ new Date(); + case Pc: + return /* @__PURE__ */ new Date(); default: return super.defaultValues(t); } @@ -57646,32 +57692,32 @@ var ya, vIe = (ya = class extends Ce { fromSchema(t) { for (const r of wIe) delete t[r]; const n = Ee(t, t, ya.schema({ names: { - notBefore: Nc, - notAfter: Oc + notBefore: Oc, + notAfter: Pc } })); - if (ke.assertSchema(n, this.className), Nc in n.result) { - const r = new Yt(); + if (ke.assertSchema(n, this.className), Oc in n.result) { + const r = new Xt(); r.fromBuffer(n.result.notBefore.valueBlock.valueHex), this.notBefore = r.toDate(); } - if (Oc in n.result) { - const r = new Yt({ valueHex: n.result.notAfter.valueBlock.valueHex }); + if (Pc in n.result) { + const r = new Xt({ valueHex: n.result.notAfter.valueBlock.valueHex }); r.fromBuffer(n.result.notAfter.valueBlock.valueHex), this.notAfter = r.toDate(); } } toSchema() { const t = []; - return Nc in this && t.push(new Je({ + return Oc in this && t.push(new Je({ idBlock: { tagClass: 3, tagNumber: 0 }, - valueHex: new Yt({ valueDate: this.notBefore }).valueBlock.valueHexView - })), Oc in this && t.push(new Je({ + valueHex: new Xt({ valueDate: this.notBefore }).valueBlock.valueHexView + })), Pc in this && t.push(new Je({ idBlock: { tagClass: 3, tagNumber: 1 }, - valueHex: new Yt({ valueDate: this.notAfter }).valueBlock.valueHexView + valueHex: new Xt({ valueDate: this.notAfter }).valueBlock.valueHexView })), new z({ value: t }); } toJSON() { @@ -57679,27 +57725,27 @@ var ya, vIe = (ya = class extends Ce { return this.notBefore && (t.notBefore = this.notBefore), this.notAfter && (t.notAfter = this.notAfter), t; } }, ya.CLASS_NAME = "PrivateKeyUsagePeriod", ya); -const Dh = "id", Ui = "type", jh = "values", kIe = [Dh, Ui], AIe = [jh]; +const jh = "id", Ui = "type", Fh = "values", kIe = [jh, Ui], AIe = [Fh]; var ba, h4 = (ba = class extends Ce { constructor(t = {}) { - super(), this.id = t[Dh] ?? ba.defaultValues(Dh), Ui in t && (this.type = t[Ui] ?? ba.defaultValues(Ui)), t.schema && this.fromSchema(t.schema); + super(), this.id = t[jh] ?? ba.defaultValues(jh), Ui in t && (this.type = t[Ui] ?? ba.defaultValues(Ui)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Dh: + case jh: return ""; case Ui: - return new fn(); + return new hn(); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case Dh: + case jh: return n === ""; case Ui: - return n instanceof fn; + return n instanceof hn; default: return super.defaultValues(t); } @@ -57708,7 +57754,7 @@ var ba, h4 = (ba = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.id || "" }), new Xe({ + value: [new $e({ name: n.id || "" }), new Xe({ name: n.type || "", optional: !0 })] @@ -57717,26 +57763,26 @@ var ba, h4 = (ba = class extends Ce { fromSchema(t) { for (const r of kIe) delete t[r]; const n = Ee(t, t, ba.schema({ names: { - id: Dh, + id: jh, type: Ui } })); ke.assertSchema(n, this.className), this.id = n.result.id.valueBlock.toString(), Ui in n.result && (this.type = n.result.type); } toSchema() { - const t = [new Ve({ value: this.id })]; + const t = [new $e({ value: this.id })]; return Ui in this && t.push(this.type), new z({ value: t }); } toJSON() { const t = { id: this.id }; return this.type && (t.type = this.type.toJSON()), t; } -}, ba.CLASS_NAME = "QCStatement", ba), jl, SIe = (jl = class extends Ce { +}, ba.CLASS_NAME = "QCStatement", ba), Fl, SIe = (Fl = class extends Ce { constructor(t = {}) { - super(), this.values = t[jh] ?? jl.defaultValues(jh), t.schema && this.fromSchema(t.schema); + super(), this.values = t[Fh] ?? Fl.defaultValues(Fh), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case jh: + case Fh: return []; default: return super.defaultValues(t); @@ -57744,7 +57790,7 @@ var ba, h4 = (ba = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case jh: + case Fh: return n.length === 0; default: return super.defaultValues(t); @@ -57754,7 +57800,7 @@ var ba, h4 = (ba = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.values || "", value: h4.schema(n.value || {}) })] @@ -57762,7 +57808,7 @@ var ba, h4 = (ba = class extends Ce { } fromSchema(t) { for (const r of AIe) delete t[r]; - const n = Ee(t, t, jl.schema({ names: { values: jh } })); + const n = Ee(t, t, Fl.schema({ names: { values: Fh } })); ke.assertSchema(n, this.className), this.values = Array.from(n.result.values, (r) => new h4({ schema: r })); } toSchema() { @@ -57771,7 +57817,7 @@ var ba, h4 = (ba = class extends Ce { toJSON() { return { values: Array.from(this.values, (t) => t.toJSON()) }; } -}, jl.CLASS_NAME = "QCStatements", jl), Po, Sg = (Po = class { +}, Fl.CLASS_NAME = "QCStatements", Fl), Ro, xg = (Ro = class { static register(t, n, r) { this.namedCurves[t.toLowerCase()] = this.namedCurves[n] = { name: t, @@ -57782,9 +57828,9 @@ var ba, h4 = (ba = class extends Ce { static find(t) { return this.namedCurves[t.toLowerCase()] || null; } -}, Po.namedCurves = {}, Po.register("P-256", "1.2.840.10045.3.1.7", 32), Po.register("P-384", "1.3.132.0.34", 48), Po.register("P-521", "1.3.132.0.35", 66), Po.register("brainpoolP256r1", "1.3.36.3.3.2.8.1.1.7", 32), Po.register("brainpoolP384r1", "1.3.36.3.3.2.8.1.1.11", 48), Po.register("brainpoolP512r1", "1.3.36.3.3.2.8.1.1.13", 64), Po); +}, Ro.namedCurves = {}, Ro.register("P-256", "1.2.840.10045.3.1.7", 32), Ro.register("P-384", "1.3.132.0.34", 48), Ro.register("P-521", "1.3.132.0.35", 66), Ro.register("brainpoolP256r1", "1.3.36.3.3.2.8.1.1.7", 32), Ro.register("brainpoolP384r1", "1.3.36.3.3.2.8.1.1.11", 48), Ro.register("brainpoolP512r1", "1.3.36.3.3.2.8.1.1.13", 64), Ro); const X1 = "x", Z1 = "y", ek = "namedCurve"; -var as, il = (as = class extends Ce { +var as, al = (as = class extends Ce { constructor(t = {}) { super(), this.x = t[X1] ?? as.defaultValues(X1), this.y = t[Z1] ?? as.defaultValues(Z1), this.namedCurve = t[ek] ?? as.defaultValues(ek), t.json && this.fromJSON(t.json), t.schema && this.fromSchema(t.schema); } @@ -57803,7 +57849,7 @@ var as, il = (as = class extends Ce { switch (t) { case X1: case Z1: - return n instanceof ArrayBuffer && Kt.equal(n, as.defaultValues(t)); + return n instanceof ArrayBuffer && Wt.equal(n, as.defaultValues(t)); case ek: return typeof n == "string" && n === as.defaultValues(t); default: @@ -57814,37 +57860,37 @@ var as, il = (as = class extends Ce { return new rx(); } fromSchema(t) { - const n = ct(t); + const n = lt(t); if (n[0] !== 4) throw new Error("Object's schema was not verified against input data for ECPublicKey"); - const r = Sg.find(this.namedCurve); + const r = xg.find(this.namedCurve); if (!r) throw new Error(`Incorrect curve OID: ${this.namedCurve}`); const o = r.size; if (n.byteLength !== o * 2 + 1) throw new Error("Object's schema was not verified against input data for ECPublicKey"); this.namedCurve = r.name, this.x = n.slice(1, o + 1).buffer, this.y = n.slice(1 + o, o * 2 + 1).buffer; } toSchema() { - return new rx({ data: Kt.concat(new Uint8Array([4]), this.x, this.y) }); + return new rx({ data: Wt.concat(new Uint8Array([4]), this.x, this.y) }); } toJSON() { - const t = Sg.find(this.namedCurve); + const t = xg.find(this.namedCurve); return { crv: t ? t.name : this.namedCurve, - x: St.encode(this.x), - y: St.encode(this.y) + x: xt.encode(this.x), + y: xt.encode(this.y) }; } fromJSON(t) { - Ct.assert("json", t, "crv", "x", "y"); + Ot.assert("json", t, "crv", "x", "y"); let n = 0; - const r = Sg.find(t.crv); + const r = xg.find(t.crv); r && (this.namedCurve = r.id, n = r.size); - const o = St.decode(t.x, { allowPadding: !0 }); + const o = xt.decode(t.x, { allowPadding: !0 }); if (o.byteLength < n) { this.x = new ArrayBuffer(n); const i = new Uint8Array(this.x), a = new Uint8Array(o); i.set(a, 1); } else this.x = o.slice(0, n).buffer; - const s = St.decode(t.y, { allowPadding: !0 }); + const s = xt.decode(t.y, { allowPadding: !0 }); if (s.byteLength < n) { this.y = new ArrayBuffer(n); const i = new Uint8Array(this.y), a = new Uint8Array(s); @@ -57860,9 +57906,9 @@ var wa, p4 = (wa = class extends Ce { static defaultValues(t) { switch (t) { case cb: - return new de(); + return new ue(); case lb: - return new de(); + return new ue(); default: return super.defaultValues(t); } @@ -57871,7 +57917,7 @@ var wa, p4 = (wa = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new de({ name: n.modulus || "" }), new de({ name: n.publicExponent || "" })] + value: [new ue({ name: n.modulus || "" }), new ue({ name: n.publicExponent || "" })] }); } fromSchema(t) { @@ -57887,12 +57933,12 @@ var wa, p4 = (wa = class extends Ce { } toJSON() { return { - n: St.encode(this.modulus.valueBlock.valueHexView), - e: St.encode(this.publicExponent.valueBlock.valueHexView) + n: xt.encode(this.modulus.valueBlock.valueHexView), + e: xt.encode(this.publicExponent.valueBlock.valueHexView) }; } fromJSON(t) { - Ct.assert("json", t, "n", "e"), this.modulus = new de({ valueHex: St.decode(t.n, { allowPadding: !0 }) }), this.publicExponent = new de({ valueHex: St.decode(t.e, { allowPadding: !0 }) }); + Ot.assert("json", t, "n", "e"), this.modulus = new ue({ valueHex: xt.decode(t.n, { allowPadding: !0 }) }), this.publicExponent = new ue({ valueHex: xt.decode(t.e, { allowPadding: !0 }) }); } }, wa.CLASS_NAME = "RSAPublicKey", wa); const ub = "algorithm", db = "subjectPublicKey", EIe = [ub, db]; @@ -57901,9 +57947,9 @@ var va, mi = (va = class extends Ce { if (this._parsedKey === void 0) { switch (this.algorithm.algorithmId) { case "1.2.840.10045.2.1": - if ("algorithmParams" in this.algorithm && this.algorithm.algorithmParams.constructor.blockName() === Ve.blockName()) + if ("algorithmParams" in this.algorithm && this.algorithm.algorithmParams.constructor.blockName() === $e.blockName()) try { - this._parsedKey = new il({ + this._parsedKey = new al({ namedCurve: this.algorithm.algorithmParams.valueBlock.toString(), schema: this.subjectPublicKey.valueBlock.valueHexView }); @@ -57912,7 +57958,7 @@ var va, mi = (va = class extends Ce { break; case "1.2.840.113549.1.1.1": case "1.2.840.113549.1.1.10": { - const t = hn(this.subjectPublicKey.valueBlock.valueHexView); + const t = pn(this.subjectPublicKey.valueBlock.valueHexView); if (t.offset !== -1) try { this._parsedKey = new p4({ schema: t.result }); } catch { @@ -57934,9 +57980,9 @@ var va, mi = (va = class extends Ce { static defaultValues(t) { switch (t) { case ub: - return new fe(); + return new de(); case db: - return new ht(); + return new pt(); default: return super.defaultValues(t); } @@ -57945,7 +57991,7 @@ var va, mi = (va = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [fe.schema(n.algorithm || {}), new ht({ name: n.subjectPublicKey || "" })] + value: [de.schema(n.algorithm || {}), new pt({ name: n.subjectPublicKey || "" })] }); } fromSchema(t) { @@ -57954,7 +58000,7 @@ var va, mi = (va = class extends Ce { algorithm: { names: { blockName: ub } }, subjectPublicKey: db } })); - ke.assertSchema(n, this.className), this.algorithm = new fe({ schema: n.result.algorithm }), this.subjectPublicKey = n.result.subjectPublicKey; + ke.assertSchema(n, this.className), this.algorithm = new de({ schema: n.result.algorithm }), this.subjectPublicKey = n.result.subjectPublicKey; } toSchema() { return new z({ value: [this.algorithm.toSchema(), this.subjectPublicKey] }); @@ -57980,27 +58026,27 @@ var va, mi = (va = class extends Ce { if ("kty" in t) { switch (t.kty.toUpperCase()) { case "EC": - this.parsedKey = new il({ json: t }), this.algorithm = new fe({ + this.parsedKey = new al({ json: t }), this.algorithm = new de({ algorithmId: "1.2.840.10045.2.1", - algorithmParams: new Ve({ value: this.parsedKey.namedCurve }) + algorithmParams: new $e({ value: this.parsedKey.namedCurve }) }); break; case "RSA": - this.parsedKey = new p4({ json: t }), this.algorithm = new fe({ + this.parsedKey = new p4({ json: t }), this.algorithm = new de({ algorithmId: "1.2.840.113549.1.1.1", - algorithmParams: new fn() + algorithmParams: new hn() }); break; default: throw new Error(`Invalid value for "kty" parameter: ${t.kty}`); } - this.subjectPublicKey = new ht({ valueHex: this.parsedKey.toSchema().toBER(!1) }); + this.subjectPublicKey = new pt({ valueHex: this.parsedKey.toSchema().toBER(!1) }); } } async importKey(t, n = Ye(!0)) { try { if (!t) throw new Error("Need to provide publicKey input parameter"); - const r = await n.exportKey("spki", t), o = hn(r); + const r = await n.exportKey("spki", t), o = pn(r); try { this.fromSchema(o.result); } catch { @@ -58012,40 +58058,40 @@ var va, mi = (va = class extends Ce { } } }, va.CLASS_NAME = "PublicKeyInfo", va); -const Fh = "version", Vh = "privateKey", Xo = "namedCurve", Pc = "publicKey", CIe = [ - Fh, +const Vh = "version", $h = "privateKey", Xo = "namedCurve", Rc = "publicKey", CIe = [ Vh, + $h, Xo, - Pc + Rc ]; -var $r, g4 = ($r = class extends Ce { +var Ur, g4 = (Ur = class extends Ce { constructor(t = {}) { - super(), this.version = t[Fh] ?? $r.defaultValues(Fh), this.privateKey = t[Vh] ?? $r.defaultValues(Vh), Xo in t && (this.namedCurve = t[Xo] ?? $r.defaultValues(Xo)), Pc in t && (this.publicKey = t[Pc] ?? $r.defaultValues(Pc)), t.json && this.fromJSON(t.json), t.schema && this.fromSchema(t.schema); + super(), this.version = t[Vh] ?? Ur.defaultValues(Vh), this.privateKey = t[$h] ?? Ur.defaultValues($h), Xo in t && (this.namedCurve = t[Xo] ?? Ur.defaultValues(Xo)), Rc in t && (this.publicKey = t[Rc] ?? Ur.defaultValues(Rc)), t.json && this.fromJSON(t.json), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Fh: - return 1; case Vh: + return 1; + case $h: return new Oe(); case Xo: return ""; - case Pc: - return new il(); + case Rc: + return new al(); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case Fh: - return n === $r.defaultValues(t); case Vh: - return n.isEqual($r.defaultValues(t)); + return n === Ur.defaultValues(t); + case $h: + return n.isEqual(Ur.defaultValues(t)); case Xo: return n === ""; - case Pc: - return il.compareWithDefault(Xo, n.namedCurve) && il.compareWithDefault("x", n.x) && il.compareWithDefault("y", n.y); + case Rc: + return al.compareWithDefault(Xo, n.namedCurve) && al.compareWithDefault("x", n.x) && al.compareWithDefault("y", n.y); default: return super.defaultValues(t); } @@ -58055,61 +58101,61 @@ var $r, g4 = ($r = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), + new ue({ name: n.version || "" }), new Oe({ name: n.privateKey || "" }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Ve({ name: n.namedCurve || "" })] + value: [new $e({ name: n.namedCurve || "" })] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new ht({ name: n.publicKey || "" })] + value: [new pt({ name: n.publicKey || "" })] }) ] }); } fromSchema(t) { for (const r of CIe) delete t[r]; - const n = Ee(t, t, $r.schema({ names: { - version: Fh, - privateKey: Vh, + const n = Ee(t, t, Ur.schema({ names: { + version: Vh, + privateKey: $h, namedCurve: Xo, - publicKey: Pc + publicKey: Rc } })); - if (ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.privateKey = n.result.privateKey, Xo in n.result && (this.namedCurve = n.result.namedCurve.valueBlock.toString()), Pc in n.result) { + if (ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.privateKey = n.result.privateKey, Xo in n.result && (this.namedCurve = n.result.namedCurve.valueBlock.toString()), Rc in n.result) { const r = { schema: n.result.publicKey.valueBlock.valueHex }; - Xo in this && (r.namedCurve = this.namedCurve), this.publicKey = new il(r); + Xo in this && (r.namedCurve = this.namedCurve), this.publicKey = new al(r); } } toSchema() { - const t = [new de({ value: this.version }), this.privateKey]; - return this.namedCurve && t.push(new ee({ + const t = [new ue({ value: this.version }), this.privateKey]; + return this.namedCurve && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Ve({ value: this.namedCurve })] - })), this.publicKey && t.push(new ee({ + value: [new $e({ value: this.namedCurve })] + })), this.publicKey && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new ht({ valueHex: this.publicKey.toSchema().toBER(!1) })] + value: [new pt({ valueHex: this.publicKey.toSchema().toBER(!1) })] })), new z({ value: t }); } toJSON() { - if (!this.namedCurve || $r.compareWithDefault(Xo, this.namedCurve)) throw new Error('Not enough information for making JSON: absent "namedCurve" value'); - const t = Sg.find(this.namedCurve), n = { + if (!this.namedCurve || Ur.compareWithDefault(Xo, this.namedCurve)) throw new Error('Not enough information for making JSON: absent "namedCurve" value'); + const t = xg.find(this.namedCurve), n = { crv: t ? t.name : this.namedCurve, - d: St.encode(this.privateKey.valueBlock.valueHexView) + d: xt.encode(this.privateKey.valueBlock.valueHexView) }; if (this.publicKey) { const r = this.publicKey.toJSON(); @@ -58118,18 +58164,18 @@ var $r, g4 = ($r = class extends Ce { return n; } fromJSON(t) { - Ct.assert("json", t, "crv", "d"); + Ot.assert("json", t, "crv", "d"); let n = 0; - const r = Sg.find(t.crv); + const r = xg.find(t.crv); r && (this.namedCurve = r.id, n = r.size); - const o = St.decode(t.d); + const o = xt.decode(t.d); if (o.byteLength < n) { const s = new ArrayBuffer(n), i = new Uint8Array(s), a = new Uint8Array(o); i.set(a, 1), this.privateKey = new Oe({ valueHex: s }); } else this.privateKey = new Oe({ valueHex: o.slice(0, n) }); - t.x && t.y && (this.publicKey = new il({ json: t })); + t.x && t.y && (this.publicKey = new al({ json: t })); } -}, $r.CLASS_NAME = "ECPrivateKey", $r); +}, Ur.CLASS_NAME = "ECPrivateKey", Ur); const fb = "prime", hb = "exponent", pb = "coefficient", IIe = [ fb, hb, @@ -58142,11 +58188,11 @@ var $s, zC = ($s = class extends Ce { static defaultValues(t) { switch (t) { case fb: - return new de(); + return new ue(); case hb: - return new de(); + return new ue(); case pb: - return new de(); + return new ue(); default: return super.defaultValues(t); } @@ -58156,9 +58202,9 @@ var $s, zC = ($s = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.prime || "" }), - new de({ name: n.exponent || "" }), - new de({ name: n.coefficient || "" }) + new ue({ name: n.prime || "" }), + new ue({ name: n.exponent || "" }), + new ue({ name: n.coefficient || "" }) ] }); } @@ -58180,16 +58226,16 @@ var $s, zC = ($s = class extends Ce { } toJSON() { return { - r: St.encode(this.prime.valueBlock.valueHexView), - d: St.encode(this.exponent.valueBlock.valueHexView), - t: St.encode(this.coefficient.valueBlock.valueHexView) + r: xt.encode(this.prime.valueBlock.valueHexView), + d: xt.encode(this.exponent.valueBlock.valueHexView), + t: xt.encode(this.coefficient.valueBlock.valueHexView) }; } fromJSON(t) { - Ct.assert("json", t, "r", "d", "r"), this.prime = new de({ valueHex: St.decode(t.r) }), this.exponent = new de({ valueHex: St.decode(t.d) }), this.coefficient = new de({ valueHex: St.decode(t.t) }); + Ot.assert("json", t, "r", "d", "r"), this.prime = new ue({ valueHex: xt.decode(t.r) }), this.exponent = new ue({ valueHex: xt.decode(t.d) }), this.coefficient = new ue({ valueHex: xt.decode(t.t) }); } }, $s.CLASS_NAME = "OtherPrimeInfo", $s); -const gb = "version", mb = "modulus", yb = "publicExponent", bb = "privateExponent", wb = "prime1", vb = "prime2", kb = "exponent1", Ab = "exponent2", Sb = "coefficient", _u = "otherPrimeInfos", NIe = [ +const gb = "version", mb = "modulus", yb = "publicExponent", bb = "privateExponent", wb = "prime1", vb = "prime2", kb = "exponent1", Ab = "exponent2", Sb = "coefficient", Lu = "otherPrimeInfos", NIe = [ gb, mb, yb, @@ -58199,33 +58245,33 @@ const gb = "version", mb = "modulus", yb = "publicExponent", bb = "privateExpone kb, Ab, Sb, - _u + Lu ]; -var er, m4 = (er = class extends Ce { +var tr, m4 = (tr = class extends Ce { constructor(t = {}) { - super(), this.version = t[gb] ?? er.defaultValues(gb), this.modulus = t[mb] ?? er.defaultValues(mb), this.publicExponent = t[yb] ?? er.defaultValues(yb), this.privateExponent = t[bb] ?? er.defaultValues(bb), this.prime1 = t[wb] ?? er.defaultValues(wb), this.prime2 = t[vb] ?? er.defaultValues(vb), this.exponent1 = t[kb] ?? er.defaultValues(kb), this.exponent2 = t[Ab] ?? er.defaultValues(Ab), this.coefficient = t[Sb] ?? er.defaultValues(Sb), _u in t && (this.otherPrimeInfos = t[_u] ?? er.defaultValues(_u)), t.json && this.fromJSON(t.json), t.schema && this.fromSchema(t.schema); + super(), this.version = t[gb] ?? tr.defaultValues(gb), this.modulus = t[mb] ?? tr.defaultValues(mb), this.publicExponent = t[yb] ?? tr.defaultValues(yb), this.privateExponent = t[bb] ?? tr.defaultValues(bb), this.prime1 = t[wb] ?? tr.defaultValues(wb), this.prime2 = t[vb] ?? tr.defaultValues(vb), this.exponent1 = t[kb] ?? tr.defaultValues(kb), this.exponent2 = t[Ab] ?? tr.defaultValues(Ab), this.coefficient = t[Sb] ?? tr.defaultValues(Sb), Lu in t && (this.otherPrimeInfos = t[Lu] ?? tr.defaultValues(Lu)), t.json && this.fromJSON(t.json), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case gb: return 0; case mb: - return new de(); + return new ue(); case yb: - return new de(); + return new ue(); case bb: - return new de(); + return new ue(); case wb: - return new de(); + return new ue(); case vb: - return new de(); + return new ue(); case kb: - return new de(); + return new ue(); case Ab: - return new de(); + return new ue(); case Sb: - return new de(); - case _u: + return new ue(); + case Lu: return []; default: return super.defaultValues(t); @@ -58236,18 +58282,18 @@ var er, m4 = (er = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), - new de({ name: n.modulus || "" }), - new de({ name: n.publicExponent || "" }), - new de({ name: n.privateExponent || "" }), - new de({ name: n.prime1 || "" }), - new de({ name: n.prime2 || "" }), - new de({ name: n.exponent1 || "" }), - new de({ name: n.exponent2 || "" }), - new de({ name: n.coefficient || "" }), + new ue({ name: n.version || "" }), + new ue({ name: n.modulus || "" }), + new ue({ name: n.publicExponent || "" }), + new ue({ name: n.privateExponent || "" }), + new ue({ name: n.prime1 || "" }), + new ue({ name: n.prime2 || "" }), + new ue({ name: n.exponent1 || "" }), + new ue({ name: n.exponent2 || "" }), + new ue({ name: n.coefficient || "" }), new z({ optional: !0, - value: [new ot({ + value: [new st({ name: n.otherPrimeInfosName || "", value: zC.schema(n.otherPrimeInfo || {}) })] @@ -58257,7 +58303,7 @@ var er, m4 = (er = class extends Ce { } fromSchema(t) { for (const r of NIe) delete t[r]; - const n = Ee(t, t, er.schema({ names: { + const n = Ee(t, t, tr.schema({ names: { version: gb, modulus: mb, publicExponent: yb, @@ -58267,50 +58313,50 @@ var er, m4 = (er = class extends Ce { exponent1: kb, exponent2: Ab, coefficient: Sb, - otherPrimeInfo: { names: { blockName: _u } } + otherPrimeInfo: { names: { blockName: Lu } } } })); - ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.modulus = n.result.modulus.convertFromDER(256), this.publicExponent = n.result.publicExponent, this.privateExponent = n.result.privateExponent.convertFromDER(256), this.prime1 = n.result.prime1.convertFromDER(128), this.prime2 = n.result.prime2.convertFromDER(128), this.exponent1 = n.result.exponent1.convertFromDER(128), this.exponent2 = n.result.exponent2.convertFromDER(128), this.coefficient = n.result.coefficient.convertFromDER(128), _u in n.result && (this.otherPrimeInfos = Array.from(n.result.otherPrimeInfos, (r) => new zC({ schema: r }))); + ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.modulus = n.result.modulus.convertFromDER(256), this.publicExponent = n.result.publicExponent, this.privateExponent = n.result.privateExponent.convertFromDER(256), this.prime1 = n.result.prime1.convertFromDER(128), this.prime2 = n.result.prime2.convertFromDER(128), this.exponent1 = n.result.exponent1.convertFromDER(128), this.exponent2 = n.result.exponent2.convertFromDER(128), this.coefficient = n.result.coefficient.convertFromDER(128), Lu in n.result && (this.otherPrimeInfos = Array.from(n.result.otherPrimeInfos, (r) => new zC({ schema: r }))); } toSchema() { const t = []; - return t.push(new de({ value: this.version })), t.push(this.modulus.convertToDER()), t.push(this.publicExponent), t.push(this.privateExponent.convertToDER()), t.push(this.prime1.convertToDER()), t.push(this.prime2.convertToDER()), t.push(this.exponent1.convertToDER()), t.push(this.exponent2.convertToDER()), t.push(this.coefficient.convertToDER()), this.otherPrimeInfos && t.push(new z({ value: Array.from(this.otherPrimeInfos, (n) => n.toSchema()) })), new z({ value: t }); + return t.push(new ue({ value: this.version })), t.push(this.modulus.convertToDER()), t.push(this.publicExponent), t.push(this.privateExponent.convertToDER()), t.push(this.prime1.convertToDER()), t.push(this.prime2.convertToDER()), t.push(this.exponent1.convertToDER()), t.push(this.exponent2.convertToDER()), t.push(this.coefficient.convertToDER()), this.otherPrimeInfos && t.push(new z({ value: Array.from(this.otherPrimeInfos, (n) => n.toSchema()) })), new z({ value: t }); } toJSON() { const t = { - n: St.encode(this.modulus.valueBlock.valueHexView), - e: St.encode(this.publicExponent.valueBlock.valueHexView), - d: St.encode(this.privateExponent.valueBlock.valueHexView), - p: St.encode(this.prime1.valueBlock.valueHexView), - q: St.encode(this.prime2.valueBlock.valueHexView), - dp: St.encode(this.exponent1.valueBlock.valueHexView), - dq: St.encode(this.exponent2.valueBlock.valueHexView), - qi: St.encode(this.coefficient.valueBlock.valueHexView) + n: xt.encode(this.modulus.valueBlock.valueHexView), + e: xt.encode(this.publicExponent.valueBlock.valueHexView), + d: xt.encode(this.privateExponent.valueBlock.valueHexView), + p: xt.encode(this.prime1.valueBlock.valueHexView), + q: xt.encode(this.prime2.valueBlock.valueHexView), + dp: xt.encode(this.exponent1.valueBlock.valueHexView), + dq: xt.encode(this.exponent2.valueBlock.valueHexView), + qi: xt.encode(this.coefficient.valueBlock.valueHexView) }; return this.otherPrimeInfos && (t.oth = Array.from(this.otherPrimeInfos, (n) => n.toJSON())), t; } fromJSON(t) { - Ct.assert("json", t, "n", "e", "d", "p", "q", "dp", "dq", "qi"), this.modulus = new de({ valueHex: St.decode(t.n) }), this.publicExponent = new de({ valueHex: St.decode(t.e) }), this.privateExponent = new de({ valueHex: St.decode(t.d) }), this.prime1 = new de({ valueHex: St.decode(t.p) }), this.prime2 = new de({ valueHex: St.decode(t.q) }), this.exponent1 = new de({ valueHex: St.decode(t.dp) }), this.exponent2 = new de({ valueHex: St.decode(t.dq) }), this.coefficient = new de({ valueHex: St.decode(t.qi) }), t.oth && (this.otherPrimeInfos = Array.from(t.oth, (n) => new zC({ json: n }))); + Ot.assert("json", t, "n", "e", "d", "p", "q", "dp", "dq", "qi"), this.modulus = new ue({ valueHex: xt.decode(t.n) }), this.publicExponent = new ue({ valueHex: xt.decode(t.e) }), this.privateExponent = new ue({ valueHex: xt.decode(t.d) }), this.prime1 = new ue({ valueHex: xt.decode(t.p) }), this.prime2 = new ue({ valueHex: xt.decode(t.q) }), this.exponent1 = new ue({ valueHex: xt.decode(t.dp) }), this.exponent2 = new ue({ valueHex: xt.decode(t.dq) }), this.coefficient = new ue({ valueHex: xt.decode(t.qi) }), t.oth && (this.otherPrimeInfos = Array.from(t.oth, (n) => new zC({ json: n }))); } -}, er.CLASS_NAME = "RSAPrivateKey", er); -const xb = "version", Eb = "privateKeyAlgorithm", Cb = "privateKey", Lu = "attributes", tk = "parsedKey", OIe = [ +}, tr.CLASS_NAME = "RSAPrivateKey", tr); +const xb = "version", Eb = "privateKeyAlgorithm", Cb = "privateKey", Du = "attributes", tk = "parsedKey", OIe = [ xb, Eb, Cb, - Lu + Du ]; -var Ro, ix = (Ro = class extends Ce { +var To, ix = (To = class extends Ce { constructor(t = {}) { - super(), this.version = t[xb] ?? Ro.defaultValues(xb), this.privateKeyAlgorithm = t[Eb] ?? Ro.defaultValues(Eb), this.privateKey = t[Cb] ?? Ro.defaultValues(Cb), Lu in t && (this.attributes = t[Lu] ?? Ro.defaultValues(Lu)), tk in t && (this.parsedKey = t[tk] ?? Ro.defaultValues(tk)), t.json && this.fromJSON(t.json), t.schema && this.fromSchema(t.schema); + super(), this.version = t[xb] ?? To.defaultValues(xb), this.privateKeyAlgorithm = t[Eb] ?? To.defaultValues(Eb), this.privateKey = t[Cb] ?? To.defaultValues(Cb), Du in t && (this.attributes = t[Du] ?? To.defaultValues(Du)), tk in t && (this.parsedKey = t[tk] ?? To.defaultValues(tk)), t.json && this.fromJSON(t.json), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case xb: return 0; case Eb: - return new fe(); + return new de(); case Cb: return new Oe(); - case Lu: + case Du: return []; case tk: return {}; @@ -58323,16 +58369,16 @@ var Ro, ix = (Ro = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), - fe.schema(n.privateKeyAlgorithm || {}), + new ue({ name: n.version || "" }), + de.schema(n.privateKeyAlgorithm || {}), new Oe({ name: n.privateKey || "" }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new ot({ + value: [new st({ name: n.attributes || "", value: En.schema() })] @@ -58342,22 +58388,22 @@ var Ro, ix = (Ro = class extends Ce { } fromSchema(t) { for (const r of OIe) delete t[r]; - const n = Ee(t, t, Ro.schema({ names: { + const n = Ee(t, t, To.schema({ names: { version: xb, privateKeyAlgorithm: { names: { blockName: Eb } }, privateKey: Cb, - attributes: Lu + attributes: Du } })); - switch (ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.privateKeyAlgorithm = new fe({ schema: n.result.privateKeyAlgorithm }), this.privateKey = n.result.privateKey, Lu in n.result && (this.attributes = Array.from(n.result.attributes, (r) => new En({ schema: r }))), this.privateKeyAlgorithm.algorithmId) { + switch (ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.privateKeyAlgorithm = new de({ schema: n.result.privateKeyAlgorithm }), this.privateKey = n.result.privateKey, Du in n.result && (this.attributes = Array.from(n.result.attributes, (r) => new En({ schema: r }))), this.privateKeyAlgorithm.algorithmId) { case "1.2.840.113549.1.1.1": { - const r = hn(this.privateKey.valueBlock.valueHexView); + const r = pn(this.privateKey.valueBlock.valueHexView); r.offset !== -1 && (this.parsedKey = new m4({ schema: r.result })); } break; case "1.2.840.10045.2.1": - if ("algorithmParams" in this.privateKeyAlgorithm && this.privateKeyAlgorithm.algorithmParams instanceof Ve) { - const r = hn(this.privateKey.valueBlock.valueHexView); + if ("algorithmParams" in this.privateKeyAlgorithm && this.privateKeyAlgorithm.algorithmParams instanceof $e) { + const r = pn(this.privateKey.valueBlock.valueHexView); r.offset !== -1 && (this.parsedKey = new g4({ namedCurve: this.privateKeyAlgorithm.algorithmParams.valueBlock.toString(), schema: r.result @@ -58367,11 +58413,11 @@ var Ro, ix = (Ro = class extends Ce { } toSchema() { const t = [ - new de({ value: this.version }), + new ue({ value: this.version }), this.privateKeyAlgorithm.toSchema(), this.privateKey ]; - return this.attributes && t.push(new ee({ + return this.attributes && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -58404,15 +58450,15 @@ var Ro, ix = (Ro = class extends Ce { if ("kty" in t) { switch (t.kty.toUpperCase()) { case "EC": - this.parsedKey = new g4({ json: t }), this.privateKeyAlgorithm = new fe({ + this.parsedKey = new g4({ json: t }), this.privateKeyAlgorithm = new de({ algorithmId: "1.2.840.10045.2.1", - algorithmParams: new Ve({ value: this.parsedKey.namedCurve }) + algorithmParams: new $e({ value: this.parsedKey.namedCurve }) }); break; case "RSA": - this.parsedKey = new m4({ json: t }), this.privateKeyAlgorithm = new fe({ + this.parsedKey = new m4({ json: t }), this.privateKeyAlgorithm = new de({ algorithmId: "1.2.840.113549.1.1.1", - algorithmParams: new fn() + algorithmParams: new hn() }); break; default: @@ -58421,15 +58467,15 @@ var Ro, ix = (Ro = class extends Ce { this.privateKey = new Oe({ valueHex: this.parsedKey.toSchema().toBER(!1) }); } } -}, Ro.CLASS_NAME = "PrivateKeyInfo", Ro); -const $h = "contentType", Uh = "contentEncryptionAlgorithm", Du = "encryptedContent", PIe = [ - $h, +}, To.CLASS_NAME = "PrivateKeyInfo", To); +const Uh = "contentType", Kh = "contentEncryptionAlgorithm", ju = "encryptedContent", PIe = [ Uh, - Du + Kh, + ju ], y4 = 1024; var Us, Ir = (Us = class extends Ce { constructor(t = {}) { - if (super(), this.contentType = t[$h] ?? Us.defaultValues($h), this.contentEncryptionAlgorithm = t[Uh] ?? Us.defaultValues(Uh), Du in t && t.encryptedContent && (this.encryptedContent = t.encryptedContent, this.encryptedContent.idBlock.tagClass === 1 && this.encryptedContent.idBlock.tagNumber === 4 && this.encryptedContent.idBlock.isConstructed === !1 && !t.disableSplit)) { + if (super(), this.contentType = t[Uh] ?? Us.defaultValues(Uh), this.contentEncryptionAlgorithm = t[Kh] ?? Us.defaultValues(Kh), ju in t && t.encryptedContent && (this.encryptedContent = t.encryptedContent, this.encryptedContent.idBlock.tagClass === 1 && this.encryptedContent.idBlock.tagNumber === 4 && this.encryptedContent.idBlock.isConstructed === !1 && !t.disableSplit)) { const n = new Oe({ idBlock: { isConstructed: !0 }, isConstructed: !0 @@ -58448,11 +58494,11 @@ var Us, Ir = (Us = class extends Ce { } static defaultValues(t) { switch (t) { - case $h: - return ""; case Uh: - return new fe(); - case Du: + return ""; + case Kh: + return new de(); + case ju: return new Oe(); default: return super.defaultValues(t); @@ -58460,12 +58506,12 @@ var Us, Ir = (Us = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case $h: - return n === ""; case Uh: + return n === ""; + case Kh: return n.algorithmId === "" && !("algorithmParams" in n); - case Du: - return n.isEqual(Us.defaultValues(Du)); + case ju: + return n.isEqual(Us.defaultValues(ju)); default: return super.defaultValues(t); } @@ -58475,15 +58521,15 @@ var Us, Ir = (Us = class extends Ce { return new z({ name: n.blockName || "", value: [ - new Ve({ name: n.contentType || "" }), - fe.schema(n.contentEncryptionAlgorithm || {}), - new Xt({ value: [new ee({ + new $e({ name: n.contentType || "" }), + de.schema(n.contentEncryptionAlgorithm || {}), + new en({ value: [new ne({ name: n.encryptedContent || "", idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new ot({ value: new Oe() })] + value: [new st({ value: new Oe() })] }), new Je({ name: n.encryptedContent || "", idBlock: { @@ -58497,15 +58543,15 @@ var Us, Ir = (Us = class extends Ce { fromSchema(t) { for (const r of PIe) delete t[r]; const n = Ee(t, t, Us.schema({ names: { - contentType: $h, - contentEncryptionAlgorithm: { names: { blockName: Uh } }, - encryptedContent: Du + contentType: Uh, + contentEncryptionAlgorithm: { names: { blockName: Kh } }, + encryptedContent: ju } })); - ke.assertSchema(n, this.className), this.contentType = n.result.contentType.valueBlock.toString(), this.contentEncryptionAlgorithm = new fe({ schema: n.result.contentEncryptionAlgorithm }), Du in n.result && (this.encryptedContent = n.result.encryptedContent, this.encryptedContent.idBlock.tagClass = 1, this.encryptedContent.idBlock.tagNumber = 4); + ke.assertSchema(n, this.className), this.contentType = n.result.contentType.valueBlock.toString(), this.contentEncryptionAlgorithm = new de({ schema: n.result.contentEncryptionAlgorithm }), ju in n.result && (this.encryptedContent = n.result.encryptedContent, this.encryptedContent.idBlock.tagClass = 1, this.encryptedContent.idBlock.tagNumber = 4); } toSchema() { const t = { isIndefiniteForm: !1 }, n = []; - if (n.push(new Ve({ value: this.contentType })), n.push(this.contentEncryptionAlgorithm.toSchema()), this.encryptedContent) { + if (n.push(new $e({ value: this.contentType })), n.push(this.contentEncryptionAlgorithm.toSchema()), this.encryptedContent) { t.isIndefiniteForm = this.encryptedContent.idBlock.isConstructed; const r = this.encryptedContent; r.idBlock.tagClass = 3, r.idBlock.tagNumber = 0, r.lenBlock.isIndefiniteForm = this.encryptedContent.idBlock.isConstructed, n.push(r); @@ -58527,34 +58573,34 @@ var Us, Ir = (Us = class extends Ce { return Oe.prototype.getValue.call(this.encryptedContent); } }, Us.CLASS_NAME = "EncryptedContentInfo", Us); -const Rc = "hashAlgorithm", Tc = "maskGenAlgorithm", Mc = "saltLength", Bc = "trailerField", RIe = [ - Rc, +const Tc = "hashAlgorithm", Mc = "maskGenAlgorithm", Bc = "saltLength", _c = "trailerField", RIe = [ Tc, Mc, - Bc + Bc, + _c ]; var Un, WC = (Un = class extends Ce { constructor(t = {}) { - super(), this.hashAlgorithm = t[Rc] ?? Un.defaultValues(Rc), this.maskGenAlgorithm = t[Tc] ?? Un.defaultValues(Tc), this.saltLength = t[Mc] ?? Un.defaultValues(Mc), this.trailerField = t[Bc] ?? Un.defaultValues(Bc), t.schema && this.fromSchema(t.schema); + super(), this.hashAlgorithm = t[Tc] ?? Un.defaultValues(Tc), this.maskGenAlgorithm = t[Mc] ?? Un.defaultValues(Mc), this.saltLength = t[Bc] ?? Un.defaultValues(Bc), this.trailerField = t[_c] ?? Un.defaultValues(_c), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Rc: - return new fe({ + case Tc: + return new de({ algorithmId: "1.3.14.3.2.26", - algorithmParams: new fn() + algorithmParams: new hn() }); - case Tc: - return new fe({ + case Mc: + return new de({ algorithmId: "1.2.840.113549.1.1.8", - algorithmParams: new fe({ + algorithmParams: new de({ algorithmId: "1.3.14.3.2.26", - algorithmParams: new fn() + algorithmParams: new hn() }).toSchema() }); - case Mc: - return 20; case Bc: + return 20; + case _c: return 1; default: return super.defaultValues(t); @@ -58565,37 +58611,37 @@ var Un, WC = (Un = class extends Ce { return new z({ name: n.blockName || "", value: [ - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, optional: !0, - value: [fe.schema(n.hashAlgorithm || {})] + value: [de.schema(n.hashAlgorithm || {})] }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, optional: !0, - value: [fe.schema(n.maskGenAlgorithm || {})] + value: [de.schema(n.maskGenAlgorithm || {})] }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 2 }, optional: !0, - value: [new de({ name: n.saltLength || "" })] + value: [new ue({ name: n.saltLength || "" })] }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 3 }, optional: !0, - value: [new de({ name: n.trailerField || "" })] + value: [new ue({ name: n.trailerField || "" })] }) ] }); @@ -58603,68 +58649,68 @@ var Un, WC = (Un = class extends Ce { fromSchema(t) { for (const r of RIe) delete t[r]; const n = Ee(t, t, Un.schema({ names: { - hashAlgorithm: { names: { blockName: Rc } }, - maskGenAlgorithm: { names: { blockName: Tc } }, - saltLength: Mc, - trailerField: Bc + hashAlgorithm: { names: { blockName: Tc } }, + maskGenAlgorithm: { names: { blockName: Mc } }, + saltLength: Bc, + trailerField: _c } })); - ke.assertSchema(n, this.className), Rc in n.result && (this.hashAlgorithm = new fe({ schema: n.result.hashAlgorithm })), Tc in n.result && (this.maskGenAlgorithm = new fe({ schema: n.result.maskGenAlgorithm })), Mc in n.result && (this.saltLength = n.result.saltLength.valueBlock.valueDec), Bc in n.result && (this.trailerField = n.result.trailerField.valueBlock.valueDec); + ke.assertSchema(n, this.className), Tc in n.result && (this.hashAlgorithm = new de({ schema: n.result.hashAlgorithm })), Mc in n.result && (this.maskGenAlgorithm = new de({ schema: n.result.maskGenAlgorithm })), Bc in n.result && (this.saltLength = n.result.saltLength.valueBlock.valueDec), _c in n.result && (this.trailerField = n.result.trailerField.valueBlock.valueDec); } toSchema() { const t = []; - return this.hashAlgorithm.isEqual(Un.defaultValues(Rc)) || t.push(new ee({ + return this.hashAlgorithm.isEqual(Un.defaultValues(Tc)) || t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: [this.hashAlgorithm.toSchema()] - })), this.maskGenAlgorithm.isEqual(Un.defaultValues(Tc)) || t.push(new ee({ + })), this.maskGenAlgorithm.isEqual(Un.defaultValues(Mc)) || t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, value: [this.maskGenAlgorithm.toSchema()] - })), this.saltLength !== Un.defaultValues(Mc) && t.push(new ee({ + })), this.saltLength !== Un.defaultValues(Bc) && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 2 }, - value: [new de({ value: this.saltLength })] - })), this.trailerField !== Un.defaultValues(Bc) && t.push(new ee({ + value: [new ue({ value: this.saltLength })] + })), this.trailerField !== Un.defaultValues(_c) && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 3 }, - value: [new de({ value: this.trailerField })] + value: [new ue({ value: this.trailerField })] })), new z({ value: t }); } toJSON() { const t = {}; - return this.hashAlgorithm.isEqual(Un.defaultValues(Rc)) || (t.hashAlgorithm = this.hashAlgorithm.toJSON()), this.maskGenAlgorithm.isEqual(Un.defaultValues(Tc)) || (t.maskGenAlgorithm = this.maskGenAlgorithm.toJSON()), this.saltLength !== Un.defaultValues(Mc) && (t.saltLength = this.saltLength), this.trailerField !== Un.defaultValues(Bc) && (t.trailerField = this.trailerField), t; + return this.hashAlgorithm.isEqual(Un.defaultValues(Tc)) || (t.hashAlgorithm = this.hashAlgorithm.toJSON()), this.maskGenAlgorithm.isEqual(Un.defaultValues(Mc)) || (t.maskGenAlgorithm = this.maskGenAlgorithm.toJSON()), this.saltLength !== Un.defaultValues(Bc) && (t.saltLength = this.saltLength), this.trailerField !== Un.defaultValues(_c) && (t.trailerField = this.trailerField), t; } }, Un.CLASS_NAME = "RSASSAPSSParams", Un); -const Kh = "salt", Ib = "iterationCount", Zo = "keyLength", Ki = "prf", TIe = [ - Kh, +const Hh = "salt", Ib = "iterationCount", Zo = "keyLength", Ki = "prf", TIe = [ + Hh, Ib, Zo, Ki ]; var Ar, a0 = (Ar = class extends Ce { constructor(t = {}) { - super(), this.salt = t[Kh] ?? Ar.defaultValues(Kh), this.iterationCount = t[Ib] ?? Ar.defaultValues(Ib), Zo in t && (this.keyLength = t[Zo] ?? Ar.defaultValues(Zo)), Ki in t && (this.prf = t[Ki] ?? Ar.defaultValues(Ki)), t.schema && this.fromSchema(t.schema); + super(), this.salt = t[Hh] ?? Ar.defaultValues(Hh), this.iterationCount = t[Ib] ?? Ar.defaultValues(Ib), Zo in t && (this.keyLength = t[Zo] ?? Ar.defaultValues(Zo)), Ki in t && (this.prf = t[Ki] ?? Ar.defaultValues(Ki)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Kh: + case Hh: return {}; case Ib: return -1; case Zo: return 0; case Ki: - return new fe({ + return new de({ algorithmId: "1.3.14.3.2.26", - algorithmParams: new fn() + algorithmParams: new hn() }); default: return super.defaultValues(t); @@ -58675,21 +58721,21 @@ var Ar, a0 = (Ar = class extends Ce { return new z({ name: n.blockName || "", value: [ - new Xt({ value: [new Oe({ name: n.saltPrimitive || "" }), fe.schema(n.saltConstructed || {})] }), - new de({ name: n.iterationCount || "" }), - new de({ + new en({ value: [new Oe({ name: n.saltPrimitive || "" }), de.schema(n.saltConstructed || {})] }), + new ue({ name: n.iterationCount || "" }), + new ue({ name: n.keyLength || "", optional: !0 }), - fe.schema(n.prf || { names: { optional: !0 } }) + de.schema(n.prf || { names: { optional: !0 } }) ] }); } fromSchema(t) { for (const r of TIe) delete t[r]; const n = Ee(t, t, Ar.schema({ names: { - saltPrimitive: Kh, - saltConstructed: { names: { blockName: Kh } }, + saltPrimitive: Hh, + saltConstructed: { names: { blockName: Hh } }, iterationCount: Ib, keyLength: Zo, prf: { names: { @@ -58697,11 +58743,11 @@ var Ar, a0 = (Ar = class extends Ce { optional: !0 } } } })); - ke.assertSchema(n, this.className), this.salt = n.result.salt, this.iterationCount = n.result.iterationCount.valueBlock.valueDec, Zo in n.result && (this.keyLength = n.result.keyLength.valueBlock.valueDec), Ki in n.result && (this.prf = new fe({ schema: n.result.prf })); + ke.assertSchema(n, this.className), this.salt = n.result.salt, this.iterationCount = n.result.iterationCount.valueBlock.valueDec, Zo in n.result && (this.keyLength = n.result.keyLength.valueBlock.valueDec), Ki in n.result && (this.prf = new de({ schema: n.result.prf })); } toSchema() { const t = []; - return t.push(this.salt), t.push(new de({ value: this.iterationCount })), Zo in this && Ar.defaultValues(Zo) !== this.keyLength && t.push(new de({ value: this.keyLength })), this.prf && Ar.defaultValues(Ki).isEqual(this.prf) === !1 && t.push(this.prf.toSchema()), new z({ value: t }); + return t.push(this.salt), t.push(new ue({ value: this.iterationCount })), Zo in this && Ar.defaultValues(Zo) !== this.keyLength && t.push(new ue({ value: this.keyLength })), this.prf && Ar.defaultValues(Ki).isEqual(this.prf) === !1 && t.push(this.prf.toSchema()), new z({ value: t }); } toJSON() { const t = { @@ -58719,9 +58765,9 @@ var ka, b4 = (ka = class extends Ce { static defaultValues(t) { switch (t) { case Nb: - return new fe(); + return new de(); case Ob: - return new fe(); + return new de(); default: return super.defaultValues(t); } @@ -58730,7 +58776,7 @@ var ka, b4 = (ka = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [fe.schema(n.keyDerivationFunc || {}), fe.schema(n.encryptionScheme || {})] + value: [de.schema(n.keyDerivationFunc || {}), de.schema(n.encryptionScheme || {})] }); } fromSchema(t) { @@ -58739,7 +58785,7 @@ var ka, b4 = (ka = class extends Ce { keyDerivationFunc: { names: { blockName: Nb } }, encryptionScheme: { names: { blockName: Ob } } } })); - ke.assertSchema(n, this.className), this.keyDerivationFunc = new fe({ schema: n.result.keyDerivationFunc }), this.encryptionScheme = new fe({ schema: n.result.encryptionScheme }); + ke.assertSchema(n, this.className), this.keyDerivationFunc = new de({ schema: n.result.keyDerivationFunc }), this.encryptionScheme = new de({ schema: n.result.encryptionScheme }); } toSchema() { return new z({ value: [this.keyDerivationFunc.toSchema(), this.encryptionScheme.toSchema()] }); @@ -58816,16 +58862,16 @@ async function w4(e, t, n, r, o) { const c = new Uint8Array(n); let l = new TextDecoder().decode(n); new TextEncoder().encode(l).some((C, k) => C !== c[k]) && (l = String.fromCharCode(...c)); - const u = new Uint8Array(l.length * 2 + 2), d = new DataView(u.buffer); - for (let C = 0; C < l.length; C++) d.setUint16(C * 2, l.charCodeAt(C), !1); - d.setUint16(l.length * 2, 0, !1); - const f = new Uint8Array(i).fill(3), h = new Uint8Array(r), g = new Uint8Array(i * Math.ceil(h.length / i)).map((C, k) => h[k % h.length]), p = new Uint8Array(i * Math.ceil(u.length / i)).map((C, k) => u[k % u.length]); + const u = new Uint8Array(l.length * 2 + 2), f = new DataView(u.buffer); + for (let C = 0; C < l.length; C++) f.setUint16(C * 2, l.charCodeAt(C), !1); + f.setUint16(l.length * 2, 0, !1); + const d = new Uint8Array(i).fill(3), h = new Uint8Array(r), g = new Uint8Array(i * Math.ceil(h.length / i)).map((C, k) => h[k % h.length]), p = new Uint8Array(i * Math.ceil(u.length / i)).map((C, k) => u[k % u.length]); let m = new Uint8Array(g.length + p.length); m.set(g), m.set(p, g.length); const v = Math.ceil((t >> 3) / s), S = []; for (let C = 0; C < v; C++) { - let k = new Uint8Array(f.length + m.length); - k.set(f), k.set(m, f.length); + let k = new Uint8Array(d.length + m.length); + k.set(d), k.set(m, d.length); for (let x = 0; x < o; x++) k = a(k); const N = new Uint8Array(i).map((x, A) => k[A % k.length]), w = Math.ceil(h.length / i) + Math.ceil(u.length / i), y = []; for (let x = 0; x < w; x++) { @@ -58855,19 +58901,19 @@ var q0 = class extends BIe { return this.subtle.importKey("raw", t, n, r, o); case "spki": { - const a = hn(br(t)); + const a = pn(br(t)); ke.assert(a, "keyData"); const c = new mi(); try { c.fromSchema(a.result); } catch { - throw new Ut("Incorrect keyData"); + throw new zt("Incorrect keyData"); } switch (i.name.toUpperCase()) { case "RSA-PSS": { if (o = ["verify"], s.kty = "RSA", s.ext = r, s.key_ops = o, !["1.2.840.113549.1.1.1", "1.2.840.113549.1.1.10"].includes(c.algorithm.algorithmId)) throw new Error(`Incorrect public key algorithm: ${c.algorithm.algorithmId}`); - if (!i.hash) throw new Ct("hash", "algorithm.hash", "Incorrect hash algorithm: Hash algorithm is missed"); + if (!i.hash) throw new Ot("hash", "algorithm.hash", "Incorrect hash algorithm: Hash algorithm is missed"); switch (i.hash.name.toUpperCase()) { case "SHA-1": s.alg = "PS1"; @@ -58891,7 +58937,7 @@ var q0 = class extends BIe { case "RSASSA-PKCS1-V1_5": { if (o = ["verify"], s.kty = "RSA", s.ext = r, s.key_ops = o, c.algorithm.algorithmId !== "1.2.840.113549.1.1.1") throw new Error(`Incorrect public key algorithm: ${c.algorithm.algorithmId}`); - if (!i.hash) throw new Ct("hash", "algorithm.hash", "Incorrect hash algorithm: Hash algorithm is missed"); + if (!i.hash) throw new Ot("hash", "algorithm.hash", "Incorrect hash algorithm: Hash algorithm is missed"); switch (i.hash.name.toUpperCase()) { case "SHA-1": s.alg = "RS1"; @@ -58929,7 +58975,7 @@ var q0 = class extends BIe { { if (s.kty = "RSA", s.ext = r, s.key_ops = o, this.name.toLowerCase() === "safari") s.alg = "RSA-OAEP"; else { - if (!i.hash) throw new Ct("hash", "algorithm.hash", "Incorrect hash algorithm: Hash algorithm is missed"); + if (!i.hash) throw new Ot("hash", "algorithm.hash", "Incorrect hash algorithm: Hash algorithm is missed"); switch (i.hash.name.toUpperCase()) { case "SHA-1": s.alg = "RSA-OAEP"; @@ -58965,7 +59011,7 @@ var q0 = class extends BIe { break; case "pkcs8": { - const a = new ix(), c = hn(br(t)); + const a = new ix(), c = pn(br(t)); ke.assert(c, "keyData"); try { a.fromSchema(c.result); @@ -59883,7 +59929,7 @@ var q0 = class extends BIe { return t; } async encryptEncryptedContentInfo(e) { - Ct.assert(e, "password", "contentEncryptionAlgorithm", "hmacHashAlgorithm", "iterationCount", "contentToEncrypt", "contentToEncrypt", "contentType"); + Ot.assert(e, "password", "contentEncryptionAlgorithm", "hmacHashAlgorithm", "iterationCount", "contentToEncrypt", "contentToEncrypt", "contentType"); const t = this.getOIDByAlgorithm(e.contentEncryptionAlgorithm, !0, "contentEncryptionAlgorithm"), n = this.getOIDByAlgorithm({ name: "PBKDF2" }, !0, "PBKDF2"), r = this.getOIDByAlgorithm({ name: "HMAC", hash: { name: e.hmacHashAlgorithm } @@ -59894,31 +59940,31 @@ var q0 = class extends BIe { const c = new Uint8Array(e.contentToEncrypt), l = new a0({ salt: new Oe({ valueHex: i }), iterationCount: e.iterationCount, - prf: new fe({ + prf: new de({ algorithmId: r, - algorithmParams: new fn() + algorithmParams: new hn() }) - }), u = new Uint8Array(e.password), d = await this.importKey("raw", u, "PBKDF2", !1, ["deriveKey"]), f = await this.deriveKey({ + }), u = new Uint8Array(e.password), f = await this.importKey("raw", u, "PBKDF2", !1, ["deriveKey"]), d = await this.deriveKey({ name: "PBKDF2", hash: { name: e.hmacHashAlgorithm }, salt: a, iterations: e.iterationCount - }, d, e.contentEncryptionAlgorithm, !1, ["encrypt"]), h = await this.encrypt({ + }, f, e.contentEncryptionAlgorithm, !1, ["encrypt"]), h = await this.encrypt({ name: e.contentEncryptionAlgorithm.name, iv: s - }, f, c), g = new b4({ - keyDerivationFunc: new fe({ + }, d, c), g = new b4({ + keyDerivationFunc: new de({ algorithmId: n, algorithmParams: l.toSchema() }), - encryptionScheme: new fe({ + encryptionScheme: new de({ algorithmId: t, algorithmParams: new Oe({ valueHex: o }) }) }); return new Ir({ contentType: e.contentType, - contentEncryptionAlgorithm: new fe({ + contentEncryptionAlgorithm: new de({ algorithmId: "1.2.840.113549.1.5.13", algorithmParams: g.toSchema() }), @@ -59926,7 +59972,7 @@ var q0 = class extends BIe { }); } async decryptEncryptedContentInfo(e) { - if (Ct.assert(e, "password", "encryptedContentInfo"), e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId !== "1.2.840.113549.1.5.13") throw new Error(`Unknown "contentEncryptionAlgorithm": ${e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId}`); + if (Ot.assert(e, "password", "encryptedContentInfo"), e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId !== "1.2.840.113549.1.5.13") throw new Error(`Unknown "contentEncryptionAlgorithm": ${e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId}`); let t; try { t = new b4({ schema: e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmParams }); @@ -59942,20 +59988,20 @@ var q0 = class extends BIe { const r = this.getAlgorithmByOID(t.encryptionScheme.algorithmId, !0), o = t.encryptionScheme.algorithmParams.valueBlock.valueHex, s = new Uint8Array(o), i = n.salt.valueBlock.valueHex, a = new Uint8Array(i), c = n.iterationCount; let l = "SHA-1"; n.prf && (l = this.getAlgorithmByOID(n.prf.algorithmId, !0).hash.name); - const u = await this.importKey("raw", e.password, "PBKDF2", !1, ["deriveKey"]), d = await this.deriveKey({ + const u = await this.importKey("raw", e.password, "PBKDF2", !1, ["deriveKey"]), f = await this.deriveKey({ name: "PBKDF2", hash: { name: l }, salt: a, iterations: c - }, u, r, !1, ["decrypt"]), f = e.encryptedContentInfo.getEncryptedContent(); + }, u, r, !1, ["decrypt"]), d = e.encryptedContentInfo.getEncryptedContent(); return this.decrypt({ name: r.name, iv: s - }, d, f); + }, f, d); } async stampDataWithPassword(e) { if (!(e instanceof Object)) throw new Error('Parameters must have type "Object"'); - Ct.assert(e, "password", "hashAlgorithm", "iterationCount", "salt", "contentToStamp"); + Ot.assert(e, "password", "hashAlgorithm", "iterationCount", "salt", "contentToStamp"); let t; switch (e.hashAlgorithm.toLowerCase()) { case "sha-1": @@ -59981,7 +60027,7 @@ var q0 = class extends BIe { return this.sign(n, o, new Uint8Array(e.contentToStamp)); } async verifyDataStampedWithPassword(e) { - Ct.assert(e, "password", "hashAlgorithm", "salt", "iterationCount", "contentToVerify", "signatureToVerify"); + Ot.assert(e, "password", "hashAlgorithm", "salt", "iterationCount", "contentToVerify", "signatureToVerify"); let t = 0; switch (e.hashAlgorithm.toLowerCase()) { case "sha-1": @@ -60008,7 +60054,7 @@ var q0 = class extends BIe { } async getSignatureParameters(e, t = "SHA-1") { this.getOIDByAlgorithm({ name: t }, !0, "hashAlgorithm"); - const n = new fe(), r = this.getAlgorithmParameters(e.algorithm.name, "sign"); + const n = new de(), r = this.getAlgorithmParameters(e.algorithm.name, "sign"); if (!Object.keys(r.algorithm).length) throw new Error("Parameter 'algorithm' is empty"); const o = r.algorithm; switch ("hash" in e.algorithm && e.algorithm.hash && e.algorithm.hash.name ? o.hash.name = e.algorithm.hash.name : o.hash.name = t, e.algorithm.name.toUpperCase()) { @@ -60029,10 +60075,10 @@ var q0 = class extends BIe { o.saltLength = 64; } const s = {}; - o.hash.name.toUpperCase() !== "SHA-1" && (s.hashAlgorithm = new fe({ + o.hash.name.toUpperCase() !== "SHA-1" && (s.hashAlgorithm = new de({ algorithmId: this.getOIDByAlgorithm({ name: o.hash.name }, !0, "hashAlgorithm"), - algorithmParams: new fn() - }), s.maskGenAlgorithm = new fe({ + algorithmParams: new hn() + }), s.maskGenAlgorithm = new de({ algorithmId: "1.2.840.113549.1.1.8", algorithmParams: s.hashAlgorithm.toSchema() })), o.saltLength !== 20 && (s.saltLength = o.saltLength); @@ -60082,10 +60128,10 @@ var q0 = class extends BIe { r.algorithmId === "1.2.840.113549.1.1.10" ? l = r.algorithmId : l = n.algorithm.algorithmId; const u = this.getAlgorithmByOID(l, !0); if (c.algorithm = this.getAlgorithmParameters(u.name, "importKey"), "hash" in c.algorithm.algorithm && (c.algorithm.algorithm.hash.name = o), u.name === "ECDSA") { - let d = !1; - if ("algorithmParams" in n.algorithm && "idBlock" in n.algorithm.algorithmParams && n.algorithm.algorithmParams.idBlock.tagClass === 1 && n.algorithm.algorithmParams.idBlock.tagNumber === 6 && (d = !0), d === !1) throw new Error("Incorrect type for ECDSA public key parameters"); - const f = this.getAlgorithmByOID(n.algorithm.algorithmParams.valueBlock.toString(), !0); - c.algorithm.algorithm.namedCurve = f.name; + let f = !1; + if ("algorithmParams" in n.algorithm && "idBlock" in n.algorithm.algorithmParams && n.algorithm.algorithmParams.idBlock.tagClass === 1 && n.algorithm.algorithmParams.idBlock.tagNumber === 6 && (f = !0), f === !1) throw new Error("Incorrect type for ECDSA public key parameters"); + const d = this.getAlgorithmByOID(n.algorithm.algorithmParams.valueBlock.toString(), !0); + c.algorithm.algorithm.namedCurve = d.name; } s = await this.getPublicKey(n, null, c); } else { @@ -60096,9 +60142,9 @@ var q0 = class extends BIe { "hash" in i.algorithm && (i.algorithm.hash.name = o); let a = t.valueBlock.valueHexView; if (s.algorithm.name === "ECDSA") { - const c = Sg.find(s.algorithm.namedCurve); + const c = xg.find(s.algorithm.namedCurve); if (!c) throw new Error("Unsupported named curve in use"); - const l = hn(a); + const l = pn(a); ke.assert(l, "Signature value"), a = DIe(l.result, c.size); } if (s.algorithm.name === "RSA-PSS") { @@ -60165,11 +60211,11 @@ function Ye(e = !1) { } function LIe(e) { if (e.byteLength % 2 !== 0) return Dn; - const t = e.byteLength / 2, n = new de({ valueHex: A4(new Uint8Array(e, 0, t)) }), r = new de({ valueHex: A4(new Uint8Array(e, t, t)) }); + const t = e.byteLength / 2, n = new ue({ valueHex: A4(new Uint8Array(e, 0, t)) }), r = new ue({ valueHex: A4(new Uint8Array(e, t, t)) }); return new z({ value: [n, r] }).toBER(!1); } function DIe(e, t) { - if (!(e instanceof z && e.valueBlock.value.length === 2 && e.valueBlock.value[0] instanceof de && e.valueBlock.value[1] instanceof de)) return Dn; + if (!(e instanceof z && e.valueBlock.value.length === 2 && e.valueBlock.value[0] instanceof ue && e.valueBlock.value[1] instanceof ue)) return Dn; const n = e.valueBlock.value[0].convertFromDER().valueBlock.valueHexView, r = e.valueBlock.value[1].convertFromDER().valueBlock.valueHexView, o = new Uint8Array(t * 2); return o.set(n, t - n.byteLength), o.set(r, 2 * t - r.byteLength), o.buffer; } @@ -60181,13 +60227,13 @@ async function jIe(e, t, n, r, o) { case "SHA-512": break; default: - throw new Ut(`Unknown hash function: ${e}`); + throw new zt(`Unknown hash function: ${e}`); } - if (Ut.assert(t, "zBuffer", "ArrayBuffer"), t.byteLength === 0) throw new Ut("'zBuffer' has zero length, error"); - if (Ut.assert(r, "SharedInfo", "ArrayBuffer"), n > 255) throw new Ut("Please set 'Counter' argument to value less or equal to 255"); + if (zt.assert(t, "zBuffer", "ArrayBuffer"), t.byteLength === 0) throw new zt("'zBuffer' has zero length, error"); + if (zt.assert(r, "SharedInfo", "ArrayBuffer"), n > 255) throw new zt("Please set 'Counter' argument to value less or equal to 255"); const s = /* @__PURE__ */ new ArrayBuffer(4), i = new Uint8Array(s); i[0] = 0, i[1] = 0, i[2] = 0, i[3] = n; - const a = Kt.concat(t, s, r); + const a = Wt.concat(t, s, r); return { counter: n, result: await o.digest({ name: e }, a) @@ -60209,18 +60255,18 @@ async function k4(e, t, n, r, o = Ye(!0)) { s = 512; break; default: - throw new Ut(`Unknown hash function: ${e}`); + throw new zt(`Unknown hash function: ${e}`); } - if (Ut.assert(t, "Zbuffer", "ArrayBuffer"), t.byteLength === 0) throw new Ut("'Zbuffer' has zero length, error"); - Ut.assert(r, "SharedInfo", "ArrayBuffer"); + if (zt.assert(t, "Zbuffer", "ArrayBuffer"), t.byteLength === 0) throw new zt("'Zbuffer' has zero length, error"); + zt.assert(r, "SharedInfo", "ArrayBuffer"); const a = n / s; Math.floor(a) > 0 && (i = Math.floor(a), a - i > 0 && i++); const c = []; for (let u = 1; u <= i; u++) c.push(await jIe(e, t, u, r, o)); - const l = Kt.concat(c.map((u) => u.result)); + const l = Wt.concat(c.map((u) => u.result)); if (n >>= 3, l.byteLength > n) { - const u = new ArrayBuffer(n), d = new Uint8Array(u), f = new Uint8Array(l); - for (let h = 0; h < n; h++) d[h] = f[h]; + const u = new ArrayBuffer(n), f = new Uint8Array(u), d = new Uint8Array(l); + for (let h = 0; h < n; h++) f[h] = d[h]; return u; } return l; @@ -60236,7 +60282,7 @@ function A4(e) { return n.slice(); } const qC = "type", GC = "value", TO = "utcTimeName", MO = "generalTimeName", FIe = [TO, MO]; -var Aa, or = (Aa = class extends Ce { +var Aa, sr = (Aa = class extends Ce { constructor(t = {}) { super(), this.type = t[qC] ?? Aa.defaultValues(qC), this.value = t[GC] ?? Aa.defaultValues(GC), t.schema && this.fromSchema(t.schema); } @@ -60252,9 +60298,9 @@ var Aa, or = (Aa = class extends Ce { } static schema(t = {}, n = !1) { const r = t.names ?? {}; - return new Xt({ + return new en({ optional: n, - value: [new W0({ name: r.utcTimeName || "" }), new Yt({ name: r.generalTimeName || "" })] + value: [new W0({ name: r.utcTimeName || "" }), new Xt({ name: r.generalTimeName || "" })] }); } fromSchema(t) { @@ -60266,7 +60312,7 @@ var Aa, or = (Aa = class extends Ce { ke.assertSchema(n, this.className), TO in n.result && (this.type = 0, this.value = n.result.utcTimeName.toDate()), MO in n.result && (this.type = 1, this.value = n.result.generalTimeName.toDate()); } toSchema() { - return this.type === 0 ? new W0({ valueDate: this.value }) : this.type === 1 ? new Yt({ valueDate: this.value }) : {}; + return this.type === 0 ? new W0({ valueDate: this.value }) : this.type === 1 ? new Xt({ valueDate: this.value }) : {}; } toJSON() { return { @@ -60275,8 +60321,8 @@ var Aa, or = (Aa = class extends Ce { }; } }, Aa.CLASS_NAME = "Time", Aa); -const JC = "tbs", _c = "version", uA = "serialNumber", dA = "signature", fA = "issuer", hA = "notBefore", pA = "notAfter", gA = "subject", mA = "subjectPublicKeyInfo", Pb = "issuerUniqueID", Rb = "subjectUniqueID", Tb = "extensions", Mb = "signatureAlgorithm", Bb = "signatureValue", ko = "tbsCertificate", ax = `${ko}.${_c}`, cT = `${ko}.${uA}`, lT = `${ko}.${dA}`, uT = `${ko}.${fA}`, cx = `${ko}.${hA}`, lx = `${ko}.${pA}`, dT = `${ko}.${gA}`, fT = `${ko}.${mA}`, ux = `${ko}.${Pb}`, dx = `${ko}.${Rb}`, c0 = `${ko}.${Tb}`, VIe = [ - ko, +const JC = "tbs", Lc = "version", uA = "serialNumber", dA = "signature", fA = "issuer", hA = "notBefore", pA = "notAfter", gA = "subject", mA = "subjectPublicKeyInfo", Pb = "issuerUniqueID", Rb = "subjectUniqueID", Tb = "extensions", Mb = "signatureAlgorithm", Bb = "signatureValue", Ao = "tbsCertificate", ax = `${Ao}.${Lc}`, cT = `${Ao}.${uA}`, lT = `${Ao}.${dA}`, uT = `${Ao}.${fA}`, cx = `${Ao}.${hA}`, lx = `${Ao}.${pA}`, dT = `${Ao}.${gA}`, fT = `${Ao}.${mA}`, ux = `${Ao}.${Pb}`, dx = `${Ao}.${Rb}`, c0 = `${Ao}.${Tb}`, VIe = [ + Ao, ax, cT, lT, @@ -60294,30 +60340,30 @@ const JC = "tbs", _c = "version", uA = "serialNumber", dA = "signature", fA = "i function $Ie(e = {}) { const t = e.names ?? {}; return new z({ - name: t.blockName || ko, + name: t.blockName || Ao, value: [ - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new de({ name: t.tbsCertificateVersion || ax })] + value: [new ue({ name: t.tbsCertificateVersion || ax })] }), - new de({ name: t.tbsCertificateSerialNumber || cT }), - fe.schema(t.signature || { names: { blockName: lT } }), - Qt.schema(t.issuer || { names: { blockName: uT } }), + new ue({ name: t.tbsCertificateSerialNumber || cT }), + de.schema(t.signature || { names: { blockName: lT } }), + Zt.schema(t.issuer || { names: { blockName: uT } }), new z({ name: t.tbsCertificateValidity || "tbsCertificate.validity", - value: [or.schema(t.notBefore || { names: { + value: [sr.schema(t.notBefore || { names: { utcTimeName: cx, generalTimeName: cx - } }), or.schema(t.notAfter || { names: { + } }), sr.schema(t.notAfter || { names: { utcTimeName: lx, generalTimeName: lx } })] }), - Qt.schema(t.subject || { names: { blockName: dT } }), + Zt.schema(t.subject || { names: { blockName: dT } }), mi.schema(t.subjectPublicKeyInfo || { names: { blockName: fT } }), new Je({ name: t.tbsCertificateIssuerUniqueID || ux, @@ -60335,7 +60381,7 @@ function $Ie(e = {}) { tagNumber: 2 } }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, @@ -60346,7 +60392,7 @@ function $Ie(e = {}) { ] }); } -var rn, Mr = (rn = class extends Ce { +var on, Mr = (on = class extends Ce { get tbs() { return br(this.tbsView); } @@ -60354,26 +60400,26 @@ var rn, Mr = (rn = class extends Ce { this.tbsView = new Uint8Array(t); } constructor(t = {}) { - super(), this.tbsView = new Uint8Array(t[JC] ?? rn.defaultValues(JC)), this.version = t[_c] ?? rn.defaultValues(_c), this.serialNumber = t[uA] ?? rn.defaultValues(uA), this.signature = t[dA] ?? rn.defaultValues(dA), this.issuer = t[fA] ?? rn.defaultValues(fA), this.notBefore = t[hA] ?? rn.defaultValues(hA), this.notAfter = t[pA] ?? rn.defaultValues(pA), this.subject = t[gA] ?? rn.defaultValues(gA), this.subjectPublicKeyInfo = t[mA] ?? rn.defaultValues(mA), Pb in t && (this.issuerUniqueID = t[Pb] ?? rn.defaultValues(Pb)), Rb in t && (this.subjectUniqueID = t[Rb] ?? rn.defaultValues(Rb)), Tb in t && (this.extensions = t[Tb] ?? rn.defaultValues(Tb)), this.signatureAlgorithm = t[Mb] ?? rn.defaultValues(Mb), this.signatureValue = t[Bb] ?? rn.defaultValues(Bb), t.schema && this.fromSchema(t.schema); + super(), this.tbsView = new Uint8Array(t[JC] ?? on.defaultValues(JC)), this.version = t[Lc] ?? on.defaultValues(Lc), this.serialNumber = t[uA] ?? on.defaultValues(uA), this.signature = t[dA] ?? on.defaultValues(dA), this.issuer = t[fA] ?? on.defaultValues(fA), this.notBefore = t[hA] ?? on.defaultValues(hA), this.notAfter = t[pA] ?? on.defaultValues(pA), this.subject = t[gA] ?? on.defaultValues(gA), this.subjectPublicKeyInfo = t[mA] ?? on.defaultValues(mA), Pb in t && (this.issuerUniqueID = t[Pb] ?? on.defaultValues(Pb)), Rb in t && (this.subjectUniqueID = t[Rb] ?? on.defaultValues(Rb)), Tb in t && (this.extensions = t[Tb] ?? on.defaultValues(Tb)), this.signatureAlgorithm = t[Mb] ?? on.defaultValues(Mb), this.signatureValue = t[Bb] ?? on.defaultValues(Bb), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case JC: return Dn; - case _c: + case Lc: return 0; case uA: - return new de(); + return new ue(); case dA: - return new fe(); + return new de(); case fA: - return new Qt(); + return new Zt(); case hA: - return new or(); + return new sr(); case pA: - return new or(); + return new sr(); case gA: - return new Qt(); + return new Zt(); case mA: return new mi(); case Pb: @@ -60383,9 +60429,9 @@ var rn, Mr = (rn = class extends Ce { case Tb: return []; case Mb: - return new fe(); + return new de(); case Bb: - return new ht(); + return new pt(); default: return super.defaultValues(t); } @@ -60396,25 +60442,25 @@ var rn, Mr = (rn = class extends Ce { name: n.blockName || "", value: [ $Ie(n.tbsCertificate), - fe.schema(n.signatureAlgorithm || { names: { blockName: Mb } }), - new ht({ name: n.signatureValue || Bb }) + de.schema(n.signatureAlgorithm || { names: { blockName: Mb } }), + new pt({ name: n.signatureValue || Bb }) ] }); } fromSchema(t) { for (const r of VIe) delete t[r]; - const n = Ee(t, t, rn.schema({ names: { tbsCertificate: { names: { extensions: { names: { extensions: c0 } } } } } })); - ke.assertSchema(n, this.className), this.tbsView = n.result.tbsCertificate.valueBeforeDecodeView, ax in n.result && (this.version = n.result[ax].valueBlock.valueDec), this.serialNumber = n.result[cT], this.signature = new fe({ schema: n.result[lT] }), this.issuer = new Qt({ schema: n.result[uT] }), this.notBefore = new or({ schema: n.result[cx] }), this.notAfter = new or({ schema: n.result[lx] }), this.subject = new Qt({ schema: n.result[dT] }), this.subjectPublicKeyInfo = new mi({ schema: n.result[fT] }), ux in n.result && (this.issuerUniqueID = n.result[ux].valueBlock.valueHex), dx in n.result && (this.subjectUniqueID = n.result[dx].valueBlock.valueHex), c0 in n.result && (this.extensions = Array.from(n.result[c0], (r) => new Bn({ schema: r }))), this.signatureAlgorithm = new fe({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; + const n = Ee(t, t, on.schema({ names: { tbsCertificate: { names: { extensions: { names: { extensions: c0 } } } } } })); + ke.assertSchema(n, this.className), this.tbsView = n.result.tbsCertificate.valueBeforeDecodeView, ax in n.result && (this.version = n.result[ax].valueBlock.valueDec), this.serialNumber = n.result[cT], this.signature = new de({ schema: n.result[lT] }), this.issuer = new Zt({ schema: n.result[uT] }), this.notBefore = new sr({ schema: n.result[cx] }), this.notAfter = new sr({ schema: n.result[lx] }), this.subject = new Zt({ schema: n.result[dT] }), this.subjectPublicKeyInfo = new mi({ schema: n.result[fT] }), ux in n.result && (this.issuerUniqueID = n.result[ux].valueBlock.valueHex), dx in n.result && (this.subjectUniqueID = n.result[dx].valueBlock.valueHex), c0 in n.result && (this.extensions = Array.from(n.result[c0], (r) => new Bn({ schema: r }))), this.signatureAlgorithm = new de({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; } encodeTBS() { const t = []; - return _c in this && this.version !== rn.defaultValues(_c) && t.push(new ee({ + return Lc in this && this.version !== on.defaultValues(Lc) && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new de({ value: this.version })] + value: [new ue({ value: this.version })] })), t.push(this.serialNumber), t.push(this.signature.toSchema()), t.push(this.issuer.toSchema()), t.push(new z({ value: [this.notBefore.toSchema(), this.notAfter.toSchema()] })), t.push(this.subject.toSchema()), t.push(this.subjectPublicKeyInfo.toSchema()), this.issuerUniqueID && t.push(new Je({ optional: !0, idBlock: { @@ -60429,7 +60475,7 @@ var rn, Mr = (rn = class extends Ce { tagNumber: 2 }, valueHex: this.subjectUniqueID - })), this.extensions && t.push(new ee({ + })), this.extensions && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -60441,8 +60487,8 @@ var rn, Mr = (rn = class extends Ce { toSchema(t = !1) { let n; if (t === !1) { - if (!this.tbsView.byteLength) return rn.schema().value[0]; - const r = hn(this.tbsView); + if (!this.tbsView.byteLength) return on.schema().value[0]; + const r = pn(this.tbsView); ke.assert(r, "TBS Certificate"), n = r.result; } else n = this.encodeTBS(); return new z({ value: [ @@ -60453,7 +60499,7 @@ var rn, Mr = (rn = class extends Ce { } toJSON() { const t = { - tbs: Xn.encode(this.tbsView), + tbs: Zn.encode(this.tbsView), version: this.version, serialNumber: this.serialNumber.toJSON(), signature: this.signature.toJSON(), @@ -60465,7 +60511,7 @@ var rn, Mr = (rn = class extends Ce { signatureAlgorithm: this.signatureAlgorithm.toJSON(), signatureValue: this.signatureValue.toJSON() }; - return _c in this && this.version !== rn.defaultValues(_c) && (t.version = this.version), this.issuerUniqueID && (t.issuerUniqueID = Xn.encode(this.issuerUniqueID)), this.subjectUniqueID && (t.subjectUniqueID = Xn.encode(this.subjectUniqueID)), this.extensions && (t.extensions = Array.from(this.extensions, (n) => n.toJSON())), t; + return Lc in this && this.version !== on.defaultValues(Lc) && (t.version = this.version), this.issuerUniqueID && (t.issuerUniqueID = Zn.encode(this.issuerUniqueID)), this.subjectUniqueID && (t.subjectUniqueID = Zn.encode(this.subjectUniqueID)), this.extensions && (t.extensions = Array.from(this.extensions, (n) => n.toJSON())), t; } async getPublicKey(t, n = Ye(!0)) { return n.getPublicKey(this.subjectPublicKeyInfo, this.signatureAlgorithm, t); @@ -60478,14 +60524,14 @@ var rn, Mr = (rn = class extends Ce { const o = await r.getSignatureParameters(t, n), s = o.parameters; this.signature = o.signatureAlgorithm, this.signatureAlgorithm = o.signatureAlgorithm, this.tbsView = new Uint8Array(this.encodeTBS().toBER()); const i = await r.signWithPrivateKey(this.tbsView, t, s); - this.signatureValue = new ht({ valueHex: i }); + this.signatureValue = new pt({ valueHex: i }); } async verify(t, n = Ye(!0)) { let r; if (t ? r = t.subjectPublicKeyInfo : this.issuer.isEqual(this.subject) && (r = this.subjectPublicKeyInfo), !(r instanceof mi)) throw new Error("Please provide issuer certificate as a parameter"); return n.verifyWithPublicKey(this.tbsView, this.signatureValue, r, this.signatureAlgorithm); } -}, rn.CLASS_NAME = "Certificate", rn); +}, on.CLASS_NAME = "Certificate", on); function Sq(e, t = null) { if (t && e.issuer.isEqual(t.issuer) && e.serialNumber.isEqual(t.serialNumber)) return null; let n = !1; @@ -60498,9 +60544,9 @@ function Sq(e, t = null) { return n ? e : null; } const YC = "version", QC = "logID", XC = "extensions", ZC = "timestamp", eI = "hashAlgorithm", tI = "signatureAlgorithm", nI = "signature", S4 = "none", x4 = "md5", E4 = "sha1", C4 = "sha224", I4 = "sha256", N4 = "sha384", O4 = "sha512", P4 = "anonymous", R4 = "rsa", T4 = "dsa", M4 = "ecdsa"; -var no, UIe = (no = class extends Ce { +var ro, UIe = (ro = class extends Ce { constructor(t = {}) { - super(), this.version = t[YC] ?? no.defaultValues(YC), this.logID = t[QC] ?? no.defaultValues(QC), this.timestamp = t[ZC] ?? no.defaultValues(ZC), this.extensions = t[XC] ?? no.defaultValues(XC), this.hashAlgorithm = t[eI] ?? no.defaultValues(eI), this.signatureAlgorithm = t[tI] ?? no.defaultValues(tI), this.signature = t[nI] ?? no.defaultValues(nI), "stream" in t && t.stream && this.fromStream(t.stream), t.schema && this.fromSchema(t.schema); + super(), this.version = t[YC] ?? ro.defaultValues(YC), this.logID = t[QC] ?? ro.defaultValues(QC), this.timestamp = t[ZC] ?? ro.defaultValues(ZC), this.extensions = t[XC] ?? ro.defaultValues(XC), this.hashAlgorithm = t[eI] ?? ro.defaultValues(eI), this.signatureAlgorithm = t[tI] ?? ro.defaultValues(tI), this.signature = t[nI] ?? ro.defaultValues(nI), "stream" in t && t.stream && this.fromStream(t.stream), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -60522,13 +60568,13 @@ var no, UIe = (no = class extends Ce { } fromSchema(t) { if (!(t instanceof rx)) throw new Error("Object's schema was not verified against input data for SignedCertificateTimestamp"); - const n = new i0({ stream: new Co({ buffer: t.data }) }); + const n = new i0({ stream: new Io({ buffer: t.data }) }); this.fromStream(n); } fromStream(t) { const n = t.getUint16(); if (this.version = t.getBlock(1)[0], this.version === 0) { - this.logID = new Uint8Array(t.getBlock(32)).buffer.slice(0), this.timestamp = new Date(Number(Cl.decodeBigInt(t.getBlock(8)))); + this.logID = new Uint8Array(t.getBlock(32)).buffer.slice(0), this.timestamp = new Date(Number(Il.decodeBigInt(t.getBlock(8)))); const r = t.getUint16(); switch (this.extensions = new Uint8Array(t.getBlock(r)).buffer.slice(0), t.getBlock(1)[0]) { case 0: @@ -60581,7 +60627,7 @@ var no, UIe = (no = class extends Ce { } toStream() { const t = new i0(); - t.appendUint16(47 + this.extensions.byteLength + this.signature.byteLength), t.appendChar(this.version), t.appendView(new Uint8Array(this.logID)), t.appendView(Cl.encode(this.timestamp.valueOf(), { length: 8 })), t.appendUint16(this.extensions.byteLength), this.extensions.byteLength && t.appendView(new Uint8Array(this.extensions)); + t.appendUint16(47 + this.extensions.byteLength + this.signature.byteLength), t.appendChar(this.version), t.appendView(new Uint8Array(this.logID)), t.appendView(Il.encode(this.timestamp.valueOf(), { length: 8 })), t.appendUint16(this.extensions.byteLength), this.extensions.byteLength && t.appendView(new Uint8Array(this.extensions)); let n; switch (this.hashAlgorithm.toLowerCase()) { case S4: @@ -60631,12 +60677,12 @@ var no, UIe = (no = class extends Ce { toJSON() { return { version: this.version, - logID: Xn.encode(this.logID, { case: "upper" }), + logID: Zn.encode(this.logID, { case: "upper" }), timestamp: this.timestamp, - extensions: Xn.encode(this.extensions, { case: "upper" }), + extensions: Zn.encode(this.extensions, { case: "upper" }), hashAlgorithm: this.hashAlgorithm, signatureAlgorithm: this.signatureAlgorithm, - signature: Xn.encode(this.signature, { case: "upper" }) + signature: Zn.encode(this.signature, { case: "upper" }) }; } async verify(t, n, r = 0, o = Ye(!0)) { @@ -60649,14 +60695,14 @@ var no, UIe = (no = class extends Ce { } if (!i) throw new Error(`Public key not found for CT with logId: ${s}`); const c = br(vO.decode(i)), l = mi.fromBER(c); - return a.appendChar(0), a.appendChar(0), a.appendView(Cl.encode(this.timestamp.valueOf(), { length: 8 })), a.appendUint16(r), r === 0 && a.appendUint24(n.byteLength), a.appendView(new Uint8Array(n)), a.appendUint16(this.extensions.byteLength), this.extensions.byteLength !== 0 && a.appendView(new Uint8Array(this.extensions)), o.verifyWithPublicKey(a.buffer.slice(0, a.length), new Oe({ valueHex: this.signature }), l, { algorithmId: "" }, "SHA-256"); + return a.appendChar(0), a.appendChar(0), a.appendView(Il.encode(this.timestamp.valueOf(), { length: 8 })), a.appendUint16(r), r === 0 && a.appendUint24(n.byteLength), a.appendView(new Uint8Array(n)), a.appendUint16(this.extensions.byteLength), this.extensions.byteLength !== 0 && a.appendView(new Uint8Array(this.extensions)), o.verifyWithPublicKey(a.buffer.slice(0, a.length), new Oe({ valueHex: this.signature }), l, { algorithmId: "" }, "SHA-256"); } -}, no.CLASS_NAME = "SignedCertificateTimestamp", no); -new Ve({ value: hq }).valueBlock.toBER(!1); +}, ro.CLASS_NAME = "SignedCertificateTimestamp", ro); +new $e({ value: hq }).valueBlock.toBER(!1); const nk = "timestamps"; -var xf, KIe = (xf = class extends Ce { +var Cf, KIe = (Cf = class extends Ce { constructor(t = {}) { - super(), this.timestamps = t[nk] ?? xf.defaultValues(nk), t.schema && this.fromSchema(t.schema); + super(), this.timestamps = t[nk] ?? Cf.defaultValues(nk), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -60683,7 +60729,7 @@ var xf, KIe = (xf = class extends Ce { } fromSchema(t) { if (!(t instanceof Oe)) throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList"); - const n = new i0({ stream: new Co({ buffer: t.valueBlock.valueHex }) }); + const n = new i0({ stream: new Io({ buffer: t.valueBlock.valueHex }) }); if (n.getUint16() !== n.length) throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList"); for (; n.length; ) this.timestamps.push(new UIe({ stream: n })); } @@ -60702,11 +60748,11 @@ var xf, KIe = (xf = class extends Ce { toJSON() { return { timestamps: Array.from(this.timestamps, (t) => t.toJSON()) }; } -}, xf.CLASS_NAME = "SignedCertificateTimestampList", xf); +}, Cf.CLASS_NAME = "SignedCertificateTimestampList", Cf); const _b = "attributes", HIe = [_b]; -var Fl, zIe = (Fl = class extends Ce { +var Vl, zIe = (Vl = class extends Ce { constructor(t = {}) { - super(), this.attributes = t[_b] ?? Fl.defaultValues(_b), t.schema && this.fromSchema(t.schema); + super(), this.attributes = t[_b] ?? Vl.defaultValues(_b), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -60720,7 +60766,7 @@ var Fl, zIe = (Fl = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.attributes || "", value: En.schema() })] @@ -60728,7 +60774,7 @@ var Fl, zIe = (Fl = class extends Ce { } fromSchema(t) { for (const r of HIe) delete t[r]; - const n = Ee(t, t, Fl.schema({ names: { attributes: _b } })); + const n = Ee(t, t, Vl.schema({ names: { attributes: _b } })); ke.assertSchema(n, this.className), this.attributes = Array.from(n.result.attributes, (r) => new En({ schema: r })); } toSchema() { @@ -60737,12 +60783,12 @@ var Fl, zIe = (Fl = class extends Ce { toJSON() { return { attributes: Array.from(this.attributes, (t) => t.toJSON()) }; } -}, Fl.CLASS_NAME = "SubjectDirectoryAttributes", Fl), WIe = class an { +}, Vl.CLASS_NAME = "SubjectDirectoryAttributes", Vl), WIe = class cn { static getItems() { - return this.types || (this.types = {}, an.register(BCe, "SubjectAltName", o4), an.register(cq, "IssuerAltName", o4), an.register(fq, "AuthorityKeyIdentifier", mq), an.register(_Ce, "BasicConstraints", aT), an.register(JCe, "MicrosoftCaVersion", eIe), an.register($Ce, "CertificatePolicies", d4), an.register(KCe, "CertificatePoliciesMicrosoft", d4), an.register(GCe, "MicrosoftCertTemplateV2", sIe), an.register(dq, "CRLDistributionPoints", OO), an.register(oT, "FreshestCRL", OO), an.register(WCe, "ExtKeyUsage", sx), an.register(uq, "CertificateIssuer", hr), an.register(sT, "AuthorityInfoAccess", PO), an.register(qCe, "SubjectInfoAccess", PO), an.register(lq, "IssuingDistributionPoint", uIe), an.register(VCe, "NameConstraints", hIe), an.register(zCe, "PolicyConstraints", gIe), an.register(HCe, "PolicyMappings", bIe), an.register(MCe, "PrivateKeyUsagePeriod", vIe), an.register(YCe, "QCStatements", SIe), an.register(hq, "SignedCertificateTimestampList", KIe), an.register(TCe, "SubjectDirectoryAttributes", zIe)), this.types; + return this.types || (this.types = {}, cn.register(BCe, "SubjectAltName", o4), cn.register(cq, "IssuerAltName", o4), cn.register(fq, "AuthorityKeyIdentifier", mq), cn.register(_Ce, "BasicConstraints", aT), cn.register(JCe, "MicrosoftCaVersion", eIe), cn.register($Ce, "CertificatePolicies", d4), cn.register(KCe, "CertificatePoliciesMicrosoft", d4), cn.register(GCe, "MicrosoftCertTemplateV2", sIe), cn.register(dq, "CRLDistributionPoints", OO), cn.register(oT, "FreshestCRL", OO), cn.register(WCe, "ExtKeyUsage", sx), cn.register(uq, "CertificateIssuer", pr), cn.register(sT, "AuthorityInfoAccess", PO), cn.register(qCe, "SubjectInfoAccess", PO), cn.register(lq, "IssuingDistributionPoint", uIe), cn.register(VCe, "NameConstraints", hIe), cn.register(zCe, "PolicyConstraints", gIe), cn.register(HCe, "PolicyMappings", bIe), cn.register(MCe, "PrivateKeyUsagePeriod", vIe), cn.register(YCe, "QCStatements", SIe), cn.register(hq, "SignedCertificateTimestampList", KIe), cn.register(TCe, "SubjectDirectoryAttributes", zIe)), this.types; } static fromBER(t, n) { - const r = hn(n); + const r = pn(n); if (r.offset === -1) return null; const o = this.find(t); if (o) try { @@ -60763,12 +60809,12 @@ var Fl, zIe = (Fl = class extends Ce { }; } }; -const Lb = "extnID", Lc = "critical", Db = "extnValue", rk = "parsedValue", qIe = [ +const Lb = "extnID", Dc = "critical", Db = "extnValue", rk = "parsedValue", qIe = [ Lb, - Lc, + Dc, Db ]; -var ro, Bn = (ro = class extends Ce { +var oo, Bn = (oo = class extends Ce { get parsedValue() { if (this._parsedValue === void 0) { const t = WIe.fromBER(this.extnID, this.extnValue.valueBlock.valueHexView); @@ -60780,13 +60826,13 @@ var ro, Bn = (ro = class extends Ce { this._parsedValue = t; } constructor(t = {}) { - super(), this.extnID = t[Lb] ?? ro.defaultValues(Lb), this.critical = t[Lc] ?? ro.defaultValues(Lc), Db in t ? this.extnValue = new Oe({ valueHex: t.extnValue }) : this.extnValue = ro.defaultValues(Db), rk in t && (this.parsedValue = t[rk] ?? ro.defaultValues(rk)), t.schema && this.fromSchema(t.schema); + super(), this.extnID = t[Lb] ?? oo.defaultValues(Lb), this.critical = t[Dc] ?? oo.defaultValues(Dc), Db in t ? this.extnValue = new Oe({ valueHex: t.extnValue }) : this.extnValue = oo.defaultValues(Db), rk in t && (this.parsedValue = t[rk] ?? oo.defaultValues(rk)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case Lb: return ""; - case Lc: + case Dc: return !1; case Db: return new Oe(); @@ -60801,8 +60847,8 @@ var ro, Bn = (ro = class extends Ce { return new z({ name: n.blockName || "", value: [ - new Ve({ name: n.extnID || "" }), - new Ql({ + new $e({ name: n.extnID || "" }), + new Xl({ name: n.critical || "", optional: !0 }), @@ -60812,29 +60858,29 @@ var ro, Bn = (ro = class extends Ce { } fromSchema(t) { for (const r of qIe) delete t[r]; - const n = Ee(t, t, ro.schema({ names: { + const n = Ee(t, t, oo.schema({ names: { extnID: Lb, - critical: Lc, + critical: Dc, extnValue: Db } })); - ke.assertSchema(n, this.className), this.extnID = n.result.extnID.valueBlock.toString(), Lc in n.result && (this.critical = n.result.critical.valueBlock.value), this.extnValue = n.result.extnValue; + ke.assertSchema(n, this.className), this.extnID = n.result.extnID.valueBlock.toString(), Dc in n.result && (this.critical = n.result.critical.valueBlock.value), this.extnValue = n.result.extnValue; } toSchema() { const t = []; - return t.push(new Ve({ value: this.extnID })), this.critical !== ro.defaultValues(Lc) && t.push(new Ql({ value: this.critical })), t.push(this.extnValue), new z({ value: t }); + return t.push(new $e({ value: this.extnID })), this.critical !== oo.defaultValues(Dc) && t.push(new Xl({ value: this.critical })), t.push(this.extnValue), new z({ value: t }); } toJSON() { const t = { extnID: this.extnID, extnValue: this.extnValue.toJSON() }; - return this.critical !== ro.defaultValues(Lc) && (t.critical = this.critical), this.parsedValue && this.parsedValue.toJSON && (t.parsedValue = this.parsedValue.toJSON()), t; + return this.critical !== oo.defaultValues(Dc) && (t.critical = this.critical), this.parsedValue && this.parsedValue.toJSON && (t.parsedValue = this.parsedValue.toJSON()), t; } -}, ro.CLASS_NAME = "Extension", ro); +}, oo.CLASS_NAME = "Extension", oo); const jb = "extensions", GIe = [jb]; -var Vl, jn = (Vl = class extends Ce { +var $l, jn = ($l = class extends Ce { constructor(t = {}) { - super(), this.extensions = t[jb] ?? Vl.defaultValues(jb), t.schema && this.fromSchema(t.schema); + super(), this.extensions = t[jb] ?? $l.defaultValues(jb), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -60849,7 +60895,7 @@ var Vl, jn = (Vl = class extends Ce { return new z({ optional: n, name: r.blockName || "", - value: [new ot({ + value: [new st({ name: r.extensions || "", value: Bn.schema(r.extension || {}) })] @@ -60857,7 +60903,7 @@ var Vl, jn = (Vl = class extends Ce { } fromSchema(t) { for (const r of GIe) delete t[r]; - const n = Ee(t, t, Vl.schema({ names: { extensions: jb } })); + const n = Ee(t, t, $l.schema({ names: { extensions: jb } })); ke.assertSchema(n, this.className), this.extensions = Array.from(n.result.extensions, (r) => new Bn({ schema: r })); } toSchema() { @@ -60866,24 +60912,24 @@ var Vl, jn = (Vl = class extends Ce { toJSON() { return { extensions: this.extensions.map((t) => t.toJSON()) }; } -}, Vl.CLASS_NAME = "Extensions", Vl); -const Fb = "issuer", Vb = "serialNumber", ju = "issuerUID", JIe = [ +}, $l.CLASS_NAME = "Extensions", $l); +const Fb = "issuer", Vb = "serialNumber", Fu = "issuerUID", JIe = [ Fb, Vb, - ju + Fu ]; var Ks, Ka = (Ks = class extends Ce { constructor(t = {}) { - super(), this.issuer = t[Fb] ?? Ks.defaultValues(Fb), this.serialNumber = t[Vb] ?? Ks.defaultValues(Vb), ju in t && (this.issuerUID = t[ju] ?? Ks.defaultValues(ju)), t.schema && this.fromSchema(t.schema); + super(), this.issuer = t[Fb] ?? Ks.defaultValues(Fb), this.serialNumber = t[Vb] ?? Ks.defaultValues(Vb), Fu in t && (this.issuerUID = t[Fu] ?? Ks.defaultValues(Fu)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case Fb: - return new hr(); + return new pr(); case Vb: - return new de(); - case ju: - return new ht(); + return new ue(); + case Fu: + return new pt(); default: return super.defaultValues(t); } @@ -60893,9 +60939,9 @@ var Ks, Ka = (Ks = class extends Ce { return new z({ name: n.blockName || "", value: [ - hr.schema(n.issuer || {}), - new de({ name: n.serialNumber || "" }), - new ht({ + pr.schema(n.issuer || {}), + new ue({ name: n.serialNumber || "" }), + new pt({ optional: !0, name: n.issuerUID || "" }) @@ -60907,9 +60953,9 @@ var Ks, Ka = (Ks = class extends Ce { const n = Ee(t, t, Ks.schema({ names: { issuer: { names: { blockName: Fb } }, serialNumber: Vb, - issuerUID: ju + issuerUID: Fu } })); - ke.assertSchema(n, this.className), this.issuer = new hr({ schema: n.result.issuer }), this.serialNumber = n.result.serialNumber, ju in n.result && (this.issuerUID = n.result.issuerUID); + ke.assertSchema(n, this.className), this.issuer = new pr({ schema: n.result.issuer }), this.serialNumber = n.result.serialNumber, Fu in n.result && (this.issuerUID = n.result.issuerUID); } toSchema() { const t = new z({ value: [this.issuer.toSchema(), this.serialNumber] }); @@ -60923,43 +60969,43 @@ var Ks, Ka = (Ks = class extends Ce { return this.issuerUID && (t.issuerUID = this.issuerUID.toJSON()), t; } }, Ks.CLASS_NAME = "IssuerSerial", Ks); -const $b = "version", Fu = "baseCertificateID", Vu = "subjectName", Ub = "issuer", Kb = "signature", Hb = "serialNumber", zb = "attrCertValidityPeriod", Wb = "attributes", $u = "issuerUniqueID", Uu = "extensions", YIe = [ +const $b = "version", Vu = "baseCertificateID", $u = "subjectName", Ub = "issuer", Kb = "signature", Hb = "serialNumber", zb = "attrCertValidityPeriod", Wb = "attributes", Uu = "issuerUniqueID", Ku = "extensions", YIe = [ $b, - Fu, Vu, + $u, Ub, Kb, Hb, zb, Wb, - $u, - Uu + Uu, + Ku ]; -var tr, rI = (tr = class extends Ce { +var nr, rI = (nr = class extends Ce { constructor(t = {}) { - super(), this.version = t[$b] ?? tr.defaultValues($b), Fu in t && (this.baseCertificateID = t[Fu] ?? tr.defaultValues(Fu)), Vu in t && (this.subjectName = t[Vu] ?? tr.defaultValues(Vu)), this.issuer = t[Ub] ?? tr.defaultValues(Ub), this.signature = t[Kb] ?? tr.defaultValues(Kb), this.serialNumber = t[Hb] ?? tr.defaultValues(Hb), this.attrCertValidityPeriod = t[zb] ?? tr.defaultValues(zb), this.attributes = t[Wb] ?? tr.defaultValues(Wb), $u in t && (this.issuerUniqueID = t[$u] ?? tr.defaultValues($u)), Uu in t && (this.extensions = t[Uu] ?? tr.defaultValues(Uu)), t.schema && this.fromSchema(t.schema); + super(), this.version = t[$b] ?? nr.defaultValues($b), Vu in t && (this.baseCertificateID = t[Vu] ?? nr.defaultValues(Vu)), $u in t && (this.subjectName = t[$u] ?? nr.defaultValues($u)), this.issuer = t[Ub] ?? nr.defaultValues(Ub), this.signature = t[Kb] ?? nr.defaultValues(Kb), this.serialNumber = t[Hb] ?? nr.defaultValues(Hb), this.attrCertValidityPeriod = t[zb] ?? nr.defaultValues(zb), this.attributes = t[Wb] ?? nr.defaultValues(Wb), Uu in t && (this.issuerUniqueID = t[Uu] ?? nr.defaultValues(Uu)), Ku in t && (this.extensions = t[Ku] ?? nr.defaultValues(Ku)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case $b: return 0; - case Fu: - return new Ka(); case Vu: - return new hr(); + return new Ka(); + case $u: + return new pr(); case Ub: - return new hr(); + return new pr(); case Kb: - return new fe(); - case Hb: return new de(); + case Hb: + return new ue(); case zb: - return new Ag(); + return new Sg(); case Wb: return []; - case $u: - return new ht(); case Uu: + return new pt(); + case Ku: return new jn(); default: return super.defaultValues(t); @@ -60970,31 +61016,31 @@ var tr, rI = (tr = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), - new Xt({ value: [new ee({ + new ue({ name: n.version || "" }), + new en({ value: [new ne({ name: n.baseCertificateID || "", idBlock: { tagClass: 3, tagNumber: 0 }, value: Ka.schema().valueBlock.value - }), new ee({ + }), new ne({ name: n.subjectName || "", idBlock: { tagClass: 3, tagNumber: 1 }, - value: hr.schema().valueBlock.value + value: pr.schema().valueBlock.value })] }), - hr.schema({ names: { blockName: n.issuer || "" } }), - fe.schema(n.signature || {}), - new de({ name: n.serialNumber || "" }), - Ag.schema(n.attrCertValidityPeriod || {}), + pr.schema({ names: { blockName: n.issuer || "" } }), + de.schema(n.signature || {}), + new ue({ name: n.serialNumber || "" }), + Sg.schema(n.attrCertValidityPeriod || {}), new z({ name: n.attributes || "", - value: [new ot({ value: En.schema() })] + value: [new st({ value: En.schema() })] }), - new ht({ + new pt({ optional: !0, name: n.issuerUniqueID || "" }), @@ -61004,29 +61050,29 @@ var tr, rI = (tr = class extends Ce { } fromSchema(t) { for (const r of YIe) delete t[r]; - const n = Ee(t, t, tr.schema({ names: { + const n = Ee(t, t, nr.schema({ names: { version: $b, - baseCertificateID: Fu, - subjectName: Vu, + baseCertificateID: Vu, + subjectName: $u, issuer: Ub, signature: { names: { blockName: Kb } }, serialNumber: Hb, attrCertValidityPeriod: { names: { blockName: zb } }, attributes: Wb, - issuerUniqueID: $u, - extensions: { names: { blockName: Uu } } + issuerUniqueID: Uu, + extensions: { names: { blockName: Ku } } } })); - ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, Fu in n.result && (this.baseCertificateID = new Ka({ schema: new z({ value: n.result.baseCertificateID.valueBlock.value }) })), Vu in n.result && (this.subjectName = new hr({ schema: new z({ value: n.result.subjectName.valueBlock.value }) })), this.issuer = n.result.issuer, this.signature = new fe({ schema: n.result.signature }), this.serialNumber = n.result.serialNumber, this.attrCertValidityPeriod = new Ag({ schema: n.result.attrCertValidityPeriod }), this.attributes = Array.from(n.result.attributes.valueBlock.value, (r) => new En({ schema: r })), $u in n.result && (this.issuerUniqueID = n.result.issuerUniqueID), Uu in n.result && (this.extensions = new jn({ schema: n.result.extensions })); + ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, Vu in n.result && (this.baseCertificateID = new Ka({ schema: new z({ value: n.result.baseCertificateID.valueBlock.value }) })), $u in n.result && (this.subjectName = new pr({ schema: new z({ value: n.result.subjectName.valueBlock.value }) })), this.issuer = n.result.issuer, this.signature = new de({ schema: n.result.signature }), this.serialNumber = n.result.serialNumber, this.attrCertValidityPeriod = new Sg({ schema: n.result.attrCertValidityPeriod }), this.attributes = Array.from(n.result.attributes.valueBlock.value, (r) => new En({ schema: r })), Uu in n.result && (this.issuerUniqueID = n.result.issuerUniqueID), Ku in n.result && (this.extensions = new jn({ schema: n.result.extensions })); } toSchema() { - const t = new z({ value: [new de({ value: this.version })] }); - return this.baseCertificateID && t.valueBlock.value.push(new ee({ + const t = new z({ value: [new ue({ value: this.version })] }); + return this.baseCertificateID && t.valueBlock.value.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: this.baseCertificateID.toSchema().valueBlock.value - })), this.subjectName && t.valueBlock.value.push(new ee({ + })), this.subjectName && t.valueBlock.value.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 @@ -61038,7 +61084,7 @@ var tr, rI = (tr = class extends Ce { const t = { version: this.version }; return this.baseCertificateID && (t.baseCertificateID = this.baseCertificateID.toJSON()), this.subjectName && (t.subjectName = this.subjectName.toJSON()), t.issuer = this.issuer.toJSON(), t.signature = this.signature.toJSON(), t.serialNumber = this.serialNumber.toJSON(), t.attrCertValidityPeriod = this.attrCertValidityPeriod.toJSON(), t.attributes = Array.from(this.attributes, (n) => n.toJSON()), this.issuerUniqueID && (t.issuerUniqueID = this.issuerUniqueID.toJSON()), this.extensions && (t.extensions = this.extensions.toJSON()), t; } -}, tr.CLASS_NAME = "AttributeCertificateInfoV1", tr); +}, nr.CLASS_NAME = "AttributeCertificateInfoV1", nr); const qb = "acinfo", Gb = "signatureAlgorithm", Jb = "signatureValue", QIe = [ qb, Jb, @@ -61053,9 +61099,9 @@ var Hs, BO = (Hs = class extends Ce { case qb: return new rI(); case Gb: - return new fe(); + return new de(); case Jb: - return new ht(); + return new pt(); default: return super.defaultValues(t); } @@ -61066,8 +61112,8 @@ var Hs, BO = (Hs = class extends Ce { name: n.blockName || "", value: [ rI.schema(n.acinfo || {}), - fe.schema(n.signatureAlgorithm || {}), - new ht({ name: n.signatureValue || "" }) + de.schema(n.signatureAlgorithm || {}), + new pt({ name: n.signatureValue || "" }) ] }); } @@ -61078,7 +61124,7 @@ var Hs, BO = (Hs = class extends Ce { signatureAlgorithm: { names: { blockName: Gb } }, signatureValue: Jb } })); - ke.assertSchema(n, this.className), this.acinfo = new rI({ schema: n.result.acinfo }), this.signatureAlgorithm = new fe({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; + ke.assertSchema(n, this.className), this.acinfo = new rI({ schema: n.result.acinfo }), this.signatureAlgorithm = new de({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; } toSchema() { return new z({ value: [ @@ -61095,26 +61141,26 @@ var Hs, BO = (Hs = class extends Ce { }; } }, Hs.CLASS_NAME = "AttributeCertificateV1", Hs); -const Yb = "digestedObjectType", Ku = "otherObjectTypeID", Qb = "digestAlgorithm", Xb = "objectDigest", XIe = [ +const Yb = "digestedObjectType", Hu = "otherObjectTypeID", Qb = "digestAlgorithm", Xb = "objectDigest", XIe = [ Yb, - Ku, + Hu, Qb, Xb ]; -var cs, xg = (cs = class extends Ce { +var cs, Eg = (cs = class extends Ce { constructor(t = {}) { - super(), this.digestedObjectType = t[Yb] ?? cs.defaultValues(Yb), Ku in t && (this.otherObjectTypeID = t[Ku] ?? cs.defaultValues(Ku)), this.digestAlgorithm = t[Qb] ?? cs.defaultValues(Qb), this.objectDigest = t[Xb] ?? cs.defaultValues(Xb), t.schema && this.fromSchema(t.schema); + super(), this.digestedObjectType = t[Yb] ?? cs.defaultValues(Yb), Hu in t && (this.otherObjectTypeID = t[Hu] ?? cs.defaultValues(Hu)), this.digestAlgorithm = t[Qb] ?? cs.defaultValues(Qb), this.objectDigest = t[Xb] ?? cs.defaultValues(Xb), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case Yb: - return new Df(); - case Ku: - return new Ve(); + return new Ff(); + case Hu: + return new $e(); case Qb: - return new fe(); + return new de(); case Xb: - return new ht(); + return new pt(); default: return super.defaultValues(t); } @@ -61124,13 +61170,13 @@ var cs, xg = (cs = class extends Ce { return new z({ name: n.blockName || "", value: [ - new Df({ name: n.digestedObjectType || "" }), - new Ve({ + new Ff({ name: n.digestedObjectType || "" }), + new $e({ optional: !0, name: n.otherObjectTypeID || "" }), - fe.schema(n.digestAlgorithm || {}), - new ht({ name: n.objectDigest || "" }) + de.schema(n.digestAlgorithm || {}), + new pt({ name: n.objectDigest || "" }) ] }); } @@ -61138,11 +61184,11 @@ var cs, xg = (cs = class extends Ce { for (const r of XIe) delete t[r]; const n = Ee(t, t, cs.schema({ names: { digestedObjectType: Yb, - otherObjectTypeID: Ku, + otherObjectTypeID: Hu, digestAlgorithm: { names: { blockName: Qb } }, objectDigest: Xb } })); - ke.assertSchema(n, this.className), this.digestedObjectType = n.result.digestedObjectType, Ku in n.result && (this.otherObjectTypeID = n.result.otherObjectTypeID), this.digestAlgorithm = new fe({ schema: n.result.digestAlgorithm }), this.objectDigest = n.result.objectDigest; + ke.assertSchema(n, this.className), this.digestedObjectType = n.result.digestedObjectType, Hu in n.result && (this.otherObjectTypeID = n.result.otherObjectTypeID), this.digestAlgorithm = new de({ schema: n.result.digestAlgorithm }), this.objectDigest = n.result.objectDigest; } toSchema() { const t = new z({ value: [this.digestedObjectType] }); @@ -61157,23 +61203,23 @@ var cs, xg = (cs = class extends Ce { return this.otherObjectTypeID && (t.otherObjectTypeID = this.otherObjectTypeID.toJSON()), t; } }, cs.CLASS_NAME = "ObjectDigestInfo", cs); -const Hu = "issuerName", zu = "baseCertificateID", Wu = "objectDigestInfo", ZIe = [ - Hu, +const zu = "issuerName", Wu = "baseCertificateID", qu = "objectDigestInfo", ZIe = [ zu, - Wu + Wu, + qu ]; var zs, B4 = (zs = class extends Ce { constructor(t = {}) { - super(), Hu in t && (this.issuerName = t[Hu] ?? zs.defaultValues(Hu)), zu in t && (this.baseCertificateID = t[zu] ?? zs.defaultValues(zu)), Wu in t && (this.objectDigestInfo = t[Wu] ?? zs.defaultValues(Wu)), t.schema && this.fromSchema(t.schema); + super(), zu in t && (this.issuerName = t[zu] ?? zs.defaultValues(zu)), Wu in t && (this.baseCertificateID = t[Wu] ?? zs.defaultValues(Wu)), qu in t && (this.objectDigestInfo = t[qu] ?? zs.defaultValues(qu)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Hu: - return new hr(); case zu: - return new Ka(); + return new pr(); case Wu: - return new xg(); + return new Ka(); + case qu: + return new Eg(); default: return super.defaultValues(t); } @@ -61183,8 +61229,8 @@ var zs, B4 = (zs = class extends Ce { return new z({ name: n.blockName || "", value: [ - hr.schema({ names: { blockName: n.issuerName } }, !0), - new ee({ + pr.schema({ names: { blockName: n.issuerName } }, !0), + new ne({ optional: !0, name: n.baseCertificateID || "", idBlock: { @@ -61193,14 +61239,14 @@ var zs, B4 = (zs = class extends Ce { }, value: Ka.schema().valueBlock.value }), - new ee({ + new ne({ optional: !0, name: n.objectDigestInfo || "", idBlock: { tagClass: 3, tagNumber: 1 }, - value: xg.schema().valueBlock.value + value: Eg.schema().valueBlock.value }) ] }); @@ -61208,21 +61254,21 @@ var zs, B4 = (zs = class extends Ce { fromSchema(t) { for (const r of ZIe) delete t[r]; const n = Ee(t, t, zs.schema({ names: { - issuerName: Hu, - baseCertificateID: zu, - objectDigestInfo: Wu + issuerName: zu, + baseCertificateID: Wu, + objectDigestInfo: qu } })); - ke.assertSchema(n, this.className), Hu in n.result && (this.issuerName = new hr({ schema: n.result.issuerName })), zu in n.result && (this.baseCertificateID = new Ka({ schema: new z({ value: n.result.baseCertificateID.valueBlock.value }) })), Wu in n.result && (this.objectDigestInfo = new xg({ schema: new z({ value: n.result.objectDigestInfo.valueBlock.value }) })); + ke.assertSchema(n, this.className), zu in n.result && (this.issuerName = new pr({ schema: n.result.issuerName })), Wu in n.result && (this.baseCertificateID = new Ka({ schema: new z({ value: n.result.baseCertificateID.valueBlock.value }) })), qu in n.result && (this.objectDigestInfo = new Eg({ schema: new z({ value: n.result.objectDigestInfo.valueBlock.value }) })); } toSchema() { const t = new z(); - return this.issuerName && t.valueBlock.value.push(this.issuerName.toSchema()), this.baseCertificateID && t.valueBlock.value.push(new ee({ + return this.issuerName && t.valueBlock.value.push(this.issuerName.toSchema()), this.baseCertificateID && t.valueBlock.value.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: this.baseCertificateID.toSchema().valueBlock.value - })), this.objectDigestInfo && t.valueBlock.value.push(new ee({ + })), this.objectDigestInfo && t.valueBlock.value.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 @@ -61235,23 +61281,23 @@ var zs, B4 = (zs = class extends Ce { return this.issuerName && (t.issuerName = this.issuerName.toJSON()), this.baseCertificateID && (t.baseCertificateID = this.baseCertificateID.toJSON()), this.objectDigestInfo && (t.objectDigestInfo = this.objectDigestInfo.toJSON()), t; } }, zs.CLASS_NAME = "V2Form", zs); -const qu = "baseCertificateID", Gu = "entityName", Ju = "objectDigestInfo", eNe = [ - qu, +const Gu = "baseCertificateID", Ju = "entityName", Yu = "objectDigestInfo", eNe = [ Gu, - Ju + Ju, + Yu ]; var Ws, oI = (Ws = class extends Ce { constructor(t = {}) { - super(), qu in t && (this.baseCertificateID = t[qu] ?? Ws.defaultValues(qu)), Gu in t && (this.entityName = t[Gu] ?? Ws.defaultValues(Gu)), Ju in t && (this.objectDigestInfo = t[Ju] ?? Ws.defaultValues(Ju)), t.schema && this.fromSchema(t.schema); + super(), Gu in t && (this.baseCertificateID = t[Gu] ?? Ws.defaultValues(Gu)), Ju in t && (this.entityName = t[Ju] ?? Ws.defaultValues(Ju)), Yu in t && (this.objectDigestInfo = t[Yu] ?? Ws.defaultValues(Yu)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case qu: - return new Ka(); case Gu: - return new hr(); + return new Ka(); case Ju: - return new xg(); + return new pr(); + case Yu: + return new Eg(); default: return super.defaultValues(t); } @@ -61261,7 +61307,7 @@ var Ws, oI = (Ws = class extends Ce { return new z({ name: n.blockName || "", value: [ - new ee({ + new ne({ optional: !0, name: n.baseCertificateID || "", idBlock: { @@ -61270,23 +61316,23 @@ var Ws, oI = (Ws = class extends Ce { }, value: Ka.schema().valueBlock.value }), - new ee({ + new ne({ optional: !0, name: n.entityName || "", idBlock: { tagClass: 3, tagNumber: 1 }, - value: hr.schema().valueBlock.value + value: pr.schema().valueBlock.value }), - new ee({ + new ne({ optional: !0, name: n.objectDigestInfo || "", idBlock: { tagClass: 3, tagNumber: 2 }, - value: xg.schema().valueBlock.value + value: Eg.schema().valueBlock.value }) ] }); @@ -61294,27 +61340,27 @@ var Ws, oI = (Ws = class extends Ce { fromSchema(t) { for (const r of eNe) delete t[r]; const n = Ee(t, t, Ws.schema({ names: { - baseCertificateID: qu, - entityName: Gu, - objectDigestInfo: Ju + baseCertificateID: Gu, + entityName: Ju, + objectDigestInfo: Yu } })); - ke.assertSchema(n, this.className), qu in n.result && (this.baseCertificateID = new Ka({ schema: new z({ value: n.result.baseCertificateID.valueBlock.value }) })), Gu in n.result && (this.entityName = new hr({ schema: new z({ value: n.result.entityName.valueBlock.value }) })), Ju in n.result && (this.objectDigestInfo = new xg({ schema: new z({ value: n.result.objectDigestInfo.valueBlock.value }) })); + ke.assertSchema(n, this.className), Gu in n.result && (this.baseCertificateID = new Ka({ schema: new z({ value: n.result.baseCertificateID.valueBlock.value }) })), Ju in n.result && (this.entityName = new pr({ schema: new z({ value: n.result.entityName.valueBlock.value }) })), Yu in n.result && (this.objectDigestInfo = new Eg({ schema: new z({ value: n.result.objectDigestInfo.valueBlock.value }) })); } toSchema() { const t = new z(); - return this.baseCertificateID && t.valueBlock.value.push(new ee({ + return this.baseCertificateID && t.valueBlock.value.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: this.baseCertificateID.toSchema().valueBlock.value - })), this.entityName && t.valueBlock.value.push(new ee({ + })), this.entityName && t.valueBlock.value.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, value: this.entityName.toSchema().valueBlock.value - })), this.objectDigestInfo && t.valueBlock.value.push(new ee({ + })), this.objectDigestInfo && t.valueBlock.value.push(new ne({ idBlock: { tagClass: 3, tagNumber: 2 @@ -61327,7 +61373,7 @@ var Ws, oI = (Ws = class extends Ce { return this.baseCertificateID && (t.baseCertificateID = this.baseCertificateID.toJSON()), this.entityName && (t.entityName = this.entityName.toJSON()), this.objectDigestInfo && (t.objectDigestInfo = this.objectDigestInfo.toJSON()), t; } }, Ws.CLASS_NAME = "Holder", Ws); -const Zb = "version", ew = "holder", tw = "issuer", nw = "signature", rw = "serialNumber", ow = "attrCertValidityPeriod", sw = "attributes", Yu = "issuerUniqueID", Qu = "extensions", tNe = [ +const Zb = "version", ew = "holder", tw = "issuer", nw = "signature", rw = "serialNumber", ow = "attrCertValidityPeriod", sw = "attributes", Qu = "issuerUniqueID", Xu = "extensions", tNe = [ Zb, ew, tw, @@ -61335,12 +61381,12 @@ const Zb = "version", ew = "holder", tw = "issuer", nw = "signature", rw = "seri rw, ow, sw, - Yu, - Qu + Qu, + Xu ]; -var lr, sI = (lr = class extends Ce { +var ur, sI = (ur = class extends Ce { constructor(t = {}) { - super(), this.version = t[Zb] ?? lr.defaultValues(Zb), this.holder = t[ew] ?? lr.defaultValues(ew), this.issuer = t[tw] ?? lr.defaultValues(tw), this.signature = t[nw] ?? lr.defaultValues(nw), this.serialNumber = t[rw] ?? lr.defaultValues(rw), this.attrCertValidityPeriod = t[ow] ?? lr.defaultValues(ow), this.attributes = t[sw] ?? lr.defaultValues(sw), Yu in t && (this.issuerUniqueID = t[Yu] ?? lr.defaultValues(Yu)), Qu in t && (this.extensions = t[Qu] ?? lr.defaultValues(Qu)), t.schema && this.fromSchema(t.schema); + super(), this.version = t[Zb] ?? ur.defaultValues(Zb), this.holder = t[ew] ?? ur.defaultValues(ew), this.issuer = t[tw] ?? ur.defaultValues(tw), this.signature = t[nw] ?? ur.defaultValues(nw), this.serialNumber = t[rw] ?? ur.defaultValues(rw), this.attrCertValidityPeriod = t[ow] ?? ur.defaultValues(ow), this.attributes = t[sw] ?? ur.defaultValues(sw), Qu in t && (this.issuerUniqueID = t[Qu] ?? ur.defaultValues(Qu)), Xu in t && (this.extensions = t[Xu] ?? ur.defaultValues(Xu)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -61351,16 +61397,16 @@ var lr, sI = (lr = class extends Ce { case tw: return {}; case nw: - return new fe(); - case rw: return new de(); + case rw: + return new ue(); case ow: - return new Ag(); + return new Sg(); case sw: return []; - case Yu: - return new ht(); case Qu: + return new pt(); + case Xu: return new jn(); default: return super.defaultValues(t); @@ -61371,9 +61417,9 @@ var lr, sI = (lr = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), + new ue({ name: n.version || "" }), oI.schema(n.holder || {}), - new Xt({ value: [hr.schema({ names: { blockName: n.issuer || "" } }), new ee({ + new en({ value: [pr.schema({ names: { blockName: n.issuer || "" } }), new ne({ name: n.issuer || "", idBlock: { tagClass: 3, @@ -61381,14 +61427,14 @@ var lr, sI = (lr = class extends Ce { }, value: B4.schema().valueBlock.value })] }), - fe.schema(n.signature || {}), - new de({ name: n.serialNumber || "" }), - Ag.schema(n.attrCertValidityPeriod || {}), + de.schema(n.signature || {}), + new ue({ name: n.serialNumber || "" }), + Sg.schema(n.attrCertValidityPeriod || {}), new z({ name: n.attributes || "", - value: [new ot({ value: En.schema() })] + value: [new st({ value: En.schema() })] }), - new ht({ + new pt({ optional: !0, name: n.issuerUniqueID || "" }), @@ -61398,7 +61444,7 @@ var lr, sI = (lr = class extends Ce { } fromSchema(t) { for (const r of tNe) delete t[r]; - const n = Ee(t, t, lr.schema({ names: { + const n = Ee(t, t, ur.schema({ names: { version: Zb, holder: { names: { blockName: ew } }, issuer: tw, @@ -61406,8 +61452,8 @@ var lr, sI = (lr = class extends Ce { serialNumber: rw, attrCertValidityPeriod: { names: { blockName: ow } }, attributes: sw, - issuerUniqueID: Yu, - extensions: { names: { blockName: Qu } } + issuerUniqueID: Qu, + extensions: { names: { blockName: Xu } } } })); switch (ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.holder = new oI({ schema: n.result.holder }), n.result.issuer.idBlock.tagClass) { case 3: @@ -61416,13 +61462,13 @@ var lr, sI = (lr = class extends Ce { default: throw new Error("Incorrect value for 'issuer' in AttributeCertificateInfoV2"); } - this.signature = new fe({ schema: n.result.signature }), this.serialNumber = n.result.serialNumber, this.attrCertValidityPeriod = new Ag({ schema: n.result.attrCertValidityPeriod }), this.attributes = Array.from(n.result.attributes.valueBlock.value, (r) => new En({ schema: r })), Yu in n.result && (this.issuerUniqueID = n.result.issuerUniqueID), Qu in n.result && (this.extensions = new jn({ schema: n.result.extensions })); + this.signature = new de({ schema: n.result.signature }), this.serialNumber = n.result.serialNumber, this.attrCertValidityPeriod = new Sg({ schema: n.result.attrCertValidityPeriod }), this.attributes = Array.from(n.result.attributes.valueBlock.value, (r) => new En({ schema: r })), Qu in n.result && (this.issuerUniqueID = n.result.issuerUniqueID), Xu in n.result && (this.extensions = new jn({ schema: n.result.extensions })); } toSchema() { const t = new z({ value: [ - new de({ value: this.version }), + new ue({ value: this.version }), this.holder.toSchema(), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -61448,13 +61494,13 @@ var lr, sI = (lr = class extends Ce { }; return this.issuerUniqueID && (t.issuerUniqueID = this.issuerUniqueID.toJSON()), this.extensions && (t.extensions = this.extensions.toJSON()), t; } -}, lr.CLASS_NAME = "AttributeCertificateInfoV2", lr); +}, ur.CLASS_NAME = "AttributeCertificateInfoV2", ur); const iw = "acinfo", aw = "signatureAlgorithm", cw = "signatureValue", nNe = [ iw, aw, cw ]; -var qs, Bd = (qs = class extends Ce { +var qs, Ld = (qs = class extends Ce { constructor(t = {}) { super(), this.acinfo = t[iw] ?? qs.defaultValues(iw), this.signatureAlgorithm = t[aw] ?? qs.defaultValues(aw), this.signatureValue = t[cw] ?? qs.defaultValues(cw), t.schema && this.fromSchema(t.schema); } @@ -61463,9 +61509,9 @@ var qs, Bd = (qs = class extends Ce { case iw: return new sI(); case aw: - return new fe(); + return new de(); case cw: - return new ht(); + return new pt(); default: return super.defaultValues(t); } @@ -61476,8 +61522,8 @@ var qs, Bd = (qs = class extends Ce { name: n.blockName || "", value: [ sI.schema(n.acinfo || {}), - fe.schema(n.signatureAlgorithm || {}), - new ht({ name: n.signatureValue || "" }) + de.schema(n.signatureAlgorithm || {}), + new pt({ name: n.signatureValue || "" }) ] }); } @@ -61488,7 +61534,7 @@ var qs, Bd = (qs = class extends Ce { signatureAlgorithm: { names: { blockName: aw } }, signatureValue: cw } })); - ke.assertSchema(n, this.className), this.acinfo = new sI({ schema: n.result.acinfo }), this.signatureAlgorithm = new fe({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; + ke.assertSchema(n, this.className), this.acinfo = new sI({ schema: n.result.acinfo }), this.signatureAlgorithm = new de({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; } toSchema() { return new z({ value: [ @@ -61505,16 +61551,16 @@ var qs, Bd = (qs = class extends Ce { }; } }, qs.CLASS_NAME = "AttributeCertificateV2", qs); -const Xu = "contentType", Hh = "content", rNe = [Xu, Hh]; -var oo, Yn = (oo = class extends Ce { +const Zu = "contentType", zh = "content", rNe = [Zu, zh]; +var so, Yn = (so = class extends Ce { constructor(t = {}) { - super(), this.contentType = t[Xu] ?? oo.defaultValues(Xu), this.content = t[Hh] ?? oo.defaultValues(Hh), t.schema && this.fromSchema(t.schema); + super(), this.contentType = t[Zu] ?? so.defaultValues(Zu), this.content = t[zh] ?? so.defaultValues(zh), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Xu: + case Zu: return ""; - case Hh: + case zh: return new Xe(); default: return super.defaultValues(t); @@ -61522,9 +61568,9 @@ var oo, Yn = (oo = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Xu: - return typeof n == "string" && n === this.defaultValues(Xu); - case Hh: + case Zu: + return typeof n == "string" && n === this.defaultValues(Zu); + case zh: return n instanceof Xe; default: return super.defaultValues(t); @@ -61535,22 +61581,22 @@ var oo, Yn = (oo = class extends Ce { return "optional" in n || (n.optional = !1), new z({ name: n.blockName || "ContentInfo", optional: n.optional, - value: [new Ve({ name: n.contentType || Xu }), new ee({ + value: [new $e({ name: n.contentType || Zu }), new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Xe({ name: n.content || Hh })] + value: [new Xe({ name: n.content || zh })] })] }); } fromSchema(t) { for (const r of rNe) delete t[r]; - const n = Ee(t, t, oo.schema()); + const n = Ee(t, t, so.schema()); ke.assertSchema(n, this.className), this.contentType = n.result.contentType.valueBlock.toString(), this.content = n.result.content; } toSchema() { - return new z({ value: [new Ve({ value: this.contentType }), new ee({ + return new z({ value: [new $e({ value: this.contentType }), new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -61562,19 +61608,19 @@ var oo, Yn = (oo = class extends Ce { const t = { contentType: this.contentType }; return this.content instanceof Xe || (t.content = this.content.toJSON()), t; } -}, oo.CLASS_NAME = "ContentInfo", oo.DATA = iT, oo.SIGNED_DATA = QCe, oo.ENVELOPED_DATA = pq, oo.ENCRYPTED_DATA = gq, oo); -const zh = "certId", Wh = "certValue", yh = "parsedValue", oNe = [zh, Wh]; +}, so.CLASS_NAME = "ContentInfo", so.DATA = iT, so.SIGNED_DATA = QCe, so.ENVELOPED_DATA = pq, so.ENCRYPTED_DATA = gq, so); +const Wh = "certId", qh = "certValue", wh = "parsedValue", oNe = [Wh, qh]; var Gs, sNe = (Gs = class extends Ce { constructor(t = {}) { - super(), this.certId = t[zh] ?? Gs.defaultValues(zh), this.certValue = t[Wh] ?? Gs.defaultValues(Wh), yh in t && (this.parsedValue = t[yh] ?? Gs.defaultValues(yh)), t.schema && this.fromSchema(t.schema); + super(), this.certId = t[Wh] ?? Gs.defaultValues(Wh), this.certValue = t[qh] ?? Gs.defaultValues(qh), wh in t && (this.parsedValue = t[wh] ?? Gs.defaultValues(wh)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case zh: - return ""; case Wh: + return ""; + case qh: return new Xe(); - case yh: + case wh: return {}; default: return super.defaultValues(t); @@ -61582,11 +61628,11 @@ var Gs, sNe = (Gs = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case zh: - return n === ""; case Wh: + return n === ""; + case qh: return n instanceof Xe; - case yh: + case wh: return n instanceof Object && Object.keys(n).length === 0; default: return super.defaultValues(t); @@ -61596,7 +61642,7 @@ var Gs, sNe = (Gs = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.id || "id" }), new ee({ + value: [new $e({ name: n.id || "id" }), new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -61608,8 +61654,8 @@ var Gs, sNe = (Gs = class extends Ce { fromSchema(t) { for (const o of oNe) delete t[o]; const n = Ee(t, t, Gs.schema({ names: { - id: zh, - value: Wh + id: Wh, + value: qh } })); ke.assertSchema(n, this.className), this.certId = n.result.certId.valueBlock.toString(), this.certValue = n.result.certValue; const r = this.certValue.valueBlock.valueHexView; @@ -61618,11 +61664,11 @@ var Gs, sNe = (Gs = class extends Ce { try { this.parsedValue = Mr.fromBER(r); } catch { - Bd.fromBER(r); + Ld.fromBER(r); } break; case a4: - this.parsedValue = Bd.fromBER(r); + this.parsedValue = Ld.fromBER(r); break; case XCe: default: @@ -61630,7 +61676,7 @@ var Gs, sNe = (Gs = class extends Ce { } } toSchema() { - return yh in this && ("acinfo" in this.parsedValue ? this.certId = a4 : this.certId = i4, this.certValue = new Oe({ valueHex: this.parsedValue.toSchema().toBER(!1) })), new z({ value: [new Ve({ value: this.certId }), new ee({ + return wh in this && ("acinfo" in this.parsedValue ? this.certId = a4 : this.certId = i4, this.certValue = new Oe({ valueHex: this.parsedValue.toSchema().toBER(!1) })), new z({ value: [new $e({ value: this.certId }), new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -61645,22 +61691,22 @@ var Gs, sNe = (Gs = class extends Ce { }; } }, Gs.CLASS_NAME = "CertBag", Gs); -const lw = "userCertificate", qh = "revocationDate", Zu = "crlEntryExtensions", iNe = [ +const lw = "userCertificate", Gh = "revocationDate", ed = "crlEntryExtensions", iNe = [ lw, - qh, - Zu + Gh, + ed ]; var Js, xq = (Js = class extends Ce { constructor(t = {}) { - super(), this.userCertificate = t[lw] ?? Js.defaultValues(lw), this.revocationDate = t[qh] ?? Js.defaultValues(qh), Zu in t && (this.crlEntryExtensions = t[Zu] ?? Js.defaultValues(Zu)), t.schema && this.fromSchema(t.schema); + super(), this.userCertificate = t[lw] ?? Js.defaultValues(lw), this.revocationDate = t[Gh] ?? Js.defaultValues(Gh), ed in t && (this.crlEntryExtensions = t[ed] ?? Js.defaultValues(ed)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case lw: - return new de(); - case qh: - return new or(); - case Zu: + return new ue(); + case Gh: + return new sr(); + case ed: return new jn(); default: return super.defaultValues(t); @@ -61671,19 +61717,19 @@ var Js, xq = (Js = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.userCertificate || lw }), - or.schema({ names: { - utcTimeName: n.revocationDate || qh, - generalTimeName: n.revocationDate || qh + new ue({ name: n.userCertificate || lw }), + sr.schema({ names: { + utcTimeName: n.revocationDate || Gh, + generalTimeName: n.revocationDate || Gh } }), - jn.schema({ names: { blockName: n.crlEntryExtensions || Zu } }, !0) + jn.schema({ names: { blockName: n.crlEntryExtensions || ed } }, !0) ] }); } fromSchema(t) { for (const r of iNe) delete t[r]; const n = Ee(t, t, Js.schema()); - ke.assertSchema(n, this.className), this.userCertificate = n.result.userCertificate, this.revocationDate = new or({ schema: n.result.revocationDate }), Zu in n.result && (this.crlEntryExtensions = new jn({ schema: n.result.crlEntryExtensions })); + ke.assertSchema(n, this.className), this.userCertificate = n.result.userCertificate, this.revocationDate = new sr({ schema: n.result.revocationDate }), ed in n.result && (this.crlEntryExtensions = new jn({ schema: n.result.crlEntryExtensions })); } toSchema() { const t = [this.userCertificate, this.revocationDate.toSchema()]; @@ -61714,33 +61760,33 @@ function cNe(e = {}) { return new z({ name: t.blockName || rc, value: [ - new de({ + new ue({ optional: !0, name: t.tbsCertListVersion || fx, value: 2 }), - fe.schema(t.signature || { names: { blockName: hT } }), - Qt.schema(t.issuer || { names: { blockName: pT } }), - or.schema(t.tbsCertListThisUpdate || { names: { + de.schema(t.signature || { names: { blockName: hT } }), + Zt.schema(t.issuer || { names: { blockName: pT } }), + sr.schema(t.tbsCertListThisUpdate || { names: { utcTimeName: hx, generalTimeName: hx } }), - or.schema(t.tbsCertListNextUpdate || { names: { + sr.schema(t.tbsCertListNextUpdate || { names: { utcTimeName: G0, generalTimeName: G0 } }, !0), new z({ optional: !0, - value: [new ot({ + value: [new st({ name: t.tbsCertListRevokedCertificates || px, value: new z({ value: [ - new de(), - or.schema(), + new ue(), + sr.schema(), jn.schema({}, !0) ] }) })] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, @@ -61780,21 +61826,21 @@ var Rn, J0 = (Rn = class extends Ce { case Sy: return 0; case aI: - return new fe(); + return new de(); case cI: - return new Qt(); + return new Zt(); case lI: - return new or(); + return new sr(); case ok: - return new or(); + return new sr(); case sk: return []; case ik: return new jn(); case uw: - return new fe(); + return new de(); case dw: - return new ht(); + return new pt(); default: return super.defaultValues(t); } @@ -61805,19 +61851,19 @@ var Rn, J0 = (Rn = class extends Ce { name: n.blockName || "CertificateList", value: [ cNe(t), - fe.schema(n.signatureAlgorithm || { names: { blockName: uw } }), - new ht({ name: n.signatureValue || dw }) + de.schema(n.signatureAlgorithm || { names: { blockName: uw } }), + new pt({ name: n.signatureValue || dw }) ] }); } fromSchema(t) { for (const r of aNe) delete t[r]; const n = Ee(t, t, Rn.schema()); - ke.assertSchema(n, this.className), this.tbsView = n.result.tbsCertList.valueBeforeDecodeView, fx in n.result && (this.version = n.result[fx].valueBlock.valueDec), this.signature = new fe({ schema: n.result[hT] }), this.issuer = new Qt({ schema: n.result[pT] }), this.thisUpdate = new or({ schema: n.result[hx] }), G0 in n.result && (this.nextUpdate = new or({ schema: n.result[G0] })), px in n.result && (this.revokedCertificates = Array.from(n.result[px], (r) => new xq({ schema: r }))), gx in n.result && (this.crlExtensions = new jn({ schema: n.result[gx] })), this.signatureAlgorithm = new fe({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; + ke.assertSchema(n, this.className), this.tbsView = n.result.tbsCertList.valueBeforeDecodeView, fx in n.result && (this.version = n.result[fx].valueBlock.valueDec), this.signature = new de({ schema: n.result[hT] }), this.issuer = new Zt({ schema: n.result[pT] }), this.thisUpdate = new sr({ schema: n.result[hx] }), G0 in n.result && (this.nextUpdate = new sr({ schema: n.result[G0] })), px in n.result && (this.revokedCertificates = Array.from(n.result[px], (r) => new xq({ schema: r }))), gx in n.result && (this.crlExtensions = new jn({ schema: n.result[gx] })), this.signatureAlgorithm = new de({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; } encodeTBS() { const t = []; - return this.version !== Rn.defaultValues(Sy) && t.push(new de({ value: this.version })), t.push(this.signature.toSchema()), t.push(this.issuer.toSchema()), t.push(this.thisUpdate.toSchema()), this.nextUpdate && t.push(this.nextUpdate.toSchema()), this.revokedCertificates && t.push(new z({ value: Array.from(this.revokedCertificates, (n) => n.toSchema()) })), this.crlExtensions && t.push(new ee({ + return this.version !== Rn.defaultValues(Sy) && t.push(new ue({ value: this.version })), t.push(this.signature.toSchema()), t.push(this.issuer.toSchema()), t.push(this.thisUpdate.toSchema()), this.nextUpdate && t.push(this.nextUpdate.toSchema()), this.revokedCertificates && t.push(new z({ value: Array.from(this.revokedCertificates, (n) => n.toSchema()) })), this.crlExtensions && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -61832,7 +61878,7 @@ var Rn, J0 = (Rn = class extends Ce { n = this.encodeTBS(); else { if (!this.tbsView.byteLength) return Rn.schema(); - const r = hn(this.tbsView); + const r = pn(this.tbsView); ke.assert(r, "TBS Certificate Revocation List"), n = r.result; } return new z({ value: [ @@ -61843,7 +61889,7 @@ var Rn, J0 = (Rn = class extends Ce { } toJSON() { const t = { - tbs: Xn.encode(this.tbsView), + tbs: Zn.encode(this.tbsView), version: this.version, signature: this.signature.toJSON(), issuer: this.issuer.toJSON(), @@ -61863,7 +61909,7 @@ var Rn, J0 = (Rn = class extends Ce { const o = await r.getSignatureParameters(t, n), { parameters: s } = o; this.signature = o.signatureAlgorithm, this.signatureAlgorithm = o.signatureAlgorithm, this.tbsView = new Uint8Array(this.encodeTBS().toBER()); const i = await r.signWithPrivateKey(this.tbsView, t, s); - this.signatureValue = new ht({ valueHex: i }); + this.signatureValue = new pt({ valueHex: i }); } async verify(t = {}, n = Ye(!0)) { let r; @@ -61877,16 +61923,16 @@ var Rn, J0 = (Rn = class extends Ce { return n.verifyWithPublicKey(this.tbsView, this.signatureValue, r, this.signatureAlgorithm); } }, Rn.CLASS_NAME = "CertificateRevocationList", Rn); -const Gh = "crlId", Jh = "crlValue", xy = "parsedValue", uNe = [Gh, Jh]; +const Jh = "crlId", Yh = "crlValue", xy = "parsedValue", uNe = [Jh, Yh]; var Ys, dNe = (Ys = class extends Ce { constructor(t = {}) { - super(), this.crlId = t[Gh] ?? Ys.defaultValues(Gh), this.crlValue = t[Jh] ?? Ys.defaultValues(Jh), xy in t && (this.parsedValue = t[xy] ?? Ys.defaultValues(xy)), t.schema && this.fromSchema(t.schema); + super(), this.crlId = t[Jh] ?? Ys.defaultValues(Jh), this.crlValue = t[Yh] ?? Ys.defaultValues(Yh), xy in t && (this.parsedValue = t[xy] ?? Ys.defaultValues(xy)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Gh: - return ""; case Jh: + return ""; + case Yh: return new Xe(); case xy: return {}; @@ -61896,9 +61942,9 @@ var Ys, dNe = (Ys = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Gh: - return n === ""; case Jh: + return n === ""; + case Yh: return n instanceof Xe; case xy: return n instanceof Object && Object.keys(n).length === 0; @@ -61910,7 +61956,7 @@ var Ys, dNe = (Ys = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.id || "id" }), new ee({ + value: [new $e({ name: n.id || "id" }), new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -61922,8 +61968,8 @@ var Ys, dNe = (Ys = class extends Ce { fromSchema(t) { for (const r of uNe) delete t[r]; const n = Ee(t, t, Ys.schema({ names: { - id: Gh, - value: Jh + id: Jh, + value: Yh } })); switch (ke.assertSchema(n, this.className), this.crlId = n.result.crlId.valueBlock.toString(), this.crlValue = n.result.crlValue, this.crlId) { case c4: @@ -61934,7 +61980,7 @@ var Ys, dNe = (Ys = class extends Ce { } } toSchema() { - return this.parsedValue && (this.crlId = c4, this.crlValue = new Oe({ valueHex: this.parsedValue.toSchema().toBER(!1) })), new z({ value: [new Ve({ value: this.crlId }), new ee({ + return this.parsedValue && (this.crlId = c4, this.crlValue = new Oe({ valueHex: this.parsedValue.toSchema().toBER(!1) })), new z({ value: [new $e({ value: this.crlId }), new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -61949,22 +61995,22 @@ var Ys, dNe = (Ys = class extends Ce { }; } }, Ys.CLASS_NAME = "CRLBag", Ys); -const Yh = "version", Qh = "encryptedContentInfo", Dc = "unprotectedAttrs", fNe = [ - Yh, +const Qh = "version", Xh = "encryptedContentInfo", jc = "unprotectedAttrs", fNe = [ Qh, - Dc + Xh, + jc ]; var Qs, mx = (Qs = class extends Ce { constructor(t = {}) { - super(), this.version = t[Yh] ?? Qs.defaultValues(Yh), this.encryptedContentInfo = t[Qh] ?? Qs.defaultValues(Qh), Dc in t && (this.unprotectedAttrs = t[Dc] ?? Qs.defaultValues(Dc)), t.schema && this.fromSchema(t.schema); + super(), this.version = t[Qh] ?? Qs.defaultValues(Qh), this.encryptedContentInfo = t[Xh] ?? Qs.defaultValues(Xh), jc in t && (this.unprotectedAttrs = t[jc] ?? Qs.defaultValues(jc)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Yh: - return 0; case Qh: + return 0; + case Xh: return new Ir(); - case Dc: + case jc: return []; default: return super.defaultValues(t); @@ -61972,11 +62018,11 @@ var Qs, mx = (Qs = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Yh: - return n === 0; case Qh: + return n === 0; + case Xh: return Ir.compareWithDefault("contentType", n.contentType) && Ir.compareWithDefault("contentEncryptionAlgorithm", n.contentEncryptionAlgorithm) && Ir.compareWithDefault("encryptedContent", n.encryptedContent); - case Dc: + case jc: return n.length === 0; default: return super.defaultValues(t); @@ -61987,15 +62033,15 @@ var Qs, mx = (Qs = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), + new ue({ name: n.version || "" }), Ir.schema(n.encryptedContentInfo || {}), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new ot({ + value: [new st({ name: n.unprotectedAttrs || "", value: En.schema() })] @@ -62006,15 +62052,15 @@ var Qs, mx = (Qs = class extends Ce { fromSchema(t) { for (const r of fNe) delete t[r]; const n = Ee(t, t, Qs.schema({ names: { - version: Yh, - encryptedContentInfo: { names: { blockName: Qh } }, - unprotectedAttrs: Dc + version: Qh, + encryptedContentInfo: { names: { blockName: Xh } }, + unprotectedAttrs: jc } })); - ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.encryptedContentInfo = new Ir({ schema: n.result.encryptedContentInfo }), Dc in n.result && (this.unprotectedAttrs = Array.from(n.result.unprotectedAttrs, (r) => new En({ schema: r }))); + ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.encryptedContentInfo = new Ir({ schema: n.result.encryptedContentInfo }), jc in n.result && (this.unprotectedAttrs = Array.from(n.result.unprotectedAttrs, (r) => new En({ schema: r }))); } toSchema() { const t = []; - return t.push(new de({ value: this.version })), t.push(this.encryptedContentInfo.toSchema()), this.unprotectedAttrs && t.push(new ee({ + return t.push(new ue({ value: this.version })), t.push(this.encryptedContentInfo.toSchema()), this.unprotectedAttrs && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -62031,7 +62077,7 @@ var Qs, mx = (Qs = class extends Ce { return this.unprotectedAttrs && (t.unprotectedAttrs = Array.from(this.unprotectedAttrs, (n) => n.toJSON())), t; } async encrypt(t, n = Ye(!0)) { - Ut.assert(t, "parameters", "object"); + zt.assert(t, "parameters", "object"); const r = { ...t, contentType: "1.2.840.113549.1.7.1" @@ -62039,7 +62085,7 @@ var Qs, mx = (Qs = class extends Ce { this.encryptedContentInfo = await n.encryptEncryptedContentInfo(r); } async decrypt(t, n = Ye(!0)) { - Ut.assert(t, "parameters", "object"); + zt.assert(t, "parameters", "object"); const r = { ...t, encryptedContentInfo: this.encryptedContentInfo @@ -62047,16 +62093,16 @@ var Qs, mx = (Qs = class extends Ce { return n.decryptEncryptedContentInfo(r); } }, Qs.CLASS_NAME = "EncryptedData", Qs); -const ed = "encryptionAlgorithm", jc = "encryptedData", Ey = "parsedValue", hNe = [ed, jc]; +const td = "encryptionAlgorithm", Fc = "encryptedData", Ey = "parsedValue", hNe = [td, Fc]; var ls, pNe = (ls = class extends Ce { constructor(t = {}) { - super(), this.encryptionAlgorithm = t[ed] ?? ls.defaultValues(ed), this.encryptedData = t[jc] ?? ls.defaultValues(jc), Ey in t && (this.parsedValue = t[Ey] ?? ls.defaultValues(Ey)), t.schema && this.fromSchema(t.schema); + super(), this.encryptionAlgorithm = t[td] ?? ls.defaultValues(td), this.encryptedData = t[Fc] ?? ls.defaultValues(Fc), Ey in t && (this.parsedValue = t[Ey] ?? ls.defaultValues(Ey)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case ed: - return new fe(); - case jc: + case td: + return new de(); + case Fc: return new Oe(); case Ey: return {}; @@ -62066,9 +62112,9 @@ var ls, pNe = (ls = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case ed: - return fe.compareWithDefault("algorithmId", n.algorithmId) && !("algorithmParams" in n); - case jc: + case td: + return de.compareWithDefault("algorithmId", n.algorithmId) && !("algorithmParams" in n); + case Fc: return n.isEqual(ls.defaultValues(t)); case Ey: return n instanceof Object && Object.keys(n).length === 0; @@ -62080,19 +62126,19 @@ var ls, pNe = (ls = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [fe.schema(n.encryptionAlgorithm || { names: { blockName: ed } }), new Xt({ value: [new Oe({ name: n.encryptedData || jc }), new Oe({ + value: [de.schema(n.encryptionAlgorithm || { names: { blockName: td } }), new en({ value: [new Oe({ name: n.encryptedData || Fc }), new Oe({ idBlock: { isConstructed: !0 }, - name: n.encryptedData || jc + name: n.encryptedData || Fc })] })] }); } fromSchema(t) { for (const r of hNe) delete t[r]; const n = Ee(t, t, ls.schema({ names: { - encryptionAlgorithm: { names: { blockName: ed } }, - encryptedData: jc + encryptionAlgorithm: { names: { blockName: td } }, + encryptedData: Fc } })); - ke.assertSchema(n, this.className), this.encryptionAlgorithm = new fe({ schema: n.result.encryptionAlgorithm }), this.encryptedData = n.result.encryptedData; + ke.assertSchema(n, this.className), this.encryptionAlgorithm = new de({ schema: n.result.encryptionAlgorithm }), this.encryptedData = n.result.encryptedData; } toSchema() { return new z({ value: [this.encryptionAlgorithm.toSchema(), this.encryptedData] }); @@ -62120,16 +62166,16 @@ var ls, pNe = (ls = class extends Ce { this.encryptionAlgorithm = r.encryptedContentInfo.contentEncryptionAlgorithm, this.encryptedData = r.encryptedContentInfo.encryptedContent; } }, ls.CLASS_NAME = "PKCS8ShroudedKeyBag", ls); -const Xh = "secretTypeId", Zh = "secretValue", gNe = [Xh, Zh]; +const Zh = "secretTypeId", ep = "secretValue", gNe = [Zh, ep]; var Sa, mNe = (Sa = class extends Ce { constructor(t = {}) { - super(), this.secretTypeId = t[Xh] ?? Sa.defaultValues(Xh), this.secretValue = t[Zh] ?? Sa.defaultValues(Zh), t.schema && this.fromSchema(t.schema); + super(), this.secretTypeId = t[Zh] ?? Sa.defaultValues(Zh), this.secretValue = t[ep] ?? Sa.defaultValues(ep), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Xh: - return ""; case Zh: + return ""; + case ep: return new Xe(); default: return super.defaultValues(t); @@ -62137,9 +62183,9 @@ var Sa, mNe = (Sa = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Xh: - return n === ""; case Zh: + return n === ""; + case ep: return n instanceof Xe; default: return super.defaultValues(t); @@ -62149,7 +62195,7 @@ var Sa, mNe = (Sa = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.id || "id" }), new ee({ + value: [new $e({ name: n.id || "id" }), new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -62161,13 +62207,13 @@ var Sa, mNe = (Sa = class extends Ce { fromSchema(t) { for (const r of gNe) delete t[r]; const n = Ee(t, t, Sa.schema({ names: { - id: Xh, - value: Zh + id: Zh, + value: ep } })); ke.assertSchema(n, this.className), this.secretTypeId = n.result.secretTypeId.valueBlock.toString(), this.secretValue = n.result.secretValue; } toSchema() { - return new z({ value: [new Ve({ value: this.secretTypeId }), new ee({ + return new z({ value: [new $e({ value: this.secretTypeId }), new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -62183,9 +62229,9 @@ var Sa, mNe = (Sa = class extends Ce { } }, Sa.CLASS_NAME = "SecretBag", Sa); //! NOTE Bag type must be imported after the SafeBagValueFactory declaration -var yNe = class td { +var yNe = class nd { static getItems() { - return this.items || (this.items = {}, td.register("1.2.840.113549.1.12.10.1.1", ix), td.register("1.2.840.113549.1.12.10.1.2", pNe), td.register("1.2.840.113549.1.12.10.1.3", sNe), td.register("1.2.840.113549.1.12.10.1.4", dNe), td.register("1.2.840.113549.1.12.10.1.5", mNe), td.register("1.2.840.113549.1.12.10.1.6", fw)), this.items; + return this.items || (this.items = {}, nd.register("1.2.840.113549.1.12.10.1.1", ix), nd.register("1.2.840.113549.1.12.10.1.2", pNe), nd.register("1.2.840.113549.1.12.10.1.3", sNe), nd.register("1.2.840.113549.1.12.10.1.4", dNe), nd.register("1.2.840.113549.1.12.10.1.5", mNe), nd.register("1.2.840.113549.1.12.10.1.6", fw)), this.items; } static register(t, n) { this.getItems()[t] = n; @@ -62194,20 +62240,20 @@ var yNe = class td { return this.getItems()[t] || null; } }; -const nd = "bagId", rd = "bagValue", Hi = "bagAttributes", bNe = [ - nd, +const rd = "bagId", od = "bagValue", Hi = "bagAttributes", bNe = [ rd, + od, Hi ]; var Xs, _4 = (Xs = class extends Ce { constructor(t = {}) { - super(), this.bagId = t[nd] ?? Xs.defaultValues(nd), this.bagValue = t[rd] ?? Xs.defaultValues(rd), Hi in t && (this.bagAttributes = t[Hi] ?? Xs.defaultValues(Hi)), t.schema && this.fromSchema(t.schema); + super(), this.bagId = t[rd] ?? Xs.defaultValues(rd), this.bagValue = t[od] ?? Xs.defaultValues(od), Hi in t && (this.bagAttributes = t[Hi] ?? Xs.defaultValues(Hi)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case nd: - return ""; case rd: + return ""; + case od: return new Xe(); case Hi: return []; @@ -62217,9 +62263,9 @@ var Xs, _4 = (Xs = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case nd: - return n === ""; case rd: + return n === ""; + case od: return n instanceof Xe; case Hi: return n.length === 0; @@ -62232,17 +62278,17 @@ var Xs, _4 = (Xs = class extends Ce { return new z({ name: n.blockName || "", value: [ - new Ve({ name: n.bagId || nd }), - new ee({ + new $e({ name: n.bagId || rd }), + new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Xe({ name: n.bagValue || rd })] + value: [new Xe({ name: n.bagValue || od })] }), new An({ optional: !0, - value: [new ot({ + value: [new st({ name: n.bagAttributes || Hi, value: En.schema() })] @@ -62253,8 +62299,8 @@ var Xs, _4 = (Xs = class extends Ce { fromSchema(t) { for (const o of bNe) delete t[o]; const n = Ee(t, t, Xs.schema({ names: { - bagId: nd, - bagValue: rd, + bagId: rd, + bagValue: od, bagAttributes: Hi } })); ke.assertSchema(n, this.className), this.bagId = n.result.bagId.valueBlock.toString(); @@ -62263,7 +62309,7 @@ var Xs, _4 = (Xs = class extends Ce { this.bagValue = new r({ schema: n.result.bagValue }), Hi in n.result && (this.bagAttributes = Array.from(n.result.bagAttributes, (o) => new En({ schema: o }))); } toSchema() { - const t = [new Ve({ value: this.bagId }), new ee({ + const t = [new $e({ value: this.bagId }), new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -62280,14 +62326,14 @@ var Xs, _4 = (Xs = class extends Ce { return this.bagAttributes && (t.bagAttributes = Array.from(this.bagAttributes, (n) => n.toJSON())), t; } }, Xs.CLASS_NAME = "SafeBag", Xs); -const bh = "safeBags"; -var $l, fw = ($l = class extends Ce { +const vh = "safeBags"; +var Ul, fw = (Ul = class extends Ce { constructor(t = {}) { - super(), this.safeBags = t[bh] ?? $l.defaultValues(bh), t.schema && this.fromSchema(t.schema); + super(), this.safeBags = t[vh] ?? Ul.defaultValues(vh), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case bh: + case vh: return []; default: return super.defaultValues(t); @@ -62295,7 +62341,7 @@ var $l, fw = ($l = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case bh: + case vh: return n.length === 0; default: return super.defaultValues(t); @@ -62305,15 +62351,15 @@ var $l, fw = ($l = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.safeBags || "", value: _4.schema() })] }); } fromSchema(t) { - for (const r of [bh]) delete t[r]; - const n = Ee(t, t, $l.schema({ names: { safeBags: bh } })); + for (const r of [vh]) delete t[r]; + const n = Ee(t, t, Ul.schema({ names: { safeBags: vh } })); ke.assertSchema(n, this.className), this.safeBags = Array.from(n.result.safeBags, (r) => new _4({ schema: r })); } toSchema() { @@ -62322,7 +62368,7 @@ var $l, fw = ($l = class extends Ce { toJSON() { return { safeBags: Array.from(this.safeBags, (t) => t.toJSON()) }; } -}, $l.CLASS_NAME = "SafeContents", $l); +}, Ul.CLASS_NAME = "SafeContents", Ul); const hw = "otherCertFormat", pw = "otherCert", wNe = [hw, pw]; var yA = class bA extends Ce { constructor(t = {}) { @@ -62342,7 +62388,7 @@ var yA = class bA extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.otherCertFormat || hw }), new Xe({ name: n.otherCert || pw })] + value: [new $e({ name: n.otherCertFormat || hw }), new Xe({ name: n.otherCert || pw })] }); } fromSchema(t) { @@ -62351,7 +62397,7 @@ var yA = class bA extends Ce { ke.assertSchema(n, this.className), this.otherCertFormat = n.result.otherCertFormat.valueBlock.toString(), this.otherCert = n.result.otherCert; } toSchema() { - return new z({ value: [new Ve({ value: this.otherCertFormat }), this.otherCert] }); + return new z({ value: [new $e({ value: this.otherCertFormat }), this.otherCert] }); } toJSON() { const t = { otherCertFormat: this.otherCertFormat }; @@ -62359,9 +62405,9 @@ var yA = class bA extends Ce { } }; const gw = "certificates", vNe = [gw]; -var Ul, Eg = (Ul = class extends Ce { +var Kl, Cg = (Kl = class extends Ce { constructor(t = {}) { - super(), this.certificates = t[gw] ?? Ul.defaultValues(gw), t.schema && this.fromSchema(t.schema); + super(), this.certificates = t[gw] ?? Kl.defaultValues(gw), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -62375,32 +62421,32 @@ var Ul, Eg = (Ul = class extends Ce { const n = t.names ?? {}; return new An({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.certificates || gw, - value: new Xt({ value: [ + value: new en({ value: [ Mr.schema(), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: [new Xe()] }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, value: [new z()] }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 2 }, - value: Bd.schema().valueBlock.value + value: Ld.schema().valueBlock.value }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 3 @@ -62413,16 +62459,16 @@ var Ul, Eg = (Ul = class extends Ce { } fromSchema(t) { for (const r of vNe) delete t[r]; - const n = Ee(t, t, Ul.schema()); + const n = Ee(t, t, Kl.schema()); ke.assertSchema(n, this.className), this.certificates = Array.from(n.result.certificates || [], (r) => { const o = r.idBlock.tagNumber; if (r.idBlock.tagClass === 1) return new Mr({ schema: r }); const s = new z({ value: r.valueBlock.value }); switch (o) { case 1: - return s.valueBlock.value[0].valueBlock.value[0].valueBlock.valueDec === 1 ? new Bd({ schema: s }) : new BO({ schema: s }); + return s.valueBlock.value[0].valueBlock.value[0].valueBlock.valueDec === 1 ? new Ld({ schema: s }) : new BO({ schema: s }); case 2: - return new Bd({ schema: s }); + return new Ld({ schema: s }); case 3: return new yA({ schema: s }); } @@ -62435,15 +62481,15 @@ var Ul, Eg = (Ul = class extends Ce { case t instanceof Mr: return t.toSchema(); case t instanceof BO: - return new ee({ + return new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, value: t.toSchema().valueBlock.value }); - case t instanceof Bd: - return new ee({ + case t instanceof Ld: + return new ne({ idBlock: { tagClass: 3, tagNumber: 2 @@ -62451,7 +62497,7 @@ var Ul, Eg = (Ul = class extends Ce { value: t.toSchema().valueBlock.value }); case t instanceof yA: - return new ee({ + return new ne({ idBlock: { tagClass: 3, tagNumber: 3 @@ -62465,7 +62511,7 @@ var Ul, Eg = (Ul = class extends Ce { toJSON() { return { certificates: Array.from(this.certificates, (t) => t.toJSON()) }; } -}, Ul.CLASS_NAME = "CertificateSet", Ul); +}, Kl.CLASS_NAME = "CertificateSet", Kl); const mw = "otherRevInfoFormat", yw = "otherRevInfo", kNe = [mw, yw]; var xa, wA = (xa = class extends Ce { constructor(t = {}) { @@ -62485,7 +62531,7 @@ var xa, wA = (xa = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.otherRevInfoFormat || mw }), new Xe({ name: n.otherRevInfo || yw })] + value: [new $e({ name: n.otherRevInfoFormat || mw }), new Xe({ name: n.otherRevInfo || yw })] }); } fromSchema(t) { @@ -62494,7 +62540,7 @@ var xa, wA = (xa = class extends Ce { ke.assertSchema(n, this.className), this.otherRevInfoFormat = n.result.otherRevInfoFormat.valueBlock.toString(), this.otherRevInfo = n.result.otherRevInfo; } toSchema() { - return new z({ value: [new Ve({ value: this.otherRevInfoFormat }), this.otherRevInfo] }); + return new z({ value: [new $e({ value: this.otherRevInfoFormat }), this.otherRevInfo] }); } toJSON() { const t = { otherRevInfoFormat: this.otherRevInfoFormat }; @@ -62520,14 +62566,14 @@ var Ea, vA = (Ea = class extends Ce { const n = t.names ?? {}; return new An({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.crls || "", - value: new Xt({ value: [J0.schema(), new ee({ + value: new en({ value: [J0.schema(), new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new Ve(), new Xe()] + value: [new $e(), new Xe()] })] }) })] }); @@ -62551,16 +62597,16 @@ var Ea, vA = (Ea = class extends Ce { }; } }, Ea.CLASS_NAME = "RevocationInfoChoices", Ea); -const ww = "certs", od = "crls", SNe = [ww, od]; -var Kl, dI = (Kl = class extends Ce { +const ww = "certs", sd = "crls", SNe = [ww, sd]; +var Hl, dI = (Hl = class extends Ce { constructor(t = {}) { - super(), this.crls = t[od] ?? Kl.defaultValues(od), t.schema && this.fromSchema(t.schema); + super(), this.crls = t[sd] ?? Hl.defaultValues(sd), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case ww: - return new Eg(); - case od: + return new Cg(); + case sd: return new vA(); default: return super.defaultValues(t); @@ -62570,7 +62616,7 @@ var Kl, dI = (Kl = class extends Ce { switch (t) { case ww: return n.certificates.length === 0; - case od: + case sd: return n.crls.length === 0 && n.otherRevocationInfos.length === 0; default: return super.defaultValues(t); @@ -62580,15 +62626,15 @@ var Kl, dI = (Kl = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ee({ + value: [new ne({ name: n.certs || "", optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: Eg.schema().valueBlock.value - }), new ee({ + value: Cg.schema().valueBlock.value + }), new ne({ name: n.crls || "", optional: !0, idBlock: { @@ -62601,21 +62647,21 @@ var Kl, dI = (Kl = class extends Ce { } fromSchema(t) { for (const r of SNe) delete t[r]; - const n = Ee(t, t, Kl.schema({ names: { + const n = Ee(t, t, Hl.schema({ names: { certs: ww, - crls: od + crls: sd } })); - ke.assertSchema(n, this.className), ww in n.result && (this.certs = new Eg({ schema: new An({ value: n.result.certs.valueBlock.value }) })), od in n.result && (this.crls = new vA({ schema: new An({ value: n.result.crls.valueBlock.value }) })); + ke.assertSchema(n, this.className), ww in n.result && (this.certs = new Cg({ schema: new An({ value: n.result.certs.valueBlock.value }) })), sd in n.result && (this.crls = new vA({ schema: new An({ value: n.result.crls.valueBlock.value }) })); } toSchema() { const t = []; - return this.certs && t.push(new ee({ + return this.certs && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: this.certs.toSchema().valueBlock.value - })), this.crls && t.push(new ee({ + })), this.crls && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 @@ -62627,7 +62673,7 @@ var Kl, dI = (Kl = class extends Ce { const t = {}; return this.certs && (t.certs = this.certs.toJSON()), this.crls && (t.crls = this.crls.toJSON()), t; } -}, Kl.CLASS_NAME = "OriginatorInfo", Kl); +}, Hl.CLASS_NAME = "OriginatorInfo", Hl); const vw = "issuer", kw = "serialNumber", xNe = [vw, kw]; var Ca, mr = (Ca = class extends Ce { constructor(t = {}) { @@ -62636,9 +62682,9 @@ var Ca, mr = (Ca = class extends Ce { static defaultValues(t) { switch (t) { case vw: - return new Qt(); + return new Zt(); case kw: - return new de(); + return new ue(); default: return super.defaultValues(t); } @@ -62647,7 +62693,7 @@ var Ca, mr = (Ca = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [Qt.schema(n.issuer || {}), new de({ name: n.serialNumber || "" })] + value: [Zt.schema(n.issuer || {}), new ue({ name: n.serialNumber || "" })] }); } fromSchema(t) { @@ -62656,7 +62702,7 @@ var Ca, mr = (Ca = class extends Ce { issuer: { names: { blockName: vw } }, serialNumber: kw } })); - ke.assertSchema(n, this.className), this.issuer = new Qt({ schema: n.result.issuer }), this.serialNumber = n.result.serialNumber; + ke.assertSchema(n, this.className), this.issuer = new Zt({ schema: n.result.issuer }), this.serialNumber = n.result.serialNumber; } toSchema() { return new z({ value: [this.issuer.toSchema(), this.serialNumber] }); @@ -62695,7 +62741,7 @@ var Ia, CNe = (Ia = class extends Ce { } static schema(t = {}) { const n = t.names ?? {}; - return new Xt({ value: [mr.schema({ names: { blockName: n.blockName || "" } }), new Je({ + return new en({ value: [mr.schema({ names: { blockName: n.blockName || "" } }), new Je({ name: n.blockName || "", idBlock: { tagClass: 3, @@ -62731,25 +62777,25 @@ var Ia, CNe = (Ia = class extends Ce { return (this.variant === 1 || this.variant === 2) && this.value && (t.value = this.value.toJSON()), t; } }, Ia.CLASS_NAME = "RecipientIdentifier", Ia); -const sd = "version", ep = "rid", tp = "keyEncryptionAlgorithm", np = "encryptedKey", ck = "recipientCertificate", INe = [ - sd, - ep, +const id = "version", tp = "rid", np = "keyEncryptionAlgorithm", rp = "encryptedKey", ck = "recipientCertificate", INe = [ + id, tp, - np + np, + rp ]; -var Ur, _O = (Ur = class extends Ce { +var Kr, _O = (Kr = class extends Ce { constructor(t = {}) { - super(), this.version = t[sd] ?? Ur.defaultValues(sd), this.rid = t[ep] ?? Ur.defaultValues(ep), this.keyEncryptionAlgorithm = t[tp] ?? Ur.defaultValues(tp), this.encryptedKey = t[np] ?? Ur.defaultValues(np), this.recipientCertificate = t[ck] ?? Ur.defaultValues(ck), t.schema && this.fromSchema(t.schema); + super(), this.version = t[id] ?? Kr.defaultValues(id), this.rid = t[tp] ?? Kr.defaultValues(tp), this.keyEncryptionAlgorithm = t[np] ?? Kr.defaultValues(np), this.encryptedKey = t[rp] ?? Kr.defaultValues(rp), this.recipientCertificate = t[ck] ?? Kr.defaultValues(ck), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case sd: + case id: return -1; - case ep: - return {}; case tp: - return new fe(); + return {}; case np: + return new de(); + case rp: return new Oe(); case ck: return new Mr(); @@ -62759,13 +62805,13 @@ var Ur, _O = (Ur = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case sd: - return n === Ur.defaultValues(sd); - case ep: - return Object.keys(n).length === 0; + case id: + return n === Kr.defaultValues(id); case tp: + return Object.keys(n).length === 0; case np: - return n.isEqual(Ur.defaultValues(t)); + case rp: + return n.isEqual(Kr.defaultValues(t)); case ck: return !1; default: @@ -62777,26 +62823,26 @@ var Ur, _O = (Ur = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), + new ue({ name: n.version || "" }), CNe.schema(n.rid || {}), - fe.schema(n.keyEncryptionAlgorithm || {}), + de.schema(n.keyEncryptionAlgorithm || {}), new Oe({ name: n.encryptedKey || "" }) ] }); } fromSchema(t) { for (const r of INe) delete t[r]; - const n = Ee(t, t, Ur.schema({ names: { - version: sd, - rid: { names: { blockName: ep } }, - keyEncryptionAlgorithm: { names: { blockName: tp } }, - encryptedKey: np + const n = Ee(t, t, Kr.schema({ names: { + version: id, + rid: { names: { blockName: tp } }, + keyEncryptionAlgorithm: { names: { blockName: np } }, + encryptedKey: rp } })); - ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, n.result.rid.idBlock.tagClass === 3 ? this.rid = new Oe({ valueHex: n.result.rid.valueBlock.valueHex }) : this.rid = new mr({ schema: n.result.rid }), this.keyEncryptionAlgorithm = new fe({ schema: n.result.keyEncryptionAlgorithm }), this.encryptedKey = n.result.encryptedKey; + ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, n.result.rid.idBlock.tagClass === 3 ? this.rid = new Oe({ valueHex: n.result.rid.valueBlock.valueHex }) : this.rid = new mr({ schema: n.result.rid }), this.keyEncryptionAlgorithm = new de({ schema: n.result.keyEncryptionAlgorithm }), this.encryptedKey = n.result.encryptedKey; } toSchema() { const t = []; - return this.rid instanceof mr ? (this.version = 0, t.push(new de({ value: this.version })), t.push(this.rid.toSchema())) : (this.version = 2, t.push(new de({ value: this.version })), t.push(new Je({ + return this.rid instanceof mr ? (this.version = 0, t.push(new ue({ value: this.version })), t.push(this.rid.toSchema())) : (this.version = 2, t.push(new ue({ value: this.version })), t.push(new Je({ idBlock: { tagClass: 3, tagNumber: 0 @@ -62812,26 +62858,26 @@ var Ur, _O = (Ur = class extends Ce { encryptedKey: this.encryptedKey.toJSON() }; } -}, Ur.CLASS_NAME = "KeyTransRecipientInfo", Ur); -const rp = "algorithm", op = "publicKey", NNe = [rp, op]; +}, Kr.CLASS_NAME = "KeyTransRecipientInfo", Kr); +const op = "algorithm", sp = "publicKey", NNe = [op, sp]; var Zs, LO = (Zs = class extends Ce { constructor(t = {}) { - super(), this.algorithm = t[rp] ?? Zs.defaultValues(rp), this.publicKey = t[op] ?? Zs.defaultValues(op), t.schema && this.fromSchema(t.schema); + super(), this.algorithm = t[op] ?? Zs.defaultValues(op), this.publicKey = t[sp] ?? Zs.defaultValues(sp), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case rp: - return new fe(); case op: - return new ht(); + return new de(); + case sp: + return new pt(); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case rp: case op: + case sp: return n.isEqual(Zs.defaultValues(t)); default: return super.defaultValues(t); @@ -62841,16 +62887,16 @@ var Zs, LO = (Zs = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [fe.schema(n.algorithm || {}), new ht({ name: n.publicKey || "" })] + value: [de.schema(n.algorithm || {}), new pt({ name: n.publicKey || "" })] }); } fromSchema(t) { for (const r of NNe) delete t[r]; const n = Ee(t, t, Zs.schema({ names: { - algorithm: { names: { blockName: rp } }, - publicKey: op + algorithm: { names: { blockName: op } }, + publicKey: sp } })); - ke.assertSchema(n, this.className), this.algorithm = new fe({ schema: n.result.algorithm }), this.publicKey = n.result.publicKey; + ke.assertSchema(n, this.className), this.algorithm = new de({ schema: n.result.algorithm }), this.publicKey = n.result.publicKey; } toSchema() { return new z({ value: [this.algorithm.toSchema(), this.publicKey] }); @@ -62889,7 +62935,7 @@ var Na, kA = (Na = class extends Ce { } static schema(t = {}) { const n = t.names ?? {}; - return new Xt({ value: [ + return new en({ value: [ mr.schema({ names: { blockName: n.blockName || "" } }), new Je({ idBlock: { @@ -62898,7 +62944,7 @@ var Na, kA = (Na = class extends Ce { }, name: n.blockName || "" }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 1 @@ -62932,14 +62978,14 @@ var Na, kA = (Na = class extends Ce { return (this.variant === 1 || this.variant === 2 || this.variant === 3) && (t.value = this.value.toJSON()), t; } }, Na.CLASS_NAME = "OriginatorIdentifierOrKey", Na); -const sp = "keyAttrId", Is = "keyAttr", PNe = [sp, Is]; -var Oa, Cg = (Oa = class extends Ce { +const ip = "keyAttrId", Is = "keyAttr", PNe = [ip, Is]; +var Oa, Ig = (Oa = class extends Ce { constructor(t = {}) { - super(), this.keyAttrId = t[sp] ?? Oa.defaultValues(sp), Is in t && (this.keyAttr = t[Is] ?? Oa.defaultValues(Is)), t.schema && this.fromSchema(t.schema); + super(), this.keyAttrId = t[ip] ?? Oa.defaultValues(ip), Is in t && (this.keyAttr = t[Is] ?? Oa.defaultValues(Is)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case sp: + case ip: return ""; case Is: return {}; @@ -62949,7 +62995,7 @@ var Oa, Cg = (Oa = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case sp: + case ip: return typeof n == "string" && n === ""; case Is: return Object.keys(n).length === 0; @@ -62962,7 +63008,7 @@ var Oa, Cg = (Oa = class extends Ce { return new z({ optional: n.optional || !0, name: n.blockName || "", - value: [new Ve({ name: n.keyAttrId || "" }), new Xe({ + value: [new $e({ name: n.keyAttrId || "" }), new Xe({ optional: !0, name: n.keyAttr || "" })] @@ -62971,48 +63017,48 @@ var Oa, Cg = (Oa = class extends Ce { fromSchema(t) { for (const r of PNe) delete t[r]; const n = Ee(t, t, Oa.schema({ names: { - keyAttrId: sp, + keyAttrId: ip, keyAttr: Is } })); ke.assertSchema(n, this.className), this.keyAttrId = n.result.keyAttrId.valueBlock.toString(), Is in n.result && (this.keyAttr = n.result.keyAttr); } toSchema() { const t = []; - return t.push(new Ve({ value: this.keyAttrId })), Is in this && t.push(this.keyAttr), new z({ value: t }); + return t.push(new $e({ value: this.keyAttrId })), Is in this && t.push(this.keyAttr), new z({ value: t }); } toJSON() { const t = { keyAttrId: this.keyAttrId }; return Is in this && (t.keyAttr = this.keyAttr.toJSON()), t; } }, Oa.CLASS_NAME = "OtherKeyAttribute", Oa); -const id = "subjectKeyIdentifier", Fc = "date", Vc = "other", RNe = [ - id, - Fc, - Vc +const ad = "subjectKeyIdentifier", Vc = "date", $c = "other", RNe = [ + ad, + Vc, + $c ]; var us, DO = (us = class extends Ce { constructor(t = {}) { - super(), this.subjectKeyIdentifier = t[id] ?? us.defaultValues(id), Fc in t && (this.date = t[Fc] ?? us.defaultValues(Fc)), Vc in t && (this.other = t[Vc] ?? us.defaultValues(Vc)), t.schema && this.fromSchema(t.schema); + super(), this.subjectKeyIdentifier = t[ad] ?? us.defaultValues(ad), Vc in t && (this.date = t[Vc] ?? us.defaultValues(Vc)), $c in t && (this.other = t[$c] ?? us.defaultValues($c)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case id: + case ad: return new Oe(); - case Fc: - return new Yt(); case Vc: - return new Cg(); + return new Xt(); + case $c: + return new Ig(); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case id: - return n.isEqual(us.defaultValues(id)); - case Fc: - return n.year === 0 && n.month === 0 && n.day === 0 && n.hour === 0 && n.minute === 0 && n.second === 0 && n.millisecond === 0; + case ad: + return n.isEqual(us.defaultValues(ad)); case Vc: + return n.year === 0 && n.month === 0 && n.day === 0 && n.hour === 0 && n.minute === 0 && n.second === 0 && n.millisecond === 0; + case $c: return n.keyAttrId === "" && !("keyAttr" in n); default: return super.defaultValues(t); @@ -63024,22 +63070,22 @@ var us, DO = (us = class extends Ce { name: n.blockName || "", value: [ new Oe({ name: n.subjectKeyIdentifier || "" }), - new Yt({ + new Xt({ optional: !0, name: n.date || "" }), - Cg.schema(n.other || {}) + Ig.schema(n.other || {}) ] }); } fromSchema(t) { for (const r of RNe) delete t[r]; const n = Ee(t, t, us.schema({ names: { - subjectKeyIdentifier: id, - date: Fc, - other: { names: { blockName: Vc } } + subjectKeyIdentifier: ad, + date: Vc, + other: { names: { blockName: $c } } } })); - ke.assertSchema(n, this.className), this.subjectKeyIdentifier = n.result.subjectKeyIdentifier, Fc in n.result && (this.date = n.result.date), Vc in n.result && (this.other = new Cg({ schema: n.result.other })); + ke.assertSchema(n, this.className), this.subjectKeyIdentifier = n.result.subjectKeyIdentifier, Vc in n.result && (this.date = n.result.date), $c in n.result && (this.other = new Ig({ schema: n.result.other })); } toSchema() { const t = []; @@ -63077,7 +63123,7 @@ var Pa, l0 = (Pa = class extends Ce { } static schema(t = {}) { const n = t.names ?? {}; - return new Xt({ value: [mr.schema(n.issuerAndSerialNumber || { names: { blockName: n.blockName || "" } }), new ee({ + return new en({ value: [mr.schema(n.issuerAndSerialNumber || { names: { blockName: n.blockName || "" } }), new ne({ name: n.blockName || "", idBlock: { tagClass: 3, @@ -63096,7 +63142,7 @@ var Pa, l0 = (Pa = class extends Ce { case 1: return this.value.toSchema(); case 2: - return new ee({ + return new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -63112,16 +63158,16 @@ var Pa, l0 = (Pa = class extends Ce { return (this.variant === 1 || this.variant === 2) && (t.value = this.value.toJSON()), t; } }, Pa.CLASS_NAME = "KeyAgreeRecipientIdentifier", Pa); -const ip = "rid", ad = "encryptedKey", MNe = [ip, ad]; +const ap = "rid", cd = "encryptedKey", MNe = [ap, cd]; var ei, jO = (ei = class extends Ce { constructor(t = {}) { - super(), this.rid = t[ip] ?? ei.defaultValues(ip), this.encryptedKey = t[ad] ?? ei.defaultValues(ad), t.schema && this.fromSchema(t.schema); + super(), this.rid = t[ap] ?? ei.defaultValues(ap), this.encryptedKey = t[cd] ?? ei.defaultValues(cd), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case ip: + case ap: return new l0(); - case ad: + case cd: return new Oe(); default: return super.defaultValues(t); @@ -63129,10 +63175,10 @@ var ei, jO = (ei = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case ip: + case ap: return n.variant === -1 && !("value" in n); - case ad: - return n.isEqual(ei.defaultValues(ad)); + case cd: + return n.isEqual(ei.defaultValues(cd)); default: return super.defaultValues(t); } @@ -63147,8 +63193,8 @@ var ei, jO = (ei = class extends Ce { fromSchema(t) { for (const r of MNe) delete t[r]; const n = Ee(t, t, ei.schema({ names: { - rid: { names: { blockName: ip } }, - encryptedKey: ad + rid: { names: { blockName: ap } }, + encryptedKey: cd } })); ke.assertSchema(n, this.className), this.rid = new l0({ schema: n.result.rid }), this.encryptedKey = n.result.encryptedKey; } @@ -63163,9 +63209,9 @@ var ei, jO = (ei = class extends Ce { } }, ei.CLASS_NAME = "RecipientEncryptedKey", ei); const fk = "encryptedKeys", Eq = "RecipientEncryptedKeys", BNe = [Eq]; -var Hl, AA = (Hl = class extends Ce { +var zl, AA = (zl = class extends Ce { constructor(t = {}) { - super(), this.encryptedKeys = t[fk] ?? Hl.defaultValues(fk), t.schema && this.fromSchema(t.schema); + super(), this.encryptedKeys = t[fk] ?? zl.defaultValues(fk), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -63187,7 +63233,7 @@ var Hl, AA = (Hl = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.RecipientEncryptedKeys || "", value: jO.schema() })] @@ -63195,7 +63241,7 @@ var Hl, AA = (Hl = class extends Ce { } fromSchema(t) { for (const r of BNe) delete t[r]; - const n = Ee(t, t, Hl.schema({ names: { RecipientEncryptedKeys: Eq } })); + const n = Ee(t, t, zl.schema({ names: { RecipientEncryptedKeys: Eq } })); ke.assertSchema(n, this.className), this.encryptedKeys = Array.from(n.result.RecipientEncryptedKeys, (r) => new jO({ schema: r })); } toSchema() { @@ -63204,29 +63250,29 @@ var Hl, AA = (Hl = class extends Ce { toJSON() { return { encryptedKeys: Array.from(this.encryptedKeys, (t) => t.toJSON()) }; } -}, Hl.CLASS_NAME = "RecipientEncryptedKeys", Hl); -const ap = "version", cp = "originator", zi = "ukm", lp = "keyEncryptionAlgorithm", up = "recipientEncryptedKeys", hk = "recipientCertificate", pk = "recipientPublicKey", _Ne = [ - ap, +}, zl.CLASS_NAME = "RecipientEncryptedKeys", zl); +const cp = "version", lp = "originator", zi = "ukm", up = "keyEncryptionAlgorithm", dp = "recipientEncryptedKeys", hk = "recipientCertificate", pk = "recipientPublicKey", _Ne = [ cp, - zi, lp, - up + zi, + up, + dp ]; var Sr, FO = (Sr = class extends Ce { constructor(t = {}) { - super(), this.version = t[ap] ?? Sr.defaultValues(ap), this.originator = t[cp] ?? Sr.defaultValues(cp), zi in t && (this.ukm = t[zi] ?? Sr.defaultValues(zi)), this.keyEncryptionAlgorithm = t[lp] ?? Sr.defaultValues(lp), this.recipientEncryptedKeys = t[up] ?? Sr.defaultValues(up), this.recipientCertificate = t[hk] ?? Sr.defaultValues(hk), this.recipientPublicKey = t[pk] ?? Sr.defaultValues(pk), t.schema && this.fromSchema(t.schema); + super(), this.version = t[cp] ?? Sr.defaultValues(cp), this.originator = t[lp] ?? Sr.defaultValues(lp), zi in t && (this.ukm = t[zi] ?? Sr.defaultValues(zi)), this.keyEncryptionAlgorithm = t[up] ?? Sr.defaultValues(up), this.recipientEncryptedKeys = t[dp] ?? Sr.defaultValues(dp), this.recipientCertificate = t[hk] ?? Sr.defaultValues(hk), this.recipientPublicKey = t[pk] ?? Sr.defaultValues(pk), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case ap: - return 0; case cp: + return 0; + case lp: return new kA(); case zi: return new Oe(); - case lp: - return new fe(); case up: + return new de(); + case dp: return new AA(); case hk: return new Mr(); @@ -63238,15 +63284,15 @@ var Sr, FO = (Sr = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case ap: - return n === 0; case cp: + return n === 0; + case lp: return n.variant === -1 && !("value" in n); case zi: return n.isEqual(Sr.defaultValues(zi)); - case lp: - return n.algorithmId === "" && !("algorithmParams" in n); case up: + return n.algorithmId === "" && !("algorithmParams" in n); + case dp: return n.encryptedKeys.length === 0; case hk: return !1; @@ -63261,15 +63307,15 @@ var Sr, FO = (Sr = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), - new ee({ + new ue({ name: n.version || "" }), + new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: [kA.schema(n.originator || {})] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, @@ -63277,7 +63323,7 @@ var Sr, FO = (Sr = class extends Ce { }, value: [new Oe({ name: n.ukm || "" })] }), - fe.schema(n.keyEncryptionAlgorithm || {}), + de.schema(n.keyEncryptionAlgorithm || {}), AA.schema(n.recipientEncryptedKeys || {}) ] }); @@ -63285,23 +63331,23 @@ var Sr, FO = (Sr = class extends Ce { fromSchema(t) { for (const r of _Ne) delete t[r]; const n = Ee(t, t, Sr.schema({ names: { - version: ap, - originator: { names: { blockName: cp } }, + version: cp, + originator: { names: { blockName: lp } }, ukm: zi, - keyEncryptionAlgorithm: { names: { blockName: lp } }, - recipientEncryptedKeys: { names: { blockName: up } } + keyEncryptionAlgorithm: { names: { blockName: up } }, + recipientEncryptedKeys: { names: { blockName: dp } } } })); - ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.originator = new kA({ schema: n.result.originator }), zi in n.result && (this.ukm = n.result.ukm), this.keyEncryptionAlgorithm = new fe({ schema: n.result.keyEncryptionAlgorithm }), this.recipientEncryptedKeys = new AA({ schema: n.result.recipientEncryptedKeys }); + ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.originator = new kA({ schema: n.result.originator }), zi in n.result && (this.ukm = n.result.ukm), this.keyEncryptionAlgorithm = new de({ schema: n.result.keyEncryptionAlgorithm }), this.recipientEncryptedKeys = new AA({ schema: n.result.recipientEncryptedKeys }); } toSchema() { const t = []; - return t.push(new de({ value: this.version })), t.push(new ee({ + return t.push(new ue({ value: this.version })), t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: [this.originator.toSchema()] - })), this.ukm && t.push(new ee({ + })), this.ukm && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -63320,34 +63366,34 @@ var Sr, FO = (Sr = class extends Ce { return this.ukm && (t.ukm = this.ukm.toJSON()), t; } }, Sr.CLASS_NAME = "KeyAgreeRecipientInfo", Sr); -const cd = "keyIdentifier", $c = "date", Uc = "other", LNe = [ - cd, - $c, - Uc +const ld = "keyIdentifier", Uc = "date", Kc = "other", LNe = [ + ld, + Uc, + Kc ]; var ds, SA = (ds = class extends Ce { constructor(t = {}) { - super(), this.keyIdentifier = t[cd] ?? ds.defaultValues(cd), $c in t && (this.date = t[$c] ?? ds.defaultValues($c)), Uc in t && (this.other = t[Uc] ?? ds.defaultValues(Uc)), t.schema && this.fromSchema(t.schema); + super(), this.keyIdentifier = t[ld] ?? ds.defaultValues(ld), Uc in t && (this.date = t[Uc] ?? ds.defaultValues(Uc)), Kc in t && (this.other = t[Kc] ?? ds.defaultValues(Kc)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case cd: + case ld: return new Oe(); - case $c: - return new Yt(); case Uc: - return new Cg(); + return new Xt(); + case Kc: + return new Ig(); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case cd: - return n.isEqual(ds.defaultValues(cd)); - case $c: - return n.year === 0 && n.month === 0 && n.day === 0 && n.hour === 0 && n.minute === 0 && n.second === 0 && n.millisecond === 0; + case ld: + return n.isEqual(ds.defaultValues(ld)); case Uc: + return n.year === 0 && n.month === 0 && n.day === 0 && n.hour === 0 && n.minute === 0 && n.second === 0 && n.millisecond === 0; + case Kc: return n.compareWithDefault("keyAttrId", n.keyAttrId) && !("keyAttr" in n); default: return super.defaultValues(t); @@ -63359,22 +63405,22 @@ var ds, SA = (ds = class extends Ce { name: n.blockName || "", value: [ new Oe({ name: n.keyIdentifier || "" }), - new Yt({ + new Xt({ optional: !0, name: n.date || "" }), - Cg.schema(n.other || {}) + Ig.schema(n.other || {}) ] }); } fromSchema(t) { for (const r of LNe) delete t[r]; const n = Ee(t, t, ds.schema({ names: { - keyIdentifier: cd, - date: $c, - other: { names: { blockName: Uc } } + keyIdentifier: ld, + date: Uc, + other: { names: { blockName: Kc } } } })); - ke.assertSchema(n, this.className), this.keyIdentifier = n.result.keyIdentifier, $c in n.result && (this.date = n.result.date), Uc in n.result && (this.other = new Cg({ schema: n.result.other })); + ke.assertSchema(n, this.className), this.keyIdentifier = n.result.keyIdentifier, Uc in n.result && (this.date = n.result.date), Kc in n.result && (this.other = new Ig({ schema: n.result.other })); } toSchema() { const t = []; @@ -63385,25 +63431,25 @@ var ds, SA = (ds = class extends Ce { return this.date && (t.date = this.date), this.other && (t.other = this.other.toJSON()), t; } }, ds.CLASS_NAME = "KEKIdentifier", ds); -const dp = "version", fp = "kekid", hp = "keyEncryptionAlgorithm", ld = "encryptedKey", gk = "preDefinedKEK", DNe = [ - dp, +const fp = "version", hp = "kekid", pp = "keyEncryptionAlgorithm", ud = "encryptedKey", gk = "preDefinedKEK", DNe = [ fp, hp, - ld + pp, + ud ]; -var Kr, VO = (Kr = class extends Ce { +var Hr, VO = (Hr = class extends Ce { constructor(t = {}) { - super(), this.version = t[dp] ?? Kr.defaultValues(dp), this.kekid = t[fp] ?? Kr.defaultValues(fp), this.keyEncryptionAlgorithm = t[hp] ?? Kr.defaultValues(hp), this.encryptedKey = t[ld] ?? Kr.defaultValues(ld), this.preDefinedKEK = t[gk] ?? Kr.defaultValues(gk), t.schema && this.fromSchema(t.schema); + super(), this.version = t[fp] ?? Hr.defaultValues(fp), this.kekid = t[hp] ?? Hr.defaultValues(hp), this.keyEncryptionAlgorithm = t[pp] ?? Hr.defaultValues(pp), this.encryptedKey = t[ud] ?? Hr.defaultValues(ud), this.preDefinedKEK = t[gk] ?? Hr.defaultValues(gk), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case dp: - return 0; case fp: - return new SA(); + return 0; case hp: - return new fe(); - case ld: + return new SA(); + case pp: + return new de(); + case ud: return new Oe(); case gk: return Dn; @@ -63414,13 +63460,13 @@ var Kr, VO = (Kr = class extends Ce { static compareWithDefault(t, n) { switch (t) { case "KEKRecipientInfo": - return n === Kr.defaultValues(dp); - case fp: - return n.compareWithDefault("keyIdentifier", n.keyIdentifier) && !("date" in n) && !("other" in n); + return n === Hr.defaultValues(fp); case hp: + return n.compareWithDefault("keyIdentifier", n.keyIdentifier) && !("date" in n) && !("other" in n); + case pp: return n.algorithmId === "" && !("algorithmParams" in n); - case ld: - return n.isEqual(Kr.defaultValues(ld)); + case ud: + return n.isEqual(Hr.defaultValues(ud)); case gk: return n.byteLength === 0; default: @@ -63432,26 +63478,26 @@ var Kr, VO = (Kr = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), + new ue({ name: n.version || "" }), SA.schema(n.kekid || {}), - fe.schema(n.keyEncryptionAlgorithm || {}), + de.schema(n.keyEncryptionAlgorithm || {}), new Oe({ name: n.encryptedKey || "" }) ] }); } fromSchema(t) { for (const r of DNe) delete t[r]; - const n = Ee(t, t, Kr.schema({ names: { - version: dp, - kekid: { names: { blockName: fp } }, - keyEncryptionAlgorithm: { names: { blockName: hp } }, - encryptedKey: ld + const n = Ee(t, t, Hr.schema({ names: { + version: fp, + kekid: { names: { blockName: hp } }, + keyEncryptionAlgorithm: { names: { blockName: pp } }, + encryptedKey: ud } })); - ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.kekid = new SA({ schema: n.result.kekid }), this.keyEncryptionAlgorithm = new fe({ schema: n.result.keyEncryptionAlgorithm }), this.encryptedKey = n.result.encryptedKey; + ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.kekid = new SA({ schema: n.result.kekid }), this.keyEncryptionAlgorithm = new de({ schema: n.result.keyEncryptionAlgorithm }), this.encryptedKey = n.result.encryptedKey; } toSchema() { return new z({ value: [ - new de({ value: this.version }), + new ue({ value: this.version }), this.kekid.toSchema(), this.keyEncryptionAlgorithm.toSchema(), this.encryptedKey @@ -63465,26 +63511,26 @@ var Kr, VO = (Kr = class extends Ce { encryptedKey: this.encryptedKey.toJSON() }; } -}, Kr.CLASS_NAME = "KEKRecipientInfo", Kr); -const pp = "version", Kc = "keyDerivationAlgorithm", gp = "keyEncryptionAlgorithm", ud = "encryptedKey", mk = "password", jNe = [ - pp, - Kc, +}, Hr.CLASS_NAME = "KEKRecipientInfo", Hr); +const gp = "version", Hc = "keyDerivationAlgorithm", mp = "keyEncryptionAlgorithm", dd = "encryptedKey", mk = "password", jNe = [ gp, - ud + Hc, + mp, + dd ]; -var so, $O = (so = class extends Ce { +var io, $O = (io = class extends Ce { constructor(t = {}) { - super(), this.version = t[pp] ?? so.defaultValues(pp), Kc in t && (this.keyDerivationAlgorithm = t[Kc] ?? so.defaultValues(Kc)), this.keyEncryptionAlgorithm = t[gp] ?? so.defaultValues(gp), this.encryptedKey = t[ud] ?? so.defaultValues(ud), this.password = t[mk] ?? so.defaultValues(mk), t.schema && this.fromSchema(t.schema); + super(), this.version = t[gp] ?? io.defaultValues(gp), Hc in t && (this.keyDerivationAlgorithm = t[Hc] ?? io.defaultValues(Hc)), this.keyEncryptionAlgorithm = t[mp] ?? io.defaultValues(mp), this.encryptedKey = t[dd] ?? io.defaultValues(dd), this.password = t[mk] ?? io.defaultValues(mk), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case pp: - return -1; - case Kc: - return new fe(); case gp: - return new fe(); - case ud: + return -1; + case Hc: + return new de(); + case mp: + return new de(); + case dd: return new Oe(); case mk: return Dn; @@ -63494,13 +63540,13 @@ var so, $O = (so = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case pp: - return n === -1; - case Kc: case gp: + return n === -1; + case Hc: + case mp: return n.algorithmId === "" && !("algorithmParams" in n); - case ud: - return n.isEqual(so.defaultValues(ud)); + case dd: + return n.isEqual(io.defaultValues(dd)); case mk: return n.byteLength === 0; default: @@ -63512,34 +63558,34 @@ var so, $O = (so = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), - new ee({ + new ue({ name: n.version || "" }), + new ne({ name: n.keyDerivationAlgorithm || "", optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: fe.schema().valueBlock.value + value: de.schema().valueBlock.value }), - fe.schema(n.keyEncryptionAlgorithm || {}), + de.schema(n.keyEncryptionAlgorithm || {}), new Oe({ name: n.encryptedKey || "" }) ] }); } fromSchema(t) { for (const r of jNe) delete t[r]; - const n = Ee(t, t, so.schema({ names: { - version: pp, - keyDerivationAlgorithm: Kc, - keyEncryptionAlgorithm: { names: { blockName: gp } }, - encryptedKey: ud + const n = Ee(t, t, io.schema({ names: { + version: gp, + keyDerivationAlgorithm: Hc, + keyEncryptionAlgorithm: { names: { blockName: mp } }, + encryptedKey: dd } })); - ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, Kc in n.result && (this.keyDerivationAlgorithm = new fe({ schema: new z({ value: n.result.keyDerivationAlgorithm.valueBlock.value }) })), this.keyEncryptionAlgorithm = new fe({ schema: n.result.keyEncryptionAlgorithm }), this.encryptedKey = n.result.encryptedKey; + ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, Hc in n.result && (this.keyDerivationAlgorithm = new de({ schema: new z({ value: n.result.keyDerivationAlgorithm.valueBlock.value }) })), this.keyEncryptionAlgorithm = new de({ schema: n.result.keyEncryptionAlgorithm }), this.encryptedKey = n.result.encryptedKey; } toSchema() { const t = []; - return t.push(new de({ value: this.version })), this.keyDerivationAlgorithm && t.push(new ee({ + return t.push(new ue({ value: this.version })), this.keyDerivationAlgorithm && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -63555,17 +63601,17 @@ var so, $O = (so = class extends Ce { }; return this.keyDerivationAlgorithm && (t.keyDerivationAlgorithm = this.keyDerivationAlgorithm.toJSON()), t; } -}, so.CLASS_NAME = "PasswordRecipientInfo", so); -const mp = "oriType", dd = "oriValue", FNe = [mp, dd]; +}, io.CLASS_NAME = "PasswordRecipientInfo", io); +const yp = "oriType", fd = "oriValue", FNe = [yp, fd]; var ti, L4 = (ti = class extends Ce { constructor(t = {}) { - super(), this.oriType = t[mp] ?? ti.defaultValues(mp), this.oriValue = t[dd] ?? ti.defaultValues(dd), t.schema && this.fromSchema(t.schema); + super(), this.oriType = t[yp] ?? ti.defaultValues(yp), this.oriValue = t[fd] ?? ti.defaultValues(fd), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case mp: + case yp: return ""; - case dd: + case fd: return {}; default: return super.defaultValues(t); @@ -63573,9 +63619,9 @@ var ti, L4 = (ti = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case mp: + case yp: return n === ""; - case dd: + case fd: return Object.keys(n).length === 0; default: return super.defaultValues(t); @@ -63585,27 +63631,27 @@ var ti, L4 = (ti = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.oriType || "" }), new Xe({ name: n.oriValue || "" })] + value: [new $e({ name: n.oriType || "" }), new Xe({ name: n.oriValue || "" })] }); } fromSchema(t) { for (const r of FNe) delete t[r]; const n = Ee(t, t, ti.schema({ names: { - oriType: mp, - oriValue: dd + oriType: yp, + oriValue: fd } })); ke.assertSchema(n, this.className), this.oriType = n.result.oriType.valueBlock.toString(), this.oriValue = n.result.oriValue; } toSchema() { - return new z({ value: [new Ve({ value: this.oriType }), this.oriValue] }); + return new z({ value: [new $e({ value: this.oriType }), this.oriValue] }); } toJSON() { const t = { oriType: this.oriType }; - return ti.compareWithDefault(dd, this.oriValue) || (t.oriValue = this.oriValue.toJSON()), t; + return ti.compareWithDefault(fd, this.oriValue) || (t.oriValue = this.oriValue.toJSON()), t; } }, ti.CLASS_NAME = "OtherRecipientInfo", ti); const yk = "variant", Ny = "value", VNe = ["blockName"]; -var ni, wh = (ni = class extends Ce { +var ni, kh = (ni = class extends Ce { constructor(t = {}) { super(), this.variant = t[yk] ?? ni.defaultValues(yk), Ny in t && (this.value = t[Ny] ?? ni.defaultValues(Ny)), t.schema && this.fromSchema(t.schema); } @@ -63631,9 +63677,9 @@ var ni, wh = (ni = class extends Ce { } static schema(t = {}) { const n = t.names ?? {}; - return new Xt({ value: [ + return new en({ value: [ _O.schema({ names: { blockName: n.blockName || "" } }), - new ee({ + new ne({ name: n.blockName || "", idBlock: { tagClass: 3, @@ -63641,7 +63687,7 @@ var ni, wh = (ni = class extends Ce { }, value: FO.schema().valueBlock.value }), - new ee({ + new ne({ name: n.blockName || "", idBlock: { tagClass: 3, @@ -63649,7 +63695,7 @@ var ni, wh = (ni = class extends Ce { }, value: VO.schema().valueBlock.value }), - new ee({ + new ne({ name: n.blockName || "", idBlock: { tagClass: 3, @@ -63657,7 +63703,7 @@ var ni, wh = (ni = class extends Ce { }, value: $O.schema().valueBlock.value }), - new ee({ + new ne({ name: n.blockName || "", idBlock: { tagClass: 3, @@ -63693,7 +63739,7 @@ var ni, wh = (ni = class extends Ce { } } toSchema() { - Ct.assertEmpty(this.value, "value", "RecipientInfo"); + Ot.assertEmpty(this.value, "value", "RecipientInfo"); const t = this.value.toSchema(); switch (this.variant) { case 1: @@ -63711,32 +63757,32 @@ var ni, wh = (ni = class extends Ce { return this.value && this.variant >= 1 && this.variant <= 4 && (t.value = this.value.toJSON()), t; } }, ni.CLASS_NAME = "RecipientInfo", ni); -const Hc = "hashAlgorithm", zc = "maskGenAlgorithm", Wc = "pSourceAlgorithm", $Ne = [ - Hc, +const zc = "hashAlgorithm", Wc = "maskGenAlgorithm", qc = "pSourceAlgorithm", $Ne = [ zc, - Wc + Wc, + qc ]; -var ur, fI = (ur = class extends Ce { +var dr, fI = (dr = class extends Ce { constructor(t = {}) { - super(), this.hashAlgorithm = t[Hc] ?? ur.defaultValues(Hc), this.maskGenAlgorithm = t[zc] ?? ur.defaultValues(zc), this.pSourceAlgorithm = t[Wc] ?? ur.defaultValues(Wc), t.schema && this.fromSchema(t.schema); + super(), this.hashAlgorithm = t[zc] ?? dr.defaultValues(zc), this.maskGenAlgorithm = t[Wc] ?? dr.defaultValues(Wc), this.pSourceAlgorithm = t[qc] ?? dr.defaultValues(qc), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Hc: - return new fe({ + case zc: + return new de({ algorithmId: "1.3.14.3.2.26", - algorithmParams: new fn() + algorithmParams: new hn() }); - case zc: - return new fe({ + case Wc: + return new de({ algorithmId: "1.2.840.113549.1.1.8", - algorithmParams: new fe({ + algorithmParams: new de({ algorithmId: "1.3.14.3.2.26", - algorithmParams: new fn() + algorithmParams: new hn() }).toSchema() }); - case Wc: - return new fe({ + case qc: + return new de({ algorithmId: "1.2.840.113549.1.1.9", algorithmParams: new Oe({ valueHex: new Uint8Array([ 218, @@ -63770,57 +63816,57 @@ var ur, fI = (ur = class extends Ce { return new z({ name: n.blockName || "", value: [ - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, optional: !0, - value: [fe.schema(n.hashAlgorithm || {})] + value: [de.schema(n.hashAlgorithm || {})] }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, optional: !0, - value: [fe.schema(n.maskGenAlgorithm || {})] + value: [de.schema(n.maskGenAlgorithm || {})] }), - new ee({ + new ne({ idBlock: { tagClass: 3, tagNumber: 2 }, optional: !0, - value: [fe.schema(n.pSourceAlgorithm || {})] + value: [de.schema(n.pSourceAlgorithm || {})] }) ] }); } fromSchema(t) { for (const r of $Ne) delete t[r]; - const n = Ee(t, t, ur.schema({ names: { - hashAlgorithm: { names: { blockName: Hc } }, - maskGenAlgorithm: { names: { blockName: zc } }, - pSourceAlgorithm: { names: { blockName: Wc } } + const n = Ee(t, t, dr.schema({ names: { + hashAlgorithm: { names: { blockName: zc } }, + maskGenAlgorithm: { names: { blockName: Wc } }, + pSourceAlgorithm: { names: { blockName: qc } } } })); - ke.assertSchema(n, this.className), Hc in n.result && (this.hashAlgorithm = new fe({ schema: n.result.hashAlgorithm })), zc in n.result && (this.maskGenAlgorithm = new fe({ schema: n.result.maskGenAlgorithm })), Wc in n.result && (this.pSourceAlgorithm = new fe({ schema: n.result.pSourceAlgorithm })); + ke.assertSchema(n, this.className), zc in n.result && (this.hashAlgorithm = new de({ schema: n.result.hashAlgorithm })), Wc in n.result && (this.maskGenAlgorithm = new de({ schema: n.result.maskGenAlgorithm })), qc in n.result && (this.pSourceAlgorithm = new de({ schema: n.result.pSourceAlgorithm })); } toSchema() { const t = []; - return this.hashAlgorithm.isEqual(ur.defaultValues(Hc)) || t.push(new ee({ + return this.hashAlgorithm.isEqual(dr.defaultValues(zc)) || t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: [this.hashAlgorithm.toSchema()] - })), this.maskGenAlgorithm.isEqual(ur.defaultValues(zc)) || t.push(new ee({ + })), this.maskGenAlgorithm.isEqual(dr.defaultValues(Wc)) || t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, value: [this.maskGenAlgorithm.toSchema()] - })), this.pSourceAlgorithm.isEqual(ur.defaultValues(Wc)) || t.push(new ee({ + })), this.pSourceAlgorithm.isEqual(dr.defaultValues(qc)) || t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 2 @@ -63830,25 +63876,25 @@ var ur, fI = (ur = class extends Ce { } toJSON() { const t = {}; - return this.hashAlgorithm.isEqual(ur.defaultValues(Hc)) || (t.hashAlgorithm = this.hashAlgorithm.toJSON()), this.maskGenAlgorithm.isEqual(ur.defaultValues(zc)) || (t.maskGenAlgorithm = this.maskGenAlgorithm.toJSON()), this.pSourceAlgorithm.isEqual(ur.defaultValues(Wc)) || (t.pSourceAlgorithm = this.pSourceAlgorithm.toJSON()), t; + return this.hashAlgorithm.isEqual(dr.defaultValues(zc)) || (t.hashAlgorithm = this.hashAlgorithm.toJSON()), this.maskGenAlgorithm.isEqual(dr.defaultValues(Wc)) || (t.maskGenAlgorithm = this.maskGenAlgorithm.toJSON()), this.pSourceAlgorithm.isEqual(dr.defaultValues(qc)) || (t.pSourceAlgorithm = this.pSourceAlgorithm.toJSON()), t; } -}, ur.CLASS_NAME = "RSAESOAEPParams", ur); -const yp = "keyInfo", qc = "entityUInfo", bp = "suppPubInfo", UNe = [ - yp, - qc, - bp +}, dr.CLASS_NAME = "RSAESOAEPParams", dr); +const bp = "keyInfo", Gc = "entityUInfo", wp = "suppPubInfo", UNe = [ + bp, + Gc, + wp ]; var fs, D4 = (fs = class extends Ce { constructor(t = {}) { - super(), this.keyInfo = t[yp] ?? fs.defaultValues(yp), qc in t && (this.entityUInfo = t[qc] ?? fs.defaultValues(qc)), this.suppPubInfo = t[bp] ?? fs.defaultValues(bp), t.schema && this.fromSchema(t.schema); + super(), this.keyInfo = t[bp] ?? fs.defaultValues(bp), Gc in t && (this.entityUInfo = t[Gc] ?? fs.defaultValues(Gc)), this.suppPubInfo = t[wp] ?? fs.defaultValues(wp), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case yp: - return new fe(); - case qc: - return new Oe(); case bp: + return new de(); + case Gc: + return new Oe(); + case wp: return new Oe(); default: return super.defaultValues(t); @@ -63856,9 +63902,9 @@ var fs, D4 = (fs = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case yp: - case qc: case bp: + case Gc: + case wp: return n.isEqual(fs.defaultValues(t)); default: return super.defaultValues(t); @@ -63869,8 +63915,8 @@ var fs, D4 = (fs = class extends Ce { return new z({ name: n.blockName || "", value: [ - fe.schema(n.keyInfo || {}), - new ee({ + de.schema(n.keyInfo || {}), + new ne({ name: n.entityUInfo || "", idBlock: { tagClass: 3, @@ -63879,7 +63925,7 @@ var fs, D4 = (fs = class extends Ce { optional: !0, value: [new Oe()] }), - new ee({ + new ne({ name: n.suppPubInfo || "", idBlock: { tagClass: 3, @@ -63893,21 +63939,21 @@ var fs, D4 = (fs = class extends Ce { fromSchema(t) { for (const r of UNe) delete t[r]; const n = Ee(t, t, fs.schema({ names: { - keyInfo: { names: { blockName: yp } }, - entityUInfo: qc, - suppPubInfo: bp + keyInfo: { names: { blockName: bp } }, + entityUInfo: Gc, + suppPubInfo: wp } })); - ke.assertSchema(n, this.className), this.keyInfo = new fe({ schema: n.result.keyInfo }), qc in n.result && (this.entityUInfo = n.result.entityUInfo.valueBlock.value[0]), this.suppPubInfo = n.result.suppPubInfo.valueBlock.value[0]; + ke.assertSchema(n, this.className), this.keyInfo = new de({ schema: n.result.keyInfo }), Gc in n.result && (this.entityUInfo = n.result.entityUInfo.valueBlock.value[0]), this.suppPubInfo = n.result.suppPubInfo.valueBlock.value[0]; } toSchema() { const t = []; - return t.push(this.keyInfo.toSchema()), this.entityUInfo && t.push(new ee({ + return t.push(this.keyInfo.toSchema()), this.entityUInfo && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, value: [this.entityUInfo] - })), t.push(new ee({ + })), t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 2 @@ -63923,12 +63969,12 @@ var fs, D4 = (fs = class extends Ce { return this.entityUInfo && (t.entityUInfo = this.entityUInfo.toJSON()), t; } }, fs.CLASS_NAME = "ECCCMSSharedInfo", fs); -const wp = "version", Gc = "originatorInfo", vp = "recipientInfos", kp = "encryptedContentInfo", Jc = "unprotectedAttrs", KNe = [ - wp, - Gc, +const vp = "version", Jc = "originatorInfo", kp = "recipientInfos", Ap = "encryptedContentInfo", Yc = "unprotectedAttrs", KNe = [ vp, + Jc, kp, - Jc + Ap, + Yc ], j4 = { kdfAlgorithm: "SHA-512", kekEncryptionLength: 256 @@ -63937,21 +63983,21 @@ const wp = "version", Gc = "originatorInfo", vp = "recipientInfos", kp = "encryp "P-384": 384, "P-521": 528 }; -var io, F4 = (io = class extends Ce { +var ao, F4 = (ao = class extends Ce { constructor(t = {}) { - super(), this.version = t[wp] ?? io.defaultValues(wp), Gc in t && (this.originatorInfo = t[Gc] ?? io.defaultValues(Gc)), this.recipientInfos = t[vp] ?? io.defaultValues(vp), this.encryptedContentInfo = t[kp] ?? io.defaultValues(kp), Jc in t && (this.unprotectedAttrs = t[Jc] ?? io.defaultValues(Jc)), this.policy = { disableSplit: !!t.disableSplit }, t.schema && this.fromSchema(t.schema); + super(), this.version = t[vp] ?? ao.defaultValues(vp), Jc in t && (this.originatorInfo = t[Jc] ?? ao.defaultValues(Jc)), this.recipientInfos = t[kp] ?? ao.defaultValues(kp), this.encryptedContentInfo = t[Ap] ?? ao.defaultValues(Ap), Yc in t && (this.unprotectedAttrs = t[Yc] ?? ao.defaultValues(Yc)), this.policy = { disableSplit: !!t.disableSplit }, t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case wp: + case vp: return 0; - case Gc: + case Jc: return new dI(); - case vp: - return []; case kp: + return []; + case Ap: return new Ir(); - case Jc: + case Yc: return []; default: return super.defaultValues(t); @@ -63959,14 +64005,14 @@ var io, F4 = (io = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case wp: - return n === io.defaultValues(t); - case Gc: - return n.certs.certificates.length === 0 && n.crls.crls.length === 0; case vp: + return n === ao.defaultValues(t); case Jc: - return n.length === 0; + return n.certs.certificates.length === 0 && n.crls.crls.length === 0; case kp: + case Yc: + return n.length === 0; + case Ap: return Ir.compareWithDefault("contentType", n.contentType) && Ir.compareWithDefault("contentEncryptionAlgorithm", n.contentEncryptionAlgorithm) && Ir.compareWithDefault("encryptedContent", n.encryptedContent); default: return super.defaultValues(t); @@ -63977,8 +64023,8 @@ var io, F4 = (io = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || "" }), - new ee({ + new ue({ name: n.version || "" }), + new ne({ name: n.originatorInfo || "", optional: !0, idBlock: { @@ -63987,18 +64033,18 @@ var io, F4 = (io = class extends Ce { }, value: dI.schema().valueBlock.value }), - new An({ value: [new ot({ + new An({ value: [new st({ name: n.recipientInfos || "", - value: wh.schema() + value: kh.schema() })] }), Ir.schema(n.encryptedContentInfo || {}), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new ot({ + value: [new st({ name: n.unprotectedAttrs || "", value: En.schema() })] @@ -64008,25 +64054,25 @@ var io, F4 = (io = class extends Ce { } fromSchema(t) { for (const r of KNe) delete t[r]; - const n = Ee(t, t, io.schema({ names: { - version: wp, - originatorInfo: Gc, - recipientInfos: vp, - encryptedContentInfo: { names: { blockName: kp } }, - unprotectedAttrs: Jc + const n = Ee(t, t, ao.schema({ names: { + version: vp, + originatorInfo: Jc, + recipientInfos: kp, + encryptedContentInfo: { names: { blockName: Ap } }, + unprotectedAttrs: Yc } })); - ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, Gc in n.result && (this.originatorInfo = new dI({ schema: new z({ value: n.result.originatorInfo.valueBlock.value }) })), this.recipientInfos = Array.from(n.result.recipientInfos, (r) => new wh({ schema: r })), this.encryptedContentInfo = new Ir({ schema: n.result.encryptedContentInfo }), Jc in n.result && (this.unprotectedAttrs = Array.from(n.result.unprotectedAttrs, (r) => new En({ schema: r }))); + ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, Jc in n.result && (this.originatorInfo = new dI({ schema: new z({ value: n.result.originatorInfo.valueBlock.value }) })), this.recipientInfos = Array.from(n.result.recipientInfos, (r) => new kh({ schema: r })), this.encryptedContentInfo = new Ir({ schema: n.result.encryptedContentInfo }), Yc in n.result && (this.unprotectedAttrs = Array.from(n.result.unprotectedAttrs, (r) => new En({ schema: r }))); } toSchema() { const t = []; - return t.push(new de({ value: this.version })), this.originatorInfo && t.push(new ee({ + return t.push(new ue({ value: this.version })), this.originatorInfo && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, value: this.originatorInfo.toSchema().valueBlock.value - })), t.push(new An({ value: Array.from(this.recipientInfos, (n) => n.toSchema()) })), t.push(this.encryptedContentInfo.toSchema()), this.unprotectedAttrs && t.push(new ee({ + })), t.push(new An({ value: Array.from(this.recipientInfos, (n) => n.toSchema()) })), t.push(this.encryptedContentInfo.toSchema()), this.unprotectedAttrs && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -64057,20 +64103,20 @@ var io, F4 = (io = class extends Ce { let i, a; if (s.useOAEP === !0) { i = o.getOIDByAlgorithm({ name: "RSA-OAEP" }, !0, "keyEncryptionAlgorithm"); - const l = new fe({ + const l = new de({ algorithmId: o.getOIDByAlgorithm({ name: s.oaepHashAlgorithm }, !0, "RSAES-OAEP-params"), - algorithmParams: new fn() + algorithmParams: new hn() }); a = new fI({ hashAlgorithm: l, - maskGenAlgorithm: new fe({ + maskGenAlgorithm: new de({ algorithmId: "1.2.840.113549.1.1.8", algorithmParams: l.toSchema() }) }).toSchema(); } else { if (i = o.getOIDByAlgorithm({ name: "RSAES-PKCS1-v1_5" }), i === "") throw new Error("Can not find OID for RSAES-PKCS1-v1_5"); - a = new fn(); + a = new hn(); } const c = new _O({ version: 0, @@ -64078,13 +64124,13 @@ var io, F4 = (io = class extends Ce { issuer: t.issuer, serialNumber: t.serialNumber }), - keyEncryptionAlgorithm: new fe({ + keyEncryptionAlgorithm: new de({ algorithmId: i, algorithmParams: a }), recipientCertificate: t }); - this.recipientInfos.push(new wh({ + this.recipientInfos.push(new kh({ variant: 1, value: c })); @@ -64108,7 +64154,7 @@ var io, F4 = (io = class extends Ce { return !0; } addRecipientByPreDefinedData(t, n = {}, r, o = Ye(!0)) { - if (Ut.assert(t, "preDefinedData", "ArrayBuffer"), !t.byteLength) throw new Error("Pre-defined data could have zero length"); + if (zt.assert(t, "preDefinedData", "ArrayBuffer"), !t.byteLength) throw new Error("Pre-defined data could have zero length"); if (!n.keyIdentifier) { const s = /* @__PURE__ */ new ArrayBuffer(16), i = new Uint8Array(s); o.getRandomValues(i), n.keyIdentifier = s; @@ -64116,19 +64162,19 @@ var io, F4 = (io = class extends Ce { switch (n.hmacHashAlgorithm || (n.hmacHashAlgorithm = "SHA-512"), n.iterationCount === void 0 && (n.iterationCount = 2048), n.keyEncryptionAlgorithm || (n.keyEncryptionAlgorithm = { name: "AES-KW", length: 256 - }), n.keyEncryptionAlgorithmParams || (n.keyEncryptionAlgorithmParams = new fn()), r) { + }), n.keyEncryptionAlgorithmParams || (n.keyEncryptionAlgorithmParams = new hn()), r) { case 1: { const s = o.getOIDByAlgorithm(n.keyEncryptionAlgorithm, !0, "keyEncryptionAlgorithm"), i = new VO({ version: 4, kekid: new SA({ keyIdentifier: new Oe({ valueHex: n.keyIdentifier }) }), - keyEncryptionAlgorithm: new fe({ + keyEncryptionAlgorithm: new de({ algorithmId: s, algorithmParams: n.keyEncryptionAlgorithmParams }), preDefinedKEK: t }); - this.recipientInfos.push(new wh({ + this.recipientInfos.push(new kh({ variant: 3, value: i })); @@ -64144,25 +64190,25 @@ var io, F4 = (io = class extends Ce { }, !0, "hmacHashAlgorithm"), l = new a0({ salt: new Oe({ valueHex: i }), iterationCount: n.iterationCount, - prf: new fe({ + prf: new de({ algorithmId: c, - algorithmParams: new fn() + algorithmParams: new hn() }) - }), u = o.getOIDByAlgorithm(n.keyEncryptionAlgorithm, !0, "keyEncryptionAlgorithm"), d = new $O({ + }), u = o.getOIDByAlgorithm(n.keyEncryptionAlgorithm, !0, "keyEncryptionAlgorithm"), f = new $O({ version: 0, - keyDerivationAlgorithm: new fe({ + keyDerivationAlgorithm: new de({ algorithmId: s, algorithmParams: l.toSchema() }), - keyEncryptionAlgorithm: new fe({ + keyEncryptionAlgorithm: new de({ algorithmId: u, algorithmParams: n.keyEncryptionAlgorithmParams }), password: t }); - this.recipientInfos.push(new wh({ + this.recipientInfos.push(new kh({ variant: 4, - value: d + value: f })); } break; @@ -64178,7 +64224,7 @@ var io, F4 = (io = class extends Ce { this._addKeyAgreeRecipientInfo(i, s, { recipientPublicKey: t }, o); } _addKeyAgreeRecipientInfo(t, n, r, o = Ye(!0)) { - const s = new jO({ rid: t }), i = new fe({ algorithmId: o.getOIDByAlgorithm({ + const s = new jO({ rid: t }), i = new de({ algorithmId: o.getOIDByAlgorithm({ name: "AES-KW", length: n.kekEncryptionLength }, !0, "keyEncryptionAlgorithm") }), a = o.getOIDByAlgorithm({ @@ -64189,15 +64235,15 @@ var io, F4 = (io = class extends Ce { const u = { version: 3, ukm: new Oe({ valueHex: c }), - keyEncryptionAlgorithm: new fe({ + keyEncryptionAlgorithm: new de({ algorithmId: a, algorithmParams: i.toSchema() }), recipientEncryptedKeys: new AA({ encryptedKeys: [s] }) - }, d = new FO(Object.assign(u, r)); - this.recipientInfos.push(new wh({ + }, f = new FO(Object.assign(u, r)); + this.recipientInfos.push(new kh({ variant: 2, - value: d + value: f })); } async encrypt(t, n, r = Ye(!0)) { @@ -64210,21 +64256,21 @@ var io, F4 = (io = class extends Ce { this.version = 2, this.encryptedContentInfo = new Ir({ disableSplit: this.policy.disableSplit, contentType: "1.2.840.113549.1.7.1", - contentEncryptionAlgorithm: new fe({ + contentEncryptionAlgorithm: new de({ algorithmId: a, algorithmParams: new Oe({ valueHex: o }) }), encryptedContent: new Oe({ valueHex: l }) }); - const d = async (m) => { + const f = async (m) => { const v = this.recipientInfos[m].value; let S, C; if (v.recipientPublicKey) S = v.recipientPublicKey.algorithm.namedCurve, C = v.recipientPublicKey; else if (v.recipientCertificate) { - const B = v.recipientCertificate.subjectPublicKeyInfo.algorithm.algorithmParams; - if (B.constructor.blockName() !== Ve.blockName()) throw new Error(`Incorrect "recipientCertificate" for index ${m}`); - switch (B.valueBlock.toString()) { + const _ = v.recipientCertificate.subjectPublicKeyInfo.algorithm.algorithmParams; + if (_.constructor.blockName() !== $e.blockName()) throw new Error(`Incorrect "recipientCertificate" for index ${m}`); + switch (_.valueBlock.toString()) { case "1.2.840.10045.3.1.7": S = "P-256"; break; @@ -64251,18 +64297,18 @@ var io, F4 = (io = class extends Ce { }, !0, ["deriveBits"]), w = await r.exportKey("spki", N.publicKey), y = await r.deriveBits({ name: "ECDH", public: C - }, N.privateKey, k), x = new fe({ schema: v.keyEncryptionAlgorithm.algorithmParams }), A = r.getAlgorithmByOID(x.algorithmId, !0, "aesKWAlgorithm"); + }, N.privateKey, k), x = new de({ schema: v.keyEncryptionAlgorithm.algorithmParams }), A = r.getAlgorithmByOID(x.algorithmId, !0, "aesKWAlgorithm"); let b = A.length; const E = /* @__PURE__ */ new ArrayBuffer(4), I = new Uint8Array(E); - for (let B = 3; B >= 0; B--) - I[B] = b, b >>= 8; + for (let _ = 3; _ >= 0; _--) + I[_] = b, b >>= 8; const O = new D4({ - keyInfo: new fe({ algorithmId: x.algorithmId }), + keyInfo: new de({ algorithmId: x.algorithmId }), entityUInfo: v.ukm, suppPubInfo: new Oe({ valueHex: E }) }).toSchema().toBER(!1), T = await k4(r.getAlgorithmByOID(v.keyEncryptionAlgorithm.algorithmId, !0, "ecdhAlgorithm").kdf, y, A.length, O, r), R = await r.importKey("raw", T, { name: "AES-KW" }, !0, ["wrapKey"]), M = await r.wrapKey("raw", c, R, { name: "AES-KW" }), F = new kA(); return F.variant = 3, F.value = LO.fromBER(w), v.originator = F, v.recipientEncryptedKeys.encryptedKeys[0].encryptedKey = new Oe({ valueHex: M }), { ecdhPrivateKey: N.privateKey }; - }, f = async (m) => { + }, d = async (m) => { const v = this.recipientInfos[m].value, S = r.getAlgorithmByOID(v.keyEncryptionAlgorithm.algorithmId, !0, "keyEncryptionAlgorithm"); if (S.name === "RSA-OAEP") { const N = v.keyEncryptionAlgorithm.algorithmParams, w = new fI({ schema: N }); @@ -64299,10 +64345,10 @@ var io, F4 = (io = class extends Ce { }, p = []; for (let m = 0; m < this.recipientInfos.length; m++) switch (this.recipientInfos[m].variant) { case 1: - p.push(await f(m)); + p.push(await d(m)); break; case 2: - p.push(await d(m)); + p.push(await f(m)); break; case 3: p.push(await h(m)); @@ -64324,11 +64370,11 @@ var io, F4 = (io = class extends Ce { const k = m.originator; if (o.recipientCertificate) { const R = o.recipientCertificate.subjectPublicKeyInfo.algorithm.algorithmParams; - if (R.constructor.blockName() !== Ve.blockName()) throw new Error(`Incorrect "recipientCertificate" for index ${p}`); + if (R.constructor.blockName() !== $e.blockName()) throw new Error(`Incorrect "recipientCertificate" for index ${p}`); v = R.valueBlock.toString(); } else if (k.value.algorithm.algorithmParams) { const R = k.value.algorithm.algorithmParams; - if (R.constructor.blockName() !== Ve.blockName()) throw new Error(`Incorrect originator for index ${p}`); + if (R.constructor.blockName() !== $e.blockName()) throw new Error(`Incorrect originator for index ${p}`); v = R.valueBlock.toString(); } else throw new Error('Parameter "recipientCertificate" is mandatory for "KeyAgreeRecipientInfo" if algorithm params are missing from originator'); if (!o.recipientPrivateKey) throw new Error('Parameter "recipientPrivateKey" is mandatory for "KeyAgreeRecipientInfo"'); @@ -64346,10 +64392,10 @@ var io, F4 = (io = class extends Ce { throw new Error(`Incorrect curve OID for index ${p}`); } let N, w = r; - vm(o.recipientPrivateKey) ? N = await r.importKey("pkcs8", o.recipientPrivateKey, { + km(o.recipientPrivateKey) ? N = await r.importKey("pkcs8", o.recipientPrivateKey, { name: "ECDH", namedCurve: S - }, !0, ["deriveBits"]) : (N = o.recipientPrivateKey, "crypto" in o && o.crypto && (w = o.crypto.subtle)), "algorithmParams" in k.value.algorithm || (k.value.algorithm.algorithmParams = new Ve({ value: v })); + }, !0, ["deriveBits"]) : (N = o.recipientPrivateKey, "crypto" in o && o.crypto && (w = o.crypto.subtle)), "algorithmParams" in k.value.algorithm || (k.value.algorithm.algorithmParams = new $e({ value: v })); const y = k.value.toSchema().toBER(!1), x = await r.importKey("spki", y, { name: "ECDH", namedCurve: S @@ -64359,15 +64405,15 @@ var io, F4 = (io = class extends Ce { }, N, C); async function b(R) { R = R || !1; - const M = new fe({ schema: m.keyEncryptionAlgorithm.algorithmParams }), F = r.getAlgorithmByOID(M.algorithmId, !0, "kwAlgorithm"); - let B = F.length; + const M = new de({ schema: m.keyEncryptionAlgorithm.algorithmParams }), F = r.getAlgorithmByOID(M.algorithmId, !0, "kwAlgorithm"); + let _ = F.length; const $ = /* @__PURE__ */ new ArrayBuffer(4), D = new Uint8Array($); for (let H = 3; H >= 0; H--) - D[H] = B, B >>= 8; - const _ = { algorithmId: M.algorithmId }; - R && (_.algorithmParams = new fn()); + D[H] = _, _ >>= 8; + const B = { algorithmId: M.algorithmId }; + R && (B.algorithmParams = new hn()); const L = new D4({ - keyInfo: new fe(_), + keyInfo: new de(B), entityUInfo: m.ukm, suppPubInfo: new Oe({ valueHex: $ }) }).toSchema().toBER(!1), j = r.getAlgorithmByOID(m.keyEncryptionAlgorithm.algorithmId, !0, "ecdhAlgorithm"); @@ -64392,7 +64438,7 @@ var io, F4 = (io = class extends Ce { if (v.hash = r.getAlgorithmByOID(x.hashAlgorithm.algorithmId), !("name" in v.hash)) throw new Error(`Incorrect OID for hash algorithm: ${x.hashAlgorithm.algorithmId}`); } let S, C = r; - vm(o.recipientPrivateKey) ? S = await r.importKey("pkcs8", o.recipientPrivateKey, v, !0, ["decrypt"]) : (S = o.recipientPrivateKey, "crypto" in o && o.crypto && (C = o.crypto.subtle)); + km(o.recipientPrivateKey) ? S = await r.importKey("pkcs8", o.recipientPrivateKey, v, !0, ["decrypt"]) : (S = o.recipientPrivateKey, "crypto" in o && o.crypto && (C = o.crypto.subtle)); const k = await C.decrypt(S.algorithm, S, m.encryptedKey.valueBlock.valueHexView), N = this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId, w = r.getAlgorithmByOID(N, !0, "contentEncryptionAlgorithm"); if (!("name" in w)) throw new Error(`Incorrect "contentEncryptionAlgorithm": ${N}`); return r.importKey("raw", k, w, !0, ["decrypt"]); @@ -64438,23 +64484,23 @@ var io, F4 = (io = class extends Ce { default: throw new Error(`Unknown recipient type in array with index ${t}`); } - const u = this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId, d = r.getAlgorithmByOID(u, !0, "contentEncryptionAlgorithm"), f = this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmParams.valueBlock.valueHex, h = new Uint8Array(f); + const u = this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId, f = r.getAlgorithmByOID(u, !0, "contentEncryptionAlgorithm"), d = this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmParams.valueBlock.valueHex, h = new Uint8Array(d); if (!this.encryptedContentInfo.encryptedContent) throw new Error("Required property `encryptedContent` is empty"); const g = this.encryptedContentInfo.getEncryptedContent(); return r.decrypt({ - name: d.name, + name: f.name, iv: h }, l, g); } -}, io.CLASS_NAME = "EnvelopedData", io); -const vh = "safeContents", Oy = "parsedValue", V4 = "contentInfos"; +}, ao.CLASS_NAME = "EnvelopedData", ao); +const Ah = "safeContents", Oy = "parsedValue", V4 = "contentInfos"; var Ra, $4 = (Ra = class extends Ce { constructor(t = {}) { - super(), this.safeContents = t[vh] ?? Ra.defaultValues(vh), Oy in t && (this.parsedValue = t[Oy] ?? Ra.defaultValues(Oy)), t.schema && this.fromSchema(t.schema); + super(), this.safeContents = t[Ah] ?? Ra.defaultValues(Ah), Oy in t && (this.parsedValue = t[Oy] ?? Ra.defaultValues(Oy)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case vh: + case Ah: return []; case Oy: return {}; @@ -64464,7 +64510,7 @@ var Ra, $4 = (Ra = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case vh: + case Ah: return n.length === 0; case Oy: return n instanceof Object && Object.keys(n).length === 0; @@ -64476,7 +64522,7 @@ var Ra, $4 = (Ra = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new ot({ + value: [new st({ name: n.contentInfos || "", value: Yn.schema() })] @@ -64494,14 +64540,14 @@ var Ra, $4 = (Ra = class extends Ce { return { safeContents: Array.from(this.safeContents, (t) => t.toJSON()) }; } async parseInternalValues(t, n = Ye(!0)) { - if (Ct.assert(t, vh), Ut.assert(t.safeContents, vh, "Array"), t.safeContents.length !== this.safeContents.length) throw new Ut('Length of "parameters.safeContents" must be equal to "this.safeContents.length"'); + if (Ot.assert(t, Ah), zt.assert(t.safeContents, Ah, "Array"), t.safeContents.length !== this.safeContents.length) throw new zt('Length of "parameters.safeContents" must be equal to "this.safeContents.length"'); this.parsedValue = { safeContents: [] }; for (const [r, o] of this.safeContents.entries()) { const s = t.safeContents[r], i = `parameters.safeContents[${r}]`; switch (o.contentType) { case iT: { - Ut.assert(o.content, "this.safeContents[j].content", Oe); + zt.assert(o.content, "this.safeContents[j].content", Oe); const a = o.content.getValue(); this.parsedValue.safeContents.push({ privacyMode: 0, @@ -64512,21 +64558,21 @@ var Ra, $4 = (Ra = class extends Ce { case pq: { const a = new F4({ schema: o.content }); - Ct.assert(i, s, "recipientCertificate", "recipientKey"); - const c = s, l = c.recipientCertificate, u = c.recipientKey, d = await a.decrypt(0, { + Ot.assert(i, s, "recipientCertificate", "recipientKey"); + const c = s, l = c.recipientCertificate, u = c.recipientKey, f = await a.decrypt(0, { recipientCertificate: l, recipientPrivateKey: u }, n); this.parsedValue.safeContents.push({ privacyMode: 2, - value: fw.fromBER(d) + value: fw.fromBER(f) }); } break; case gq: { const a = new mx({ schema: o.content }); - Ct.assert(i, s, "password"); + Ot.assert(i, s, "password"); const c = s.password, l = await a.decrypt({ password: c }, n); this.parsedValue.safeContents.push({ privacyMode: 1, @@ -64541,10 +64587,10 @@ var Ra, $4 = (Ra = class extends Ce { } async makeInternalValues(t, n = Ye(!0)) { if (!this.parsedValue) throw new Error('Please run "parseValues" first or add "parsedValue" manually'); - if (Ut.assert(this.parsedValue, "this.parsedValue", "object"), Ut.assert(this.parsedValue.safeContents, "this.parsedValue.safeContents", "Array"), Ut.assert(t, "parameters", "object"), Ct.assert(t, "safeContents"), Ut.assert(t.safeContents, "parameters.safeContents", "Array"), t.safeContents.length !== this.parsedValue.safeContents.length) throw new Ut('Length of "parameters.safeContents" must be equal to "this.parsedValue.safeContents"'); + if (zt.assert(this.parsedValue, "this.parsedValue", "object"), zt.assert(this.parsedValue.safeContents, "this.parsedValue.safeContents", "Array"), zt.assert(t, "parameters", "object"), Ot.assert(t, "safeContents"), zt.assert(t.safeContents, "parameters.safeContents", "Array"), t.safeContents.length !== this.parsedValue.safeContents.length) throw new zt('Length of "parameters.safeContents" must be equal to "this.parsedValue.safeContents"'); this.safeContents = []; for (const [r, o] of this.parsedValue.safeContents.entries()) - switch (Ct.assert("content", o, "privacyMode", "value"), Ut.assert(o.value, "content.value", fw), o.privacyMode) { + switch (Ot.assert("content", o, "privacyMode", "value"), zt.assert(o.value, "content.value", fw), o.privacyMode) { case 0: { const s = o.value.toSchema().toBER(!1); @@ -64566,7 +64612,7 @@ var Ra, $4 = (Ra = class extends Ce { case 2: { const s = new F4(), i = o.value.toSchema().toBER(!1), a = t.safeContents[r]; - switch (Ct.assert(`parameters.safeContents[${r}]`, a, "encryptingCertificate", "encryptionAlgorithm"), !0) { + switch (Ot.assert(`parameters.safeContents[${r}]`, a, "encryptingCertificate", "encryptionAlgorithm"), !0) { case a.encryptionAlgorithm.name.toLowerCase() === "aes-cbc": case a.encryptionAlgorithm.name.toLowerCase() === "aes-gcm": break; @@ -64594,41 +64640,41 @@ var Ra, $4 = (Ra = class extends Ce { return this; } }, Ra.CLASS_NAME = "AuthenticatedSafe", Ra); -const fd = "hashAlgorithm", Ap = "issuerNameHash", Sp = "issuerKeyHash", hd = "serialNumber", zNe = [ - fd, - Ap, +const hd = "hashAlgorithm", Sp = "issuerNameHash", xp = "issuerKeyHash", pd = "serialNumber", zNe = [ + hd, Sp, - hd + xp, + pd ]; -var ao, zr = (ao = class extends Ce { +var co, Wr = (co = class extends Ce { static async create(t, n, r = Ye(!0)) { - const o = new ao(); + const o = new co(); return await o.createForCertificate(t, n, r), o; } constructor(t = {}) { - super(), this.hashAlgorithm = t[fd] ?? ao.defaultValues(fd), this.issuerNameHash = t[Ap] ?? ao.defaultValues(Ap), this.issuerKeyHash = t[Sp] ?? ao.defaultValues(Sp), this.serialNumber = t[hd] ?? ao.defaultValues(hd), t.schema && this.fromSchema(t.schema); + super(), this.hashAlgorithm = t[hd] ?? co.defaultValues(hd), this.issuerNameHash = t[Sp] ?? co.defaultValues(Sp), this.issuerKeyHash = t[xp] ?? co.defaultValues(xp), this.serialNumber = t[pd] ?? co.defaultValues(pd), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case fd: - return new fe(); - case Ap: - case Sp: - return new Oe(); case hd: return new de(); + case Sp: + case xp: + return new Oe(); + case pd: + return new ue(); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case fd: + case hd: return n.algorithmId === "" && !("algorithmParams" in n); - case Ap: case Sp: - case hd: - return n.isEqual(ao.defaultValues(hd)); + case xp: + case pd: + return n.isEqual(co.defaultValues(pd)); default: return super.defaultValues(t); } @@ -64638,22 +64684,22 @@ var ao, zr = (ao = class extends Ce { return new z({ name: n.blockName || "", value: [ - fe.schema(n.hashAlgorithmObject || { names: { blockName: n.hashAlgorithm || "" } }), + de.schema(n.hashAlgorithmObject || { names: { blockName: n.hashAlgorithm || "" } }), new Oe({ name: n.issuerNameHash || "" }), new Oe({ name: n.issuerKeyHash || "" }), - new de({ name: n.serialNumber || "" }) + new ue({ name: n.serialNumber || "" }) ] }); } fromSchema(t) { for (const r of zNe) delete t[r]; - const n = Ee(t, t, ao.schema({ names: { - hashAlgorithm: fd, - issuerNameHash: Ap, - issuerKeyHash: Sp, - serialNumber: hd + const n = Ee(t, t, co.schema({ names: { + hashAlgorithm: hd, + issuerNameHash: Sp, + issuerKeyHash: xp, + serialNumber: pd } })); - ke.assertSchema(n, this.className), this.hashAlgorithm = new fe({ schema: n.result.hashAlgorithm }), this.issuerNameHash = n.result.issuerNameHash, this.issuerKeyHash = n.result.issuerKeyHash, this.serialNumber = n.result.serialNumber; + ke.assertSchema(n, this.className), this.hashAlgorithm = new de({ schema: n.result.hashAlgorithm }), this.issuerNameHash = n.result.issuerNameHash, this.issuerKeyHash = n.result.issuerKeyHash, this.serialNumber = n.result.serialNumber; } toSchema() { return new z({ value: [ @@ -64672,14 +64718,14 @@ var ao, zr = (ao = class extends Ce { }; } isEqual(t) { - return !(this.hashAlgorithm.algorithmId !== t.hashAlgorithm.algorithmId || !Kt.equal(this.issuerNameHash.valueBlock.valueHexView, t.issuerNameHash.valueBlock.valueHexView) || !Kt.equal(this.issuerKeyHash.valueBlock.valueHexView, t.issuerKeyHash.valueBlock.valueHexView) || !this.serialNumber.isEqual(t.serialNumber)); + return !(this.hashAlgorithm.algorithmId !== t.hashAlgorithm.algorithmId || !Wt.equal(this.issuerNameHash.valueBlock.valueHexView, t.issuerNameHash.valueBlock.valueHexView) || !Wt.equal(this.issuerKeyHash.valueBlock.valueHexView, t.issuerKeyHash.valueBlock.valueHexView) || !this.serialNumber.isEqual(t.serialNumber)); } async createForCertificate(t, n, r = Ye(!0)) { - Ct.assert(n, fd, "issuerCertificate"); + Ot.assert(n, hd, "issuerCertificate"); const o = r.getOIDByAlgorithm({ name: n.hashAlgorithm }, !0, "hashAlgorithm"); - this.hashAlgorithm = new fe({ + this.hashAlgorithm = new de({ algorithmId: o, - algorithmParams: new fn() + algorithmParams: new hn() }); const s = n.issuerCertificate; this.serialNumber = t.serialNumber; @@ -64688,28 +64734,28 @@ var ao, zr = (ao = class extends Ce { const a = s.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView, c = await r.digest({ name: n.hashAlgorithm }, a); this.issuerKeyHash = new Oe({ valueHex: c }); } -}, ao.CLASS_NAME = "CertID", ao); -const xp = "certID", Ep = "certStatus", Cp = "thisUpdate", Yc = "nextUpdate", pd = "singleExtensions", WNe = [ - xp, +}, co.CLASS_NAME = "CertID", co); +const Ep = "certID", Cp = "certStatus", Ip = "thisUpdate", Qc = "nextUpdate", gd = "singleExtensions", WNe = [ Ep, Cp, - Yc, - pd + Ip, + Qc, + gd ]; -var co, UO = (co = class extends Ce { +var lo, UO = (lo = class extends Ce { constructor(t = {}) { - super(), this.certID = t[xp] ?? co.defaultValues(xp), this.certStatus = t[Ep] ?? co.defaultValues(Ep), this.thisUpdate = t[Cp] ?? co.defaultValues(Cp), Yc in t && (this.nextUpdate = t[Yc] ?? co.defaultValues(Yc)), pd in t && (this.singleExtensions = t[pd] ?? co.defaultValues(pd)), t.schema && this.fromSchema(t.schema); + super(), this.certID = t[Ep] ?? lo.defaultValues(Ep), this.certStatus = t[Cp] ?? lo.defaultValues(Cp), this.thisUpdate = t[Ip] ?? lo.defaultValues(Ip), Qc in t && (this.nextUpdate = t[Qc] ?? lo.defaultValues(Qc)), gd in t && (this.singleExtensions = t[gd] ?? lo.defaultValues(gd)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case xp: - return new zr(); case Ep: - return {}; + return new Wr(); case Cp: - case Yc: + return {}; + case Ip: + case Qc: return new Date(0, 0, 0); - case pd: + case gd: return []; default: return super.defaultValues(t); @@ -64717,13 +64763,13 @@ var co, UO = (co = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case xp: - return zr.compareWithDefault("hashAlgorithm", n.hashAlgorithm) && zr.compareWithDefault("issuerNameHash", n.issuerNameHash) && zr.compareWithDefault("issuerKeyHash", n.issuerKeyHash) && zr.compareWithDefault("serialNumber", n.serialNumber); case Ep: - return Object.keys(n).length === 0; + return Wr.compareWithDefault("hashAlgorithm", n.hashAlgorithm) && Wr.compareWithDefault("issuerNameHash", n.issuerNameHash) && Wr.compareWithDefault("issuerKeyHash", n.issuerKeyHash) && Wr.compareWithDefault("serialNumber", n.serialNumber); case Cp: - case Yc: - return n === co.defaultValues(t); + return Object.keys(n).length === 0; + case Ip: + case Qc: + return n === lo.defaultValues(t); default: return super.defaultValues(t); } @@ -64733,8 +64779,8 @@ var co, UO = (co = class extends Ce { return new z({ name: n.blockName || "", value: [ - zr.schema(n.certID || {}), - new Xt({ value: [ + Wr.schema(n.certID || {}), + new en({ value: [ new Je({ name: n.certStatus || "", idBlock: { @@ -64742,19 +64788,19 @@ var co, UO = (co = class extends Ce { tagNumber: 0 } }), - new ee({ + new ne({ name: n.certStatus || "", idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new Yt(), new ee({ + value: [new Xt(), new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Df()] + value: [new Ff()] })] }), new Je({ @@ -64766,16 +64812,16 @@ var co, UO = (co = class extends Ce { lenBlock: { length: 1 } }) ] }), - new Yt({ name: n.thisUpdate || "" }), - new ee({ + new Xt({ name: n.thisUpdate || "" }), + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Yt({ name: n.nextUpdate || "" })] + value: [new Xt({ name: n.nextUpdate || "" })] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, @@ -64788,24 +64834,24 @@ var co, UO = (co = class extends Ce { } fromSchema(t) { for (const r of WNe) delete t[r]; - const n = Ee(t, t, co.schema({ names: { - certID: { names: { blockName: xp } }, - certStatus: Ep, - thisUpdate: Cp, - nextUpdate: Yc, - singleExtensions: { names: { blockName: pd } } + const n = Ee(t, t, lo.schema({ names: { + certID: { names: { blockName: Ep } }, + certStatus: Cp, + thisUpdate: Ip, + nextUpdate: Qc, + singleExtensions: { names: { blockName: gd } } } })); - ke.assertSchema(n, this.className), this.certID = new zr({ schema: n.result.certID }), this.certStatus = n.result.certStatus, this.thisUpdate = n.result.thisUpdate.toDate(), Yc in n.result && (this.nextUpdate = n.result.nextUpdate.toDate()), pd in n.result && (this.singleExtensions = Array.from(n.result.singleExtensions.valueBlock.value, (r) => new Bn({ schema: r }))); + ke.assertSchema(n, this.className), this.certID = new Wr({ schema: n.result.certID }), this.certStatus = n.result.certStatus, this.thisUpdate = n.result.thisUpdate.toDate(), Qc in n.result && (this.nextUpdate = n.result.nextUpdate.toDate()), gd in n.result && (this.singleExtensions = Array.from(n.result.singleExtensions.valueBlock.value, (r) => new Bn({ schema: r }))); } toSchema() { const t = []; - return t.push(this.certID.toSchema()), t.push(this.certStatus), t.push(new Yt({ valueDate: this.thisUpdate })), this.nextUpdate && t.push(new ee({ + return t.push(this.certID.toSchema()), t.push(this.certStatus), t.push(new Xt({ valueDate: this.thisUpdate })), this.nextUpdate && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new Yt({ valueDate: this.nextUpdate })] - })), this.singleExtensions && t.push(new ee({ + value: [new Xt({ valueDate: this.nextUpdate })] + })), this.singleExtensions && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 @@ -64821,16 +64867,16 @@ var co, UO = (co = class extends Ce { }; return this.nextUpdate && (t.nextUpdate = this.nextUpdate), this.singleExtensions && (t.singleExtensions = Array.from(this.singleExtensions, (n) => n.toJSON())), t; } -}, co.CLASS_NAME = "SingleResponse", co); -const bk = "tbs", gd = "version", Aw = "responderID", Sw = "producedAt", xw = "responses", Ip = "responseExtensions", Qf = "ResponseData", xA = `${Qf}.${gd}`, Np = `${Qf}.${Aw}`, KO = `${Qf}.${Sw}`, HO = `${Qf}.${xw}`, EA = `${Qf}.${Ip}`, qNe = [ - Qf, +}, lo.CLASS_NAME = "SingleResponse", lo); +const bk = "tbs", md = "version", Aw = "responderID", Sw = "producedAt", xw = "responses", Np = "responseExtensions", Zf = "ResponseData", xA = `${Zf}.${md}`, Op = `${Zf}.${Aw}`, KO = `${Zf}.${Sw}`, HO = `${Zf}.${xw}`, EA = `${Zf}.${Np}`, qNe = [ + Zf, xA, - Np, + Op, KO, HO, EA ]; -var xr, yc = (xr = class extends Ce { +var xr, bc = (xr = class extends Ce { get tbs() { return br(this.tbsView); } @@ -64838,11 +64884,11 @@ var xr, yc = (xr = class extends Ce { this.tbsView = new Uint8Array(t); } constructor(t = {}) { - super(), this.tbsView = new Uint8Array(t[bk] ?? xr.defaultValues(bk)), gd in t && (this.version = t[gd] ?? xr.defaultValues(gd)), this.responderID = t[Aw] ?? xr.defaultValues(Aw), this.producedAt = t[Sw] ?? xr.defaultValues(Sw), this.responses = t[xw] ?? xr.defaultValues(xw), Ip in t && (this.responseExtensions = t[Ip] ?? xr.defaultValues(Ip)), t.schema && this.fromSchema(t.schema); + super(), this.tbsView = new Uint8Array(t[bk] ?? xr.defaultValues(bk)), md in t && (this.version = t[md] ?? xr.defaultValues(md)), this.responderID = t[Aw] ?? xr.defaultValues(Aw), this.producedAt = t[Sw] ?? xr.defaultValues(Sw), this.responses = t[xw] ?? xr.defaultValues(xw), Np in t && (this.responseExtensions = t[Np] ?? xr.defaultValues(Np)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case gd: + case md: return 0; case bk: return Dn; @@ -64851,7 +64897,7 @@ var xr, yc = (xr = class extends Ce { case Sw: return new Date(0, 0, 0); case xw: - case Ip: + case Np: return []; default: return super.defaultValues(t); @@ -64866,7 +64912,7 @@ var xr, yc = (xr = class extends Ce { case Sw: return n === xr.defaultValues(t); case xw: - case Ip: + case Np: return n.length === 0; default: return super.defaultValues(t); @@ -64875,37 +64921,37 @@ var xr, yc = (xr = class extends Ce { static schema(t = {}) { const n = t.names ?? {}; return new z({ - name: n.blockName || Qf, + name: n.blockName || Zf, value: [ - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new de({ name: n.version || xA })] + value: [new ue({ name: n.version || xA })] }), - new Xt({ value: [new ee({ - name: n.responderID || Np, + new en({ value: [new ne({ + name: n.responderID || Op, idBlock: { tagClass: 3, tagNumber: 1 }, - value: [Qt.schema(n.ResponseDataByName || { names: { blockName: "ResponseData.byName" } })] - }), new ee({ - name: n.responderID || Np, + value: [Zt.schema(n.ResponseDataByName || { names: { blockName: "ResponseData.byName" } })] + }), new ne({ + name: n.responderID || Op, idBlock: { tagClass: 3, tagNumber: 2 }, value: [new Oe({ name: n.ResponseDataByKey || "ResponseData.byKey" })] })] }), - new Yt({ name: n.producedAt || KO }), - new z({ value: [new ot({ + new Xt({ name: n.producedAt || KO }), + new z({ value: [new st({ name: HO, value: UO.schema(n.response || {}) })] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, @@ -64919,35 +64965,35 @@ var xr, yc = (xr = class extends Ce { fromSchema(t) { for (const r of qNe) delete t[r]; const n = Ee(t, t, xr.schema()); - ke.assertSchema(n, this.className), this.tbsView = n.result.ResponseData.valueBeforeDecodeView, xA in n.result && (this.version = n.result[xA].valueBlock.valueDec), n.result[Np].idBlock.tagNumber === 1 ? this.responderID = new Qt({ schema: n.result[Np].valueBlock.value[0] }) : this.responderID = n.result[Np].valueBlock.value[0], this.producedAt = n.result[KO].toDate(), this.responses = Array.from(n.result[HO], (r) => new UO({ schema: r })), EA in n.result && (this.responseExtensions = Array.from(n.result[EA].valueBlock.value, (r) => new Bn({ schema: r }))); + ke.assertSchema(n, this.className), this.tbsView = n.result.ResponseData.valueBeforeDecodeView, xA in n.result && (this.version = n.result[xA].valueBlock.valueDec), n.result[Op].idBlock.tagNumber === 1 ? this.responderID = new Zt({ schema: n.result[Op].valueBlock.value[0] }) : this.responderID = n.result[Op].valueBlock.value[0], this.producedAt = n.result[KO].toDate(), this.responses = Array.from(n.result[HO], (r) => new UO({ schema: r })), EA in n.result && (this.responseExtensions = Array.from(n.result[EA].valueBlock.value, (r) => new Bn({ schema: r }))); } toSchema(t = !1) { let n; if (t === !1) { if (!this.tbsView.byteLength) return xr.schema(); - const r = hn(this.tbsView); + const r = pn(this.tbsView); ke.assert(r, "TBS Response Data"), n = r.result; } else { const r = []; - gd in this && r.push(new ee({ + md in this && r.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new de({ value: this.version })] - })), this.responderID instanceof Qt ? r.push(new ee({ + value: [new ue({ value: this.version })] + })), this.responderID instanceof Zt ? r.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, value: [this.responderID.toSchema()] - })) : r.push(new ee({ + })) : r.push(new ne({ idBlock: { tagClass: 3, tagNumber: 2 }, value: [this.responderID] - })), r.push(new Yt({ valueDate: this.producedAt })), r.push(new z({ value: Array.from(this.responses, (o) => o.toSchema()) })), this.responseExtensions && r.push(new ee({ + })), r.push(new Xt({ valueDate: this.producedAt })), r.push(new z({ value: Array.from(this.responses, (o) => o.toSchema()) })), this.responseExtensions && r.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 @@ -64959,17 +65005,17 @@ var xr, yc = (xr = class extends Ce { } toJSON() { const t = {}; - return gd in this && (t.version = this.version), this.responderID && (t.responderID = this.responderID), this.producedAt && (t.producedAt = this.producedAt), this.responses && (t.responses = Array.from(this.responses, (n) => n.toJSON())), this.responseExtensions && (t.responseExtensions = Array.from(this.responseExtensions, (n) => n.toJSON())), t; + return md in this && (t.version = this.version), this.responderID && (t.responderID = this.responderID), this.producedAt && (t.producedAt = this.producedAt), this.responses && (t.responses = Array.from(this.responses, (n) => n.toJSON())), this.responseExtensions && (t.responseExtensions = Array.from(this.responseExtensions, (n) => n.toJSON())), t; } }, xr.CLASS_NAME = "ResponseData", xr); const hI = "trustedCerts", pI = "certs", gI = "crls", mI = "ocsps", yI = "checkDate", bI = "findOrigin", wI = "findIssuer"; -var Ef, Py = (Ef = class extends Error { +var If, Py = (If = class extends Error { constructor(t, n) { - super(n), this.name = Ef.NAME, this.code = t, this.message = n; + super(n), this.name = If.NAME, this.code = t, this.message = n; } -}, Ef.NAME = "ChainValidationError", Ef); +}, If.NAME = "ChainValidationError", If); function GNe(e, t) { - for (let n = 0; n < t.length; n++) if (Kt.equal(e.tbsView, t[n].tbsView)) return !0; + for (let n = 0; n < t.length; n++) if (Wt.equal(e.tbsView, t[n].tbsView)) return !0; return !1; } var Cq = class Iq { @@ -64979,9 +65025,9 @@ var Cq = class Iq { static defaultFindOrigin(t, n) { t.tbsView.byteLength === 0 && (t.tbsView = new Uint8Array(t.encodeTBS().toBER())); for (const r of n.certs) - if (r.tbsView.byteLength === 0 && (r.tbsView = new Uint8Array(r.encodeTBS().toBER())), Kt.equal(t.tbsView, r.tbsView)) return "Intermediate Certificates"; + if (r.tbsView.byteLength === 0 && (r.tbsView = new Uint8Array(r.encodeTBS().toBER())), Wt.equal(t.tbsView, r.tbsView)) return "Intermediate Certificates"; for (const r of n.trustedCerts) - if (r.tbsView.byteLength === 0 && (r.tbsView = new Uint8Array(r.encodeTBS().toBER())), Kt.equal(t.tbsView, r.tbsView)) return "Trusted Certificates"; + if (r.tbsView.byteLength === 0 && (r.tbsView = new Uint8Array(r.encodeTBS().toBER())), Wt.equal(t.tbsView, r.tbsView)) return "Trusted Certificates"; return "Unknown"; } async defaultFindIssuer(t, n, r = Ye(!0)) { @@ -64999,12 +65045,12 @@ var Cq = class Iq { } function c(l) { if (s !== null && l.extensions) { - let d = !1; - for (const f of l.extensions) if (f.extnID === "2.5.29.14" && f.parsedValue) { - d = !0, Kt.equal(f.parsedValue.valueBlock.valueHex, s.valueBlock.valueHexView) && o.push(l); + let f = !1; + for (const d of l.extensions) if (d.extnID === "2.5.29.14" && d.parsedValue) { + f = !0, Wt.equal(d.parsedValue.valueBlock.valueHex, s.valueBlock.valueHexView) && o.push(l); break; } - if (d) return; + if (f) return; } let u = !1; a !== null && (u = l.serialNumber.isEqual(a)), i !== null ? l.subject.isEqual(i) && u && o.push(l) : t.issuer.isEqual(l.subject) && o.push(l); @@ -65057,7 +65103,7 @@ var Cq = class Iq { const S = await this.findIssuer(g, this, p); if (S.length === 0) throw new Error("No valid certificate paths found"); for (let C = 0; C < S.length; C++) { - if (Kt.equal(S[C].tbsView, g.tbsView)) { + if (Wt.equal(S[C].tbsView, g.tbsView)) { m.push([S[C]]); continue; } @@ -65228,19 +65274,19 @@ var Cq = class Iq { }; r.push(...this.trustedCerts), r.push(...this.certs); for (let g = 0; g < r.length; g++) for (let p = 0; p < r.length; p++) - if (g !== p && Kt.equal(r[g].tbsView, r[p].tbsView)) { + if (g !== p && Wt.equal(r[g].tbsView, r[p].tbsView)) { r.splice(p, 1), g = 0; break; } const l = r[r.length - 1]; let u; - const d = [l]; + const f = [l]; if (u = await o(l, n), u.length === 0) throw new Py(60, "Unable to find certificate path"); for (let g = u.length - 1; g >= 0; g--) { let p = !1; for (let m = 0; m < u[g].length; m++) { const v = u[g][m]; - for (let S = 0; S < this.trustedCerts.length; S++) if (Kt.equal(v.tbsView, this.trustedCerts[S].tbsView)) { + for (let S = 0; S < this.trustedCerts.length; S++) if (Wt.equal(v.tbsView, this.trustedCerts[S].tbsView)) { p = !0; break; } @@ -65249,17 +65295,17 @@ var Cq = class Iq { p || u.splice(g, 1); } if (u.length === 0) throw new Py(97, "No valid certificate paths found"); - let f = u[0].length, h = 0; - for (let g = 0; g < u.length; g++) u[g].length < f && (f = u[g].length, h = g); - for (let g = 0; g < u[h].length; g++) d.push(u[h][g]); - if (u = await c(d, this.checkDate), u.result === !1) throw u; - return d; + let d = u[0].length, h = 0; + for (let g = 0; g < u.length; g++) u[g].length < d && (d = u[g].length, h = g); + for (let g = 0; g < u[h].length; g++) f.push(u[h][g]); + if (u = await c(f, this.checkDate), u.result === !1) throw u; + return f; } async verify(t = {}, n = Ye(!0)) { function r(c, l) { - const u = sl(c), d = sl(l), f = u.split("."), h = d.split("."), g = f.length, p = h.length; + const u = il(c), f = il(l), d = u.split("."), h = f.split("."), g = d.length, p = h.length; if (g === 0 || p === 0 || g < p) return !1; - for (let m = 0; m < g; m++) if (f[m].length === 0) return !1; + for (let m = 0; m < g; m++) if (d[m].length === 0) return !1; for (let m = 0; m < p; m++) if (h[m].length === 0) { if (m === 0) { if (p === 1) return !1; @@ -65268,46 +65314,46 @@ var Cq = class Iq { return !1; } for (let m = 0; m < p; m++) - if (h[p - 1 - m].length !== 0 && f[g - 1 - m].localeCompare(h[p - 1 - m]) !== 0) + if (h[p - 1 - m].length !== 0 && d[g - 1 - m].localeCompare(h[p - 1 - m]) !== 0) return !1; return !0; } function o(c, l) { - const u = sl(c), d = sl(l), f = u.split("@"), h = d.split("@"); - if (f.length === 0 || h.length === 0 || f.length < h.length) return !1; + const u = il(c), f = il(l), d = u.split("@"), h = f.split("@"); + if (d.length === 0 || h.length === 0 || d.length < h.length) return !1; if (h.length === 1) { - if (r(f[1], h[0])) { - const g = f[1].split("."), p = h[0].split("."); + if (r(d[1], h[0])) { + const g = d[1].split("."), p = h[0].split("."); return p[0].length === 0 ? !0 : g.length === p.length; } return !1; } - return u.localeCompare(d) === 0; + return u.localeCompare(f) === 0; } function s(c, l) { - let u = sl(c); - const d = sl(l), f = u.split("/"); - if (d.split("/").length > 1) return !1; - if (f.length > 1) { - for (let h = 0; h < f.length; h++) if (f[h].length > 0 && f[h].charAt(f[h].length - 1) !== ":") { - u = f[h].split(":")[0]; + let u = il(c); + const f = il(l), d = u.split("/"); + if (f.split("/").length > 1) return !1; + if (d.length > 1) { + for (let h = 0; h < d.length; h++) if (d[h].length > 0 && d[h].charAt(d[h].length - 1) !== ":") { + u = d[h].split(":")[0]; break; } } - if (r(u, d)) { - const h = u.split("."), g = d.split("."); + if (r(u, f)) { + const h = u.split("."), g = f.split("."); return g[0].length === 0 ? !0 : h.length === g.length; } return !1; } function i(c, l) { - const u = c.valueBlock.valueHexView, d = l.valueBlock.valueHexView; - if (u.length === 4 && d.length === 8) { - for (let f = 0; f < 4; f++) if ((u[f] ^ d[f]) & d[f + 4]) return !1; + const u = c.valueBlock.valueHexView, f = l.valueBlock.valueHexView; + if (u.length === 4 && f.length === 8) { + for (let d = 0; d < 4; d++) if ((u[d] ^ f[d]) & f[d + 4]) return !1; return !0; } - if (u.length === 16 && d.length === 32) { - for (let f = 0; f < 16; f++) if ((u[f] ^ d[f]) & d[f + 16]) return !1; + if (u.length === 16 && f.length === 32) { + for (let d = 0; d < 16; d++) if ((u[d] ^ f[d]) & f[d + 16]) return !1; return !0; } return !1; @@ -65315,23 +65361,23 @@ var Cq = class Iq { function a(c, l) { if (c.typesAndValues.length === 0 || l.typesAndValues.length === 0) return !0; if (c.typesAndValues.length < l.typesAndValues.length) return !1; - let u = !0, d = 0; - for (let f = 0; f < l.typesAndValues.length; f++) { + let u = !0, f = 0; + for (let d = 0; d < l.typesAndValues.length; d++) { let h = !1; - for (let g = d; g < c.typesAndValues.length; g++) - if (h = c.typesAndValues[g].isEqual(l.typesAndValues[f]), c.typesAndValues[g].type === l.typesAndValues[f].type && (u = u && h), h === !0) - if (d === 0 || d === g) { - d = g + 1; + for (let g = f; g < c.typesAndValues.length; g++) + if (h = c.typesAndValues[g].isEqual(l.typesAndValues[d]), c.typesAndValues[g].type === l.typesAndValues[d].type && (u = u && h), h === !0) + if (f === 0 || f === g) { + f = g + 1; break; } else return !1; if (h === !1) return !1; } - return d === 0 ? !1 : u; + return f === 0 ? !1 : u; } try { if (this.certs.length === 0) throw new Error("Empty certificate array"); - const c = t.passedWhenNotRevValues || !1, l = t.initialPolicySet || ["2.5.29.32.0"], u = t.initialExplicitPolicy || !1, d = t.initialPolicyMappingInhibit || !1, f = t.initialInhibitPolicy || !1, h = t.initialPermittedSubtreesSet || [], g = t.initialExcludedSubtreesSet || [], p = t.initialRequiredNameForms || []; - let m = u, v = d, S = f; + const c = t.passedWhenNotRevValues || !1, l = t.initialPolicySet || ["2.5.29.32.0"], u = t.initialExplicitPolicy || !1, f = t.initialPolicyMappingInhibit || !1, d = t.initialInhibitPolicy || !1, h = t.initialPermittedSubtreesSet || [], g = t.initialExcludedSubtreesSet || [], p = t.initialRequiredNameForms || []; + let m = u, v = f, S = d; const C = [ !1, !1, @@ -65349,10 +65395,10 @@ var Cq = class Iq { const T = new Array(this.certs.length - 1), R = new Array(this.certs.length - 1); let M = m ? this.certs.length - 1 : -1; for (let D = this.certs.length - 2; D >= 0; D--, b++) { - const _ = this.certs[D]; - if (_.extensions) { - for (let L = 0; L < _.extensions.length; L++) { - const j = _.extensions[L]; + const B = this.certs[D]; + if (B.extensions) { + for (let L = 0; L < B.extensions.length; L++) { + const j = B.extensions[L]; if (j.extnID === "2.5.29.32") { R[D] = j.parsedValue; for (let H = 0; H < E.length; H++) if (E[H] === "2.5.29.32.0") { @@ -65361,15 +65407,15 @@ var Cq = class Iq { } for (let H = 0; H < j.parsedValue.certificatePolicies.length; H++) { let Y = -1; - const ue = j.parsedValue.certificatePolicies[H].policyIdentifier; - for (let le = 0; le < E.length; le++) if (ue === E[le]) { - Y = le; + const le = j.parsedValue.certificatePolicies[H].policyIdentifier; + for (let ie = 0; ie < E.length; ie++) if (le === E[ie]) { + Y = ie; break; } if (Y === -1) { - E.push(ue); - const le = new Array(this.certs.length - 1); - le[D] = !0, I.push(le); + E.push(le); + const ie = new Array(this.certs.length - 1); + ie[D] = !0, I.push(ie); } else I[Y][D] = !0; } } @@ -65394,27 +65440,27 @@ var Cq = class Iq { m === !1 && C[0] === !0 && (k--, k === 0 && (m = !0, M = D, C[0] = !1)), v === !1 && C[1] === !0 && (N--, N === 0 && (v = !0, C[1] = !1)), S === !1 && C[2] === !0 && (w--, w === 0 && (S = !0, C[2] = !1)); } } - for (let D = 0; D < this.certs.length - 1; D++) if (D < this.certs.length - 2 && typeof T[D + 1] < "u") for (let _ = 0; _ < T[D + 1].mappings.length; _++) { - if (T[D + 1].mappings[_].issuerDomainPolicy === "2.5.29.32.0" || T[D + 1].mappings[_].subjectDomainPolicy === "2.5.29.32.0") return { + for (let D = 0; D < this.certs.length - 1; D++) if (D < this.certs.length - 2 && typeof T[D + 1] < "u") for (let B = 0; B < T[D + 1].mappings.length; B++) { + if (T[D + 1].mappings[B].issuerDomainPolicy === "2.5.29.32.0" || T[D + 1].mappings[B].subjectDomainPolicy === "2.5.29.32.0") return { result: !1, resultCode: 99, resultMessage: 'The "anyPolicy" should not be a part of policy mapping scheme' }; let L = -1, j = -1; for (let H = 0; H < E.length; H++) - E[H] === T[D + 1].mappings[_].issuerDomainPolicy && (L = H), E[H] === T[D + 1].mappings[_].subjectDomainPolicy && (j = H); + E[H] === T[D + 1].mappings[B].issuerDomainPolicy && (L = H), E[H] === T[D + 1].mappings[B].subjectDomainPolicy && (j = H); typeof I[L][D] < "u" && delete I[L][D]; - for (let H = 0; H < R[D].certificatePolicies.length; H++) if (T[D + 1].mappings[_].subjectDomainPolicy === R[D].certificatePolicies[H].policyIdentifier && L !== -1 && j !== -1) + for (let H = 0; H < R[D].certificatePolicies.length; H++) if (T[D + 1].mappings[B].subjectDomainPolicy === R[D].certificatePolicies[H].policyIdentifier && L !== -1 && j !== -1) for (let Y = 0; Y <= D; Y++) typeof I[j][Y] < "u" && (I[L][Y] = !0, delete I[j][Y]); } - for (let D = 0; D < E.length; D++) if (E[D] === "2.5.29.32.0") for (let _ = 0; _ < M; _++) delete I[D][_]; + for (let D = 0; D < E.length; D++) if (E[D] === "2.5.29.32.0") for (let B = 0; B < M; B++) delete I[D][B]; const F = []; for (let D = 0; D < I.length; D++) { - let _ = !0; + let B = !0; for (let L = 0; L < this.certs.length - 1; L++) { let j = !1; if (L < M && E[D] === "2.5.29.32.0" && E.length > 1) { - _ = !1; + B = !1; break; } if (typeof I[D][L] > "u") { @@ -65425,45 +65471,45 @@ var Cq = class Iq { } } if (!j) { - _ = !1; + B = !1; break; } } } - _ === !0 && F.push(E[D]); + B === !0 && F.push(E[D]); } - let B = []; - if (l.length === 1 && l[0] === "2.5.29.32.0" && m === !1) B = l; - else if (F.length === 1 && F[0] === "2.5.29.32.0") B = l; - else for (let D = 0; D < F.length; D++) for (let _ = 0; _ < l.length; _++) if (l[_] === F[D] || l[_] === "2.5.29.32.0") { - B.push(F[D]); + let _ = []; + if (l.length === 1 && l[0] === "2.5.29.32.0" && m === !1) _ = l; + else if (F.length === 1 && F[0] === "2.5.29.32.0") _ = l; + else for (let D = 0; D < F.length; D++) for (let B = 0; B < l.length; B++) if (l[B] === F[D] || l[B] === "2.5.29.32.0") { + _.push(F[D]); break; } const $ = { - result: B.length > 0, + result: _.length > 0, resultCode: 0, - resultMessage: B.length > 0 ? "" : 'Zero "userConstrPolicies" array, no intersections with "authConstrPolicies"', + resultMessage: _.length > 0 ? "" : 'Zero "userConstrPolicies" array, no intersections with "authConstrPolicies"', authConstrPolicies: F, - userConstrPolicies: B, + userConstrPolicies: _, explicitPolicyIndicator: m, policyMappings: T, certificatePath: this.certs }; - if (B.length === 0 || $.result === !1) return $; + if (_.length === 0 || $.result === !1) return $; b = 1; for (let D = this.certs.length - 2; D >= 0; D--, b++) { - const _ = this.certs[D]; + const B = this.certs[D]; let L = [], j = [], H = []; - if (_.extensions) for (let pe = 0; pe < _.extensions.length; pe++) { - const ge = _.extensions[pe]; - ge.extnID === "2.5.29.30" && ("permittedSubtrees" in ge.parsedValue && (j = j.concat(ge.parsedValue.permittedSubtrees)), "excludedSubtrees" in ge.parsedValue && (H = H.concat(ge.parsedValue.excludedSubtrees))), ge.extnID === "2.5.29.17" && (L = L.concat(ge.parsedValue.altNames)); + if (B.extensions) for (let pe = 0; pe < B.extensions.length; pe++) { + const ve = B.extensions[pe]; + ve.extnID === "2.5.29.30" && ("permittedSubtrees" in ve.parsedValue && (j = j.concat(ve.parsedValue.permittedSubtrees)), "excludedSubtrees" in ve.parsedValue && (H = H.concat(ve.parsedValue.excludedSubtrees))), ve.extnID === "2.5.29.17" && (L = L.concat(ve.parsedValue.altNames)); } let Y = A.length <= 0; for (let pe = 0; pe < A.length; pe++) switch (A[pe].base.type) { case 4: - if (A[pe].base.value.typesAndValues.length !== _.subject.typesAndValues.length) continue; + if (A[pe].base.value.typesAndValues.length !== B.subject.typesAndValues.length) continue; Y = !0; - for (let ge = 0; ge < _.subject.typesAndValues.length; ge++) if (_.subject.typesAndValues[ge].type !== A[pe].base.value.typesAndValues[ge].type) { + for (let ve = 0; ve < B.subject.typesAndValues.length; ve++) if (B.subject.typesAndValues[ve].type !== A[pe].base.value.typesAndValues[ve].type) { Y = !1; break; } @@ -65471,7 +65517,7 @@ var Cq = class Iq { } if (Y === !1) throw $.result = !1, $.resultCode = 21, $.resultMessage = "No necessary name form found", $; - const ue = [ + const le = [ [], [], [], @@ -65480,76 +65526,76 @@ var Cq = class Iq { ]; for (let pe = 0; pe < y.length; pe++) switch (y[pe].base.type) { case 1: - ue[0].push(y[pe]); + le[0].push(y[pe]); break; case 2: - ue[1].push(y[pe]); + le[1].push(y[pe]); break; case 4: - ue[2].push(y[pe]); + le[2].push(y[pe]); break; case 6: - ue[3].push(y[pe]); + le[3].push(y[pe]); break; case 7: - ue[4].push(y[pe]); + le[4].push(y[pe]); } for (let pe = 0; pe < 5; pe++) { - let ge = !1, Me = !1; - const Be = ue[pe]; - for (let te = 0; te < Be.length; te++) { + let ve = !1, _e = !1; + const Be = le[pe]; + for (let ee = 0; ee < Be.length; ee++) { switch (pe) { case 0: if (L.length > 0) - for (let he = 0; he < L.length; he++) L[he].type === 1 && (Me = !0, ge = ge || o(L[he].value, Be[te].base.value)); - else for (let he = 0; he < _.subject.typesAndValues.length; he++) (_.subject.typesAndValues[he].type === "1.2.840.113549.1.9.1" || _.subject.typesAndValues[he].type === "0.9.2342.19200300.100.1.3") && (Me = !0, ge = ge || o(_.subject.typesAndValues[he].value.valueBlock.value, Be[te].base.value)); + for (let he = 0; he < L.length; he++) L[he].type === 1 && (_e = !0, ve = ve || o(L[he].value, Be[ee].base.value)); + else for (let he = 0; he < B.subject.typesAndValues.length; he++) (B.subject.typesAndValues[he].type === "1.2.840.113549.1.9.1" || B.subject.typesAndValues[he].type === "0.9.2342.19200300.100.1.3") && (_e = !0, ve = ve || o(B.subject.typesAndValues[he].value.valueBlock.value, Be[ee].base.value)); break; case 1: if (L.length > 0) - for (let he = 0; he < L.length; he++) L[he].type === 2 && (Me = !0, ge = ge || r(L[he].value, Be[te].base.value)); + for (let he = 0; he < L.length; he++) L[he].type === 2 && (_e = !0, ve = ve || r(L[he].value, Be[ee].base.value)); break; case 2: - Me = !0, ge = a(_.subject, Be[te].base.value); + _e = !0, ve = a(B.subject, Be[ee].base.value); break; case 3: if (L.length > 0) - for (let he = 0; he < L.length; he++) L[he].type === 6 && (Me = !0, ge = ge || s(L[he].value, Be[te].base.value)); + for (let he = 0; he < L.length; he++) L[he].type === 6 && (_e = !0, ve = ve || s(L[he].value, Be[ee].base.value)); break; case 4: if (L.length > 0) - for (let he = 0; he < L.length; he++) L[he].type === 7 && (Me = !0, ge = ge || i(L[he].value, Be[te].base.value)); + for (let he = 0; he < L.length; he++) L[he].type === 7 && (_e = !0, ve = ve || i(L[he].value, Be[ee].base.value)); } - if (ge) break; + if (ve) break; } - if (ge === !1 && Be.length > 0 && Me) + if (ve === !1 && Be.length > 0 && _e) throw $.result = !1, $.resultCode = 41, $.resultMessage = 'Failed to meet "permitted sub-trees" name constraint', $; } - let le = !1; + let ie = !1; for (let pe = 0; pe < x.length; pe++) { switch (x[pe].base.type) { case 1: if (L.length >= 0) - for (let ge = 0; ge < L.length; ge++) L[ge].type === 1 && (le = le || o(L[ge].value, x[pe].base.value)); - else for (let ge = 0; ge < _.subject.typesAndValues.length; ge++) (_.subject.typesAndValues[ge].type === "1.2.840.113549.1.9.1" || _.subject.typesAndValues[ge].type === "0.9.2342.19200300.100.1.3") && (le = le || o(_.subject.typesAndValues[ge].value.valueBlock.value, x[pe].base.value)); + for (let ve = 0; ve < L.length; ve++) L[ve].type === 1 && (ie = ie || o(L[ve].value, x[pe].base.value)); + else for (let ve = 0; ve < B.subject.typesAndValues.length; ve++) (B.subject.typesAndValues[ve].type === "1.2.840.113549.1.9.1" || B.subject.typesAndValues[ve].type === "0.9.2342.19200300.100.1.3") && (ie = ie || o(B.subject.typesAndValues[ve].value.valueBlock.value, x[pe].base.value)); break; case 2: if (L.length > 0) - for (let ge = 0; ge < L.length; ge++) L[ge].type === 2 && (le = le || r(L[ge].value, x[pe].base.value)); + for (let ve = 0; ve < L.length; ve++) L[ve].type === 2 && (ie = ie || r(L[ve].value, x[pe].base.value)); break; case 4: - le = le || a(_.subject, x[pe].base.value); + ie = ie || a(B.subject, x[pe].base.value); break; case 6: if (L.length > 0) - for (let ge = 0; ge < L.length; ge++) L[ge].type === 6 && (le = le || s(L[ge].value, x[pe].base.value)); + for (let ve = 0; ve < L.length; ve++) L[ve].type === 6 && (ie = ie || s(L[ve].value, x[pe].base.value)); break; case 7: if (L.length > 0) - for (let ge = 0; ge < L.length; ge++) L[ge].type === 7 && (le = le || i(L[ge].value, x[pe].base.value)); + for (let ve = 0; ve < L.length; ve++) L[ve].type === 7 && (ie = ie || i(L[ve].value, x[pe].base.value)); } - if (le) break; + if (ie) break; } - if (le === !0) + if (ie === !0) throw $.result = !1, $.resultCode = 42, $.resultMessage = 'Failed to meet "excluded sub-trees" name constraint', $; y = y.concat(j), x = x.concat(H); } @@ -65573,25 +65619,25 @@ var Cq = class Iq { } } }; -const CA = "tbsResponseData", Ew = "signatureAlgorithm", Cw = "signature", Op = "certs", Vv = "BasicOCSPResponse", zO = `${Vv}.${CA}`, WO = `${Vv}.${Ew}`, qO = `${Vv}.${Cw}`, IA = `${Vv}.${Op}`, JNe = [ +const CA = "tbsResponseData", Ew = "signatureAlgorithm", Cw = "signature", Pp = "certs", Vv = "BasicOCSPResponse", zO = `${Vv}.${CA}`, WO = `${Vv}.${Ew}`, qO = `${Vv}.${Cw}`, IA = `${Vv}.${Pp}`, JNe = [ zO, WO, qO, IA ], U4 = "1.3.6.1.5.5.7.3.9", YNe = "2.5.29.15", QNe = "2.5.29.37"; -var on, u0 = (on = class extends Ce { +var sn, u0 = (sn = class extends Ce { constructor(t = {}) { - super(), this.tbsResponseData = t[CA] ?? on.defaultValues(CA), this.signatureAlgorithm = t[Ew] ?? on.defaultValues(Ew), this.signature = t[Cw] ?? on.defaultValues(Cw), Op in t && (this.certs = t[Op] ?? on.defaultValues(Op)), t.schema && this.fromSchema(t.schema); + super(), this.tbsResponseData = t[CA] ?? sn.defaultValues(CA), this.signatureAlgorithm = t[Ew] ?? sn.defaultValues(Ew), this.signature = t[Cw] ?? sn.defaultValues(Cw), Pp in t && (this.certs = t[Pp] ?? sn.defaultValues(Pp)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case CA: - return new yc(); + return new bc(); case Ew: - return new fe(); + return new de(); case Cw: - return new ht(); - case Op: + return new pt(); + case Pp: return []; default: return super.defaultValues(t); @@ -65600,14 +65646,14 @@ var on, u0 = (on = class extends Ce { static compareWithDefault(t, n) { switch (t) { case "type": { - let r = yc.compareWithDefault("tbs", n.tbs) && yc.compareWithDefault("responderID", n.responderID) && yc.compareWithDefault("producedAt", n.producedAt) && yc.compareWithDefault("responses", n.responses); - return "responseExtensions" in n && (r = r && yc.compareWithDefault("responseExtensions", n.responseExtensions)), r; + let r = bc.compareWithDefault("tbs", n.tbs) && bc.compareWithDefault("responderID", n.responderID) && bc.compareWithDefault("producedAt", n.producedAt) && bc.compareWithDefault("responses", n.responses); + return "responseExtensions" in n && (r = r && bc.compareWithDefault("responseExtensions", n.responseExtensions)), r; } case Ew: return n.algorithmId === "" && !("algorithmParams" in n); case Cw: - return n.isEqual(on.defaultValues(t)); - case Op: + return n.isEqual(sn.defaultValues(t)); + case Pp: return n.length === 0; default: return super.defaultValues(t); @@ -65618,16 +65664,16 @@ var on, u0 = (on = class extends Ce { return new z({ name: n.blockName || Vv, value: [ - yc.schema(n.tbsResponseData || { names: { blockName: zO } }), - fe.schema(n.signatureAlgorithm || { names: { blockName: WO } }), - new ht({ name: n.signature || qO }), - new ee({ + bc.schema(n.tbsResponseData || { names: { blockName: zO } }), + de.schema(n.signatureAlgorithm || { names: { blockName: WO } }), + new pt({ name: n.signature || qO }), + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new z({ value: [new ot({ + value: [new z({ value: [new st({ name: IA, value: Mr.schema(n.certs || {}) })] })] @@ -65637,12 +65683,12 @@ var on, u0 = (on = class extends Ce { } fromSchema(t) { for (const r of JNe) delete t[r]; - const n = Ee(t, t, on.schema()); - ke.assertSchema(n, this.className), this.tbsResponseData = new yc({ schema: n.result[zO] }), this.signatureAlgorithm = new fe({ schema: n.result[WO] }), this.signature = n.result[qO], IA in n.result && (this.certs = Array.from(n.result[IA], (r) => new Mr({ schema: r }))); + const n = Ee(t, t, sn.schema()); + ke.assertSchema(n, this.className), this.tbsResponseData = new bc({ schema: n.result[zO] }), this.signatureAlgorithm = new de({ schema: n.result[WO] }), this.signature = n.result[qO], IA in n.result && (this.certs = Array.from(n.result[IA], (r) => new Mr({ schema: r }))); } toSchema() { const t = []; - return t.push(this.tbsResponseData.toSchema()), t.push(this.signatureAlgorithm.toSchema()), t.push(this.signature), this.certs && t.push(new ee({ + return t.push(this.tbsResponseData.toSchema()), t.push(this.signatureAlgorithm.toSchema()), t.push(this.signature), this.certs && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -65667,7 +65713,7 @@ var on, u0 = (on = class extends Ce { const c = r.getAlgorithmByOID(a.certID.hashAlgorithm.algorithmId, !0, "CertID.hashAlgorithm"); if (!s[c.name]) { s[c.name] = 1; - const l = new zr(); + const l = new Wr(); i.push(l), await l.createForCertificate(t, { hashAlgorithm: c.name, issuerCertificate: n @@ -65702,66 +65748,66 @@ var on, u0 = (on = class extends Ce { if (!("name" in s)) throw new Error("Empty algorithm"); this.signatureAlgorithm = o.signatureAlgorithm, this.tbsResponseData.tbsView = new Uint8Array(this.tbsResponseData.toSchema(!0).toBER()); const i = await r.signWithPrivateKey(this.tbsResponseData.tbsView, t, { algorithm: s }); - this.signature = new ht({ valueHex: i }); + this.signature = new pt({ valueHex: i }); } async verify(t = {}, n = Ye(!0)) { if (!this.certs || this.certs.length === 0) throw new Error("No certificates attached to the BasicOCSPResponse"); - const r = this.certs, o = t.trustedCerts || [], s = t.issuerCerts || [], i = t.trustedResponders || [], a = await on.collectResponderCandidates(r, this.tbsResponseData.responderID, n); + const r = this.certs, o = t.trustedCerts || [], s = t.issuerCerts || [], i = t.trustedResponders || [], a = await sn.collectResponderCandidates(r, this.tbsResponseData.responderID, n); if (a.length === 0) throw new Error("No certificate matching the OCSP responderID was found in the response"); const c = []; - let l = null, u = !1, d = !1; - for (const f of a) { - const h = r[f]; + let l = null, u = !1, f = !1; + for (const d of a) { + const h = r[d]; let g; try { g = await this.verifyResponseSignature(h, n); } catch (p) { - l === null && (l = p), c.push(`candidate #${f} signature error: ${p.message}`); + l === null && (l = p), c.push(`candidate #${d} signature error: ${p.message}`); continue; } if (!g) { u = !0; continue; } - d = !0; + f = !0; try { - const p = i.length > 0 && on.containsCertificateByDer(i, h); + const p = i.length > 0 && sn.containsCertificateByDer(i, h); let m = []; - p || (m = await on.validateSignerChain(h, r, s, o, n)); + p || (m = await sn.validateSignerChain(h, r, s, o, n)); const v = []; for (const C of [ ...s, ...r, ...o, ...m - ]) on.containsCertificateByDer(v, C) || v.push(C); + ]) sn.containsCertificateByDer(v, C) || v.push(C); let S = !0; - for (const C of this.tbsResponseData.responses) if (!await on.isAuthorizedResponderForCertID(h, C.certID, v, i, n)) { + for (const C of this.tbsResponseData.responses) if (!await sn.isAuthorizedResponderForCertID(h, C.certID, v, i, n)) { S = !1; break; } if (S) return !0; - c.push(`candidate #${f}: responder is not authorized for all SingleResponses`); + c.push(`candidate #${d}: responder is not authorized for all SingleResponses`); } catch (p) { - c.push(`candidate #${f}: ${p.message}`); + c.push(`candidate #${d}: ${p.message}`); } } if (u && c.length === 0 && l === null) return !1; - throw d ? new Error(`OCSP responder verification failed. Reasons: ${c.join("; ")}`) : l || new Error(`OCSP responder verification failed. Reasons: ${c.join("; ")}`); + throw f ? new Error(`OCSP responder verification failed. Reasons: ${c.join("; ")}`) : l || new Error(`OCSP responder verification failed. Reasons: ${c.join("; ")}`); } static containsCertificateByDer(t, n) { const r = n.toSchema(!0).toBER(!1); - return t.some((o) => Kt.equal(o.toSchema(!0).toBER(!1), r)); + return t.some((o) => Wt.equal(o.toSchema(!0).toBER(!1), r)); } static async collectResponderCandidates(t, n, r = Ye(!0)) { const o = []; - if (n instanceof Qt) + if (n instanceof Zt) for (const [s, i] of t.entries()) i.subject.isEqual(n) && o.push(s); else if (n instanceof Oe) for (const [s, i] of t.entries()) { const a = i.subjectPublicKeyInfo.subjectPublicKey; if (!a.valueBlock?.valueHexView) continue; const c = await r.digest({ name: "sha-1" }, a.valueBlock.valueHexView); - Kt.equal(c, n.valueBlock.valueHex) && o.push(s); + Wt.equal(c, n.valueBlock.valueHex) && o.push(s); } else throw new Error("Unsupported OCSP responderID type"); return o; @@ -65772,7 +65818,7 @@ var on, u0 = (on = class extends Ce { static async validateSignerChain(t, n, r, o, s = Ye(!0)) { const i = [], a = (l) => { const u = Sq(l, t); - u && !on.containsCertificateByDer(i, u) && i.push(u); + u && !sn.containsCertificateByDer(i, u) && i.push(u); }; for (const l of r) a(l); for (const l of n) a(l); @@ -65788,10 +65834,10 @@ var on, u0 = (on = class extends Ce { const o = r.getAlgorithmByOID(t.hashAlgorithm.algorithmId, !1); if (!o || !("name" in o)) return []; const s = o.name, i = []; - for (const c of n) on.containsCertificateByDer(i, c) || i.push(c); + for (const c of n) sn.containsCertificateByDer(i, c) || i.push(c); const a = []; for (const c of i) { - const l = new zr(); + const l = new Wr(); try { await l.createForCertificate(c, { hashAlgorithm: s, @@ -65800,7 +65846,7 @@ var on, u0 = (on = class extends Ce { } catch { continue; } - l.hashAlgorithm.algorithmId === t.hashAlgorithm.algorithmId && Kt.equal(l.issuerNameHash.valueBlock.valueHexView, t.issuerNameHash.valueBlock.valueHexView) && Kt.equal(l.issuerKeyHash.valueBlock.valueHexView, t.issuerKeyHash.valueBlock.valueHexView) && a.push(c); + l.hashAlgorithm.algorithmId === t.hashAlgorithm.algorithmId && Wt.equal(l.issuerNameHash.valueBlock.valueHexView, t.issuerNameHash.valueBlock.valueHexView) && Wt.equal(l.issuerKeyHash.valueBlock.valueHexView, t.issuerKeyHash.valueBlock.valueHexView) && a.push(c); } return a; } @@ -65810,17 +65856,17 @@ var on, u0 = (on = class extends Ce { const s = o.name; try { const i = await r.digest({ name: s }, t.subject.toSchema().toBER(!1)); - if (!Kt.equal(new Uint8Array(i), n.issuerNameHash.valueBlock.valueHexView)) return !1; + if (!Wt.equal(new Uint8Array(i), n.issuerNameHash.valueBlock.valueHexView)) return !1; const a = t.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView, c = await r.digest({ name: s }, a); - return Kt.equal(new Uint8Array(c), n.issuerKeyHash.valueBlock.valueHexView); + return Wt.equal(new Uint8Array(c), n.issuerKeyHash.valueBlock.valueHexView); } catch { return !1; } } static async isAuthorizedResponderForCertID(t, n, r, o, s = Ye(!0)) { - if (o.length > 0 && on.containsCertificateByDer(o, t) || await on.certificateMatchesIssuerID(t, n, s)) return !0; - if (!on.certHasOCSPSigningEKU(t) || !on.certKeyUsagePermitsDigitalSignature(t)) return !1; - const i = await on.findIssuersForCertID(n, r, s); + if (o.length > 0 && sn.containsCertificateByDer(o, t) || await sn.certificateMatchesIssuerID(t, n, s)) return !0; + if (!sn.certHasOCSPSigningEKU(t) || !sn.certKeyUsagePermitsDigitalSignature(t)) return !1; + const i = await sn.findIssuersForCertID(n, r, s); for (const a of i) if (t.issuer.isEqual(a.subject)) try { @@ -65835,7 +65881,7 @@ var on, u0 = (on = class extends Ce { const r = n.parsedValue; if (r instanceof sx) return r.keyPurposes.includes(U4); try { - const o = hn(n.extnValue.valueBlock.valueHexView); + const o = pn(n.extnValue.valueBlock.valueHexView); return o.offset === -1 || !(o.result instanceof z) ? !1 : new sx({ schema: o.result }).keyPurposes.includes(U4); } catch { return !1; @@ -65845,17 +65891,17 @@ var on, u0 = (on = class extends Ce { const n = t.extensions?.find((r) => r.extnID === YNe); if (!n) return !0; try { - const r = hn(n.extnValue.valueBlock.valueHexView); - if (r.offset === -1 || !(r.result instanceof ht)) return !1; + const r = pn(n.extnValue.valueBlock.valueHexView); + if (r.offset === -1 || !(r.result instanceof pt)) return !1; const o = new Uint8Array(r.result.valueBlock.valueHexView); return o.length === 0 ? !1 : (o[0] & 128) !== 0; } catch { return !1; } } -}, on.CLASS_NAME = "BasicOCSPResponse", on); -const vI = "tbs", kI = "version", AI = "subject", SI = "subjectPublicKeyInfo", kh = "attributes", Iw = "signatureAlgorithm", Nw = "signatureValue", qm = "CertificationRequestInfo", gT = `${qm}.version`, mT = `${qm}.subject`, yT = `${qm}.subjectPublicKeyInfo`, yx = `${qm}.attributes`, XNe = [ - qm, +}, sn.CLASS_NAME = "BasicOCSPResponse", sn); +const vI = "tbs", kI = "version", AI = "subject", SI = "subjectPublicKeyInfo", Sh = "attributes", Iw = "signatureAlgorithm", Nw = "signatureValue", Gm = "CertificationRequestInfo", gT = `${Gm}.version`, mT = `${Gm}.subject`, yT = `${Gm}.subjectPublicKeyInfo`, yx = `${Gm}.attributes`, XNe = [ + Gm, gT, mT, yT, @@ -65866,18 +65912,18 @@ const vI = "tbs", kI = "version", AI = "subject", SI = "subjectPublicKeyInfo", k function ZNe(e = {}) { const t = e.names ?? {}; return new z({ - name: t.CertificationRequestInfo || qm, + name: t.CertificationRequestInfo || Gm, value: [ - new de({ name: t.CertificationRequestInfoVersion || gT }), - Qt.schema(t.subject || { names: { blockName: mT } }), + new ue({ name: t.CertificationRequestInfoVersion || gT }), + Zt.schema(t.subject || { names: { blockName: mT } }), mi.schema({ names: { blockName: yT } }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new ot({ + value: [new st({ optional: !0, name: t.CertificationRequestInfoAttributes || yx, value: En.schema(t.attributes || {}) @@ -65895,7 +65941,7 @@ Er = class extends Ce { this.tbsView = new Uint8Array(t); } constructor(t = {}) { - super(), this.tbsView = new Uint8Array(t[vI] ?? Er.defaultValues(vI)), this.version = t[kI] ?? Er.defaultValues(kI), this.subject = t[AI] ?? Er.defaultValues(AI), this.subjectPublicKeyInfo = t[SI] ?? Er.defaultValues(SI), kh in t && (this.attributes = t[kh] ?? Er.defaultValues(kh)), this.signatureAlgorithm = t[Iw] ?? Er.defaultValues(Iw), this.signatureValue = t[Nw] ?? Er.defaultValues(Nw), t.schema && this.fromSchema(t.schema); + super(), this.tbsView = new Uint8Array(t[vI] ?? Er.defaultValues(vI)), this.version = t[kI] ?? Er.defaultValues(kI), this.subject = t[AI] ?? Er.defaultValues(AI), this.subjectPublicKeyInfo = t[SI] ?? Er.defaultValues(SI), Sh in t && (this.attributes = t[Sh] ?? Er.defaultValues(Sh)), this.signatureAlgorithm = t[Iw] ?? Er.defaultValues(Iw), this.signatureValue = t[Nw] ?? Er.defaultValues(Nw), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -65904,15 +65950,15 @@ Er = class extends Ce { case kI: return 0; case AI: - return new Qt(); + return new Zt(); case SI: return new mi(); - case kh: + case Sh: return []; case Iw: - return new fe(); + return new de(); case Nw: - return new ht(); + return new pt(); default: return super.defaultValues(t); } @@ -65923,23 +65969,23 @@ Er = class extends Ce { ZNe(n.certificationRequestInfo || {}), new z({ name: n.signatureAlgorithm || Iw, - value: [new Ve(), new Xe({ optional: !0 })] + value: [new $e(), new Xe({ optional: !0 })] }), - new ht({ name: n.signatureValue || Nw }) + new pt({ name: n.signatureValue || Nw }) ] }); } fromSchema(t) { for (const r of XNe) delete t[r]; const n = Ee(t, t, Er.schema()); - ke.assertSchema(n, this.className), this.tbsView = n.result.CertificationRequestInfo.valueBeforeDecodeView, this.version = n.result[gT].valueBlock.valueDec, this.subject = new Qt({ schema: n.result[mT] }), this.subjectPublicKeyInfo = new mi({ schema: n.result[yT] }), yx in n.result && (this.attributes = Array.from(n.result[yx], (r) => new En({ schema: r }))), this.signatureAlgorithm = new fe({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; + ke.assertSchema(n, this.className), this.tbsView = n.result.CertificationRequestInfo.valueBeforeDecodeView, this.version = n.result[gT].valueBlock.valueDec, this.subject = new Zt({ schema: n.result[mT] }), this.subjectPublicKeyInfo = new mi({ schema: n.result[yT] }), yx in n.result && (this.attributes = Array.from(n.result[yx], (r) => new En({ schema: r }))), this.signatureAlgorithm = new de({ schema: n.result.signatureAlgorithm }), this.signatureValue = n.result.signatureValue; } encodeTBS() { const t = [ - new de({ value: this.version }), + new ue({ value: this.version }), this.subject.toSchema(), this.subjectPublicKeyInfo.toSchema() ]; - return kh in this && t.push(new ee({ + return Sh in this && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -65951,7 +65997,7 @@ Er = class extends Ce { let n; if (t === !1) { if (this.tbsView.byteLength === 0) return Er.schema(); - const r = hn(this.tbsView); + const r = pn(this.tbsView); ke.assert(r, "PKCS#10 Certificate Request"), n = r.result; } else n = this.encodeTBS(); return new z({ value: [ @@ -65962,21 +66008,21 @@ Er = class extends Ce { } toJSON() { const t = { - tbs: Xn.encode(this.tbsView), + tbs: Zn.encode(this.tbsView), version: this.version, subject: this.subject.toJSON(), subjectPublicKeyInfo: this.subjectPublicKeyInfo.toJSON(), signatureAlgorithm: this.signatureAlgorithm.toJSON(), signatureValue: this.signatureValue.toJSON() }; - return kh in this && (t.attributes = Array.from(this.attributes || [], (n) => n.toJSON())), t; + return Sh in this && (t.attributes = Array.from(this.attributes || [], (n) => n.toJSON())), t; } async sign(t, n = "SHA-1", r = Ye(!0)) { if (!t) throw new Error("Need to provide a private key for signing"); const o = await r.getSignatureParameters(t, n), s = o.parameters; this.signatureAlgorithm = o.signatureAlgorithm, this.tbsView = new Uint8Array(this.encodeTBS().toBER()); const i = await r.signWithPrivateKey(this.tbsView, t, s); - this.signatureValue = new ht({ valueHex: i }); + this.signatureValue = new pt({ valueHex: i }); } async verify(t = Ye(!0)) { return t.verifyWithPublicKey(this.tbsView, this.signatureValue, this.subjectPublicKeyInfo, this.signatureAlgorithm); @@ -65985,16 +66031,16 @@ Er = class extends Ce { return n.getPublicKey(this.subjectPublicKeyInfo, this.signatureAlgorithm, t); } }, Er.CLASS_NAME = "CertificationRequest"; -const md = "digestAlgorithm", yd = "digest", eOe = [md, yd]; -var ri, Pp = (ri = class extends Ce { +const yd = "digestAlgorithm", bd = "digest", eOe = [yd, bd]; +var ri, Rp = (ri = class extends Ce { constructor(t = {}) { - super(), this.digestAlgorithm = t[md] ?? ri.defaultValues(md), this.digest = t[yd] ?? ri.defaultValues(yd), t.schema && this.fromSchema(t.schema); + super(), this.digestAlgorithm = t[yd] ?? ri.defaultValues(yd), this.digest = t[bd] ?? ri.defaultValues(bd), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case md: - return new fe(); case yd: + return new de(); + case bd: return new Oe(); default: return super.defaultValues(t); @@ -66002,9 +66048,9 @@ var ri, Pp = (ri = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case md: - return fe.compareWithDefault("algorithmId", n.algorithmId) && !("algorithmParams" in n); case yd: + return de.compareWithDefault("algorithmId", n.algorithmId) && !("algorithmParams" in n); + case bd: return n.isEqual(ri.defaultValues(t)); default: return super.defaultValues(t); @@ -66014,16 +66060,16 @@ var ri, Pp = (ri = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [fe.schema(n.digestAlgorithm || { names: { blockName: md } }), new Oe({ name: n.digest || yd })] + value: [de.schema(n.digestAlgorithm || { names: { blockName: yd } }), new Oe({ name: n.digest || bd })] }); } fromSchema(t) { for (const r of eOe) delete t[r]; const n = Ee(t, t, ri.schema({ names: { - digestAlgorithm: { names: { blockName: md } }, - digest: yd + digestAlgorithm: { names: { blockName: yd } }, + digest: bd } })); - ke.assertSchema(n, this.className), this.digestAlgorithm = new fe({ schema: n.result.digestAlgorithm }), this.digest = n.result.digest; + ke.assertSchema(n, this.className), this.digestAlgorithm = new de({ schema: n.result.digestAlgorithm }), this.digest = n.result.digest; } toSchema() { return new z({ value: [this.digestAlgorithm.toSchema(), this.digest] }); @@ -66035,10 +66081,10 @@ var ri, Pp = (ri = class extends Ce { }; } }, ri.CLASS_NAME = "DigestInfo", ri); -const Rp = "eContentType", es = "eContent", tOe = [Rp, es]; -var To, Tp = (To = class extends Ce { +const Tp = "eContentType", es = "eContent", tOe = [Tp, es]; +var Mo, Mp = (Mo = class extends Ce { constructor(t = {}) { - if (super(), this.eContentType = t[Rp] ?? To.defaultValues(Rp), es in t && (this.eContent = t[es] ?? To.defaultValues(es), this.eContent.idBlock.tagClass === 1 && this.eContent.idBlock.tagNumber === 4 && this.eContent.idBlock.isConstructed === !1)) { + if (super(), this.eContentType = t[Tp] ?? Mo.defaultValues(Tp), es in t && (this.eContent = t[es] ?? Mo.defaultValues(es), this.eContent.idBlock.tagClass === 1 && this.eContent.idBlock.tagNumber === 4 && this.eContent.idBlock.isConstructed === !1)) { const n = new Oe({ idBlock: { isConstructed: !0 }, isConstructed: !0 @@ -66057,7 +66103,7 @@ var To, Tp = (To = class extends Ce { } static defaultValues(t) { switch (t) { - case Rp: + case Tp: return ""; case es: return new Oe(); @@ -66067,10 +66113,10 @@ var To, Tp = (To = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Rp: + case Tp: return n === ""; case es: - return n.idBlock.tagClass === 1 && n.idBlock.tagNumber === 4 ? n.isEqual(To.defaultValues(es)) : !1; + return n.idBlock.tagClass === 1 && n.idBlock.tagNumber === 4 ? n.isEqual(Mo.defaultValues(es)) : !1; default: return super.defaultValues(t); } @@ -66079,7 +66125,7 @@ var To, Tp = (To = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.eContentType || "" }), new ee({ + value: [new $e({ name: n.eContentType || "" }), new ne({ optional: !0, idBlock: { tagClass: 3, @@ -66091,15 +66137,15 @@ var To, Tp = (To = class extends Ce { } fromSchema(t) { for (const r of tOe) delete t[r]; - const n = Ee(t, t, To.schema({ names: { - eContentType: Rp, + const n = Ee(t, t, Mo.schema({ names: { + eContentType: Tp, eContent: es } })); ke.assertSchema(n, this.className), this.eContentType = n.result.eContentType.valueBlock.toString(), es in n.result && (this.eContent = n.result.eContent); } toSchema() { const t = []; - return t.push(new Ve({ value: this.eContentType })), this.eContent && To.compareWithDefault(es, this.eContent) === !1 && t.push(new ee({ + return t.push(new $e({ value: this.eContentType })), this.eContent && Mo.compareWithDefault(es, this.eContent) === !1 && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -66110,23 +66156,23 @@ var To, Tp = (To = class extends Ce { } toJSON() { const t = { eContentType: this.eContentType }; - return this.eContent && To.compareWithDefault(es, this.eContent) === !1 && (t.eContent = this.eContent.toJSON()), t; + return this.eContent && Mo.compareWithDefault(es, this.eContent) === !1 && (t.eContent = this.eContent.toJSON()), t; } -}, To.CLASS_NAME = "EncapsulatedContentInfo", To); -const bd = "mac", wd = "macSalt", Wi = "iterations", nOe = [ - bd, +}, Mo.CLASS_NAME = "EncapsulatedContentInfo", Mo); +const wd = "mac", vd = "macSalt", Wi = "iterations", nOe = [ wd, + vd, Wi ]; -var Mo, ku = (Mo = class extends Ce { +var Bo, Au = (Bo = class extends Ce { constructor(t = {}) { - super(), this.mac = t[bd] ?? Mo.defaultValues(bd), this.macSalt = t[wd] ?? Mo.defaultValues(wd), Wi in t && (this.iterations = t[Wi] ?? Mo.defaultValues(Wi)), t.schema && this.fromSchema(t.schema); + super(), this.mac = t[wd] ?? Bo.defaultValues(wd), this.macSalt = t[vd] ?? Bo.defaultValues(vd), Wi in t && (this.iterations = t[Wi] ?? Bo.defaultValues(Wi)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case bd: - return new Pp(); case wd: + return new Rp(); + case vd: return new Oe(); case Wi: return 1; @@ -66136,12 +66182,12 @@ var Mo, ku = (Mo = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case bd: - return Pp.compareWithDefault("digestAlgorithm", n.digestAlgorithm) && Pp.compareWithDefault("digest", n.digest); case wd: - return n.isEqual(Mo.defaultValues(t)); + return Rp.compareWithDefault("digestAlgorithm", n.digestAlgorithm) && Rp.compareWithDefault("digest", n.digest); + case vd: + return n.isEqual(Bo.defaultValues(t)); case Wi: - return n === Mo.defaultValues(t); + return n === Bo.defaultValues(t); default: return super.defaultValues(t); } @@ -66152,9 +66198,9 @@ var Mo, ku = (Mo = class extends Ce { name: n.blockName || "", optional: n.optional || !0, value: [ - Pp.schema(n.mac || { names: { blockName: bd } }), - new Oe({ name: n.macSalt || wd }), - new de({ + Rp.schema(n.mac || { names: { blockName: wd } }), + new Oe({ name: n.macSalt || vd }), + new ue({ optional: !0, name: n.iterations || Wi }) @@ -66163,16 +66209,16 @@ var Mo, ku = (Mo = class extends Ce { } fromSchema(t) { for (const r of nOe) delete t[r]; - const n = Ee(t, t, Mo.schema({ names: { - mac: { names: { blockName: bd } }, - macSalt: wd, + const n = Ee(t, t, Bo.schema({ names: { + mac: { names: { blockName: wd } }, + macSalt: vd, iterations: Wi } })); - ke.assertSchema(n, this.className), this.mac = new Pp({ schema: n.result.mac }), this.macSalt = n.result.macSalt, Wi in n.result && (this.iterations = n.result.iterations.valueBlock.valueDec); + ke.assertSchema(n, this.className), this.mac = new Rp({ schema: n.result.mac }), this.macSalt = n.result.macSalt, Wi in n.result && (this.iterations = n.result.iterations.valueBlock.valueDec); } toSchema() { const t = [this.mac.toSchema(), this.macSalt]; - return this.iterations !== void 0 && t.push(new de({ value: this.iterations })), new z({ value: t }); + return this.iterations !== void 0 && t.push(new ue({ value: this.iterations })), new z({ value: t }); } toJSON() { const t = { @@ -66181,15 +66227,15 @@ var Mo, ku = (Mo = class extends Ce { }; return this.iterations !== void 0 && (t.iterations = this.iterations), t; } -}, Mo.CLASS_NAME = "MacData", Mo); +}, Bo.CLASS_NAME = "MacData", Bo); const NA = "hashAlgorithm", OA = "hashedMessage", rOe = [NA, OA]; var hs, Ms = (hs = class extends Ce { static async create(t, n, r = Ye(!0)) { const o = r.getOIDByAlgorithm({ name: t }, !0, "hashAlgorithm"), s = await r.digest(t, n); return new hs({ - hashAlgorithm: new fe({ + hashAlgorithm: new de({ algorithmId: o, - algorithmParams: new fn() + algorithmParams: new hn() }), hashedMessage: new Oe({ valueHex: s }) }); @@ -66200,7 +66246,7 @@ var hs, Ms = (hs = class extends Ce { static defaultValues(t) { switch (t) { case NA: - return new fe(); + return new de(); case OA: return new Oe(); default: @@ -66221,7 +66267,7 @@ var hs, Ms = (hs = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [fe.schema(n.hashAlgorithm || {}), new Oe({ name: n.hashedMessage || "" })] + value: [de.schema(n.hashAlgorithm || {}), new Oe({ name: n.hashedMessage || "" })] }); } fromSchema(t) { @@ -66230,7 +66276,7 @@ var hs, Ms = (hs = class extends Ce { hashAlgorithm: { names: { blockName: NA } }, hashedMessage: OA } })); - ke.assertSchema(n, this.className), this.hashAlgorithm = new fe({ schema: n.result.hashAlgorithm }), this.hashedMessage = n.result.hashedMessage; + ke.assertSchema(n, this.className), this.hashAlgorithm = new de({ schema: n.result.hashAlgorithm }), this.hashedMessage = n.result.hashedMessage; } toSchema() { return new z({ value: [this.hashAlgorithm.toSchema(), this.hashedMessage] }); @@ -66242,16 +66288,16 @@ var hs, Ms = (hs = class extends Ce { }; } }, hs.CLASS_NAME = "MessageImprint", hs); -const Mp = "reqCert", Qc = "singleRequestExtensions", oOe = [Mp, Qc]; +const Bp = "reqCert", Xc = "singleRequestExtensions", oOe = [Bp, Xc]; var oi, GO = (oi = class extends Ce { constructor(t = {}) { - super(), this.reqCert = t[Mp] ?? oi.defaultValues(Mp), Qc in t && (this.singleRequestExtensions = t[Qc] ?? oi.defaultValues(Qc)), t.schema && this.fromSchema(t.schema); + super(), this.reqCert = t[Bp] ?? oi.defaultValues(Bp), Xc in t && (this.singleRequestExtensions = t[Xc] ?? oi.defaultValues(Xc)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Mp: - return new zr(); - case Qc: + case Bp: + return new Wr(); + case Xc: return []; default: return super.defaultValues(t); @@ -66259,9 +66305,9 @@ var oi, GO = (oi = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Mp: + case Bp: return n.isEqual(oi.defaultValues(t)); - case Qc: + case Xc: return n.length === 0; default: return super.defaultValues(t); @@ -66271,7 +66317,7 @@ var oi, GO = (oi = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [zr.schema(n.reqCert || {}), new ee({ + value: [Wr.schema(n.reqCert || {}), new ne({ optional: !0, idBlock: { tagClass: 3, @@ -66284,14 +66330,14 @@ var oi, GO = (oi = class extends Ce { fromSchema(t) { for (const r of oOe) delete t[r]; const n = Ee(t, t, oi.schema({ names: { - reqCert: { names: { blockName: Mp } }, - extensions: { names: { blockName: Qc } } + reqCert: { names: { blockName: Bp } }, + extensions: { names: { blockName: Xc } } } })); - ke.assertSchema(n, this.className), this.reqCert = new zr({ schema: n.result.reqCert }), Qc in n.result && (this.singleRequestExtensions = Array.from(n.result.singleRequestExtensions.valueBlock.value, (r) => new Bn({ schema: r }))); + ke.assertSchema(n, this.className), this.reqCert = new Wr({ schema: n.result.reqCert }), Xc in n.result && (this.singleRequestExtensions = Array.from(n.result.singleRequestExtensions.valueBlock.value, (r) => new Bn({ schema: r }))); } toSchema() { const t = []; - return t.push(this.reqCert.toSchema()), this.singleRequestExtensions && t.push(new ee({ + return t.push(this.reqCert.toSchema()), this.singleRequestExtensions && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -66305,14 +66351,14 @@ var oi, GO = (oi = class extends Ce { return this.singleRequestExtensions && (t.singleRequestExtensions = Array.from(this.singleRequestExtensions, (n) => n.toJSON())), t; } }, oi.CLASS_NAME = "Request", oi); -const wk = "tbs", Bp = "version", _p = "requestorName", vk = "requestList", Lp = "requestExtensions", Gm = "TBSRequest", PA = `${Gm}.${Bp}`, RA = `${Gm}.${_p}`, JO = `${Gm}.requests`, TA = `${Gm}.${Lp}`, sOe = [ - Gm, +const wk = "tbs", _p = "version", Lp = "requestorName", vk = "requestList", Dp = "requestExtensions", Jm = "TBSRequest", PA = `${Jm}.${_p}`, RA = `${Jm}.${Lp}`, JO = `${Jm}.requests`, TA = `${Jm}.${Dp}`, sOe = [ + Jm, PA, RA, JO, TA ]; -var Hr, bc = (Hr = class extends Ce { +var zr, wc = (zr = class extends Ce { get tbs() { return br(this.tbsView); } @@ -66320,18 +66366,18 @@ var Hr, bc = (Hr = class extends Ce { this.tbsView = new Uint8Array(t); } constructor(t = {}) { - super(), this.tbsView = new Uint8Array(t[wk] ?? Hr.defaultValues(wk)), Bp in t && (this.version = t[Bp] ?? Hr.defaultValues(Bp)), _p in t && (this.requestorName = t[_p] ?? Hr.defaultValues(_p)), this.requestList = t[vk] ?? Hr.defaultValues(vk), Lp in t && (this.requestExtensions = t[Lp] ?? Hr.defaultValues(Lp)), t.schema && this.fromSchema(t.schema); + super(), this.tbsView = new Uint8Array(t[wk] ?? zr.defaultValues(wk)), _p in t && (this.version = t[_p] ?? zr.defaultValues(_p)), Lp in t && (this.requestorName = t[Lp] ?? zr.defaultValues(Lp)), this.requestList = t[vk] ?? zr.defaultValues(vk), Dp in t && (this.requestExtensions = t[Dp] ?? zr.defaultValues(Dp)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { case wk: return Dn; - case Bp: - return 0; case _p: - return new Dt(); - case vk: + return 0; case Lp: + return new Vt(); + case vk: + case Dp: return []; default: return super.defaultValues(t); @@ -66341,12 +66387,12 @@ var Hr, bc = (Hr = class extends Ce { switch (t) { case wk: return n.byteLength === 0; - case Bp: - return n === Hr.defaultValues(t); case _p: - return n.type === Dt.defaultValues("type") && Object.keys(n.value).length === 0; - case vk: + return n === zr.defaultValues(t); case Lp: + return n.type === Vt.defaultValues("type") && Object.keys(n.value).length === 0; + case vk: + case Dp: return n.length === 0; default: return super.defaultValues(t); @@ -66355,32 +66401,32 @@ var Hr, bc = (Hr = class extends Ce { static schema(t = {}) { const n = t.names ?? {}; return new z({ - name: n.blockName || Gm, + name: n.blockName || Jm, value: [ - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new de({ name: n.TBSRequestVersion || PA })] + value: [new ue({ name: n.TBSRequestVersion || PA })] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 1 }, - value: [Dt.schema(n.requestorName || { names: { blockName: RA } })] + value: [Vt.schema(n.requestorName || { names: { blockName: RA } })] }), new z({ name: n.requestList || "TBSRequest.requestList", - value: [new ot({ + value: [new st({ name: n.requests || JO, value: GO.schema(n.requestNames || {}) })] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, @@ -66393,31 +66439,31 @@ var Hr, bc = (Hr = class extends Ce { } fromSchema(t) { for (const r of sOe) delete t[r]; - const n = Ee(t, t, Hr.schema()); - ke.assertSchema(n, this.className), this.tbsView = n.result.TBSRequest.valueBeforeDecodeView, PA in n.result && (this.version = n.result[PA].valueBlock.valueDec), RA in n.result && (this.requestorName = new Dt({ schema: n.result[RA] })), this.requestList = Array.from(n.result[JO], (r) => new GO({ schema: r })), TA in n.result && (this.requestExtensions = Array.from(n.result[TA].valueBlock.value, (r) => new Bn({ schema: r }))); + const n = Ee(t, t, zr.schema()); + ke.assertSchema(n, this.className), this.tbsView = n.result.TBSRequest.valueBeforeDecodeView, PA in n.result && (this.version = n.result[PA].valueBlock.valueDec), RA in n.result && (this.requestorName = new Vt({ schema: n.result[RA] })), this.requestList = Array.from(n.result[JO], (r) => new GO({ schema: r })), TA in n.result && (this.requestExtensions = Array.from(n.result[TA].valueBlock.value, (r) => new Bn({ schema: r }))); } toSchema(t = !1) { let n; if (t === !1) { - if (this.tbsView.byteLength === 0) return Hr.schema(); - const r = hn(this.tbsView); + if (this.tbsView.byteLength === 0) return zr.schema(); + const r = pn(this.tbsView); if (ke.assert(r, "TBS Request"), !(r.result instanceof z)) throw new Error("ASN.1 result should be SEQUENCE"); n = r.result; } else { const r = []; - this.version !== void 0 && r.push(new ee({ + this.version !== void 0 && r.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new de({ value: this.version })] - })), this.requestorName && r.push(new ee({ + value: [new ue({ value: this.version })] + })), this.requestorName && r.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 }, value: [this.requestorName.toSchema()] - })), r.push(new z({ value: Array.from(this.requestList, (o) => o.toSchema()) })), this.requestExtensions && r.push(new ee({ + })), r.push(new z({ value: Array.from(this.requestList, (o) => o.toSchema()) })), this.requestExtensions && r.push(new ne({ idBlock: { tagClass: 3, tagNumber: 2 @@ -66431,19 +66477,19 @@ var Hr, bc = (Hr = class extends Ce { const t = {}; return this.version != null && (t.version = this.version), this.requestorName && (t.requestorName = this.requestorName.toJSON()), t.requestList = Array.from(this.requestList, (n) => n.toJSON()), this.requestExtensions && (t.requestExtensions = Array.from(this.requestExtensions, (n) => n.toJSON())), t; } -}, Hr.CLASS_NAME = "TBSRequest", Hr); -const Ah = "signatureAlgorithm", Sh = "signature", wc = "certs"; -var ps, xh = (ps = class extends Ce { +}, zr.CLASS_NAME = "TBSRequest", zr); +const xh = "signatureAlgorithm", Eh = "signature", vc = "certs"; +var ps, Ch = (ps = class extends Ce { constructor(t = {}) { - super(), this.signatureAlgorithm = t[Ah] ?? ps.defaultValues(Ah), this.signature = t[Sh] ?? ps.defaultValues(Sh), wc in t && (this.certs = t[wc] ?? ps.defaultValues(wc)), t.schema && this.fromSchema(t.schema); + super(), this.signatureAlgorithm = t[xh] ?? ps.defaultValues(xh), this.signature = t[Eh] ?? ps.defaultValues(Eh), vc in t && (this.certs = t[vc] ?? ps.defaultValues(vc)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Ah: - return new fe(); - case Sh: - return new ht(); - case wc: + case xh: + return new de(); + case Eh: + return new pt(); + case vc: return []; default: return super.defaultValues(t); @@ -66451,11 +66497,11 @@ var ps, xh = (ps = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Ah: + case xh: return n.algorithmId === "" && !("algorithmParams" in n); - case Sh: + case Eh: return n.isEqual(ps.defaultValues(t)); - case wc: + case vc: return n.length === 0; default: return super.defaultValues(t); @@ -66466,15 +66512,15 @@ var ps, xh = (ps = class extends Ce { return new z({ name: n.blockName || "", value: [ - fe.schema(n.signatureAlgorithm || {}), - new ht({ name: n.signature || "" }), - new ee({ + de.schema(n.signatureAlgorithm || {}), + new pt({ name: n.signature || "" }), + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new z({ value: [new ot({ + value: [new z({ value: [new st({ name: n.certs || "", value: Mr.schema({}) })] })] @@ -66484,20 +66530,20 @@ var ps, xh = (ps = class extends Ce { } fromSchema(t) { for (const r of [ - Ah, - Sh, - wc + xh, + Eh, + vc ]) delete t[r]; const n = Ee(t, t, ps.schema({ names: { - signatureAlgorithm: { names: { blockName: Ah } }, - signature: Sh, - certs: wc + signatureAlgorithm: { names: { blockName: xh } }, + signature: Eh, + certs: vc } })); - ke.assertSchema(n, this.className), this.signatureAlgorithm = new fe({ schema: n.result.signatureAlgorithm }), this.signature = n.result.signature, wc in n.result && (this.certs = Array.from(n.result.certs, (r) => new Mr({ schema: r }))); + ke.assertSchema(n, this.className), this.signatureAlgorithm = new de({ schema: n.result.signatureAlgorithm }), this.signature = n.result.signature, vc in n.result && (this.certs = Array.from(n.result.certs, (r) => new Mr({ schema: r }))); } toSchema() { const t = []; - return t.push(this.signatureAlgorithm.toSchema()), t.push(this.signature), this.certs && t.push(new ee({ + return t.push(this.signatureAlgorithm.toSchema()), t.push(this.signature), this.certs && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -66514,27 +66560,27 @@ var ps, xh = (ps = class extends Ce { return this.certs && (t.certs = Array.from(this.certs, (n) => n.toJSON())), t; } }, ps.CLASS_NAME = "Signature", ps); -const Dp = "tbsRequest", Xc = "optionalSignature", iOe = [Dp, Xc]; +const jp = "tbsRequest", Zc = "optionalSignature", iOe = [jp, Zc]; var Ta, aOe = (Ta = class extends Ce { constructor(t = {}) { - super(), this.tbsRequest = t[Dp] ?? Ta.defaultValues(Dp), Xc in t && (this.optionalSignature = t[Xc] ?? Ta.defaultValues(Xc)), t.schema && this.fromSchema(t.schema); + super(), this.tbsRequest = t[jp] ?? Ta.defaultValues(jp), Zc in t && (this.optionalSignature = t[Zc] ?? Ta.defaultValues(Zc)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Dp: - return new bc(); - case Xc: - return new xh(); + case jp: + return new wc(); + case Zc: + return new Ch(); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case Dp: - return bc.compareWithDefault("tbs", n.tbs) && bc.compareWithDefault("version", n.version) && bc.compareWithDefault("requestorName", n.requestorName) && bc.compareWithDefault("requestList", n.requestList) && bc.compareWithDefault("requestExtensions", n.requestExtensions); - case Xc: - return xh.compareWithDefault("signatureAlgorithm", n.signatureAlgorithm) && xh.compareWithDefault("signature", n.signature) && xh.compareWithDefault("certs", n.certs); + case jp: + return wc.compareWithDefault("tbs", n.tbs) && wc.compareWithDefault("version", n.version) && wc.compareWithDefault("requestorName", n.requestorName) && wc.compareWithDefault("requestList", n.requestList) && wc.compareWithDefault("requestExtensions", n.requestExtensions); + case Zc: + return Ch.compareWithDefault("signatureAlgorithm", n.signatureAlgorithm) && Ch.compareWithDefault("signature", n.signature) && Ch.compareWithDefault("certs", n.certs); default: return super.defaultValues(t); } @@ -66543,24 +66589,24 @@ var Ta, aOe = (Ta = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "OCSPRequest", - value: [bc.schema(n.tbsRequest || { names: { blockName: Dp } }), new ee({ + value: [wc.schema(n.tbsRequest || { names: { blockName: jp } }), new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [xh.schema(n.optionalSignature || { names: { blockName: Xc } })] + value: [Ch.schema(n.optionalSignature || { names: { blockName: Zc } })] })] }); } fromSchema(t) { for (const r of iOe) delete t[r]; const n = Ee(t, t, Ta.schema()); - ke.assertSchema(n, this.className), this.tbsRequest = new bc({ schema: n.result.tbsRequest }), Xc in n.result && (this.optionalSignature = new xh({ schema: n.result.optionalSignature })); + ke.assertSchema(n, this.className), this.tbsRequest = new wc({ schema: n.result.tbsRequest }), Zc in n.result && (this.optionalSignature = new Ch({ schema: n.result.optionalSignature })); } toSchema(t = !1) { const n = []; - return n.push(this.tbsRequest.toSchema(t)), this.optionalSignature && n.push(new ee({ + return n.push(this.tbsRequest.toSchema(t)), this.optionalSignature && n.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -66574,29 +66620,29 @@ var Ta, aOe = (Ta = class extends Ce { return this.optionalSignature && (t.optionalSignature = this.optionalSignature.toJSON()), t; } async createForCertificate(t, n, r = Ye(!0)) { - const o = new zr(); + const o = new Wr(); await o.createForCertificate(t, n, r), this.tbsRequest.requestList.push(new GO({ reqCert: o })); } async sign(t, n = "SHA-1", r = Ye(!0)) { - if (Ct.assertEmpty(t, "privateKey", "OCSPRequest.sign method"), !this.optionalSignature) throw new Error('Need to create "optionalSignature" field before signing'); + if (Ot.assertEmpty(t, "privateKey", "OCSPRequest.sign method"), !this.optionalSignature) throw new Error('Need to create "optionalSignature" field before signing'); const o = await r.getSignatureParameters(t, n), s = o.parameters; this.optionalSignature.signatureAlgorithm = o.signatureAlgorithm; const i = this.tbsRequest.toSchema(!0).toBER(!1), a = await r.signWithPrivateKey(i, t, s); - this.optionalSignature.signature = new ht({ valueHex: a }); + this.optionalSignature.signature = new pt({ valueHex: a }); } verify() { } }, Ta.CLASS_NAME = "OCSPRequest", Ta); -const jp = "responseType", Fp = "response", cOe = [jp, Fp]; -var si, Vp = (si = class extends Ce { +const Fp = "responseType", Vp = "response", cOe = [Fp, Vp]; +var si, $p = (si = class extends Ce { constructor(t = {}) { - super(), this.responseType = t[jp] ?? si.defaultValues(jp), this.response = t[Fp] ?? si.defaultValues(Fp), t.schema && this.fromSchema(t.schema); + super(), this.responseType = t[Fp] ?? si.defaultValues(Fp), this.response = t[Vp] ?? si.defaultValues(Vp), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case jp: - return ""; case Fp: + return ""; + case Vp: return new Oe(); default: return super.defaultValues(t); @@ -66604,9 +66650,9 @@ var si, Vp = (si = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case jp: - return n === ""; case Fp: + return n === ""; + case Vp: return n.isEqual(si.defaultValues(t)); default: return super.defaultValues(t); @@ -66616,19 +66662,19 @@ var si, Vp = (si = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "", - value: [new Ve({ name: n.responseType || "" }), new Oe({ name: n.response || "" })] + value: [new $e({ name: n.responseType || "" }), new Oe({ name: n.response || "" })] }); } fromSchema(t) { for (const r of cOe) delete t[r]; const n = Ee(t, t, si.schema({ names: { - responseType: jp, - response: Fp + responseType: Fp, + response: Vp } })); ke.assertSchema(n, this.className), this.responseType = n.result.responseType.valueBlock.toString(), this.response = n.result.response; } toSchema() { - return new z({ value: [new Ve({ value: this.responseType }), this.response] }); + return new z({ value: [new $e({ value: this.responseType }), this.response] }); } toJSON() { return { @@ -66637,27 +66683,27 @@ var si, Vp = (si = class extends Ce { }; } }, si.CLASS_NAME = "ResponseBytes", si); -const Eh = "responseStatus", Di = "responseBytes"; +const Ih = "responseStatus", Di = "responseBytes"; var ii, lOe = (ii = class extends Ce { constructor(t = {}) { - super(), this.responseStatus = t[Eh] ?? ii.defaultValues(Eh), Di in t && (this.responseBytes = t[Di] ?? ii.defaultValues(Di)), t.schema && this.fromSchema(t.schema); + super(), this.responseStatus = t[Ih] ?? ii.defaultValues(Ih), Di in t && (this.responseBytes = t[Di] ?? ii.defaultValues(Di)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Eh: - return new Df(); + case Ih: + return new Ff(); case Di: - return new Vp(); + return new $p(); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case Eh: + case Ih: return n.isEqual(ii.defaultValues(t)); case Di: - return Vp.compareWithDefault("responseType", n.responseType) && Vp.compareWithDefault("response", n.response); + return $p.compareWithDefault("responseType", n.responseType) && $p.compareWithDefault("response", n.response); default: return super.defaultValues(t); } @@ -66666,24 +66712,24 @@ var ii, lOe = (ii = class extends Ce { const n = t.names ?? {}; return new z({ name: n.blockName || "OCSPResponse", - value: [new Df({ name: n.responseStatus || Eh }), new ee({ + value: [new Ff({ name: n.responseStatus || Ih }), new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [Vp.schema(n.responseBytes || { names: { blockName: Di } })] + value: [$p.schema(n.responseBytes || { names: { blockName: Di } })] })] }); } fromSchema(t) { - for (const r of [Eh, Di]) delete t[r]; + for (const r of [Ih, Di]) delete t[r]; const n = Ee(t, t, ii.schema()); - ke.assertSchema(n, this.className), this.responseStatus = n.result.responseStatus, Di in n.result && (this.responseBytes = new Vp({ schema: n.result.responseBytes })); + ke.assertSchema(n, this.className), this.responseStatus = n.result.responseStatus, Di in n.result && (this.responseBytes = new $p({ schema: n.result.responseBytes })); } toSchema() { const t = []; - return t.push(this.responseStatus), this.responseBytes && t.push(new ee({ + return t.push(this.responseStatus), this.responseBytes && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -66703,7 +66749,7 @@ var ii, lOe = (ii = class extends Ce { }; if (!this.responseBytes || this.responseBytes.responseType !== "1.3.6.1.5.5.7.48.1.1") return s; try { - const i = hn(this.responseBytes.response.valueBlock.valueHexView); + const i = pn(this.responseBytes.response.valueBlock.valueHexView); ke.assert(i, "Basic OCSP response"), o = new u0({ schema: i.result }); } catch { return s; @@ -66723,7 +66769,7 @@ var ii, lOe = (ii = class extends Ce { throw new Error(`Unknown ResponseBytes type: ${this.responseBytes?.responseType || "Unknown"}`); } }, ii.CLASS_NAME = "OCSPResponse", ii); -const Au = "type", qi = "attributes", kk = "encodedValue", uOe = [qi]; +const Su = "type", qi = "attributes", kk = "encodedValue", uOe = [qi]; function dOe(e) { const t = e.map((n) => ({ value: n, @@ -66738,13 +66784,13 @@ function dOe(e) { return 0; }), t.map((n) => n.value); } -var Cr, eo = (Cr = class extends Ce { +var Cr, to = (Cr = class extends Ce { constructor(t = {}) { - super(), this.type = t[Au] ?? Cr.defaultValues(Au), this.attributes = t[qi] ?? Cr.defaultValues(qi), this.encodedValue = t[kk] ?? Cr.defaultValues(kk), t.schema && this.fromSchema(t.schema); + super(), this.type = t[Su] ?? Cr.defaultValues(Su), this.attributes = t[qi] ?? Cr.defaultValues(qi), this.encodedValue = t[kk] ?? Cr.defaultValues(kk), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Au: + case Su: return -1; case qi: return []; @@ -66756,8 +66802,8 @@ var Cr, eo = (Cr = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Au: - return n === Cr.defaultValues(Au); + case Su: + return n === Cr.defaultValues(Su); case qi: return n.length === 0; case kk: @@ -66768,14 +66814,14 @@ var Cr, eo = (Cr = class extends Ce { } static schema(t = {}) { const n = t.names ?? {}; - return new ee({ + return new ne({ name: n.blockName || "", optional: !0, idBlock: { tagClass: 3, tagNumber: n.tagNumber || 0 }, - value: [new ot({ + value: [new st({ name: n.attributes || "", value: En.schema() })] @@ -66796,9 +66842,9 @@ var Cr, eo = (Cr = class extends Ce { this.attributes = Array.from(n.result.attributes, (o) => new En({ schema: o })); } toSchema() { - if (Cr.compareWithDefault(Au, this.type) || Cr.compareWithDefault(qi, this.attributes)) throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class'); + if (Cr.compareWithDefault(Su, this.type) || Cr.compareWithDefault(qi, this.attributes)) throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class'); let t = Array.from(this.attributes, (n) => n.toSchema()); - return this.type === 0 && this.encodedValue.byteLength === 0 && (t = dOe(t)), new ee({ + return this.type === 0 && this.encodedValue.byteLength === 0 && (t = dOe(t)), new ne({ optional: !0, idBlock: { tagClass: 3, @@ -66808,14 +66854,14 @@ var Cr, eo = (Cr = class extends Ce { }); } toJSON() { - if (Cr.compareWithDefault(Au, this.type) || Cr.compareWithDefault(qi, this.attributes)) throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class'); + if (Cr.compareWithDefault(Su, this.type) || Cr.compareWithDefault(qi, this.attributes)) throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class'); return { type: this.type, attributes: Array.from(this.attributes, (t) => t.toJSON()) }; } }, Cr.CLASS_NAME = "SignedAndUnsignedAttributes", Cr); -const $p = "version", vd = "sid", Up = "digestAlgorithm", Zc = "signedAttrs", Kp = "signatureAlgorithm", Ow = "signature", el = "unsignedAttrs", lu = "SignerInfo", YO = `${lu}.${$p}`, Pw = `${lu}.${vd}`, QO = `${lu}.${Up}`, MA = `${lu}.${Zc}`, XO = `${lu}.${Kp}`, ZO = `${lu}.${Ow}`, BA = `${lu}.${el}`, fOe = [ +const Up = "version", kd = "sid", Kp = "digestAlgorithm", el = "signedAttrs", Hp = "signatureAlgorithm", Ow = "signature", tl = "unsignedAttrs", uu = "SignerInfo", YO = `${uu}.${Up}`, Pw = `${uu}.${kd}`, QO = `${uu}.${Kp}`, MA = `${uu}.${el}`, XO = `${uu}.${Hp}`, ZO = `${uu}.${Ow}`, BA = `${uu}.${tl}`, fOe = [ YO, Pw, QO, @@ -66824,45 +66870,45 @@ const $p = "version", vd = "sid", Up = "digestAlgorithm", Zc = "signedAttrs", Kp ZO, BA ]; -var cn, eP = (cn = class extends Ce { +var ln, eP = (ln = class extends Ce { constructor(t = {}) { - super(), this.version = t[$p] ?? cn.defaultValues($p), this.sid = t[vd] ?? cn.defaultValues(vd), this.digestAlgorithm = t[Up] ?? cn.defaultValues(Up), Zc in t && (this.signedAttrs = t[Zc] ?? cn.defaultValues(Zc)), this.signatureAlgorithm = t[Kp] ?? cn.defaultValues(Kp), this.signature = t[Ow] ?? cn.defaultValues(Ow), el in t && (this.unsignedAttrs = t[el] ?? cn.defaultValues(el)), t.schema && this.fromSchema(t.schema); + super(), this.version = t[Up] ?? ln.defaultValues(Up), this.sid = t[kd] ?? ln.defaultValues(kd), this.digestAlgorithm = t[Kp] ?? ln.defaultValues(Kp), el in t && (this.signedAttrs = t[el] ?? ln.defaultValues(el)), this.signatureAlgorithm = t[Hp] ?? ln.defaultValues(Hp), this.signature = t[Ow] ?? ln.defaultValues(Ow), tl in t && (this.unsignedAttrs = t[tl] ?? ln.defaultValues(tl)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case $p: + case Up: return 0; - case vd: + case kd: return new Xe(); - case Up: - return new fe(); - case Zc: - return new eo({ type: 0 }); case Kp: - return new fe(); + return new de(); + case el: + return new to({ type: 0 }); + case Hp: + return new de(); case Ow: return new Oe(); - case el: - return new eo({ type: 1 }); + case tl: + return new to({ type: 1 }); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case $p: - return cn.defaultValues($p) === n; - case vd: - return n instanceof Xe; case Up: - return n instanceof fe ? n.isEqual(cn.defaultValues(Up)) : !1; - case Zc: - return eo.compareWithDefault("type", n.type) && eo.compareWithDefault("attributes", n.attributes) && eo.compareWithDefault("encodedValue", n.encodedValue); + return ln.defaultValues(Up) === n; + case kd: + return n instanceof Xe; case Kp: - return n instanceof fe ? n.isEqual(cn.defaultValues(Kp)) : !1; - case Ow: + return n instanceof de ? n.isEqual(ln.defaultValues(Kp)) : !1; case el: - return eo.compareWithDefault("type", n.type) && eo.compareWithDefault("attributes", n.attributes) && eo.compareWithDefault("encodedValue", n.encodedValue); + return to.compareWithDefault("type", n.type) && to.compareWithDefault("attributes", n.attributes) && to.compareWithDefault("encodedValue", n.encodedValue); + case Hp: + return n instanceof de ? n.isEqual(ln.defaultValues(Hp)) : !1; + case Ow: + case tl: + return to.compareWithDefault("type", n.type) && to.compareWithDefault("attributes", n.attributes) && to.compareWithDefault("encodedValue", n.encodedValue); default: return super.defaultValues(t); } @@ -66870,10 +66916,10 @@ var cn, eP = (cn = class extends Ce { static schema(t = {}) { const n = t.names ?? {}; return new z({ - name: lu, + name: uu, value: [ - new de({ name: n.version || YO }), - new Xt({ value: [mr.schema(n.sidSchema || { names: { blockName: Pw } }), new Xt({ value: [new ee({ + new ue({ name: n.version || YO }), + new en({ value: [mr.schema(n.sidSchema || { names: { blockName: Pw } }), new en({ value: [new ne({ optional: !0, name: n.sid || Pw, idBlock: { @@ -66889,14 +66935,14 @@ var cn, eP = (cn = class extends Ce { tagNumber: 0 } })] })] }), - fe.schema(n.digestAlgorithm || { names: { blockName: QO } }), - eo.schema(n.signedAttrs || { names: { + de.schema(n.digestAlgorithm || { names: { blockName: QO } }), + to.schema(n.signedAttrs || { names: { blockName: MA, tagNumber: 0 } }), - fe.schema(n.signatureAlgorithm || { names: { blockName: XO } }), + de.schema(n.signatureAlgorithm || { names: { blockName: XO } }), new Oe({ name: n.signature || ZO }), - eo.schema(n.unsignedAttrs || { names: { + to.schema(n.unsignedAttrs || { names: { blockName: BA, tagNumber: 1 } }) @@ -66905,34 +66951,34 @@ var cn, eP = (cn = class extends Ce { } fromSchema(t) { for (const o of fOe) delete t[o]; - const n = Ee(t, t, cn.schema()); + const n = Ee(t, t, ln.schema()); ke.assertSchema(n, this.className), this.version = n.result[YO].valueBlock.valueDec; const r = n.result[Pw]; - r.idBlock.tagClass === 1 ? this.sid = new mr({ schema: r }) : this.sid = r, this.digestAlgorithm = new fe({ schema: n.result[QO] }), MA in n.result && (this.signedAttrs = new eo({ + r.idBlock.tagClass === 1 ? this.sid = new mr({ schema: r }) : this.sid = r, this.digestAlgorithm = new de({ schema: n.result[QO] }), MA in n.result && (this.signedAttrs = new to({ type: 0, schema: n.result[MA] - })), this.signatureAlgorithm = new fe({ schema: n.result[XO] }), this.signature = n.result[ZO], BA in n.result && (this.unsignedAttrs = new eo({ + })), this.signatureAlgorithm = new de({ schema: n.result[XO] }), this.signature = n.result[ZO], BA in n.result && (this.unsignedAttrs = new to({ type: 1, schema: n.result[BA] })); } toSchema() { - if (cn.compareWithDefault(vd, this.sid)) throw new Error('Incorrectly initialized "SignerInfo" class'); + if (ln.compareWithDefault(kd, this.sid)) throw new Error('Incorrectly initialized "SignerInfo" class'); const t = []; - return t.push(new de({ value: this.version })), this.sid instanceof mr ? t.push(this.sid.toSchema()) : t.push(this.sid), t.push(this.digestAlgorithm.toSchema()), this.signedAttrs && cn.compareWithDefault(Zc, this.signedAttrs) === !1 && t.push(this.signedAttrs.toSchema()), t.push(this.signatureAlgorithm.toSchema()), t.push(this.signature), this.unsignedAttrs && cn.compareWithDefault(el, this.unsignedAttrs) === !1 && t.push(this.unsignedAttrs.toSchema()), new z({ value: t }); + return t.push(new ue({ value: this.version })), this.sid instanceof mr ? t.push(this.sid.toSchema()) : t.push(this.sid), t.push(this.digestAlgorithm.toSchema()), this.signedAttrs && ln.compareWithDefault(el, this.signedAttrs) === !1 && t.push(this.signedAttrs.toSchema()), t.push(this.signatureAlgorithm.toSchema()), t.push(this.signature), this.unsignedAttrs && ln.compareWithDefault(tl, this.unsignedAttrs) === !1 && t.push(this.unsignedAttrs.toSchema()), new z({ value: t }); } toJSON() { - if (cn.compareWithDefault(vd, this.sid)) throw new Error('Incorrectly initialized "SignerInfo" class'); + if (ln.compareWithDefault(kd, this.sid)) throw new Error('Incorrectly initialized "SignerInfo" class'); const t = { version: this.version, digestAlgorithm: this.digestAlgorithm.toJSON(), signatureAlgorithm: this.signatureAlgorithm.toJSON(), signature: this.signature.toJSON() }; - return this.sid instanceof Xe || (t.sid = this.sid.toJSON()), this.signedAttrs && cn.compareWithDefault(Zc, this.signedAttrs) === !1 && (t.signedAttrs = this.signedAttrs.toJSON()), this.unsignedAttrs && cn.compareWithDefault(el, this.unsignedAttrs) === !1 && (t.unsignedAttrs = this.unsignedAttrs.toJSON()), t; + return this.sid instanceof Xe || (t.sid = this.sid.toJSON()), this.signedAttrs && ln.compareWithDefault(el, this.signedAttrs) === !1 && (t.signedAttrs = this.signedAttrs.toJSON()), this.unsignedAttrs && ln.compareWithDefault(tl, this.unsignedAttrs) === !1 && (t.unsignedAttrs = this.unsignedAttrs.toJSON()), t; } -}, cn.CLASS_NAME = "SignerInfo", cn); -const Rw = "version", Tw = "policy", Mw = "messageImprint", Bw = "serialNumber", _w = "genTime", kd = "ordering", Ad = "nonce", Hp = "accuracy", zp = "tsa", Wp = "extensions", xs = "TSTInfo", tP = `${xs}.${Rw}`, nP = `${xs}.${Tw}`, rP = `${xs}.${Mw}`, oP = `${xs}.${Bw}`, sP = `${xs}.${_w}`, _A = `${xs}.${Hp}`, LA = `${xs}.${kd}`, DA = `${xs}.${Ad}`, jA = `${xs}.${zp}`, FA = `${xs}.${Wp}`, hOe = [ +}, ln.CLASS_NAME = "SignerInfo", ln); +const Rw = "version", Tw = "policy", Mw = "messageImprint", Bw = "serialNumber", _w = "genTime", Ad = "ordering", Sd = "nonce", zp = "accuracy", Wp = "tsa", qp = "extensions", xs = "TSTInfo", tP = `${xs}.${Rw}`, nP = `${xs}.${Tw}`, rP = `${xs}.${Mw}`, oP = `${xs}.${Bw}`, sP = `${xs}.${_w}`, _A = `${xs}.${zp}`, LA = `${xs}.${Ad}`, DA = `${xs}.${Sd}`, jA = `${xs}.${Wp}`, FA = `${xs}.${qp}`, hOe = [ tP, nP, rP, @@ -66946,7 +66992,7 @@ const Rw = "version", Tw = "policy", Mw = "messageImprint", Bw = "serialNumber", ]; var Kn, pOe = (Kn = class extends Ce { constructor(t = {}) { - super(), this.version = t[Rw] ?? Kn.defaultValues(Rw), this.policy = t[Tw] ?? Kn.defaultValues(Tw), this.messageImprint = t[Mw] ?? Kn.defaultValues(Mw), this.serialNumber = t[Bw] ?? Kn.defaultValues(Bw), this.genTime = t[_w] ?? Kn.defaultValues(_w), Hp in t && (this.accuracy = t[Hp] ?? Kn.defaultValues(Hp)), kd in t && (this.ordering = t[kd] ?? Kn.defaultValues(kd)), Ad in t && (this.nonce = t[Ad] ?? Kn.defaultValues(Ad)), zp in t && (this.tsa = t[zp] ?? Kn.defaultValues(zp)), Wp in t && (this.extensions = t[Wp] ?? Kn.defaultValues(Wp)), t.schema && this.fromSchema(t.schema); + super(), this.version = t[Rw] ?? Kn.defaultValues(Rw), this.policy = t[Tw] ?? Kn.defaultValues(Tw), this.messageImprint = t[Mw] ?? Kn.defaultValues(Mw), this.serialNumber = t[Bw] ?? Kn.defaultValues(Bw), this.genTime = t[_w] ?? Kn.defaultValues(_w), zp in t && (this.accuracy = t[zp] ?? Kn.defaultValues(zp)), Ad in t && (this.ordering = t[Ad] ?? Kn.defaultValues(Ad)), Sd in t && (this.nonce = t[Sd] ?? Kn.defaultValues(Sd)), Wp in t && (this.tsa = t[Wp] ?? Kn.defaultValues(Wp)), qp in t && (this.extensions = t[qp] ?? Kn.defaultValues(qp)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -66957,18 +67003,18 @@ var Kn, pOe = (Kn = class extends Ce { case Mw: return new Ms(); case Bw: - return new de(); + return new ue(); case _w: return new Date(0, 0, 0); - case Hp: - return new mh(); - case kd: - return !1; - case Ad: - return new de(); case zp: - return new Dt(); + return new bh(); + case Ad: + return !1; + case Sd: + return new ue(); case Wp: + return new Vt(); + case qp: return []; default: return super.defaultValues(t); @@ -66979,18 +67025,18 @@ var Kn, pOe = (Kn = class extends Ce { case Rw: case Tw: case _w: - case kd: - return n === Kn.defaultValues(kd); + case Ad: + return n === Kn.defaultValues(Ad); case Mw: return Ms.compareWithDefault("hashAlgorithm", n.hashAlgorithm) && Ms.compareWithDefault("hashedMessage", n.hashedMessage); case Bw: - case Ad: - return n.isEqual(Kn.defaultValues(Ad)); - case Hp: - return mh.compareWithDefault("seconds", n.seconds) && mh.compareWithDefault("millis", n.millis) && mh.compareWithDefault("micros", n.micros); + case Sd: + return n.isEqual(Kn.defaultValues(Sd)); case zp: - return Dt.compareWithDefault("type", n.type) && Dt.compareWithDefault("value", n.value); + return bh.compareWithDefault("seconds", n.seconds) && bh.compareWithDefault("millis", n.millis) && bh.compareWithDefault("micros", n.micros); case Wp: + return Vt.compareWithDefault("type", n.type) && Vt.compareWithDefault("value", n.value); + case qp: return n.length === 0; default: return super.defaultValues(t); @@ -67001,35 +67047,35 @@ var Kn, pOe = (Kn = class extends Ce { return new z({ name: n.blockName || xs, value: [ - new de({ name: n.version || tP }), - new Ve({ name: n.policy || nP }), + new ue({ name: n.version || tP }), + new $e({ name: n.policy || nP }), Ms.schema(n.messageImprint || { names: { blockName: rP } }), - new de({ name: n.serialNumber || oP }), - new Yt({ name: n.genTime || sP }), - mh.schema(n.accuracy || { names: { blockName: _A } }), - new Ql({ + new ue({ name: n.serialNumber || oP }), + new Xt({ name: n.genTime || sP }), + bh.schema(n.accuracy || { names: { blockName: _A } }), + new Xl({ name: n.ordering || LA, optional: !0 }), - new de({ + new ue({ name: n.nonce || DA, optional: !0 }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [Dt.schema(n.tsa || { names: { blockName: jA } })] + value: [Vt.schema(n.tsa || { names: { blockName: jA } })] }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 1 }, - value: [new ot({ + value: [new st({ name: n.extensions || FA, value: Bn.schema(n.extension || {}) })] @@ -67040,18 +67086,18 @@ var Kn, pOe = (Kn = class extends Ce { fromSchema(t) { for (const r of hOe) delete t[r]; const n = Ee(t, t, Kn.schema()); - ke.assertSchema(n, this.className), this.version = n.result[tP].valueBlock.valueDec, this.policy = n.result[nP].valueBlock.toString(), this.messageImprint = new Ms({ schema: n.result[rP] }), this.serialNumber = n.result[oP], this.genTime = n.result[sP].toDate(), _A in n.result && (this.accuracy = new mh({ schema: n.result[_A] })), LA in n.result && (this.ordering = n.result[LA].valueBlock.value), DA in n.result && (this.nonce = n.result[DA]), jA in n.result && (this.tsa = new Dt({ schema: n.result[jA] })), FA in n.result && (this.extensions = Array.from(n.result[FA], (r) => new Bn({ schema: r }))); + ke.assertSchema(n, this.className), this.version = n.result[tP].valueBlock.valueDec, this.policy = n.result[nP].valueBlock.toString(), this.messageImprint = new Ms({ schema: n.result[rP] }), this.serialNumber = n.result[oP], this.genTime = n.result[sP].toDate(), _A in n.result && (this.accuracy = new bh({ schema: n.result[_A] })), LA in n.result && (this.ordering = n.result[LA].valueBlock.value), DA in n.result && (this.nonce = n.result[DA]), jA in n.result && (this.tsa = new Vt({ schema: n.result[jA] })), FA in n.result && (this.extensions = Array.from(n.result[FA], (r) => new Bn({ schema: r }))); } toSchema() { const t = []; - return t.push(new de({ value: this.version })), t.push(new Ve({ value: this.policy })), t.push(this.messageImprint.toSchema()), t.push(this.serialNumber), t.push(new Yt({ valueDate: this.genTime })), this.accuracy && t.push(this.accuracy.toSchema()), this.ordering !== void 0 && t.push(new Ql({ value: this.ordering })), this.nonce && t.push(this.nonce), this.tsa && t.push(new ee({ + return t.push(new ue({ value: this.version })), t.push(new $e({ value: this.policy })), t.push(this.messageImprint.toSchema()), t.push(this.serialNumber), t.push(new Xt({ valueDate: this.genTime })), this.accuracy && t.push(this.accuracy.toSchema()), this.ordering !== void 0 && t.push(new Xl({ value: this.ordering })), this.nonce && t.push(this.nonce), this.tsa && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, value: [this.tsa.toSchema()] - })), this.extensions && t.push(new ee({ + })), this.extensions && t.push(new ne({ optional: !0, idBlock: { tagClass: 3, @@ -67078,10 +67124,10 @@ var Kn, pOe = (Kn = class extends Ce { if (t.notAfter && this.genTime > t.notAfter) throw new Error("Generation time for TSTInfo object is more than notAfter value"); const o = n.getAlgorithmByOID(this.messageImprint.hashAlgorithm.algorithmId, !0, "MessageImprint.hashAlgorithm"), s = await n.digest(o.name, new Uint8Array(r)); - return Kt.equal(s, this.messageImprint.hashedMessage.valueBlock.valueHexView); + return Wt.equal(s, this.messageImprint.hashedMessage.valueBlock.valueHexView); } }, Kn.CLASS_NAME = "TSTInfo", Kn); -const qp = "version", Lw = "digestAlgorithms", Dw = "encapContentInfo", Gp = "certificates", Jp = "crls", jw = "signerInfos", Ry = "ocsps", Xf = "SignedData", iP = `${Xf}.${qp}`, VA = `${Xf}.${Lw}`, aP = `${Xf}.${Dw}`, $A = `${Xf}.${Gp}`, UA = `${Xf}.${Jp}`, KA = `${Xf}.${jw}`, gOe = [ +const Gp = "version", Lw = "digestAlgorithms", Dw = "encapContentInfo", Jp = "certificates", Yp = "crls", jw = "signerInfos", Ry = "ocsps", eh = "SignedData", iP = `${eh}.${Gp}`, VA = `${eh}.${Lw}`, aP = `${eh}.${Dw}`, $A = `${eh}.${Jp}`, UA = `${eh}.${Yp}`, KA = `${eh}.${jw}`, gOe = [ iP, VA, aP, @@ -67089,26 +67135,26 @@ const qp = "version", Lw = "digestAlgorithms", Dw = "encapContentInfo", Gp = "ce UA, KA ]; -var cr = class extends Error { +var lr = class extends Error { constructor({ message: e, code: t = 0, date: n = /* @__PURE__ */ new Date(), signatureVerified: r = null, signerCertificate: o = null, signerCertificateVerified: s = null, timestampSerial: i = null, certificatePath: a = [] }) { super(e), this.name = "SignedDataVerifyError", this.date = n, this.code = t, this.timestampSerial = i, this.signatureVerified = r, this.signerCertificate = o, this.signerCertificateVerified = s, this.certificatePath = a; } -}, nr, bx = (nr = class extends Ce { +}, rr, bx = (rr = class extends Ce { constructor(t = {}) { - super(), this.version = t[qp] ?? nr.defaultValues(qp), this.digestAlgorithms = t[Lw] ?? nr.defaultValues(Lw), this.encapContentInfo = t[Dw] ?? nr.defaultValues(Dw), Gp in t && (this.certificates = t[Gp] ?? nr.defaultValues(Gp)), Jp in t && (this.crls = t[Jp] ?? nr.defaultValues(Jp)), Ry in t && (this.ocsps = t[Ry] ?? nr.defaultValues(Ry)), this.signerInfos = t[jw] ?? nr.defaultValues(jw), t.schema && this.fromSchema(t.schema); + super(), this.version = t[Gp] ?? rr.defaultValues(Gp), this.digestAlgorithms = t[Lw] ?? rr.defaultValues(Lw), this.encapContentInfo = t[Dw] ?? rr.defaultValues(Dw), Jp in t && (this.certificates = t[Jp] ?? rr.defaultValues(Jp)), Yp in t && (this.crls = t[Yp] ?? rr.defaultValues(Yp)), Ry in t && (this.ocsps = t[Ry] ?? rr.defaultValues(Ry)), this.signerInfos = t[jw] ?? rr.defaultValues(jw), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case qp: + case Gp: return 0; case Lw: return []; case Dw: - return new Tp(); - case Gp: - return []; + return new Mp(); case Jp: return []; + case Yp: + return []; case Ry: return []; case jw: @@ -67119,13 +67165,13 @@ var cr = class extends Error { } static compareWithDefault(t, n) { switch (t) { - case qp: - return n === nr.defaultValues(qp); + case Gp: + return n === rr.defaultValues(Gp); case Dw: - return Tp.compareWithDefault("eContentType", n.eContentType) && Tp.compareWithDefault("eContent", n.eContent); + return Mp.compareWithDefault("eContentType", n.eContentType) && Mp.compareWithDefault("eContent", n.eContent); case Lw: - case Gp: case Jp: + case Yp: case Ry: case jw: return n.length === 0; @@ -67136,25 +67182,25 @@ var cr = class extends Error { static schema(t = {}) { const n = t.names ?? {}; return n.optional === void 0 && (n.optional = !1), new z({ - name: n.blockName || Xf, + name: n.blockName || eh, optional: n.optional, value: [ - new de({ name: n.version || iP }), - new An({ value: [new ot({ + new ue({ name: n.version || iP }), + new An({ value: [new st({ name: n.digestAlgorithms || VA, - value: fe.schema() + value: de.schema() })] }), - Tp.schema(n.encapContentInfo || { names: { blockName: aP } }), - new ee({ + Mp.schema(n.encapContentInfo || { names: { blockName: aP } }), + new ne({ name: n.certificates || $A, optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: Eg.schema().valueBlock.value + value: Cg.schema().valueBlock.value }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, @@ -67162,7 +67208,7 @@ var cr = class extends Error { }, value: vA.schema(n.crls || { names: { crls: UA } }).valueBlock.value }), - new An({ value: [new ot({ + new An({ value: [new st({ name: n.signerInfos || KA, value: eP.schema() })] }) @@ -67171,18 +67217,18 @@ var cr = class extends Error { } fromSchema(t) { for (const r of gOe) delete t[r]; - const n = Ee(t, t, nr.schema()); - if (ke.assertSchema(n, this.className), this.version = n.result[iP].valueBlock.valueDec, VA in n.result && (this.digestAlgorithms = Array.from(n.result[VA], (r) => new fe({ schema: r }))), this.encapContentInfo = new Tp({ schema: n.result[aP] }), $A in n.result) { - const r = new Eg({ schema: new An({ value: n.result[$A].valueBlock.value }) }); + const n = Ee(t, t, rr.schema()); + if (ke.assertSchema(n, this.className), this.version = n.result[iP].valueBlock.valueDec, VA in n.result && (this.digestAlgorithms = Array.from(n.result[VA], (r) => new de({ schema: r }))), this.encapContentInfo = new Mp({ schema: n.result[aP] }), $A in n.result) { + const r = new Cg({ schema: new An({ value: n.result[$A].valueBlock.value }) }); this.certificates = r.certificates.slice(0); } UA in n.result && (this.crls = Array.from(n.result[UA], (r) => r.idBlock.tagClass === 1 ? new J0({ schema: r }) : (r.idBlock.tagClass = 1, r.idBlock.tagNumber = 16, new wA({ schema: r })))), KA in n.result && (this.signerInfos = Array.from(n.result[KA], (r) => new eP({ schema: r }))); } toSchema(t = !1) { const n = []; - if (this.certificates && this.certificates.length && this.certificates.some((r) => r instanceof yA) || this.crls && this.crls.length && this.crls.some((r) => r instanceof wA) ? this.version = 5 : this.certificates && this.certificates.length && this.certificates.some((r) => r instanceof Bd) ? this.version = 4 : this.certificates && this.certificates.length && this.certificates.some((r) => r instanceof BO) || this.signerInfos.some((r) => r.version === 3) || this.encapContentInfo.eContentType !== nr.ID_DATA ? this.version = 3 : this.version = 1, n.push(new de({ value: this.version })), n.push(new An({ value: Array.from(this.digestAlgorithms, (r) => r.toSchema()) })), n.push(this.encapContentInfo.toSchema()), this.certificates) { - const r = new Eg({ certificates: this.certificates }).toSchema(); - n.push(new ee({ + if (this.certificates && this.certificates.length && this.certificates.some((r) => r instanceof yA) || this.crls && this.crls.length && this.crls.some((r) => r instanceof wA) ? this.version = 5 : this.certificates && this.certificates.length && this.certificates.some((r) => r instanceof Ld) ? this.version = 4 : this.certificates && this.certificates.length && this.certificates.some((r) => r instanceof BO) || this.signerInfos.some((r) => r.version === 3) || this.encapContentInfo.eContentType !== rr.ID_DATA ? this.version = 3 : this.version = 1, n.push(new ue({ value: this.version })), n.push(new An({ value: Array.from(this.digestAlgorithms, (r) => r.toSchema()) })), n.push(this.encapContentInfo.toSchema()), this.certificates) { + const r = new Cg({ certificates: this.certificates }).toSchema(); + n.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -67190,7 +67236,7 @@ var cr = class extends Error { value: r.valueBlock.value })); } - return this.crls && n.push(new ee({ + return this.crls && n.push(new ne({ idBlock: { tagClass: 3, tagNumber: 1 @@ -67214,16 +67260,16 @@ var cr = class extends Error { return this.certificates && (t.certificates = Array.from(this.certificates, (n) => n.toJSON())), this.crls && (t.crls = Array.from(this.crls, (n) => n.toJSON())), t; } async verify({ signer: t = -1, data: n = Dn, trustedCerts: r = [], checkDate: o = /* @__PURE__ */ new Date(), checkChain: s = !1, passedWhenNotRevValues: i = !1, extendedMode: a = !1, findOrigin: c = null, findIssuer: l = null } = {}, u = Ye(!0)) { - let d = null, f = null; + let f = null, d = null; try { let h = Dn, g = "", p = []; const m = this.signerInfos[t]; - if (!m) throw new cr({ + if (!m) throw new lr({ date: o, code: 1, message: "Unable to get signer by supplied index" }); - if (!this.certificates) throw new cr({ + if (!this.certificates) throw new lr({ date: o, code: 2, message: "No certificates attached to this signed data" @@ -67231,7 +67277,7 @@ var cr = class extends Error { if (m.sid instanceof mr) { for (const k of this.certificates) if (k instanceof Mr && k.issuer.isEqual(m.sid.issuer) && k.serialNumber.isEqual(m.sid.serialNumber)) { - d = k; + f = k; break; } } else { @@ -67239,155 +67285,155 @@ var cr = class extends Error { for (const w of this.certificates) { if (!(w instanceof Mr)) continue; const y = await u.digest({ name: "sha-1" }, w.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView); - if (Kt.equal(y, N)) { - d = w; + if (Wt.equal(y, N)) { + f = w; break; } } } - if (!d) throw new cr({ + if (!f) throw new lr({ date: o, code: 3, message: "Unable to find signer certificate" }); if (this.encapContentInfo.eContentType === "1.2.840.113549.1.9.16.1.4") { - if (!this.encapContentInfo.eContent) throw new cr({ + if (!this.encapContentInfo.eContent) throw new lr({ date: o, code: 15, message: "Error during verification: TSTInfo eContent is empty", signatureVerified: null, - signerCertificate: d, - timestampSerial: f, + signerCertificate: f, + timestampSerial: d, signerCertificateVerified: !0 }); let k; try { k = pOe.fromBER(this.encapContentInfo.eContent.getValue()); } catch { - throw new cr({ + throw new lr({ date: o, code: 15, message: "Error during verification: TSTInfo wrong ASN.1 schema ", signatureVerified: null, - signerCertificate: d, - timestampSerial: f, + signerCertificate: f, + timestampSerial: d, signerCertificateVerified: !0 }); } - if (o = k.genTime, f = k.serialNumber.valueBlock.valueHexView.slice().buffer, n.byteLength === 0) throw new cr({ + if (o = k.genTime, d = k.serialNumber.valueBlock.valueHexView.slice().buffer, n.byteLength === 0) throw new lr({ date: o, code: 4, message: "Missed detached data input array" }); - if (!await k.verify({ data: n }, u)) throw new cr({ + if (!await k.verify({ data: n }, u)) throw new lr({ date: o, code: 15, message: "Error during verification: TSTInfo verification is failed", signatureVerified: !1, - signerCertificate: d, - timestampSerial: f, + signerCertificate: f, + timestampSerial: d, signerCertificateVerified: !0 }); } if (s) { - const k = this.certificates.filter((x) => x instanceof Mr && !!Sq(x, d)), N = { + const k = this.certificates.filter((x) => x instanceof Mr && !!Sq(x, f)), N = { checkDate: o, certs: k, trustedCerts: r }; l && (N.findIssuer = l), c && (N.findOrigin = c); const w = new Cq(N); - if (w.certs.push(d), this.crls) + if (w.certs.push(f), this.crls) for (const x of this.crls) "thisUpdate" in x ? w.crls.push(x) : x.otherRevInfoFormat === "1.3.6.1.5.5.7.48.1.1" && w.ocsps.push(new u0({ schema: x.otherRevInfo })); this.ocsps && w.ocsps.push(...this.ocsps); const y = await w.verify({ passedWhenNotRevValues: i }, u).catch((x) => { - throw new cr({ + throw new lr({ date: o, code: 5, message: `Validation of signer's certificate failed with error: ${x instanceof Object ? x.resultMessage : x}`, - signerCertificate: d, + signerCertificate: f, signerCertificateVerified: !1 }); }); - if (y.certificatePath && (p = y.certificatePath), !y.result) throw new cr({ + if (y.certificatePath && (p = y.certificatePath), !y.result) throw new lr({ date: o, code: 5, message: `Validation of signer's certificate failed: ${y.resultMessage}`, - signerCertificate: d, + signerCertificate: f, signerCertificateVerified: !1 }); } const v = u.getAlgorithmByOID(m.digestAlgorithm.algorithmId); - if (!("name" in v)) throw new cr({ + if (!("name" in v)) throw new lr({ date: o, code: 7, message: `Unsupported signature algorithm: ${m.digestAlgorithm.algorithmId}`, - signerCertificate: d, + signerCertificate: f, signerCertificateVerified: !0 }); g = v.name; const S = this.encapContentInfo.eContent; if (S) S.idBlock.tagClass === 1 && S.idBlock.tagNumber === 4 ? n = S.getValue() : n = S.valueBlock.valueBeforeDecodeView.slice().buffer; - else if (n.byteLength === 0) throw new cr({ + else if (n.byteLength === 0) throw new lr({ date: o, code: 8, message: "Missed detached data input array", - signerCertificate: d, + signerCertificate: f, signerCertificateVerified: !0 }); if (m.signedAttrs) { let k = !1, N = !1; for (const w of m.signedAttrs.attributes) if (w.type === "1.2.840.113549.1.9.3" && (k = !0), w.type === "1.2.840.113549.1.9.4" && (N = !0, h = w.values[0].valueBlock.valueHex), k && N) break; - if (k === !1) throw new cr({ + if (k === !1) throw new lr({ date: o, code: 9, message: 'Attribute "content-type" is a mandatory attribute for "signed attributes"', - signerCertificate: d, + signerCertificate: f, signerCertificateVerified: !0 }); - if (N === !1) throw new cr({ + if (N === !1) throw new lr({ date: o, code: 10, message: 'Attribute "message-digest" is a mandatory attribute for "signed attributes"', signatureVerified: null, - signerCertificate: d, + signerCertificate: f, signerCertificateVerified: !0 }); } if (m.signedAttrs) { const k = await u.digest(g, new Uint8Array(n)); - if (!Kt.equal(k, h)) throw new cr({ + if (!Wt.equal(k, h)) throw new lr({ date: o, code: 15, message: "Error during verification: Message digest doesn't match", signatureVerified: null, - signerCertificate: d, - timestampSerial: f, + signerCertificate: f, + timestampSerial: d, signerCertificateVerified: !0 }); n = m.signedAttrs.encodedValue; } - const C = m.signatureAlgorithm.algorithmId === "1.2.840.113549.1.1.1" ? await u.verifyWithPublicKey(n, m.signature, d.subjectPublicKeyInfo, m.signatureAlgorithm, g) : await u.verifyWithPublicKey(n, m.signature, d.subjectPublicKeyInfo, m.signatureAlgorithm); + const C = m.signatureAlgorithm.algorithmId === "1.2.840.113549.1.1.1" ? await u.verifyWithPublicKey(n, m.signature, f.subjectPublicKeyInfo, m.signatureAlgorithm, g) : await u.verifyWithPublicKey(n, m.signature, f.subjectPublicKeyInfo, m.signatureAlgorithm); return a ? { date: o, code: 14, message: "", signatureVerified: C, - signerCertificate: d, - timestampSerial: f, + signerCertificate: f, + timestampSerial: d, signerCertificateVerified: !0, certificatePath: p } : C; } catch (h) { - throw h instanceof cr ? h : new cr({ + throw h instanceof lr ? h : new lr({ date: o, code: 15, message: `Error during verification: ${h instanceof Error ? h.message : h}`, signatureVerified: null, - signerCertificate: d, - timestampSerial: f, + signerCertificate: f, + timestampSerial: d, signerCertificateVerified: !0 }); } @@ -67398,49 +67444,49 @@ var cr = class extends Error { if (!i) throw new RangeError("SignerInfo index is out of range"); !i.signedAttrs?.attributes.length && "hash" in t.algorithm && "hash" in t.algorithm && t.algorithm.hash && (r = t.algorithm.hash.name); const a = s.getOIDByAlgorithm({ name: r }, !0, "hashAlgorithm"); - this.digestAlgorithms.filter((d) => d.algorithmId === a).length === 0 && this.digestAlgorithms.push(new fe({ + this.digestAlgorithms.filter((f) => f.algorithmId === a).length === 0 && this.digestAlgorithms.push(new de({ algorithmId: a, - algorithmParams: new fn() - })), i.digestAlgorithm = new fe({ + algorithmParams: new hn() + })), i.digestAlgorithm = new de({ algorithmId: a, - algorithmParams: new fn() + algorithmParams: new hn() }); const c = await s.getSignatureParameters(t, r), l = c.parameters; if (i.signatureAlgorithm = c.signatureAlgorithm, i.signedAttrs) if (i.signedAttrs.encodedValue.byteLength !== 0) o = i.signedAttrs.encodedValue; else { o = i.signedAttrs.toSchema().toBER(); - const d = ct(o); - d[0] = 49; + const f = lt(o); + f[0] = 49; } else { - const d = this.encapContentInfo.eContent; - if (d) - d.idBlock.tagClass === 1 && d.idBlock.tagNumber === 4 ? o = d.getValue() : o = d.valueBlock.valueBeforeDecodeView.slice().buffer; + const f = this.encapContentInfo.eContent; + if (f) + f.idBlock.tagClass === 1 && f.idBlock.tagNumber === 4 ? o = f.getValue() : o = f.valueBlock.valueBeforeDecodeView.slice().buffer; else if (o.byteLength === 0) throw new Error("Missed detached data input array"); } const u = await s.signWithPrivateKey(o, t, l); i.signature = new Oe({ valueHex: u }); } -}, nr.CLASS_NAME = "SignedData", nr.ID_DATA = iT, nr); -const Sd = "version", xd = "authSafe", Gi = "macData", Ty = "parsedValue", mOe = [ - Sd, +}, rr.CLASS_NAME = "SignedData", rr.ID_DATA = iT, rr); +const xd = "version", Ed = "authSafe", Gi = "macData", Ty = "parsedValue", mOe = [ xd, + Ed, Gi ]; -var Bo; -Bo = class extends Ce { +var _o; +_o = class extends Ce { constructor(t = {}) { - super(), this.version = t[Sd] ?? Bo.defaultValues(Sd), this.authSafe = t[xd] ?? Bo.defaultValues(xd), Gi in t && (this.macData = t[Gi] ?? Bo.defaultValues(Gi)), Ty in t && (this.parsedValue = t[Ty] ?? Bo.defaultValues(Ty)), t.schema && this.fromSchema(t.schema); + super(), this.version = t[xd] ?? _o.defaultValues(xd), this.authSafe = t[Ed] ?? _o.defaultValues(Ed), Gi in t && (this.macData = t[Gi] ?? _o.defaultValues(Gi)), Ty in t && (this.parsedValue = t[Ty] ?? _o.defaultValues(Ty)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Sd: - return 3; case xd: + return 3; + case Ed: return new Yn(); case Gi: - return new ku(); + return new Au(); case Ty: return {}; default: @@ -67449,12 +67495,12 @@ Bo = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case Sd: - return n === Bo.defaultValues(t); case xd: + return n === _o.defaultValues(t); + case Ed: return Yn.compareWithDefault("contentType", n.contentType) && Yn.compareWithDefault("content", n.content); case Gi: - return ku.compareWithDefault("mac", n.mac) && ku.compareWithDefault("macSalt", n.macSalt) && ku.compareWithDefault("iterations", n.iterations); + return Au.compareWithDefault("mac", n.mac) && Au.compareWithDefault("macSalt", n.macSalt) && Au.compareWithDefault("iterations", n.iterations); case Ty: return n instanceof Object && Object.keys(n).length === 0; default: @@ -67466,9 +67512,9 @@ Bo = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.version || Sd }), - Yn.schema(n.authSafe || { names: { blockName: xd } }), - ku.schema(n.macData || { names: { + new ue({ name: n.version || xd }), + Yn.schema(n.authSafe || { names: { blockName: Ed } }), + Au.schema(n.macData || { names: { blockName: Gi, optional: !0 } }) @@ -67477,15 +67523,15 @@ Bo = class extends Ce { } fromSchema(t) { for (const r of mOe) delete t[r]; - const n = Ee(t, t, Bo.schema({ names: { - version: Sd, - authSafe: { names: { blockName: xd } }, + const n = Ee(t, t, _o.schema({ names: { + version: xd, + authSafe: { names: { blockName: Ed } }, macData: { names: { blockName: Gi } } } })); - ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.authSafe = new Yn({ schema: n.result.authSafe }), Gi in n.result && (this.macData = new ku({ schema: n.result.macData })); + ke.assertSchema(n, this.className), this.version = n.result.version.valueBlock.valueDec, this.authSafe = new Yn({ schema: n.result.authSafe }), Gi in n.result && (this.macData = new Au({ schema: n.result.macData })); } toSchema() { - const t = [new de({ value: this.version }), this.authSafe.toSchema()]; + const t = [new ue({ value: this.version }), this.authSafe.toSchema()]; return this.macData && t.push(this.macData.toSchema()), new z({ value: t }); } toJSON() { @@ -67496,12 +67542,12 @@ Bo = class extends Ce { return this.macData && (t.macData = this.macData.toJSON()), t; } async makeInternalValues(t = {}, n = Ye(!0)) { - if (Ut.assert(t, "parameters", "object"), !this.parsedValue) throw new Error('Please call "parseValues" function first in order to make "parsedValue" data'); - switch (Ct.assertEmpty(this.parsedValue.integrityMode, "integrityMode", "parsedValue"), Ct.assertEmpty(this.parsedValue.authenticatedSafe, "authenticatedSafe", "parsedValue"), this.parsedValue.integrityMode) { + if (zt.assert(t, "parameters", "object"), !this.parsedValue) throw new Error('Please call "parseValues" function first in order to make "parsedValue" data'); + switch (Ot.assertEmpty(this.parsedValue.integrityMode, "integrityMode", "parsedValue"), Ot.assertEmpty(this.parsedValue.authenticatedSafe, "authenticatedSafe", "parsedValue"), this.parsedValue.integrityMode) { case 0: { - if (!("iterations" in t)) throw new Ct("iterations"); - Ct.assertEmpty(t.pbkdf2HashAlgorithm, "pbkdf2HashAlgorithm"), Ct.assertEmpty(t.hmacHashAlgorithm, "hmacHashAlgorithm"), Ct.assertEmpty(t.password, "password"); + if (!("iterations" in t)) throw new Ot("iterations"); + Ot.assertEmpty(t.pbkdf2HashAlgorithm, "pbkdf2HashAlgorithm"), Ot.assertEmpty(t.hmacHashAlgorithm, "hmacHashAlgorithm"), Ot.assertEmpty(t.password, "password"); const r = /* @__PURE__ */ new ArrayBuffer(64), o = new Uint8Array(r); n.getRandomValues(o); const s = this.parsedValue.authenticatedSafe.toSchema().toBER(!1); @@ -67516,9 +67562,9 @@ Bo = class extends Ce { iterationCount: t.iterations, contentToStamp: s }); - this.macData = new ku({ - mac: new Pp({ - digestAlgorithm: new fe({ algorithmId: n.getOIDByAlgorithm({ name: t.hmacHashAlgorithm }, !0, "hmacHashAlgorithm") }), + this.macData = new Au({ + mac: new Rp({ + digestAlgorithm: new de({ algorithmId: n.getOIDByAlgorithm({ name: t.hmacHashAlgorithm }, !0, "hmacHashAlgorithm") }), digest: new Oe({ valueHex: i }) }), macSalt: new Oe({ valueHex: r }), @@ -67528,11 +67574,11 @@ Bo = class extends Ce { break; case 1: { - if (!("signingCertificate" in t)) throw new Ct("signingCertificate"); - Ct.assertEmpty(t.privateKey, "privateKey"), Ct.assertEmpty(t.hashAlgorithm, "hashAlgorithm"); + if (!("signingCertificate" in t)) throw new Ot("signingCertificate"); + Ot.assertEmpty(t.privateKey, "privateKey"), Ot.assertEmpty(t.hashAlgorithm, "hashAlgorithm"); const r = this.parsedValue.authenticatedSafe.toSchema().toBER(!1), o = new bx({ version: 1, - encapContentInfo: new Tp({ + encapContentInfo: new Mp({ eContentType: "1.2.840.113549.1.7.1", eContent: new Oe({ valueHex: r }) }), @@ -67540,7 +67586,7 @@ Bo = class extends Ce { }), s = await n.digest({ name: t.hashAlgorithm }, new Uint8Array(r)), i = []; i.push(new En({ type: "1.2.840.113549.1.9.3", - values: [new Ve({ value: "1.2.840.113549.1.7.1" })] + values: [new $e({ value: "1.2.840.113549.1.7.1" })] })), i.push(new En({ type: "1.2.840.113549.1.9.5", values: [new W0({ valueDate: /* @__PURE__ */ new Date() })] @@ -67553,7 +67599,7 @@ Bo = class extends Ce { issuer: t.signingCertificate.issuer, serialNumber: t.signingCertificate.serialNumber }), - signedAttrs: new eo({ + signedAttrs: new to({ type: 0, attributes: i }) @@ -67568,10 +67614,10 @@ Bo = class extends Ce { } } async parseInternalValues(t, n = Ye(!0)) { - switch (Ut.assert(t, "parameters", "object"), t.checkIntegrity === void 0 && (t.checkIntegrity = !0), this.parsedValue = {}, this.authSafe.contentType) { + switch (zt.assert(t, "parameters", "object"), t.checkIntegrity === void 0 && (t.checkIntegrity = !0), this.parsedValue = {}, this.authSafe.contentType) { case Yn.DATA: { - Ct.assertEmpty(t.password, "password"), this.parsedValue.integrityMode = 0, Ut.assert(this.authSafe.content, "authSafe.content", Oe); + Ot.assertEmpty(t.password, "password"), this.parsedValue.integrityMode = 0, zt.assert(this.authSafe.content, "authSafe.content", Oe); const r = this.authSafe.content.getValue(); if (this.parsedValue.authenticatedSafe = $4.fromBER(r), t.checkIntegrity) { if (!this.macData) throw new Error('Absent "macData" value, can not check PKCS#12 data integrity'); @@ -67591,7 +67637,7 @@ Bo = class extends Ce { { this.parsedValue.integrityMode = 1; const r = new bx({ schema: this.authSafe.content }), o = r.encapContentInfo.eContent; - Ct.assert(o, "eContent", "cmsSigned.encapContentInfo"), Ut.assert(o, "eContent", Oe); + Ot.assert(o, "eContent", "cmsSigned.encapContentInfo"), zt.assert(o, "eContent", Oe); const s = o.getValue(); if (this.parsedValue.authenticatedSafe = $4.fromBER(s), !await r.verify({ signer: 0, @@ -67603,36 +67649,36 @@ Bo = class extends Ce { throw new Error(`Incorrect value for "this.authSafe.contentType": ${this.authSafe.contentType}`); } } -}, Bo.CLASS_NAME = "PFX"; -const Yp = "status", tl = "statusStrings", nl = "failInfo", yOe = [ - Yp, - tl, - nl +}, _o.CLASS_NAME = "PFX"; +const Qp = "status", nl = "statusStrings", rl = "failInfo", yOe = [ + Qp, + nl, + rl ]; -var _o, Ak = (_o = class extends Ce { +var Lo, Ak = (Lo = class extends Ce { constructor(t = {}) { - super(), this.status = t[Yp] ?? _o.defaultValues(Yp), tl in t && (this.statusStrings = t[tl] ?? _o.defaultValues(tl)), nl in t && (this.failInfo = t[nl] ?? _o.defaultValues(nl)), t.schema && this.fromSchema(t.schema); + super(), this.status = t[Qp] ?? Lo.defaultValues(Qp), nl in t && (this.statusStrings = t[nl] ?? Lo.defaultValues(nl)), rl in t && (this.failInfo = t[rl] ?? Lo.defaultValues(rl)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case Yp: + case Qp: return 2; - case tl: - return []; case nl: - return new ht(); + return []; + case rl: + return new pt(); default: return super.defaultValues(t); } } static compareWithDefault(t, n) { switch (t) { - case Yp: - return n === _o.defaultValues(t); - case tl: - return n.length === 0; + case Qp: + return n === Lo.defaultValues(t); case nl: - return n.isEqual(_o.defaultValues(t)); + return n.length === 0; + case rl: + return n.isEqual(Lo.defaultValues(t)); default: return super.defaultValues(t); } @@ -67642,15 +67688,15 @@ var _o, Ak = (_o = class extends Ce { return new z({ name: n.blockName || "", value: [ - new de({ name: n.status || "" }), + new ue({ name: n.status || "" }), new z({ optional: !0, - value: [new ot({ + value: [new st({ name: n.statusStrings || "", value: new ki() })] }), - new ht({ + new pt({ name: n.failInfo || "", optional: !0 }) @@ -67659,19 +67705,19 @@ var _o, Ak = (_o = class extends Ce { } fromSchema(t) { for (const o of yOe) delete t[o]; - const n = Ee(t, t, _o.schema({ names: { - status: Yp, - statusStrings: tl, - failInfo: nl + const n = Ee(t, t, Lo.schema({ names: { + status: Qp, + statusStrings: nl, + failInfo: rl } })); ke.assertSchema(n, this.className); const r = n.result.status; if (r.valueBlock.isHexOnly === !0 || r.valueBlock.valueDec < 0 || r.valueBlock.valueDec > 5) throw new Error('PKIStatusInfo "status" has invalid value'); - this.status = r.valueBlock.valueDec, tl in n.result && (this.statusStrings = n.result.statusStrings), nl in n.result && (this.failInfo = n.result.failInfo); + this.status = r.valueBlock.valueDec, nl in n.result && (this.statusStrings = n.result.statusStrings), rl in n.result && (this.failInfo = n.result.failInfo); } toSchema() { const t = []; - return t.push(new de({ value: this.status })), this.statusStrings && t.push(new z({ + return t.push(new ue({ value: this.status })), this.statusStrings && t.push(new z({ optional: !0, value: this.statusStrings })), this.failInfo && t.push(this.failInfo), new z({ value: t }); @@ -67680,8 +67726,8 @@ var _o, Ak = (_o = class extends Ce { const t = { status: this.status }; return this.statusStrings && (t.statusStrings = Array.from(this.statusStrings, (n) => n.toJSON())), this.failInfo && (t.failInfo = this.failInfo.toJSON()), t; } -}, _o.CLASS_NAME = "PKIStatusInfo", _o); -const Fw = "version", Vw = "messageImprint", Qp = "reqPolicy", Xp = "nonce", Ji = "certReq", Zp = "extensions", Zf = "TimeStampReq", cP = `${Zf}.${Fw}`, lP = `${Zf}.${Vw}`, HA = `${Zf}.${Qp}`, zA = `${Zf}.${Xp}`, WA = `${Zf}.${Ji}`, qA = `${Zf}.${Zp}`, bOe = [ +}, Lo.CLASS_NAME = "PKIStatusInfo", Lo); +const Fw = "version", Vw = "messageImprint", Xp = "reqPolicy", Zp = "nonce", Ji = "certReq", eg = "extensions", th = "TimeStampReq", cP = `${th}.${Fw}`, lP = `${th}.${Vw}`, HA = `${th}.${Xp}`, zA = `${th}.${Zp}`, WA = `${th}.${Ji}`, qA = `${th}.${eg}`, bOe = [ cP, lP, HA, @@ -67689,9 +67735,9 @@ const Fw = "version", Vw = "messageImprint", Qp = "reqPolicy", Xp = "nonce", Ji WA, qA ]; -var rr, VDe = (rr = class extends Ce { +var or, VDe = (or = class extends Ce { constructor(t = {}) { - super(), this.version = t[Fw] ?? rr.defaultValues(Fw), this.messageImprint = t[Vw] ?? rr.defaultValues(Vw), Qp in t && (this.reqPolicy = t[Qp] ?? rr.defaultValues(Qp)), Xp in t && (this.nonce = t[Xp] ?? rr.defaultValues(Xp)), Ji in t && (this.certReq = t[Ji] ?? rr.defaultValues(Ji)), Zp in t && (this.extensions = t[Zp] ?? rr.defaultValues(Zp)), t.schema && this.fromSchema(t.schema); + super(), this.version = t[Fw] ?? or.defaultValues(Fw), this.messageImprint = t[Vw] ?? or.defaultValues(Vw), Xp in t && (this.reqPolicy = t[Xp] ?? or.defaultValues(Xp)), Zp in t && (this.nonce = t[Zp] ?? or.defaultValues(Zp)), Ji in t && (this.certReq = t[Ji] ?? or.defaultValues(Ji)), eg in t && (this.extensions = t[eg] ?? or.defaultValues(eg)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { @@ -67699,13 +67745,13 @@ var rr, VDe = (rr = class extends Ce { return 0; case Vw: return new Ms(); - case Qp: - return ""; case Xp: - return new de(); + return ""; + case Zp: + return new ue(); case Ji: return !1; - case Zp: + case eg: return []; default: return super.defaultValues(t); @@ -67714,14 +67760,14 @@ var rr, VDe = (rr = class extends Ce { static compareWithDefault(t, n) { switch (t) { case Fw: - case Qp: + case Xp: case Ji: - return n === rr.defaultValues(t); + return n === or.defaultValues(t); case Vw: return Ms.compareWithDefault("hashAlgorithm", n.hashAlgorithm) && Ms.compareWithDefault("hashedMessage", n.hashedMessage); - case Xp: - return n.isEqual(rr.defaultValues(t)); case Zp: + return n.isEqual(or.defaultValues(t)); + case eg: return n.length === 0; default: return super.defaultValues(t); @@ -67730,29 +67776,29 @@ var rr, VDe = (rr = class extends Ce { static schema(t = {}) { const n = t.names ?? {}; return new z({ - name: n.blockName || Zf, + name: n.blockName || th, value: [ - new de({ name: n.version || cP }), + new ue({ name: n.version || cP }), Ms.schema(n.messageImprint || { names: { blockName: lP } }), - new Ve({ + new $e({ name: n.reqPolicy || HA, optional: !0 }), - new de({ + new ue({ name: n.nonce || zA, optional: !0 }), - new Ql({ + new Xl({ name: n.certReq || WA, optional: !0 }), - new ee({ + new ne({ optional: !0, idBlock: { tagClass: 3, tagNumber: 0 }, - value: [new ot({ + value: [new st({ name: n.extensions || qA, value: Bn.schema() })] @@ -67762,12 +67808,12 @@ var rr, VDe = (rr = class extends Ce { } fromSchema(t) { for (const r of bOe) delete t[r]; - const n = Ee(t, t, rr.schema()); + const n = Ee(t, t, or.schema()); ke.assertSchema(n, this.className), this.version = n.result[cP].valueBlock.valueDec, this.messageImprint = new Ms({ schema: n.result[lP] }), HA in n.result && (this.reqPolicy = n.result[HA].valueBlock.toString()), zA in n.result && (this.nonce = n.result[zA]), WA in n.result && (this.certReq = n.result[WA].valueBlock.value), qA in n.result && (this.extensions = Array.from(n.result[qA], (r) => new Bn({ schema: r }))); } toSchema() { const t = []; - return t.push(new de({ value: this.version })), t.push(this.messageImprint.toSchema()), this.reqPolicy && t.push(new Ve({ value: this.reqPolicy })), this.nonce && t.push(this.nonce), Ji in this && rr.compareWithDefault(Ji, this.certReq) === !1 && t.push(new Ql({ value: this.certReq })), this.extensions && t.push(new ee({ + return t.push(new ue({ value: this.version })), t.push(this.messageImprint.toSchema()), this.reqPolicy && t.push(new $e({ value: this.reqPolicy })), this.nonce && t.push(this.nonce), Ji in this && or.compareWithDefault(Ji, this.certReq) === !1 && t.push(new Xl({ value: this.certReq })), this.extensions && t.push(new ne({ idBlock: { tagClass: 3, tagNumber: 0 @@ -67780,19 +67826,19 @@ var rr, VDe = (rr = class extends Ce { version: this.version, messageImprint: this.messageImprint.toJSON() }; - return this.reqPolicy !== void 0 && (t.reqPolicy = this.reqPolicy), this.nonce !== void 0 && (t.nonce = this.nonce.toJSON()), this.certReq !== void 0 && rr.compareWithDefault(Ji, this.certReq) === !1 && (t.certReq = this.certReq), this.extensions && (t.extensions = Array.from(this.extensions, (n) => n.toJSON())), t; + return this.reqPolicy !== void 0 && (t.reqPolicy = this.reqPolicy), this.nonce !== void 0 && (t.nonce = this.nonce.toJSON()), this.certReq !== void 0 && or.compareWithDefault(Ji, this.certReq) === !1 && (t.certReq = this.certReq), this.extensions && (t.extensions = Array.from(this.extensions, (n) => n.toJSON())), t; } -}, rr.CLASS_NAME = "TimeStampReq", rr); -const eg = "status", tg = "timeStampToken", bT = "TimeStampResp", uP = `${bT}.${eg}`, GA = `${bT}.${tg}`, wOe = [uP, GA]; +}, or.CLASS_NAME = "TimeStampReq", or); +const tg = "status", ng = "timeStampToken", bT = "TimeStampResp", uP = `${bT}.${tg}`, GA = `${bT}.${ng}`, wOe = [uP, GA]; var Ma, $De = (Ma = class extends Ce { constructor(t = {}) { - super(), this.status = t[eg] ?? Ma.defaultValues(eg), tg in t && (this.timeStampToken = t[tg] ?? Ma.defaultValues(tg)), t.schema && this.fromSchema(t.schema); + super(), this.status = t[tg] ?? Ma.defaultValues(tg), ng in t && (this.timeStampToken = t[ng] ?? Ma.defaultValues(ng)), t.schema && this.fromSchema(t.schema); } static defaultValues(t) { switch (t) { - case eg: - return new Ak(); case tg: + return new Ak(); + case ng: return new Yn(); default: return super.defaultValues(t); @@ -67800,9 +67846,9 @@ var Ma, $De = (Ma = class extends Ce { } static compareWithDefault(t, n) { switch (t) { - case eg: - return Ak.compareWithDefault(eg, n.status) && !("statusStrings" in n) && !("failInfo" in n); case tg: + return Ak.compareWithDefault(tg, n.status) && !("statusStrings" in n) && !("failInfo" in n); + case ng: return n.contentType === "" && n.content instanceof Xe; default: return super.defaultValues(t); @@ -67897,7 +67943,7 @@ const Oq = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ randomPositiveInteger: Nq, toArrayBuffer: X2, toHex: kOe -}, Symbol.toStringTag, { value: "Module" })), ln = { +}, Symbol.toStringTag, { value: "Module" })), un = { data: "1.2.840.113549.1.7.1", signedData: "1.2.840.113549.1.7.2", contentType: "1.2.840.113549.1.9.3", @@ -67956,15 +68002,15 @@ const Oq = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ /** `id-etsi-ext-valassured-ST-certs`, in ETSI's standard 319 412-1: a short-term certificate. */ validityAssuredShortTerm: "0.4.0.194121.2.1" }, UDe = { - [ln.sha1]: "sha1", - [ln.sha256]: "sha256", - [ln.sha384]: "sha384", - [ln.sha512]: "sha512" + [un.sha1]: "sha1", + [un.sha256]: "sha256", + [un.sha384]: "sha384", + [un.sha512]: "sha512" }, KDe = { - sha1: ln.sha1, - sha256: ln.sha256, - sha384: ln.sha384, - sha512: ln.sha512 + sha1: un.sha1, + sha256: un.sha256, + sha384: un.sha384, + sha512: un.sha512 }, Pq = { sha1: "SHA-1", sha256: "SHA-256", @@ -67985,11 +68031,11 @@ function Tq(e) { } function zDe(e) { const t = Tq(e); - return Rq(t) ? new W0({ valueDate: t }) : new Yt({ valueDate: t }); + return Rq(t) ? new W0({ valueDate: t }) : new Xt({ valueDate: t }); } function d0(e) { const t = Tq(e); - return new or({ type: Rq(t) ? 0 : 1, value: t }); + return new sr({ type: Rq(t) ? 0 : 1, value: t }); } function Z2(e) { const t = e.privateKey.algorithm; @@ -68033,7 +68079,7 @@ function H4(e) { } } async function WDe(e = {}) { - const { selfSignedCertificate: t } = await import("./self-signed-DIdbaT2K.js"), n = e.hash ?? "sha256", r = await Ig(e.algorithm ?? "RSA-PKCS1-v1_5", n, !0), o = await t({ + const { selfSignedCertificate: t } = await import("./self-signed-BsJCIg7s.js"), n = e.hash ?? "sha256", r = await Ng(e.algorithm ?? "RSA-PKCS1-v1_5", n, !0), o = await t({ publicKey: r.publicKey, privateKey: r.privateKey, commonName: e.commonName ?? "EmbedPDF test signer", @@ -68046,7 +68092,7 @@ async function WDe(e = {}) { }), certificate: o, privateKey: r.privateKey }; } async function qDe(e = {}) { - const { timestampAuthorityCertificate: t } = await import("./self-signed-DIdbaT2K.js"), n = await Ig("RSA-PKCS1-v1_5", "sha256", !0), r = await t({ + const { timestampAuthorityCertificate: t } = await import("./self-signed-BsJCIg7s.js"), n = await Ng("RSA-PKCS1-v1_5", "sha256", !0), r = await t({ publicKey: n.publicKey, privateKey: n.privateKey, commonName: e.commonName ?? "EmbedPDF test timestamp authority", @@ -68054,14 +68100,14 @@ async function qDe(e = {}) { }), o = Z2({ privateKey: n.privateKey, certificateChain: [r] - }), { buildTimestampToken: s } = await import("./timestamp-DdhyGESj.js").then((i) => i.t); + }), { buildTimestampToken: s } = await import("./timestamp-YjVubp40.js").then((i) => i.t); return { kind: "cms", certificate: r, sign: ({ digest: i, algorithm: a }) => s({ digest: i, hash: a, authority: o }) }; } -async function Ig(e, t, n) { +async function Ng(e, t, n) { return await globalThis.crypto.subtle.generateKey( e === "ECDSA" ? { name: "ECDSA", namedCurve: "P-256" } : { name: e === "RSA-PSS" ? "RSA-PSS" : "RSASSA-PKCS1-v1_5", @@ -68076,18 +68122,19 @@ async function Ig(e, t, n) { function GDe(e) { return { kind: "cms", + ...e.maxCmsBytes !== void 0 ? { maxCmsBytes: e.maxCmsBytes } : {}, sign: (t) => e.sign(t) }; } const AOe = 250; function JDe(e) { - const { url: t, policy: n, timeoutMs: r = 1e4, retries: o = 1 } = e, s = (l = {}) => ({ authority: t, ...l }), i = (l, u, d) => new J(q.SignatureRefused, l, { details: s(u), cause: d }), a = (l, u) => i(`the timestamp authority at ${t} ${u}`, { reason: l }); + const { url: t, policy: n, timeoutMs: r = 1e4, retries: o = 1 } = e, s = (l = {}) => ({ authority: t, ...l }), i = (l, u, f) => new J(q.SignatureRefused, l, { details: s(u), cause: f }), a = (l, u) => i(`the timestamp authority at ${t} ${u}`, { reason: l }); async function c(l) { - const u = e.fetch ?? globalThis.fetch, d = (g, p) => new J( + const u = e.fetch ?? globalThis.fetch, f = (g, p) => new J( q.Network, `the timestamp authority at ${t} did not answer: ${g}`, { details: s(), cause: p } - ), f = new AbortController(), h = setTimeout(() => f.abort(), r); + ), d = new AbortController(), h = setTimeout(() => d.abort(), r); try { let g; try { @@ -68095,15 +68142,15 @@ function JDe(e) { method: "POST", headers: { "content-type": "application/timestamp-query", ...e.headers }, body: new Uint8Array(l), - signal: f.signal + signal: d.signal }); } catch (p) { - if (f.signal.aborted) throw d(`no reply within ${r} ms`, p); + if (d.signal.aborted) throw f(`no reply within ${r} ms`, p); const m = "document" in globalThis ? ". In a browser most authorities cannot be called directly: call yours through a route on your own server" : ""; - throw d(`${p.message}${m}`, p); + throw f(`${p.message}${m}`, p); } if (g.status >= 500 || g.status === 429) - throw d(`HTTP ${g.status}`); + throw f(`HTTP ${g.status}`); if (!g.ok) throw i( `the timestamp authority at ${t} refused the request: HTTP ${g.status}`, @@ -68112,8 +68159,8 @@ function JDe(e) { try { return new Uint8Array(await g.arrayBuffer()); } catch (p) { - throw d( - f.signal.aborted ? `no reply within ${r} ms` : `the reply broke off: ${p.message}`, + throw f( + d.signal.aborted ? `no reply within ${r} ms` : `the reply broke off: ${p.message}`, p ); } @@ -68124,19 +68171,20 @@ function JDe(e) { return { kind: "cms", hash: e.hash ?? "sha256", - async sign({ digest: l, algorithm: u, subFilter: d }) { - if (d !== "ETSI.RFC3161") + ...e.maxCmsBytes !== void 0 ? { maxCmsBytes: e.maxCmsBytes } : {}, + async sign({ digest: l, algorithm: u, subFilter: f }) { + if (f !== "ETSI.RFC3161") throw new J( q.InvalidArg, "a timestamp authority can't sign a document: pass it as `timestampAuthority`, or sign with `kind: 'timestamp'`", { details: s() } ); - const [f, h, g, p] = await Promise.all([ - import("./timestamp-protocol-DQ1E-rny.js"), - import("./parse-Cv_kCMGz.js"), - import("./timestamp-DdhyGESj.js").then((N) => N.t), + const [d, h, g, p] = await Promise.all([ + import("./timestamp-protocol-C2RoyYm6.js"), + import("./parse-BNZey3Fv.js"), + import("./timestamp-YjVubp40.js").then((N) => N.t), Promise.resolve().then(() => Oq) - ]), m = p.randomPositiveInteger(), v = f.buildTimestampRequest({ digest: l, algorithm: u, policy: n, nonce: m }); + ]), m = p.randomPositiveInteger(), v = d.buildTimestampRequest({ digest: l, algorithm: u, policy: n, nonce: m }); let S; for (let N = 0; ; N++) try { @@ -68148,7 +68196,7 @@ function JDe(e) { } let C; try { - C = f.readTimestampResponse(S); + C = d.readTimestampResponse(S); } catch (N) { throw i( `the timestamp authority at ${t} sent a reply that can't be read: ${N.message}`, @@ -68203,7 +68251,7 @@ async function YDe(e) { const n = e.hash ?? "sha256"; let r = await e.store.load(e.subject); if (!r) { - const { selfSignedCertificate: s } = await import("./self-signed-DIdbaT2K.js"), i = await Ig(e.algorithm ?? "RSA-PKCS1-v1_5", n, !1), a = await s({ + const { selfSignedCertificate: s } = await import("./self-signed-BsJCIg7s.js"), i = await Ng(e.algorithm ?? "RSA-PKCS1-v1_5", n, !1), a = await s({ publicKey: i.publicKey, privateKey: i.privateKey, commonName: e.subject, @@ -68240,8 +68288,8 @@ function XDe(e, t = {}) { })), r), s = async (i, a) => { const c = await o(); return new Promise((l, u) => { - const d = c.transaction(n, i), f = a(d.objectStore(n)); - f.onsuccess = () => l(f.result), f.onerror = () => u(f.error ?? new Error("indexedDB request failed")); + const f = c.transaction(n, i), d = a(f.objectStore(n)); + d.onsuccess = () => l(d.result), d.onerror = () => u(d.error ?? new Error("indexedDB request failed")); }); }; return { @@ -68269,9 +68317,9 @@ function xI(...e) { for (const r of e) t |= 128 >> r; const n = 7 - Math.max(...e); return new Bn({ - extnID: ln.keyUsage, + extnID: un.keyUsage, critical: !0, - extnValue: new ht({ + extnValue: new pt({ valueHex: new Uint8Array([t]).buffer, unusedBits: n }).toBER(!1) @@ -68281,59 +68329,59 @@ const EI = 0, xOe = 1, EOe = 5, COe = 6; async function CI(e) { $v(); const t = new Mr(); - t.version = 2, t.serialNumber = new de({ + t.version = 2, t.serialNumber = new ue({ valueHex: X2(Nq()) }), t.subject.typesAndValues.push( new xO({ - type: ln.commonName, + type: un.commonName, value: new ki({ value: e.commonName }) }) ), t.issuer = e.issuer ? e.issuer.certificate.subject : t.subject, t.notBefore = d0(e.notBefore ?? new Date(Date.now() - f0)), t.notAfter = d0(e.notAfter ?? new Date(Date.now() + 365 * f0)); const n = e.kind === "authority", r = new aT({ cA: n }); if (t.extensions = [ new Bn({ - extnID: ln.basicConstraints, + extnID: un.basicConstraints, critical: !0, extnValue: r.toSchema().toBER(!1), parsedValue: r }), n ? xI(EI, EOe, COe) : e.kind === "signer" ? xI(EI, xOe) : xI(EI) ], e.kind === "responder") { - const c = new sx({ keyPurposes: [ln.ocspSigning] }); + const c = new sx({ keyPurposes: [un.ocspSigning] }); t.extensions.push( new Bn({ - extnID: ln.extendedKeyUsage, + extnID: un.extendedKeyUsage, critical: !1, extnValue: c.toSchema().toBER(!1), parsedValue: c }), new Bn({ - extnID: ln.ocspNoCheck, + extnID: un.ocspNoCheck, critical: !1, - extnValue: new fn().toBER(!1) + extnValue: new hn().toBER(!1) }) ); } e.unrevocable && t.extensions.push( new Bn({ - extnID: e.unrevocable === "no-rev-avail" ? ln.noRevAvail : ln.validityAssuredShortTerm, + extnID: e.unrevocable === "no-rev-avail" ? un.noRevAvail : un.validityAssuredShortTerm, critical: !1, - extnValue: new fn().toBER(!1) + extnValue: new hn().toBER(!1) }) ); const { ocsp: o, crl: s, issuer: i } = e.addresses ?? {}; if (o || i) { - const c = (u) => new Dt({ type: 6, value: u }), l = new PO({ + const c = (u) => new Vt({ type: 6, value: u }), l = new PO({ accessDescriptions: [ ...o ? [ new ox({ - accessMethod: ln.accessOcsp, + accessMethod: un.accessOcsp, accessLocation: c(o) }) ] : [], ...i ? [ new ox({ - accessMethod: ln.accessIssuers, + accessMethod: un.accessIssuers, accessLocation: c(i) }) ] : [] @@ -68341,7 +68389,7 @@ async function CI(e) { }); t.extensions.push( new Bn({ - extnID: ln.authorityInfoAccess, + extnID: un.authorityInfoAccess, critical: !1, extnValue: l.toSchema().toBER(!1), parsedValue: l @@ -68352,13 +68400,13 @@ async function CI(e) { const c = new OO({ distributionPoints: [ new NO({ - distributionPoint: [new Dt({ type: 6, value: s })] + distributionPoint: [new Vt({ type: 6, value: s })] }) ] }); t.extensions.push( new Bn({ - extnID: ln.crlDistributionPoints, + extnID: un.crlDistributionPoints, critical: !1, extnValue: c.toSchema().toBER(!1), parsedValue: c @@ -68373,18 +68421,18 @@ async function CI(e) { async function IOe(e) { const t = $v(); let n = e.asked; - n || (n = new zr(), await n.createForCertificate(e.certificate, { + n || (n = new Wr(), await n.createForCertificate(e.certificate, { hashAlgorithm: e.idHash ?? "SHA-1", issuerCertificate: e.issuer })); - const r = (u) => ({ tagClass: 3, tagNumber: u }), o = e.status === "good" ? new Je({ idBlock: r(0) }) : e.status === "unknown" ? new Je({ idBlock: r(2) }) : new ee({ + const r = (u) => ({ tagClass: 3, tagNumber: u }), o = e.status === "good" ? new Je({ idBlock: r(0) }) : e.status === "unknown" ? new Je({ idBlock: r(2) }) : new ne({ idBlock: r(1), value: [ - new Yt({ valueDate: e.status.revokedAt }), + new Xt({ valueDate: e.status.revokedAt }), ...e.status.reason ? [ - new ee({ + new ne({ idBlock: r(0), - value: [new Df({ value: Mq[e.status.reason] })] + value: [new Ff({ value: Mq[e.status.reason] })] }) ] : [] ] @@ -68403,8 +68451,8 @@ async function IOe(e) { new Uint8Array(e.issuer.toSchema(!0).toBER(!1)) ) || (i.certs = [a]), await i.sign(e.signer.privateKey, "SHA-256"); const l = new lOe(); - return l.responseStatus.valueBlock.valueDec = 0, l.responseBytes = new Vp({ - responseType: ln.ocspBasic, + return l.responseStatus.valueBlock.valueDec = 0, l.responseBytes = new $p({ + responseType: un.ocspBasic, response: new Oe({ valueHex: i.toSchema().toBER(!1) }) }), new Uint8Array(l.toSchema().toBER(!1)); } @@ -68419,9 +68467,9 @@ async function NOe(e) { crlEntryExtensions: new jn({ extensions: [ new Bn({ - extnID: ln.crlReason, + extnID: un.crlReason, critical: !1, - extnValue: new Df({ + extnValue: new Ff({ value: Mq[n.reason] }).toBER(!1) }) @@ -68432,9 +68480,9 @@ async function NOe(e) { )), t.crlExtensions = new jn({ extensions: [ new Bn({ - extnID: ln.crlNumber, + extnID: un.crlNumber, critical: !1, - extnValue: new de({ value: 1 }).toBER(!1) + extnValue: new ue({ value: 1 }).toBER(!1) }), ...e.extensions ?? [] ] @@ -68445,7 +68493,7 @@ async function ZDe(e = {}) { const t = e.now ?? (() => /* @__PURE__ */ new Date()), n = (e.url ?? "http://test-authority.example").replace(/\/$/, ""), r = { ocsp: `${n}/ocsp`, crl: `${n}/crl`, issuer: `${n}/issuer` }, o = e.commonName ?? "EmbedPDF test certificate authority", s = () => ({ notBefore: new Date(t().getTime() - f0), notAfter: new Date(t().getTime() + 365 * f0) - }), i = await Ig("RSA-PKCS1-v1_5", "sha256", !0), a = { + }), i = await Ng("RSA-PKCS1-v1_5", "sha256", !0), a = { certificate: await CI({ kind: "authority", commonName: o, @@ -68454,7 +68502,7 @@ async function ZDe(e = {}) { ...s() }), privateKey: i.privateKey - }, c = await Ig("RSA-PKCS1-v1_5", "sha256", !0), l = { + }, c = await Ng("RSA-PKCS1-v1_5", "sha256", !0), l = { certificate: await CI({ kind: "responder", commonName: `${o} (OCSP responder)`, @@ -68463,11 +68511,11 @@ async function ZDe(e = {}) { ...s() }), privateKey: c.privateKey - }, u = (S) => new Uint8Array(S.toSchema(!0).toBER(!1)), d = u(a.certificate), f = [], h = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map(), p = (S) => new Uint8Array(S.serialNumber.valueBlock.valueHexView), m = (S) => f.find((C) => wx(p(C), S)) ?? null; + }, u = (S) => new Uint8Array(S.toSchema(!0).toBER(!1)), f = u(a.certificate), d = [], h = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map(), p = (S) => new Uint8Array(S.serialNumber.valueBlock.valueHexView), m = (S) => d.find((C) => wx(p(C), S)) ?? null; return { - certificate: d, + certificate: f, async issueSigner(S = {}) { - const C = S.hash ?? "sha256", k = await Ig( + const C = S.hash ?? "sha256", k = await Ng( S.algorithm ?? "RSA-PKCS1-v1_5", C, !0 @@ -68481,18 +68529,18 @@ async function ZDe(e = {}) { ...N ? { unrevocable: N } : {}, ...s() }); - f.push(w), N && h.add(w); + d.push(w), N && h.add(w); const y = u(w); return { ...Z2({ privateKey: k.privateKey, - certificateChain: [y, d], + certificateChain: [y, f], hash: C }), certificate: y, privateKey: k.privateKey }; }, revocation: { fetch: async (S) => { if (!S.url.startsWith(n)) throw new Error(`the test certificate authority does not answer at ${S.url}`); - if (S.kind === "issuer") return d; + if (S.kind === "issuer") return f; if (S.kind === "crl") return NOe({ issuer: a, @@ -68504,7 +68552,7 @@ async function ZDe(e = {}) { reason: x.reason })) }); - const C = hn(X2(S.body)); + const C = pn(X2(S.body)); if (C.offset === -1) throw new Error("the OCSP request is not valid DER"); const k = new aOe({ schema: C.result }).tbsRequest.requestList[0]; if (!k) throw new Error("the OCSP request asks about no certificate"); @@ -68525,7 +68573,7 @@ async function ZDe(e = {}) { }); } }, revoke(S, C = {}) { - const k = S instanceof Uint8Array ? S : S.certificate, N = f.find((w) => wx(u(w), k)); + const k = S instanceof Uint8Array ? S : S.certificate, N = d.find((w) => wx(u(w), k)); if (!N) throw new Error("the test certificate authority did not issue this certificate"); if (h.has(N)) @@ -68541,23 +68589,23 @@ const OOe = 250; function e8e(e) { const { url: t, timeoutMs: n = 1e4, retries: r = 1 } = e; async function o(s) { - const i = e.fetch ?? globalThis.fetch, a = (f = {}) => ({ + const i = e.fetch ?? globalThis.fetch, a = (d = {}) => ({ source: s.url, route: t, - ...f - }), c = (f, h) => new J( + ...d + }), c = (d, h) => new J( q.Network, - `${s.url} did not answer through ${t}: ${f}`, + `${s.url} did not answer through ${t}: ${d}`, { details: a(), cause: h } ), l = { kind: s.kind, url: s.url, ...s.kind === "ocsp" ? { body: ROe(s.body) } : {} - }, u = new AbortController(), d = setTimeout(() => u.abort(), n); + }, u = new AbortController(), f = setTimeout(() => u.abort(), n); try { - let f; + let d; try { - f = await i(t, { + d = await i(t, { method: "POST", headers: { "content-type": "application/json", ...e.headers }, body: JSON.stringify(l), @@ -68566,18 +68614,18 @@ function e8e(e) { } catch (h) { throw u.signal.aborted ? c(`no reply within ${n} ms`, h) : c(h.message, h); } - if (f.status >= 500 || f.status === 429) - throw c(`HTTP ${f.status}${await POe(f)}`); - if (!f.ok) { - const h = await Bq(f); + if (d.status >= 500 || d.status === 429) + throw c(`HTTP ${d.status}${await POe(d)}`); + if (!d.ok) { + const h = await Bq(d); throw new J( q.SignatureRefused, - `the route at ${t} refused to ask ${s.url}: ${h.message ?? `HTTP ${f.status}`}`, - { details: a({ httpStatus: f.status, reason: h.reason }) } + `the route at ${t} refused to ask ${s.url}: ${h.message ?? `HTTP ${d.status}`}`, + { details: a({ httpStatus: d.status, reason: h.reason }) } ); } try { - return new Uint8Array(await f.arrayBuffer()); + return new Uint8Array(await d.arrayBuffer()); } catch (h) { throw c( u.signal.aborted ? `no reply within ${n} ms` : `the reply broke off: ${h.message}`, @@ -68585,7 +68633,7 @@ function e8e(e) { ); } } finally { - clearTimeout(d); + clearTimeout(f); } } return { @@ -68623,7 +68671,7 @@ function ROe(e) { function t8e() { return bt(vs); } -const n8e = wo(zxe); +const n8e = vo(zxe); function Sk(e, t) { hR(vs, e, t); } @@ -68687,7 +68735,7 @@ function LOe(e) { name: "links", load: async (g, p) => { if (!e.getPage(p)) - throw new re( + throw new te( "not-found", "link", `page ${p.objectNumber} is not in this document` @@ -68718,7 +68766,7 @@ function LOe(e) { const v = c(g); switch (v.kind) { case "destination": { - const S = p?.stage ?? e.tryGet(Zt); + const S = p?.stage ?? e.tryGet(tn); return S ? (S.goToDestination(v.destination), { status: "revealed" }) : { status: "destination", destination: v.destination }; } case "uri": { @@ -68733,7 +68781,7 @@ function LOe(e) { }, u = (g, p) => { const m = II(g) ? g.target : g, v = II(g) ? { activate: g.activate, ref: g.ref, ...p } : p, S = l(m, v); return n.emit({ target: m, activation: S }), S; - }, d = (g, p) => { + }, f = (g, p) => { let m = null; for (const v of s(g)) BOe(v.bounds, p) && (!m || v.bounds.width * v.bounds.height < m.bounds.width * m.bounds.height) && (m = v); @@ -68743,7 +68791,7 @@ function LOe(e) { api: { listLinks: s, getLink: (g, p) => s(g).find((m) => m.id === p) ?? null, - getLinkAt: d, + getLinkAt: f, readAllLinks: async (g) => { const p = e.document()?.pages ?? []; return await e.cancellable( @@ -68763,7 +68811,7 @@ function LOe(e) { resolve: c, activate: u, activateAt: (g, p, m) => { - const v = e.pageOf(g).ref, S = d(v, p); + const v = e.pageOf(g).ref, S = f(v, p); return S ? u(S, { page: v, ...m }) : null; }, getLabel: (g) => { @@ -68792,12 +68840,12 @@ function LOe(e) { } }; } -const wT = Pf, DOe = () => ({ +const wT = Tf, DOe = () => ({ id: "link", token: wT, scope: "document", requires: [yr], - optional: [Zt, vt, Lr], + optional: [tn, vt, Lr], create: LOe }); function jOe({ @@ -68811,13 +68859,13 @@ function jOe({ ), /* @__PURE__ */ P("a", { ref: n, ...t }); } function FOe() { - const e = Rt(wT); + const e = Bt(wT); Ke(() => e?.registerUriOpener(Rse), [e]); } function VOe({ renderLink: e } = {}) { - const t = qo(), n = bt(Pf); + const t = Go(), n = bt(Tf); FOe(); - const r = Rt(Uf()), o = Rt(Lr), s = ft(() => o ? gR(o.dispatch) : null, [o]), i = wt(Pf, (u) => u.listLinks(t.ref), pi), a = wt(wT, (u) => u.isNavigationEngaged()), c = zt( + const r = Bt(Hf()), o = Bt(Lr), s = ft(() => o ? gR(o.dispatch) : null, [o]), i = wt(Tf, (u) => u.listLinks(t.ref), pi), a = wt(wT, (u) => u.isNavigationEngaged()), c = Gt( Cn, (u) => u.activeToolEnables("annotation-edit"), !1 @@ -68827,7 +68875,7 @@ function VOe({ renderLink: e } = {}) { }, [n, t.ref]), !a || !i.length) return null; const l = eae(i, c); return l.length ? /* @__PURE__ */ P("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: l.map((u) => { - const { box: d, href: f, label: h } = nae( + const { box: f, href: d, label: h } = nae( u, t.transform, (v) => n.getLabel(v) @@ -68835,7 +68883,7 @@ function VOe({ renderLink: e } = {}) { jOe, { onPress: () => k1(o, u, t.ref, "mouseDown"), - href: f ?? void 0, + href: d ?? void 0, target: "_blank", rel: "noopener noreferrer", role: "link", @@ -68843,7 +68891,7 @@ function VOe({ renderLink: e } = {}) { title: h, "aria-label": h, onClick: (v) => { - f && rae(v) || (v.preventDefault(), n.activate(u, g)); + d && rae(v) || (v.preventDefault(), n.activate(u, g)); }, onKeyDown: (v) => { (v.key === "Enter" || v.key === " ") && (v.preventDefault(), n.activate(u, g)); @@ -68855,10 +68903,10 @@ function VOe({ renderLink: e } = {}) { onBlur: () => k1(o, u, t.ref, "blur"), style: { position: "absolute", - left: d.left, - top: d.top, - width: d.width, - height: d.height, + left: f.left, + top: f.top, + width: f.width, + height: f.height, cursor: "pointer", pointerEvents: "auto" } @@ -68979,14 +69027,14 @@ function qOe(e, t, n, r) { return; } s.add(l), u().then( - (d) => { - s.delete(l), e.state.update(HOe, l, d), i(); + (f) => { + s.delete(l), e.state.update(HOe, l, f), i(); }, - (d) => { - s.delete(l), e.state.update(dP, l), e.state.update(q4, l), r(l, d), n.settle(l, { + (f) => { + s.delete(l), e.state.update(dP, l), e.state.update(q4, l), r(l, f), n.settle(l, { ok: !1, - error: new re("operation-failed", "i18n", `locale '${l}' failed to load`, { - details: Br(qe("i18n", d)) + error: new te("operation-failed", "i18n", `locale '${l}' failed to load`, { + details: Br(ze("i18n", f)) }) }), i(); } @@ -69727,7 +69775,7 @@ function ej(e, t, n) { const r = n?.params, o = n?.fallbackKey, s = (a) => Z4(e, a, t, r) ?? (o === void 0 ? void 0 : Z4(e, a, o, r)), i = s(e.locale) ?? s(e.fallbackLocale); return i !== void 0 ? { text: PN(i, n?.params), found: !0 } : n?.fallback !== void 0 ? { text: PN(n.fallback, n.params), found: !1 } : { text: t, found: !1 }; } -const tj = (e) => new re("not-found", "i18n", `unknown locale '${e}': not loaded and not in loaders`); +const tj = (e) => new te("not-found", "i18n", `unknown locale '${e}': not loaded and not in loaders`); function sPe(e) { const t = e.settings(), n = e.events.source(), r = e.events.source(), o = () => e.state.get(); e.state.update(UOe, t.get()); @@ -69760,35 +69808,35 @@ function sPe(e) { S[w] || N.push({ code: w, name: w, direction: "ltr", loaded: !1 }); return N; } - ), d = /* @__PURE__ */ new Map(), f = (S, C) => { - const k = d.get(S); - k && (d.delete(S), C.ok ? k.resolve() : k.reject(C.error)); + ), f = /* @__PURE__ */ new Map(), d = (S, C) => { + const k = f.get(S); + k && (f.delete(S), C.ok ? k.resolve() : k.reject(C.error)); }, h = () => { - for (const [S, C] of d) - d.delete(S), C.reject( - new re("operation-cancelled", "i18n", `switching to '${S}' was replaced`) + for (const [S, C] of f) + f.delete(S), C.reject( + new te("operation-cancelled", "i18n", `switching to '${S}' was replaced`) ); }, g = qOe( e, t, - { settle: f }, - (S, C) => r.emit({ locale: S, error: Br(qe("i18n", C)) }) + { settle: d }, + (S, C) => r.emit({ locale: S, error: Br(ze("i18n", C)) }) ), p = (S, C = {}) => { const { signal: k } = C; if (k?.aborted) - return Promise.reject(new re("operation-cancelled", "i18n", "operation cancelled")); + return Promise.reject(new te("operation-cancelled", "i18n", "operation cancelled")); if (kT(o(), t.get().loaders, S)) return h(), e.state.update(jq, S), Promise.resolve(); if (!o().locales[S] && !t.get().loaders[S]) return Promise.reject(tj(S)); h(); const N = new Promise((w, y) => { - d.set(S, { resolve: w, reject: y }), e.state.update(WOe, S); + f.set(S, { resolve: w, reject: y }), e.state.update(WOe, S); }); return k?.addEventListener( "abort", () => { - d.delete(S) && e.state.update(dP, S); + f.delete(S) && e.state.update(dP, S); }, { once: !0 } ), e.cancellable(k, N); @@ -69804,7 +69852,7 @@ function sPe(e) { if ((k.includes("fallbackLocale") || k.includes("loaders")) && e.state.update(Lq, C), k.includes("locale")) { const N = C.locale ?? C.fallbackLocale; p(N).catch((w) => { - pr(w, "not-found") && console.warn(`[i18n] ${w.message}`); + Xn(w, "not-found") && console.warn(`[i18n] ${w.message}`); }); } S = C; @@ -69837,11 +69885,11 @@ function sPe(e) { const iPe = (e) => ({ id: "i18n", scope: "workspace", - token: vo, + token: ko, state: $Oe, settings: { defaults: Ade, registered: e }, create: sPe -}), aPe = wr(vo, { +}), aPe = wr(ko, { read: (e) => ({ locale: e.getLocale(), direction: e.getDirection(), @@ -69849,13 +69897,13 @@ const iPe = (e) => ({ loading: e.getLoadingLocale() }), empty: { locale: "en", direction: "ltr", locales: [], loading: null } -}), kx = wo(aPe); -function Tt() { - return wt(vo, (e) => e.getTranslator()); +}), kx = vo(aPe); +function _t() { + return wt(ko, (e) => e.getTranslator()); } -const dt = sn("shell", { +const dt = an("shell", { hint: "add shellPlugin() from '@embedpdf/plugin-shell' to your plugins list" -}), h0 = 5, Vq = 3, cPe = ["icon"], lPe = ["default"], ST = (e) => e.kind === "custom" && e.terminal === null, Sm = (e) => e.kind === "command" ? e.command : e.terminal; +}), h0 = 5, Vq = 3, cPe = ["icon"], lPe = ["default"], ST = (e) => e.kind === "custom" && e.terminal === null, xm = (e) => e.kind === "command" ? e.command : e.terminal; function uPe(e, t, n) { const r = typeof t == "string" ? { command: t } : t, o = r.importance ?? e.importance ?? Vq, s = "slot" in r ? { kind: "custom", @@ -69967,13 +70015,13 @@ function Kq(e, t) { function ET(e, t) { const n = ([o, s]) => ET(o, s.length > 0 ? [...t, ...s] : t), r = Object.freeze({ place: (o, s) => n(mPe(e, o, s)), - addBar: (o, s) => n([Ko(e, "bars", o, s), []]), + addBar: (o, s) => n([Ho(e, "bars", o, s), []]), removeBar: (o) => n(yPe(e, typeof o == "string" ? [o] : o)), add: (o, s) => n(bPe(e, o, s)), remove: (o, s) => n(kPe(e, typeof o == "string" ? [o] : o, s)), replace: (o, s) => n(APe(e, o, s)), - addMenu: (o, s) => n([Ko(e, "menus", o, s), []]), - addPanel: (o, s) => n([Ko(e, "panels", o, s), []]), + addMenu: (o, s) => n([Ho(e, "menus", o, s), []]), + addPanel: (o, s) => n([Ho(e, "panels", o, s), []]), panel: (o, s) => n(SPe(e, o, s)), panels: (o) => n([xPe(e, o), []]), removePanel: (o) => n(EPe(e, o)), @@ -69982,13 +70030,13 @@ function ET(e, t) { }); return tE.set(r, { data: e, warnings: t }), r; } -const Il = ["start", "center", "end"], xm = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && "items" in e; -function zd(e, t) { +const Nl = ["start", "center", "end"], Em = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && "items" in e; +function qd(e, t) { const n = e[t]; return Array.isArray(n) ? n : []; } function Ai(e) { - return Array.isArray(e) ? e : xm(e) ? Array.isArray(e.items) ? e.items : [] : [e]; + return Array.isArray(e) ? e : Em(e) ? Array.isArray(e.items) ? e.items : [] : [e]; } function yi(e) { return typeof e == "string" ? e : typeof e != "object" || e === null ? "" : "custom" in e ? e.custom : e.command; @@ -69996,7 +70044,7 @@ function yi(e) { function pPe(e) { return typeof e == "string" ? e : typeof e != "object" || e === null ? null : "custom" in e ? e.command ?? null : e.command; } -function Jm(e) { +function Ym(e) { if (typeof e == "string") return e.length > 0; if (typeof e != "object" || e === null || Array.isArray(e)) return !1; const t = e; @@ -70010,20 +70058,20 @@ function Hq(e) { } function Q0(e) { const t = /* @__PURE__ */ new Set(); - for (const n of Il) - for (const r of zd(e, n)) - for (const o of Ai(r)) Jm(o) && t.add(yi(o)); + for (const n of Nl) + for (const r of qd(e, n)) + for (const o of Ai(r)) Ym(o) && t.add(yi(o)); return [...t]; } -function Xl(e) { +function Zl(e) { if (Array.isArray(e)) return e; const t = e?.items; return Array.isArray(t) ? t : []; } -const jf = (e) => Array.isArray(e) ? e : [], Em = (e) => [ - ...new Set(jf(e).flatMap((t) => Xl(t))) -], As = (e) => e.bars ?? {}, Ff = (e) => e.menus ?? {}, X0 = (e) => e.panels ?? {}; -function Ko(e, t, n, r) { +const Vf = (e) => Array.isArray(e) ? e : [], Cm = (e) => [ + ...new Set(Vf(e).flatMap((t) => Zl(t))) +], As = (e) => e.bars ?? {}, $f = (e) => e.menus ?? {}, X0 = (e) => e.panels ?? {}; +function Ho(e, t, n, r) { return { ...e, [t]: { ...e[t], [n]: r } }; } function gPe(e, t, n) { @@ -70031,14 +70079,14 @@ function gPe(e, t, n) { return { ...e, [t]: o }; } function Z0(e, t) { - return t.length === 0 ? Ai(e).length === 0 ? e : null : xm(e) ? { ...e, items: t } : Array.isArray(e) ? t : t.length === 1 ? t[0] : t; + return t.length === 0 ? Ai(e).length === 0 ? e : null : Em(e) ? { ...e, items: t } : Array.isArray(e) ? t : t.length === 1 ? t[0] : t; } function ev(e, t) { const n = {}; - for (const a of Il) { - const c = zd(e, a); + for (const a of Nl) { + const c = qd(e, a); if (c.length === 0) continue; - const l = c.map((u, d) => t(u, a, d)).filter((u) => u !== null); + const l = c.map((u, f) => t(u, a, f)).filter((u) => u !== null); l.length > 0 && (n[a] = l); } const { start: r, center: o, end: s, ...i } = e; @@ -70050,7 +70098,7 @@ function nE(e, t) { const Ax = (e, t, n, r) => `${e}: "${t}" is not in "${n}"${gr(t, r)}`; function mPe(e, t, n) { const r = As(e)[t]; - return r ? [Ko(e, "bars", t, { ...r, place: n }), []] : [e, [`place: no bar "${t}"${gr(t, Object.keys(As(e)))}`]]; + return r ? [Ho(e, "bars", t, { ...r, place: n }), []] : [e, [`place: no bar "${t}"${gr(t, Object.keys(As(e)))}`]]; } function zq(e, t) { const n = As(e), r = new Set(t.filter((s) => n[s] !== void 0)); @@ -70073,21 +70121,21 @@ function yPe(e, t) { ]; } function bPe(e, t, n) { - if (!Jm(t)) return [e, [`add: ${JSON.stringify(t)} is not an item`]]; + if (!Ym(t)) return [e, [`add: ${JSON.stringify(t)} is not an item`]]; const r = n?.to; if (!r) return [e, [`add: "${yi(t)}" needs a bar or menu to go to ({ to })`]]; const o = As(e)[r]; if (o) return wPe(e, r, o, t, n); - const s = Ff(e)[r]; + const s = $f(e)[r]; if (s) return vPe(e, r, s, t, n); - const i = [...Object.keys(As(e)), ...Object.keys(Ff(e))]; + const i = [...Object.keys(As(e)), ...Object.keys($f(e))]; return [e, [`add: no bar or menu "${r}"${gr(r, i)}`]]; } function wPe(e, t, n, r, o) { const s = yi(r), i = [], a = (h) => h.some((g) => yi(g) === s), c = `add: "${s}" is already in that group of "${t}"`, l = o.before ?? o.after; if (l !== void 0) { - for (const h of Il) { - const g = zd(n, h); + for (const h of Nl) { + const g = qd(n, h); for (let p = 0; p < g.length; p++) { const m = Ai(g[p]), v = m.findIndex((N) => yi(N) === l); if (v === -1) continue; @@ -70096,15 +70144,15 @@ function wPe(e, t, n, r, o) { n, (N, w, y) => w === h && y === p ? Z0(N, C) : N ); - return [Ko(e, "bars", t, k), []]; + return [Ho(e, "bars", t, k), []]; } } i.push(Ax("add", l, t, Q0(n))); } if (o.group !== void 0) - for (const h of Il) { - const g = zd(n, h), p = g.findIndex( - (S) => xm(S) && S.id === o.group + for (const h of Nl) { + const g = qd(n, h), p = g.findIndex( + (S) => Em(S) && S.id === o.group ); if (p === -1) continue; const m = Ai(g[p]); @@ -70113,31 +70161,31 @@ function wPe(e, t, n, r, o) { n, (S, C, k) => C === h && k === p ? Z0(S, [...m, r]) : S ); - return [Ko(e, "bars", t, v), i]; + return [Ho(e, "bars", t, v), i]; } let u = o.section ?? "end"; - Il.includes(u) || (i.push(`add: "${u}" is not a section (start, center or end); using "end"`), u = "end"); - const d = o.group !== void 0 ? { id: o.group, items: [r] } : [r], f = { ...n, [u]: [...zd(n, u), d] }; - return [Ko(e, "bars", t, f), i]; + Nl.includes(u) || (i.push(`add: "${u}" is not a section (start, center or end); using "end"`), u = "end"); + const f = o.group !== void 0 ? { id: o.group, items: [r] } : [r], d = { ...n, [u]: [...qd(n, u), f] }; + return [Ho(e, "bars", t, d), i]; } function vPe(e, t, n, r, o) { const s = typeof r == "string" ? r : "custom" in r ? null : r.command; if (s === null) return [e, [`add: "${t}" is a menu, which holds commands, not your own components`]]; - if (Em(n).includes(s)) + if (Cm(n).includes(s)) return [e, [`add: "${s}" is already in "${t}"`]]; const i = [], a = o.before ?? o.after; if (a !== void 0) { - const c = jf(n), l = c.findIndex((u) => Xl(u).includes(a)); + const c = Vf(n), l = c.findIndex((u) => Zl(u).includes(a)); if (l !== -1) { - const u = Xl(c[l]), d = u.indexOf(a), f = o.before !== void 0 ? d : d + 1, h = [...u.slice(0, f), s, ...u.slice(f)], g = c.map( + const u = Zl(c[l]), f = u.indexOf(a), d = o.before !== void 0 ? f : f + 1, h = [...u.slice(0, d), s, ...u.slice(d)], g = c.map( (p, m) => m === l ? nE(p, h) : p ); - return [Ko(e, "menus", t, g), []]; + return [Ho(e, "menus", t, g), []]; } - i.push(Ax("add", a, t, Em(n))); + i.push(Ax("add", a, t, Cm(n))); } - return [Ko(e, "menus", t, [...jf(n), [s]]), i]; + return [Ho(e, "menus", t, [...Vf(n), [s]]), i]; } function kPe(e, t, n) { const r = n?.from; @@ -70152,37 +70200,37 @@ function kPe(e, t, n) { if (i) { const l = ev( i, - (d) => Z0( - d, - Ai(d).filter((f) => { - const h = yi(f); + (f) => Z0( + f, + Ai(f).filter((d) => { + const h = yi(d); return o.has(h) ? (s.add(h), !1) : !0; }) ) - ), u = t.filter((d) => !s.has(d)); + ), u = t.filter((f) => !s.has(f)); return [ - s.size > 0 ? Ko(e, "bars", r, l) : e, - u.map((d) => Ax("remove", d, r, Q0(i))) + s.size > 0 ? Ho(e, "bars", r, l) : e, + u.map((f) => Ax("remove", f, r, Q0(i))) ]; } - const a = Ff(e)[r]; + const a = $f(e)[r]; if (a) { - const l = jf(a).map( - (d) => nE( - d, - Xl(d).filter((f) => o.has(f) ? (s.add(f), !1) : !0) + const l = Vf(a).map( + (f) => nE( + f, + Zl(f).filter((d) => o.has(d) ? (s.add(d), !1) : !0) ) - ).filter((d) => d !== null), u = t.filter((d) => !s.has(d)); + ).filter((f) => f !== null), u = t.filter((f) => !s.has(f)); return [ - s.size > 0 ? Ko(e, "menus", r, l) : e, - u.map((d) => Ax("remove", d, r, Em(a))) + s.size > 0 ? Ho(e, "menus", r, l) : e, + u.map((f) => Ax("remove", f, r, Cm(a))) ]; } - const c = [...Object.keys(As(e)), ...Object.keys(Ff(e))]; + const c = [...Object.keys(As(e)), ...Object.keys($f(e))]; return [e, [`remove: no bar or menu "${r}"${gr(r, c)}`]]; } function APe(e, t, n) { - if (!Jm(n)) return [e, [`replace: ${JSON.stringify(n)} is not an item`]]; + if (!Ym(n)) return [e, [`replace: ${JSON.stringify(n)} is not an item`]]; let r = !1; const o = {}; for (const [a, c] of Object.entries(As(e))) { @@ -70199,22 +70247,22 @@ function APe(e, t, n) { ); } const s = typeof n == "string" ? n : "custom" in n ? null : n.command, i = {}; - for (const [a, c] of Object.entries(Ff(e))) { - if (s === null || !Em(c).includes(t)) { + for (const [a, c] of Object.entries($f(e))) { + if (s === null || !Cm(c).includes(t)) { i[a] = c; continue; } - r = !0, i[a] = jf(c).map( + r = !0, i[a] = Vf(c).map( (l) => nE( l, - Xl(l).map((u) => u === t ? s : u) + Zl(l).map((u) => u === t ? s : u) ) ); } if (!r) { const a = [ ...Object.values(As(e)).flatMap(Q0), - ...Object.values(Ff(e)).flatMap(Em) + ...Object.values($f(e)).flatMap(Cm) ]; return [e, [`replace: "${t}" is in no bar or menu${gr(t, a)}`]]; } @@ -70231,7 +70279,7 @@ function qq(e, t) { } function SPe(e, t, n) { const r = X0(e)[t]; - return r ? [Ko(e, "panels", t, qq(r, n)), []] : [e, [`panel: no panel "${t}"${gr(t, Object.keys(X0(e)))}`]]; + return r ? [Ho(e, "panels", t, qq(r, n)), []] : [e, [`panel: no panel "${t}"${gr(t, Object.keys(X0(e)))}`]]; } function xPe(e, t) { const n = Object.fromEntries( @@ -70254,12 +70302,12 @@ function EPe(e, t) { ) : a ]) ), o = Object.fromEntries( - Object.entries(Ff(e)).map(([i, a]) => [ + Object.entries($f(e)).map(([i, a]) => [ i, - Em(a).includes(n) ? jf(a).map( + Cm(a).includes(n) ? Vf(a).map( (c) => nE( c, - Xl(c).filter((l) => l !== n) + Zl(c).filter((l) => l !== n) ) ).filter((c) => c !== null) : a ]) @@ -70293,7 +70341,7 @@ function nj(e, t, n) { `${n} ${e === void 0 ? "nothing" : typeof e}, not a layout; showing the default layout` ); } -const OPe = "modes", tv = "mode:view", Zl = (e) => `mode:${e}`, eu = (e) => `panel:${e}`, rj = ["top", "bottom", "start", "end"], PPe = [ +const OPe = "modes", tv = "mode:view", eu = (e) => `mode:${e}`, tu = (e) => `panel:${e}`, rj = ["top", "bottom", "start", "end"], PPe = [ "top-start", "top", "top-end", @@ -70302,7 +70350,7 @@ const OPe = "modes", tv = "mode:view", Zl = (e) => `mode:${e}`, eu = (e) => `pan "bottom-start", "bottom", "bottom-end" -], uu = (e) => Object.entries(e.bars ?? {}).filter( +], du = (e) => Object.entries(e.bars ?? {}).filter( (t) => typeof t[1] == "object" && t[1] !== null ); function Jq(e) { @@ -70315,7 +70363,7 @@ function Yq(e) { return typeof e == "object" && e !== null && "float" in e && PPe.includes(e.float) ? e.float : null; } function TPe(e, t) { - const n = uu(e).filter(([, i]) => Jq(i.place) === t), r = (i) => typeof i == "object" && i !== null && "edge" in i ? i.before !== void 0 ? { id: i.before, after: !1 } : i.after !== void 0 ? { id: i.after, after: !0 } : null : null, o = n.filter(([, i]) => r(i.place) === null).map(([i]) => i); + const n = du(e).filter(([, i]) => Jq(i.place) === t), r = (i) => typeof i == "object" && i !== null && "edge" in i ? i.before !== void 0 ? { id: i.before, after: !1 } : i.after !== void 0 ? { id: i.after, after: !0 } : null : null, o = n.filter(([, i]) => r(i.place) === null).map(([i]) => i); let s = n.filter(([, i]) => r(i.place) !== null); for (let i = !0; i && s.length > 0; ) i = !1, s = s.filter(([a, c]) => { @@ -70325,7 +70373,7 @@ function TPe(e, t) { return [...o, ...s.map(([i]) => i)]; } function MPe(e, t) { - return uu(e).filter(([, n]) => Kv(n.place) === t).map(([n]) => n); + return du(e).filter(([, n]) => Kv(n.place) === t).map(([n]) => n); } function Qq(e, t) { const n = [], r = (o) => { @@ -70341,7 +70389,7 @@ function BPe(e, t) { return Qq(e, TPe(e, t)); } function _Pe(e, t) { - return uu(e).filter(([, n]) => Yq(n.place) === t).map(([n]) => n); + return du(e).filter(([, n]) => Yq(n.place) === t).map(([n]) => n); } function LPe(e, t) { return Qq(e, _Pe(e, t)); @@ -70359,19 +70407,19 @@ function DPe(e, t) { } } function jPe(e, t) { - return uu(e).filter(([, n]) => RPe(n.place) === t).map(([n]) => n); + return du(e).filter(([, n]) => RPe(n.place) === t).map(([n]) => n); } function FPe(e, t) { - return uu(e).filter(([, n]) => Hq(n.place) === t).map(([n]) => n); + return du(e).filter(([, n]) => Hq(n.place) === t).map(([n]) => n); } -function Cm(e) { +function Im(e) { const t = /* @__PURE__ */ new Set(); - for (const [, n] of uu(e)) + for (const [, n] of du(e)) typeof n.mode == "string" && n.mode.length > 0 && t.add(n.mode); return [...t]; } function Xq(e, t) { - return uu(e).filter(([, n]) => n.mode === t).map(([n]) => n); + return du(e).filter(([, n]) => n.mode === t).map(([n]) => n); } const VPe = /* @__PURE__ */ new Set(), $Pe = (e) => { if (typeof e == "string") return e; @@ -70383,7 +70431,7 @@ const VPe = /* @__PURE__ */ new Set(), $Pe = (e) => { return e.variants !== void 0 && (t.variants = e.variants), e.importance !== void 0 && (t.importance = e.importance), e.emphasis === "primary" && (t.emphasis = "primary"), t; }; function UPe(e, t) { - const n = Cm(e).map(Zl).filter((o) => !t.has(o)); + const n = Im(e).map(eu).filter((o) => !t.has(o)); return n.length === 0 ? [] : (t.has(tv) ? n : [tv, ...n]).map((o) => ({ command: o, variants: ["label"], importance: 1 })); } function CT(e, t, n = {}) { @@ -70394,22 +70442,22 @@ function CT(e, t, n = {}) { for (let u = 2; s.has(l); u++) l = `${c}-${u}`; return s.add(l), l; }, a = {}; - for (const c of Il) { + for (const c of Nl) { const l = []; - zd(r, c).forEach((u, d) => { - const f = xm(u) ? u : null, h = /* @__PURE__ */ new Set(); + qd(r, c).forEach((u, f) => { + const d = Em(u) ? u : null, h = /* @__PURE__ */ new Set(); let g = Ai(u).filter((v) => { - if (!Jm(v)) return !1; + if (!Ym(v)) return !1; const S = yi(v); return h.has(S) ? !1 : (h.add(S), typeof v == "object" && "custom" in v ? !0 : !o.has(S)); }); - const p = f?.id === OPe; + const p = d?.id === OPe; if (p && (g = [...UPe(e, o).filter((v) => !h.has(v.command)), ...g]), g.length === 0) return; const m = { - id: i(f?.id ?? `${c}-${d}`), + id: i(d?.id ?? `${c}-${f}`), items: g.map($Pe) }; - p && (m.role = "tabs"), f?.titleKey !== void 0 && (m.labelKey = f.titleKey), f?.shed !== void 0 && (m.shed = f.shed), f?.collapse !== void 0 && (m.collapse = f.collapse), f?.importance !== void 0 && (m.importance = f.importance), f?.dependent === !0 && (m.dependent = !0), l.push(m); + p && (m.role = "tabs"), d?.titleKey !== void 0 && (m.labelKey = d.titleKey), d?.shed !== void 0 && (m.shed = d.shed), d?.collapse !== void 0 && (m.collapse = d.collapse), d?.importance !== void 0 && (m.importance = d.importance), d?.dependent === !0 && (m.dependent = !0), l.push(m); }), l.length > 0 && (a[c] = l); } return { id: t, sections: a }; @@ -70421,9 +70469,9 @@ function IT(e, t) { const n = e.menus?.[t]; if (!n) return null; const r = (o) => [ - ...new Set(Xl(o).filter((s) => typeof s == "string")) + ...new Set(Zl(o).filter((s) => typeof s == "string")) ]; - return jf(n).map((o) => { + return Vf(n).map((o) => { if (Array.isArray(o) || typeof o != "object" || o === null) return { items: r(o) }; const s = o, i = { @@ -70436,7 +70484,7 @@ const oj = /* @__PURE__ */ new WeakMap(); function HPe(e) { const t = oj.get(e); if (t) return t; - const n = Cm(e).map( + const n = Im(e).map( (i) => [i, Xq(e, i).map((a) => eE(CT(e, a)))] ), r = new Map( Object.keys(e.menus ?? {}).map((i) => [ @@ -70444,11 +70492,11 @@ function HPe(e) { IT(e, i).flatMap((a) => a.items) ]) ), o = /* @__PURE__ */ new Set(); - for (const [, i] of uu(e)) - for (const a of Il) - for (const c of zd(i, a)) + for (const [, i] of du(e)) + for (const a of Nl) + for (const c of qd(i, a)) for (const l of Ai(c)) - typeof l == "string" ? o.add(l) : Jm(l) && !("custom" in l) && o.add(l.command); + typeof l == "string" ? o.add(l) : Ym(l) && !("custom" in l) && o.add(l.command); const s = { modes: n, menus: r, buttons: [...o] }; return oj.set(e, s), s; } @@ -70457,10 +70505,10 @@ function zPe(e, t, n = t) { for (const [i, a] of r.modes) a.some( (l) => xT(l, (u) => { - const d = Sm(u); - return d !== null && o(d); + const f = xm(u); + return f !== null && o(f); }) - ) || s.push(Zl(i)); + ) || s.push(eu(i)); for (const i of r.buttons) { const a = n(i)?.menu; a !== void 0 && !(r.menus.get(a) ?? []).some(o) && s.push(i); @@ -70482,9 +70530,9 @@ function JPe(e, t) { if (typeof r != "object" || r === null) return [...n, "the layout is not an object"]; const o = r.bars ?? {}, s = new Set(t.commands), i = new Set(s); - for (const c of Cm(r)) i.add(Zl(c)); - Cm(r).length > 0 && i.add(tv); - for (const c of Object.keys(r.panels ?? {})) i.add(eu(c)); + for (const c of Im(r)) i.add(eu(c)); + Im(r).length > 0 && i.add(tv); + for (const c of Object.keys(r.panels ?? {})) i.add(tu(c)); const a = (c, l) => { !i.has(l) && t.hasCommand?.(l) !== !0 && n.push(`${c}: no command "${l}"${gr(l, i)}`); }; @@ -70494,7 +70542,7 @@ function JPe(e, t) { n.push(`${u} is not a bar`); continue; } - n.push(...YPe(u, c, l.place, r)), l.mode !== void 0 && l.title === void 0 && l.titleKey === void 0 && (s.has(Zl(l.mode)) || n.push( + n.push(...YPe(u, c, l.place, r)), l.mode !== void 0 && l.title === void 0 && l.titleKey === void 0 && (s.has(eu(l.mode)) || n.push( `${u}: its mode "${l.mode}" has no title, so its tab reads "${l.mode}"` )), n.push(...QPe(u, l, a)); } @@ -70548,7 +70596,7 @@ function YPe(e, t, n, r) { function QPe(e, t, n) { const r = [], o = /* @__PURE__ */ new Set(); let s = 0, i = 0; - for (const a of Il) { + for (const a of Nl) { const c = t[a]; if (c !== void 0) { if (!Array.isArray(c)) { @@ -70556,21 +70604,21 @@ function QPe(e, t, n) { continue; } for (const l of c) { - if (xm(l) && l.id !== void 0 && (o.has(l.id) && r.push(`${e}: two groups are called "${l.id}"`), o.add(l.id)), s++, xm(l) && l.dependent !== void 0) { - const d = l.dependent; - d === !0 ? i++ : d !== !1 && r.push( - `${e}: ${l.id === void 0 ? "a group" : `group "${l.id}"`} has dependent ${JSON.stringify(d)}, which is not true or false` + if (Em(l) && l.id !== void 0 && (o.has(l.id) && r.push(`${e}: two groups are called "${l.id}"`), o.add(l.id)), s++, Em(l) && l.dependent !== void 0) { + const f = l.dependent; + f === !0 ? i++ : f !== !1 && r.push( + `${e}: ${l.id === void 0 ? "a group" : `group "${l.id}"`} has dependent ${JSON.stringify(f)}, which is not true or false` ); } const u = /* @__PURE__ */ new Set(); - for (const d of Ai(l)) { - if (!Jm(d)) { - r.push(`${e}: ${JSON.stringify(d)} is not an item`); + for (const f of Ai(l)) { + if (!Ym(f)) { + r.push(`${e}: ${JSON.stringify(f)} is not an item`); continue; } - const f = yi(d); - u.has(f) && r.push(`${e}: "${f}" is twice in one group`), u.add(f), r.push(...XPe(e, f, d)); - const h = pPe(d); + const d = yi(f); + u.has(d) && r.push(`${e}: "${d}" is twice in one group`), u.add(d), r.push(...XPe(e, d, f)); + const h = pPe(f); h !== null && n(e, h); } } @@ -70589,7 +70637,7 @@ function ZPe(e, t, n) { if (!Array.isArray(t)) return [`${e} is not a list of sections`]; const r = [], o = /* @__PURE__ */ new Set(); for (const s of t) - for (const i of Xl(s)) { + for (const i of Zl(s)) { if (typeof i != "string") { r.push(`${e}: ${JSON.stringify(i)} is not a command id`); continue; @@ -70753,8 +70801,8 @@ function lj(e, t, n) { l += 1; continue; } - const d = t.unit(u.unit.key, u.unit.variants[u.variantIndex]); - d === void 0 && (o = !1), r += d ?? 0, s += 1, c = !0; + const f = t.unit(u.unit.key, u.unit.variants[u.variantIndex]); + f === void 0 && (o = !1), r += f ?? 0, s += 1, c = !0; } if (l > 0) { const u = t.groupTrigger(a.group.id); @@ -70808,7 +70856,7 @@ function i6e(e, t, n) { }; } function a6e(e, t) { - const n = Sm(e); + const n = xm(e); if (n === null) return []; const r = t(n)?.menu; return [r ? { kind: "submenu", command: n, menu: r } : { kind: "command", command: n }]; @@ -70828,12 +70876,12 @@ function c6e(e, t, n) { } function l6e(e, t) { const n = $q(e, (o) => { - const s = Sm(o); + const s = xm(o); return s !== null && t(s); }), r = []; for (const o of n.sections) for (const s of o.groups) { - const i = s.units.map(Sm).filter((a) => a !== null); + const i = s.units.map(xm).filter((a) => a !== null); i.length !== 0 && r.push({ id: s.id, labelKey: s.labelKey, commands: i }); } return r; @@ -70855,31 +70903,31 @@ function f6e(e) { } function h6e(e) { const { resolve: t, execute: n, measureKey: r } = e, o = (u) => { - const d = Sm(u); - return d === null ? null : t(d); - }, s = $q(e.bar, (u) => o(u)?.visible === !0), i = e.orientation === "vertical" ? f6e(s) : s, a = i6e(i, e.metrics, e.containerLength), c = (u) => u.map(o).filter((d) => d !== null && d.visible), l = { - unit: (u, d) => { + const f = xm(u); + return f === null ? null : t(f); + }, s = $q(e.bar, (u) => o(u)?.visible === !0), i = e.orientation === "vertical" ? f6e(s) : s, a = i6e(i, e.metrics, e.containerLength), c = (u) => u.map(o).filter((f) => f !== null && f.visible), l = { + unit: (u, f) => { if (u.kind === "custom") return { kind: "custom", key: u.key, - measureKey: r.unit(u.key, d), + measureKey: r.unit(u.key, f), name: u.slot, - variant: d, + variant: f, terminal: o(u), runTerminal: () => { u.terminal !== null && n(u.terminal); }, grow: u.grow }; - const f = t(u.command); + const d = t(u.command); return { kind: "command", key: u.key, - measureKey: r.unit(u.key, d), - command: f ?? e.unregistered(u.command), - variant: d, - run: f ? () => n(u.command) : () => { + measureKey: r.unit(u.key, f), + command: d ?? e.unregistered(u.command), + variant: f, + run: d ? () => n(u.command) : () => { } }; }, @@ -70897,7 +70945,7 @@ function h6e(e) { } }), // The shed children for the live trigger; the whole group for the measured one. - disclosure: (u, d) => ({ + disclosure: (u, f) => ({ kind: "disclosure", key: `${u.id}::trigger`, measureKey: r.groupTrigger(u.id), @@ -70906,7 +70954,7 @@ function h6e(e) { labelKey: u.labelKey, role: u.role, commands: c( - u.units.filter((f) => d || a.units.get(f.key)?.kind === "shed") + u.units.filter((d) => f || a.units.get(d.key)?.kind === "shed") ), execute: n } @@ -71073,7 +71121,7 @@ function OT(e, t) { function S6e(e) { return e.charAt(0).toUpperCase() + e.slice(1); } -const bo = sn("commands", { +const wo = an("commands", { hint: "add commandsPlugin() from '@embedpdf/plugin-commands' to your plugins list" }), Zq = (e, t) => e === t ? !0 : !e || !t ? !1 : e.id === t.id && e.label === t.label && e.icon === t.icon && e.iconAccent?.primary === t.iconAccent?.primary && e.iconAccent?.secondary === t.iconAccent?.secondary && e.menu === t.menu && e.enabled === t.enabled && e.active === t.active && e.pressable === t.pressable && e.visible === t.visible && e.disabledReason === t.disabledReason && e.shortcuts.length === t.shortcuts.length && e.shortcuts.every((n, r) => n === t.shortcuts[r]), eG = (e) => ({ id: e, @@ -71109,7 +71157,7 @@ function N6e(e) { I6e(r) ? n.push(r) : t.set(r.id, pP(r)); return { commands: t, families: n }; } -const tG = (e, t) => t.some((n) => e === n || e.startsWith(`${n}.`)), nG = (e) => e.tryGet(vo)?.getTranslator() ?? null, rG = (e, t) => { +const tG = (e, t) => t.some((n) => e === n || e.startsWith(`${n}.`)), nG = (e) => e.tryGet(ko)?.getTranslator() ?? null, rG = (e, t) => { if (e.labelParams) try { return e.labelParams(t); @@ -71159,7 +71207,7 @@ function T6e(e, t) { const l = c.documentId === null ? null : e.documentHandle(c.documentId); if (!l) return null; const u = a.requires?.find( - (d) => !O6e(l.security, d) + (f) => !O6e(l.security, f) ); return u !== void 0 ? P6e(u) : r(a, c) ? null : a.notAllowedKey ?? sG; }; @@ -71167,11 +71215,11 @@ function T6e(e, t) { const l = nG(c), u = () => oG(a, rG(a, c), l); if (n(a)) return { reason: "turned-off", message: R6e(u(), l) }; - const d = s(a, c); - if (d !== null) - return { reason: "not-allowed", message: iG(d, u(), l) }; - const f = o(a, c); - return f === null ? null : { reason: "locked", message: cG(f, u(), l) }; + const f = s(a, c); + if (f !== null) + return { reason: "not-allowed", message: iG(f, u(), l) }; + const d = o(a, c); + return d === null ? null : { reason: "locked", message: cG(d, u(), l) }; } }; } function M6e(e, t, n) { @@ -71226,13 +71274,13 @@ function D6e(e) { }, s = tt( () => [t.get().commands], (D) => N6e(D) - ), i = e.events.source(), a = e.events.source(), c = (D, _ = {}) => { - const L = D ?? e.get(It).getActiveId(), j = (H) => L ? e.forDocument(H, L) : e.get(H); + ), i = e.events.source(), a = e.events.source(), c = (D, B = {}) => { + const L = D ?? e.get(Pt).getActiveId(), j = (H) => L ? e.forDocument(H, L) : e.get(H); return { documentId: L, appState: t.get().appState, - ..._.args === void 0 ? {} : { args: _.args }, - ..._.signal ? { signal: _.signal } : {}, + ...B.args === void 0 ? {} : { args: B.args }, + ...B.signal ? { signal: B.signal } : {}, get: j, tryGet: (H) => { try { @@ -71245,240 +71293,240 @@ function D6e(e) { }, l = Mn( (D) => [e.storeChangeCount()], (D) => { - const _ = c(D || void 0), L = /* @__PURE__ */ new Map(), j = (H) => (L.has(H) || L.set(H, _.tryGet(H)), L.get(H)); - return { ..._, tryGet: j, get: (H) => j(H) ?? _.get(H) }; + const B = c(D || void 0), L = /* @__PURE__ */ new Map(), j = (H) => (L.has(H) || L.set(H, B.tryGet(H)), L.get(H)); + return { ...B, tryGet: j, get: (H) => j(H) ?? B.get(H) }; } - ), u = /* @__PURE__ */ new WeakMap(), d = (D, _) => { + ), u = /* @__PURE__ */ new WeakMap(), f = (D, B) => { let L = u.get(D); L || (L = /* @__PURE__ */ new Map(), u.set(D, L)); - let j = L.get(_); - return j || (j = pP({ ...D.command(_), id: `${D.prefix}${_}` }), L.set(_, j)), j; - }, f = (D) => { - const { commands: _, families: L } = s(), j = n.get(D) ?? _.get(D); + let j = L.get(B); + return j || (j = pP({ ...D.command(B), id: `${D.prefix}${B}` }), L.set(B, j)), j; + }, d = (D) => { + const { commands: B, families: L } = s(), j = n.get(D) ?? B.get(D); if (j) return j; const H = L.find( (Y) => D.startsWith(Y.prefix) && D.length > Y.prefix.length ); - return H ? d(H, D.slice(H.prefix.length)) : null; + return H ? f(H, D.slice(H.prefix.length)) : null; }, h = tt( () => [r, s()], - (D, { commands: _ }) => { - const L = new Map(_); + (D, { commands: B }) => { + const L = new Map(B); for (const [j, H] of n) L.set(j, H); return [...L.values()]; } - ), g = (D, _, L) => { + ), g = (D, B, L) => { if (!D) return L; try { - return D(_); + return D(B); } catch { return !1; } - }, p = (D, _) => { + }, p = (D, B) => { if (D) try { - return D(_) ?? void 0; + return D(B) ?? void 0; } catch { return; } - }, m = (D, _) => { + }, m = (D, B) => { try { - return D.names(_); + return D.names(B); } catch { return hj; } }, { isTurnedOff: v, notAllowedKeyOf: S, lockedKeyOf: C, refusalOf: k } = T6e( e, t - ), N = (D, _) => { - if (D.active) return g(D.active, _, !1); - const L = _.tryGet(dt); + ), N = (D, B) => { + if (D.active) return g(D.active, B, !1); + const L = B.tryGet(dt); if (!L) return !1; const j = fj(D); return D.menu ? L.isMenuOpen(D.menu) : j ? L.isOpen(j.id) : D.modal ? L.isOpen(D.modal) : !1; - }, w = (D, _) => { - const L = v(D), j = L ? null : S(D, _), H = t.get().notAllowed === "disable", Y = L || j !== null ? null : C(D, _); + }, w = (D, B) => { + const L = v(D), j = L ? null : S(D, B), H = t.get().notAllowed === "disable", Y = L || j !== null ? null : C(D, B); return { - enabled: !(L || j !== null || Y !== null) && g(D.enabled, _, !0), - visible: !L && (j === null || H) && g(D.visible, _, !0), + enabled: !(L || j !== null || Y !== null) && g(D.enabled, B, !0), + visible: !L && (j === null || H) && g(D.visible, B, !0), notAllowedKey: H ? j : null, lockedKey: Y }; - }, y = (D, _) => { - const { definition: L } = D, { enabled: j, visible: H, notAllowedKey: Y, lockedKey: ue } = w(L, _), le = rG(L, _), pe = p(L.iconAccent, _); + }, y = (D, B) => { + const { definition: L } = D, { enabled: j, visible: H, notAllowedKey: Y, lockedKey: le } = w(L, B), ie = rG(L, B), pe = p(L.iconAccent, B); return [ D, - nG(_), - le === void 0 ? void 0 : JSON.stringify(le), + nG(B), + ie === void 0 ? void 0 : JSON.stringify(ie), pe?.primary, pe?.secondary, j, - N(L, _), + N(L, B), H, Y, - ue + le ]; }, A = Mn((D) => [], (D) => { - const _ = Mn( + const B = Mn( (L) => [e.storeChangeCount()], (L) => { - const j = f(L); + const j = d(L); return j ? y(j, l(D)) : _6e; } ); return Mn( - (L) => _(L), - (L, j, H, Y, ue, le, pe, ge, Me, Be, te) => { + (L) => B(L), + (L, j, H, Y, le, ie, pe, ve, _e, Be, ee) => { if (!j) return null; - const he = Y === void 0 ? void 0 : JSON.parse(Y), Te = oG(j.definition, he, H), ze = Be !== null ? iG(Be, Te, H) : te !== null ? cG(te, Te, H) : void 0; + const he = Y === void 0 ? void 0 : JSON.parse(Y), Te = oG(j.definition, he, H), We = Be !== null ? iG(Be, Te, H) : ee !== null ? cG(ee, Te, H) : void 0; return { id: j.definition.id, label: Te, icon: j.definition.icon, - iconAccent: L6e(ue, le), + iconAccent: L6e(le, ie), shortcuts: j.shortcuts, menu: j.definition.menu, enabled: pe, - active: ge, + active: ve, pressable: B6e(j.definition), - visible: Me, + visible: _e, categories: j.definition.categories ?? [], - ...ze === void 0 ? {} : { disabledReason: ze } + ...We === void 0 ? {} : { disabledReason: We } }; } ); - }), b = (D, _) => A(_ ?? "")(D), E = Mn( + }), b = (D, B) => A(B ?? "")(D), E = Mn( (D) => { - const _ = s(), L = l(D); + const B = s(), L = l(D); return [ h(), - _, - ..._.families.map((j) => m(j, L)) + B, + ...B.families.map((j) => m(j, L)) ]; }, - (D, ..._) => { - const [L, { families: j }, ...H] = _, Y = L.map((le) => le.definition.id), ue = new Set(Y); - return j.forEach((le, pe) => { - for (const ge of H[pe] ?? hj) { - const Me = `${le.prefix}${ge}`; - ue.has(Me) || (ue.add(Me), Y.push(Me)); + (D, ...B) => { + const [L, { families: j }, ...H] = B, Y = L.map((ie) => ie.definition.id), le = new Set(Y); + return j.forEach((ie, pe) => { + for (const ve of H[pe] ?? hj) { + const _e = `${ie.prefix}${ve}`; + le.has(_e) || (le.add(_e), Y.push(_e)); } }), Y; } ), I = Mn( - (D) => E(D).map((_) => b(_, D || void 0)), - (D, ..._) => _.filter((L) => L !== null) + (D) => E(D).map((B) => b(B, D || void 0)), + (D, ...B) => B.filter((L) => L !== null) ), O = (D) => I(D ?? ""), T = tt( () => [h()], (D) => D.flatMap( - (_) => _.shortcuts.map((L) => ({ commandId: _.definition.id, shortcut: L })) + (B) => B.shortcuts.map((L) => ({ commandId: B.definition.id, shortcut: L })) ) - ), R = async (D, _) => { + ), R = async (D, B) => { if (D.run) { - await D.run(_); + await D.run(B); return; } - const L = _.tryGet(dt), j = fj(D); + const L = B.tryGet(dt), j = fj(D); L && (D.menu ? L.toggleMenu(D.menu) : j ? L.toggle(j.id, { exclusive: j.exclusive, focus: j.focus }) : D.modal && L.toggle(D.modal, { exclusive: "modal" })); - }, M = async (D, _ = {}) => { - const { signal: L, documentId: j, args: H } = _; + }, M = async (D, B = {}) => { + const { signal: L, documentId: j, args: H } = B; if (L?.aborted) - throw new re("operation-cancelled", "commands", "operation cancelled"); - const Y = f(D); + throw new te("operation-cancelled", "commands", "operation cancelled"); + const Y = d(D); if (!Y) return { status: "rejected", reason: "not-found" }; - const ue = w(Y.definition, l(j ?? "")); - if (!ue.visible) return { status: "rejected", reason: "hidden" }; - if (!ue.enabled) return { status: "rejected", reason: "disabled" }; - const le = c(j, { args: H, signal: L }); + const le = w(Y.definition, l(j ?? "")); + if (!le.visible) return { status: "rejected", reason: "hidden" }; + if (!le.enabled) return { status: "rejected", reason: "disabled" }; + const ie = c(j, { args: H, signal: L }); try { - await e.cancellable(L, R(Y.definition, le)); + await e.cancellable(L, R(Y.definition, ie)); } catch (pe) { - if (L?.aborted && pr(pe, "operation-cancelled")) throw pe; - const ge = qe("commands", pe); + if (L?.aborted && Xn(pe, "operation-cancelled")) throw pe; + const ve = ze("commands", pe); throw a.emit({ commandId: D, - documentId: le.documentId, - error: Br(ge) - }), ge; + documentId: ie.documentId, + error: Br(ve) + }), ve; } finally { e.notify(); } - return i.emit({ commandId: D, documentId: le.documentId, args: H }), { status: "executed" }; - }, F = (D, _) => { - if ((n.has(D.id) || s().commands.has(D.id)) && !_?.replace) - throw new re("conflict", "commands", `duplicate command '${D.id}'`); + return i.emit({ commandId: D, documentId: ie.documentId, args: H }), { status: "executed" }; + }, F = (D, B) => { + if ((n.has(D.id) || s().commands.has(D.id)) && !B?.replace) + throw new te("conflict", "commands", `duplicate command '${D.id}'`); const j = pP(D); return n.set(D.id, j), o(), () => { n.get(D.id) === j && (n.delete(D.id), o()); }; - }, B = M6e( + }, _ = M6e( t, - (D) => f(D)?.definition ?? null, + (D) => d(D)?.definition ?? null, v ); return { api: { ...t.api, registerCommand: F, - registerCommands: (D, _) => { - const L = D.map((j) => F(j, _)); + registerCommands: (D, B) => { + const L = D.map((j) => F(j, B)); return () => L.forEach((j) => j()); }, - hasCommand: (D) => f(D) !== null, - getCommand: (D) => f(D)?.definition ?? null, + hasCommand: (D) => d(D) !== null, + getCommand: (D) => d(D)?.definition ?? null, listCommandIds: () => E(""), resolveCommand: b, listCommands: O, - searchCommands: (D, _) => { + searchCommands: (D, B) => { const L = D.trim().toLowerCase(); - return O(_).filter( + return O(B).filter( (j) => j.visible && (L === "" || j.label.toLowerCase().includes(L) || j.id.includes(L)) ); }, listShortcuts: T, execute: M, - canExecute: (D, _) => { - const L = f(D); + canExecute: (D, B) => { + const L = d(D); if (!L) return !1; - const j = w(L.definition, l(_ ?? "")); + const j = w(L.definition, l(B ?? "")); return j.enabled && j.visible; }, - getRefusal: (D, _) => { - const L = f(D); - return L ? k(L.definition, l(_ ?? "")) : null; + getRefusal: (D, B) => { + const L = d(D); + return L ? k(L.definition, l(B ?? "")) : null; }, - ...B, + ..._, onExecuted: i.on, onExecutionFailed: a.on, // ── host lens ── - matchStroke: (D, _) => { + matchStroke: (D, B) => { let L = null, j = null; for (const H of h()) { - if (_.inTextField && !H.definition.shortcutInTextFields || !H.parsed.some((pe) => v6e(pe, D, _))) continue; - const Y = l(""), ue = k(H.definition, Y), le = g(H.definition.visible, Y, !0); - if (!ue) { - if (le && g(H.definition.enabled, Y, !0)) + if (B.inTextField && !H.definition.shortcutInTextFields || !H.parsed.some((pe) => v6e(pe, D, B))) continue; + const Y = l(""), le = k(H.definition, Y), ie = g(H.definition.visible, Y, !0); + if (!le) { + if (ie && g(H.definition.enabled, Y, !0)) return { commandId: H.definition.id, refusal: null }; L ?? (L = { commandId: H.definition.id, refusal: null }); continue; } - le && (j ?? (j = { commandId: H.definition.id, refusal: ue })); + ie && (j ?? (j = { commandId: H.definition.id, refusal: le })); } return L ?? j; }, getMenuTarget: (D) => { - const _ = f(D); - return _ ? { menu: _.definition.menu } : null; + const B = d(D); + return B ? { menu: B.definition.menu } : null; } } }; } -const rE = bo, j6e = (e) => ({ +const rE = wo, j6e = (e) => ({ id: "commands", scope: "workspace", token: rE, // Labels come from i18n, and commands that open a panel, menu or dialog // go through shell; without them a label is the command's own, and those // commands open nothing. - optional: [vo, dt], + optional: [ko, dt], // Command definitions come from the app and may use any capability. resolvesAnyCapability: !0, // Your app's state is replaced whole, never merged: a new value is the whole new state. @@ -71500,14 +71548,14 @@ const rE = bo, j6e = (e) => ({ }) }); function jr() { - return bt(bo); + return bt(wo); } -const F6e = jm(bo); +const F6e = Fm(wo); function lG(e, t = {}) { return OT(e, { isMac: t.isMac ?? pv() }); } -function go(e) { - const t = bt(bo), n = ar() ?? void 0, r = en( +function mo(e) { + const t = bt(wo), n = cr() ?? void 0, r = nn( () => t.resolveCommand(e, n), Zq ); @@ -71590,11 +71638,11 @@ function gP(e, t) { function H6e(e, t, n, r) { const { from: o } = uG(t), { undo: s, redo: i } = gP(e, r.id), a = { undo: s, redo: i }, c = [...a[o]], l = c.findIndex((u) => u.seq === n.seq); if (l >= 0) { - const u = [...c[l].parts, r].sort((d, f) => d.seq - f.seq); + const u = [...c[l].parts, r].sort((f, d) => f.seq - d.seq); c[l] = { ...c[l], parts: u }; } else { - const u = (f) => o === "undo" ? f.seq < n.seq : f.seq > n.seq, d = c.filter(u).length; - c.splice(d, 0, { ...n, parts: [r] }); + const u = (d) => o === "undo" ? d.seq < n.seq : d.seq > n.seq, f = c.filter(u).length; + c.splice(f, 0, { ...n, parts: [r] }); } return { ...e, ...a, [o]: c, merging: null }; } @@ -71638,7 +71686,7 @@ function J6e(e) { e.state.update(H6e, g, p, m); return { error: S }; } - ), d = (g) => { + ), f = (g) => { e.changes.sendHolds(); const p = NI(e.state.get(), g); if (!p) return; @@ -71682,16 +71730,16 @@ function J6e(e) { ); n.emit({ label: p.label, redo: C, skipped: N }); }); - }, f = () => e.changes.listPending().find((g) => g.held && g.history) ?? null; + }, d = () => e.changes.listPending().find((g) => g.held && g.history) ?? null; return { api: { ...t.api, - undo: () => d("undo"), - redo: () => d("redo"), - canUndo: () => f() !== null || e.state.get().undo.length > 0, - canRedo: () => f() === null && e.state.get().redo.length > 0, - getUndoLabel: () => f()?.label ?? NI(e.state.get(), "undo")?.label ?? null, - getRedoLabel: () => f() === null ? NI(e.state.get(), "redo")?.label ?? null : null, + undo: () => f("undo"), + redo: () => f("redo"), + canUndo: () => d() !== null || e.state.get().undo.length > 0, + canRedo: () => d() === null && e.state.get().redo.length > 0, + getUndoLabel: () => d()?.label ?? NI(e.state.get(), "undo")?.label ?? null, + getRedoLabel: () => d() === null ? NI(e.state.get(), "redo")?.label ?? null : null, clear: l, onUndone: n.on, onUndoFailed: r.on @@ -71710,7 +71758,7 @@ function J6e(e) { } const Y6e = (e) => ({ id: "history", - token: rg, + token: og, scope: "document", state: $6e, settings: { defaults: dce, registered: e }, @@ -71783,17 +71831,17 @@ function iRe(e) { const t = e.events.source(), n = e.events.source(), r = e.events.source(), o = e.events.source(); e.state.onChange(({ previous: l, next: u }) => { if (l.surfaces !== u.surfaces) { - const d = /* @__PURE__ */ new Set([...Object.keys(l.surfaces), ...Object.keys(u.surfaces)]); - for (const f of d) { - const h = l.surfaces[f]?.open ?? !1, g = u.surfaces[f]?.open ?? !1; - h !== g && (g ? t.emit({ id: f, props: u.surfaces[f].props }) : n.emit({ id: f })); + const f = /* @__PURE__ */ new Set([...Object.keys(l.surfaces), ...Object.keys(u.surfaces)]); + for (const d of f) { + const h = l.surfaces[d]?.open ?? !1, g = u.surfaces[d]?.open ?? !1; + h !== g && (g ? t.emit({ id: d, props: u.surfaces[d].props }) : n.emit({ id: d })); } } if (l.openMenus !== u.openMenus) { - for (const d of l.openMenus) - u.openMenus.includes(d) || o.emit({ id: d }); - for (const d of u.openMenus) - l.openMenus.includes(d) || r.emit({ id: d }); + for (const f of l.openMenus) + u.openMenus.includes(f) || o.emit({ id: f }); + for (const f of u.openMenus) + l.openMenus.includes(f) || r.emit({ id: f }); } }); const s = () => e.state.get(), i = Mn( @@ -71845,9 +71893,9 @@ function lRe() { function uRe(e, t) { hR(dt, e, t); } -const dRe = wo(cRe), mj = Object.freeze({}); +const dRe = vo(cRe), mj = Object.freeze({}); function Pi(e) { - const t = Rt(dt), n = zt(dt, (o) => o.isOpen(e), !1), r = zt( + const t = Bt(dt), n = Gt(dt, (o) => o.isOpen(e), !1), r = Gt( dt, (o) => o.getSurface(e)?.props ?? mj, mj @@ -71864,14 +71912,14 @@ function Pi(e) { ); } function o8e(e, t, n = {}) { - const r = Rt(dt), o = zt( + const r = Bt(dt), o = Gt( dt, (a) => a.getSurface(e)?.focusRequest ?? 0, 0 - ), [s] = De(Gae), i = n.select ?? !1; + ), [s] = je(Gae), i = n.select ?? !1; Ke(() => s.follow(t.current, r, o, { select: i })); } -const fRe = "attachments", hRe = "attachment-item", Ps = (e) => e.tryGet($m), Su = (e) => Ps(e)?.getSelected()[0] ?? null; +const fRe = "attachments", hRe = "attachment-item", Ps = (e) => e.tryGet(Um), xu = (e) => Ps(e)?.getSelected()[0] ?? null; async function yj(e, t) { const { bytes: n, name: r, mimeType: o } = await e.download(t); Yx(n, r, o ?? void 0); @@ -71907,18 +71955,18 @@ const bj = (e) => { labelKey: "commands.attachment.save", icon: "download", ...wj, - enabled: (e) => Su(e) !== null, + enabled: (e) => xu(e) !== null, run: async (e) => { - const t = Ps(e), n = Su(e); + const t = Ps(e), n = xu(e); t && n && await yj(t, n); } }, { id: "attachment:go-to", labelKey: "commands.attachment.goTo", - visible: (e) => Su(e)?.home.kind === "page", + visible: (e) => xu(e)?.home.kind === "page", run: (e) => { - const t = Su(e); + const t = xu(e); t && Ps(e)?.reveal(t); } }, @@ -71928,12 +71976,12 @@ const bj = (e) => { icon: "trash", ...vj, allowed: (e) => { - const t = Ps(e), n = Su(e); + const t = Ps(e), n = xu(e); return t ? n ? t.canDelete(n) : t.canCreate() : !0; }, - enabled: (e) => Su(e) !== null, + enabled: (e) => xu(e) !== null, run: async (e) => { - const t = Ps(e), n = Su(e); + const t = Ps(e), n = xu(e); t && n && await t.delete(n); } }, @@ -72014,7 +72062,7 @@ function xx(e) { return e.listOpenSurfaces().find((t) => t.exclusive === "mode")?.id ?? null; } function xRe(e) { - return Cm(e).map((t) => { + return Im(e).map((t) => { const n = Xq(e, t).map((r) => e.bars[r]).find((r) => r.title !== void 0 || r.titleKey !== void 0); return { mode: t, @@ -72025,8 +72073,8 @@ function xRe(e) { } const ERe = (e, t) => e.length === t.length && e.every((n, r) => n.mode === t[r].mode && n.title === t[r].title && n.titleKey === t[r].titleKey); function CRe(e, t) { - return e.filter((n) => !t(Zl(n.mode))).map((n) => { - const r = Zl(n.mode); + return e.filter((n) => !t(eu(n.mode))).map((n) => { + const r = eu(n.mode); return { id: r, label: n.title ?? (n.titleKey === void 0 ? n.mode : void 0), @@ -72063,21 +72111,21 @@ const PRe = { icon: "fileImport", shortcut: "Mod+O", categories: ["documents.open"], - visible: (e) => e.tryGet(It)?.canOpenFiles() ?? !1, + visible: (e) => e.tryGet(Pt)?.canOpenFiles() ?? !1, run: async (e) => { - const t = e.tryGet(It); + const t = e.tryGet(Pt); t && ORe(t, IRe(e.args) ?? await NRe()); } -}, RRe = "outline", yP = "outline-rename", mG = "outline-properties", TRe = "outline-item", pl = (e) => e.tryGet(Vm), p0 = (e) => { - const t = pl(e), [n] = t?.getSelected() ?? []; +}, RRe = "outline", yP = "outline-rename", mG = "outline-properties", TRe = "outline-item", gl = (e) => e.tryGet($m), p0 = (e) => { + const t = gl(e), [n] = t?.getSelected() ?? []; return n ? t?.get(n) ?? null : null; -}, My = (e) => p0(e) !== null, xu = { +}, My = (e) => p0(e) !== null, Eu = { categories: ["outline.editing"], - allowed: (e) => pl(e)?.canEdit() ?? !0, + allowed: (e) => gl(e)?.canEdit() ?? !0, notAllowedKey: "commands.notAllowed.doc-outline-modify" }; async function kj(e, t) { - const n = pl(e); + const n = gl(e); if (!n) return; const r = e.tryGet(dt), o = p0(e); r?.open(RRe), r?.open(yP, { props: { after: o?.ref.objectNumber ?? null } }); @@ -72093,7 +72141,7 @@ const MRe = [ labelKey: "commands.outline.add", icon: "plus", shortcut: "Mod+B", - ...xu, + ...Eu, run: (e) => kj(e, (t) => t ? { parent: t.parent, position: { after: t.ref } @@ -72102,14 +72150,14 @@ const MRe = [ { id: "outline:add-child", labelKey: "commands.outline.addChild", - ...xu, + ...Eu, enabled: My, run: (e) => kj(e, (t) => t ? { parent: t.ref } : {}) }, { id: "outline:rename", labelKey: "commands.outline.rename", - ...xu, + ...Eu, enabled: My, run: (e) => { const t = p0(e); @@ -72119,17 +72167,17 @@ const MRe = [ { id: "outline:set-destination", labelKey: "commands.outline.setDestination", - ...xu, - enabled: (e) => My(e) && pl(e)?.getCurrentViewTarget() != null, + ...Eu, + enabled: (e) => My(e) && gl(e)?.getCurrentViewTarget() != null, run: async (e) => { - const t = pl(e), n = p0(e), r = t?.getCurrentViewTarget() ?? null; + const t = gl(e), n = p0(e), r = t?.getCurrentViewTarget() ?? null; t && n && r && await t.update(n.ref, { target: r }); } }, { id: "outline:properties", labelKey: "commands.outline.properties", - ...xu, + ...Eu, enabled: My, run: (e) => { const t = p0(e); @@ -72143,10 +72191,10 @@ const MRe = [ id: "outline:delete", labelKey: "commands.outline.delete", icon: "trash", - ...xu, + ...Eu, enabled: My, run: async (e) => { - const t = pl(e), n = t?.getSelected() ?? []; + const t = gl(e), n = t?.getSelected() ?? []; t && n.length > 0 && await t.delete(n); } }, @@ -72155,23 +72203,23 @@ const MRe = [ labelKey: "commands.outline.more", icon: "dots", menu: TRe, - ...xu + ...Eu }, { id: "outline:expand-all", labelKey: "commands.outline.expandAll", icon: "chevronsDown", categories: ["outline"], - run: (e) => pl(e)?.expandAll() + run: (e) => gl(e)?.expandAll() }, { id: "outline:collapse-all", labelKey: "commands.outline.collapseAll", icon: "chevronsUp", categories: ["outline"], - run: (e) => pl(e)?.collapseAll() + run: (e) => gl(e)?.collapseAll() } -], BRe = "page", yG = "application/pdf", Os = (e) => e.tryGet(Fm), gl = (e) => Os(e)?.getSelected() ?? [], bP = (e) => gl(e).length > 0, JA = (e) => e.tryGet(It)?.listPages(e.documentId ?? void 0) ?? [], bG = (e) => e.args ?? {}, Ed = { +], BRe = "page", yG = "application/pdf", Os = (e) => e.tryGet(Vm), ml = (e) => Os(e)?.getSelected() ?? [], bP = (e) => ml(e).length > 0, JA = (e) => e.tryGet(Pt)?.listPages(e.documentId ?? void 0) ?? [], bG = (e) => e.args ?? {}, Cd = { categories: ["pages"], allowed: (e) => Os(e)?.canEdit() ?? !0, notAllowedKey: "commands.notAllowed.doc-pages-assemble" @@ -72179,7 +72227,7 @@ const MRe = [ function Aj(e) { const t = bG(e).position; if (t) return t; - const n = new Set(gl(e).map((o) => o.objectNumber)), r = JA(e).filter((o) => n.has(o.ref.objectNumber)).pop(); + const n = new Set(ml(e).map((o) => o.objectNumber)), r = JA(e).filter((o) => n.has(o.ref.objectNumber)).pop(); return r ? { after: r.ref } : "end"; } async function _Re(e) { @@ -72190,16 +72238,16 @@ async function _Re(e) { } function LRe(e) { const t = e.documentId ?? void 0; - return `${e.tryGet(It)?.get(t)?.name?.replace(/\.pdf$/i, "") || "document"}-pages.pdf`; + return `${e.tryGet(Pt)?.get(t)?.name?.replace(/\.pdf$/i, "") || "document"}-pages.pdf`; } const Sj = (e, t, n, r) => ({ id: e, labelKey: t, icon: n, - ...Ed, + ...Cd, enabled: bP, run: async (o) => { - const s = gl(o); + const s = ml(o); s.length > 0 && await Os(o)?.rotateBy(s, r); } }), DRe = [ @@ -72209,13 +72257,13 @@ const Sj = (e, t, n, r) => ({ id: "page:delete", labelKey: "commands.pages.delete", icon: "trash", - ...Ed, + ...Cd, enabled: (e) => { - const t = gl(e).length; + const t = ml(e).length; return t > 0 && t < JA(e).length; }, run: async (e) => { - const t = gl(e); + const t = ml(e); t.length > 0 && await Os(e)?.delete(t); } }, @@ -72223,10 +72271,10 @@ const Sj = (e, t, n, r) => ({ id: "page:duplicate", labelKey: "commands.pages.duplicate", icon: "copy", - ...Ed, + ...Cd, enabled: bP, run: async (e) => { - const t = Os(e), n = gl(e); + const t = Os(e), n = ml(e); if (!t || n.length === 0) return; const { pages: r } = await t.duplicate(n); t.select(r); @@ -72236,7 +72284,7 @@ const Sj = (e, t, n, r) => ({ id: "page:insert-blank", labelKey: "commands.pages.insertBlank", icon: "filePlus", - ...Ed, + ...Cd, run: async (e) => { const t = Os(e); if (!t) return; @@ -72248,7 +72296,7 @@ const Sj = (e, t, n, r) => ({ id: "page:insert-file", labelKey: "commands.pages.insertFile", icon: "fileImport", - ...Ed, + ...Cd, run: async (e) => { const t = Os(e); if (!t) return; @@ -72272,15 +72320,15 @@ const Sj = (e, t, n, r) => ({ notAllowedKey: "commands.notAllowed.doc-download", enabled: bP, run: async (e) => { - const t = gl(e), n = Os(e); + const t = ml(e), n = Os(e); !n || t.length === 0 || Yx(await n.extract(t), LRe(e), yG); } }, { id: "page:select-all", labelKey: "commands.pages.selectAll", - categories: Ed.categories, - enabled: (e) => gl(e).length < JA(e).length, + categories: Cd.categories, + enabled: (e) => ml(e).length < JA(e).length, run: (e) => Os(e)?.select(JA(e).map((t) => t.ref)) }, { @@ -72288,39 +72336,39 @@ const Sj = (e, t, n, r) => ({ labelKey: "commands.pages.more", icon: "dots", menu: BRe, - ...Ed + ...Cd } -], wG = "go-to-page", vG = "shortcuts", xj = "redact-confirm", jRe = "print", Ej = "form-design", FRe = "form-edit", Cj = (e) => e.tryGet(Ss)?.isDesigning() ?? !1, VRe = "embedpdf-custom", at = (e) => e.tryGet(Zt), Ck = (e) => (at(e)?.getPageCount() ?? 0) > 1, Pn = (e) => e.tryGet(yr), jt = (e) => e.tryGet(vt), YA = (e) => e.tryGet(_r), QA = (e) => e.tryGet(Wo), Ik = (e) => QA(e)?.getSnapshot() ?? null, $Re = ele.find((e) => "id" in e && e.id === "document:download"), URe = (e, t) => { - const n = e.tryGet(It), r = e.documentId ?? void 0; +], wG = "go-to-page", vG = "shortcuts", xj = "redact-confirm", jRe = "print", Ej = "form-design", FRe = "form-edit", Cj = (e) => e.tryGet(Ss)?.isDesigning() ?? !1, VRe = "embedpdf-custom", ct = (e) => e.tryGet(tn), Ck = (e) => (ct(e)?.getPageCount() ?? 0) > 1, Pn = (e) => e.tryGet(yr), Ut = (e) => e.tryGet(vt), YA = (e) => e.tryGet(_r), QA = (e) => e.tryGet(qo), Ik = (e) => QA(e)?.getSnapshot() ?? null, $Re = ele.find((e) => "id" in e && e.id === "document:download"), URe = (e, t) => { + const n = e.tryGet(Pt), r = e.documentId ?? void 0; return `${(n?.get(r)?.name ?? "document").replace(/\.pdf$/i, "")} p${(n?.listPages(r).findIndex((o) => o.ref.objectNumber === t.objectNumber) ?? -1) + 1}.png`; -}, Ht = { - allowed: (e) => jt(e)?.canCreate() ?? !0, +}, qt = { + allowed: (e) => Ut(e)?.canCreate() ?? !0, notAllowedKey: "commands.notAllowed.annotations-create" -}, vc = { +}, kc = { allowed: (e) => e.tryGet(Ss)?.canDesign() ?? !0, notAllowedKey: "commands.notAllowed.doc-forms-modify" }, Ij = { allowed: (e) => e.tryGet(Qn)?.canPlace(e.documentId ?? void 0) ?? !0, notAllowedKey: "commands.notAllowed.annotations-create" }, KRe = (e, t) => e === t || !!e && !!t && e.start.page.objectNumber === t.start.page.objectNumber && e.start.index === t.start.index && e.end.page.objectNumber === t.end.page.objectNumber && e.end.index === t.end.index, Nk = (e, t) => ({ - run: (n) => n.tryGet(bo)?.execute(eu(e), { documentId: n.documentId ?? void 0 }), + run: (n) => n.tryGet(wo)?.execute(tu(e), { documentId: n.documentId ?? void 0 }), active: (n) => n.tryGet(dt)?.isOpen(e) ?? !1, - visible: (n) => (n.tryGet(bo)?.hasCommand(eu(e)) ?? !1) && (t?.(n) ?? !0) + visible: (n) => (n.tryGet(wo)?.hasCommand(tu(e)) ?? !1) && (t?.(n) ?? !0) }), OI = (e) => { - const t = at(e)?.getCurrentPage(); + const t = ct(e)?.getCurrentPage(); return t != null && (e.tryGet(gi)?.canMeasure(t) ?? !1); -}, PI = (e) => (jt(e)?.selection.getSelected().length ?? 0) > 0, RI = (e) => { - const t = jt(e); +}, PI = (e) => (Ut(e)?.selection.getSelected().length ?? 0) > 0, RI = (e) => { + const t = Ut(e); return (t?.selection.getSelected() ?? []).every(({ ref: n }) => t.isEditable(n)); -}, Nj = (e) => (jt(e)?.selection.getProperties().properties ?? []).some((t) => t.key === "orientation"), TI = (e) => new Set((jt(e)?.selection.getSelected() ?? []).map((t) => t.subtype)), MI = (e) => { - const t = jt(e)?.selection.getSelected() ?? []; +}, Nj = (e) => (Ut(e)?.selection.getProperties().properties ?? []).some((t) => t.key === "orientation"), TI = (e) => new Set((Ut(e)?.selection.getSelected() ?? []).map((t) => t.subtype)), MI = (e) => { + const t = Ut(e)?.selection.getSelected() ?? []; return t.every((n) => n.subtype === "redact") ? t.map((n) => n.ref) : []; }, Ok = (e) => { - const t = jt(e)?.selection.getProperties(); + const t = Ut(e)?.selection.getProperties(); if (!(!t || !t.properties.some((n) => n.key === "link") || t.mixed.includes("link"))) return t.values.link ?? null; -}, Ng = {}; -Ng.stamp = { icon: "rubberStamp" }; +}, Og = {}; +Og.stamp = { icon: "rubberStamp" }; const kG = (e, t, n) => { if (!n) return null; const r = e.tryGet(vt); @@ -72330,7 +72378,7 @@ const kG = (e, t, n) => { primary: s(n.primary), secondary: n.secondary ? s(n.secondary) : void 0 }; -}, AG = {}, SG = (e, t, n, { feature: r, check: o, accent: s }) => (n && (Ng[t] = { +}, AG = {}, SG = (e, t, n, { feature: r, check: o, accent: s }) => (n && (Og[t] = { icon: n, ...s ? { accent: s } : {} }), AG[t] = r, { @@ -72342,7 +72390,7 @@ const kG = (e, t, n) => { active: (i) => Pn(i)?.getActiveToolId() === t, enabled: (i) => Pn(i) != null, iconAccent: (i) => kG(i, t, s) -}), Ot = (e, t, n, r, o) => ({ +}), Tt = (e, t, n, r, o) => ({ ...SG(e, t, r, o), labelKey: n }), BI = (e, t, n, r, o) => ({ @@ -72350,9 +72398,9 @@ const kG = (e, t, n) => { labelKey: n, icon: r, categories: [o], - ...Ht, + ...qt, visible: (s) => YA(s)?.hasSelection() ?? !1, - run: (s) => jt(s)?.createFromSelection(t), + run: (s) => Ut(s)?.createFromSelection(t), iconAccent: (s) => kG(s, t, { primary: "color" }) }), HRe = (e) => { const t = e?.page; @@ -72360,71 +72408,71 @@ const kG = (e, t, n) => { }, By = (e, t, n) => ({ id: e, labelKey: n, - run: (r) => at(r)?.zoomTo({ level: t }), - enabled: (r) => at(r) != null + run: (r) => ct(r)?.zoomTo({ level: t }), + enabled: (r) => ct(r) != null }), _I = (e, t, n, r) => ({ id: e, labelKey: n, icon: r, - run: (o) => at(o)?.updateSettings({ spread: t }), - active: (o) => at(o)?.getSettings().spread === t, - enabled: (o) => at(o) != null, - locked: (o) => at(o)?.getLock("spread") ?? null + run: (o) => ct(o)?.updateSettings({ spread: t }), + active: (o) => ct(o)?.getSettings().spread === t, + enabled: (o) => ct(o) != null, + locked: (o) => ct(o)?.getLock("spread") ?? null }), Oj = (e, t, n, r) => ({ id: e, labelKey: n, icon: r, - run: (o) => at(o)?.updateSettings({ + run: (o) => ct(o)?.updateSettings({ flow: "continuous", layout: t }), active: (o) => { - const s = at(o)?.getSettings(); + const s = ct(o)?.getSettings(); return s?.flow === "continuous" && s.layout === t; }, - enabled: (o) => at(o) != null, - locked: (o) => at(o)?.getLock("flow") ?? at(o)?.getLock("layout") ?? null + enabled: (o) => ct(o) != null, + locked: (o) => ct(o)?.getLock("flow") ?? ct(o)?.getLock("layout") ?? null }), Pj = [ { id: "zoom:in", labelKey: "commands.zoom.in", icon: "zoomIn", shortcut: ["Mod+=", "Mod+NumpadAdd"], - run: (e) => at(e)?.zoomIn(), - enabled: (e) => at(e)?.canZoomIn() ?? !1 + run: (e) => ct(e)?.zoomIn(), + enabled: (e) => ct(e)?.canZoomIn() ?? !1 }, { id: "zoom:out", labelKey: "commands.zoom.out", icon: "zoomOut", shortcut: ["Mod+-", "Mod+NumpadSubtract"], - run: (e) => at(e)?.zoomOut(), - enabled: (e) => at(e)?.canZoomOut() ?? !1 + run: (e) => ct(e)?.zoomOut(), + enabled: (e) => ct(e)?.canZoomOut() ?? !1 }, { id: "zoom:fit-page", labelKey: "commands.zoom.fitPage", icon: "fitToPage", shortcut: "Mod+0", - run: (e) => at(e)?.fitPage(), - active: (e) => at(e)?.getZoomMode() === dr.FitPage, - enabled: (e) => at(e) != null + run: (e) => ct(e)?.fitPage(), + active: (e) => ct(e)?.getZoomMode() === fr.FitPage, + enabled: (e) => ct(e) != null }, { id: "zoom:fit-width", labelKey: "commands.zoom.fitWidth", icon: "fitToWidth", shortcut: "Mod+1", - run: (e) => at(e)?.fitWidth(), - active: (e) => at(e)?.getZoomMode() === dr.FitWidth, - enabled: (e) => at(e) != null + run: (e) => ct(e)?.fitWidth(), + active: (e) => ct(e)?.getZoomMode() === fr.FitWidth, + enabled: (e) => ct(e) != null }, { id: "zoom:automatic", labelKey: "commands.zoom.automatic", - run: (e) => at(e)?.fitAutomatic(), - active: (e) => at(e)?.getZoomMode() === dr.Automatic, - enabled: (e) => at(e) != null + run: (e) => ct(e)?.fitAutomatic(), + active: (e) => ct(e)?.getZoomMode() === fr.Automatic, + enabled: (e) => ct(e) != null }, By("zoom:50", 0.5, "commands.zoom.p50"), By("zoom:100", 1, "commands.zoom.p100"), @@ -72442,8 +72490,8 @@ const kG = (e, t, n) => { labelKey: "commands.page.next", icon: "chevronRight", shortcut: "ArrowRight", - run: (e) => at(e)?.nextPage(), - enabled: (e) => at(e)?.canGoNext() ?? !1, + run: (e) => ct(e)?.nextPage(), + enabled: (e) => ct(e)?.canGoNext() ?? !1, visible: Ck }, { @@ -72451,31 +72499,31 @@ const kG = (e, t, n) => { labelKey: "commands.page.previous", icon: "chevronLeft", shortcut: "ArrowLeft", - run: (e) => at(e)?.previousPage(), - enabled: (e) => at(e)?.canGoPrevious() ?? !1, + run: (e) => ct(e)?.previousPage(), + enabled: (e) => ct(e)?.canGoPrevious() ?? !1, visible: Ck }, { id: "page:first", labelKey: "commands.page.first", shortcut: "Home", - run: (e) => at(e)?.goToFirstPage(), - enabled: (e) => at(e)?.canGoPrevious() ?? !1, + run: (e) => ct(e)?.goToFirstPage(), + enabled: (e) => ct(e)?.canGoPrevious() ?? !1, visible: Ck }, { id: "page:last", labelKey: "commands.page.last", shortcut: "End", - run: (e) => at(e)?.goToLastPage(), - enabled: (e) => at(e)?.canGoNext() ?? !1, + run: (e) => ct(e)?.goToLastPage(), + enabled: (e) => ct(e)?.canGoNext() ?? !1, visible: Ck }, { id: "page:go-to", labelKey: "commands.page.goTo", run: (e) => { - const t = at(e); + const t = ct(e); if (!t) return; const n = HRe(e.args); if (n === null) { @@ -72484,7 +72532,7 @@ const kG = (e, t, n) => { } t.goToPage(Math.min(Math.max(n, 1), t.getPageCount()) - 1); }, - enabled: (e) => (at(e)?.getPageCount() ?? 0) > 0 + enabled: (e) => (ct(e)?.getPageCount() ?? 0) > 0 }, { id: "tool:pan", @@ -72517,9 +72565,9 @@ const kG = (e, t, n) => { categories: ["snapshots"], allowed: (e) => QA(e)?.canSnapshot() ?? !0, notAllowedKey: "commands.notAllowed.doc-content-copy", - run: (e) => Pn(e)?.activateTool(hg), - active: (e) => Pn(e)?.getActiveToolId() === hg, - enabled: (e) => Pn(e)?.hasTool(hg) ?? !1 + run: (e) => Pn(e)?.activateTool(pg), + active: (e) => Pn(e)?.getActiveToolId() === pg, + enabled: (e) => Pn(e)?.hasTool(pg) ?? !1 }, { id: "menu:document", @@ -72544,10 +72592,10 @@ const kG = (e, t, n) => { icon: "download", shortcut: "Mod+S", categories: ["documents.download"], - allowed: (e) => e.tryGet(It)?.canDownload() ?? !0, + allowed: (e) => e.tryGet(Pt)?.canDownload() ?? !0, notAllowedKey: "commands.notAllowed.doc-download", run: (e) => { - e.tryGet(It) && Promise.resolve($Re.run?.(e)).catch((t) => console.warn("[embedpdf] download failed", t)); + e.tryGet(Pt) && Promise.resolve($Re.run?.(e)).catch((t) => console.warn("[embedpdf] download failed", t)); }, enabled: (e) => e.documentId != null }, @@ -72557,7 +72605,7 @@ const kG = (e, t, n) => { icon: "print", shortcut: "Mod+P", categories: ["documents.print"], - allowed: (e) => e.tryGet(It)?.canPrint() ?? !0, + allowed: (e) => e.tryGet(Pt)?.canPrint() ?? !0, notAllowedKey: "commands.notAllowed.doc-print", modal: jRe, enabled: (e) => e.documentId != null @@ -72571,26 +72619,26 @@ const kG = (e, t, n) => { id: "view:scroll-paged", labelKey: "commands.scroll.paged", icon: "pageByPage", - run: (e) => at(e)?.updateSettings({ flow: "paged" }), - active: (e) => at(e)?.getSettings().flow === "paged", - enabled: (e) => at(e) != null, - locked: (e) => at(e)?.getLock("flow") ?? null + run: (e) => ct(e)?.updateSettings({ flow: "paged" }), + active: (e) => ct(e)?.getSettings().flow === "paged", + enabled: (e) => ct(e) != null, + locked: (e) => ct(e)?.getLock("flow") ?? null }, { id: "view:rotate-clockwise", labelKey: "commands.rotate.clockwise", icon: "rotateClockwise", - run: (e) => at(e)?.rotateViewBy(90), - enabled: (e) => at(e) != null, - locked: (e) => at(e)?.getLock("viewRotation") ?? null + run: (e) => ct(e)?.rotateViewBy(90), + enabled: (e) => ct(e) != null, + locked: (e) => ct(e)?.getLock("viewRotation") ?? null }, { id: "view:rotate-counterclockwise", labelKey: "commands.rotate.counterclockwise", icon: "rotateCounterClockwise", - run: (e) => at(e)?.rotateViewBy(-90), - enabled: (e) => at(e) != null, - locked: (e) => at(e)?.getLock("viewRotation") ?? null + run: (e) => ct(e)?.rotateViewBy(-90), + enabled: (e) => ct(e) != null, + locked: (e) => ct(e)?.getLock("viewRotation") ?? null }, { id: "mode:view", @@ -72604,110 +72652,110 @@ const kG = (e, t, n) => { return t ? xx(t) === null : !0; } }, - Ch("mode:annotate", "commands.mode.annotate", { feature: "annotations" }), - Ch("mode:shapes", "commands.mode.shapes", { feature: "shapes" }), - Ch("mode:insert", "commands.mode.insert"), - Ch("mode:form", "commands.mode.form", { feature: "forms.building" }), - Ch("mode:redact", "commands.mode.redact", { feature: "redaction" }), - Ch("mode:measure", "commands.mode.measure", { feature: "measurement" }), - Ot("tool:highlight", "highlight", "commands.annotate.highlight", "highlight", { + Nh("mode:annotate", "commands.mode.annotate", { feature: "annotations" }), + Nh("mode:shapes", "commands.mode.shapes", { feature: "shapes" }), + Nh("mode:insert", "commands.mode.insert"), + Nh("mode:form", "commands.mode.form", { feature: "forms.building" }), + Nh("mode:redact", "commands.mode.redact", { feature: "redaction" }), + Nh("mode:measure", "commands.mode.measure", { feature: "measurement" }), + Tt("tool:highlight", "highlight", "commands.annotate.highlight", "highlight", { feature: "annotations.highlight", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:strikeout", "strikeout", "commands.annotate.strikeout", "strikethrough", { + Tt("tool:strikeout", "strikeout", "commands.annotate.strikeout", "strikethrough", { feature: "annotations.markup", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:underline", "underline", "commands.annotate.underline", "underline", { + Tt("tool:underline", "underline", "commands.annotate.underline", "underline", { feature: "annotations.markup", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:squiggly", "squiggly", "commands.annotate.squiggly", "squiggly", { + Tt("tool:squiggly", "squiggly", "commands.annotate.squiggly", "squiggly", { feature: "annotations.markup", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:ink", "ink", "commands.annotate.ink", "pencilMarker", { + Tt("tool:ink", "ink", "commands.annotate.ink", "pencilMarker", { feature: "annotations.drawing", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:ink-highlight", "ink-highlight", "commands.annotate.inkHighlight", "inkHighlighter", { + Tt("tool:ink-highlight", "ink-highlight", "commands.annotate.inkHighlight", "inkHighlighter", { feature: "annotations.drawing", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:free-text", "free-text", "commands.annotate.text", "freeText", { + Tt("tool:free-text", "free-text", "commands.annotate.text", "freeText", { feature: "annotations.text", - check: Ht, + check: qt, accent: { primary: "fontColor" } }), - Ot("tool:insert-text", "insert-text", "commands.annotate.insertText", "insertText", { + Tt("tool:insert-text", "insert-text", "commands.annotate.insertText", "insertText", { feature: "annotations.text", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:replace-text", "replace-text", "commands.annotate.replaceText", "replaceText", { + Tt("tool:replace-text", "replace-text", "commands.annotate.replaceText", "replaceText", { feature: "annotations.text", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:callout", "free-text-callout", "commands.annotate.callout", "callout", { + Tt("tool:callout", "free-text-callout", "commands.annotate.callout", "callout", { feature: "annotations.text", - check: Ht, + check: qt, accent: { primary: "color", secondary: "interiorColor" } }), - Ot("tool:note", "note", "commands.annotate.note", "message", { + Tt("tool:note", "note", "commands.annotate.note", "message", { feature: "annotations.notes", - check: Ht + check: qt }), - Ot("tool:link", "link", "commands.annotate.link", "link", { + Tt("tool:link", "link", "commands.annotate.link", "link", { feature: "annotations.links", - check: Ht + check: qt }), - Ot("tool:square", "square", "commands.shapes.rectangle", "square", { + Tt("tool:square", "square", "commands.shapes.rectangle", "square", { feature: "shapes", - check: Ht, + check: qt, accent: { primary: "color", secondary: "interiorColor" } }), - Ot("tool:circle", "circle", "commands.shapes.circle", "circle", { + Tt("tool:circle", "circle", "commands.shapes.circle", "circle", { feature: "shapes", - check: Ht, + check: qt, accent: { primary: "color", secondary: "interiorColor" } }), - Ot("tool:line", "line", "commands.shapes.line", "line", { + Tt("tool:line", "line", "commands.shapes.line", "line", { feature: "shapes", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:arrow", "arrow", "commands.shapes.arrow", "lineArrow", { + Tt("tool:arrow", "arrow", "commands.shapes.arrow", "lineArrow", { feature: "shapes", - check: Ht, + check: qt, accent: { primary: "color" } }), - Ot("tool:polygon", "polygon", "commands.shapes.polygon", "polygon", { + Tt("tool:polygon", "polygon", "commands.shapes.polygon", "polygon", { feature: "shapes", - check: Ht, + check: qt, accent: { primary: "color", secondary: "interiorColor" } }), - Ot("tool:polyline", "polyline", "commands.shapes.polyline", "zigzag", { + Tt("tool:polyline", "polyline", "commands.shapes.polyline", "zigzag", { feature: "shapes", - check: Ht, + check: qt, accent: { primary: "color" } }), { @@ -72718,9 +72766,9 @@ const kG = (e, t, n) => { ...Ij, ...Nk("stamps", (e) => e.tryGet(Qn) != null) }, - Ot("tool:attachment", "attachment", "commands.insert.attachment", "paperclip", { + Tt("tool:attachment", "attachment", "commands.insert.attachment", "paperclip", { feature: "attachments.adding", - check: Ht + check: qt }), { id: "tool:signature", @@ -72730,16 +72778,16 @@ const kG = (e, t, n) => { ...Ij, ...Nk("signatures", (e) => e.tryGet(Qn) != null && e.tryGet(vs) != null) }, - Ot("tool:image", "image", "commands.insert.image", "photo", { + Tt("tool:image", "image", "commands.insert.image", "photo", { feature: "stamps", - check: Ht + check: qt }), { id: "form:design", labelKey: "commands.form.design", icon: "formDesign", categories: ["forms.building"], - ...vc, + ...kc, run: (e) => { const t = Pn(e), n = e.tryGet(dt); if (t) { @@ -72753,35 +72801,35 @@ const kG = (e, t, n) => { active: Cj, enabled: (e) => Pn(e) != null }, - Ot("tool:text-field", "form-text", "commands.form.textfield", "formTextfield", { + Tt("tool:text-field", "form-text", "commands.form.textfield", "formTextfield", { feature: "forms.building", - check: vc + check: kc }), - Ot("tool:checkbox", "form-checkbox", "commands.form.checkbox", "formCheckbox", { + Tt("tool:checkbox", "form-checkbox", "commands.form.checkbox", "formCheckbox", { feature: "forms.building", - check: vc + check: kc }), - Ot("tool:radio", "form-radio", "commands.form.radio", "formRadio", { + Tt("tool:radio", "form-radio", "commands.form.radio", "formRadio", { feature: "forms.building", - check: vc + check: kc }), - Ot("tool:combo-box", "form-combobox", "commands.form.select", "formSelect", { + Tt("tool:combo-box", "form-combobox", "commands.form.select", "formSelect", { feature: "forms.building", - check: vc + check: kc }), - Ot("tool:list-box", "form-listbox", "commands.form.listbox", "formListbox", { + Tt("tool:list-box", "form-listbox", "commands.form.listbox", "formListbox", { feature: "forms.building", - check: vc + check: kc }), - Ot("tool:button", "form-button", "commands.form.button", "formButton", { + Tt("tool:button", "form-button", "commands.form.button", "formButton", { feature: "forms.building", - check: vc + check: kc }), - Ot("tool:signature-field", "form-signature", "commands.form.signature", "signature", { + Tt("tool:signature-field", "form-signature", "commands.form.signature", "signature", { feature: "forms.building", - check: vc + check: kc }), - Ot("tool:redact", "redact", "commands.redact.mark", "redactArea", { + Tt("tool:redact", "redact", "commands.redact.mark", "redactArea", { feature: "redaction", check: { allowed: (e) => e.tryGet(oa)?.canMark() ?? !0, @@ -72818,25 +72866,25 @@ const kG = (e, t, n) => { } }, { - ...Ot("tool:distance", "distance", "measurement.distance", "distance", { + ...Tt("tool:distance", "distance", "measurement.distance", "distance", { feature: "measurement", - check: Ht, + check: qt, accent: { primary: "color" } }), enabled: OI }, { - ...Ot("tool:perimeter", "perimeter", "measurement.perimeter", "perimeter", { + ...Tt("tool:perimeter", "perimeter", "measurement.perimeter", "perimeter", { feature: "measurement", - check: Ht, + check: qt, accent: { primary: "color" } }), enabled: OI }, { - ...Ot("tool:area", "area", "measurement.area", "area", { + ...Tt("tool:area", "area", "measurement.area", "area", { feature: "measurement", - check: Ht, + check: qt, accent: { primary: "color" } }), enabled: OI @@ -72856,15 +72904,15 @@ const kG = (e, t, n) => { id: "annotation:cancel-creation", labelKey: "commands.annotate.cancelCreation", shortcut: "Escape", - enabled: (e) => jt(e)?.draft.get() != null, - run: (e) => jt(e)?.draft.cancel() + enabled: (e) => Ut(e)?.draft.get() != null, + run: (e) => Ut(e)?.draft.cancel() }, { id: "annotation:disarm-stamp", labelKey: "commands.annotate.disarmStamp", shortcut: "Escape", - enabled: (e) => jt(e)?.stamps.isArmed() ?? !1, - run: (e) => jt(e)?.stamps.disarm() + enabled: (e) => Ut(e)?.stamps.isArmed() ?? !1, + run: (e) => Ut(e)?.stamps.disarm() }, { id: "annotation:delete", @@ -72872,10 +72920,10 @@ const kG = (e, t, n) => { icon: "trash", shortcut: ["Delete", "Backspace"], categories: ["annotations"], - run: (e) => void jt(e)?.selection.delete(), + run: (e) => void Ut(e)?.selection.delete(), visible: PI, enabled: (e) => { - const t = jt(e), n = t?.selection.getSelected() ?? []; + const t = Ut(e), n = t?.selection.getSelected() ?? []; return n.length > 0 && n.every(({ ref: r }) => t.canDelete(r) && t.isEditable(r)); } }, @@ -72891,7 +72939,7 @@ const kG = (e, t, n) => { labelKey: "commands.style", icon: "palette", categories: ["annotations"], - ...Nk("style", (e) => (jt(e)?.selection.getProperties().properties.length ?? 0) > 0) + ...Nk("style", (e) => (Ut(e)?.selection.getProperties().properties.length ?? 0) > 0) }, { id: "annotation:stamp-from-selection", @@ -72901,23 +72949,23 @@ const kG = (e, t, n) => { allowed: (e) => e.tryGet(Qn)?.canCreateFromAnnotations(e.documentId ?? void 0) ?? !0, notAllowedKey: "commands.notAllowed.doc-download", run: (e) => { - const t = jt(e), n = e.tryGet(Qn), r = e.documentId; + const t = Ut(e), n = e.tryGet(Qn), r = e.documentId; if (!t || !n || r == null) return; const o = t.selection.getSelected(), s = o[0]?.ref.page; if (s === void 0) return; - const i = e.tryGet(vo), a = i?.t("demo.stampsCustomLabel") ?? "Custom stamp", c = i?.t("demo.stampsCustomLibrary") ?? "My stamps", l = VRe; + const i = e.tryGet(ko), a = i?.t("demo.stampsCustomLabel") ?? "Custom stamp", c = i?.t("demo.stampsCustomLibrary") ?? "My stamps", l = VRe; (n.getLibrary(l) ? Promise.resolve(l) : n.createLibrary(c, { id: l, categories: ["custom"] - }).then(({ library: u }) => u.id)).then((u) => n.createAssetFromAnnotations(s, o.map((d) => d.ref), { + }).then(({ library: u }) => u.id)).then((u) => n.createAssetFromAnnotations(s, o.map((f) => f.ref), { libraryId: u, label: `${a} ${n.listAssets({ libraryId: u }).length + 1}` }, { documentId: r })).then(async () => { const u = e.tryGet(dt); - u && (u.isOpen("stamps") || await e.tryGet(bo)?.execute(eu("stamps"), { documentId: r }), u.updateSurfaceProps("stamps", { libraryId: l })); + u && (u.isOpen("stamps") || await e.tryGet(wo)?.execute(tu("stamps"), { documentId: r }), u.updateSurfaceProps("stamps", { libraryId: l })); }).catch((u) => console.warn("[embedpdf] stamp from selection failed", u)); }, - visible: (e) => e.tryGet(Qn) != null && PI(e) && !TI(e).has("widget") && !TI(e).has("redact") && new Set((jt(e)?.selection.getSelected() ?? []).map((t) => t.ref.page.objectNumber)).size === 1 + visible: (e) => e.tryGet(Qn) != null && PI(e) && !TI(e).has("widget") && !TI(e).has("redact") && new Set((Ut(e)?.selection.getSelected() ?? []).map((t) => t.ref.page.objectNumber)).size === 1 }, { id: "annotation:duplicate", @@ -72926,24 +72974,24 @@ const kG = (e, t, n) => { shortcut: "Mod+D", categories: ["annotations"], allowed: (e) => { - const t = jt(e); + const t = Ut(e); return (t?.selection.getSelected() ?? []).some(({ subtype: n }) => n !== "widget") ? t?.canCreate() ?? !0 : !0; }, - notAllowedKey: Ht.notAllowedKey, - run: (e) => void jt(e)?.selection.duplicate().catch(() => { + notAllowedKey: qt.notAllowedKey, + run: (e) => void Ut(e)?.selection.duplicate().catch(() => { }), visible: (e) => { - const t = jt(e), n = t?.selection.getSelected() ?? []; + const t = Ut(e), n = t?.selection.getSelected() ?? []; return n.length > 0 && RI(e) && n.every(({ ref: r }) => t.isMovable(r)); }, - enabled: (e) => jt(e)?.selection.canDuplicate() ?? !1 + enabled: (e) => Ut(e)?.selection.canDuplicate() ?? !1 }, { id: "annotation:rotate-counterclockwise", labelKey: "commands.annotate.rotateCounterclockwise", icon: "rotateCounterClockwise", categories: ["annotations"], - run: (e) => void jt(e)?.selection.rotateBy(-90).catch(() => { + run: (e) => void Ut(e)?.selection.rotateBy(-90).catch(() => { }), visible: Nj }, @@ -72952,7 +73000,7 @@ const kG = (e, t, n) => { labelKey: "commands.annotate.rotateClockwise", icon: "rotateClockwise", categories: ["annotations"], - run: (e) => void jt(e)?.selection.rotateBy(90).catch(() => { + run: (e) => void Ut(e)?.selection.rotateBy(90).catch(() => { }), visible: Nj }, @@ -72961,16 +73009,16 @@ const kG = (e, t, n) => { labelKey: "commands.annotate.group", icon: "group", categories: ["annotations"], - run: (e) => void jt(e)?.selection.group(), - visible: (e) => (jt(e)?.selection.canGroup() ?? !1) && RI(e) + run: (e) => void Ut(e)?.selection.group(), + visible: (e) => (Ut(e)?.selection.canGroup() ?? !1) && RI(e) }, { id: "annotation:ungroup", labelKey: "commands.annotate.ungroup", icon: "ungroup", categories: ["annotations"], - run: (e) => void jt(e)?.selection.ungroup(), - visible: (e) => (jt(e)?.selection.canUngroup() ?? !1) && RI(e) + run: (e) => void Ut(e)?.selection.ungroup(), + visible: (e) => (Ut(e)?.selection.canUngroup() ?? !1) && RI(e) }, { id: "selection:copy", @@ -73045,7 +73093,7 @@ const kG = (e, t, n) => { icon: "externalLink", run: (e) => { const t = Ok(e); - t && e.tryGet(Pf)?.activate(t); + t && e.tryGet(Tf)?.activate(t); }, visible: (e) => Ok(e) != null }, @@ -73054,7 +73102,7 @@ const kG = (e, t, n) => { labelKey: "commands.annotate.removeLink", icon: "linkOff", categories: ["annotations.links"], - run: (e) => jt(e)?.selection.updateLink(null), + run: (e) => Ut(e)?.selection.updateLink(null), visible: (e) => Ok(e) != null }, { @@ -73069,19 +73117,19 @@ const kG = (e, t, n) => { labelKey: "commands.undo", icon: "arrowBackUp", shortcut: "Mod+z", - run: (e) => e.tryGet(rg)?.undo(), - enabled: (e) => e.tryGet(rg)?.canUndo() ?? !1 + run: (e) => e.tryGet(og)?.undo(), + enabled: (e) => e.tryGet(og)?.canUndo() ?? !1 }, { id: "history:redo", labelKey: "commands.redo", icon: "arrowForwardUp", shortcut: ["Shift+Mod+z", "Mod+y"], - run: (e) => e.tryGet(rg)?.redo(), - enabled: (e) => e.tryGet(rg)?.canRedo() ?? !1 + run: (e) => e.tryGet(og)?.redo(), + enabled: (e) => e.tryGet(og)?.canRedo() ?? !1 } ]; -function Ch(e, t, { feature: n } = {}) { +function Nh(e, t, { feature: n } = {}) { return { id: e, labelKey: t, @@ -73096,23 +73144,23 @@ function zRe(e, t) { return e.flatMap((n) => { const r = `tool:${n.id}`; if (t(r)) return []; - const o = n.extends, s = n.meta ?? {}, i = typeof s.icon == "string" ? s.icon : o && Ng[o]?.icon; + const o = n.extends, s = n.meta ?? {}, i = typeof s.icon == "string" ? s.icon : o && Og[o]?.icon; return [{ ...SG(r, n.id, i || void 0, { feature: o && AG[o] || "annotations", - check: Ht, - ...o && Ng[o]?.accent ? { accent: Ng[o].accent } : {} + check: qt, + ...o && Og[o]?.accent ? { accent: Og[o].accent } : {} }), label: typeof s.label == "string" ? s.label : n.id }]; }); } -const Ih = { +const Oh = { id: "style", items: ["panel:style"], importance: 4, dependent: !0 -}, Nh = { +}, Ph = { id: "history", items: ["history:undo", "history:redo"], importance: 3, @@ -73199,8 +73247,8 @@ const Ih = { ], importance: 2 }, - Ih, - Nh + Oh, + Ph ] }, shapes: { @@ -73223,8 +73271,8 @@ const Ih = { items: ["tool:polygon", "tool:polyline"], importance: 2 }, - Ih, - Nh + Oh, + Ph ] }, insert: { @@ -73247,8 +73295,8 @@ const Ih = { ], importance: 4 }, - Ih, - Nh + Oh, + Ph ] }, form: { @@ -73285,8 +73333,8 @@ const Ih = { items: ["tool:signature-field"], importance: 2 }, - Ih, - Nh + Oh, + Ph ] }, redact: { @@ -73299,8 +73347,8 @@ const Ih = { items: ["tool:redact", "panel:redaction"], importance: 4 }, - Ih, - Nh + Oh, + Ph ] }, measure: { @@ -73327,7 +73375,7 @@ const Ih = { }], importance: 4 }, - Ih + Oh ] }, pager: { @@ -73407,7 +73455,7 @@ const Ih = { ], importance: 1 }], - end: [Nh] + end: [Ph] }, outline: { place: { panel: "outline" }, @@ -73607,11 +73655,11 @@ function ZRe(e, t, n, r) { return !1; } }), a = (l) => { - const u = Rj(l), d = u.filter((g) => !i(g)), f = d.length === u.length ? l : { + const u = Rj(l), f = u.filter((g) => !i(g)), d = f.length === u.length ? l : { ...l, - shortcut: d + shortcut: f }, h = o.get(l.id); - return h ? QRe(f, h) : f; + return h ? QRe(d, h) : d; }, c = new Set(e.map((l) => l.id)); return { commands: [...e.map(a), ...[...o.values()].filter((l) => !c.has(l.id))], @@ -73628,20 +73676,20 @@ const Ri = Fn({ warnBeforeLeaving: !0 }), e5e = Ri.Provider; function t5e() { - return Et(Ri).layout; + return Ct(Ri).layout; } function n5e() { - const { size: e, touch: t } = Et(Ri); + const { size: e, touch: t } = Ct(Ri); return { size: e, touch: t }; } function r5e() { - return Et(Ri).warnBeforeLeaving; + return Ct(Ri).warnBeforeLeaving; } function EG() { - const { onPanelResize: e } = Et(Ri); + const { onPanelResize: e } = Ct(Ri); return (t) => e?.(t); } const MT = { @@ -73682,31 +73730,31 @@ function o5e(e, t) { } const zv = Fn(o5e(xG, MT)), s5e = zv.Provider; function Ti() { - return Et(zv); + return Ct(zv); } function oc() { - return Et(zv).env; + return Ct(zv).env; } function i5e(e) { - return Et(zv).menu(e); + return Ct(zv).menu(e); } function BT(e) { - return Et(zv).strip(e) ?? void 0; + return Ct(zv).strip(e) ?? void 0; } function _T() { - return Et(Ri).viewerCommands; + return Ct(Ri).viewerCommands; } function CG() { - return Et(Ri).icons; + return Ct(Ri).icons; } function IG() { - return Et(Ri).stamp; + return Ct(Ri).stamp; } function s8e() { - return Et(Ri).signature; + return Ct(Ri).signature; } function a5e() { - return Et(Ri).fonts; + return Ct(Ri).fonts; } const c5e = (e) => Array.isArray(e); function l5e(e) { @@ -74321,8 +74369,8 @@ function PG(e, t) { const n = Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0; return n !== void 0 ? l5e(n) : u5e(e) ? OG[e] : null; } -const d5e = /* @__PURE__ */ new Set(["chevronLeft", "chevronRight"]), Im = (e) => d5e.has(e) ? "rtl:-scale-x-100" : ""; -function Nt({ name: e, size: t = 20, strokeWidth: n = 2, className: r, title: o, accent: s }) { +const d5e = /* @__PURE__ */ new Set(["chevronLeft", "chevronRight"]), Nm = (e) => d5e.has(e) ? "rtl:-scale-x-100" : ""; +function Rt({ name: e, size: t = 20, strokeWidth: n = 2, className: r, title: o, accent: s }) { const i = PG(e, CG()); return i ? /* @__PURE__ */ P("svg", { width: t, @@ -75250,21 +75298,21 @@ function k5e(e = {}) { a.en = () => c().then((l) => Pk(Mj, l)); } for (const [c, l] of Object.entries(Bj)) { - const u = o.get(c), d = u?.load, f = u?.words; - a[c] = d ? () => Promise.all([l(), d()]).then(([h, g]) => Pk(h, g)) : f ? () => l().then((h) => Pk(h, f)) : l; + const u = o.get(c), f = u?.load, d = u?.words; + a[c] = f ? () => Promise.all([l(), f()]).then(([h, g]) => Pk(h, g)) : d ? () => l().then((h) => Pk(h, d)) : l; } for (const [c, { words: l, load: u }] of o) { if (n(c) !== void 0) continue; - const d = { + const f = { code: c, name: v5e(c), direction: w5e(c) }; - u ? a[c] = () => u().then((f) => ({ - ...d, - translations: f + u ? a[c] = () => u().then((d) => ({ + ...f, + translations: d })) : i.push({ - ...d, + ...f, translations: l ?? {} }); } @@ -75287,7 +75335,7 @@ function A5e({ locale: e, children: t }) { }); } function i8e() { - return Et(TG); + return Ct(TG); } const S5e = { top: !1, @@ -75345,37 +75393,37 @@ function DG(e, t) { typeof e.showPopover == "function" && e.showPopover(); let r = ""; const o = () => { - const d = _G(e), f = n?.getBoundingClientRect() ?? { + const f = _G(e), d = n?.getBoundingClientRect() ?? { left: 0, top: 0, - right: d.width, - bottom: d.height - }, h = Math.max(0, f.left), g = Math.max(0, f.top), p = { + right: f.width, + bottom: f.height + }, h = Math.max(0, d.left), g = Math.max(0, d.top), p = { left: h, top: g, - width: Math.max(0, Math.min(d.width, f.right) - h), - height: Math.max(0, Math.min(d.height, f.bottom) - g) - }, m = `${p.left},${p.top},${p.width},${p.height},${d.width},${d.height}`; - m !== r && (r = m, N5e(e, p), t?.(MG(f, d))); + width: Math.max(0, Math.min(f.width, d.right) - h), + height: Math.max(0, Math.min(f.height, d.bottom) - g) + }, m = `${p.left},${p.top},${p.width},${p.height},${f.width},${f.height}`; + m !== r && (r = m, N5e(e, p), t?.(MG(d, f))); }; o(); const s = new ResizeObserver(o); n && s.observe(n); const i = Qx(o), a = e.ownerDocument, c = () => { if (typeof e.showPopover != "function" || !e.matches(":popover-open")) return; - const d = Gr(a); - e.hidePopover(), e.showPopover(), d && d !== Gr(a) && d.focus({ preventScroll: !0 }); + const f = Jr(a); + e.hidePopover(), e.showPopover(), f && f !== Jr(a) && f.focus({ preventScroll: !0 }); }, l = () => { n && I5e(n) && c(); - }, u = (d) => { - d.newState === "open" && c(); + }, u = (f) => { + f.newState === "open" && c(); }; return a.addEventListener("fullscreenchange", l), n?.addEventListener("toggle", u), () => { a.removeEventListener("fullscreenchange", l), n?.removeEventListener("toggle", u), i(), s.disconnect(), typeof e.hidePopover == "function" && e.matches(":popover-open") && e.hidePopover(); }; } function oE(e, t) { - const n = e.ownerDocument, r = Gr(n), o = (a) => { + const n = e.ownerDocument, r = Jr(n), o = (a) => { a.key !== "Escape" || a.defaultPrevented || (a.preventDefault(), a.stopPropagation(), t.onEscape()); }; e.addEventListener("keydown", o); @@ -75391,14 +75439,14 @@ function oE(e, t) { standDown: i, release: () => { i(); - const a = Gr(n), c = a === null || e.contains(a) || a.hasAttribute("data-epdf-focus-root"); + const a = Jr(n), c = a === null || e.contains(a) || a.hasAttribute("data-epdf-focus-root"); r?.isConnected && c && r.focus(); } }; } const jG = Fn("top"), Wv = jG.Provider; function DT() { - return Et(jG); + return Ct(jG); } function FG(e, t, n = "start", r = "above") { return e === "start" || e === "end" ? `${e === "start" == (t === "ltr") ? "right" : "left"}-${n}` : `${e === "bottom" || e === "float-bottom" || e === "selection" && r === "above" ? "top" : "bottom"}-${n === "start" == (t === "ltr") ? "start" : "end"}`; @@ -75441,30 +75489,30 @@ function KG(e, t, n, r) { const a = e.getBoundingClientRect(); (Math.abs(a.left - s) > 0.5 || Math.abs(a.top - i) > 0.5) && (e.style.left = `${2 * s - a.left}px`, e.style.top = `${2 * i - a.top}px`); } -let Oh = null, Lj = Number.NEGATIVE_INFINITY; +let Rh = null, Lj = Number.NEGATIVE_INFINITY; const Dj = (e) => e.pointerType === "touch"; function P5e(e, t, n) { let r = null, o = !1, s = !1, i = !1, a = !1, c, l; - const u = { hide: () => p() }, d = () => { + const u = { hide: () => p() }, f = () => { clearTimeout(c), clearTimeout(l); - }, f = () => e.getAttribute("aria-expanded") === "true", h = () => Oh !== null || Date.now() - Lj < 300, g = (y) => { - if (d(), !(r === y || r === "pointer")) { + }, d = () => e.getAttribute("aria-expanded") === "true", h = () => Rh !== null || Date.now() - Lj < 300, g = (y) => { + if (f(), !(r === y || r === "pointer")) { if (r === null) { if (t.canShow && !t.canShow()) return; - Oh !== u && Oh?.hide(), Oh = u, n.addEventListener("keydown", w, !0); + Rh !== u && Rh?.hide(), Rh = u, n.addEventListener("keydown", w, !0); } r = y, t.show(y); } }, p = () => { - d(), r !== null && (r = null, Oh === u && (Oh = null), Lj = Date.now(), n.removeEventListener("keydown", w, !0), t.hide()); + f(), r !== null && (r = null, Rh === u && (Rh = null), Lj = Date.now(), n.removeEventListener("keydown", w, !0), t.hide()); }, m = () => { clearTimeout(l), l = setTimeout(p, 100); }, v = (y) => { - Dj(y) || (o = !0, clearTimeout(l), !(a || f()) && (r !== null || h() ? g("pointer") : c = setTimeout(() => g("pointer"), 500))); + Dj(y) || (o = !0, clearTimeout(l), !(a || d()) && (r !== null || h() ? g("pointer") : c = setTimeout(() => g("pointer"), 500))); }, S = (y) => { Dj(y) || (o = !1, clearTimeout(c), !i && (a = !1, r !== null && !s && m())); }, C = () => { - e.matches(":focus-visible") && (i = !0, !a && !f() && g("focus")); + e.matches(":focus-visible") && (i = !0, !a && !d() && g("focus")); }, k = () => { i = !1, !(o || s) && (a = !1, p()); }, N = () => { @@ -75485,14 +75533,14 @@ function P5e(e, t, n) { }; } const R5e = 6, T5e = '[inert], [aria-hidden="true"]', M5e = "bg-tooltip text-tooltip-fg m-0 max-w-64 overflow-visible rounded-sm border border-transparent px-2 py-1 text-start text-xs font-normal leading-4 tracking-normal normal-case whitespace-normal shadow-md transition-opacity duration-100 starting:opacity-0 motion-reduce:transition-none", jj = (e) => e.label !== "" && (!e.labelShown || !!e.shortcut || !!e.reason), B5e = (e) => e !== null && (e.scrollWidth > e.clientWidth || e.scrollHeight > e.clientHeight); -function sr(e, t = {}) { - const [n, r] = De(null), [o, s] = De(null), i = Re(null), a = DT(), c = xi(), l = t.clipped !== void 0 && e !== null && !jj(e), u = e !== null && (jj(e) || l && e.label !== ""), d = Re(t.clipped); - d.current = t.clipped, Ze(() => { +function ir(e, t = {}) { + const [n, r] = je(null), [o, s] = je(null), i = Re(null), a = DT(), c = xi(), l = t.clipped !== void 0 && e !== null && !jj(e), u = e !== null && (jj(e) || l && e.label !== ""), f = Re(t.clipped); + f.current = t.clipped, Ze(() => { if (!n || !u || n.closest(T5e)) return; const g = n.ownerDocument.defaultView ?? n.ownerDocument, p = P5e(n, { show: s, hide: () => s(null), - canShow: l ? () => B5e(d.current?.(n) ?? null) : void 0 + canShow: l ? () => B5e(f.current?.(n) ?? null) : void 0 }, g); return i.current = p, () => { i.current = null, p.detach(); @@ -75502,13 +75550,13 @@ function sr(e, t = {}) { u, l ]); - const f = u && e !== null && o !== null && n !== null, h = f && (e.labelShown === !0 || t.clipped !== void 0 || n.getAttribute("aria-label") === e.label); + const d = u && e !== null && o !== null && n !== null, h = d && (e.labelShown === !0 || t.clipped !== void 0 || n.getAttribute("aria-label") === e.label); return { trigger: { ref: r, - "aria-describedby": f && (!h || e.shortcut || e.reason) ? c : void 0 + "aria-describedby": d && (!h || e.shortcut || e.reason) ? c : void 0 }, - element: f ? /* @__PURE__ */ P(_5e, { + element: d ? /* @__PURE__ */ P(_5e, { id: c, button: n, content: e, @@ -75520,11 +75568,11 @@ function sr(e, t = {}) { }; } function sE({ content: e, options: t, children: n }) { - const r = sr(e, t); + const r = ir(e, t); return /* @__PURE__ */ P(nt, { children: [n(r.trigger), r.element] }); } function HG({ label: e, reason: t, inMenu: n, ...r }) { - const o = sr({ + const o = ir({ label: e, reason: t }, { inMenu: n }); @@ -75543,11 +75591,11 @@ function _5e({ id: e, button: t, content: n, named: r, interactive: o, placement typeof l.showPopover == "function" && l.showPopover(); const u = () => KG(l, Cx(t), c.current(), R5e); u(); - const d = new ResizeObserver(u); - d.observe(l), d.observe(t); - const f = Qx(u); + const f = new ResizeObserver(u); + f.observe(l), f.observe(t); + const d = Qx(u); return () => { - f(), d.disconnect(), typeof l.hidePopover == "function" && l.matches(":popover-open") && l.hidePopover(); + d(), f.disconnect(), typeof l.hidePopover == "function" && l.matches(":popover-open") && l.hidePopover(); }; }, [t]), /* @__PURE__ */ P("div", { ref: a, @@ -75617,10 +75665,10 @@ function j5e(e) { for (let r = 0; r < t.length; r++) n[r] = t.charCodeAt(r); return n; } -const Og = "embedpdf-standard", F5e = "standard"; +const Pg = "embedpdf-standard", F5e = "standard"; function V5e(e) { const t = `${F5e}:`; - return e.startsWith(t) ? `${Og}:${e.slice(t.length)}` : e; + return e.startsWith(t) ? `${Pg}:${e.slice(t.length)}` : e; } function $5e(e) { return Uv(L5e, [e, ...typeof navigator < "u" ? navigator.languages ?? [] : []]) ?? "en"; @@ -75633,8 +75681,8 @@ function K5e(e, t, n) { const i = (async () => { await o?.promise.catch(() => { }); - const a = e.getLibrary(Og); - a?.locale !== t && (o && !a || (a && await e.deleteLibrary(Og), await e.importLibrary(await U5e(t, r), { id: Og }))); + const a = e.getLibrary(Pg); + a?.locale !== t && (o && !a || (a && await e.deleteLibrary(Pg), await e.importLibrary(await U5e(t, r), { id: Pg }))); })(); return Vj.set(e, { locale: t, @@ -75668,7 +75716,7 @@ function z5e() { const e = E5(), { libraries: t } = IG(); return Ke(() => { WG(e).then(() => H5e(e, t ?? [])).catch((r) => console.error("[embedpdf] stamp libraries failed:", r)); - const n = [Og, ...(t ?? []).map((r) => r.id)]; + const n = [Pg, ...(t ?? []).map((r) => r.id)]; return Ix ? d1e(e, Ix, { except: n }) : void 0; }, [e]), null; } @@ -75688,22 +75736,22 @@ function Kj(e) { const G5e = 'button, a[href], input, select, textarea, [role="tab"], [contenteditable]:not([contenteditable="false"])', FT = "bg-black/30 transition-opacity duration-200 starting:opacity-0", qG = () => { }, GG = Fn(qG), JG = GG.Provider; function J5e() { - return Et(GG); + return Ct(GG); } const Y5e = (e, t) => e.composedPath().some((n) => n instanceof Element && n !== t && n.matches('[aria-modal="true"]')), Q5e = (e) => Object.fromEntries(Object.entries(e ?? {}).map(([t, n]) => [`data-${t}`, n])), X5e = 8; function YG({ label: e, onClose: t, size: n = "content", list: r = !1, trapFocus: o = !0, header: s, width: i, part: a, data: c, children: l }) { - const u = Re(null), d = Re(null), f = Re(null), h = Re(t); + const u = Re(null), f = Re(null), d = Re(null), h = Re(t); h.current = t; - const g = Re(0), p = Re(null), m = () => n === "panel" ? Kj(u.current?.offsetHeight ?? 0) : [f.current?.offsetHeight ?? 0], v = (N, w) => { - const y = f.current; + const g = Re(0), p = Re(null), m = () => n === "panel" ? Kj(u.current?.offsetHeight ?? 0) : [d.current?.offsetHeight ?? 0], v = (N, w) => { + const y = d.current; if (!y || w.length === 0) return; const x = w[0], A = w[w.length - 1]; n === "panel" && (y.style.height = `${Math.min(A, Math.max(x, N))}px`); const b = Math.max(0, x - N); - y.style.translate = b > 0 ? `0 ${b}px` : "", d.current && (d.current.style.opacity = b > 0 ? `${Math.max(0, 1 - b / x)}` : ""); + y.style.translate = b > 0 ? `0 ${b}px` : "", f.current && (f.current.style.opacity = b > 0 ? `${Math.max(0, 1 - b / x)}` : ""); }; Ze(() => { - const N = u.current, w = f.current; + const N = u.current, w = d.current; if (!N || !w) return; const y = DG(N, (b) => { const E = BG(b, [ @@ -75724,7 +75772,7 @@ function YG({ label: e, onClose: t, size: n = "content", list: r = !1, trapFocus }, []); const S = (N) => { if (N.pointerType === "mouse" && N.button !== 0 || N.target.closest(G5e)) return; - const w = f.current; + const w = d.current; if (!w) return; N.currentTarget.setPointerCapture(N.pointerId); const y = w.offsetHeight; @@ -75770,12 +75818,12 @@ function YG({ label: e, onClose: t, size: n = "content", list: r = !1, trapFocus maxHeight: "none" }, children: [/* @__PURE__ */ P("div", { - ref: d, + ref: f, "aria-hidden": "true", className: `absolute inset-0 ${FT} in-data-dragging:transition-none`, onClick: () => h.current() }), /* @__PURE__ */ P("div", { - ref: f, + ref: d, role: o ? "dialog" : void 0, "aria-modal": o ? !0 : void 0, "aria-label": o ? e : void 0, @@ -75807,7 +75855,7 @@ function YG({ label: e, onClose: t, size: n = "content", list: r = !1, trapFocus } const Z5e = (e, t) => b6e(e, t, Zq), eTe = []; function VT(e) { - const t = bt(rE), n = ar(), r = ft(() => e ? eE(e) : null, [e]), o = en( + const t = bt(rE), n = cr(), r = ft(() => e ? eE(e) : null, [e]), o = nn( () => r ? y6e(r, (s) => t.resolveCommand(s, n ?? void 0)) : eTe, Z5e ); @@ -75876,7 +75924,7 @@ const nTe = (e) => ({ flexDirection: e === "vertical" ? "column" : "row", alignItems: "center", flex: "1 0 auto" -}), QG = yv("toolbar-surface"), Nm = yv("toolbar-border"), $T = yv("toolbar-active"), sTe = (e, t, n) => /* @__PURE__ */ P( +}), QG = yv("toolbar-surface"), Om = yv("toolbar-border"), $T = yv("toolbar-active"), sTe = (e, t, n) => /* @__PURE__ */ P( "button", { type: "button", @@ -75895,7 +75943,7 @@ const nTe = (e) => ({ color: "inherit", font: "inherit", background: e.active ? $T : "transparent", - border: `1px solid ${Nm}`, + border: `1px solid ${Om}`, borderRadius: 4, cursor: e.enabled ? "pointer" : "default", opacity: e.enabled ? 1 : 0.4 @@ -75925,7 +75973,7 @@ const XG = (e, t) => /* @__PURE__ */ P( padding: "4px 8px", color: "inherit", font: "inherit", - border: `1px solid ${Nm}`, + border: `1px solid ${Om}`, borderRadius: 4, background: e ? $T : "transparent", cursor: "pointer" @@ -75957,12 +76005,12 @@ function UT({ minWidth: 200, padding: 4, background: QG, - border: `1px solid ${Nm}`, + border: `1px solid ${Om}`, borderRadius: 6, boxShadow: "0 4px 16px rgba(0,0,0,0.15)" }, children: e.sections.map((o, s) => /* @__PURE__ */ P(nt, { children: [ - s > 0 && /* @__PURE__ */ P("div", { style: { height: 1, background: Nm, margin: "4px 0" } }), + s > 0 && /* @__PURE__ */ P("div", { style: { height: 1, background: Om, margin: "4px 0" } }), o.rows.map((i) => { const a = e.resolve(i.command); if (!a) return null; @@ -76023,7 +76071,7 @@ function cTe({ padding: "4px 6px", font: "inherit", borderRadius: 4, - border: `1px solid ${Nm}`, + border: `1px solid ${Om}`, background: QG }, children: e.commands.map((r) => /* @__PURE__ */ P("option", { value: r.id, disabled: !r.enabled, children: r.label }, r.id)) @@ -76036,7 +76084,7 @@ function lTe({ view: e, orientation: t }) { - const [n, r] = De(!1); + const [n, r] = je(!1); return /* @__PURE__ */ P("span", { style: { position: "relative", display: "inline-flex" }, children: [ XG(n, () => r((o) => !o)), /* @__PURE__ */ P( @@ -76052,7 +76100,7 @@ function uTe({ view: e, orientation: t }) { - const [n, r] = De(!1), o = e.commands.some((s) => s.active); + const [n, r] = je(!1), o = e.commands.some((s) => s.active); return /* @__PURE__ */ P("span", { style: { position: "relative", display: "inline-flex" }, children: [ /* @__PURE__ */ P( "button", @@ -76068,7 +76116,7 @@ function uTe({ padding: "4px 6px", color: "inherit", font: "inherit", - border: `1px solid ${Nm}`, + border: `1px solid ${Om}`, borderRadius: 4, // A hint that the active item is in here. background: n || o ? $T : "transparent", @@ -76098,81 +76146,81 @@ function dTe({ renderCustom: c, renderCollapsed: l, renderGroupTrigger: u, - renderSeparator: d, - renderOverflowTrigger: f = XG, + renderSeparator: f, + renderOverflowTrigger: d = XG, renderOverflowMenu: h }) { - const g = Qa(), p = bt(rE), m = ar(), v = t === "vertical", [, S] = Wl((_) => _ + 1, 0); + const g = Qa(), p = bt(rE), m = cr(), v = t === "vertical", [, S] = ql((B) => B + 1, 0); Ke(() => g.subscribe(S), [g]); - const C = Re(null), [k, N] = De(0); + const C = Re(null), [k, N] = je(0); Ze( () => C.current ? kae(C.current, t, N) : void 0, [t] ); - const [w] = De(yae), [, y] = Wl((_) => _ + 1, 0), x = ft( - () => (_, L) => { - w.report(t, _, L) && y(); + const [w] = je(yae), [, y] = ql((B) => B + 1, 0), x = ft( + () => (B, L) => { + w.report(t, B, L) && y(); }, [w, t] ), A = Re(null); Ze(() => { - const _ = C.current; - if (!_) return; - const L = xae(_, t); + const B = C.current; + if (!B) return; + const L = xae(B, t); return A.current = L, () => { L.detach(), A.current = null; }; }, [t]), Ze(() => A.current?.refresh()); - const b = (_) => p.resolveCommand(_, m ?? void 0), E = (_) => void p.execute(_, { documentId: m ?? void 0 }), I = ft(() => eE(e), [e]), O = h6e({ + const b = (B) => p.resolveCommand(B, m ?? void 0), E = (B) => void p.execute(B, { documentId: m ?? void 0 }), I = ft(() => eE(e), [e]), O = h6e({ bar: I, resolve: b, unregistered: eG, execute: E, - menuTarget: (_) => p.getMenuTarget(_), + menuTarget: (B) => p.getMenuTarget(B), metrics: w.metrics(t, n, r), - measureKey: ng, + measureKey: rg, containerLength: k, orientation: t - }), [T, R] = De(!1); + }), [T, R] = je(!1); Ke(() => { O.hasOverflow || R(!1); }, [O.hasOverflow]); - const M = (_) => _.kind === "custom" && !c?.[_.name], F = (_, L) => { - switch (_.kind) { + const M = (B) => B.kind === "custom" && !c?.[B.name], F = (B, L) => { + switch (B.kind) { case "command": - return a(_.command, _.variant, _.run); + return a(B.command, B.variant, B.run); case "custom": { - const j = () => _.terminal ? a(_.terminal, "icon", _.runTerminal) : null, H = c?.[_.name]; + const j = () => B.terminal ? a(B.terminal, "icon", B.runTerminal) : null, H = c?.[B.name]; if (H) { - const Y = H(_.variant, { + const Y = H(B.variant, { layer: L, - measure: (ue) => x(_.measureKey, ue) + measure: (le) => x(B.measureKey, le) }); return Y === void 0 ? j() : Y; } return L === "measure" ? null : /* @__PURE__ */ P( tTe, { - name: _.name, - k: _.measureKey, + name: B.name, + k: B.measureKey, orientation: t, - grow: _.grow, + grow: B.grow, onLength: x, children: j() } ); } case "collapsed": { - const j = l?.(_.view); - return j === void 0 ? /* @__PURE__ */ P(cTe, { view: _.view, orientation: t }) : j; + const j = l?.(B.view); + return j === void 0 ? /* @__PURE__ */ P(cTe, { view: B.view, orientation: t }) : j; } case "disclosure": { - const j = u?.(_.view); - return j === void 0 ? /* @__PURE__ */ P(uTe, { view: _.view, orientation: t }) : j; + const j = u?.(B.view); + return j === void 0 ? /* @__PURE__ */ P(uTe, { view: B.view, orientation: t }) : j; } } - }, B = (_) => _.groups.map((L, j) => /* @__PURE__ */ P(nt, { children: [ - j > 0 && (d ? d() : /* @__PURE__ */ P(iTe, { orientation: t })), + }, _ = (B) => B.groups.map((L, j) => /* @__PURE__ */ P(nt, { children: [ + j > 0 && (f ? f() : /* @__PURE__ */ P(iTe, { orientation: t })), L.parts.map((H) => /* @__PURE__ */ P( "span", { @@ -76182,13 +76230,13 @@ function dTe({ }, H.key )) - ] }, L.id)), $ = (_) => ({ + ] }, L.id)), $ = (B) => ({ display: "flex", flexDirection: v ? "column" : "row", alignItems: "center", gap: n, - flex: _.grows ? "1 0 auto" : "0 0 auto", - ..._.spacing === "balance" ? v ? { marginTop: "auto", marginBottom: "auto" } : { marginLeft: "auto", marginRight: "auto" } : _.spacing === "gap" ? v ? { marginTop: n } : { marginInlineStart: n } : null + flex: B.grows ? "1 0 auto" : "0 0 auto", + ...B.spacing === "balance" ? v ? { marginTop: "auto", marginBottom: "auto" } : { marginLeft: "auto", marginRight: "auto" } : B.spacing === "gap" ? v ? { marginTop: n } : { marginInlineStart: n } : null }), D = { sections: O.overflow, isOpen: T, @@ -76212,34 +76260,34 @@ function dTe({ ...i }, children: [ - O.sections.map((_) => /* @__PURE__ */ P("div", { style: $(_), children: [ - B(_), - _.name === "end" && O.hasOverflow && /* @__PURE__ */ P("span", { ...zj, style: { position: "relative", display: "inline-flex" }, children: [ - f(T, () => R((L) => !L)), + O.sections.map((B) => /* @__PURE__ */ P("div", { style: $(B), children: [ + _(B), + B.name === "end" && O.hasOverflow && /* @__PURE__ */ P("span", { ...zj, style: { position: "relative", display: "inline-flex" }, children: [ + d(T, () => R((L) => !L)), h ? h(D) : /* @__PURE__ */ P(UT, { view: D, orientation: t }) ] }) - ] }, _.name)), + ] }, B.name)), /* @__PURE__ */ P("div", { "aria-hidden": !0, ...w5, style: nTe(t), children: [ - O.measured.filter((_) => !M(_)).map((_) => { - const L = F(_, "measure"); - return _.kind === "custom" && L === null ? null : /* @__PURE__ */ P( + O.measured.filter((B) => !M(B)).map((B) => { + const L = F(B, "measure"); + return B.kind === "custom" && L === null ? null : /* @__PURE__ */ P( Hj, { - k: _.measureKey, + k: B.measureKey, orientation: t, onLength: x, children: L }, - _.measureKey + B.measureKey ); }), /* @__PURE__ */ P( Hj, { - k: ng.overflowTrigger, + k: rg.overflowTrigger, orientation: t, onLength: x, - children: f(!1, () => { + children: d(!1, () => { }) } ) @@ -76367,28 +76415,28 @@ function nJ({ features: e, disable: t, readOnly: n }, r) { const o = tJ(r), s = /* @__PURE__ */ new Map(), i = (l) => { let u = s.get(l); if (!u) { - const d = o.get(l) ?? []; + const f = o.get(l) ?? []; u = { on: !0, - parts: new Map(d.map((f) => [f, !0])) + parts: new Map(f.map((d) => [d, !0])) }, s.set(l, u); } return u; }, a = (l) => { - const u = [...l].sort(([d], [f]) => Number(d.includes(".")) - Number(f.includes("."))); - for (const [d, f] of u) { - const [h, g] = KT(d), p = i(h); + const u = [...l].sort(([f], [d]) => Number(f.includes(".")) - Number(d.includes("."))); + for (const [f, d] of u) { + const [h, g] = KT(f), p = i(h); if (g !== void 0) { - p.parts.set(g, f); + p.parts.set(g, d); continue; } - p.on = f; - for (const m of p.parts.keys()) p.parts.set(m, f); + p.on = d; + for (const m of p.parts.keys()) p.parts.set(m, d); } }, c = (l) => l.map((u) => [u, !1]); - return a(c(fTe)), a(c((t ?? []).filter((l) => !l.includes(":")))), a(Object.entries(e ?? {}).filter((l) => typeof l[1] == "boolean")), a(c(yTe(n))), [...o.keys(), ...s.keys()].filter((l, u, d) => d.indexOf(l) === u && s.has(l)).flatMap((l) => { - const { on: u, parts: d } = s.get(l), f = [...d].filter(([, h]) => !h); - return !u && f.length === d.size ? [l] : f.map(([h]) => `${l}.${h}`); + return a(c(fTe)), a(c((t ?? []).filter((l) => !l.includes(":")))), a(Object.entries(e ?? {}).filter((l) => typeof l[1] == "boolean")), a(c(yTe(n))), [...o.keys(), ...s.keys()].filter((l, u, f) => f.indexOf(l) === u && s.has(l)).flatMap((l) => { + const { on: u, parts: f } = s.get(l), d = [...f].filter(([, h]) => !h); + return !u && d.length === f.size ? [l] : d.map(([h]) => `${l}.${h}`); }); } function bTe(e, t) { @@ -76417,17 +76465,17 @@ function qj(e, t) { } const Gj = (e, t) => typeof e == "boolean" || typeof t == "boolean" ? e === t : e.length === t.length && e.every((n, r) => n === t[r]); function kTe() { - const e = Tt(), t = U1e(wt(Zt, (o) => o.getCurrentPage())), n = Pi("measurement"), r = sr({ label: e("measurement.title") }); + const e = _t(), t = U1e(wt(tn, (o) => o.getCurrentPage())), n = Pi("measurement"), r = ir({ label: e("measurement.title") }); return /* @__PURE__ */ P(nt, { children: [/* @__PURE__ */ P("button", { ...r.trigger, type: "button", - part: Jr(n.isOpen), - className: Ho(n.isOpen), + part: Yr(n.isOpen), + className: zo(n.isOpen), "aria-pressed": n.isOpen, onClick: () => n.toggle(), children: /* @__PURE__ */ P("span", { className: "flex items-center whitespace-nowrap text-sm", - children: [/* @__PURE__ */ P(Nt, { + children: [/* @__PURE__ */ P(Rt, { name: "updateScale", size: 20, className: "me-1.5 shrink-0" @@ -76441,7 +76489,7 @@ function kTe() { }), r.element] }); } function ATe() { - const e = Tt(), { files: t } = H9(); + const e = _t(), { files: t } = H9(); return /* @__PURE__ */ P("span", { className: "text-fg-muted whitespace-nowrap text-xs", children: e("attachments.count", { params: { count: t.length } }) @@ -76449,7 +76497,7 @@ function ATe() { } const HT = Fn(null); function STe({ children: e }) { - const t = ar() ?? "", [n, r] = De(() => /* @__PURE__ */ new Map()), o = fi((a) => r((c) => new Map(c).set(t, a)), [t]), s = n.get(t) ?? "", i = ft(() => [s, o], [s, o]); + const t = cr() ?? "", [n, r] = je(() => /* @__PURE__ */ new Map()), o = fi((a) => r((c) => new Map(c).set(t, a)), [t]), s = n.get(t) ?? "", i = ft(() => [s, o], [s, o]); return /* @__PURE__ */ P(HT.Provider, { value: i, children: e @@ -76458,17 +76506,17 @@ function STe({ children: e }) { const xTe = ["", () => { }]; function a8e() { - return Et(HT) ?? xTe; + return Ct(HT) ?? xTe; } function ETe({ variant: e }) { - const t = Tt(), n = Et(HT); + const t = _t(), n = Ct(HT); if (!n) return null; const [r, o] = n; return /* @__PURE__ */ P("div", { className: `relative ${e === "narrow" ? "w-24" : "w-36"}`, children: [/* @__PURE__ */ P("div", { className: "text-fg-muted pointer-events-none absolute inset-y-0 start-0 flex items-center ps-2", - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "search", size: 14 }) @@ -76491,14 +76539,14 @@ function CTe(e) { } const ITe = (e, t) => e?.first === t?.first && e?.last === t?.last; function NTe() { - const e = Tt(), t = Rt(Zt), n = um((k) => k.currentPageIndex + 1), r = um((k) => k.pageCount), o = zt(Zt, CTe, null, ITe), s = o !== null && o.last > o.first, i = s ? o.first : n, [a, c] = De(null), l = Re(null), u = Re(null), d = Re(!1), f = a !== null, h = sr({ label: e("pageNumber.goToPage") }), g = h.trigger.ref, p = fi((k) => { + const e = _t(), t = Bt(tn), n = dm((k) => k.currentPageIndex + 1), r = dm((k) => k.pageCount), o = Gt(tn, CTe, null, ITe), s = o !== null && o.last > o.first, i = s ? o.first : n, [a, c] = je(null), l = Re(null), u = Re(null), f = Re(!1), d = a !== null, h = ir({ label: e("pageNumber.goToPage") }), g = h.trigger.ref, p = fi((k) => { u.current = k, g(k); }, [g]); if (Ze(() => { - f ? (l.current?.focus(), l.current?.select()) : d.current && (d.current = !1, u.current?.focus()); - }, [f]), r <= 1) return null; + d ? (l.current?.focus(), l.current?.select()) : f.current && (f.current = !1, u.current?.focus()); + }, [d]), r <= 1) return null; const m = () => { - d.current = !0, c(null); + f.current = !0, c(null); }, v = () => { const k = Number.parseInt(a ?? "", 10); Number.isFinite(k) && t?.goToPage(Math.min(Math.max(k, 1), r) - 1), m(); @@ -76512,7 +76560,7 @@ function NTe() { } })).split(""); return /* @__PURE__ */ P("span", { className: "text-fg-secondary flex whitespace-nowrap text-sm", - children: f ? /* @__PURE__ */ P("span", { + children: d ? /* @__PURE__ */ P("span", { className: "block h-8 px-2 leading-8", children: [ S, @@ -76547,28 +76595,28 @@ function NTe() { }); } function OTe() { - const e = Tt(), t = E5(), { standard: n, quick: r } = IG(), { locale: o } = kx(), s = Fz(), i = ar(), a = zt(yr, (f) => f.getActiveToolId(), null), c = f1e((f) => f.armedAsset?.id ?? null), l = (r ?? []).map(V5e), u = l.some((f) => f.startsWith(`${Og}:`)); + const e = _t(), t = E5(), { standard: n, quick: r } = IG(), { locale: o } = kx(), s = Fz(), i = cr(), a = Gt(yr, (d) => d.getActiveToolId(), null), c = f1e((d) => d.armedAsset?.id ?? null), l = (r ?? []).map(V5e), u = l.some((d) => d.startsWith(`${Pg}:`)); Ke(() => { - u && WG(t).then(() => K5e(t, $5e(o), n)).catch((f) => console.error("[embedpdf] quick stamps failed:", f)); + u && WG(t).then(() => K5e(t, $5e(o), n)).catch((d) => console.error("[embedpdf] quick stamps failed:", d)); }, [ t, o, u ]); - const d = l.map((f) => s.find((h) => h.id === f)).filter((f) => !!f); - return d.length === 0 || !i ? null : /* @__PURE__ */ P("div", { + const f = l.map((d) => s.find((h) => h.id === d)).filter((d) => !!d); + return f.length === 0 || !i ? null : /* @__PURE__ */ P("div", { className: "flex items-center gap-1", role: "group", "aria-label": e("demo.quickStampsLabel"), - children: d.map((f) => /* @__PURE__ */ P(PTe, { - asset: f, - active: a === "stamp" && c === f.id, - onArm: () => void t.armAsset(f.id).catch((h) => console.error("[embedpdf] arm failed", h)) - }, f.id)) + children: f.map((d) => /* @__PURE__ */ P(PTe, { + asset: d, + active: a === "stamp" && c === d.id, + onArm: () => void t.armAsset(d.id).catch((h) => console.error("[embedpdf] arm failed", h)) + }, d.id)) }); } function PTe({ asset: e, active: t, onArm: n }) { - const r = p1e(e.id), o = sr({ + const r = p1e(e.id), o = ir({ label: e.label, labelShown: !r }); @@ -76578,8 +76626,8 @@ function PTe({ asset: e, active: t, onArm: n }) { onClick: n, "aria-label": e.label, "aria-pressed": t, - part: Jr(t), - className: Ho(t, !0), + part: Yr(t), + className: zo(t, !0), children: r ? /* @__PURE__ */ P("img", { src: r, alt: "", @@ -76598,11 +76646,11 @@ function TTe(e, t) { return e.canDesign() ? !0 : e.list().some((n) => n.kind === "signature" ? t?.canSign(n.ref) ?? !1 : e.canFill(n.ref)); } function MTe() { - const e = Rt(vt) !== null, t = Rt(vs), n = zt(vt, RTe, !1), r = zt(Ss, (i) => TTe(i, t), !1), o = zt(Fm, (i) => i.canEdit(), !1), s = zt(oa, (i) => i.canApply(), !1); + const e = Bt(vt) !== null, t = Bt(vs), n = Gt(vt, RTe, !1), r = Gt(Ss, (i) => TTe(i, t), !1), o = Gt(Vm, (i) => i.canEdit(), !1), s = Gt(oa, (i) => i.canApply(), !1); return e && !n && !r && !o && !s; } function BTe({ compact: e = !1 }) { - const t = Tt(), n = jr(); + const t = _t(), n = jr(); F6e((s) => s.disabledCategories); const r = hTe((s) => n.isCategoryDisabled(s)), o = MTe(); return !r && !o ? null : /* @__PURE__ */ P(sE, { @@ -76610,7 +76658,7 @@ function BTe({ compact: e = !1 }) { children: (s) => /* @__PURE__ */ P("span", { ...s, className: "bg-hover text-fg-secondary flex h-7 shrink-0 select-none items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 text-xs font-medium", - children: [/* @__PURE__ */ P(Nt, { + children: [/* @__PURE__ */ P(Rt, { name: "eye", size: 16, className: "shrink-0" @@ -76661,7 +76709,7 @@ function rJ() { } const oJ = Fn(rJ()), FTe = oJ.Provider; function sJ() { - return Et(oJ); + return Ct(oJ); } const iJ = { display: "inline-flex", @@ -76674,22 +76722,22 @@ const iJ = { function $Te({ id: e, variant: t, orientation: n, grow: r = !1, measure: o, children: s }) { const i = Re(null), a = DT(), { size: c } = oc(), l = sJ(), u = Re(o); u.current = o; - const d = Re(null), f = t !== null; + const f = Re(null), d = t !== null; return Ze(() => { const h = i.current; if (!h) return; const g = n === "vertical" ? "height" : "width", p = () => u.current(r ? YU(h, n) : h.getBoundingClientRect()[g]); - f || p(); + d || p(); const m = new ResizeObserver(p); - return m.observe(h), d.current = m, () => { - m.disconnect(), d.current = null; + return m.observe(h), f.current = m, () => { + m.disconnect(), f.current = null; }; }, [ n, - f, + d, r ]), Ze(() => { - const h = i.current, g = d.current; + const h = i.current, g = f.current; !h || !g || (g.unobserve(h), g.observe(h)); }, [t]), Ze(() => { const h = i.current; @@ -76738,7 +76786,7 @@ function WTe(e, t, n) { l(); const u = new ResizeObserver(l); u.observe(e), u.observe(t); - const d = Qx(l), f = X6(e, (m) => { + const f = Qx(l), d = X6(e, (m) => { (!s || !m.composedPath().includes(s)) && o(); }), h = cR(e, { trigger: s, @@ -76756,11 +76804,11 @@ function WTe(e, t, n) { r && m.key !== "Tab" && m.stopPropagation(); }; return e.addEventListener("keydown", p), () => { - e.removeEventListener("keydown", p), h(), f(), d(), u.disconnect(), typeof e.hidePopover == "function" && e.matches(":popover-open") && e.hidePopover(); + e.removeEventListener("keydown", p), h(), d(), f(), u.disconnect(), typeof e.hidePopover == "function" && e.matches(":popover-open") && e.hidePopover(); }; } function qv(e) { - const t = Re(null), [n, r] = De(!1), o = oc().size === "compact"; + const t = Re(null), [n, r] = je(!1), o = oc().size === "compact"; return Ze(() => { const s = t.current?.parentElement; s && !s.closest(cJ) && r(!0); @@ -76770,7 +76818,7 @@ function qv(e) { }); } function qTe({ children: e, onClose: t, align: n = "start" }) { - const r = Re(null), o = DT(), s = Et(AP), i = Re(t); + const r = Re(null), o = DT(), s = Ct(AP), i = Re(t); return i.current = t, Ze(() => { const a = r.current, c = a?.parentElement; if (!(!a || !c)) @@ -76803,7 +76851,7 @@ function GTe(e) { return t && n ? uJ(n, t) : null; } function JTe({ children: e, onClose: t }) { - const [n, r] = De([]), o = Re(n); + const [n, r] = je([]), o = Re(n); o.current = n; const s = Re(null), i = Re(t); i.current = t; @@ -76841,7 +76889,7 @@ function JTe({ children: e, onClose: t }) { }); } function Jj({ covered: e, close: t, opener: n, label: r, onBack: o, children: s }) { - const i = Tt(), a = Re(null), c = Re({ + const i = _t(), a = Re(null), c = Re({ close: t, onBack: o }); @@ -76851,16 +76899,16 @@ function Jj({ covered: e, close: t, opener: n, label: r, onBack: o, children: s }, Ze(() => { const l = a.current; if (!l) return; - const u = n ?? GTe(l), d = r ?? lJ(u); - d && l.setAttribute("aria-label", d); - const f = cR(l, { + const u = n ?? GTe(l), f = r ?? lJ(u); + f && l.setAttribute("aria-label", f); + const d = cR(l, { trigger: u, close: () => c.current.close(), items: () => g0(l), initialFocus: "none" }); queueMicrotask(() => { - l.isConnected && !l.inert && g0(l).find((p) => !fg(p))?.focus(); + l.isConnected && !l.inert && g0(l).find((p) => !hg(p))?.focus(); }); const h = $G(r2(l)), g = (p) => { if (p.defaultPrevented) return; @@ -76868,7 +76916,7 @@ function Jj({ covered: e, close: t, opener: n, label: r, onBack: o, children: s p.key === h.open && m.getAttribute("aria-haspopup") === "menu" ? (p.preventDefault(), m.click()) : p.key === h.close && c.current.onBack && (p.preventDefault(), c.current.onBack()); }; return l.addEventListener("keydown", g), () => { - l.removeEventListener("keydown", g), f(); + l.removeEventListener("keydown", g), d(); }; }, []), Ze(() => { a.current && (a.current.inert = e); @@ -76887,7 +76935,7 @@ function Jj({ covered: e, close: t, opener: n, label: r, onBack: o, children: s "data-epdf-menu-back": "", onClick: o, className: zT, - children: [/* @__PURE__ */ P(Nt, { + children: [/* @__PURE__ */ P(Rt, { name: "chevronLeft", size: 16, className: "text-fg-muted rtl:-scale-x-100" @@ -76911,22 +76959,22 @@ function DI(e) { return t || (t = /* @__PURE__ */ new Map(), Yj.set(e, t)), t; } function iE({ menuId: e, className: t = "relative inline-flex", children: n }) { - const r = Rt(dt), o = dRe((l) => l.openMenus.includes(e)), s = Re(null), [, i] = Wl((l) => l + 1, 0), a = r ? DI(r).get(e) : void 0, c = o && a !== void 0 && a === s.current; + const r = Bt(dt), o = dRe((l) => l.openMenus.includes(e)), s = Re(null), [, i] = ql((l) => l + 1, 0), a = r ? DI(r).get(e) : void 0, c = o && a !== void 0 && a === s.current; return Ze(() => { const l = s.current; if (!r || !l) return; - const u = DI(r), d = u.get(e); + const u = DI(r), f = u.get(e); if (!o) { - d === l && u.delete(e); + f === l && u.delete(e); return; } - !d?.isConnected && !l.closest(cJ) && (u.set(e, l), i()); + !f?.isConnected && !l.closest(cJ) && (u.set(e, l), i()); }), /* @__PURE__ */ P("span", { ref: s, className: t, onClickCapture: (l) => { - const u = l.target, d = u.closest("[aria-haspopup]") && !u.closest('[role="menu"]'); - r && s.current && d && DI(r).set(e, s.current); + const u = l.target, f = u.closest("[aria-haspopup]") && !u.closest('[role="menu"]'); + r && s.current && f && DI(r).set(e, s.current); }, children: [n(c), c && /* @__PURE__ */ P(qv, { onClose: () => r?.closeMenu(e), @@ -76944,7 +76992,7 @@ const fJ = (e) => { none: "menuitem", radio: "menuitemradio", checkbox: "menuitemcheckbox" -}, hJ = "flex w-full items-center gap-3 rounded-md px-2.5 py-1.5 text-start text-sm outline-none transition-colors aria-disabled:cursor-not-allowed aria-disabled:opacity-40", zT = `${hJ} text-fg-secondary hover:bg-hover focus-visible:bg-hover aria-disabled:hover:bg-transparent`, QTe = `${hJ} bg-selected text-accent focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-accent forced-colors:outline-2 forced-colors:outline-solid forced-colors:-outline-offset-2`, pJ = (e) => sr(e.enabled ? null : { +}, hJ = "flex w-full items-center gap-3 rounded-md px-2.5 py-1.5 text-start text-sm outline-none transition-colors aria-disabled:cursor-not-allowed aria-disabled:opacity-40", zT = `${hJ} text-fg-secondary hover:bg-hover focus-visible:bg-hover aria-disabled:hover:bg-transparent`, QTe = `${hJ} bg-selected text-accent focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-accent forced-colors:outline-2 forced-colors:outline-solid forced-colors:-outline-offset-2`, pJ = (e) => ir(e.enabled ? null : { label: e.label, reason: e.disabledReason, labelShown: !0 @@ -76964,11 +77012,11 @@ function Gv({ command: e, choice: t, onSelect: n }) { }, className: r ? QTe : zT, children: [ - e.icon && /* @__PURE__ */ P(Nt, { + e.icon && /* @__PURE__ */ P(Rt, { name: e.icon, size: 16, accent: e.iconAccent, - className: `${r ? "text-accent" : "text-fg-muted"} ${Im(e.icon)}` + className: `${r ? "text-accent" : "text-fg-muted"} ${Nm(e.icon)}` }), /* @__PURE__ */ P("span", { className: "flex-1 truncate", @@ -76982,7 +77030,7 @@ function Gv({ command: e, choice: t, onSelect: n }) { }), s.element] }); } function gJ({ command: e, menuId: t, onRun: n }) { - const [r, o] = De(!1), s = Et(dJ), i = pJ(e); + const [r, o] = je(!1), s = Ct(dJ), i = pJ(e); return /* @__PURE__ */ P("div", { role: "none", className: "relative", @@ -77006,17 +77054,17 @@ function gJ({ command: e, menuId: t, onRun: n }) { }, className: `${zT} ${r ? "bg-hover" : ""}`, children: [ - e.icon && /* @__PURE__ */ P(Nt, { + e.icon && /* @__PURE__ */ P(Rt, { name: e.icon, size: 16, accent: e.iconAccent, - className: `text-fg-muted ${Im(e.icon)}` + className: `text-fg-muted ${Nm(e.icon)}` }), /* @__PURE__ */ P("span", { className: "flex-1 truncate", children: e.label }), - /* @__PURE__ */ P(Nt, { + /* @__PURE__ */ P(Rt, { name: "chevronRight", size: 16, className: "text-fg-muted rtl:-scale-x-100" @@ -77035,7 +77083,7 @@ function gJ({ command: e, menuId: t, onRun: n }) { }); } function XTe({ commandId: e, choice: t, onRun: n }) { - const r = go(e); + const r = mo(e); return r.visible ? r.menu ? /* @__PURE__ */ P(gJ, { command: r, menuId: r.menu, @@ -77065,7 +77113,7 @@ function mJ({ title: e, first: t, children: n }) { } const ZTe = (e, t) => e.length === t.length && e.every((n, r) => n === t[r]); function WT({ menuId: e, onRun: t }) { - const n = Tt(), r = i5e(e), o = jr(), s = ar() ?? void 0, i = en(() => (r ?? []).map((c) => { + const n = _t(), r = i5e(e), o = jr(), s = cr() ?? void 0, i = nn(() => (r ?? []).map((c) => { const l = c.items.map((u) => o.resolveCommand(u, s)).filter((u) => u?.visible === !0); return l.length === 0 ? null : fJ(l); }), ZTe); @@ -77082,16 +77130,16 @@ function WT({ menuId: e, onRun: t }) { children: a.map(({ section: c, choice: l }, u) => /* @__PURE__ */ P(mJ, { first: u === 0, title: c.title ?? (c.titleKey ? n(c.titleKey) : void 0), - children: c.items.map((d) => /* @__PURE__ */ P(XTe, { - commandId: d, + children: c.items.map((f) => /* @__PURE__ */ P(XTe, { + commandId: f, choice: l, onRun: t - }, d)) + }, f)) }, u)) }); } function aE({ view: e, align: t }) { - const n = Tt(); + const n = _t(); if (!e.isOpen) return null; const r = e.sections.map((o) => { const s = o.rows.flatMap((i) => { @@ -77131,15 +77179,15 @@ function aE({ view: e, align: t }) { }); } const Qj = "flex h-8 w-auto min-w-8 cursor-pointer items-center justify-center rounded-md p-[5px] transition-colors", e3e = "hover:bg-hover hover:ring hover:ring-accent", t3e = "border-none bg-selected text-accent shadow ring ring-accent", n3e = "cursor-not-allowed opacity-50 hover:bg-transparent hover:ring-0", r3e = "bg-accent text-on-accent hover:bg-accent-hover", o3e = "border-none bg-accent-active text-on-accent shadow", s3e = "cursor-not-allowed opacity-50 hover:bg-accent"; -function Ho(e, t = !0, n) { +function zo(e, t = !0, n) { return n === "primary" ? `${Qj} ${e ? o3e : r3e} ${t ? "" : s3e}` : `${Qj} ${e ? t3e : e3e} ${t ? "" : n3e}`; } -const Jr = (e, t) => [ +const Yr = (e, t) => [ "toolbar-button", t === "primary" ? "toolbar-button-primary" : null, e ? "toolbar-button-active" : null ].filter(Boolean).join(" "), cE = (e) => `toolbar toolbar-${e}`, yJ = (e) => e ? "mode-tab mode-tab-active" : "mode-tab", i3e = "flex h-8 w-auto min-w-8 cursor-pointer items-center justify-center rounded-none border-b-2 px-2 py-1 text-sm transition-colors hover:bg-transparent hover:border-b-fg-muted", a3e = "border-b-accent text-accent hover:border-b-accent", c3e = "border-b-transparent", bJ = (e, t = !0) => `${i3e} ${e ? a3e : c3e} ${t ? "" : "cursor-not-allowed opacity-50"}`; -function Pg(e, t = !1) { +function Rg(e, t = !1) { const [n] = e.shortcuts; return { label: e.label, @@ -77149,7 +77197,7 @@ function Pg(e, t = !1) { }; } function lE({ cmd: e, variant: t, run: n, emphasis: r }) { - const o = t === "label", s = sr(Pg(e, o || t === "icon+label" || !e.icon)), i = (a) => /* @__PURE__ */ P(nt, { children: [/* @__PURE__ */ P("button", { + const o = t === "label", s = ir(Rg(e, o || t === "icon+label" || !e.icon)), i = (a) => /* @__PURE__ */ P(nt, { children: [/* @__PURE__ */ P("button", { ...s.trigger, type: "button", onClick: n, @@ -77158,24 +77206,24 @@ function lE({ cmd: e, variant: t, run: n, emphasis: r }) { "aria-haspopup": e.menu ? "menu" : void 0, "aria-expanded": e.menu ? a : void 0, "aria-label": e.label, - part: o ? yJ(a) : Jr(a, r), - className: o ? bJ(a, e.enabled) : `${Ho(a, e.enabled, r)} ${r === "primary" && t === "icon+label" ? "px-2.5" : ""}`, + part: o ? yJ(a) : Yr(a, r), + className: o ? bJ(a, e.enabled) : `${zo(a, e.enabled, r)} ${r === "primary" && t === "icon+label" ? "px-2.5" : ""}`, children: o ? /* @__PURE__ */ P("span", { className: "whitespace-nowrap px-1", children: e.label }) : t === "icon+label" ? /* @__PURE__ */ P("span", { className: "flex items-center whitespace-nowrap text-sm", - children: [e.icon && /* @__PURE__ */ P(Nt, { + children: [e.icon && /* @__PURE__ */ P(Rt, { name: e.icon, size: 20, accent: e.iconAccent, - className: `me-1.5 shrink-0 ${Im(e.icon)}` + className: `me-1.5 shrink-0 ${Nm(e.icon)}` }), /* @__PURE__ */ P("span", { children: e.label })] - }) : e.icon ? /* @__PURE__ */ P(Nt, { + }) : e.icon ? /* @__PURE__ */ P(Rt, { name: e.icon, size: 20, accent: e.iconAccent, - className: Im(e.icon) + className: Nm(e.icon) }) : /* @__PURE__ */ P("span", { className: "text-sm", children: e.label @@ -77191,11 +77239,11 @@ const jI = { className: "contents" }; function l3e() { - const e = Tt(), t = jr(), n = go("zoom:in"), r = go("zoom:out"), o = go("menu:zoom"), s = sr(Pg(n)), i = sr(Pg(r)), a = sr(Pg(o)), c = Rt(dt), l = Rt(Zt), u = zt(Zt, (p) => p.getZoomLevel(), 1), d = Math.round((u ?? 1) * 100), [f, h] = De(String(d)); - Ke(() => h(String(d)), [d]); + const e = _t(), t = jr(), n = mo("zoom:in"), r = mo("zoom:out"), o = mo("menu:zoom"), s = ir(Rg(n)), i = ir(Rg(r)), a = ir(Rg(o)), c = Bt(dt), l = Bt(tn), u = Gt(tn, (p) => p.getZoomLevel(), 1), f = Math.round((u ?? 1) * 100), [d, h] = je(String(f)); + Ke(() => h(String(f)), [f]); const g = (p) => { p.preventDefault(); - const m = parseFloat(f); + const m = parseFloat(d); !isNaN(m) && m > 0 && l?.zoomTo({ level: m / 100 }); }; return /* @__PURE__ */ P(iE, { @@ -77214,10 +77262,10 @@ function l3e() { pattern: "\\d*", "aria-label": e("commands.zoom.level"), className: "h-6 w-8 min-w-0 shrink border-0 bg-transparent p-0 text-end text-sm outline-none focus:outline-none", - value: f, + value: d, onChange: (m) => h(m.target.value.replace(/[^0-9]/g, "")), onBlur: () => { - (!f || parseFloat(f) <= 0) && h(String(d)); + (!d || parseFloat(d) <= 0) && h(String(f)); } }), /* @__PURE__ */ P("span", { className: "shrink-0 text-sm", @@ -77232,10 +77280,10 @@ function l3e() { "aria-haspopup": "menu", "aria-expanded": p, "aria-label": o.label, - part: Jr(!1), - className: Ho(!1), + part: Yr(!1), + className: zo(!1), onClick: () => c?.toggleMenu("zoom"), - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "chevronDown", size: 20 }) @@ -77248,10 +77296,10 @@ function l3e() { type: "button", "aria-label": r.label, disabled: !r.enabled, - part: Jr(!1), - className: Ho(!1, r.enabled), + part: Yr(!1), + className: zo(!1, r.enabled), onClick: () => t.execute("zoom:out"), - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "zoomOut", size: 20 }) @@ -77264,10 +77312,10 @@ function l3e() { type: "button", "aria-label": n.label, disabled: !n.enabled, - part: Jr(!1), - className: Ho(!1, n.enabled), + part: Yr(!1), + className: zo(!1, n.enabled), onClick: () => t.execute("zoom:in"), - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "zoomIn", size: 20 }) @@ -77278,7 +77326,7 @@ function l3e() { }); } function u3e() { - const e = Rt(dt), t = go("menu:zoom"), n = sr(Pg(t)); + const e = Bt(dt), t = mo("menu:zoom"), n = ir(Rg(t)); return /* @__PURE__ */ P(iE, { menuId: "zoom", children: (r) => /* @__PURE__ */ P(nt, { children: [/* @__PURE__ */ P("button", { @@ -77287,10 +77335,10 @@ function u3e() { "aria-label": t.label, "aria-haspopup": "menu", "aria-expanded": r, - part: Jr(r), - className: Ho(r), + part: Yr(r), + className: zo(r), onClick: () => e?.toggleMenu("zoom"), - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "zoomIn", size: 20 }) @@ -77298,7 +77346,7 @@ function u3e() { }); } function d3e({ view: e }) { - const [t, n] = De(!1), r = e.commands.some((o) => o.active); + const [t, n] = je(!1), r = e.commands.some((o) => o.active); return /* @__PURE__ */ P("span", { className: "relative inline-flex", children: [/* @__PURE__ */ P("button", { @@ -77306,9 +77354,9 @@ function d3e({ view: e }) { onClick: () => n((o) => !o), "aria-haspopup": "menu", "aria-expanded": t, - part: e.id === "modes" ? yJ(r) : Jr(t), + part: e.id === "modes" ? yJ(r) : Yr(t), className: bJ(r), - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "chevronDown", size: 18 }) @@ -77316,7 +77364,7 @@ function d3e({ view: e }) { }); } function f3e({ view: e }) { - const [t, n] = De(!1), r = e.commands.find((s) => s.active) ?? e.commands[0], o = !!(r?.active && r.id !== tv); + const [t, n] = je(!1), r = e.commands.find((s) => s.active) ?? e.commands[0], o = !!(r?.active && r.id !== tv); return /* @__PURE__ */ P("div", { style: { width: 100 }, className: "relative", @@ -77325,12 +77373,12 @@ function f3e({ view: e }) { onClick: () => n((s) => !s), "aria-haspopup": "menu", "aria-expanded": t, - part: Jr(t), + part: Yr(t), className: "bg-surface hover:bg-hover flex w-full cursor-pointer appearance-none items-center rounded-md py-1.5 pe-2 ps-3 text-[13px] transition-colors", children: [/* @__PURE__ */ P("span", { className: `min-w-0 flex-1 truncate text-start ${o ? "text-accent" : "text-fg"}`, children: r?.label - }), /* @__PURE__ */ P(Nt, { + }), /* @__PURE__ */ P(Rt, { name: "chevronDown", size: 16, className: o ? "text-accent" : "text-fg-secondary" @@ -77339,7 +77387,7 @@ function f3e({ view: e }) { }); } function h3e({ view: e }) { - const t = Tt(), [n, r] = De(!1), o = e.commands.find((a) => a.active) ?? e.commands[0], s = e.labelKey ? t(e.labelKey) : o?.label, i = sr(s ? { + const t = _t(), [n, r] = je(!1), o = e.commands.find((a) => a.active) ?? e.commands[0], s = e.labelKey ? t(e.labelKey) : o?.label, i = ir(s ? { label: s, labelShown: !o?.icon } : null); @@ -77353,17 +77401,17 @@ function h3e({ view: e }) { "aria-haspopup": "menu", "aria-expanded": n, "aria-label": s, - part: Jr(n), - className: Ho(n), - children: [o?.icon ? /* @__PURE__ */ P(Nt, { + part: Yr(n), + className: zo(n), + children: [o?.icon ? /* @__PURE__ */ P(Rt, { name: o.icon, size: 20, accent: o.iconAccent, - className: Im(o.icon) + className: Nm(o.icon) }) : /* @__PURE__ */ P("span", { className: "whitespace-nowrap px-1 text-sm", children: s - }), /* @__PURE__ */ P(Nt, { + }), /* @__PURE__ */ P(Rt, { name: "chevronDown", size: 14, className: "text-fg-secondary" @@ -77381,7 +77429,7 @@ function p3e({ view: e }) { }); } function g3e({ isOpen: e, toggle: t }) { - const n = Tt()("demo.more"), r = sr({ label: n }); + const n = _t()("demo.more"), r = ir({ label: n }); return /* @__PURE__ */ P(nt, { children: [/* @__PURE__ */ P("button", { ...r.trigger, type: "button", @@ -77389,9 +77437,9 @@ function g3e({ isOpen: e, toggle: t }) { "aria-haspopup": "menu", "aria-expanded": e, "aria-label": n, - part: Jr(e), - className: Ho(e), - children: /* @__PURE__ */ P(Nt, { + part: Yr(e), + className: zo(e), + children: /* @__PURE__ */ P(Rt, { name: "dots", size: 20 }) @@ -77409,7 +77457,7 @@ function vJ(e) { return new Set(wJ(e).flatMap((t) => typeof t == "object" && "command" in t && t.emphasis === "primary" ? [t.command] : [])); } function y3e({ commandId: e }) { - const t = go(e); + const t = mo(e); return t.visible ? /* @__PURE__ */ P(lE, { cmd: t, variant: "icon", @@ -77492,7 +77540,7 @@ function k3e(e, t) { } const AJ = Fn(null), SJ = "(prefers-color-scheme: dark)", A3e = () => typeof window < "u" && window.matchMedia?.(SJ).matches ? "dark" : "light"; function S3e({ children: e, preference: t = "system", target: n }) { - const [r, o] = De(A3e); + const [r, o] = je(A3e); Ke(() => { if (t !== "system" || typeof window > "u" || !window.matchMedia) return; const a = window.matchMedia(SJ), c = () => o(a.matches ? "dark" : "light"); @@ -77509,7 +77557,7 @@ function S3e({ children: e, preference: t = "system", target: n }) { }); } function c8e() { - const e = Et(AJ); + const e = Ct(AJ); if (!e) throw new Error("useTheme must be used within "); return e; } @@ -77612,10 +77660,10 @@ function l8e(e) { } const T3e = (e, t) => t.type === "fonts.changed" ? os() : e, ZA = (e, t) => e.fonts.find((n) => n.name === t); function M3e(e, t) { - const n = Cf(t.family), r = t.weight ?? 400, o = t.italic ?? !1; + const n = Nf(t.family), r = t.weight ?? 400, o = t.italic ?? !1; let s; for (const i of e.fonts) { - if (i.source === "standard" || Cf(i.familyName) !== n) continue; + if (i.source === "standard" || Nf(i.familyName) !== n) continue; const a = Math.abs(i.weight - r) + (i.italic === o ? 0 : 1e3) + (i.source === "engine" ? 0 : 0.5); (!s || a < s.score) && (s = { font: i, score: a }); } @@ -77642,40 +77690,40 @@ function _3e(e, t) { function L3e(e) { const { measurer: t } = e, n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(); let o = 0; - const s = (f) => { - let h = n.get(f); - return h || (h = n5(f), n.set(f, h)), h; - }, i = async (f, h, g) => { + const s = (d) => { + let h = n.get(d); + return h || (h = n5(d), n.set(d, h)), h; + }, i = async (d, h, g) => { const p = e.programOf(h, g), m = await e.getProgram(h); - return hme(m, p, (v, S) => f.width(p, v, S)); - }, a = async (f, h) => { + return hme(m, p, (v, S) => d.width(p, v, S)); + }, a = async (d, h) => { const g = F0(qa(h)); - return g ? sg(g) : i(f, h); - }, c = async (f, h) => { + return g ? ig(g) : i(d, h); + }, c = async (d, h) => { await e.loadList(); - const p = (await e.resolve({ runs: [{ text: " ", fontFamily: h }] })).runs[0], m = Promise.all(p.fallbacks.map((S) => a(f, S))); - return { face: gs(p.font) ? sg(p.font) : p.program ? await i(f, p.program, p) : sg(e.standardOf(p.font)), fallbacks: await m, lastResort: sH() }; - }, l = (f, h) => { + const p = (await e.resolve({ runs: [{ text: " ", fontFamily: h }] })).runs[0], m = Promise.all(p.fallbacks.map((S) => a(d, S))); + return { face: gs(p.font) ? ig(p.font) : p.program ? await i(d, p.program, p) : ig(e.standardOf(p.font)), fallbacks: await m, lastResort: sH() }; + }, l = (d, h) => { const g = r.get(h) ?? { value: null, generation: -1, finding: !1 }; if (r.set(h, g), g.finding || g.generation === o) return g; g.finding = !0; const p = o, m = (v) => { g.value = v, g.generation = p, g.finding = !1, e.changed(); }; - return c(f, h).then(m, () => m("failed")), g; - }, u = (f, h) => { + return c(d, h).then(m, () => m("failed")), g; + }, u = (d, h) => { const g = !h.face.standard && e.refused(h.face.program), p = h.fallbacks.filter((m) => !e.refused(m.program)); return !g && p.length === h.fallbacks.length ? h : { - face: g ? sg(e.standardOf(f)) : h.face, + face: g ? ig(e.standardOf(d)) : h.face, fallbacks: p, lastResort: h.lastResort }; - }, d = (f, h, g) => { + }, f = (d, h, g) => { const p = /* @__PURE__ */ new Set(); let m = !1; for (const [v, S] of XK(g)) { const { font: C, covered: k } = tH(g.slice(v, S), h); - !k || C.standard || p.has(C) || (p.add(C), f.ready(C.program) || (m = !0)); + !k || C.standard || p.has(C) || (p.add(C), d.ready(C.program) || (m = !0)); } return m; }; @@ -77687,14 +77735,14 @@ function L3e(e) { * found or measured, the box's standard font, or Helvetica, with only the * last resort behind it. */ - get(f, h) { - const g = s(f); - if (gs(f) && zN(g.face, h) || !t) return g; - const { value: p } = l(t, f); + get(d, h) { + const g = s(d); + if (gs(d) && zN(g.face, h) || !t) return g; + const { value: p } = l(t, d); if (p === null) return null; if (p === "failed") return g; - const m = u(f, p); - return d(t, m, h) ? null : m; + const m = u(d, p); + return f(t, m, h) ? null : m; }, /** The document's fonts changed: find each font's again, the next time it's asked for. */ reset() { @@ -77704,7 +77752,7 @@ function L3e(e) { } function D3e(e) { const t = /^epdf-([0-9a-f]{16})$/.exec(e)?.[1]; - return t && !Jl.startsWith(t) ? t : void 0; + return t && !Yl.startsWith(t) ? t : void 0; } function j3e(e) { const t = e.events.source(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(); @@ -77722,8 +77770,8 @@ function j3e(e) { } }), l = (y, x) => { const A = F0(qa(y)); - if (A) return vl(A); - if (y === Jl) return j0(); + if (A) return kl(A); + if (y === Yl) return j0(); let b = n.get(y); if (!b) { let E = null; @@ -77749,19 +77797,19 @@ function j3e(e) { }, u = (y, x) => { if (gs(y)) return y; const A = c.get(), b = A ? ZA(A, y) : void 0; - return b ? cl({ + return b ? ll({ family: b.familyName, weight: x?.weight ?? b.weight, italic: x?.italic ?? b.italic }) : "helvetica"; - }, d = (y) => e.measurer?.refused(y) ?? !1, f = (y, x, A, b) => { + }, f = (y) => e.measurer?.refused(y) ?? !1, d = (y, x, A, b) => { const E = c.get(), I = [], O = (R) => { I.some((M) => M.hash === R.hash) || I.push(R); }; y && O(y); for (const R of A) { const M = l(R, Zj(E, R)); - d(M) || O(M); + f(M) || O(M); } return O(j0()), { fontFamily: I.map((R) => e.measurer?.ready(R) ?? !0).every((R) => R) ? _3e( @@ -77783,7 +77831,7 @@ function j3e(e) { getProgram: h, programOf: (y, x) => l(y, x ?? Zj(c.get(), y)), standardOf: (y) => u(y), - refused: d, + refused: f, changed: a }); e.measurer?.onChange(() => { @@ -77810,26 +77858,26 @@ function j3e(e) { return B3e(x); }, v = (y) => [ ...m(y), - vl(cl(y)).hash + kl(ll(y)).hash ], S = (y, x) => { let A = o.get(y); return A || (A = x(), o.set(y, A)), A; }, C = (y, x) => O2( - x ?? (y ? cl({ + x ?? (y ? ll({ family: y.familyName, weight: y.weight, italic: y.italic }) : "helvetica") - ), k = (y) => f( - vl(y), + ), k = (y) => d( + kl(y), ui[y], v(ui[y]), C(void 0, y) ), N = (y) => { const x = y.programs[0], A = x?.displaySha256 && x.canDownload ? l(x.displaySha256, y) : null; - return !A || d(A) ? k( - cl({ family: y.familyName, weight: y.weight, italic: y.italic }) - ) : f( + return !A || f(A) ? k( + ll({ family: y.familyName, weight: y.weight, italic: y.italic }) + ) : d( A, y, v({ family: y.familyName, weight: y.weight, italic: y.italic }), @@ -77854,18 +77902,18 @@ function j3e(e) { getFontCss: (y) => (gs(y) || p(), S(`font:${y}`, () => { if (gs(y)) return k(y); const x = c.get(), A = x ? ZA(x, y) : void 0; - return A ? N(A) : k(Gf(y)); + return A ? N(A) : k(Yf(y)); })), getFaceCss: (y) => ($P(y.family) || p(), S(`face:${y.family}|${y.weight ?? 400}|${y.italic ?? !1}`, () => { const x = c.get(), A = x ? M3e(x, y) : void 0; - return A ? N(A) : k(cl(y)); + return A ? N(A) : k(ll(y)); })), getRunCss: (y) => S( `run:${y.font}|${y.weight}|${y.italic}|${y.program}|${y.fallbacks.join(",")}`, () => { const x = gs(y.font) ? y.font : null, A = c.get(), b = y.program ? l(y.program, y) : null; - return f( - b && d(b) ? vl(u(y.font, y)) : b, + return d( + b && f(b) ? kl(u(y.font, y)) : b, y, y.fallbacks, C(A ? ZA(A, y.font) : void 0, x) @@ -77890,7 +77938,7 @@ const F3e = () => ({ token: Xa, scope: "document", create: j3e -}), EJ = sn("metadata", { +}), EJ = an("metadata", { hint: "add metadataPlugin() from '@embedpdf/plugin-metadata' to your plugins list", // Without a document, an adapter's stand-in rejects these with `not-ready`, as the // capability would; the type asks for every member that returns a promise. @@ -77912,52 +77960,52 @@ function V3e(e) { name: "metadata", onDemand: !0, initial: () => null, - load: async (d) => ({ value: await d.metadata.get() }), - fold: (d, f) => f.type === "metadata.updated" ? f.metadata : d, - onChanged: ({ cause: d, event: f, previous: h, next: g }) => { - g && (d === "load" ? n.emit({ metadata: g }) : f && "origin" in f && t.emit({ + load: async (f) => ({ value: await f.metadata.get() }), + fold: (f, d) => d.type === "metadata.updated" ? d.metadata : f, + onChanged: ({ cause: f, event: d, previous: h, next: g }) => { + g && (f === "load" ? n.emit({ metadata: g }) : d && "origin" in d && t.emit({ metadata: g, previous: h, changedKeys: eF(h, g), - origin: f.origin + origin: d.origin })); } }), i = e.mirror({ name: "customMetadata", onDemand: !0, initial: () => null, - load: async (d) => ({ value: await d.metadata.custom.get() }), - fold: (d, f) => f.type === "metadata.customUpdated" ? f.custom : d, - onChanged: ({ cause: d, event: f, previous: h, next: g }) => { - g && (d === "load" ? o.emit({ custom: g }) : f && "origin" in f && r.emit({ + load: async (f) => ({ value: await f.metadata.custom.get() }), + fold: (f, d) => d.type === "metadata.customUpdated" ? d.custom : f, + onChanged: ({ cause: f, event: d, previous: h, next: g }) => { + g && (f === "load" ? o.emit({ custom: g }) : d && "origin" in d && r.emit({ custom: g, previous: h, changedKeys: eF(h, g), - origin: f.origin + origin: d.origin })); } - }), a = () => e.allows(tF), c = (d, f) => { - if (e.assertAllowed(tF, d), f?.signal?.aborted) - throw new re("operation-cancelled", "metadata", `${d} was cancelled`); + }), a = () => e.allows(tF), c = (f, d) => { + if (e.assertAllowed(tF, f), d?.signal?.aborted) + throw new te("operation-cancelled", "metadata", `${f} was cancelled`); }, l = { getSnapshot: i.get, getStatus: i.getStatus, - update: async (d, f) => (c("metadata.custom.update", f), { custom: (await e.cancellable(f?.signal, e.doc.metadata.custom.update(d))).custom }), - refresh: (d) => e.cancellable(d?.signal, i.refresh()), + update: async (f, d) => (c("metadata.custom.update", d), { custom: (await e.cancellable(d?.signal, e.doc.metadata.custom.update(f))).custom }), + refresh: (f) => e.cancellable(f?.signal, i.refresh()), onUpdated: r.on, onResynced: o.on }; return { api: { getSnapshot: s.get, getStatus: s.getStatus, - ensureLoaded: (d) => e.cancellable( - d?.signal, + ensureLoaded: (f) => e.cancellable( + f?.signal, Promise.all([s.ensureLoaded(), i.ensureLoaded()]).then(() => { }) ), canUpdate: a, - update: async (d, f) => (c("metadata.update", f), { metadata: (await e.cancellable(f?.signal, e.doc.metadata.update(d))).metadata }), - refresh: (d) => e.cancellable(d?.signal, s.refresh()), + update: async (f, d) => (c("metadata.update", d), { metadata: (await e.cancellable(d?.signal, e.doc.metadata.update(f))).metadata }), + refresh: (f) => e.cancellable(f?.signal, s.refresh()), onUpdated: t.on, onResynced: n.on, custom: l @@ -77999,16 +78047,16 @@ const JT = (e, t) => { case "document": return { kind: "document" }; } -}, K3e = (e, t) => new re("operation-cancelled", "actions", `${e} was cancelled`, { +}, K3e = (e, t) => new te("operation-cancelled", "actions", `${e} was cancelled`, { cause: t?.reason }); function H3e(e, t, { run: n }, { triggerEnabled: r, lifecycleAnnotationsOf: o, planPageSteps: s }, i, { runDocumentEventOp: a }) { - const { executed: c, reportDiagnostic: l } = t.events, { decisionFor: u } = t.policy, { allowsPrint: d } = t.authority, { enqueue: f, budget: h } = t.queue, { readDocumentActions: g, DOC_EVENT_TREES: p } = t.catalog, { form: m } = t, { noteUserActivity: v } = i, S = async (O, T, R) => { + const { executed: c, reportDiagnostic: l } = t.events, { decisionFor: u } = t.policy, { allowsPrint: f } = t.authority, { enqueue: d, budget: h } = t.queue, { readDocumentActions: g, DOC_EVENT_TREES: p } = t.catalog, { form: m } = t, { noteUserActivity: v } = i, S = async (O, T, R) => { const M = await n(O, T, R); return c.emit({ tree: O, result: M, source: T.source }), M; }, C = (O, T, R) => { const M = R?.signal; - return T.origin === "user" && v(), f(async () => { + return T.origin === "user" && v(), d(async () => { h.scriptNodes = 0; const F = await S(O, T, M); if (F.status === "cancelled") throw K3e("actions.execute", M); @@ -78019,38 +78067,38 @@ function H3e(e, t, { run: n }, { triggerEnabled: r, lifecycleAnnotationsOf: o, p const R = u(O.root, T.origin); return R === "allow" || R === "adapter"; }, N = async (O, T, R, M, F) => { - const B = []; + const _ = []; for (const $ of O) { if (F?.aborted) break; const D = await S($.tree, { origin: T, source: $.source, event: R }, F); - B.push({ source: $.source, tree: $.tree, result: D }); + _.push({ source: $.source, tree: $.tree, result: D }); } - return F?.aborted ? { status: "cancelled", steps: B, diagnostics: M } : JT(B, M); + return F?.aborted ? { status: "cancelled", steps: _, diagnostics: M } : JT(_, M); }, w = async (O, T) => { - const R = [], M = (B) => { - R.push(B), l(B, { source: rF(O) }); - }, F = (B) => e.cancellable(T, B); + const R = [], M = (_) => { + R.push(_), l(_, { source: rF(O) }); + }, F = (_) => e.cancellable(T, _); try { if (!r(O)) return M({ code: "trigger-disabled", message: `${O.type}: trigger family disabled by config` }), { status: "inert", steps: [], diagnostics: R }; - const B = ZB(O); + const _ = ZB(O); switch (O.type) { case "activate": case "annotation": { const $ = O.type === "activate" ? "activate" : O.event, D = await nF(e, m, O.annotation, F); if ($ === "mouseUp" && D?.actions?.activate) return { status: "inert", steps: [], diagnostics: R }; - const _ = D?.actions?.[$]; - if (!_?.root && !_?.incomplete) return { status: "inert", steps: [], diagnostics: R }; + const B = D?.actions?.[$]; + if (!B?.root && !B?.incomplete) return { status: "inert", steps: [], diagnostics: R }; const L = rF(O); - return await N([{ source: L, tree: _ }], B, XB(O), R, T); + return await N([{ source: L, tree: B }], _, XB(O), R, T); } case "page": { - const $ = await o(O.page), D = e.getPage(O.page)?.actions, _ = s(O.event, O.page, D, $); - return await N(_, B, XB(O), R, T); + const $ = await o(O.page), D = e.getPage(O.page)?.actions, B = s(O.event, O.page, D, $); + return await N(B, _, XB(O), R, T); } case "document": return O.event !== "open" ? await a(O.event, R, M) : i.claim() ? await i.run() : (M({ @@ -78058,15 +78106,15 @@ function H3e(e, t, { run: n }, { triggerEnabled: r, lifecycleAnnotationsOf: o, p message: "document open sequence already fired for this document" }), { status: "inert", steps: [], diagnostics: R }); } - } catch (B) { - return pr(B, "operation-cancelled") && T?.aborted ? { status: "cancelled", steps: [], diagnostics: R } : (M({ + } catch (_) { + return Xn(_, "operation-cancelled") && T?.aborted ? { status: "cancelled", steps: [], diagnostics: R } : (M({ code: "trigger-failed", - message: `trigger resolution failed: ${B instanceof Error ? B.message : String(B)}` + message: `trigger resolution failed: ${_ instanceof Error ? _.message : String(_)}` }), { status: "refused", steps: [], diagnostics: R }); } }, y = (O, T) => { const R = T?.signal; - return ZB(O) === "user" && v(), f(() => (h.scriptNodes = 0, w(O, R)), T).catch( + return ZB(O) === "user" && v(), d(() => (h.scriptNodes = 0, w(O, R)), T).catch( // Only a signal that fired while the trigger waited for its turn gets // here: resolveAndRun itself never throws. () => ({ status: "cancelled", steps: [], diagnostics: [] }) @@ -78080,7 +78128,7 @@ function H3e(e, t, { run: n }, { triggerEnabled: r, lifecycleAnnotationsOf: o, p source: { kind: "api" }, event: { type: "activate" }, ...O - }), b = (O, T, R) => C(x(O), A(T), R), E = (O, T) => k(x(O), A(T)) && (O !== "Print" || d()), I = async (O) => { + }), b = (O, T, R) => C(x(O), A(T), R), E = (O, T) => k(x(O), A(T)) && (O !== "Print" || f()), I = async (O) => { switch (O.kind) { case "annotation": return (await nF(e, m, O.annotation))?.actions?.[O.event ?? "activate"] ?? null; @@ -78181,16 +78229,16 @@ const J3e = (e) => ({ }; function Q3e(e, t, { performSubmit: n }, { firePrintThroughAdapter: r }) { const { decisionFor: o } = t.policy, s = t.ports.slots, { reportDiagnostic: i } = t.events, { form: a } = t; - async function c(l, u, d) { - const f = [], h = (A, b) => { - f.push(A), i(A, { action: b, source: u.source }); + async function c(l, u, f) { + const d = [], h = (A, b) => { + d.push(A), i(A, { action: b, source: u.source }); }; if (l.incomplete) return h( { code: "incomplete-tree", message: "refused: the action tree is incomplete" }, l.root?.type ?? null - ), { status: "refused", nodes: [], diagnostics: f }; - if (!l.root) return { status: "inert", nodes: [], diagnostics: f }; + ), { status: "refused", nodes: [], diagnostics: d }; + if (!l.root) return { status: "inert", nodes: [], diagnostics: d }; const g = [], p = []; let m = !1, v = !1; const S = (A, b) => { @@ -78207,20 +78255,20 @@ function Q3e(e, t, { performSubmit: n }, { firePrintThroughAdapter: r }) { F.kind === "objectNumber" ? R.push(F.objectNumber) : T.push(F.name); if (T.length || R.length) { const F = await a.read(); - for (const B of T) { - const $ = F.fields.find((D) => D.name === B); + for (const _ of T) { + const $ = F.fields.find((D) => D.name === _); if (!$) { - E({ code: "unresolved-target", message: `hide: no field named '${B}'` }); + E({ code: "unresolved-target", message: `hide: no field named '${_}'` }); continue; } I.push($.ref); } - for (const B of R) { + for (const _ of R) { const $ = F.fields.find( - (D) => D.widgets.some((_) => _.objectNumber === B) + (D) => D.widgets.some((B) => B.objectNumber === _) ); $ ? I.push($.ref) : O.push({ - annotObjectNumber: B, + annotObjectNumber: _, patch: { flags: { hidden: A.hide } } }); } @@ -78233,7 +78281,7 @@ function Q3e(e, t, { performSubmit: n }, { firePrintThroughAdapter: r }) { message: "hide: no form commit sink registered (form plugin absent)" }), { status: "no-executor" }; const F = await s.formCommitSink( - I.map((B) => ({ kind: "setDisplay", ref: B, display: b })) + I.map((_) => ({ kind: "setDisplay", ref: _, display: b })) ); F.status === "failed" && (M = F.error ?? "failed", E({ code: "executor-failed", message: `hide: ${M}` })); } @@ -78243,13 +78291,13 @@ function Q3e(e, t, { performSubmit: n }, { firePrintThroughAdapter: r }) { code: "no-commit-sink", message: "hide: no annotation commit sink registered (annotation plugin absent)" }), { status: "no-executor" }; - const F = await s.annotCommitSink(O), B = F.results.filter(($) => $.status === "failed"); - for (const $ of B) + const F = await s.annotCommitSink(O), _ = F.results.filter(($) => $.status === "failed"); + for (const $ of _) E({ code: "executor-failed", message: `hide: annotation ${$.annotObjectNumber}: ${$.error ?? "failed"}` }); - B.length === F.results.length && B.length > 0 && (M = B[0]?.error); + _.length === F.results.length && _.length > 0 && (M = _[0]?.error); } return M ? { status: "failed", detail: M } : { status: "executed" }; }, k = async (A, b) => { @@ -78365,7 +78413,7 @@ function Q3e(e, t, { performSubmit: n }, { firePrintThroughAdapter: r }) { } }); }, N = async (A, b) => { - if (d?.aborted) { + if (f?.aborted) { v = !0; return; } @@ -78375,11 +78423,11 @@ function Q3e(e, t, { performSubmit: n }, { firePrintThroughAdapter: r }) { }; if (await N(l.root, []), !m && !v) for (const A of p) await A.fire(); - if (v) return { status: "cancelled", nodes: g, diagnostics: f }; + if (v) return { status: "cancelled", nodes: g, diagnostics: d }; const w = g.some((A) => A.status === "executed"), y = g.some( (A) => A.status === "failed" || A.status === "skipped" ); - return { status: w ? y ? "partial" : "executed" : y ? "partial" : "inert", nodes: g, diagnostics: f }; + return { status: w ? y ? "partial" : "executed" : y ? "partial" : "inert", nodes: g, diagnostics: d }; } return { run: c }; } @@ -78431,33 +78479,33 @@ function Z3e(e, { settings: t, form: n }) { return { triggerEnabled: r, lifecycleAnnotationsOf: (c) => { const l = c.objectNumber, u = o.get(l); if (u) return u; - const d = U3e(e, n, c).then( - (f) => f.filter( + const f = U3e(e, n, c).then( + (d) => d.filter( (h) => h.actions && (h.actions.pageOpen?.root || h.actions.pageClose?.root || h.actions.pageVisible?.root || h.actions.pageInvisible?.root) ).map((h) => ({ ref: h.ref, actions: h.actions })) ); - return o.set(l, d), d.catch(() => { - o.get(l) === d && o.delete(l); - }), d; + return o.set(l, f), f.catch(() => { + o.get(l) === f && o.delete(l); + }), f; }, invalidate: (c) => { const l = X3e(c); if (l === "all") o.clear(); else if (l) for (const u of l) o.delete(u.objectNumber); - }, planPageSteps: (c, l, u, d) => { - const f = { kind: "page", page: l }, h = (g) => d.filter((p) => p.actions[g]?.root).map((p) => ({ + }, planPageSteps: (c, l, u, f) => { + const d = { kind: "page", page: l }, h = (g) => f.filter((p) => p.actions[g]?.root).map((p) => ({ source: { kind: "annotation", annotation: p.ref, page: l }, tree: p.actions[g] })); switch (c) { case "open": return [ - ...u?.open?.root ? [{ source: f, tree: u.open }] : [], + ...u?.open?.root ? [{ source: d, tree: u.open }] : [], ...h("pageOpen") ]; case "close": return [ ...h("pageClose"), - ...u?.close?.root ? [{ source: f, tree: u.close }] : [] + ...u?.close?.root ? [{ source: d, tree: u.close }] : [] ]; case "visible": return h("pageVisible"); @@ -78469,7 +78517,7 @@ function Z3e(e, { settings: t, form: n }) { function eMe(e, { ensureOpenSequenceBeforeDocEvent: t }, { runAndEmit: n }) { - const { reportDiagnostic: r } = e.events, { readDocumentActions: o, DOC_EVENT_TREES: s } = e.catalog, { enqueue: i, budget: a } = e.queue, c = e.ports.slots, { allowsPrint: l } = e.authority, { documentPrint: u } = e, d = e.printLatch, f = async (p, m) => { + const { reportDiagnostic: r } = e.events, { readDocumentActions: o, DOC_EVENT_TREES: s } = e.catalog, { enqueue: i, budget: a } = e.queue, c = e.ports.slots, { allowsPrint: l } = e.authority, { documentPrint: u } = e, f = e.printLatch, d = async (p, m) => { if (!e.settings.get().triggers.document) return null; try { await t(); @@ -78488,11 +78536,11 @@ function eMe(e, { }; return { runDocumentEventOp: async (p, m, v) => { - const S = await f(p, v); + const S = await d(p, v); return JT(S ? [S] : [], m); }, firePrintThroughAdapter: async (p, m) => { - if (d.active) + if (f.active) return m({ code: "reentrant-print", message: "print request during a document print event — suppressed (one dialog per request)" @@ -78508,32 +78556,32 @@ function eMe(e, { ), { status: "executed" }); if (!c.uiAdapter) return m({ code: "no-adapter", message: "print: no UI adapter installed" }), { status: "no-executor", detail: "no UI adapter installed" }; - d.active = !0; + f.active = !0; try { - await f("will-print", m); + await d("will-print", m); const v = c.uiAdapter; - return v ? (p ? v.print(p) : v.print(), await f("did-print", m), { status: "executed" }) : { status: "no-executor", detail: "UI adapter uninstalled mid-print" }; + return v ? (p ? v.print(p) : v.print(), await d("did-print", m), { status: "executed" }) : { status: "no-executor", detail: "UI adapter uninstalled mid-print" }; } finally { - d.active = !1; + f.active = !1; } }, api: { runDocumentVerb: (p, m, v) => i(async () => { a.scriptNodes = 0; const S = (w) => r(w, { source: { kind: "document" } }), C = p === "save" ? "will-save" : "will-print", k = p === "save" ? "did-save" : "did-print", N = async () => { - if (await f(C, S), v?.signal?.aborted) - throw new re("operation-cancelled", "actions", `${p} was cancelled`, { + if (await d(C, S), v?.signal?.aborted) + throw new te("operation-cancelled", "actions", `${p} was cancelled`, { cause: v.signal.reason }); const w = await m(); - return await f(k, S), w; + return await d(k, S), w; }; if (p !== "print") return N(); - d.active = !0; + f.active = !0; try { return await N(); } finally { - d.active = !1; + f.active = !1; } }, v) } @@ -78541,8 +78589,8 @@ function eMe(e, { } function tMe(e, { releaseBarrier: t, resetCascade: n }, { runAndEmit: r }) { const { reportDiagnostic: o, openSequenceCompleted: s } = e.events, i = () => e.settings.get().openSequence, { readDocumentActions: a } = e.catalog, { enqueue: c } = e.queue, l = e.ports.slots; - let u = !1, d = !1; - const f = async () => { + let u = !1, f = !1; + const d = async () => { const v = [], S = [], C = { origin: "lifecycle", source: { kind: "document" }, @@ -78584,21 +78632,21 @@ function tMe(e, { releaseBarrier: t, resetCascade: n }, { runAndEmit: r }) { const k = JT(S, v); return s.emit({ result: k }), k; }, h = async () => { - u || i() === "off" || (u = !0, await f()); + u || i() === "off" || (u = !0, await d()); }, g = () => { if (!u) { if (i() === "off") { u = !0, t(!1); return; } - !l.uiAdapter && i() !== "headless" && !d || (u = !0, c(() => f())); + !l.uiAdapter && i() !== "headless" && !f || (u = !0, c(() => d())); } }; return { - run: f, + run: d, ensureOpenSequenceBeforeDocEvent: h, noteUserActivity: () => { - n(), d || (d = !0, g()); + n(), f || (f = !0, g()); }, claim: () => u ? !1 : (u = !0, !0), /** Arm the latch at bringup: fires immediately for 'headless', releases @@ -78618,40 +78666,40 @@ function nMe(e, { events: t, settings: n }, { dispatch: r }) { current: null, visible: /* @__PURE__ */ new Set() }, c = 0; - const l = (f) => { - f.cause === "user" && (c = 0); - const h = f.currentPage === null ? null : f.currentPage.objectNumber, g = new Set(f.visiblePages.map((C) => C.objectNumber)), p = h !== a.current, m = [...a.visible].filter( + const l = (d) => { + d.cause === "user" && (c = 0); + const h = d.currentPage === null ? null : d.currentPage.objectNumber, g = new Set(d.visiblePages.map((C) => C.objectNumber)), p = h !== a.current, m = [...a.visible].filter( (C) => !g.has(C) ), v = [...g].filter( (C) => !a.visible.has(C) ); if (!p && m.length === 0 && v.length === 0) return; const S = a.current; - if (a = { current: h, visible: g }, f.cause === "programmatic" && (c += 1, c > oF)) { + if (a = { current: h, visible: g }, d.cause === "programmatic" && (c += 1, c > oF)) { o({ code: "cascade-budget", message: `page-lifecycle emission suppressed: ${c} consecutive programmatic rounds (cap ${oF})` }); return; } - p && S !== null && r({ type: "page", event: "close", page: Lt(S) }); + p && S !== null && r({ type: "page", event: "close", page: Ft(S) }); for (const C of m) - r({ type: "page", event: "invisible", page: Lt(C) }); + r({ type: "page", event: "invisible", page: Ft(C) }); for (const C of v) - r({ type: "page", event: "visible", page: Lt(C) }); - p && h !== null && r({ type: "page", event: "open", page: Lt(h) }); + r({ type: "page", event: "visible", page: Ft(C) }); + p && h !== null && r({ type: "page", event: "open", page: Ft(h) }); }; return { - releaseBarrier: (f) => { + releaseBarrier: (d) => { s = !0; const h = i; i = null; try { if (h) l(h); - else if (f && n.get().openSequence === "headless") { + else if (d && n.get().openSequence === "headless") { const g = e.document()?.pages[0]?.ref.objectNumber; - g !== void 0 && (a = { current: g, visible: a.visible }, r({ type: "page", event: "open", page: Lt(g) })); + g !== void 0 && (a = { current: g, visible: a.visible }, r({ type: "page", event: "open", page: Ft(g) })); } } catch (g) { o({ @@ -78664,13 +78712,13 @@ function nMe(e, { events: t, settings: n }, { dispatch: r }) { resetCascade: () => { c = 0; }, - api: { reportPageState: (f) => { - if (f.placed) { - if (f.cause === "user" && (c = 0), !s) { - i = f; + api: { reportPageState: (d) => { + if (d.placed) { + if (d.cause === "user" && (c = 0), !s) { + i = d; return; } - l(f); + l(d); } } } }; @@ -78678,18 +78726,18 @@ function nMe(e, { events: t, settings: n }, { dispatch: r }) { function rMe(e, { form: t }) { const n = (c) => { if (!c) return ["T"]; - const { r: l, g: u, b: d } = jY(c); - return ["RGB", l / 255, u / 255, d / 255]; + const { r: l, g: u, b: f } = jY(c); + return ["RGB", l / 255, u / 255, f / 255]; }, r = async (c) => { - const l = Lt(c), u = await t.read(), d = e.getPage(l), f = Math.max(0, d?.index ?? -1), { annotations: h } = await e.doc.page(l).annotations.list(), g = h.filter( + const l = Ft(c), u = await t.read(), f = e.getPage(l), d = Math.max(0, f?.index ?? -1), { annotations: h } = await e.doc.page(l).annotations.list(), g = h.filter( (p) => p.subtype !== "link" && !p.subtype.startsWith("widget") ).map((p) => { - const m = d ? BV(p.rect, d.pdfCropBox) : null, v = p; + const m = f ? BV(p.rect, f.pdfCropBox) : null, v = p; return { ref: p.ref, name: p.nm ?? "", subtype: p.subtype, - page: f, + page: d, rect: m ? [m.left, m.bottom, m.right, m.top] : [0, 0, 0, 0], contents: p.contents ?? "", author: p.author ?? "", @@ -78714,7 +78762,7 @@ function rMe(e, { form: t }) { world: { fields: oA(u), annots: g, - annotPages: [f], + annotPages: [d], annotsCoverDocument: (e.document()?.pageCount ?? 0) <= 1 } }; @@ -78740,13 +78788,13 @@ function rMe(e, { form: t }) { "will-close": "WillClose" }; return { scriptWorldFor: r, scriptEventFor: (c, l) => { - const u = c.event, d = u.type === "page" ? "Page" : u.type === "document" ? "Doc" : c.source.kind === "widget" ? "Field" : c.source.kind === "link" ? "Link" : c.source.kind === "outline" ? "Bookmark" : "Annot", f = u.type === "activate" ? "Mouse Up" : u.type === "annotation" ? o[u.event] ?? "Mouse Up" : u.type === "page" ? s[u.event] ?? "Open" : i[u.event] ?? "Open", h = c.source.kind === "widget" ? c.source.field : void 0, g = h ? l.fields.find( + const u = c.event, f = u.type === "page" ? "Page" : u.type === "document" ? "Doc" : c.source.kind === "widget" ? "Field" : c.source.kind === "link" ? "Link" : c.source.kind === "outline" ? "Bookmark" : "Annot", d = u.type === "activate" ? "Mouse Up" : u.type === "annotation" ? o[u.event] ?? "Mouse Up" : u.type === "page" ? s[u.event] ?? "Open" : i[u.event] ?? "Open", h = c.source.kind === "widget" ? c.source.field : void 0, g = h ? l.fields.find( (p) => h.kind === "objectNumber" && p.ref.kind === "objectNumber" ? p.ref.objectNumber === h.objectNumber : h.kind === "fqn" && p.name === h.name ) : void 0; return { kind: "widget-activate", - type: d, - name: f, + type: f, + name: d, ...h ? { target: h, source: h } : {}, ...g && g.valueEntry.kind === "scalar" ? { value: g.valueEntry.value } : {} }; @@ -78754,7 +78802,7 @@ function rMe(e, { form: t }) { } const oMe = 16; function sMe(e, t, n, { scriptHost: r }, { performSubmit: o }, { surfaceScriptResult: s }, i) { - const { reportDiagnostic: a } = t.events, c = t.ports.slots, { budget: l } = t.queue, { firePrintThroughAdapter: u } = i, { scriptWorldFor: d, scriptEventFor: f } = rMe(e, t), h = async (p, m) => { + const { reportDiagnostic: a } = t.events, c = t.ports.slots, { budget: l } = t.queue, { firePrintThroughAdapter: u } = i, { scriptWorldFor: f, scriptEventFor: d } = rMe(e, t), h = async (p, m) => { let v = null; if (p.formEffects.length > 0) if (!c.formCommitSink) @@ -78801,7 +78849,7 @@ function sMe(e, t, n, { scriptHost: r }, { performSubmit: o }, { surfaceScriptRe if (C === void 0) return { status: "inert", reason: "no page to anchor the world on" }; const k = (x) => a(x, { action: "javascript", source: v }), N = [], w = (x, A) => x.uiEffects.filter((b) => b.type === "print" || b.type === "submitForm" ? (N.push({ effect: b, phase: A }), !1) : !0), y = await r.transaction(async (x) => { - let A = await d(C); + let A = await f(C); const b = await x.boot({ ...A.world, event: { kind: "name-tree-boot", type: "Doc", name: "Open" } @@ -78814,10 +78862,10 @@ function sMe(e, t, n, { scriptHost: r }, { performSubmit: o }, { surfaceScriptRe phase: "boot", realm: "document", source: v - }), (b.formEffects.length || b.annotEffects.length) && (A = await d(C))); + }), (b.formEffects.length || b.annotEffects.length) && (A = await f(C))); const E = await x.run(p.script, { ...A.world, - event: f(m, A.snapshot) + event: d(m, A.snapshot) }); if (s({ uiEffects: w(E, "user"), @@ -78840,7 +78888,7 @@ function sMe(e, t, n, { scriptHost: r }, { performSubmit: o }, { surfaceScriptRe }); } function iMe(e, t, n) { - const r = e.sandboxFactory ?? (() => import("./index-gudfJIGx.js").then( + const r = e.sandboxFactory ?? (() => import("./index-CRnA8aVz.js").then( ({ createQuickJsSandbox: s }) => s() )), o = e.budget ?? r0; return { @@ -78887,7 +78935,7 @@ function aMe(e, { catalog: t, settings: n }, r) { doc: e.doc, document: () => e.document(), bootSources: async () => ((await o())?.nameTreeScripts ?? []).map( - ({ action: l }) => ol(l) + ({ action: l }) => sl(l) ) }, a = s ? s.realmFor(i) : null; return a && e.cleanup(() => a.destroy()), { @@ -78906,10 +78954,10 @@ function aMe(e, { catalog: t, settings: n }, r) { }; } function cMe(e, { performSubmit: t }) { - const { reportDiagnostic: n, scriptDiagnosticReported: r, scriptFailed: o } = e.events, s = e.ports.slots, { allowsPrint: i } = e.authority, { documentPrint: a } = e, c = e.printLatch, l = (d) => { - const f = { origin: d.origin, phase: d.phase }, h = d.source ?? null; - for (const g of d.uiEffects) { - if (d.realm === "detached" && g.type !== "alert") { + const { reportDiagnostic: n, scriptDiagnosticReported: r, scriptFailed: o } = e.events, s = e.ports.slots, { allowsPrint: i } = e.authority, { documentPrint: a } = e, c = e.printLatch, l = (f) => { + const d = { origin: f.origin, phase: f.phase }, h = f.source ?? null; + for (const g of f.uiEffects) { + if (f.realm === "detached" && g.type !== "alert") { r.emit({ code: "ui-effect-suppressed", message: `script ${g.type} request from a detached realm suppressed: no document surface` @@ -78920,8 +78968,8 @@ function cMe(e, { performSubmit: t }) { t( IJ(g), { - origin: d.origin, - source: d.source ?? { kind: "api" }, + origin: f.origin, + source: f.source ?? { kind: "api" }, event: { type: "activate" } }, (p) => n(p, { action: "javascript", source: h }) @@ -78943,10 +78991,10 @@ function cMe(e, { performSubmit: t }) { continue; } if (g.type === "print" && a.available()) { - if (d.origin !== "user") { + if (f.origin !== "user") { r.emit({ code: "ui-effect-suppressed", - message: `script print request from a ${d.origin} event suppressed` + message: `script print request from a ${f.origin} event suppressed` }); continue; } @@ -78976,28 +79024,28 @@ function cMe(e, { performSubmit: t }) { continue; } g.type === "alert" ? s.uiAdapter.alert?.(g.message, { - ...f, + ...d, icon: g.icon, ...g.title !== void 0 ? { title: g.title } : {} - }) : g.type === "goToPage" ? s.uiAdapter.goToPage?.(g.pageIndex, f) : s.uiAdapter.print(f); + }) : g.type === "goToPage" ? s.uiAdapter.goToPage?.(g.pageIndex, d) : s.uiAdapter.print(d); } - for (const g of d.diagnostics) r.emit(g); - d.error && o.emit({ error: d.error, source: h }); + for (const g of f.diagnostics) r.emit(g); + f.error && o.emit({ error: f.error, source: h }); }; return { surfaceScriptResult: l, - api: { surfaceScriptResult: l, surfaceScriptCommit: (d, f) => { + api: { surfaceScriptResult: l, surfaceScriptCommit: (f, d) => { const h = ["boot", "user"]; for (const g of h) { - const p = d.uiEffects.filter((m) => m.phase === g); + const p = f.uiEffects.filter((m) => m.phase === g); p.length === 0 && g === "boot" || l({ uiEffects: p, - diagnostics: g === "user" ? d.diagnostics : [], - ...g === "user" && d.error ? { error: d.error } : {}, - origin: f.origin, + diagnostics: g === "user" ? f.diagnostics : [], + ...g === "user" && f.error ? { error: f.error } : {}, + origin: d.origin, phase: g, - realm: f.realm, - ...f.source ? { source: f.source } : {} + realm: d.realm, + ...d.source ? { source: d.source } : {} }); } } } @@ -79026,7 +79074,7 @@ function dMe(e) { }, DOC_EVENT_TREES: uMe }; } function fMe(e) { - const t = () => e.get(It); + const t = () => e.get(Pt); return { /** Whether the kernel prints this document: `doc.print`, and the host gave a printer. */ available: () => t().canPrint(), @@ -79120,9 +79168,9 @@ function bMe(e) { function wMe(e, t, n) { const r = t.policy, o = t.ports.slots, { reportDiagnostic: s } = t.events, i = () => n.now?.() ?? Date.now(); return { performSubmit: async (c, l, u) => { - const d = r.current()["submit-form"][l.origin]; - if (d !== "adapter" && d !== "allow") - return d === "report" && u({ + const f = r.current()["submit-form"][l.origin]; + if (f !== "adapter" && f !== "allow") + return f === "report" && u({ code: "blocked", message: `submit-form: policy 'report' for origin '${l.origin}'` }), { status: "blocked" }; @@ -79131,19 +79179,19 @@ function wMe(e, t, n) { code: "no-submit-resolver", message: "submit-form: no dataset resolver registered (form plugin missing?)" }), { status: "blocked", detail: "no dataset resolver" }; - let f; + let d; try { - f = await o.submitResolver(c, l, u); + d = await o.submitResolver(c, l, u); } catch (p) { const m = p instanceof Error ? p.message : String(p); return u({ code: "executor-failed", message: `submit-form: dataset resolution: ${m}` }), { status: "failed", detail: m }; } const h = e.doc.forms, g = typeof h.submit == "function" ? () => Promise.resolve( - h.submit(Y3e(f, new Date(i()).toISOString())) + h.submit(Y3e(d, new Date(i()).toISOString())) ) : null; if (o.submitHandler) try { - const p = o.submitHandler(f, { submitToDocumentHome: g }); + const p = o.submitHandler(d, { submitToDocumentHome: g }); return p && typeof p.then == "function" && p.catch((m) => { s( { @@ -79174,22 +79222,22 @@ function vMe(e, t = {}) { const n = bMe(e), { events: r, ports: o, settings: s } = n, i = { dispatch: (S) => m.dispatch(S), runAndEmit: (S, C) => m.runAndEmit(S, C) - }, a = t.javascript ?? {}, c = wMe(e, n, a), l = aMe(e, n, a), u = cMe(n, c), d = nMe(e, n, i), f = tMe(n, d, i), h = eMe(n, f, i), g = Z3e(e, n), p = Q3e(e, n, c, h), m = H3e( + }, a = t.javascript ?? {}, c = wMe(e, n, a), l = aMe(e, n, a), u = cMe(n, c), f = nMe(e, n, i), d = tMe(n, f, i), h = eMe(n, d, i), g = Z3e(e, n), p = Q3e(e, n, c, h), m = H3e( e, n, p, g, - f, + d, h ); return sMe(e, n, a, l, c, u, h), { - api: tu("actions", [ + api: nu("actions", [ s.api, o.api, l.api, u.api, - d.api, f.api, + d.api, h.api, m.api, { @@ -79201,7 +79249,7 @@ function vMe(e, t = {}) { } ]), connect() { - e.listen(e.doc.events, (S) => g.invalidate(S)), f.arm(), e.aroundDownload((S) => h.api.runDocumentVerb("save", S)), e.aroundPrint((S) => h.api.runDocumentVerb("print", S)); + e.listen(e.doc.events, (S) => g.invalidate(S)), d.arm(), e.aroundDownload((S) => h.api.runDocumentVerb("save", S)), e.aroundPrint((S) => h.api.runDocumentVerb("print", S)); } }; } @@ -79217,13 +79265,13 @@ function kMe(e) { } const AMe = (e) => ({ id: "actions", - token: Dm, + token: jm, scope: "document", settings: { defaults: lle, registered: kMe(e) }, create: (t) => vMe(t, e) }); function SMe(e) { - const t = Rt(Lr), n = Rt(Zt), r = Re(e); + const t = Bt(Lr), n = Bt(tn), r = Re(e); r.current = e, Ke(() => { if (!t) return; const o = Tse({ @@ -79273,7 +79321,7 @@ const IMe = (e) => ({ function TMe(e, t) { const n = e.indexOf(t); return n >= 0 ? n : e.findIndex( - (r) => r.start === t.start && r.count === t.count && Vf(r.page, t.page) + (r) => r.start === t.start && r.count === t.count && Uf(r.page, t.page) ); } const MMe = (e, t) => t.filter((n) => (e.hitsByPage[n.ref.objectNumber]?.length ?? 0) > 0).map((n) => n.ref), iF = Object.freeze([]), BMe = Object.freeze([]), _Me = 250; @@ -79285,7 +79333,7 @@ function LMe(e) { hit: N.hits[N.activeHitIndex] ?? null }), k.status !== "idle" && N.status === "idle" && l.emit({}); }); - function d(k) { + function f(k) { const N = []; for (const w of k.matches) { const y = e.getPage(w.page); @@ -79303,7 +79351,7 @@ function LMe(e) { } return N; } - async function f(k, N, w) { + async function d(k, N, w) { const { signal: y } = N; w.onStart(); let x = N.snippets ?? e.allows("doc.text.copy"); @@ -79324,22 +79372,22 @@ function LMe(e) { ); } catch (T) { if (y?.aborted) return !1; - if (!A && x && b === void 0 && pr(T, "permission-denied")) { + if (!A && x && b === void 0 && Xn(T, "permission-denied")) { x = !1; continue; } - if (b !== void 0 && !E && pr(T, "invalid-input")) { + if (b !== void 0 && !E && Xn(T, "invalid-input")) { E = !0, b = void 0, w.onStart(); continue; } throw T; } if (y?.aborted) return !1; - if (w.onSlice(d(I), I.pagesSearched, I.pageCount), I.nextCursor === null) return !0; + if (w.onSlice(f(I), I.pagesSearched, I.pageCount), I.nextCursor === null) return !0; b = I.nextCursor; } } - const h = () => e.tryGet(Zt)?.getCurrentPage() ?? void 0; + const h = () => e.tryGet(tn)?.getCurrentPage() ?? void 0; async function g(k, N = {}) { if (k.text.length === 0) return p(), { status: "complete", hitCount: 0 }; @@ -79347,7 +79395,7 @@ function LMe(e) { const w = N.from === void 0 ? h() : e.pageOf(N.from).ref; let y = ""; return n.run(async (x) => { - if (y = x.id, !await f( + if (y = x.id, !await d( k, { from: w, signal: x.signal }, { @@ -79356,20 +79404,20 @@ function LMe(e) { }), onSlice: (b, E, I) => x.commit(() => e.state.update(CMe, b, { pagesSearched: E, pageCount: I })) } - )) throw new re("operation-cancelled", "search", "search aborted"); + )) throw new te("operation-cancelled", "search", "search aborted"); return x.commit(() => { e.state.update(IMe), s.emit({ hitCount: u().hits.length }); }), { status: "complete", hitCount: u().hits.length }; }, N).catch((x) => { - if (pr(x, "instance-closed")) return { status: "cancelled", hitCount: 0 }; - if (pr(x, "operation-cancelled")) { + if (Xn(x, "instance-closed")) return { status: "cancelled", hitCount: 0 }; + if (Xn(x, "operation-cancelled")) { const b = x.details?.reason ?? "cancelled", E = b === "superseded" ? "superseded" : b === "cleared" ? "cleared" : "cancelled"; return E === "cancelled" && u().operationId === y && e.state.update(NMe), i.emit({ reason: E }), { status: E === "superseded" ? "superseded" : "cancelled", hitCount: u().hits.length }; } - const A = Br(qe("search", x)); + const A = Br(ze("search", x)); throw u().operationId === y && e.state.update(OMe, A), a.emit({ error: A }), x; }); } @@ -79384,7 +79432,7 @@ function LMe(e) { } function v(k, N) { const w = { ...t.get().reveal, ...N }; - e.tryGet(Zt)?.reveal(k.page, { + e.tryGet(tn)?.reveal(k.page, { rect: k.bounds, align: w.align, behavior: w.behavior @@ -79426,7 +79474,7 @@ function LMe(e) { findAll: async (k, N = {}) => { e.assertAllowed("doc.text.search", "findAll"), N.snippets && e.assertAllowed("doc.text.copy", "findAll"); const w = []; - if (!await f( + if (!await d( k, { ...N.snippets !== void 0 ? { snippets: N.snippets } : {}, @@ -79438,7 +79486,7 @@ function LMe(e) { }, onSlice: (x) => w.push(...x) } - )) throw new re("operation-cancelled", "search", "findAll aborted"); + )) throw new te("operation-cancelled", "search", "findAll aborted"); return w; }, onStarted: r.on, @@ -79466,7 +79514,7 @@ const DMe = (e) => ({ id: "search", token: Oi, scope: "document", - optional: [Zt], + optional: [tn], state: YT, settings: { defaults: K1e, registered: e }, create: LMe @@ -79491,40 +79539,40 @@ const DMe = (e) => ({ } }); function FMe({ onHitClick: e }) { - const t = qo(), n = KMe(t.ref), r = VMe((f) => f.activeHit), o = $Me((f) => f.highlight), [s] = De(aae); + const t = Go(), n = KMe(t.ref), r = VMe((d) => d.activeHit), o = $Me((d) => d.highlight), [s] = je(aae); if (n.length === 0) return null; - const i = pt("search-highlight", o.color), a = pt("search-highlight-active", o.activeColor), c = pt( + const i = gt("search-highlight", o.color), a = gt("search-highlight-active", o.activeColor), c = gt( "search-blend-mode", o.blendMode - ), l = e ? { pointerEvents: "auto", cursor: "pointer" } : null, u = (f) => e && { + ), l = e ? { pointerEvents: "auto", cursor: "pointer" } : null, u = (d) => e && { onPointerDown: (h) => s.press(h), onClick: (h) => { - s.isClick(h) && e(f); + s.isClick(h) && e(d); } - }, d = iae(n, { + }, f = iae(n, { active: r, page: t.transform, color: i, activeColor: a }); - return /* @__PURE__ */ P("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: d.map( - (f) => f.box ? /* @__PURE__ */ P( + return /* @__PURE__ */ P("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: f.map( + (d) => d.box ? /* @__PURE__ */ P( "div", { - ...u(f.hit), + ...u(d.hit), style: { position: "absolute", - left: f.box.left, - top: f.box.top, - width: f.box.width, - height: f.box.height, - backgroundColor: f.fill, + left: d.box.left, + top: d.box.top, + width: d.box.width, + height: d.box.height, + backgroundColor: d.fill, mixBlendMode: c, borderRadius: 2, ...l } }, - f.key + d.key ) : /* @__PURE__ */ P( "svg", { @@ -79539,31 +79587,31 @@ function FMe({ onHitClick: e }) { children: /* @__PURE__ */ P( "polygon", { - points: f.points ?? void 0, - ...u(f.hit), - style: { fill: f.fill, ...l } + points: d.points ?? void 0, + ...u(d.hit), + style: { fill: d.fill, ...l } } ) }, - f.key + d.key ) ) }); } function u8e() { return bt(Oi); } -const VMe = wo(jMe), $Me = jm(Oi), UMe = Object.freeze([]); +const VMe = vo(jMe), $Me = Fm(Oi), UMe = Object.freeze([]); function KMe(e) { const t = vi(); - return en( + return nn( (n) => n.tryCapability(Oi, t ?? void 0)?.listHits(e === void 0 ? void 0 : { page: e }) ?? UMe ); } -const m0 = sn("stage-thumbs"), QT = { - stage: Zt, +const m0 = an("stage-thumbs"), QT = { + stage: tn, thumbnails: m0, - render: Wo, - link: Pf, + render: qo, + link: Tf, selection: _r, search: Oi, annotation: vt, @@ -79572,17 +79620,17 @@ const m0 = sn("stage-thumbs"), QT = { redaction: oa, form: Ss, signature: vs, - pageEdit: Fm, + pageEdit: Vm, metadata: EJ, fonts: Xa, - outline: Vm, - attachment: $m, + outline: $m, + attachment: Um, actions: Lr, - documents: It, + documents: Pt, interaction: yr, - commands: bo, + commands: wo, shell: dt, - i18n: vo + i18n: ko }, HMe = Symbol.for("@embedpdf/viewer/kernel"), zMe = "this viewer is gone: it was unmounted, or mounted again with a new config. Use the viewer the new onReady gives you.", WMe = /^(?:on|register)(?:[A-Z]|$)/, qMe = (e) => { if (typeof e != "object" || e === null) return !1; const t = Object.getPrototypeOf(e); @@ -79590,7 +79638,7 @@ const m0 = sn("stage-thumbs"), QT = { }; function GMe(e, t) { let n = !1; - const r = /* @__PURE__ */ new Set(), o = (p) => new re("instance-closed", p, zMe), s = (p) => { + const r = /* @__PURE__ */ new Set(), o = (p) => new te("instance-closed", p, zMe), s = (p) => { const m = () => { r.delete(m), p(); }; @@ -79641,11 +79689,11 @@ function GMe(e, t) { try { return e.capability(p, m); } catch (v) { - if (pr(v) || e.scopeOf(p) !== "document") throw v; + if (Xn(v) || e.scopeOf(p) !== "document") throw v; const S = v instanceof Error ? v.message : String(v); - throw new re("not-ready", p.name, S, { cause: v }); + throw new te("not-ready", p.name, S, { cause: v }); } - }, d = (p) => { + }, f = (p) => { function m(S) { const C = l(S); if (n) throw o(C.name); @@ -79659,7 +79707,7 @@ function GMe(e, t) { get: m, tryGet: v }; - }, f = (p, m, v = {}) => { + }, d = (p, m, v = {}) => { if (n) return () => { }; const { immediate: S = !1, isEqual: C = Object.is } = v, k = m; @@ -79669,7 +79717,7 @@ function GMe(e, t) { try { y = p(); } catch (A) { - if (pr(A, "not-ready")) return; + if (Xn(A, "not-ready")) return; throw A; } if (N === null) { @@ -79682,11 +79730,11 @@ function GMe(e, t) { }; return w(), s(e.subscribe(w)); }, h = { - ...d(void 0), - documents: a(e.documents, It.name), - commands: a(e.capability(bo), bo.name), - forDocument: d, - watch: f + ...f(void 0), + documents: a(e.documents, Pt.name), + commands: a(e.capability(wo), wo.name), + forDocument: f, + watch: d }; return Object.defineProperty(h, HMe, { value: e }), { viewer: h, @@ -79780,13 +79828,13 @@ function PJ(e) { }; } const RJ = (e) => e.closest("[data-embedpdf-root]") ?? e, XT = "data-epdf-fills-window"; -function Rg(e) { +function Tg(e) { if (e.hasAttribute(XT)) return "window"; const t = e.getRootNode().host ?? null; return vP(e) || t !== null && vP(t) ? "screen" : null; } async function rBe(e) { - if (Rg(e) !== null) return; + if (Tg(e) !== null) return; const t = PJ(e); if (t.screen) try { await e.requestFullscreen({ navigationUI: "hide" }); @@ -79796,7 +79844,7 @@ async function rBe(e) { t.topLevel && t.popover && sBe(e); } async function oBe(e) { - const t = Rg(e); + const t = Tg(e); t === "window" ? SP(e) : t === "screen" && await e.ownerDocument.exitFullscreen(); } function sBe(e) { @@ -79810,21 +79858,21 @@ const iBe = { current: null }; function aBe(e) { - const [t, n] = De(iBe); + const [t, n] = je(iBe); return Ze(() => { const r = e.current; if (!r) return; const o = RJ(r), s = nBe(PJ(o)), i = () => { - const l = Rg(o); + const l = Tg(o); n((u) => u.way === s && u.current === l ? u : { way: s, current: l }); }, a = (l) => { - l.key !== "Escape" || l.defaultPrevented || wS(l) || Rg(o) === "window" && (l.preventDefault(), SP(o)); + l.key !== "Escape" || l.defaultPrevented || wS(l) || Tg(o) === "window" && (l.preventDefault(), SP(o)); }, c = o.ownerDocument; return i(), c.addEventListener("fullscreenchange", i), o.addEventListener("toggle", i), o.addEventListener("keydown", a), () => { - c.removeEventListener("fullscreenchange", i), o.removeEventListener("toggle", i), o.removeEventListener("keydown", a), Rg(o) === "window" && SP(o); + c.removeEventListener("fullscreenchange", i), o.removeEventListener("toggle", i), o.removeEventListener("keydown", a), Tg(o) === "window" && SP(o); }; }, [e]), t; } @@ -79837,7 +79885,7 @@ function lBe(e, t, n) { icon: r ? "fullscreenExit" : "fullscreen", visible: () => o, active: () => r, - run: () => Rg(e) === null ? rBe(e) : oBe(e) + run: () => Tg(e) === null ? rBe(e) : oBe(e) }; } const ZT = (e) => typeof e == "object" && e !== null, uBe = (e) => e.side === "start" ? "start" : "end"; @@ -79854,7 +79902,7 @@ function fBe(e, t, n) { started: o }; } -const uF = (e, t, n, r) => t > 0 || n && !(e.tryGet(bo)?.isCategoryDisabled(r) ?? !1), e3 = "search", TJ = { +const uF = (e, t, n, r) => t > 0 || n && !(e.tryGet(wo)?.isCategoryDisabled(r) ?? !1), e3 = "search", TJ = { categories: ["search"], allowed: (e) => e.tryGet(Oi)?.canSearch() ?? !0, notAllowedKey: "commands.notAllowed.doc-text-search" @@ -79871,7 +79919,7 @@ const uF = (e, t, n, r) => t > 0 || n && !(e.tryGet(bo)?.isCategoryDisabled(r) ? titleKey: "panels.thumbnails", icon: "sidebar", categories: ["thumbnails"], - allowed: (e) => e.tryGet(Wo)?.canRenderThumbnail() ?? !0, + allowed: (e) => e.tryGet(qo)?.canRenderThumbnail() ?? !0, notAllowedKey: "commands.notAllowed.doc-render-thumbnail" }], ["outline", { @@ -79879,7 +79927,7 @@ const uF = (e, t, n, r) => t > 0 || n && !(e.tryGet(bo)?.isCategoryDisabled(r) ? icon: "listTree", categories: ["outline"], visible: (e) => { - const t = e.tryGet(Vm); + const t = e.tryGet($m); return t != null && uF(e, t.list().length, t.canEdit(), "outline.editing"); } }], @@ -79888,7 +79936,7 @@ const uF = (e, t, n, r) => t > 0 || n && !(e.tryGet(bo)?.isCategoryDisabled(r) ? icon: "paperclip", categories: ["attachments"], visible: (e) => { - const t = e.tryGet($m); + const t = e.tryGet(Um); return t != null && uF(e, t.list().length, t.canCreate(), "attachments.adding"); } }], @@ -79958,15 +80006,15 @@ const uF = (e, t, n, r) => t > 0 || n && !(e.tryGet(bo)?.isCategoryDisabled(r) ? }; function gBe(e, t) { return Object.entries(e ?? {}).flatMap(([n, r]) => { - const o = eu(n); + const o = tu(n); if (!ZT(r)) return []; const s = n === e3 && !t(dF.id) ? [dF] : []; if (t(o)) return s; - const i = hBe.get(n), { focus: a, titleKey: c, icon: l, ...u } = i ?? {}, d = r.titleKey ?? (r.title === void 0 ? i?.titleKey : void 0); + const i = hBe.get(n), { focus: a, titleKey: c, icon: l, ...u } = i ?? {}, f = r.titleKey ?? (r.title === void 0 ? i?.titleKey : void 0); return [{ id: o, - label: r.title ?? (d === void 0 ? n : void 0), - labelKey: d, + label: r.title ?? (f === void 0 ? n : void 0), + labelKey: f, icon: r.icon ?? i?.icon, ...pBe(n, a, r.closable !== !1), ...u @@ -79986,13 +80034,13 @@ function wBe(e, t) { return t === null ? !1 : e ?? bBe(t, "page-number"); } function vBe(e, t) { - const n = Rt(Zt), [r, o] = De(!1); + const n = Bt(tn), [r, o] = je(!1); return Ke(() => { const s = t.current; if (!e || !s) return; let i = !1, a; const c = () => { - const m = Gr(s.ownerDocument); + const m = Jr(s.ownerDocument); return i || m !== null && s.contains(m) && m.matches(":focus-visible") || s.querySelector('[aria-expanded="true"]') !== null; }, l = () => { o(!1), clearTimeout(a), a = setTimeout(u, yBe); @@ -80000,18 +80048,18 @@ function vBe(e, t) { function u() { c() ? l() : o(!0); } - const d = () => { + const f = () => { i = !0, l(); - }, f = () => { + }, d = () => { i = !1, l(); }, h = s.closest("[data-float]")?.offsetParent ?? null, g = { capture: !0, passive: !0 }; - h?.addEventListener("pointermove", l, g), h?.addEventListener("pointerdown", l, g), s.addEventListener("pointerenter", d), s.addEventListener("pointerleave", f), s.addEventListener("focusin", l); + h?.addEventListener("pointermove", l, g), h?.addEventListener("pointerdown", l, g), s.addEventListener("pointerenter", f), s.addEventListener("pointerleave", d), s.addEventListener("focusin", l); const p = n?.onCameraChanged(l); return l(), () => { - p?.(), h?.removeEventListener("pointermove", l, g), h?.removeEventListener("pointerdown", l, g), s.removeEventListener("pointerenter", d), s.removeEventListener("pointerleave", f), s.removeEventListener("focusin", l), clearTimeout(a), o(!1); + p?.(), h?.removeEventListener("pointermove", l, g), h?.removeEventListener("pointerdown", l, g), s.removeEventListener("pointerenter", f), s.removeEventListener("pointerleave", d), s.removeEventListener("focusin", l), clearTimeout(a), o(!1); }; }, [ e, @@ -80020,7 +80068,7 @@ function vBe(e, t) { ]), r; } function kBe(e) { - const [t, n] = De(S5e); + const [t, n] = je(S5e); return Ze(() => { const r = e.current; if (!r) return; @@ -80056,16 +80104,16 @@ function SBe(e, t) { }; } function xBe(e, t) { - const n = kx((u) => u.direction), [r, o] = De(null), [s, i] = De(ABe); + const n = kx((u) => u.direction), [r, o] = je(null), [s, i] = je(ABe); Ze(() => { const u = e.current; - return u ? iR(u, (d) => o(Math.round(d))) : void 0; + return u ? iR(u, (f) => o(Math.round(f))) : void 0; }, [e]); const a = t.touch === null; Ke(() => { if (!a || typeof matchMedia != "function") return; - const u = matchMedia(MJ), d = () => i(u.matches); - return u.addEventListener("change", d), () => u.removeEventListener("change", d); + const u = matchMedia(MJ), f = () => i(u.matches); + return u.addEventListener("change", f), () => u.removeEventListener("change", f); }, [a]); const c = t.size, l = t.touch ?? s; return ft(() => r === null ? null : { @@ -80081,11 +80129,11 @@ function xBe(e, t) { ]); } function EBe({ className: e, rootRef: t, children: n }) { - const r = Re(null), o = t ?? r, s = n5e(), [i] = De(() => SBe(s.size, s.touch)); + const r = Re(null), o = t ?? r, s = n5e(), [i] = je(() => SBe(s.size, s.touch)); Ke(() => { for (const C of i.problems) console.warn(`[embedpdf] ${C}`); }, [i]); - const a = xBe(o, i), c = a ?? MT, l = t5e(), u = ft(() => NPe(l, WRe, c), [l, c]), d = u.toJSON(), f = jr(), h = ar() ?? void 0, g = en(() => zPe(d, (C) => f.resolveCommand(C, h), (C) => f.getCommand(C)), fF), p = Re(/* @__PURE__ */ new Map()), m = ft(() => { + const a = xBe(o, i), c = a ?? MT, l = t5e(), u = ft(() => NPe(l, WRe, c), [l, c]), f = u.toJSON(), d = jr(), h = cr() ?? void 0, g = nn(() => zPe(f, (C) => d.resolveCommand(C, h), (C) => d.getCommand(C)), fF), p = Re(/* @__PURE__ */ new Map()), m = ft(() => { const C = (A, b) => { const E = JSON.stringify(b), I = p.current.get(A); return I?.key === E ? I.value : (p.current.set(A, { @@ -80093,26 +80141,26 @@ function EBe({ className: e, rootRef: t, children: n }) { value: b }), b); }, k = new Set(g), N = /* @__PURE__ */ new Map(); - for (const A of Object.keys(d.bars ?? {})) N.set(A, C(`bar:${A}`, CT(d, A, { omit: k }))); + for (const A of Object.keys(f.bars ?? {})) N.set(A, C(`bar:${A}`, CT(f, A, { omit: k }))); const w = (A) => N.get(A) ?? null, y = { - selection: C("strip:selection", XA(d, "selection", w)), - annotation: C("strip:annotation", XA(d, "annotation", w)), - snapshot: C("strip:snapshot", XA(d, "snapshot", w)) + selection: C("strip:selection", XA(f, "selection", w)), + annotation: C("strip:annotation", XA(f, "annotation", w)), + snapshot: C("strip:snapshot", XA(f, "snapshot", w)) }, x = /* @__PURE__ */ new Map(); - for (const A of Object.keys(d.menus ?? {})) x.set(A, C(`menu:${A}`, IT(d, A))); + for (const A of Object.keys(f.menus ?? {})) x.set(A, C(`menu:${A}`, IT(f, A))); return { - data: d, + data: f, env: c, bar: w, strip: (A) => y[A], menu: (A) => x.get(A) ?? null }; }, [ - d, + f, c, g - ]), v = en(() => Cm(d).map(Zl).filter((C) => !g.includes(C) && f.resolveCommand(C, h)?.visible === !0), fF); - CBe(hF(xRe(d), ERe)), IBe(hF(d.panels, mBe)), OBe(v), PBe(a === null ? null : u); + ]), v = nn(() => Im(f).map(eu).filter((C) => !g.includes(C) && d.resolveCommand(C, h)?.visible === !0), fF); + CBe(hF(xRe(f), ERe)), IBe(hF(f.panels, mBe)), OBe(v), PBe(a === null ? null : u); const S = kBe(o); return NBe(o, S.top && S.right && S.bottom && S.left), /* @__PURE__ */ P("div", { ref: o, @@ -80166,7 +80214,7 @@ function NBe(e, t) { ]); } function OBe(e) { - const t = jr(), n = Rt(dt), r = zt(dt, xx, null); + const t = jr(), n = Bt(dt), r = Gt(dt, xx, null); Ke(() => { r === null || e.includes(r) || (n?.close(r), t.execute(tv).catch(() => { })); @@ -80209,7 +80257,7 @@ const RBe = { insetStart: 0, insetEnd: 0, offset: 0 -}, al = (e) => e !== null && e.width > 0; +}, cl = (e) => e !== null && e.width > 0; function TBe(e, t, n, r) { const o = n + t / 2, s = e - r - t / 2; if (o > s) return null; @@ -80221,7 +80269,7 @@ function TBe(e, t, n, r) { }; } function MBe({ length: e, gap: t, start: n, middle: r, end: o }) { - const s = al(n) ? n.width + t : 0, i = al(o) ? o.width + t : 0, a = al(r) ? TBe(e, r.width, s, i) : null, c = al(r) && a === null ? r.height + t : 0, l = al(n) && al(o) && n.width + t + o.width > e; + const s = cl(n) ? n.width + t : 0, i = cl(o) ? o.width + t : 0, a = cl(r) ? TBe(e, r.width, s, i) : null, c = cl(r) && a === null ? r.height + t : 0, l = cl(n) && cl(o) && n.width + t + o.width > e; return { start: { ...Zi, @@ -80235,7 +80283,7 @@ function MBe({ length: e, gap: t, start: n, middle: r, end: o }) { }; } function BBe({ length: e, gap: t, start: n, end: r }) { - return al(n) && al(r) && n.width + t + r.width > e ? { + return cl(n) && cl(r) && n.width + t + r.width > e ? { start: { ...Zi, offset: r.height + t @@ -80252,17 +80300,17 @@ function BBe({ length: e, gap: t, start: n, end: r }) { }; } function t3(e) { - const t = jr(), n = ar() ?? void 0, r = ft(() => e ? eE(e) : null, [e]); - return en(() => r !== null && xT(r, (o) => { - const s = Sm(o); + const t = jr(), n = cr() ?? void 0, r = ft(() => e ? eE(e) : null, [e]); + return nn(() => r !== null && xT(r, (o) => { + const s = xm(o); return s !== null && t.resolveCommand(s, n)?.visible === !0; })); } function n3(e) { - const { data: t } = Ti(), n = zt(dt, xx, null); + const { data: t } = Ti(), n = Gt(dt, xx, null); return e.filter((r) => { const o = t.bars?.[r]?.mode; - return o === void 0 || n === Zl(o); + return o === void 0 || n === eu(o); }); } const _Be = { @@ -80327,15 +80375,15 @@ const BJ = Fn(() => { function VBe({ id: e, position: t }) { const { data: n, bar: r } = Ti(), o = r(e), s = t3(o), i = ft(() => o ? FBe(o, gF[t]) : null, [o, t]), a = Re(null), c = i !== null && s; Ke(() => c && a.current ? Zx(a.current) : void 0, [c]); - const l = vBe(c && wBe(DPe(n, e), o), a), u = Et(BJ); + const l = vBe(c && wBe(DPe(n, e), o), a), u = Ct(BJ); return Ze(() => { - let d = null; + let f = null; if (a.current?.querySelectorAll(':scope > [role="toolbar"] > div')?.forEach((h, g) => { - DBe[g] === gF[t] ? (h.setAttribute("part", cE(e)), d = h) : h.removeAttribute("part"); - }), d === null) return; - const f = iR(d, (h) => u(e, h)); + DBe[g] === gF[t] ? (h.setAttribute("part", cE(e)), f = h) : h.removeAttribute("part"); + }), f === null) return; + const d = iR(f, (h) => u(e, h)); return () => { - f(), u(e, null); + d(), u(e, null); }; }, [ c, @@ -80356,7 +80404,7 @@ function VBe({ id: e, position: t }) { }) }) : null; } -const $Be = 8, Al = 20, UBe = [ +const $Be = 8, Sl = 20, UBe = [ "top", "sides", "bottom" @@ -80365,25 +80413,25 @@ const $Be = 8, Al = 20, UBe = [ "middle", "end" ], HBe = { - top: { top: Al }, + top: { top: Sl }, sides: { - top: Al, - bottom: Al, + top: Sl, + bottom: Sl, display: "flex", flexDirection: "column", justifyContent: "center" }, - bottom: { bottom: Al } + bottom: { bottom: Sl } }, zBe = (e, t) => e === "top" || e === "sides" && t === "end" ? "paddingTop" : "paddingBottom"; function WBe() { - const e = Re(null), [t, n] = De(0); + const e = Re(null), [t, n] = je(0); return Ze(() => e.current ? iR(e.current, n) : void 0, []), /* @__PURE__ */ P(nt, { children: [/* @__PURE__ */ P("div", { ref: e, "aria-hidden": !0, className: "pointer-events-none absolute top-0 h-0", style: { - insetInlineStart: Al, - insetInlineEnd: Al + insetInlineStart: Sl, + insetInlineEnd: Sl } }), UBe.map((r) => /* @__PURE__ */ P(JBe, { row: r, @@ -80396,7 +80444,7 @@ const qBe = { end: null }, GBe = (e, t) => e === t || e !== null && t !== null && Math.abs(e.width - t.width) <= 0.5 && Math.abs(e.height - t.height) <= 0.5; function JBe({ row: e, length: t }) { - const { data: n } = Ti(), r = RBe[e], [o, s] = De(qBe), i = fi((c, l) => s((u) => GBe(u[c], l) ? u : { + const { data: n } = Ti(), r = RBe[e], [o, s] = je(qBe), i = fi((c, l) => s((u) => GBe(u[c], l) ? u : { ...u, [c]: l }), []), a = (e === "sides" ? BBe : MBe)({ @@ -80417,7 +80465,7 @@ function JBe({ row: e, length: t }) { }) }); } function YBe({ row: e, slot: t, position: n, stack: r, spot: o, onColumn: s }) { - const i = n3(r), a = Re(null), [c, l] = De(0), [u, d] = De(() => /* @__PURE__ */ new Map()), f = fi((p, m) => d((v) => { + const i = n3(r), a = Re(null), [c, l] = je(0), [u, f] = je(() => /* @__PURE__ */ new Map()), d = fi((p, m) => f((v) => { const S = v.get(p); if (m === null ? S === void 0 : S !== void 0 && Math.abs(S - m) <= 0.5) return v; const C = new Map(v); @@ -80440,15 +80488,15 @@ function YBe({ row: e, slot: t, position: n, stack: r, spot: o, onColumn: s }) { className: "pointer-events-none absolute", style: { ...HBe[e], - insetInlineStart: Al + o.insetStart, - insetInlineEnd: Al + o.insetEnd, + insetInlineStart: Sl + o.insetStart, + insetInlineEnd: Sl + o.insetEnd, [zBe(e, t)]: o.offset }, children: /* @__PURE__ */ P("div", { ref: a, className: `flex gap-2 ${e === "bottom" ? "flex-col-reverse" : "flex-col"}`, children: /* @__PURE__ */ P(BJ.Provider, { - value: f, + value: d, children: i.map((p) => /* @__PURE__ */ P(VBe, { id: p, position: n @@ -80561,7 +80609,7 @@ function s_e() { return Ke(() => o_e(), []), null; } function i_e({ cmd: e, run: t, emphasis: n }) { - const r = sr(Pg(e)), o = (s) => /* @__PURE__ */ P(nt, { children: [/* @__PURE__ */ P("button", { + const r = ir(Rg(e)), o = (s) => /* @__PURE__ */ P(nt, { children: [/* @__PURE__ */ P("button", { ...r.trigger, type: "button", onClick: t, @@ -80570,13 +80618,13 @@ function i_e({ cmd: e, run: t, emphasis: n }) { "aria-haspopup": e.menu ? "menu" : void 0, "aria-expanded": e.menu ? s : void 0, "aria-label": e.label, - part: Jr(s, n), - className: Ho(s, e.enabled, n), - children: e.icon && /* @__PURE__ */ P(Nt, { + part: Yr(s, n), + className: zo(s, e.enabled, n), + children: e.icon && /* @__PURE__ */ P(Rt, { name: e.icon, size: 20, accent: e.iconAccent, - className: Im(e.icon) + className: Nm(e.icon) }) }), r.element] }); return e.menu ? /* @__PURE__ */ P(iE, { @@ -80604,9 +80652,9 @@ function r3({ bar: e, view: t, label: n }) { }) }); } -const a_e = In(() => import("./link-editor-BQl5WwML-BMgM601I.js").then((e) => e.LinkEditorCard)); +const a_e = In(() => import("./link-editor-BQl5WwML-7K8D2W_R.js").then((e) => e.LinkEditorCard)); function c_e() { - const e = Tt(), t = BT("annotation"), n = VT(t), r = Pi("link-editor"), o = U0e((s) => s.selected); + const e = _t(), t = BT("annotation"), n = VT(t), r = Pi("link-editor"), o = U0e((s) => s.selected); return Ke(() => { !o.length && r.isOpen && r.close(); }, [o.length, r.isOpen]), !t || !n ? null : /* @__PURE__ */ P(z0e, { @@ -80620,9 +80668,9 @@ function c_e() { }); } function l_e() { - const e = ar(), { unlock: t, close: n } = pR(), r = c2((g) => g.documents), o = Tt(), [s, i] = De(""), [a, c] = De(!1), [l, u] = De(!1), d = r.find((g) => g.id === e); - if (!e || !d) return null; - const f = a || d.passwordProvided === !0, h = async () => { + const e = cr(), { unlock: t, close: n } = pR(), r = c2((g) => g.documents), o = _t(), [s, i] = je(""), [a, c] = je(!1), [l, u] = je(!1), f = r.find((g) => g.id === e); + if (!e || !f) return null; + const d = a || f.passwordProvided === !0, h = async () => { if (!(l || !s.trim())) { u(!0); try { @@ -80644,7 +80692,7 @@ function l_e() { children: [ /* @__PURE__ */ P("div", { className: "bg-accent-light mb-4 rounded-full p-4", - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "lock", size: 28, className: "text-accent" @@ -80654,15 +80702,15 @@ function l_e() { className: "text-fg text-lg font-semibold", children: o("passwordPrompt.title") }), - d.name && /* @__PURE__ */ P("p", { + f.name && /* @__PURE__ */ P("p", { className: "text-fg-muted mt-1 text-sm", - children: d.name + children: f.name }) ] }), /* @__PURE__ */ P("p", { className: "text-fg-secondary mt-4 text-center text-sm", - children: o(f ? "passwordPrompt.incorrect" : "passwordPrompt.required") + children: o(d ? "passwordPrompt.incorrect" : "passwordPrompt.required") }), /* @__PURE__ */ P("div", { className: "mt-5", @@ -80682,9 +80730,9 @@ function l_e() { autoFocus: !0 })] }), - f && /* @__PURE__ */ P("div", { + d && /* @__PURE__ */ P("div", { className: "mt-3 flex items-center gap-2 rounded-md border border-red-500/40 bg-red-500/10 p-3", - children: [/* @__PURE__ */ P(Nt, { + children: [/* @__PURE__ */ P(Rt, { name: "alertTriangle", size: 16, className: "flex-shrink-0 text-red-500" @@ -80728,7 +80776,7 @@ function xP(e) { } } function u_e() { - const e = ar(), { close: t, retry: n } = pR(), r = c2((i) => i.documents), o = Tt(), s = r.find((i) => i.id === e); + const e = cr(), { close: t, retry: n } = pR(), r = c2((i) => i.documents), o = _t(), s = r.find((i) => i.id === e); return !e || !s ? null : /* @__PURE__ */ P("div", { className: "bg-app flex h-full w-full items-center justify-center p-8", children: /* @__PURE__ */ P("div", { @@ -80737,7 +80785,7 @@ function u_e() { children: [ /* @__PURE__ */ P("div", { className: "mb-4 rounded-full bg-red-500/10 p-4", - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "alertTriangle", size: 28, className: "text-red-500" @@ -80776,26 +80824,26 @@ function u_e() { }); } function d_e({ className: e, children: t }) { - const n = Tt(), r = jr(), o = go(mP), s = o.visible && o.enabled, i = Re(0), [a, c] = De(!1), l = (d) => s && gG(d.dataTransfer), u = () => { + const n = _t(), r = jr(), o = mo(mP), s = o.visible && o.enabled, i = Re(0), [a, c] = je(!1), l = (f) => s && gG(f.dataTransfer), u = () => { i.current = 0, c(!1); }; return /* @__PURE__ */ P("div", { className: e, - onDragEnter: (d) => { - l(d) && (d.preventDefault(), i.current += 1, c(!0)); + onDragEnter: (f) => { + l(f) && (f.preventDefault(), i.current += 1, c(!0)); }, - onDragOver: (d) => { - l(d) && (d.preventDefault(), d.dataTransfer.dropEffect = "copy"); + onDragOver: (f) => { + l(f) && (f.preventDefault(), f.dataTransfer.dropEffect = "copy"); }, onDragLeave: () => { i.current !== 0 && (i.current -= 1, i.current === 0 && c(!1)); }, - onDrop: (d) => { - if (u(), !l(d)) return; - d.preventDefault(), d.stopPropagation(); - const f = Array.from(d.dataTransfer.files).filter(TT); - if (f.length === 0) return; - const h = { files: f }; + onDrop: (f) => { + if (u(), !l(f)) return; + f.preventDefault(), f.stopPropagation(); + const d = Array.from(f.dataTransfer.files).filter(TT); + if (d.length === 0) return; + const h = { files: d }; r.execute(mP, { args: h }).catch(() => { }); }, @@ -80814,9 +80862,9 @@ function f_e() { return e.isOpen ? /* @__PURE__ */ P(h_e, { onClose: e.close }) : null; } function h_e({ onClose: e }) { - const t = Tt(), n = xi(), r = Rt(Zt), o = um((d) => d.currentPageIndex + 1), s = um((d) => d.pageCount), [i, a] = De(() => String(o)), c = () => { - const d = Number.parseInt(i, 10); - Number.isFinite(d) && s > 0 && r?.goToPage(Math.min(Math.max(d, 1), s) - 1), e(); + const t = _t(), n = xi(), r = Bt(tn), o = dm((f) => f.currentPageIndex + 1), s = dm((f) => f.pageCount), [i, a] = je(() => String(o)), c = () => { + const f = Number.parseInt(i, 10); + Number.isFinite(f) && s > 0 && r?.goToPage(Math.min(Math.max(f, 1), s) - 1), e(); }, [l, u = ""] = t("pageNumber.page", { params: { current: "", total: s @@ -80826,8 +80874,8 @@ function h_e({ onClose: e }) { onClose: e, className: "border-border bg-surface w-80 rounded-lg border p-4 shadow-xl", children: /* @__PURE__ */ P("form", { - onSubmit: (d) => { - d.preventDefault(), c(); + onSubmit: (f) => { + f.preventDefault(), c(); }, children: [ /* @__PURE__ */ P("h2", { @@ -80844,8 +80892,8 @@ function h_e({ onClose: e }) { inputMode: "numeric", "aria-label": t("pageNumber.goToPage"), value: i, - onChange: (d) => a(d.target.value.replace(/[^0-9]/g, "")), - onFocus: (d) => d.currentTarget.select(), + onChange: (f) => a(f.target.value.replace(/[^0-9]/g, "")), + onFocus: (f) => f.currentTarget.select(), style: { width: `${String(s).length + 2}ch` }, className: "border-border bg-surface text-fg focus:border-accent focus:ring-accent rounded-md border px-1.5 py-1 text-center tabular-nums outline-none focus:ring-1" }), @@ -80870,7 +80918,7 @@ function h_e({ onClose: e }) { }); } function LJ({ small: e = !1 }) { - const t = Tt(), n = qo(), { status: r, slow: o } = rde(), s = r === "loading" && o; + const t = _t(), n = Go(), { status: r, slow: o } = rde(), s = r === "loading" && o; if (!s && !(r === "error" || r === "forbidden")) return null; const { viewScale: i, rotation: a } = n.transform, c = n.getViewDemand?.().visibleRect, l = c && c.width > 0 && c.height > 0 ? { x: (c.x + c.width / 2) * i, @@ -80886,14 +80934,14 @@ function LJ({ small: e = !1 }) { pointerEvents: "none" }; if (s) { - const d = e ? "h-5 w-5" : "h-8 w-8"; + const f = e ? "h-5 w-5" : "h-8 w-8"; return /* @__PURE__ */ P("div", { style: u, children: /* @__PURE__ */ P("div", { part: "page-loading", role: "status", "aria-label": t("demo.pageLoading", { params: { page: n.pageIndex + 1 } }), - className: `border-border-subtle border-t-accent ${d} rounded-full border-2 motion-safe:animate-spin` + className: `border-border-subtle border-t-accent ${f} rounded-full border-2 motion-safe:animate-spin` }) }); } @@ -80955,7 +81003,7 @@ function v_e(e) { return n === "sheet" ? /* @__PURE__ */ P(E_e, { ...e }) : n === "overlay" ? /* @__PURE__ */ P(x_e, { ...e }) : /* @__PURE__ */ P(A_e, { ...e }); } function i3({ title: e, header: t, onClose: n }) { - const r = Tt(); + const r = _t(); return /* @__PURE__ */ P("div", { part: "panel-header", "data-epdf-panel-header": "", @@ -80974,7 +81022,7 @@ function i3({ title: e, header: t, onClose: n }) { onClick: n, "aria-label": r("panel.close"), className: "text-fg-muted hover:bg-hover grid h-7 w-7 shrink-0 place-items-center rounded-md", - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "x", size: 16 }) @@ -80988,20 +81036,20 @@ function k_e(e) { return t || (t = /* @__PURE__ */ new Map(), mF.set(e, t)), t; } function a3(e, t) { - const n = k_e(Qa()), [, r] = Wl((i) => i + 1, 0); + const n = k_e(Qa()), [, r] = ql((i) => i + 1, 0); return [n.get(e) ?? t.initial, (i) => { n.get(e) !== i && (n.set(e, i), r()); }]; } function A_e({ id: e, side: t, width: n, resizable: r = !0, closable: o = !0, title: s, onClose: i, header: a, bars: c, children: l }) { - const u = oc(), d = xi(), f = o3(n), [h, g] = a3(e, f), p = uE(h, u.width, f), m = EG(), v = { + const u = oc(), f = xi(), d = o3(n), [h, g] = a3(e, d), p = uE(h, u.width, d), m = EG(), v = { side: t, dir: u.dir, viewerWidth: u.width, - widths: f + widths: d }; return /* @__PURE__ */ P("section", { - id: d, + id: f, role: "region", "aria-label": s, part: "panel", @@ -81021,7 +81069,7 @@ function A_e({ id: e, side: t, width: n, resizable: r = !0, closable: o = !0, ti children: l }), r && /* @__PURE__ */ P(jJ, { - regionId: d, + regionId: f, edge: v, title: s, width: p, @@ -81035,19 +81083,19 @@ function A_e({ id: e, side: t, width: n, resizable: r = !0, closable: o = !0, ti }); } function jJ({ regionId: e, edge: t, title: n, width: r, onWidth: o, onResized: s }) { - const i = Tt(), a = Re(null), c = (d) => { - d.pointerType === "mouse" && d.button !== 0 || (d.preventDefault(), d.currentTarget.setPointerCapture(d.pointerId), a.current = { - pointerId: d.pointerId, - startX: d.clientX, + const i = _t(), a = Re(null), c = (f) => { + f.pointerType === "mouse" && f.button !== 0 || (f.preventDefault(), f.currentTarget.setPointerCapture(f.pointerId), a.current = { + pointerId: f.pointerId, + startX: f.clientX, startWidth: r, width: r }); - }, l = (d) => { - const f = a.current; - !f || f.pointerId !== d.pointerId || (f.width = EP(f.startWidth, d.clientX - f.startX, t), o(f.width)); - }, u = (d) => { - const f = a.current; - f?.pointerId === d.pointerId && (a.current = null, f.width !== f.startWidth && s(f.width)); + }, l = (f) => { + const d = a.current; + !d || d.pointerId !== f.pointerId || (d.width = EP(d.startWidth, f.clientX - d.startX, t), o(d.width)); + }, u = (f) => { + const d = a.current; + d?.pointerId === f.pointerId && (a.current = null, d.width !== d.startWidth && s(d.width)); }; return /* @__PURE__ */ P("div", { role: "separator", @@ -81064,9 +81112,9 @@ function jJ({ regionId: e, edge: t, title: n, width: r, onWidth: o, onResized: s onPointerMove: l, onPointerUp: u, onPointerCancel: u, - onKeyDown: (d) => { - const f = w_e(r, d.key, d.shiftKey, t); - f !== null && (d.preventDefault(), f !== r && (o(f), s(f))); + onKeyDown: (f) => { + const d = w_e(r, f.key, f.shiftKey, t); + d !== null && (f.preventDefault(), d !== r && (o(d), s(d))); } }); } @@ -81075,11 +81123,11 @@ const S_e = { end: "end-0 border-s starting:translate-x-full rtl:starting:-translate-x-full" }; function x_e({ id: e, side: t, width: n, resizable: r = !0, title: o, onClose: s, header: i, bars: a, list: c, children: l }) { - const u = oc(), d = xi(), f = o3(n), [h, g] = a3(e, f), p = uE(h, u.width, f), m = EG(), v = { + const u = oc(), f = xi(), d = o3(n), [h, g] = a3(e, d), p = uE(h, u.width, d), m = EG(), v = { side: t, dir: u.dir, viewerWidth: u.width, - widths: f + widths: d }, S = Re(null), C = Re(s); return C.current = s, Ze(() => { const k = S.current; @@ -81096,7 +81144,7 @@ function x_e({ id: e, side: t, width: n, resizable: r = !0, title: o, onClose: s onClick: () => C.current() }), /* @__PURE__ */ P("section", { ref: S, - id: d, + id: f, role: "dialog", "aria-label": o, part: "panel", @@ -81120,7 +81168,7 @@ function x_e({ id: e, side: t, width: n, resizable: r = !0, title: o, onClose: s }) }), r && /* @__PURE__ */ P(jJ, { - regionId: d, + regionId: f, edge: v, title: o, width: p, @@ -81155,7 +81203,7 @@ function E_e({ id: e, width: t, title: n, onClose: r, header: o, bars: s, list: }); } function C_e({ id: e, side: t, title: n, onClose: r, children: o }) { - const s = Tt(), { size: i } = oc(), a = Re(null), c = Re(r); + const s = _t(), { size: i } = oc(), a = Re(null), c = Re(r); return c.current = r, Ze(() => { const l = a.current; if (!l) return; @@ -81183,7 +81231,7 @@ function C_e({ id: e, side: t, title: n, onClose: r, children: o }) { onClick: r, "aria-label": s("panel.close"), className: "text-fg-muted hover:bg-hover grid h-8 w-8 shrink-0 place-items-center rounded-md", - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "x", size: 16 }) @@ -81192,7 +81240,7 @@ function C_e({ id: e, side: t, title: n, onClose: r, children: o }) { }); } function I_e({ id: e, title: t, panels: n }) { - const r = Tt(), [o, s] = De(!1), i = sr({ label: r("panels.switch") }); + const r = _t(), [o, s] = je(!1), i = ir({ label: r("panels.switch") }); return /* @__PURE__ */ P("div", { className: "relative flex min-w-0", children: [ @@ -81207,7 +81255,7 @@ function I_e({ id: e, title: t, panels: n }) { children: [/* @__PURE__ */ P("span", { className: "truncate", children: t - }), /* @__PURE__ */ P(Nt, { + }), /* @__PURE__ */ P(Rt, { name: "chevronDown", size: 16, className: "text-fg-muted shrink-0" @@ -81229,7 +81277,7 @@ function I_e({ id: e, title: t, panels: n }) { }); } function N_e({ panel: e, current: t, onPicked: n }) { - const r = go(eu(e)); + const r = mo(tu(e)); return r.visible ? /* @__PURE__ */ P(Gv, { command: { ...r, @@ -81263,7 +81311,7 @@ function P_e(e, t, n, r, o) { for (const u of e) (!s || yF(u, t.x, t.y) < yF(s, t.x, t.y)) && (s = u); if (!s || o.has(s.page)) return null; const i = FJ(e) > 1, a = i ? t.x < s.x + s.width / 2 : t.y < s.y + s.height / 2, c = a ? { before: s.page } : { after: s.page }; - if (o.size > 0 && O_e(r, o, c).every((u, d) => u === r[d])) + if (o.size > 0 && O_e(r, o, c).every((u, f) => u === r[f])) return null; const l = n.gap / 2; return { @@ -81301,13 +81349,13 @@ function wF(e) { height: t.transform.viewHeight })); } -const UI = (e) => "before" in e ? { before: Lt(e.before) } : { after: Lt(e.after) }; +const UI = (e) => "before" in e ? { before: Ft(e.before) } : { after: Ft(e.after) }; function __e() { - const e = Tt(), t = xi(), n = y_(), r = y_(m0), o = um((W) => W.currentPageIndex), s = sle(), i = bde(), a = wde((W) => W.selected), c = jr(), l = go("page:insert-file"), u = go("page:insert-blank"), d = u.visible && u.enabled, f = J5e(), h = Re(null), [g, p] = De(null), [m, v] = De(null), [S, C] = De(!1), [k, N] = De(null), w = Re(null); + const e = _t(), t = xi(), n = y_(), r = y_(m0), o = dm((W) => W.currentPageIndex), s = sle(), i = bde(), a = wde((W) => W.selected), c = jr(), l = mo("page:insert-file"), u = mo("page:insert-blank"), f = u.visible && u.enabled, d = J5e(), h = Re(null), [g, p] = je(null), [m, v] = je(null), [S, C] = je(!1), [k, N] = je(null), w = Re(null); w.current = k; - const [y, x] = De(null), A = Re(null), b = Re(!1), E = s.map((W) => W.ref.objectNumber), I = (W) => W === null ? -1 : E.indexOf(W), O = new Set(a.map((W) => W.objectNumber)), T = I(g) >= 0 ? I(g) : o; + const [y, x] = je(null), A = Re(null), b = Re(!1), E = s.map((W) => W.ref.objectNumber), I = (W) => W === null ? -1 : E.indexOf(W), O = new Set(a.map((W) => W.objectNumber)), T = I(g) >= 0 ? I(g) : o; Ke(() => r.reveal(o), [o, r]); - const R = um((W) => W.pageCount, m0), M = a[a.length - 1]?.objectNumber ?? null, F = M === null ? -1 : E.indexOf(M); + const R = dm((W) => W.pageCount, m0), M = a[a.length - 1]?.objectNumber ?? null, F = M === null ? -1 : E.indexOf(M); Ke(() => { F >= 0 && F < R && r.reveal(F); }, [ @@ -81315,7 +81363,7 @@ function __e() { R, r ]); - const B = () => { + const _ = () => { const { gap: W, pageFrame: Se } = r.getSettings(); return { gap: typeof W == "object" && W !== null && "px" in W ? W.px : B_e, @@ -81329,31 +81377,31 @@ function __e() { } : null; }, D = (W, Se, Ae) => { const ce = $(W, Se); - return ce ? P_e(wF(r), ce, B(), E, Ae) : null; - }, _ = (W) => { - n.goToPage(W), f(); + return ce ? P_e(wF(r), ce, _(), E, Ae) : null; + }, B = (W) => { + n.goToPage(W), d(); }, L = (W) => i.select(W), j = (W, Se, Ae) => { if (b.current) { b.current = !1; return; } const ce = W.objectNumber; - if (p(ce), d && (Ae.metaKey || Ae.ctrlKey)) { + if (p(ce), f && (Ae.metaKey || Ae.ctrlKey)) { L(O.has(ce) ? a.filter((Ne) => Ne.objectNumber !== ce) : [...a, W]), v(ce); return; } - if (d && Ae.shiftKey && I(m) >= 0) { + if (f && Ae.shiftKey && I(m) >= 0) { const Ne = I(m), [K, U] = Ne < Se ? [Ne, Se] : [Se, Ne]; - L(s.slice(K, U + 1).map((Z) => Z.ref)); + L(s.slice(K, U + 1).map((X) => X.ref)); return; } - v(ce), d && L([W]), _(Se); + v(ce), f && L([W]), B(Se); }, H = (W) => { p(W.objectNumber), O.has(W.objectNumber) || L([W]); - }, Y = (W) => h.current?.querySelector(`[data-epdf-page-menu="${W}"] button`)?.click(), ue = () => { + }, Y = (W) => h.current?.querySelector(`[data-epdf-page-menu="${W}"] button`)?.click(), le = () => { A.current !== null && clearTimeout(A.current), A.current = null; - }, le = (W, Se) => { - if (!d || Se.button !== 0 || Se.target.closest("[data-epdf-page-menu]")) return; + }, ie = (W, Se) => { + if (!f || Se.button !== 0 || Se.target.closest("[data-epdf-page-menu]")) return; const Ae = W.objectNumber, ce = O.has(Ae) ? O : /* @__PURE__ */ new Set([Ae]); N({ pointerId: Se.pointerId, @@ -81371,16 +81419,16 @@ function __e() { held: !0 }); }, M_e)); - }, pe = k?.active === !0, ge = k !== null; + }, pe = k?.active === !0, ve = k !== null; Ke(() => { - if (!ge) return; + if (!ve) return; const W = (Ne) => { const K = w.current; if (!K || Ne.pointerId !== K.pointerId) return; if (!K.active) { if (Math.hypot(Ne.clientX - K.startX, Ne.clientY - K.startY) <= T_e) return; if (Ne.pointerType !== "mouse" && !K.held) { - ue(), N(null); + le(), N(null); return; } } @@ -81391,18 +81439,18 @@ function __e() { drop: D(Ne.clientX, Ne.clientY, K.moving) }); }, Se = (Ne, K) => { - ue(); + le(); const U = w.current; if (!U || Ne.pointerId !== U.pointerId) return; if (N(null), !U.active) { - U.held && K && (b.current = !0, H(Lt(U.page)), Y(U.page)); + U.held && K && (b.current = !0, H(Ft(U.page)), Y(U.page)); return; } if (b.current = !0, setTimeout(() => { b.current = !1; }, 0), !K || !U.drop) return; - const Z = s.filter((ne) => U.moving.has(ne.ref.objectNumber)); - i.reorder(Z.map((ne) => ne.ref), UI(U.drop.position)).catch(() => { + const X = s.filter((re) => U.moving.has(re.ref.objectNumber)); + i.reorder(X.map((re) => re.ref), UI(U.drop.position)).catch(() => { }); }, Ae = (Ne) => Se(Ne, !0), ce = (Ne) => Se(Ne, !1); return window.addEventListener("pointermove", W), window.addEventListener("pointerup", Ae), window.addEventListener("pointercancel", ce), () => { @@ -81412,16 +81460,16 @@ function __e() { if (!pe) return; const W = (Se) => Se.preventDefault(); return document.addEventListener("touchmove", W, { passive: !1 }), () => document.removeEventListener("touchmove", W); - }, [pe]), Ke(() => ue, []); - const Me = (W) => d && l.visible && l.enabled && gG(W.dataTransfer), Be = (W) => { - Me(W) && (W.preventDefault(), W.stopPropagation(), W.dataTransfer.dropEffect = "copy", x(D(W.clientX, W.clientY, /* @__PURE__ */ new Set()))); - }, te = (W) => { - if (!Me(W)) return; + }, [pe]), Ke(() => le, []); + const _e = (W) => f && l.visible && l.enabled && gG(W.dataTransfer), Be = (W) => { + _e(W) && (W.preventDefault(), W.stopPropagation(), W.dataTransfer.dropEffect = "copy", x(D(W.clientX, W.clientY, /* @__PURE__ */ new Set()))); + }, ee = (W) => { + if (!_e(W)) return; W.stopPropagation(); const Se = W.relatedTarget; (!Se || !h.current?.contains(Se)) && x(null); }, he = (W) => { - if (!Me(W)) return; + if (!_e(W)) return; W.preventDefault(), W.stopPropagation(); const Se = D(W.clientX, W.clientY, /* @__PURE__ */ new Set()); x(null); @@ -81436,7 +81484,7 @@ function __e() { }, Te = (W, Se) => { const Ae = s[W]; if (Ae) { - if (p(Ae.ref.objectNumber), r.reveal(W), !d) { + if (p(Ae.ref.objectNumber), r.reveal(W), !f) { n.goToPage(W); return; } @@ -81447,7 +81495,7 @@ function __e() { } v(Ae.ref.objectNumber), L([Ae.ref]), n.goToPage(W); } - }, ze = (W) => { + }, We = (W) => { if (W.target !== W.currentTarget || s.length === 0) return; C(!0); const Se = FJ(wF(r)), Ae = { @@ -81456,7 +81504,7 @@ function __e() { ArrowUp: -Se, ArrowDown: Se }[W.key], ce = W.metaKey || W.ctrlKey; - if (Ae !== void 0 && W.altKey && d) { + if (Ae !== void 0 && W.altKey && f) { W.preventDefault(); const Ne = R_e(E, O, Ae < 0 ? -1 : 1), K = s.filter((U) => O.has(U.ref.objectNumber)); Ne && K.length > 0 && i.reorder(K.map((U) => U.ref), UI(Ne)).catch(() => { @@ -81473,10 +81521,10 @@ function __e() { W.preventDefault(), Te(W.key === "Home" ? 0 : s.length - 1, W.shiftKey); return; case "Enter": - W.preventDefault(), _(T); + W.preventDefault(), B(T); return; case " ": { - if (!d) return; + if (!f) return; W.preventDefault(); const Ne = s[T]; if (!Ne) return; @@ -81486,51 +81534,51 @@ function __e() { } case "Delete": case "Backspace": - if (!d) return; + if (!f) return; W.preventDefault(), c.execute("page:delete").catch(() => { }); return; case "a": case "A": - if (!ce || !d) return; + if (!ce || !f) return; W.preventDefault(), c.execute("page:select-all").catch(() => { }); return; } - }, ae = s[T]?.ref ?? null, me = pe ? k.drop : y; + }, ae = s[T]?.ref ?? null, ge = pe ? k.drop : y; return /* @__PURE__ */ P("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ P("div", { ref: h, role: "listbox", "aria-label": e("panels.thumbnails"), - "aria-multiselectable": d || void 0, + "aria-multiselectable": f || void 0, tabIndex: 0, "aria-activedescendant": S && ae ? `${t}-${ae.objectNumber}` : void 0, - onKeyDown: ze, + onKeyDown: We, onFocus: (W) => W.target === W.currentTarget && C(W.currentTarget.matches(":focus-visible")), onBlur: (W) => W.target === W.currentTarget && C(!1), onDragEnter: Be, onDragOver: Be, - onDragLeave: te, + onDragLeave: ee, onDrop: he, className: "focus-visible:ring-accent relative flex min-h-0 flex-1 flex-col outline-none focus-visible:ring-2 focus-visible:ring-inset", children: /* @__PURE__ */ P(O9, { token: m0, className: "flex-1", style: { position: "relative" }, - overlay: /* @__PURE__ */ P(nt, { children: [me && /* @__PURE__ */ P("div", { + overlay: /* @__PURE__ */ P(nt, { children: [ge && /* @__PURE__ */ P("div", { "aria-hidden": !0, className: "bg-accent pointer-events-none absolute rounded-full", style: { - left: me.line.x, - top: me.line.y, - width: me.line.width, - height: me.line.height + left: ge.line.x, + top: ge.line.y, + width: ge.line.width, + height: ge.line.height } }), /* @__PURE__ */ P(IN, { axis: "y" })] }), pageChrome: (W) => { - const Se = W.ref.objectNumber, Ae = d && O.has(Se), ce = W.pageIndex === o, Ne = S && ae?.objectNumber === Se, K = pe && k.moving.has(Se); + const Se = W.ref.objectNumber, Ae = f && O.has(Se), ce = W.pageIndex === o, Ne = S && ae?.objectNumber === Se, K = pe && k.moving.has(Se); return /* @__PURE__ */ P("div", { className: "group", style: { @@ -81542,13 +81590,13 @@ function __e() { label: e("thumbnails.page", { params: { page: W.pageIndex + 1 } }), id: `${t}-${Se}`, role: "option", - "aria-selected": d ? Ae : ce, + "aria-selected": f ? Ae : ce, "aria-current": ce ? "page" : void 0, tabIndex: -1, onClick: (U) => j(W.ref, W.pageIndex, U), - onPointerDown: (U) => le(W.ref, U), + onPointerDown: (U) => ie(W.ref, U), onContextMenu: (U) => { - d && (U.preventDefault(), H(W.ref), Y(Se)); + f && (U.preventDefault(), H(W.ref), Y(Se)); }, className: `box-border cursor-pointer touch-manipulation rounded ${Ae || ce ? "border-accent border-2" : "border-border-subtle border"} ${ce ? "ring-accent-light ring-2" : ""} ${Ae ? "bg-accent/10" : ""} ${Ne ? "outline-accent outline outline-2 outline-offset-2" : ""} ${K ? "bg-surface/60" : ""}`, style: { @@ -81559,7 +81607,7 @@ function __e() { bottom: W.frame.bottom } }), - d && /* @__PURE__ */ P("span", { + f && /* @__PURE__ */ P("span", { "data-epdf-page-menu": Se, onClick: (U) => U.stopPropagation(), onPointerDownCapture: () => H(W.ref), @@ -81595,14 +81643,14 @@ function __e() { }); } function L_e() { - const e = go("menu:page"); + const e = mo("menu:page"); return e.visible ? /* @__PURE__ */ P(lE, { cmd: e, variant: "icon", run: () => void e.run() }) : null; } -const D_e = In(() => import("./search-panel-BsY-2v13-ZjlYoC7t.js").then((e) => e.SearchPanel)), j_e = In(() => import("./search-panel-BsY-2v13-ZjlYoC7t.js").then((e) => e.FindBar)), F_e = In(() => import("./comments-panel-BJ1GRhZ0-BOiDUolf.js").then((e) => e.CommentsPanel)), V_e = In(() => import("./measurement-6M_KEsFK-ARa1M4UB.js").then((e) => e.MeasurementSection)), $_e = In(() => import("./annotation-style-BZv7nj7j-BDYrzgLn.js").then((e) => e.AnnotationStylePanel)), U_e = In(() => import("./stamps-panel-BfRJ9uBl-Cs7BhHXt.js").then((e) => e.StampsPanel)), K_e = In(() => import("./signatures-panel-smWbAS42-BS1McmH7.js").then((e) => e.SignaturesPanel)), H_e = In(() => import("./redaction-panel-Djm12Ydh-D9gDjih9.js").then((e) => e.RedactionPanel)), z_e = In(() => import("./outline-panel-BfusJ14a-CrwTtYxN.js").then((e) => e.OutlinePanel)), W_e = In(() => import("./attachments-panel-CBvOCDpU-DcNUtnoD.js").then((e) => e.AttachmentsPanel)), q_e = In(() => import("./form-design-panel-B4qGH4r--T0yv-8g7.js").then((e) => e.FormDesignPanel)), VJ = /* @__PURE__ */ new Map([ +const D_e = In(() => import("./search-panel-BsY-2v13-BzjGBsPo.js").then((e) => e.SearchPanel)), j_e = In(() => import("./search-panel-BsY-2v13-BzjGBsPo.js").then((e) => e.FindBar)), F_e = In(() => import("./comments-panel-BJ1GRhZ0-MnxRXHtZ.js").then((e) => e.CommentsPanel)), V_e = In(() => import("./measurement-6M_KEsFK-DhJ1Dnhv.js").then((e) => e.MeasurementSection)), $_e = In(() => import("./annotation-style-BZv7nj7j-z_uZITv9.js").then((e) => e.AnnotationStylePanel)), U_e = In(() => import("./stamps-panel-BfRJ9uBl-CcPfGL64.js").then((e) => e.StampsPanel)), K_e = In(() => import("./signatures-panel-smWbAS42-C8ccrvhV.js").then((e) => e.SignaturesPanel)), H_e = In(() => import("./redaction-panel-Djm12Ydh-BY55F6C2.js").then((e) => e.RedactionPanel)), z_e = In(() => import("./outline-panel-BfusJ14a-awUDJM2i.js").then((e) => e.OutlinePanel)), W_e = In(() => import("./attachments-panel-CBvOCDpU-B7OO6xRT.js").then((e) => e.AttachmentsPanel)), q_e = In(() => import("./form-design-panel-B4qGH4r--CLCbLmeD.js").then((e) => e.FormDesignPanel)), VJ = /* @__PURE__ */ new Map([ ["thumbnails", { draw: () => /* @__PURE__ */ P(__e, {}), list: !0 @@ -81640,29 +81688,29 @@ function Y_e(e, t) { }, vF.set(e, n)), n[t]; } function kF({ side: e }) { - const { data: t, env: n } = Ti(), r = jr(), o = Rt(dt), s = ar(), i = ft(() => dBe(t, e), [t, e]), { shown: a, off: c, open: l, bars: u } = en((f) => { - const h = (g) => r.resolveCommand(eu(g), s ?? void 0)?.visible; + const { data: t, env: n } = Ti(), r = jr(), o = Bt(dt), s = cr(), i = ft(() => dBe(t, e), [t, e]), { shown: a, off: c, open: l, bars: u } = nn((d) => { + const h = (g) => r.resolveCommand(tu(g), s ?? void 0)?.visible; return { shown: i.filter((g) => h(g) === !0), off: i.filter((g) => h(g) === !1), open: o ? i.filter((g) => o.isOpen(g)) : G_e, - bars: i.filter((g) => VJ.get(g)?.bar?.when(f, s) === !0) + bars: i.filter((g) => VJ.get(g)?.bar?.when(d, s) === !0) }; }, J_e); - uRe((f) => f.onSurfaceOpened, (f) => { - if (!(!o || !i.includes(f.id))) - for (const h of i) h !== f.id && o.isOpen(h) && o.close(h); + uRe((d) => d.onSurfaceOpened, (d) => { + if (!(!o || !i.includes(d.id))) + for (const h of i) h !== d.id && o.isOpen(h) && o.close(h); }); - const d = l.find((f) => a.includes(f)) ?? null; + const f = l.find((d) => a.includes(d)) ?? null; return Ze(() => { if (!o) return; - for (const p of l) p !== d && (d !== null || c.includes(p)) && o.close(p); + for (const p of l) p !== f && (f !== null || c.includes(p)) && o.close(p); if (n === MT) return; - const f = t.panels ?? {}, h = Y_e(o, e), g = fBe(f, { + const d = t.panels ?? {}, h = Y_e(o, e), g = fBe(d, { ids: i, shown: a, - current: d, - docks: (p) => y_e(n.size, f[p]?.present) && !u.includes(p) + current: f, + docks: (p) => y_e(n.size, d[p]?.present) && !u.includes(p) }, h); for (const p of g.started) h.add(p); g.open !== null && o.open(g.open); @@ -81676,15 +81724,15 @@ function kF({ side: e }) { l, c, u, - d - ]), d === null ? null : /* @__PURE__ */ P(Q_e, { - id: d, + f + ]), f === null ? null : /* @__PURE__ */ P(Q_e, { + id: f, side: e, siblings: a - }, d); + }, f); } function Q_e({ id: e, side: t, siblings: n }) { - const r = Ti().data.panels?.[e], o = jr(), s = Rt(dt), i = ar(), a = VJ.get(e), c = en((d) => a?.bar?.when(d, i) === !0), l = en(() => o.resolveCommand(eu(e), i ?? void 0)?.label ?? null); + const r = Ti().data.panels?.[e], o = jr(), s = Bt(dt), i = cr(), a = VJ.get(e), c = nn((f) => a?.bar?.when(f, i) === !0), l = nn(() => o.resolveCommand(tu(e), i ?? void 0)?.label ?? null); if (!r) return null; const u = l ?? r.title ?? e; return c ? /* @__PURE__ */ P(C_e, { @@ -81752,7 +81800,7 @@ function Z_e(e, t) { ]); } function $J({ icon: e, label: t }) { - return e ? /* @__PURE__ */ P(Nt, { + return e ? /* @__PURE__ */ P(Rt, { name: e, size: 20 }) : /* @__PURE__ */ P("span", { @@ -81761,7 +81809,7 @@ function $J({ icon: e, label: t }) { }); } function eLe({ host: e, commandId: t, active: n }) { - const r = go(t); + const r = mo(t); return Z_e(e, r), r.visible ? /* @__PURE__ */ P(lE, { cmd: n ? { ...r, @@ -81772,7 +81820,7 @@ function eLe({ host: e, commandId: t, active: n }) { }) : null; } function tLe({ icon: e, label: t, active: n }) { - const r = sr(t ? { + const r = ir(t ? { label: t, labelShown: !e } : null); @@ -81781,8 +81829,8 @@ function tLe({ icon: e, label: t, active: n }) { type: "button", "aria-label": t ?? void 0, "aria-pressed": n || void 0, - part: Jr(n), - className: Ho(n), + part: Yr(n), + className: zo(n), children: /* @__PURE__ */ P($J, { icon: e, label: t @@ -81812,7 +81860,7 @@ const rLe = (e) => ({ categories: [] }); function oLe({ item: e, commandId: t, onPicked: n }) { - const r = go(t); + const r = mo(t); if (!r.visible) return null; const o = { ...r, @@ -81829,7 +81877,7 @@ function oLe({ item: e, commandId: t, onPicked: n }) { }); } function sLe({ menu: e }) { - const [t, n] = De(!1), r = () => n(!1), o = sr(e.label ? { + const [t, n] = je(!1), r = () => n(!1), o = ir(e.label ? { label: e.label, labelShown: !e.icon } : null); @@ -81842,8 +81890,8 @@ function sLe({ menu: e }) { "aria-haspopup": "menu", "aria-expanded": t, "aria-label": e.label ?? void 0, - part: Jr(t), - className: Ho(t), + part: Yr(t), + className: zo(t), onClick: () => n((s) => !s), children: /* @__PURE__ */ P($J, { icon: e.icon, @@ -81872,7 +81920,7 @@ function sLe({ menu: e }) { }); } function iLe({ icon: e }) { - return e.icon ? /* @__PURE__ */ P(Nt, { + return e.icon ? /* @__PURE__ */ P(Rt, { name: e.icon, size: e.size ?? 20, title: e.label ?? void 0, @@ -81894,7 +81942,7 @@ function lLe({ components: e }) { } const uLe = 2500; function dLe() { - const e = Tt(), [t, n] = De(null), r = fi((o) => n((s) => ({ + const e = _t(), [t, n] = je(null), r = fi((o) => n((s) => ({ message: o, count: (s?.count ?? 0) + 1 })), []); @@ -81925,7 +81973,7 @@ function fLe() { } const hLe = 12, pLe = 38; function gLe() { - const e = Tt(), { touch: t } = oc(), n = BT("selection"), r = VT(n); + const e = _t(), { touch: t } = oc(), n = BT("selection"), r = VT(n); return !n || !r ? null : /* @__PURE__ */ P(Ufe, { placement: "bottom", gap: t ? pLe : hLe, @@ -81938,7 +81986,7 @@ function gLe() { } const mLe = 12; function yLe() { - const e = Tt(), t = BT("snapshot"), n = VT(t); + const e = _t(), t = BT("snapshot"), n = VT(t); return !t || !n ? null : /* @__PURE__ */ P(lde, { placement: "bottom", gap: mLe, @@ -82006,7 +82054,7 @@ function kLe() { return e.isOpen ? /* @__PURE__ */ P(ALe, { onClose: e.close }) : null; } function ALe({ onClose: e }) { - const t = Tt(), n = xi(), r = jr(), o = ar() ?? void 0, s = en(() => wLe(r, o), vLe), i = pv(); + const t = _t(), n = xi(), r = jr(), o = cr() ?? void 0, s = nn(() => wLe(r, o), vLe), i = pv(); return /* @__PURE__ */ P(GT, { labelledBy: n, onClose: e, @@ -82023,7 +82071,7 @@ function ALe({ onClose: e }) { label: t("panel.close"), onClick: e, className: "text-fg-muted hover:bg-hover hover:text-fg grid h-7 w-7 place-items-center rounded-md", - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "x", size: 16 }) @@ -82080,7 +82128,7 @@ function ELe() { }, [e, t]), null; } function CLe({ name: e, onCancel: t, onClose: n }) { - const r = Tt(), o = xi(); + const r = _t(), o = xi(); return /* @__PURE__ */ P(GT, { labelledBy: o, onClose: t, @@ -82113,7 +82161,7 @@ function CLe({ name: e, onCancel: t, onClose: n }) { }); } function ILe({ visibility: e }) { - const { setActive: t, close: n } = pR(), { documents: r, activeId: o } = c2(), s = Tt(), [i, a] = De(null); + const { setActive: t, close: n } = pR(), { documents: r, activeId: o } = c2(), s = _t(), [i, a] = je(null); if (!(e === "always" || e === "multiple" && r.length > 1)) return null; const c = (l, u) => { l.hasUnsavedChanges ? a({ @@ -82126,15 +82174,15 @@ function ILe({ visibility: e }) { children: [/* @__PURE__ */ P("div", { className: "flex flex-1 items-end overflow-x-auto pl-4", children: r.map((l) => { - const u = o === l.id, d = l.name ?? s("tabs.untitled", { params: { id: l.id.slice(0, 8) } }); + const u = o === l.id, f = l.name ?? s("tabs.untitled", { params: { id: l.id.slice(0, 8) } }); return /* @__PURE__ */ P("div", { onClick: () => t(l.id), role: "tab", part: u ? "tab tab-active" : "tab", tabIndex: 0, "aria-selected": u, - onKeyDown: (f) => { - (f.key === "Enter" || f.key === " ") && (f.preventDefault(), t(l.id)); + onKeyDown: (d) => { + (d.key === "Enter" || d.key === " ") && (d.preventDefault(), t(l.id)); }, className: `group relative flex min-w-[120px] max-w-[240px] cursor-pointer items-center gap-2 rounded-t-lg px-4 py-2 text-sm font-medium transition-all ${u ? "bg-surface text-fg z-10" : "bg-surface-alt text-fg-secondary hover:bg-hover hover:text-fg"}`, children: [ @@ -82142,24 +82190,24 @@ function ILe({ visibility: e }) { className: "border-border-subtle border-t-accent h-3 w-3 flex-shrink-0 animate-spin rounded-full border", "aria-label": s("tabs.loading") }), - l.status === "locked" && /* @__PURE__ */ P(Nt, { + l.status === "locked" && /* @__PURE__ */ P(Rt, { name: "lock", size: 13, className: "text-fg-muted flex-shrink-0" }), - l.status === "error" && l.openRequest && /* @__PURE__ */ P(Nt, { + l.status === "error" && l.openRequest && /* @__PURE__ */ P(Rt, { name: "lock", size: 13, className: "text-fg-muted flex-shrink-0" }), l.status === "error" && !l.openRequest && /* @__PURE__ */ P(sE, { content: { label: s(xP(l.error)) }, - children: (f) => /* @__PURE__ */ P("span", { - ...f, + children: (d) => /* @__PURE__ */ P("span", { + ...d, className: "flex flex-shrink-0", role: "img", "aria-label": s(xP(l.error)), - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "alertTriangle", size: 13, className: "text-red-500" @@ -82168,16 +82216,16 @@ function ILe({ visibility: e }) { }), /* @__PURE__ */ P("span", { className: "min-w-0 flex-1 truncate", - children: d + children: f }), u && r.length > 1 && /* @__PURE__ */ P("button", { type: "button", - onClick: (f) => { - f.stopPropagation(), c(l, d); + onClick: (d) => { + d.stopPropagation(), c(l, f); }, - "aria-label": s("tabs.close", { params: { name: d } }), + "aria-label": s("tabs.close", { params: { name: f } }), className: "hover:bg-hover flex-shrink-0 cursor-pointer rounded-full p-1 opacity-100 transition-all", - children: /* @__PURE__ */ P(Nt, { + children: /* @__PURE__ */ P(Rt, { name: "x", size: 14 }) @@ -82214,7 +82262,7 @@ function OLe(e, t, n) { ["stroke-dasharray", a.strokeDasharray], ["stroke-opacity", a.strokeOpacity], ["fill-opacity", a.fillOpacity] - ].filter(([, d]) => d !== void 0).map(([d, f]) => `${d}="${f}"`).join(" "); + ].filter(([, f]) => f !== void 0).map(([f, d]) => `${f}="${d}"`).join(" "); s.push(``); } return o.join("") + s.join(""); @@ -82234,7 +82282,7 @@ const TLe = { copy: "plus" }; function MLe() { - const e = kfe((i) => i.activeToolId) ?? "pointer", t = cve(e), n = CG(), r = ive().tools.get(e)?.ghost ? void 0 : Ng[e], o = (i) => t[i] ?? void 0, s = r?.accent ? { + const e = kfe((i) => i.activeToolId) ?? "pointer", t = cve(e), n = CG(), r = ive().tools.get(e)?.ghost ? void 0 : Og[e], o = (i) => t[i] ?? void 0, s = r?.accent ? { primary: o(r.accent.primary), secondary: r.accent.secondary ? o(r.accent.secondary) : void 0 } : void 0; @@ -82246,10 +82294,10 @@ function MLe() { }])) } : null), null; } -const BLe = () => Pi("redact-confirm").isOpen, _Le = () => $1e((e) => e.calibrationRequest !== null), LLe = () => Pi("signature-sign").isOpen, DLe = () => Pi("signature-maker").isOpen, jLe = () => Pi("signature-inspector").isOpen, FLe = () => Pi("print").isOpen, VLe = In(() => import("./redact-confirm-C0AI8Tbt-DoYTi75M.js").then((e) => e.RedactConfirmModal), { shownWhile: BLe }), $Le = In(() => import("./measurement-6M_KEsFK-ARa1M4UB.js").then((e) => e.CalibrationDialog), { shownWhile: _Le }), ULe = In(() => import("./sign-dialog-BZ-u3DaO-DUNRfJDM.js").then((e) => e.SignDialog), { shownWhile: LLe }), KLe = In(() => import("./signature-maker-Lp7uuutB-fK8F7XzG.js").then((e) => e.SignatureMakerModal), { shownWhile: DLe }), HLe = In(() => import("./signature-inspector-DgkYwQHv-B4iHMa4u.js").then((e) => e.SignatureInspector), { shownWhile: jLe }), zLe = In(() => import("./print-dialog-DPur4IlU-0p7zQEeK.js").then((e) => e.PrintDialog), { shownWhile: FLe }), WLe = () => Pi(mG).isOpen, CF = In(() => import("./grant-prompt-Co4bzHaR-ibAjp4kO.js").then((e) => e.GrantPrompt), { prefetch: !1 }), qLe = () => IS((e) => e.identityRequest !== void 0), GLe = In(() => import("./grant-prompt-Co4bzHaR-ibAjp4kO.js").then((e) => e.VisitorIdentityDialog), { +const BLe = () => Pi("redact-confirm").isOpen, _Le = () => $1e((e) => e.calibrationRequest !== null), LLe = () => Pi("signature-sign").isOpen, DLe = () => Pi("signature-maker").isOpen, jLe = () => Pi("signature-inspector").isOpen, FLe = () => Pi("print").isOpen, VLe = In(() => import("./redact-confirm-C0AI8Tbt-BhOcPITJ.js").then((e) => e.RedactConfirmModal), { shownWhile: BLe }), $Le = In(() => import("./measurement-6M_KEsFK-DhJ1Dnhv.js").then((e) => e.CalibrationDialog), { shownWhile: _Le }), ULe = In(() => import("./sign-dialog-BZ-u3DaO-A_aSCrL7.js").then((e) => e.SignDialog), { shownWhile: LLe }), KLe = In(() => import("./signature-maker-Lp7uuutB-qzUGKTPq.js").then((e) => e.SignatureMakerModal), { shownWhile: DLe }), HLe = In(() => import("./signature-inspector-DgkYwQHv-DecD2jME.js").then((e) => e.SignatureInspector), { shownWhile: jLe }), zLe = In(() => import("./print-dialog-DPur4IlU-D6FsF7fz.js").then((e) => e.PrintDialog), { shownWhile: FLe }), WLe = () => Pi(mG).isOpen, CF = In(() => import("./grant-prompt-Co4bzHaR-EijIs4Sr.js").then((e) => e.GrantPrompt), { prefetch: !1 }), qLe = () => IS((e) => e.identityRequest !== void 0), GLe = In(() => import("./grant-prompt-Co4bzHaR-EijIs4Sr.js").then((e) => e.VisitorIdentityDialog), { shownWhile: qLe, prefetch: !1 -}), JLe = In(() => import("./outline-properties-D2EBON1r-Lwj1vkS_.js").then((e) => e.OutlinePropertiesDialog), { shownWhile: WLe }); +}), JLe = In(() => import("./outline-properties-D2EBON1r-CMs5r_jq.js").then((e) => e.OutlinePropertiesDialog), { shownWhile: WLe }); function YLe() { const e = KPe(Ti().data); return e === "never" ? null : /* @__PURE__ */ P("slot", { @@ -82258,7 +82306,7 @@ function YLe() { }); } function QLe() { - const e = Tt(); + const e = _t(); return /* @__PURE__ */ P("div", { className: "grid h-full w-full place-items-center", children: /* @__PURE__ */ P("div", { @@ -82271,7 +82319,7 @@ function QLe() { }); } function XLe({ children: e }) { - const t = ar(), n = IS((o) => o.status), r = IS((o) => o.openRequest !== void 0); + const t = cr(), n = IS((o) => o.status), r = IS((o) => o.openRequest !== void 0); return t === null ? /* @__PURE__ */ P("div", { className: "min-w-0 flex-1 overflow-auto", children: /* @__PURE__ */ P("slot", { name: "empty" }) @@ -82405,17 +82453,17 @@ function KJ(e, t, n) { function nDe({ registered: e, settings: t, yours: n, locale: r, features: o, disable: s, readOnly: i, appState: a }) { const c = Qa(), l = Re(e); return Ze(() => { - const { disabled: u, byHand: d } = KJ({ + const { disabled: u, byHand: f } = KJ({ features: o, disable: s, readOnly: i - }, n, t), f = l.current; + }, n, t), d = l.current; l.current = { locale: r, disabled: u, - byHand: d, + byHand: f, appState: a - }, Object.is(f.appState, a) || c.capability(bo).updateSettings({ appState: a }), Gj(f.byHand.editable, d.editable) || c.settingsOf(vt).updateSettings({ editable: d.editable }), Gj(f.byHand.fillable, d.fillable) || c.settingsOf(Ss).updateSettings({ fillable: d.fillable }), (!NF(f.disabled.disabledCategories, u.disabledCategories) || !NF(f.disabled.disabledCommands, u.disabledCommands)) && c.capability(bo).updateSettings(u), f.locale !== r && c.capability(vo).setLocale(r).catch(() => { + }, Object.is(d.appState, a) || c.capability(wo).updateSettings({ appState: a }), Gj(d.byHand.editable, f.editable) || c.settingsOf(vt).updateSettings({ editable: f.editable }), Gj(d.byHand.fillable, f.fillable) || c.settingsOf(Ss).updateSettings({ fillable: f.fillable }), (!NF(d.disabled.disabledCategories, u.disabledCategories) || !NF(d.disabled.disabledCommands, u.disabledCommands)) && c.capability(wo).updateSettings(u), d.locale !== r && c.capability(ko).setLocale(r).catch(() => { }); }), null; } @@ -82424,21 +82472,21 @@ function rDe() { className: "bg-app text-fg-muted grid h-full place-items-center", children: /* @__PURE__ */ P("div", { className: "animate-pulse text-sm", - children: Tt()("demo.starting") + children: _t()("demo.starting") }) }); } -function OF({ engine: e, initialDocuments: t, fetch: n, fallback: r, commands: o, appState: s, icons: i, strings: a, locale: c = "auto", features: l, disable: u, readOnly: d, scope: f, identity: h, notAllowed: g, layout: p, size: m, touch: v, plugins: S, fonts: C, warnBeforeLeaving: k, theme: N, themeTarget: w, components: y, onReady: x, onDocumentChange: A, onPanelResize: b }) { - const [E] = De(rJ), [I] = De(() => { - const M = eBe(S), { locales: F, loaders: B, codes: $ } = k5e(a), D = M.settings.i18n?.fallbackLocale, _ = g5e(D, $), L = _ === null ? [`the viewer has no language "${D}" to fall back to, so it falls back to English: give its words in \`strings\``] : [], j = { ...QT }; - for (const { name: pe, plugin: ge } of M.own) ge.token && (j[pe] = ge.token); - const H = JMe(j), Y = new Set(Pj.map((pe) => pe.id)), ue = ZRe([...Pj, ...zRe(M.settings.annotation?.tools ?? [], (pe) => Y.has(pe))], o ?? [], { +function OF({ engine: e, initialDocuments: t, fetch: n, fallback: r, commands: o, appState: s, icons: i, strings: a, locale: c = "auto", features: l, disable: u, readOnly: f, scope: d, identity: h, notAllowed: g, layout: p, size: m, touch: v, plugins: S, fonts: C, warnBeforeLeaving: k, theme: N, themeTarget: w, components: y, onReady: x, onDocumentChange: A, onPanelResize: b }) { + const [E] = je(rJ), [I] = je(() => { + const M = eBe(S), { locales: F, loaders: _, codes: $ } = k5e(a), D = M.settings.i18n?.fallbackLocale, B = g5e(D, $), L = B === null ? [`the viewer has no language "${D}" to fall back to, so it falls back to English: give its words in \`strings\``] : [], j = { ...QT }; + for (const { name: pe, plugin: ve } of M.own) ve.token && (j[pe] = ve.token); + const H = JMe(j), Y = new Set(Pj.map((pe) => pe.id)), le = ZRe([...Pj, ...zRe(M.settings.annotation?.tools ?? [], (pe) => Y.has(pe))], o ?? [], { plugins: j, viewer: H.current - }, { isMac: pv() }), le = (o ?? []).flatMap((pe) => pe.categories ?? []); + }, { isMac: pv() }), ie = (o ?? []).flatMap((pe) => pe.categories ?? []); return { slot: H, - viewerCommands: ue, + viewerCommands: le, layout: p, size: m, touch: v, @@ -82450,22 +82498,22 @@ function OF({ engine: e, initialDocuments: t, fetch: n, fallback: r, commands: o onPanelResize: b, i18n: { locales: F, - loaders: B, + loaders: _, codes: $, - fallback: _ ?? "en", - initial: _j(c, $, _ ?? "en") + fallback: B ?? "en", + initial: _j(c, $, B ?? "en") }, plugins: { ...M, problems: [...M.problems, ...L] }, tokens: j, - yourCategories: le, + yourCategories: ie, ...KJ({ features: l, disable: u, - readOnly: d - }, le, M.settings), + readOnly: f + }, ie, M.settings), appState: s }; }); @@ -82476,7 +82524,7 @@ function OF({ engine: e, initialDocuments: t, fetch: n, fallback: r, commands: o for (const M of bTe(l, I.yourCategories)) IF.has(M) || (IF.add(M), console.warn(`[embedpdf] features: no feature or part is called "${M}"`)); }, [l, I]); - const { settings: O } = I.plugins, [T] = De(() => [ + const { settings: O } = I.plugins, [T] = je(() => [ g_(lF({ layout: "vertical" }, O.stage)), g_({ layout: "grid", @@ -82586,7 +82634,7 @@ function OF({ engine: e, initialDocuments: t, fetch: n, fallback: r, commands: o plugins: T, initialDocuments: t, fetch: n, - scope: f, + scope: d, identity: h, fallback: r ?? /* @__PURE__ */ P(rDe, {}), onReady: (M) => void I.slot.attach(M), @@ -82605,7 +82653,7 @@ function OF({ engine: e, initialDocuments: t, fetch: n, fallback: r, commands: o locale: _j(c, I.i18n.codes, I.i18n.fallback), features: l, disable: u, - readOnly: d, + readOnly: f, appState: s }), /* @__PURE__ */ P(tDe, { @@ -82668,7 +82716,7 @@ function zJ(e, t, n = Promise.resolve()) { if (!cDe(e)) return { source: async () => { - throw new re("invalid-input", "documents", "this viewer can't open that document"); + throw new te("invalid-input", "documents", "this viewer can't open that document"); } }; const r = lDe(e); @@ -82676,7 +82724,7 @@ function zJ(e, t, n = Promise.resolve()) { name: r, source: async () => { const o = e instanceof Blob ? new Uint8Array(await e.arrayBuffer()) : new Uint8Array(e); - if (!iU(o)) throw new re("invalid-input", "documents", `${r} isn't a PDF`); + if (!iU(o)) throw new te("invalid-input", "documents", `${r} isn't a PDF`); return { kind: "bytes", id: t, bytes: o }; } }; @@ -82733,57 +82781,57 @@ function pDe(e) { const gDe = ":host{display:inline-flex;vertical-align:middle}:host([hidden]){display:none}"; let TF = null; const mDe = () => (TF ?? (TF = [WJ(), fE(gDe)]), TF), qJ = typeof HTMLElement > "u" ? class { -} : HTMLElement, jo = (e, t) => e.getAttribute(t); +} : HTMLElement, Fo = (e, t) => e.getAttribute(t); function bi(e, t, n) { n === null ? e.removeAttribute(t) : e.setAttribute(t, n); } const c3 = (e) => e.hasAttribute("active"), GJ = (e, t) => { e.toggleAttribute("active", !!t); }; -var ea, ml; +var ea, yl; class l3 extends qJ { constructor() { super(...arguments); Vn(this, ea, null); - Vn(this, ml, null); + Vn(this, yl, null); } /** Whether what it draws takes focus: a button does, an icon doesn't. */ get focusable() { return !0; } connectedCallback() { - rt(this, ml) || (gn(this, ml, this.attachShadow({ mode: "open", delegatesFocus: this.focusable })), rt(this, ml).adoptedStyleSheets = mDe()), this.focusable && !this.hasAttribute("tabindex") && (this.tabIndex = 0), gn(this, ea, pDe(this)), this.changed(); + ot(this, yl) || (gn(this, yl, this.attachShadow({ mode: "open", delegatesFocus: this.focusable })), ot(this, yl).adoptedStyleSheets = mDe()), this.focusable && !this.hasAttribute("tabindex") && (this.tabIndex = 0), gn(this, ea, pDe(this)), this.changed(); } disconnectedCallback() { - rt(this, ea) && IP(rt(this, ea)).remove(this), gn(this, ea, null); + ot(this, ea) && IP(ot(this, ea)).remove(this), gn(this, ea, null); } attributeChangedCallback() { this.changed(); } /** Tells the viewer what this element says now. */ changed() { - rt(this, ea) && rt(this, ml) && IP(rt(this, ea)).place(this.describe(rt(this, ml))); + ot(this, ea) && ot(this, yl) && IP(ot(this, ea)).place(this.describe(ot(this, yl))); } } -ea = new WeakMap(), ml = new WeakMap(); +ea = new WeakMap(), yl = new WeakMap(); const u3 = class u3 extends l3 { /** The command it is, by id. */ get command() { - return jo(this, "command"); + return Fo(this, "command"); } set command(t) { bi(this, "command", t); } /** Its icon, by name: the viewer's or one of yours. */ get icon() { - return jo(this, "icon"); + return Fo(this, "icon"); } set icon(t) { bi(this, "icon", t); } /** Its name, for its tooltip and screen readers. */ get label() { - return jo(this, "label"); + return Fo(this, "label"); } set label(t) { bi(this, "label", t); @@ -82812,14 +82860,14 @@ let NP = u3; class yDe extends qJ { /** The command it is, by id. */ get command() { - return jo(this, "command"); + return Fo(this, "command"); } set command(t) { bi(this, "command", t); } /** Its icon, by name: the viewer's or one of yours. */ get icon() { - return jo(this, "icon"); + return Fo(this, "icon"); } set icon(t) { bi(this, "icon", t); @@ -82832,28 +82880,28 @@ class yDe extends qJ { GJ(this, t); } } -var tm; +var nm; const d3 = class d3 extends l3 { constructor() { super(...arguments); - Vn(this, tm, null); + Vn(this, nm, null); } /** Its icon, by name: the viewer's or one of yours. */ get icon() { - return jo(this, "icon"); + return Fo(this, "icon"); } set icon(n) { bi(this, "icon", n); } /** Its name, for its tooltip and screen readers. */ get label() { - return jo(this, "label"); + return Fo(this, "label"); } set label(n) { bi(this, "label", n); } connectedCallback() { - rt(this, tm) ?? gn(this, tm, new MutationObserver(() => this.changed())), rt(this, tm).observe(this, { + ot(this, nm) ?? gn(this, nm, new MutationObserver(() => this.changed())), ot(this, nm).observe(this, { childList: !0, subtree: !0, characterData: !0, @@ -82862,13 +82910,13 @@ const d3 = class d3 extends l3 { }), super.connectedCallback(); } disconnectedCallback() { - rt(this, tm)?.disconnect(), super.disconnectedCallback(); + ot(this, nm)?.disconnect(), super.disconnectedCallback(); } describe(n) { const r = [...this.children].filter((o) => o.localName === "epdf-menu-item").map( (o) => ({ - command: jo(o, "command"), - icon: jo(o, "icon"), + command: Fo(o, "command"), + icon: Fo(o, "icon"), label: o.textContent?.trim() ?? "", active: c3(o), select: () => o.dispatchEvent(new CustomEvent("select", { bubbles: !0 })) @@ -82877,7 +82925,7 @@ const d3 = class d3 extends l3 { return { kind: "menu", host: this, root: n, icon: this.icon, label: this.label, items: r }; } }; -tm = new WeakMap(), d3.observedAttributes = ["icon", "label"]; +nm = new WeakMap(), d3.observedAttributes = ["icon", "label"]; let OP = d3; const f3 = class f3 extends l3 { get focusable() { @@ -82885,14 +82933,14 @@ const f3 = class f3 extends l3 { } /** The icon, by name: the viewer's or one of yours. */ get name() { - return jo(this, "name"); + return Fo(this, "name"); } set name(t) { bi(this, "name", t); } /** Its width and height in px; null for a toolbar button's. */ get size() { - const t = Number.parseFloat(jo(this, "size") ?? ""); + const t = Number.parseFloat(Fo(this, "size") ?? ""); return Number.isFinite(t) && t > 0 ? t : null; } set size(t) { @@ -82900,7 +82948,7 @@ const f3 = class f3 extends l3 { } /** What it shows, for screen readers; without one, they skip it. */ get label() { - return jo(this, "label"); + return Fo(this, "label"); } set label(t) { bi(this, "label", t); @@ -82962,41 +83010,41 @@ const ADe = typeof HTMLElement > "u" ? class { "fetch", "appState" ], xDe = "data-epdf-wrapped"; -var Ld, yl, ts, Io, ta, ov, sv, na, Dd, jd, Nx, Pt, Yi, TP, MP, Ox, Px, Rx, BP, YJ, QJ, _P, tS; +var jd, bl, ts, No, ta, ov, sv, na, Fd, Vd, Nx, Mt, Yi, TP, MP, Ox, Px, Rx, BP, YJ, QJ, _P, tS; const Tx = class Tx extends ADe { constructor() { super(...arguments); - Vn(this, Pt); - Vn(this, Ld, null); - Vn(this, yl, null); + Vn(this, Mt); + Vn(this, jd, null); + Vn(this, bl, null); Vn(this, ts, null); /** The config the running viewer shows, and the props it renders with. */ - Vn(this, Io, null); + Vn(this, No, null); Vn(this, ta, null); /** What the running viewer's door makes of a `src` (`DoorEngine.sourceOf`). */ Vn(this, ov, (n) => n); /** Whether the running viewer's door keeps a document open under a new `src` (`DoorEngine.follows`). */ Vn(this, sv); Vn(this, na, null); - Vn(this, Dd, null); + Vn(this, Fd, null); /** The ids of `src` documents still closing, which a new one must not take. */ - Vn(this, jd, /* @__PURE__ */ new Set()); + Vn(this, Vd, /* @__PURE__ */ new Set()); /** * How the viewer downloads a URL: the shown config's `fetch`, read at each download, so a new * one needs no new viewer. */ - Vn(this, Nx, (n, r) => (rt(this, Io)?.fetch ?? globalThis.fetch)(n, r)); + Vn(this, Nx, (n, r) => (ot(this, No)?.fetch ?? globalThis.fetch)(n, r)); /** The viewer is live: `src` opens, then `epdf:ready` and the config's `onReady` say so. */ Vn(this, Ox, (n) => { - gn(this, na, n), mn(this, Pt, BP).call(this), this.dispatchEvent(new CustomEvent("epdf:ready", { detail: { viewer: n } })), rt(this, Io)?.onReady?.(n); + gn(this, na, n), mn(this, Mt, BP).call(this), this.dispatchEvent(new CustomEvent("epdf:ready", { detail: { viewer: n } })), ot(this, No)?.onReady?.(n); }); /** The active document changed: `epdf:documentchange` and the config's `onDocumentChange`. */ Vn(this, Px, (n) => { - this.dispatchEvent(new CustomEvent("epdf:documentchange", { detail: { documentId: n } })), rt(this, Io)?.onDocumentChange?.(n); + this.dispatchEvent(new CustomEvent("epdf:documentchange", { detail: { documentId: n } })), ot(this, No)?.onDocumentChange?.(n); }); /** The user resized a panel: `epdf:panelresize` and the config's `onPanelResize`. */ Vn(this, Rx, (n) => { - this.dispatchEvent(new CustomEvent("epdf:panelresize", { detail: n })), rt(this, Io)?.onPanelResize?.(n); + this.dispatchEvent(new CustomEvent("epdf:panelresize", { detail: n })), ot(this, No)?.onPanelResize?.(n); }); } /** @@ -83004,38 +83052,38 @@ const Tx = class Tx extends ADe { * live keys change in place and any other change builds a new viewer. */ set config(n) { - gn(this, Ld, n), mn(this, Pt, TP).call(this); + gn(this, jd, n), mn(this, Mt, TP).call(this); } get config() { - return dDe(fDe(this), rt(this, Ld)); + return dDe(fDe(this), ot(this, jd)); } /** * The document: a URL, a `File`, or bytes (or what the door's engine opens). Another one opens * in its place, `null` closes it, and `undefined` goes back to the `src` attribute. */ set src(n) { - mn(this, Pt, Yi).call(this, { src: n }); + mn(this, Mt, Yi).call(this, { src: n }); } get src() { return this.config.src ?? null; } /** `'light'`, `'dark'`, `'system'`, or the theme config. */ set theme(n) { - mn(this, Pt, Yi).call(this, { theme: n }); + mn(this, Mt, Yi).call(this, { theme: n }); } get theme() { return this.config.theme; } /** `'auto'` or a language code. */ set locale(n) { - mn(this, Pt, Yi).call(this, { locale: n }); + mn(this, Mt, Yi).call(this, { locale: n }); } get locale() { return this.config.locale; } /** What people can do in this viewer: features and their parts, on or off. */ set features(n) { - mn(this, Pt, Yi).call(this, { features: n }); + mn(this, Mt, Yi).call(this, { features: n }); } get features() { return this.config.features; @@ -83045,28 +83093,28 @@ const Tx = class Tx extends ADe { * @deprecated Use `features`; goes in 4.0. */ set disable(n) { - mn(this, Pt, Yi).call(this, { disable: n }); + mn(this, Mt, Yi).call(this, { disable: n }); } get disable() { return this.config.disable; } /** Every feature that changes the document off, or all but `except`. */ set readOnly(n) { - mn(this, Pt, Yi).call(this, { readOnly: n }); + mn(this, Mt, Yi).call(this, { readOnly: n }); } get readOnly() { return this.config.readOnly; } /** How a document at a URL downloads: your own `fetch`. The next download uses a new one. */ set fetch(n) { - mn(this, Pt, Yi).call(this, { fetch: n }); + mn(this, Mt, Yi).call(this, { fetch: n }); } get fetch() { return this.config.fetch; } /** Your app's state, which your commands read: a new value, and every button asks again. */ set appState(n) { - mn(this, Pt, Yi).call(this, { appState: n }); + mn(this, Mt, Yi).call(this, { appState: n }); } get appState() { return this.config.appState; @@ -83077,7 +83125,7 @@ const Tx = class Tx extends ADe { * builds a new viewer. */ get viewer() { - return rt(this, na); + return ot(this, na); } connectedCallback() { for (const n of SDe) { @@ -83085,83 +83133,83 @@ const Tx = class Tx extends ADe { const r = Reflect.get(this, n); Reflect.deleteProperty(this, n), Reflect.set(this, n, r); } - this.hasAttribute(xDe) && rt(this, Ld) === null || queueMicrotask(() => { - this.isConnected && !rt(this, ts) && mn(this, Pt, tS).call(this); + this.hasAttribute(xDe) && ot(this, jd) === null || queueMicrotask(() => { + this.isConnected && !ot(this, ts) && mn(this, Mt, tS).call(this); }); } disconnectedCallback() { - mn(this, Pt, MP).call(this); + mn(this, Mt, MP).call(this); } attributeChangedCallback() { - rt(this, ts) && mn(this, Pt, TP).call(this); + ot(this, ts) && mn(this, Mt, TP).call(this); } }; -Ld = new WeakMap(), yl = new WeakMap(), ts = new WeakMap(), Io = new WeakMap(), ta = new WeakMap(), ov = new WeakMap(), sv = new WeakMap(), na = new WeakMap(), Dd = new WeakMap(), jd = new WeakMap(), Nx = new WeakMap(), Pt = new WeakSet(), Yi = function(n) { - this.config = { ...rt(this, Ld), ...n }; +jd = new WeakMap(), bl = new WeakMap(), ts = new WeakMap(), No = new WeakMap(), ta = new WeakMap(), ov = new WeakMap(), sv = new WeakMap(), na = new WeakMap(), Fd = new WeakMap(), Vd = new WeakMap(), Nx = new WeakMap(), Mt = new WeakSet(), Yi = function(n) { + this.config = { ...ot(this, jd), ...n }; }, /** Show the current config: in place when only live keys changed, else on a new viewer. */ TP = function() { if (!this.isConnected) return; - const n = rt(this, Io); - if (!rt(this, ts) || !n) { - mn(this, Pt, tS).call(this); + const n = ot(this, No); + if (!ot(this, ts) || !n) { + mn(this, Mt, tS).call(this); return; } const r = this.config, o = iDe(n, r); if (o.length !== 0) { if (!o.every(sDe)) { - mn(this, Pt, tS).call(this); + mn(this, Mt, tS).call(this); return; } - if (gn(this, Io, r), o.includes("theme") && mn(this, Pt, _P).call(this, r.theme), o.some((s) => s !== "src" && s !== "fetch")) { + if (gn(this, No, r), o.includes("theme") && mn(this, Mt, _P).call(this, r.theme), o.some((s) => s !== "src" && s !== "fetch")) { const { theme: s, locale: i, features: a, disable: c, readOnly: l, appState: u } = r; - gn(this, ta, { ...rt(this, ta), theme: s, locale: i, features: a, disable: c, readOnly: l, appState: u }), rt(this, ts).render(mo(OF, rt(this, ta))); + gn(this, ta, { ...ot(this, ta), theme: s, locale: i, features: a, disable: c, readOnly: l, appState: u }), ot(this, ts).render(yo(OF, ot(this, ta))); } - o.includes("src") && mn(this, Pt, BP).call(this); + o.includes("src") && mn(this, Mt, BP).call(this); } }, MP = function() { - gn(this, na, null), gn(this, Dd, null), rt(this, jd).clear(), gn(this, Io, null), gn(this, ta, null), rt(this, ts)?.unmount(), gn(this, ts, null); + gn(this, na, null), gn(this, Fd, null), ot(this, Vd).clear(), gn(this, No, null), gn(this, ta, null), ot(this, ts)?.unmount(), gn(this, ts, null); }, Ox = new WeakMap(), Px = new WeakMap(), Rx = new WeakMap(), /** * Open the document `src` names in the place of the one the previous `src` opened, which * closes. `documents` takes over from `src` when the config has them. */ BP = function() { var u; - const n = rt(this, na), r = rt(this, Io); + const n = ot(this, na), r = ot(this, No); if (!n || !r || r.documents) return; - const { documents: o } = n, s = rt(this, Dd); - if (s && r.src != null && ((u = rt(this, sv)) != null && u.call(this, s.input, r.src))) return; - gn(this, Dd, null); + const { documents: o } = n, s = ot(this, Fd); + if (s && r.src != null && ((u = ot(this, sv)) != null && u.call(this, s.input, r.src))) return; + gn(this, Fd, null); const i = s && o.has(s.id) ? s.id : s?.reserved, a = i ? o.getOrder().indexOf(i) : -1; let c = () => { }; - const l = new Promise((d) => c = d); - if (r.src != null && mn(this, Pt, YJ).call(this, r.src, a, s ? l : void 0), s) { - const d = s.id; - rt(this, jd).add(d); - const f = /* @__PURE__ */ new Set([s.reserved, d]), h = () => { - rt(this, jd).delete(d), c(); + const l = new Promise((f) => c = f); + if (r.src != null && mn(this, Mt, YJ).call(this, r.src, a, s ? l : void 0), s) { + const f = s.id; + ot(this, Vd).add(f); + const d = /* @__PURE__ */ new Set([s.reserved, f]), h = () => { + ot(this, Vd).delete(f), c(); }; - Promise.all([...f].map((g) => o.close(g))).then(() => s.opened).then((g) => g !== null && !f.has(g) ? o.close(g) : void 0).then(h, h); + Promise.all([...d].map((g) => o.close(g))).then(() => s.opened).then((g) => g !== null && !d.has(g) ? o.close(g) : void 0).then(h, h); } }, /** Open `src` as the `src` document, at `position` in the tabs, once `after` settles. */ YJ = function(n, r, o) { - const { documents: s } = rt(this, na), i = rt(this, ov).call(this, n), a = mn(this, Pt, QJ).call(this, i), { source: c, name: l } = zJ(i, a, o), u = new Set(s.getOrder()), d = s.open(c, l !== void 0 ? { name: l } : {}), f = s.getOrder().find((p) => !u.has(p)), h = d.then( + const { documents: s } = ot(this, na), i = ot(this, ov).call(this, n), a = mn(this, Mt, QJ).call(this, i), { source: c, name: l } = zJ(i, a, o), u = new Set(s.getOrder()), f = s.open(c, l !== void 0 ? { name: l } : {}), d = s.getOrder().find((p) => !u.has(p)), h = f.then( ({ document: p }) => p.id, () => null ); - if (!f) return; + if (!d) return; const g = { - reserved: f, - id: dE(i) ? f : a, + reserved: d, + id: dE(i) ? d : a, opened: h, input: i }; - gn(this, Dd, g), h.then((p) => { + gn(this, Fd, g), h.then((p) => { p !== null && (g.id = p); - }), r >= 0 && s.move(f, r); + }), r >= 0 && s.move(d, r); }, /** The id `src` asks for, or with a number after it while a document still has it. */ QJ = function(n) { - const r = HJ(n), o = (i) => rt(this, jd).has(i) || !!rt(this, na)?.documents.has(i); + const r = HJ(n), o = (i) => ot(this, Vd).has(i) || !!ot(this, na)?.documents.has(i); let s = r; for (let i = 2; o(s); i++) s = `${r}#${i}`; return s; @@ -83172,9 +83220,9 @@ _P = function(n) { }, tS = function() { if (!this.shadowRoot) { const h = this.attachShadow({ mode: "open" }); - gn(this, yl, document.createElement("div")), rt(this, yl).setAttribute(JJ, ""), h.appendChild(rt(this, yl)); + gn(this, bl, document.createElement("div")), ot(this, bl).setAttribute(JJ, ""), h.appendChild(ot(this, bl)); } - mn(this, Pt, MP).call(this); + mn(this, Mt, MP).call(this); const n = this.config; kDe(n); const { @@ -83185,23 +83233,23 @@ _P = function(n) { fetch: a, ...c } = n; - mn(this, Pt, _P).call(this, i), gn(this, Io, n); - const { engine: l, sourceOf: u = (h) => h, follows: d, plugins: f } = vDe(n); - gn(this, ov, u), gn(this, sv, d), gn(this, ta, { + mn(this, Mt, _P).call(this, i), gn(this, No, n); + const { engine: l, sourceOf: u = (h) => h, follows: f, plugins: d } = vDe(n); + gn(this, ov, u), gn(this, sv, f), gn(this, ta, { engine: l, initialDocuments: o && uDe(o, u), - fetch: rt(this, Nx), + fetch: ot(this, Nx), theme: i, - themeTarget: rt(this, yl), + themeTarget: ot(this, bl), // The viewer's own components among the children (``, ``). components: IP(this), ...c, - plugins: aDe(f, c.plugins), + plugins: aDe(d, c.plugins), // The element's own, which call the config's after its events. - onReady: rt(this, Ox), - onDocumentChange: rt(this, Px), - onPanelResize: rt(this, Rx) - }), gn(this, ts, Hre(rt(this, yl))), rt(this, ts).render(mo(OF, rt(this, ta))); + onReady: ot(this, Ox), + onDocumentChange: ot(this, Px), + onPanelResize: ot(this, Rx) + }), gn(this, ts, Hre(ot(this, bl))), ot(this, ts).render(yo(OF, ot(this, ta))); }, Tx.observedAttributes = ["src", "locale", "theme"], Tx.defaultEngineProvider = null; let rv = Tx; typeof customElements < "u" && !customElements.get("embedpdf-viewer") && customElements.define("embedpdf-viewer", rv); @@ -83224,23 +83272,23 @@ const NDe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty( default: x$ }, Symbol.toStringTag, { value: "Module" })); export { - ar as $, - fe as A, + cr as $, + de as A, bt as B, vt as C, - Zt as D, + tn as D, oe as E, jr as F, F6e as G, oc as H, - de as I, + ue as I, bRe as J, wRe as K, - Jr as L, + Yr as L, Ms as M, i8e as N, Oe as O, - go as P, + mo as P, lE as Q, yRe as R, nt as S, @@ -83256,17 +83304,17 @@ export { sx as a$, kfe as a0, cve as a1, - en as a2, + nn as a2, MDe as a3, - Rt as a4, + Bt as a4, oa as a5, a5e as a6, Xa as a7, - zt as a8, + Gt as a8, C0 as a9, FRe as aA, xi as aB, - pr as aC, + Xn as aC, l8e as aD, D2 as aE, BSe as aF, @@ -83276,20 +83324,20 @@ export { u2 as aJ, jRe as aK, pR as aL, - um as aM, + dm as aM, c2 as aN, IS as aO, mG as aP, - Vm as aQ, + $m as aQ, $v as aR, Mr as aS, Nq as aT, xO as aU, ki as aV, - ln as aW, + un as aW, d0 as aX, aT as aY, - ht as aZ, + pt as aZ, Bn as a_, X6 as aa, E5 as ab, @@ -83318,44 +83366,44 @@ export { yr as ay, y_ as az, $De as b, - yDe as b$, + NP as b$, Pq as b0, Yn as b1, bx as b2, UDe as b3, W0 as b4, - Yt as b5, - Ve as b6, + Xt as b5, + $e as b6, mr as b7, wx as b8, z as b9, - Cq as bA, - J as bB, - q as bC, - lOe as bD, - u0 as bE, - zr as bF, - J0 as bG, - Qt as bH, - aOe as bI, - ZDe as bJ, - WDe as bK, - qDe as bL, - Ig as bM, - e8e as bN, - JDe as bO, - XDe as bP, - QDe as bQ, - YDe as bR, - GDe as bS, - Z2 as bT, - Lr as bU, - bo as bV, - It as bW, - rv as bX, - NP as bY, - PP as bZ, - OP as b_, + q as bA, + p4 as bB, + al as bC, + xg as bD, + kOe as bE, + Cq as bF, + lOe as bG, + u0 as bH, + Wr as bI, + J0 as bJ, + Zt as bK, + aOe as bL, + ZDe as bM, + WDe as bN, + qDe as bO, + Ng as bP, + e8e as bQ, + JDe as bR, + XDe as bS, + QDe as bT, + YDe as bU, + GDe as bV, + Z2 as bW, + Lr as bX, + wo as bY, + Pt as bZ, + rv as b_, RDe as ba, qde as bb, c8e as bc, @@ -83363,63 +83411,66 @@ export { yP as be, Ze as bf, wr as bg, - wo as bh, + vo as bh, vi as bi, An as bj, - fn as bk, + hn as bk, WC as bl, HDe as bm, - eo as bn, + to as bn, LIe as bo, En as bp, zDe as bq, Ka as br, - hr as bs, - Dt as bt, + pr as bs, + Vt as bt, eP as bu, - Tp as bv, + Mp as bv, pOe as bw, r0 as bx, BDe as by, - kOe as bz, + J as bz, Qa as c, - vo as c0, - Pf as c1, - EJ as c2, - Fm as c3, - Wo as c4, - Oi as c5, - _r as c6, - dt as c7, - Qn as c8, - Uq as c9, - d8e as ca, - Pj as cb, - NG as cc, - WRe as cd, - EDe as ce, + PP as c0, + OP as c1, + yDe as c2, + ko as c3, + Tf as c4, + EJ as c5, + Vm as c6, + qo as c7, + Oi as c8, + _r as c9, + dt as ca, + Qn as cb, + Uq as cc, + d8e as cd, + Pj as ce, + NG as cf, + WRe as cg, + EDe as ch, ive as d, _De as e, - hn as f, - De as g, + pn as f, + je as g, P as h, HG as i, - Nt as j, - sr as k, + Rt as j, + ir as k, KMe as l, J5e as m, ft as n, - Ho as o, + zo as o, u8e as p, VMe as q, Ke as r, Re as s, X2 as t, - Tt as u, + _t as u, PDe as v, o8e as w, U0e as x, LDe as y, DDe as z }; -//# sourceMappingURL=wasm-url-asset-sqnq1cad.js.map +//# sourceMappingURL=wasm-url-asset-Dc0HnHB_.js.map diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/embedpdf-worker.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/embedpdf-worker.js index 718d7b88..d808feb1 100644 --- a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/embedpdf-worker.js +++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/embedpdf-worker.js @@ -1,5 +1,5 @@ -"use strict";(()=>{let e,t,n,r,i,o,a,s,l,u,d,c,f,m,p;var h,F,g,_,P,D,b,y,w=Object.defineProperty,E=Object.getOwnPropertyNames,A=(e=function(e){if("u">typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')},"u">typeof require?require:"u">typeof Proxy?new Proxy(e,{get:(e,t)=>("u">typeof require?require:e)[t]}):e),v=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},S=(e,t,n)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?w(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n},k={};v(k,{default:()=>_});var x=(t={"../runtime/npm/wasm32/lib/embedpdf.browser.js"(){var e;e=self.location.href,_=function(t={}){var n,r,i,o,a,s,l,u,d,c,f,m,p,h,F,g,_,P,D,b,y=new Promise((e,t)=>{n=e,r=t});["_EPDF_CheckPasswordPermissions","_EPDF_DigestBuffer","_EPDF_FreeBuffer","_EPDF_GetDecodedImageBytes","_EPDF_GetMetaKeyCount","_EPDF_GetMetaKeyName","_EPDF_GetMetaTrapped","_EPDF_GetPageBoxByIndex","_EPDF_GetPageRotateByIndex","_EPDF_GetPageTabOrderByIndex","_EPDF_GetPageUserUnitByIndex","_EPDF_HasMetaText","_EPDF_InitThread","_EPDF_IsEncrypted","_EPDF_IsOwnerUnlocked","_EPDF_LoadBaseDocument","_EPDF_LoadMemBaseDocument","_EPDF_LoadMemBaseDocument64","_EPDF_LoadPageNormalized","_EPDF_PNG_EncodeRGBA","_EPDF_ReleaseBaseDocument","_EPDF_RemoveEncryption","_EPDF_RenderAnnotBitmap","_EPDF_RenderAnnotBitmapUnrotated","_EPDF_RenderPage_Continue","_EPDF_RenderPageBitmapWithMatrix_Start","_EPDF_SaveAsCopyEx","_EPDF_SaveDocumentToOwnedBuffer","_EPDF_SaveDocumentToOwnedBufferEx","_EPDF_SaveDocumentToOwnedBufferWithVersion","_EPDF_SetBaseDocumentSha256","_EPDF_SetDecodedImageBudget","_EPDF_SetEncryption","_EPDF_SetMetaText","_EPDF_SetMetaTrapped","_EPDF_SetRuntimeOwnerPermissions","_EPDF_ShutdownThread","_EPDF_UnlockOwnerPermissions","_EPDFAction_CloseModel","_EPDFAction_CreateGoTo","_EPDFAction_CreateGoToNamed","_EPDFAction_CreateHide","_EPDFAction_CreateJavaScript","_EPDFAction_CreateLaunch","_EPDFAction_CreateNamed","_EPDFAction_CreateRemoteGoToByName","_EPDFAction_CreateRemoteGoToDest","_EPDFAction_CreateResetForm","_EPDFAction_CreateSubmitForm","_EPDFAction_CreateURI","_EPDFAction_GetNextAt","_EPDFAction_GetNextCount","_EPDFAction_GetNodeCount","_EPDFAction_GetNodeDest","_EPDFAction_GetNodeFilePath","_EPDFAction_GetNodeHideFlag","_EPDFAction_GetNodeJavaScript","_EPDFAction_GetNodeName","_EPDFAction_GetNodeResetForm","_EPDFAction_GetNodeSubmitForm","_EPDFAction_GetNodeSubmitFormCharSet","_EPDFAction_GetNodeSubmitFormURL","_EPDFAction_GetNodeSubtype","_EPDFAction_GetNodeTargetCount","_EPDFAction_GetNodeTargetName","_EPDFAction_GetNodeTargetObjectNumber","_EPDFAction_GetNodeType","_EPDFAction_GetNodeURI","_EPDFAction_GetNodeURIIsMap","_EPDFAction_GetRootNode","_EPDFAction_GetWarningFlags","_EPDFAction_IsComplete","_EPDFAction_LoadModel","_EPDFAction_NodeHasJavaScript","_EPDFAction_SetNext","_EPDFAnnot_AddMeasure","_EPDFAnnot_ClearBorderEffect","_EPDFAnnot_ClearColor","_EPDFAnnot_ClearEmbedMetadata","_EPDFAnnot_ClearEmbedMetadataKey","_EPDFAnnot_ClearMKColor","_EPDFAnnot_ClearMKIcon","_EPDFAnnot_ClearRectangleDifferences","_EPDFAnnot_ExportAppearance","_EPDFAnnot_GenerateAppearance","_EPDFAnnot_GenerateAppearanceWithBlend","_EPDFAnnot_GenerateFormFieldAP","_EPDFAnnot_GetActionModel","_EPDFAnnot_GetAPMatrix","_EPDFAnnot_GetAppearanceState","_EPDFAnnot_GetAppearanceStateCount","_EPDFAnnot_GetAppearanceStateName","_EPDFAnnot_GetAppearanceTransform","_EPDFAnnot_GetAvailableAppearanceModes","_EPDFAnnot_GetBlendMode","_EPDFAnnot_GetBooleanValue","_EPDFAnnot_GetBorderDashPattern","_EPDFAnnot_GetBorderDashPatternCount","_EPDFAnnot_GetBorderEffect","_EPDFAnnot_GetBorderStyle","_EPDFAnnot_GetCalloutLine","_EPDFAnnot_GetCalloutLineCount","_EPDFAnnot_GetColor","_EPDFAnnot_GetDefaultAppearance","_EPDFAnnot_GetDefaultAppearanceFontFace","_EPDFAnnot_GetDefaultAppearanceFontPostScriptName","_EPDFAnnot_GetDrawing","_EPDFAnnot_GetDrawingRect","_EPDFAnnot_GetEmbedMetadataBoolean","_EPDFAnnot_GetEmbedMetadataJSON","_EPDFAnnot_GetEmbedMetadataNumber","_EPDFAnnot_GetEmbedMetadataRect","_EPDFAnnot_GetEmbedMetadataString","_EPDFAnnot_GetFileAttachmentForWrite","_EPDFAnnot_GetIntent","_EPDFAnnot_GetLineCaption","_EPDFAnnot_GetLineEndings","_EPDFAnnot_GetLineLeader","_EPDFAnnot_GetMeasure","_EPDFAnnot_GetMKColor","_EPDFAnnot_GetMKIcon","_EPDFAnnot_GetMKRotation","_EPDFAnnot_GetMKText","_EPDFAnnot_GetMKTextPosition","_EPDFAnnot_GetName","_EPDFAnnot_GetObjectNumber","_EPDFAnnot_GetOpacity","_EPDFAnnot_GetOverlayText","_EPDFAnnot_GetOverlayTextRepeat","_EPDFAnnot_GetRect","_EPDFAnnot_GetRectangleDifferences","_EPDFAnnot_GetReplyType","_EPDFAnnot_GetRichContent","_EPDFAnnot_GetRichTextJSON","_EPDFAnnot_GetRotate","_EPDFAnnot_GetShapeCaption","_EPDFAnnot_GetStructurePosition","_EPDFAnnot_GetTextAlignment","_EPDFAnnot_HasAppearanceStream","_EPDFAnnot_HasEmbedMetadata","_EPDFAnnot_HasMKIcon","_EPDFAnnot_IsValid","_EPDFAnnot_RemoveAction","_EPDFAnnot_RemoveDest","_EPDFAnnot_RemoveKey","_EPDFAnnot_RemoveMeasure","_EPDFAnnot_SetAction","_EPDFAnnot_SetAPMatrix","_EPDFAnnot_SetAppearanceFromPage","_EPDFAnnot_SetBooleanValue","_EPDFAnnot_SetBorderDashPattern","_EPDFAnnot_SetBorderEffect","_EPDFAnnot_SetBorderStyle","_EPDFAnnot_SetCalloutLine","_EPDFAnnot_SetColor","_EPDFAnnot_SetDefaultAppearance","_EPDFAnnot_SetDefaultAppearanceDocumentFont","_EPDFAnnot_SetDefaultAppearanceRegisteredFont","_EPDFAnnot_SetDrawing","_EPDFAnnot_SetEmbedMetadataBoolean","_EPDFAnnot_SetEmbedMetadataJSON","_EPDFAnnot_SetEmbedMetadataNumber","_EPDFAnnot_SetEmbedMetadataRect","_EPDFAnnot_SetEmbedMetadataString","_EPDFAnnot_SetEventAction","_EPDFAnnot_SetIntent","_EPDFAnnot_SetLine","_EPDFAnnot_SetLineCaption","_EPDFAnnot_SetLineEndings","_EPDFAnnot_SetLineLeader","_EPDFAnnot_SetLinkedAnnot","_EPDFAnnot_SetMKColor","_EPDFAnnot_SetMKIcon","_EPDFAnnot_SetMKRotation","_EPDFAnnot_SetMKText","_EPDFAnnot_SetMKTextPosition","_EPDFAnnot_SetName","_EPDFAnnot_SetNoColor","_EPDFAnnot_SetNumberValue","_EPDFAnnot_SetOpacity","_EPDFAnnot_SetOverlayText","_EPDFAnnot_SetOverlayTextRepeat","_EPDFAnnot_SetRect","_EPDFAnnot_SetReplyType","_EPDFAnnot_SetRichTextJSON","_EPDFAnnot_SetRichTextXHTML","_EPDFAnnot_SetRotate","_EPDFAnnot_SetShapeCaption","_EPDFAnnot_SetStampOpacity","_EPDFAnnot_SetSubtype","_EPDFAnnot_SetTextAlignment","_EPDFAnnot_SetVertices","_EPDFAnnot_UpdateAppearanceToRect","_EPDFAttachment_ExportCanonicalToOwnedBuffer","_EPDFAttachment_ExportRawToOwnedBuffer","_EPDFAttachment_ExtractFile","_EPDFAttachment_ExtractFileToOwnedBuffer","_EPDFAttachment_GetDescription","_EPDFAttachment_GetIntegerValue","_EPDFAttachment_ImportRaw","_EPDFAttachment_SetDescription","_EPDFAttachment_SetName","_EPDFAttachment_SetSubtype","_EPDFCatalog_GetLanguage","_EPDFCatalog_GetMetadata","_EPDFCatalog_SetMetadata","_EPDFDest_CreateRemoteView","_EPDFDest_CreateRemoteXYZ","_EPDFDest_CreateView","_EPDFDest_CreateViewByObjectNumber","_EPDFDest_CreateXYZ","_EPDFDest_CreateXYZByObjectNumber","_EPDFDest_GetPageObjectNumber","_EPDFDest_GetViewNullParams","_EPDFDoc_CanonicalDrawing","_EPDFDoc_ClearMissingCharacters","_EPDFDoc_ClearPagePieceInfoEntry","_EPDFDoc_ClearPagePieceInfoKey","_EPDFDoc_ClearPieceInfoEntry","_EPDFDoc_ClearPieceInfoKey","_EPDFDoc_CompareRevisions","_EPDFDoc_CountMissingCharacters","_EPDFDoc_DeletePageByObjectNumber","_EPDFDoc_ExportDictCanonicalToOwnedBuffer","_EPDFDoc_ExportDictRawToOwnedBuffer","_EPDFDoc_ExportDrawing","_EPDFDoc_ExportPagesFlattened","_EPDFDoc_GetAdditionalActionModel","_EPDFDoc_GetAttachmentIndexByKey","_EPDFDoc_GetAttachmentKey","_EPDFDoc_GetBaseBytesSize","_EPDFDoc_GetDrawings","_EPDFDoc_GetFontDisplayProgramCoverage","_EPDFDoc_GetFontDisplayProgramData","_EPDFDoc_GetFontEmbeddingPolicy","_EPDFDoc_GetFontProgramData","_EPDFDoc_GetFontsFingerprint","_EPDFDoc_GetImportFieldRoots","_EPDFDoc_GetLastModified","_EPDFDoc_GetLoadedBytesSize","_EPDFDoc_GetLoadedObjectValue","_EPDFDoc_GetMissingCharacter","_EPDFDoc_GetNamedJavaScriptActionModel","_EPDFDoc_GetNamedPageAt","_EPDFDoc_GetNamedPageCount","_EPDFDoc_GetOpenActionDest","_EPDFDoc_GetOpenActionModel","_EPDFDoc_GetPageActionModel","_EPDFDoc_GetPageLabelSectionAt","_EPDFDoc_GetPageLabelSectionCount","_EPDFDoc_GetPageLastModified","_EPDFDoc_GetPageObjectNumberByIndex","_EPDFDoc_GetPagePieceInfoBoolean","_EPDFDoc_GetPagePieceInfoEntryAt","_EPDFDoc_GetPagePieceInfoEntryCount","_EPDFDoc_GetPagePieceInfoKeyAt","_EPDFDoc_GetPagePieceInfoKeyCount","_EPDFDoc_GetPagePieceInfoLastModified","_EPDFDoc_GetPagePieceInfoName","_EPDFDoc_GetPagePieceInfoNumber","_EPDFDoc_GetPagePieceInfoString","_EPDFDoc_GetPagePieceInfoStringArrayAt","_EPDFDoc_GetPagePieceInfoStringArrayCount","_EPDFDoc_GetPagePieceInfoValueType","_EPDFDoc_GetPieceInfoBoolean","_EPDFDoc_GetPieceInfoEntryAt","_EPDFDoc_GetPieceInfoEntryCount","_EPDFDoc_GetPieceInfoKeyAt","_EPDFDoc_GetPieceInfoKeyCount","_EPDFDoc_GetPieceInfoLastModified","_EPDFDoc_GetPieceInfoName","_EPDFDoc_GetPieceInfoNumber","_EPDFDoc_GetPieceInfoString","_EPDFDoc_GetPieceInfoStringArrayAt","_EPDFDoc_GetPieceInfoStringArrayCount","_EPDFDoc_GetPieceInfoValueType","_EPDFDoc_GetRevision","_EPDFDoc_GetRevisionCount","_EPDFDoc_GetStructureObjectNumbers","_EPDFDoc_GetTypographicFeatures","_EPDFDoc_HasPagePieceInfoEntry","_EPDFDoc_HasPieceInfoEntry","_EPDFDoc_ImportDictRaw","_EPDFDoc_ImportDrawing","_EPDFDoc_ImportPages","_EPDFDoc_LoadPageByObjectNumber","_EPDFDoc_LoadPageByObjectNumberNormalized","_EPDFDoc_OpenBaseOverlay","_EPDFDoc_OpenBaseOverlayFromPath","_EPDFDoc_OpenRevision","_EPDFDoc_ReadLoadedBytes","_EPDFDoc_RemoveNamedPage","_EPDFDoc_RemoveNamedPagesForPage","_EPDFDoc_ResolveFonts","_EPDFDoc_SetFontEmbeddingPolicy","_EPDFDoc_SetNamedPage","_EPDFDoc_SetPageLabelSections","_EPDFDoc_SetPagePieceInfoBoolean","_EPDFDoc_SetPagePieceInfoName","_EPDFDoc_SetPagePieceInfoNumber","_EPDFDoc_SetPagePieceInfoString","_EPDFDoc_SetPagePieceInfoStringArray","_EPDFDoc_SetPageRotationByObjectNumber","_EPDFDoc_SetPieceInfoBoolean","_EPDFDoc_SetPieceInfoName","_EPDFDoc_SetPieceInfoNumber","_EPDFDoc_SetPieceInfoString","_EPDFDoc_SetPieceInfoStringArray","_EPDFDoc_SetTypographicFeatures","_EPDFDoc_StartLoadPageByObjectNumber","_EPDFDocument_ClearEmbedMetadata","_EPDFDss_Add","_EPDFDss_GetCount","_EPDFDss_GetData","_EPDFFont_AddFallbackFont","_EPDFFont_AuthorizeEditing","_EPDFFont_ClearFallbackFonts","_EPDFFont_ClearRegisteredFonts","_EPDFFont_GetCoverage","_EPDFFont_GetEmbeddingPermission","_EPDFFont_GetFallbackOrder","_EPDFFont_GetFamilyName","_EPDFFont_GetLastResortFont","_EPDFFont_GetMetrics","_EPDFFont_GetPostScriptName","_EPDFFont_GetProgramData","_EPDFFont_GetProgramFormat","_EPDFFont_GetProgramHash","_EPDFFont_GetWeight","_EPDFFont_IsEditingAuthorized","_EPDFFont_IsInstanced","_EPDFFont_IsItalic","_EPDFFont_RegisterFont","_EPDFFont_RegisterMemFont","_EPDFFont_RegisterMemFont64","_EPDFFont_SetLastResortFont","_EPDFFontFaces_Close","_EPDFFontFaces_Count","_EPDFFontFaces_CountPrograms","_EPDFFontFaces_GetFamily","_EPDFFontFaces_GetProgramDisplayHash","_EPDFFontFaces_GetProgramEmbedded","_EPDFFontFaces_GetProgramEmbeddingPermission","_EPDFFontFaces_GetProgramFormat","_EPDFFontFaces_GetProgramHash","_EPDFFontFaces_GetProgramMetrics","_EPDFFontFaces_GetProgramObjNum","_EPDFFontFaces_GetProgramPostScriptName","_EPDFFontFaces_GetWeight","_EPDFFontFaces_IsItalic","_EPDFFontFaces_Load","_EPDFFontFaces_ProgramMapsUnicode","_EPDFFontResolution_Close","_EPDFFontResolution_CountMissingCharacters","_EPDFFontResolution_GetBaseFontName","_EPDFFontResolution_GetFallbacks","_EPDFFontResolution_GetFamily","_EPDFFontResolution_GetMissingCharacter","_EPDFFontResolution_GetProgramDisplayHash","_EPDFFontResolution_GetProgramObjNum","_EPDFFontResolution_GetRegisteredFont","_EPDFFontResolution_GetSource","_EPDFFontResolution_GetWeight","_EPDFFontResolution_IsDegraded","_EPDFFontResolution_IsItalic","_EPDFForm_AttachWidget","_EPDFForm_ClearFieldEmbedMetadata","_EPDFForm_ClearFieldEmbedMetadataKey","_EPDFForm_CloseModel","_EPDFForm_CountCalculationOrder","_EPDFForm_CountFieldDefaultValues","_EPDFForm_CountFieldOptions","_EPDFForm_CountFields","_EPDFForm_CountFieldValues","_EPDFForm_CountFieldWidgets","_EPDFForm_CreateField","_EPDFForm_DeleteField","_EPDFForm_DetachWidget","_EPDFForm_ExportFDF","_EPDFForm_ExportFieldRawToOwnedBuffer","_EPDFForm_ExportXFDF","_EPDFForm_GetCalculationOrderFieldIndex","_EPDFForm_GetFieldActionModel","_EPDFForm_GetFieldAlternateName","_EPDFForm_GetFieldDefaultValueAt","_EPDFForm_GetFieldDefaultValueKind","_EPDFForm_GetFieldEmbedMetadataBoolean","_EPDFForm_GetFieldEmbedMetadataJSON","_EPDFForm_GetFieldEmbedMetadataNumber","_EPDFForm_GetFieldEmbedMetadataString","_EPDFForm_GetFieldFamily","_EPDFForm_GetFieldFlags","_EPDFForm_GetFieldIndexByObjNum","_EPDFForm_GetFieldIndexForWidget","_EPDFForm_GetFieldMappingName","_EPDFForm_GetFieldMaxLen","_EPDFForm_GetFieldName","_EPDFForm_GetFieldObjNum","_EPDFForm_GetFieldOptionLabel","_EPDFForm_GetFieldOptionValue","_EPDFForm_GetFieldOrigin","_EPDFForm_GetFieldPartialName","_EPDFForm_GetFieldTopIndex","_EPDFForm_GetFieldValueAt","_EPDFForm_GetFieldValueKind","_EPDFForm_GetFieldWidgetExportValue","_EPDFForm_GetFieldWidgetObjNum","_EPDFForm_GetFieldWidgetOnState","_EPDFForm_GetFieldWidgetPageObjNum","_EPDFForm_GetFieldWidgetRect","_EPDFForm_GetFormKind","_EPDFForm_GetNeedAppearances","_EPDFForm_HasFieldEmbedMetadata","_EPDFForm_HasFieldValuesList","_EPDFForm_ImportFieldRaw","_EPDFForm_IsFieldOptionSelected","_EPDFForm_IsFieldWidgetChecked","_EPDFForm_LoadModel","_EPDFForm_RedrawFieldWidgets","_EPDFForm_Repair","_EPDFForm_SetCalculationOrder","_EPDFForm_SetFieldAlternateName","_EPDFForm_SetFieldAppearanceText","_EPDFForm_SetFieldDefaultValue","_EPDFForm_SetFieldDisplay","_EPDFForm_SetFieldEmbedMetadataBoolean","_EPDFForm_SetFieldEmbedMetadataJSON","_EPDFForm_SetFieldEmbedMetadataNumber","_EPDFForm_SetFieldEmbedMetadataString","_EPDFForm_SetFieldEventAction","_EPDFForm_SetFieldFlags","_EPDFForm_SetFieldMappingName","_EPDFForm_SetFieldMaxLen","_EPDFForm_SetFieldName","_EPDFForm_SetFieldOptions","_EPDFForm_SetFieldSelectedIndices","_EPDFForm_SetFieldValue","_EPDFForm_SetFieldWidgetsChecked","_EPDFImageObj_SetJpeg","_EPDFImageObj_SetPng","_EPDFLayer_AbortTransaction","_EPDFLayer_BeginTransaction","_EPDFLayer_CommitTransaction","_EPDFLayer_GetBaseDocument","_EPDFLayer_GetBaseSha256","_EPDFLayer_GetBirthName","_EPDFLayer_GetBirthObjectNumber","_EPDFLayer_GetLastObjectNumber","_EPDFLayer_GetPromotedObjectCount","_EPDFLayer_IsInTransaction","_EPDFLayer_IsObjectPromoted","_EPDFLayer_IsPagePromoted","_EPDFLayer_OpenLayer","_EPDFLayer_OpenLayerArtifact","_EPDFLayer_OpenLayerArtifactFromPath","_EPDFLayer_RaiseLastObjectNumber","_EPDFLayer_SaveDelta","_EPDFLayer_SaveDeltaEx","_EPDFLayer_SaveDeltaToOwnedBuffer","_EPDFLayer_SaveDeltaToOwnedBufferEx","_EPDFLayer_SaveLayerArtifact","_EPDFLayer_SaveLayerArtifactEx","_EPDFLayer_SaveLayerArtifactToOwnedBuffer","_EPDFLayer_SaveLayerArtifactToOwnedBufferEx","_EPDFMeasure_AddFormat","_EPDFMeasure_CountFormats","_EPDFMeasure_GetCYX","_EPDFMeasure_GetFormat","_EPDFMeasure_GetOrigin","_EPDFMeasure_GetRatio","_EPDFMeasure_GetSubtype","_EPDFMeasure_RemoveFormats","_EPDFMeasure_SetCYX","_EPDFMeasure_SetOrigin","_EPDFMeasure_SetRatio","_EPDFNamedDest_Remove","_EPDFNamedDest_SetDest","_EPDFNumberFormat_GetConversion","_EPDFNumberFormat_GetFixedDenominator","_EPDFNumberFormat_GetFraction","_EPDFNumberFormat_GetLabelPosition","_EPDFNumberFormat_GetPrecision","_EPDFNumberFormat_GetText","_EPDFNumberFormat_GetUnit","_EPDFNumberFormat_SetConversion","_EPDFNumberFormat_SetFixedDenominator","_EPDFNumberFormat_SetFraction","_EPDFNumberFormat_SetLabelPosition","_EPDFNumberFormat_SetPrecision","_EPDFNumberFormat_SetText","_EPDFNumberFormat_SetUnit","_EPDFObjectDiff_Close","_EPDFObjectDiff_GetCount","_EPDFObjectDiff_GetEntry","_EPDFObjectDiff_GetReadStatus","_EPDFObjectDiff_GetReferrer","_EPDFObjectDiff_GetReferrerCount","_EPDFObjectDiff_GetRevisionHealth","_EPDFObjectDiff_GetValue","_EPDFOutline_CreateItem","_EPDFOutline_DeleteItem","_EPDFOutline_ExportItemRawToOwnedBuffer","_EPDFOutline_GetItem","_EPDFOutline_GetObjectNumber","_EPDFOutline_ImportItemRaw","_EPDFOutline_MoveItem","_EPDFOutline_SetAction","_EPDFOutline_SetColor","_EPDFOutline_SetOpen","_EPDFOutline_SetStyle","_EPDFOutline_SetTitle","_EPDFPage_AddViewport","_EPDFPage_AddViewportRaw","_EPDFPage_ApplyRedactions","_EPDFPage_ContinueLoad","_EPDFPage_CountViewports","_EPDFPage_CountViewportsRaw","_EPDFPage_CreateAnnot","_EPDFPage_CreateAnnotRaw","_EPDFPage_ExportAnnotationsAsDocument","_EPDFPage_ExportAnnotsRawToOwnedBuffer","_EPDFPage_ExportRawToOwnedBuffer","_EPDFPage_FindViewport","_EPDFPage_Flatten","_EPDFPage_FlattenAnnotations","_EPDFPage_GetAnnotByName","_EPDFPage_GetAnnotByObjectNumber","_EPDFPage_GetAnnotCountRaw","_EPDFPage_GetAnnotIndexByNameRaw","_EPDFPage_GetAnnotIndexByObjectNumberRaw","_EPDFPage_GetAnnotRaw","_EPDFPage_GetObjectNumber","_EPDFPage_GetParsedSize","_EPDFPage_GetViewport","_EPDFPage_GetViewportRaw","_EPDFPage_ImportAnnotsRaw","_EPDFPage_ImportRaw","_EPDFPage_InsertBlankRaw","_EPDFPage_IsContentCurrent","_EPDFPage_IsValid","_EPDFPage_MoveAnnots","_EPDFPage_MoveAnnotsRaw","_EPDFPage_PromoteInlineAnnotsRaw","_EPDFPage_RemoveAnnot","_EPDFPage_RemoveAnnotByName","_EPDFPage_RemoveAnnotByObjectNumber","_EPDFPage_RemoveAnnotRaw","_EPDFPage_RemoveViewport","_EPDFPage_RemoveViewportRaw","_EPDFPage_ResetRenderCache","_EPDFSig_CloseModel","_EPDFSig_Count","_EPDFSig_DigestByteRange","_EPDFSig_DigestFileRange","_EPDFSig_GetByteRange","_EPDFSig_GetContents","_EPDFSig_GetCoverage","_EPDFSig_GetDocMDPPermission","_EPDFSig_GetFieldMDPAction","_EPDFSig_GetFieldName","_EPDFSig_GetFieldNameAt","_EPDFSig_GetFieldNameCount","_EPDFSig_GetFieldObjNum","_EPDFSig_GetIndexByFieldObjNum","_EPDFSig_GetKind","_EPDFSig_GetLockAction","_EPDFSig_GetLockPermission","_EPDFSig_GetRevisionIndex","_EPDFSig_GetSeedValueFilter","_EPDFSig_GetSeedValueListAt","_EPDFSig_GetSeedValueListCount","_EPDFSig_GetSeedValueMDP","_EPDFSig_GetSeedValuePresentFlags","_EPDFSig_GetSeedValueRequiredFlags","_EPDFSig_GetSeedValueVersion","_EPDFSig_GetString","_EPDFSig_GetValueObjNum","_EPDFSig_GetWidgetObjNum","_EPDFSig_GetWidgetPageObjNum","_EPDFSig_HasSeedValue","_EPDFSig_IsCatalogCertification","_EPDFSig_IsRevisionChainValid","_EPDFSig_IsSigned","_EPDFSig_LoadModel","_EPDFSig_Prepare","_EPDFSig_SaveCandidate","_EPDFSig_SaveCandidateToOwnedBuffer","_EPDFSig_Seal","_EPDFSig_SealSpan","_EPDFSig_SetFieldLock","_EPDFSig_WriteContents","_EPDFText_GetCharGeometry","_EPDFText_GetCharToTextMap","_EPDFText_GetPageGeometry","_EPDFText_GetTextFull","_EPDFText_RedactInQuads","_EPDFText_RedactInRect","_EPDFViewport_AddMeasure","_EPDFViewport_Close","_EPDFViewport_GetBBox","_EPDFViewport_GetMeasure","_EPDFViewport_GetName","_EPDFViewport_RemoveMeasure","_EPDFViewport_SetBBox","_EPDFViewport_SetName","_FORM_CanRedo","_FORM_CanUndo","_FORM_DoDocumentAAction","_FORM_DoDocumentJSAction","_FORM_DoDocumentOpenAction","_FORM_DoPageAAction","_FORM_ForceToKillFocus","_FORM_GetFocusedAnnot","_FORM_GetFocusedText","_FORM_GetSelectedText","_FORM_GetTextDirection","_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_SetTextDirection","_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_GetExpansion","_FPDF_StructElement_GetID","_FPDF_StructElement_GetLang","_FPDF_StructElement_GetMarkedContentID","_FPDF_StructElement_GetMarkedContentIdAtIndex","_FPDF_StructElement_GetMarkedContentIdCount","_FPDF_StructElement_GetObjType","_FPDF_StructElement_GetParent","_FPDF_StructElement_GetRawType","_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_SetFontColor","_FPDFAnnot_SetFormFieldFlags","_FPDFAnnot_SetRect","_FPDFAnnot_SetStringValue","_FPDFAnnot_SetURI","_FPDFAnnot_UpdateObject","_FPDFAttachment_GetAFRelationship","_FPDFAttachment_GetDescription","_FPDFAttachment_GetFile","_FPDFAttachment_GetName","_FPDFAttachment_GetStringValue","_FPDFAttachment_GetSubtype","_FPDFAttachment_GetValueType","_FPDFAttachment_HasKey","_FPDFAttachment_SetDescription","_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_GetColor","_FPDFBookmark_GetCount","_FPDFBookmark_GetDest","_FPDFBookmark_GetFirstChild","_FPDFBookmark_GetNextSibling","_FPDFBookmark_GetStyle","_FPDFBookmark_GetTitle","_FPDFCatalog_GetLanguage","_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","_FPDFFormObj_RemoveObject","_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_InsertObjectAtIndex","_FPDFPage_New","_FPDFPage_RemoveAnnot","_FPDFPage_RemoveObject","_FPDFPage_SetArtBox","_FPDFPage_SetBleedBox","_FPDFPage_SetCropBox","_FPDFPage_SetMediaBox","_FPDFPage_SetRotation","_FPDFPage_SetTrimBox","_FPDFPage_TransformAnnots","_FPDFPage_TransFormWithClip","_FPDFPageObj_AddExistingMark","_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_GetRenderedFillPattern","_FPDFPageObj_GetRenderedStrokePattern","_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_GetParamFloatValue","_FPDFPageObjMark_GetParamIntValue","_FPDFPageObjMark_GetParamKey","_FPDFPageObjMark_GetParamStringValue","_FPDFPageObjMark_GetParamValueType","_FPDFPageObjMark_RemoveParam","_FPDFPageObjMark_SetBlobParam","_FPDFPageObjMark_SetFloatParam","_FPDFPageObjMark_SetIntParam","_FPDFPageObjMark_SetStringParam","_FPDFPath_BezierTo","_FPDFPath_Close","_FPDFPath_CountSegments","_FPDFPath_GetBezierControlPoints","_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_SetPositions","_FPDFText_SetText","_FPDFTextObj_GetFont","_FPDFTextObj_GetFontSize","_FPDFTextObj_GetRenderedBitmap","_FPDFTextObj_GetText","_FPDFTextObj_GetTextRenderMode","_FPDFTextObj_SetFontSize","_FPDFTextObj_SetTextRenderMode","_malloc","_free","_memory","___indirect_function_table","onRuntimeInitialized"].forEach(e=>{Object.getOwnPropertyDescriptor(y,e)||Object.defineProperty(y,e,{get:()=>J("You are getting "+e+" 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"),set:()=>J("You are setting "+e+" 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")})});var w="object"==typeof window,E="u">typeof WorkerGlobalScope,v="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type,k=!w&&!v&&!E,x=Object.assign({},t),G="./this.program",O="";if(k){if("object"==typeof process&&"function"==typeof A||"object"==typeof window||"u">typeof WorkerGlobalScope)throw 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?)")}else if(w||E){if(E?O=self.location.href:"u">typeof document&&document.currentScript&&(O=document.currentScript.src),e&&(O=e),O=O.startsWith("blob:")?"":O.substr(0,O.replace(/[?#].*/,"").lastIndexOf("/")+1),"object"!=typeof window&&"u"{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=e=>(M(!Q(e),"readAsync does not work with file:// URLs"),fetch(e,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+" : "+e.url))))}else throw Error("environment detection error");var I=t.print||console.log.bind(console),N=t.printErr||console.error.bind(console);Object.assign(t,x),x=null,Object.getOwnPropertyDescriptor(t,b="fetchSettings")&&J(`\`Module.${b}\` was supplied but \`${b}\` not included in INCOMING_MODULE_JS_API`),t.arguments&&t.arguments,er("arguments","arguments_"),t.thisProgram&&(G=t.thisProgram),er("thisProgram","thisProgram"),M(void 0===t.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.read,"Module.read option was removed"),M(void 0===t.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),M(void 0===t.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),M(void 0===t.setWindowTitle,"Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),M(void 0===t.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),er("asm","wasmExports"),er("readAsync","readAsync"),er("readBinary","readBinary"),er("setWindowTitle","setWindowTitle"),M(!v,"node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."),M(!k,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var C=t.wasmBinary;er("wasmBinary","wasmBinary"),"object"!=typeof WebAssembly&&N("no native wasm support detected");var j=!1;function M(e,t){e||J("Assertion failed"+(t?": "+t:""))}function R(){var e=a.buffer;t.HEAP8=s=new Int8Array(e),t.HEAP16=u=new Int16Array(e),t.HEAPU8=l=new Uint8Array(e),t.HEAPU16=d=new Uint16Array(e),t.HEAP32=c=new Int32Array(e),t.HEAPU32=f=new Uint32Array(e),t.HEAPF32=m=new Float32Array(e),t.HEAPF64=p=new Float64Array(e)}function T(){if(!j){var e=e1();0==e&&(e+=4);var t=f[e>>>2>>>0],n=f[e+4>>>2>>>0];(0x2135467!=t||0x89bacdfe!=n)&&J(`Stack overflow! Stack cookie has been overwritten at ${ec(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ec(n)} ${ec(t)}`),0x63736d65!=f[0]&&J("Runtime error: The application has corrupted its heap memory area (address zero)!")}}M(!t.STACK_SIZE,"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),M("u">typeof Int32Array&&"u">typeof Float64Array&&void 0!=Int32Array.prototype.subarray&&void 0!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),M(!t.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),M(!t.INITIAL_MEMORY,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var B=[],L=[],$=[],z=!1;M(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var U=0,V=null,W=null,q={};function H(e){for(var t=e;;){if(!q[e])return e;e=t+Math.random()}}function K(e){U++,t.monitorRunDependencies?.(U),e?(M(!q[e]),q[e]=1,null===V&&"u">typeof setInterval&&(V=setInterval(()=>{if(j){clearInterval(V),V=null;return}var e=!1;for(var t in q)e||(e=!0,N("still waiting on run dependencies:")),N(`dependency: ${t}`);e&&N("(end of list)")},1e4))):N("warning: run dependency added without ID")}function Z(e){if(U--,t.monitorRunDependencies?.(U),e?(M(q[e]),delete q[e]):N("warning: run dependency removed without ID"),0==U&&(null!==V&&(clearInterval(V),V=null),W)){var n=W;W=null,n()}}function J(e){t.onAbort?.(e),N(e="Aborted("+e+")"),j=!0;var n=new WebAssembly.RuntimeError(e);throw r(n),n}var Q=e=>e.startsWith("file://");function X(e,t){return(...n)=>{M(z,`native function \`${e}\` called before runtime initialization`);var r=eZ[e];return M(r,`exported native function \`${e}\` not found`),M(n.length<=t,`native function \`${e}\` called with ${n.length} args but expects ${t}`),r(...n)}}function Y(e){if(e==h&&C)return new Uint8Array(C);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e,t,n){return(!C?i(e).then(e=>new Uint8Array(e),()=>Y(e)):Promise.resolve().then(()=>Y(e))).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{N(`failed to asynchronously prepare wasm: ${e}`),Q(h)&&N(`warning: Loading from a file URI (${h}) 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`),J(e)})}var et=new Int16Array(1),en=new Int8Array(et.buffer);if(et[0]=25459,115!==en[0]||99!==en[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";if(t.ENVIRONMENT)throw Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");function er(e,n,r=!0){Object.getOwnPropertyDescriptor(t,e)||Object.defineProperty(t,e,{configurable:!0,get(){J(`\`Module.${e}\` has been replaced by \`${n}\``+(r?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":""))}})}function ei(e){return"FS_createPath"===e||"FS_createDataFile"===e||"FS_createPreloadedFile"===e||"FS_unlink"===e||"addRunDependency"===e||"FS_createLazyFile"===e||"FS_createDevice"===e||"removeRunDependency"===e}function eo(e,t){"u">typeof globalThis&&!Object.getOwnPropertyDescriptor(globalThis,e)&&Object.defineProperty(globalThis,e,{configurable:!0,get(){t()}})}function ea(e,t){eo(e,()=>{em(`\`${e}\` is not longer defined by emscripten. ${t}`)})}function es(e){Object.getOwnPropertyDescriptor(t,e)||Object.defineProperty(t,e,{configurable:!0,get(){var t=`'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;ei(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),J(t)}})}ea("buffer","Please use HEAP8.buffer or wasmMemory.buffer"),ea("asm","Please use wasmExports instead");class el{constructor(e){S(this,"name","ExitStatus"),this.message=`Program terminated with exit(${e})`,this.status=e}}var eu=e=>{for(;e.length>0;)e.shift()(t)},ed=t.noExitRuntime||!0,ec=e=>(M("number"==typeof e),"0x"+e.toString(16).padStart(8,"0")),ef=()=>e6(),em=e=>{em.shown||(em.shown={}),em.shown[e]||(em.shown[e]=1,N(e))},ep=(e,t)=>(M(e==e>>>0||e==(0|e)),M(t===(0|t)),t+2097152>>>0<4194305-!!e?(e>>>0)+0x100000000*t:0/0),eh="u">typeof TextDecoder?new TextDecoder:void 0,eF=(e,t=0,n=0/0)=>{for(var r=(t>>>=0)+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&eh)return eh.decode(e.subarray(t,i));for(var o="";t>10,56320|1023&u)}}return o},eg=(e,t)=>(M("number"==typeof e,`UTF8ToString expects a number (got ${typeof e})`),(e>>>=0)?eF(l,e,t):""),e_=()=>{M(void 0!=eC.varargs);var e=c[eC.varargs>>>2>>>0];return eC.varargs+=4,e},eP={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},normalize:e=>{var t=eP.isAbs(e),n="/"===e.substr(-1);return(e=eP.normalizeArray(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=eP.splitPath(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=eP.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return -1===t?e:e.substr(t+1)},join:(...e)=>eP.normalize(e.join("/")),join2:(e,t)=>eP.normalize(e+"/"+t)},eD=e=>(eD=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);J("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")})())(e),eb={resolve:(...e)=>{for(var t="",n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:eN.cwd();if("string"!=typeof i)throw TypeError("Arguments to path.resolve must be strings");if(!i)return"";t=i+"/"+t,n=eP.isAbs(i)}return t=eP.normalizeArray(t.split("/").filter(e=>!!e),!n).join("/"),(n?"/":"")+t||"."},relative:(e,t)=>{function n(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=eb.resolve(e).substr(1),t=eb.resolve(t).substr(1);for(var r=n(e.split("/")),i=n(t.split("/")),o=Math.min(r.length,i.length),a=o,s=0;s{for(var t=0,n=0;n=55296&&r<=57343?(t+=4,++n):t+=3}return t},eE=(e,t,n,r)=>{if(n>>>=0,M("string"==typeof e,`stringToUTF8Array expects a string (got ${typeof e})`),!(r>0))return 0;for(var i=n,o=n+r-1,a=0;a=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=o)break;t[n++>>>0]=s}else if(s<=2047){if(n+1>=o)break;t[n++>>>0]=192|s>>6,t[n++>>>0]=128|63&s}else if(s<=65535){if(n+2>=o)break;t[n++>>>0]=224|s>>12,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|63&s}else{if(n+3>=o)break;s>1114111&&em("Invalid Unicode code point "+ec(s)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[n++>>>0]=240|s>>18,t[n++>>>0]=128|s>>12&63,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|63&s}}return t[n>>>0]=0,n-i};function eA(e,t,n){var r=Array(n>0?n:ew(e)+1),i=eE(e,r,0,r.length);return t&&(r.length=i),r}var ev={ttys:[],init(){},shutdown(){},register(e,t){ev.ttys[e]={input:[],output:[],ops:t},eN.registerDevice(e,ev.stream_ops)},stream_ops:{open(e){var t=ev.ttys[e.node.rdev];if(!t)throw new eN.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new eN.ErrnoError(60);for(var o,a=0,s=0;s(()=>{if(!ey.length){var e=null;if("u">typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+=` -`),!e)return null;ey=eA(e,!0)}return ey.shift()})(),put_char(e,t){null===t||10===t?(I(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(I(eF(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,n)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(N(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(N(eF(e.output)),e.output=[])}}},eS=(e,t)=>(M(t,"alignment argument is required"),Math.ceil(e/t)*t),ek=e=>{var t,n=eX(65536,e=eS(e,65536));return n&&(t=e,l.fill(0,n,n+t)),n},ex={ops_table:null,mount:e=>ex.createNode(null,"/",16895,0),createNode(e,t,n,r){if(eN.isBlkdev(n)||eN.isFIFO(n))throw new eN.ErrnoError(63);ex.ops_table||(ex.ops_table={dir:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr,lookup:ex.node_ops.lookup,mknod:ex.node_ops.mknod,rename:ex.node_ops.rename,unlink:ex.node_ops.unlink,rmdir:ex.node_ops.rmdir,readdir:ex.node_ops.readdir,symlink:ex.node_ops.symlink},stream:{llseek:ex.stream_ops.llseek}},file:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr},stream:{llseek:ex.stream_ops.llseek,read:ex.stream_ops.read,write:ex.stream_ops.write,allocate:ex.stream_ops.allocate,mmap:ex.stream_ops.mmap,msync:ex.stream_ops.msync}},link:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr,readlink:ex.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr},stream:eN.chrdev_stream_ops}});var i=eN.createNode(e,t,n,r);return eN.isDir(i.mode)?(i.node_ops=ex.ops_table.dir.node,i.stream_ops=ex.ops_table.dir.stream,i.contents={}):eN.isFile(i.mode)?(i.node_ops=ex.ops_table.file.node,i.stream_ops=ex.ops_table.file.stream,i.usedBytes=0,i.contents=null):eN.isLink(i.mode)?(i.node_ops=ex.ops_table.link.node,i.stream_ops=ex.ops_table.link.stream):eN.isChrdev(i.mode)&&(i.node_ops=ex.ops_table.chrdev.node,i.stream_ops=ex.ops_table.chrdev.stream),i.timestamp=Date.now(),e&&(e.contents[t]=i,e.timestamp=i.timestamp),i},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),0!=n&&(t=Math.max(t,256));var r=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=eN.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,eN.isDir(e.mode)?t.size=4096:eN.isFile(e.mode)?t.size=e.usedBytes:eN.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&ex.resizeFileStorage(e,t.size)},lookup(e,t){throw new eN.ErrnoError(44)},mknod:(e,t,n,r)=>ex.createNode(e,t,n,r),rename(e,t,n){if(eN.isDir(e.mode)){var r;try{r=eN.lookupNode(t,n)}catch{}if(r)for(var i in r.contents)throw new eN.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var n=eN.lookupNode(e,t);for(var r in n.contents)throw new eN.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=ex.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!eN.isLink(e.mode))throw new eN.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var o=e.node.contents;if(i>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-i,r);if(M(a>=0),a>8&&o.subarray)t.set(o.subarray(i,i+a),n);else for(var s=0;s0||n+t>>0))}return{ptr:o,allocated:a}},msync:(e,t,n,r,i)=>(ex.stream_ops.write(e,t,0,r,n,!1),0)}},eG=t.preloadPlugins||[],eO=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},eI={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},eN={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class extends Error{constructor(e){for(var t in super(z?eg(eQ(e)):""),S(this,"name","ErrnoError"),this.errno=e,eI)if(eI[t]===e){this.code=t;break}}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){S(this,"shared",{})}get object(){return this.node}set object(e){this.node=e}get isRead(){return(2097155&this.flags)!=1}get isWrite(){return(2097155&this.flags)!=0}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){S(this,"node_ops",{}),S(this,"stream_ops",{}),S(this,"readMode",365),S(this,"writeMode",146),S(this,"mounted",null),e||(e=this),this.parent=e,this.mount=e.mount,this.id=eN.nextInode++,this.name=t,this.mode=n,this.rdev=r}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return eN.isDir(this.mode)}get isDevice(){return eN.isChrdev(this.mode)}},lookupPath(e,t={}){if(!(e=eb.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new eN.ErrnoError(32);for(var n=e.split("/").filter(e=>!!e),r=eN.root,i="/",o=0;o40)throw new eN.ErrnoError(32)}}return{path:i,node:r}},getPath(e){for(var t;;){if(eN.isRoot(e)){var n=e.mount.mountpoint;if(!t)return n;return"/"!==n[n.length-1]?`${n}/${t}`:n+t}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r>>0)%eN.nameTable.length},hashAddNode(e){var t=eN.hashName(e.parent.id,e.name);e.name_next=eN.nameTable[t],eN.nameTable[t]=e},hashRemoveNode(e){var t=eN.hashName(e.parent.id,e.name);if(eN.nameTable[t]===e)eN.nameTable[t]=e.name_next;else for(var n=eN.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=eN.mayLookup(e);if(n)throw new eN.ErrnoError(n);for(var r=eN.hashName(e.id,t),i=eN.nameTable[r];i;i=i.name_next){var o=i.name;if(i.parent.id===e.id&&o===t)return i}return eN.lookup(e,t)},createNode(e,t,n,r){M("object"==typeof e);var i=new eN.FSNode(e,t,n,r);return eN.hashAddNode(i),i},destroyNode(e){eN.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(61440&e)==32768,isDir:e=>(61440&e)==16384,isLink:e=>(61440&e)==40960,isChrdev:e=>(61440&e)==8192,isBlkdev:e=>(61440&e)==24576,isFIFO:e=>(61440&e)==4096,isSocket:e=>(49152&e)==49152,flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>eN.ignorePermissions?0:t.includes("r")&&!(292&e.mode)||t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0,mayLookup:e=>eN.isDir(e.mode)?eN.nodePermissions(e,"x")||2*!e.node_ops.lookup:54,mayCreate(e,t){try{return eN.lookupNode(e,t),20}catch(e){}return eN.nodePermissions(e,"wx")},mayDelete(e,t,n){try{r=eN.lookupNode(e,t)}catch(e){return e.errno}var r,i=eN.nodePermissions(e,"wx");if(i)return i;if(n){if(!eN.isDir(r.mode))return 54;if(eN.isRoot(r)||eN.getPath(r)===eN.cwd())return 10}else if(eN.isDir(r.mode))return 31;return 0},mayOpen:(e,t)=>e?eN.isLink(e.mode)?32:eN.isDir(e.mode)&&("r"!==eN.flagsToPermissionString(t)||512&t)?31:eN.nodePermissions(e,eN.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=eN.MAX_OPEN_FDS;e++)if(!eN.streams[e])return e;throw new eN.ErrnoError(33)},getStreamChecked(e){var t=eN.getStream(e);if(!t)throw new eN.ErrnoError(8);return t},getStream:e=>eN.streams[e],createStream:(e,t=-1)=>(M(t>=-1),e=Object.assign(new eN.FSStream,e),-1==t&&(t=eN.nextfd()),e.fd=t,eN.streams[t]=e,e),closeStream(e){eN.streams[e]=null},dupStream(e,t=-1){var n=eN.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){var t=eN.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new eN.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){eN.devices[e]={stream_ops:t}},getDevice:e=>eN.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),eN.syncFSRequests++,eN.syncFSRequests>1&&N(`warning: ${eN.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=eN.getMounts(eN.root.mount),r=0;function i(e){return M(eN.syncFSRequests>0),eN.syncFSRequests--,t(e)}function o(e){if(e)return o.errored?void 0:(o.errored=!0,i(e));++r>=n.length&&i(null)}n.forEach(t=>{if(!t.type.syncfs)return o(null);t.type.syncfs(t,e,o)})},mount(e,t,n){if("string"==typeof e)throw e;var r,i="/"===n,o=!n;if(i&&eN.root)throw new eN.ErrnoError(10);if(!i&&!o){var a=eN.lookupPath(n,{follow_mount:!1});if(n=a.path,r=a.node,eN.isMountpoint(r))throw new eN.ErrnoError(10);if(!eN.isDir(r.mode))throw new eN.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},l=e.mount(s);return l.mount=s,s.root=l,i?eN.root=l:r&&(r.mounted=s,r.mount&&r.mount.mounts.push(s)),l},unmount(e){var t=eN.lookupPath(e,{follow_mount:!1});if(!eN.isMountpoint(t.node))throw new eN.ErrnoError(28);var n=t.node,r=n.mounted,i=eN.getMounts(r);Object.keys(eN.nameTable).forEach(e=>{for(var t=eN.nameTable[e];t;){var n=t.name_next;i.includes(t.mount)&&eN.destroyNode(t),t=n}}),n.mounted=null;var o=n.mount.mounts.indexOf(r);M(-1!==o),n.mount.mounts.splice(o,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,n){var r=eN.lookupPath(e,{parent:!0}).node,i=eP.basename(e);if(!i||"."===i||".."===i)throw new eN.ErrnoError(28);var o=eN.mayCreate(r,i);if(o)throw new eN.ErrnoError(o);if(!r.node_ops.mknod)throw new eN.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},create:(e,t)=>(t=(void 0!==t?t:438)&4095|32768,eN.mknod(e,t,0)),mkdir:(e,t)=>(t=(void 0!==t?t:511)&1023|16384,eN.mknod(e,t,0)),mkdirTree(e,t){for(var n=e.split("/"),r="",i=0;i(void 0===n&&(n=t,t=438),t|=8192,eN.mknod(e,t,n)),symlink(e,t){if(!eb.resolve(e))throw new eN.ErrnoError(44);var n=eN.lookupPath(t,{parent:!0}).node;if(!n)throw new eN.ErrnoError(44);var r=eP.basename(t),i=eN.mayCreate(n,r);if(i)throw new eN.ErrnoError(i);if(!n.node_ops.symlink)throw new eN.ErrnoError(63);return n.node_ops.symlink(n,r,e)},rename(e,t){var n,r,i,o=eP.dirname(e),a=eP.dirname(t),s=eP.basename(e),l=eP.basename(t);if(n=eN.lookupPath(e,{parent:!0}).node,r=eN.lookupPath(t,{parent:!0}).node,!n||!r)throw new eN.ErrnoError(44);if(n.mount!==r.mount)throw new eN.ErrnoError(75);var u=eN.lookupNode(n,s),d=eb.relative(e,a);if("."!==d.charAt(0))throw new eN.ErrnoError(28);if("."!==(d=eb.relative(t,o)).charAt(0))throw new eN.ErrnoError(55);try{i=eN.lookupNode(r,l)}catch(e){}if(u!==i){var c=eN.isDir(u.mode),f=eN.mayDelete(n,s,c);if(f||(f=i?eN.mayDelete(r,l,c):eN.mayCreate(r,l)))throw new eN.ErrnoError(f);if(!n.node_ops.rename)throw new eN.ErrnoError(63);if(eN.isMountpoint(u)||i&&eN.isMountpoint(i))throw new eN.ErrnoError(10);if(r!==n&&(f=eN.nodePermissions(n,"w")))throw new eN.ErrnoError(f);eN.hashRemoveNode(u);try{n.node_ops.rename(u,r,l),u.parent=r}catch(e){throw e}finally{eN.hashAddNode(u)}}},rmdir(e){var t=eN.lookupPath(e,{parent:!0}).node,n=eP.basename(e),r=eN.lookupNode(t,n),i=eN.mayDelete(t,n,!0);if(i)throw new eN.ErrnoError(i);if(!t.node_ops.rmdir)throw new eN.ErrnoError(63);if(eN.isMountpoint(r))throw new eN.ErrnoError(10);t.node_ops.rmdir(t,n),eN.destroyNode(r)},readdir(e){var t=eN.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new eN.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=eN.lookupPath(e,{parent:!0}).node;if(!t)throw new eN.ErrnoError(44);var n=eP.basename(e),r=eN.lookupNode(t,n),i=eN.mayDelete(t,n,!1);if(i)throw new eN.ErrnoError(i);if(!t.node_ops.unlink)throw new eN.ErrnoError(63);if(eN.isMountpoint(r))throw new eN.ErrnoError(10);t.node_ops.unlink(t,n),eN.destroyNode(r)},readlink(e){var t=eN.lookupPath(e).node;if(!t)throw new eN.ErrnoError(44);if(!t.node_ops.readlink)throw new eN.ErrnoError(28);return eb.resolve(eN.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var n=eN.lookupPath(e,{follow:!t}).node;if(!n)throw new eN.ErrnoError(44);if(!n.node_ops.getattr)throw new eN.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>eN.stat(e,!0),chmod(e,t,n){var r;if(!(r="string"==typeof e?eN.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new eN.ErrnoError(63);r.node_ops.setattr(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})},lchmod(e,t){eN.chmod(e,t,!0)},fchmod(e,t){var n=eN.getStreamChecked(e);eN.chmod(n.node,t)},chown(e,t,n,r){var i;if(!(i="string"==typeof e?eN.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new eN.ErrnoError(63);i.node_ops.setattr(i,{timestamp:Date.now()})},lchown(e,t,n){eN.chown(e,t,n,!0)},fchown(e,t,n){var r=eN.getStreamChecked(e);eN.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new eN.ErrnoError(28);if("string"==typeof e){var n;n=eN.lookupPath(e,{follow:!0}).node}else n=e;if(!n.node_ops.setattr)throw new eN.ErrnoError(63);if(eN.isDir(n.mode))throw new eN.ErrnoError(31);if(!eN.isFile(n.mode))throw new eN.ErrnoError(28);var r=eN.nodePermissions(n,"w");if(r)throw new eN.ErrnoError(r);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=eN.getStreamChecked(e);if((2097155&n.flags)==0)throw new eN.ErrnoError(28);eN.truncate(n.node,t)},utime(e,t,n){var r=eN.lookupPath(e,{follow:!0}).node;r.node_ops.setattr(r,{timestamp:Math.max(t,n)})},open(e,n,r){if(""===e)throw new eN.ErrnoError(44);if(r=64&(n="string"==typeof n?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw Error(`Unknown file open mode: ${e}`);return t})(n):n)?4095&(r=void 0===r?438:r)|32768:0,"object"==typeof e)i=e;else{e=eP.normalize(e);try{var i;i=eN.lookupPath(e,{follow:!(131072&n)}).node}catch(e){}}var o=!1;if(64&n)if(i){if(128&n)throw new eN.ErrnoError(20)}else i=eN.mknod(e,r,0),o=!0;if(!i)throw new eN.ErrnoError(44);if(eN.isChrdev(i.mode)&&(n&=-513),65536&n&&!eN.isDir(i.mode))throw new eN.ErrnoError(54);if(!o){var a=eN.mayOpen(i,n);if(a)throw new eN.ErrnoError(a)}512&n&&!o&&eN.truncate(i,0),n&=-131713;var s=eN.createStream({node:i,path:eN.getPath(i),flags:n,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!t.logReadFiles||1&n||e in eN.readFiles||(eN.readFiles[e]=1),s},close(e){if(eN.isClosed(e))throw new eN.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{eN.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,n){if(eN.isClosed(e))throw new eN.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new eN.ErrnoError(70);if(0!=n&&1!=n&&2!=n)throw new eN.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(M(n>=0),r<0||i<0)throw new eN.ErrnoError(28);if(eN.isClosed(e)||(2097155&e.flags)==1)throw new eN.ErrnoError(8);if(eN.isDir(e.node.mode))throw new eN.ErrnoError(31);if(!e.stream_ops.read)throw new eN.ErrnoError(28);var o=void 0!==i;if(o){if(!e.seekable)throw new eN.ErrnoError(70)}else i=e.position;var a=e.stream_ops.read(e,t,n,r,i);return o||(e.position+=a),a},write(e,t,n,r,i,o){if(M(n>=0),r<0||i<0)throw new eN.ErrnoError(28);if(eN.isClosed(e)||(2097155&e.flags)==0)throw new eN.ErrnoError(8);if(eN.isDir(e.node.mode))throw new eN.ErrnoError(31);if(!e.stream_ops.write)throw new eN.ErrnoError(28);e.seekable&&1024&e.flags&&eN.llseek(e,0,2);var a=void 0!==i;if(a){if(!e.seekable)throw new eN.ErrnoError(70)}else i=e.position;var s=e.stream_ops.write(e,t,n,r,i,o);return a||(e.position+=s),s},allocate(e,t,n){if(eN.isClosed(e))throw new eN.ErrnoError(8);if(t<0||n<=0)throw new eN.ErrnoError(28);if((2097155&e.flags)==0)throw new eN.ErrnoError(8);if(!eN.isFile(e.node.mode)&&!eN.isDir(e.node.mode))throw new eN.ErrnoError(43);if(!e.stream_ops.allocate)throw new eN.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,i){if((2&r)!=0&&(2&i)==0&&(2097155&e.flags)!=2||(2097155&e.flags)==1)throw new eN.ErrnoError(2);if(!e.stream_ops.mmap)throw new eN.ErrnoError(43);if(!t)throw new eN.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync:(e,t,n,r,i)=>(M(n>=0),e.stream_ops.msync)?e.stream_ops.msync(e,t,n,r,i):0,ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new eN.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw Error(`Invalid encoding type "${t.encoding}"`);var n,r=eN.open(e,t.flags),i=eN.stat(e).size,o=new Uint8Array(i);return eN.read(r,o,0,i,0),"utf8"===t.encoding?n=eF(o):"binary"===t.encoding&&(n=o),eN.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=eN.open(e,n.flags,n.mode);if("string"==typeof t){var i=new Uint8Array(ew(t)+1),o=eE(t,i,0,i.length);eN.write(r,i,0,o,void 0,n.canOwn)}else if(ArrayBuffer.isView(t))eN.write(r,t,0,t.byteLength,void 0,n.canOwn);else throw Error("Unsupported data type");eN.close(r)},cwd:()=>eN.currentPath,chdir(e){var t=eN.lookupPath(e,{follow:!0});if(null===t.node)throw new eN.ErrnoError(44);if(!eN.isDir(t.node.mode))throw new eN.ErrnoError(54);var n=eN.nodePermissions(t.node,"x");if(n)throw new eN.ErrnoError(n);eN.currentPath=t.path},createDefaultDirectories(){eN.mkdir("/tmp"),eN.mkdir("/home"),eN.mkdir("/home/web_user")},createDefaultDevices(){eN.mkdir("/dev"),eN.registerDevice(eN.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r,llseek:()=>0}),eN.mkdev("/dev/null",eN.makedev(1,3)),ev.register(eN.makedev(5,0),ev.default_tty_ops),ev.register(eN.makedev(6,0),ev.default_tty1_ops),eN.mkdev("/dev/tty",eN.makedev(5,0)),eN.mkdev("/dev/tty1",eN.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(0===t&&(t=eD(e).byteLength),e[--t]);eN.createDevice("/dev","random",n),eN.createDevice("/dev","urandom",n),eN.mkdir("/dev/shm"),eN.mkdir("/dev/shm/tmp")},createSpecialDirectories(){eN.mkdir("/proc");var e=eN.mkdir("/proc/self");eN.mkdir("/proc/self/fd"),eN.mount({mount(){var t=eN.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var n=eN.getStreamChecked(+t),r={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return r.parent=r,r}},t}},{},"/proc/self/fd")},createStandardStreams(e,t,n){e?eN.createDevice("/dev","stdin",e):eN.symlink("/dev/tty","/dev/stdin"),t?eN.createDevice("/dev","stdout",null,t):eN.symlink("/dev/tty","/dev/stdout"),n?eN.createDevice("/dev","stderr",null,n):eN.symlink("/dev/tty1","/dev/stderr");var r=eN.open("/dev/stdin",0),i=eN.open("/dev/stdout",1),o=eN.open("/dev/stderr",1);M(0===r.fd,`invalid handle for stdin (${r.fd})`),M(1===i.fd,`invalid handle for stdout (${i.fd})`),M(2===o.fd,`invalid handle for stderr (${o.fd})`)},staticInit(){eN.nameTable=Array(4096),eN.mount(ex,{},"/"),eN.createDefaultDirectories(),eN.createDefaultDevices(),eN.createSpecialDirectories(),eN.filesystems={MEMFS:ex}},init(e,n,r){M(!eN.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),eN.initialized=!0,e??(e=t.stdin),n??(n=t.stdout),r??(r=t.stderr),eN.createStandardStreams(e,n,r)},quit(){eN.initialized=!1,eJ(0);for(var e=0;etypeof XMLHttpRequest)throw Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=o(e.url),e.usedBytes=e.contents.length}catch(e){throw new eN.ErrnoError(29)}},createLazyFile(e,t,n,r,i){if("u">typeof XMLHttpRequest){if(!E)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o={isDevice:!1,contents:new class{constructor(){S(this,"lengthKnown",!1),S(this,"chunks",[])}get(e){if(!(e>this.length-1)&&!(e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e,t=new XMLHttpRequest;if(t.open("HEAD",n,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw Error("Couldn't load "+n+". Status: "+t.status);var r=Number(t.getResponseHeader("Content-length")),i=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,o=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,a=1048576;i||(a=r);var s=this;s.setDataGetter(e=>{var t=e*a,i=(e+1)*a-1;if(i=Math.min(i,r-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,t)=>{if(e>t)throw Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>r-1)throw Error("only "+r+" bytes available! programmer error!");var i=new XMLHttpRequest;if(i.open("GET",n,!1),r!==a&&i.setRequestHeader("Range","bytes="+e+"-"+t),i.responseType="arraybuffer",i.overrideMimeType&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.send(null),!(i.status>=200&&i.status<300||304===i.status))throw Error("Couldn't load "+n+". Status: "+i.status);return void 0!==i.response?new Uint8Array(i.response||[]):eA(i.responseText||"",!0)})(t,i)),void 0===s.chunks[e])throw Error("doXHR failed!");return s.chunks[e]}),(o||!r)&&(a=r=1,a=r=this.getter(0).length,I("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=r,this._chunkSize=a,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}}}else var o={isDevice:!1,url:n};var a=eN.createFile(e,t,o,r,i);o.contents?a.contents=o.contents:o.url&&(a.contents=null,a.url=o.url),Object.defineProperties(a,{usedBytes:{get:function(){return this.contents.length}}});var l={};function u(e,t,n,r,i){var o=e.node.contents;if(i>=o.length)return 0;var a=Math.min(o.length-i,r);if(M(a>=0),o.slice)for(var s=0;s{var t=a.stream_ops[e];l[e]=(...e)=>(eN.forceLoadFile(a),t(...e))}),l.read=(e,t,n,r,i)=>(eN.forceLoadFile(a),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{eN.forceLoadFile(a);var o=ek(t);if(!o)throw new eN.ErrnoError(48);return u(e,s,o,t,n),{ptr:o,allocated:!0}},a.stream_ops=l,a},absolutePath(){J("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){J("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){J("FS.createLink has been removed; use FS.symlink instead")},joinPath(){J("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){J("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){J("FS.standardizePath has been removed; use PATH.normalize instead")}},eC={DEFAULT_POLLMASK:5,calculateAt(e,t,n){if(eP.isAbs(t))return t;if(-100===e)r=eN.cwd();else{var r;r=eC.getStreamFromFD(e).path}if(0==t.length){if(!n)throw new eN.ErrnoError(44);return r}return eP.join2(r,t)},doStat(e,t,n){var r=e(t);c[n>>>2>>>0]=r.dev,c[n+4>>>2>>>0]=r.mode,f[n+8>>>2>>>0]=r.nlink,c[n+12>>>2>>>0]=r.uid,c[n+16>>>2>>>0]=r.gid,c[n+20>>>2>>>0]=r.rdev,g=[r.size>>>0,+Math.abs(F=r.size)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+24>>>2>>>0]=g[0],c[n+28>>>2>>>0]=g[1],c[n+32>>>2>>>0]=4096,c[n+36>>>2>>>0]=r.blocks;var i=r.atime.getTime(),o=r.mtime.getTime(),a=r.ctime.getTime();return g=[Math.floor(i/1e3)>>>0,+Math.abs(F=Math.floor(i/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+40>>>2>>>0]=g[0],c[n+44>>>2>>>0]=g[1],f[n+48>>>2>>>0]=i%1e3*1e6,g=[Math.floor(o/1e3)>>>0,+Math.abs(F=Math.floor(o/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+56>>>2>>>0]=g[0],c[n+60>>>2>>>0]=g[1],f[n+64>>>2>>>0]=o%1e3*1e6,g=[Math.floor(a/1e3)>>>0,+Math.abs(F=Math.floor(a/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+72>>>2>>>0]=g[0],c[n+76>>>2>>>0]=g[1],f[n+80>>>2>>>0]=a%1e3*1e6,g=[r.ino>>>0,+Math.abs(F=r.ino)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+88>>>2>>>0]=g[0],c[n+92>>>2>>>0]=g[1],0},doMsync(e,t,n,r,i){if(!eN.isFile(t.node.mode))throw new eN.ErrnoError(43);if(2&r)return 0;var o=l.slice(e,e+n);eN.msync(t,o,i,n,r)},getStreamFromFD:e=>eN.getStreamChecked(e),varargs:void 0,getStr:e=>eg(e)},ej=(e,t,n)=>(M("number"==typeof n,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),eE(e,l,t,n)),eM=[0,31,60,91,121,152,182,213,244,274,305,335],eR=[0,31,59,90,120,151,181,212,243,273,304,334],eT=e=>{var t=a.buffer,n=(e-t.byteLength+65535)/65536|0;try{return a.grow(n),R(),1}catch(n){N(`growMemory: Attempted to grow heap from ${t.byteLength} bytes to ${e} bytes, but got error: ${n}`)}},eB={},eL=()=>{if(!eL.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:G||"./this.program"};for(var t in eB)void 0===eB[t]?delete e[t]:e[t]=eB[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);eL.strings=n}return eL.strings},e$=[],ez=e=>{var t=e$[e];return t||(e>=e$.length&&(e$.length=e+1),e$[e]=t=_.get(e)),M(_.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t},eU="u">typeof TextDecoder?new TextDecoder("utf-16le"):void 0,eV=(e,t)=>{M(e<16384),e<128?t.push(e):t.push(e%128|128,e>>7)},eW=[],eq=(e,t)=>{_.set(e,t),e$[e]=_.get(e)},eH=(e,n,r,i,o)=>{var a,l,u={string:e=>{var t,n,r=0;return null!=e&&0!==e&&(t=ew(e)+1,ej(e,n=e2(t),t),r=n),r},array:e=>{let t;var n=(t=e.length,e2(t));return M(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),s.set(e,n>>>0),n}},d=(M(a=t["_"+e],"Cannot call unknown function "+e+", make sure it is exported"),a),c=[],f=0;if(M("array"!==n,'Return type should not be "array".'),i)for(var m=0;m{var c,f=t?eb.resolve(eP.join2(e,t)):e,m=H(`cp ${f}`);function p(n){var i,c;function p(n){d?.(),l||eN.createDataFile(e,t,n,r,o,u),a?.(),Z(m)}i=()=>{s?.(),Z(m)},"u">typeof Browser&&Browser.init(),c=!1,eG.forEach(e=>{!c&&e.canHandle(f)&&(e.handle(n,f,p,i),c=!0)}),c||p(n)}(K(m),"string"==typeof n)?(c=H(`al ${n}`),i(n).then(e=>{M(e,`Loading data file "${n}" failed (no arrayBuffer).`),p(new Uint8Array(e)),c&&Z(c)},e=>{if(s)s();else throw`Loading data file "${n}" failed.`}),c&&K(c)):p(n)},eN.staticInit();var eK={__assert_fail:function(e,t,n,r){e>>>=0,t>>>=0,r>>>=0,J(`Assertion failed: ${eg(e)}, at: `+[t?eg(t):"unknown filename",n,r?eg(r):"unknown function"])},__syscall_fcntl64:function(e,t,n){eC.varargs=n>>>=0;try{var r=eC.getStreamFromFD(e);switch(t){case 0:var i=e_();if(i<0)break;for(;eN.streams[i];)i++;return eN.dupStream(r,i).fd;case 1:case 2:case 13:case 14:return 0;case 3:return r.flags;case 4:var i=e_();return r.flags|=i,0;case 12:var i=e_();return u[i+0>>>1>>>0]=2,0}return -28}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_fstat64:function(e,t){t>>>=0;try{var n=eC.getStreamFromFD(e);return eC.doStat(eN.stat,n.path,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ftruncate64:function(e,t,n){var r=ep(t,n);try{if(isNaN(r))return 61;return eN.ftruncate(e,r),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_getdents64:function(e,t,n){t>>>=0,n>>>=0;try{var r=eC.getStreamFromFD(e);r.getdents||(r.getdents=eN.readdir(r.path));for(var i=0,o=eN.llseek(r,0,1),a=Math.floor(o/280);a>>0,(F=l,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[t+i>>>2>>>0]=g[0],c[t+i+4>>>2>>>0]=g[1],g=[(a+1)*280>>>0,(F=(a+1)*280,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[t+i+8>>>2>>>0]=g[0],c[t+i+12>>>2>>>0]=g[1],u[t+i+16>>>1>>>0]=280,s[t+i+18>>>0]=d,ej(f,t+i+19,256),i+=280,a+=1}return eN.llseek(r,280*a,0),i}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ioctl:function(e,t,n){eC.varargs=n>>>=0;try{var r=eC.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:if(!r.tty)return -59;return 0;case 21505:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),o=e_();c[o>>>2>>>0]=i.c_iflag||0,c[o+4>>>2>>>0]=i.c_oflag||0,c[o+8>>>2>>>0]=i.c_cflag||0,c[o+12>>>2>>>0]=i.c_lflag||0;for(var a=0;a<32;a++)s[o+a+17>>>0]=i.c_cc[a]||0}return 0;case 21506:case 21507:case 21508:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcsets){for(var o=e_(),l=c[o>>>2>>>0],d=c[o+4>>>2>>>0],f=c[o+8>>>2>>>0],m=c[o+12>>>2>>>0],p=[],a=0;a<32;a++)p.push(s[o+a+17>>>0]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:l,c_oflag:d,c_cflag:f,c_lflag:m,c_cc:p})}return 0;case 21519:if(!r.tty)return -59;var o=e_();return c[o>>>2>>>0]=0,0;case 21520:if(!r.tty)return -59;return -28;case 21531:var o=e_();return eN.ioctl(r,t,o);case 21523:if(!r.tty)return -59;if(r.tty.ops.ioctl_tiocgwinsz){var h=r.tty.ops.ioctl_tiocgwinsz(r.tty),o=e_();u[o>>>1>>>0]=h[0],u[o+2>>>1>>>0]=h[1]}return 0;default:return -28}}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_lstat64:function(e,t){e>>>=0,t>>>=0;try{return e=eC.getStr(e),eC.doStat(eN.lstat,e,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_newfstatat:function(e,t,n,r){t>>>=0,n>>>=0;try{t=eC.getStr(t);var i=256&r,o=4096&r;return r&=-6401,M(!r,`unknown flags in __syscall_newfstatat: ${r}`),t=eC.calculateAt(e,t,o),eC.doStat(i?eN.lstat:eN.stat,t,n)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_openat:function(e,t,n,r){t>>>=0,eC.varargs=r>>>=0;try{t=eC.getStr(t),t=eC.calculateAt(e,t);var i=r?e_():0;return eN.open(t,n,i).fd}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_rmdir:function(e){e>>>=0;try{return e=eC.getStr(e),eN.rmdir(e),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_stat64:function(e,t){e>>>=0,t>>>=0;try{return e=eC.getStr(e),eC.doStat(eN.stat,e,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_unlinkat:function(e,t,n){t>>>=0;try{return t=eC.getStr(t),t=eC.calculateAt(e,t),0===n?eN.unlink(t):512===n?eN.rmdir(t):J("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_abort_js:()=>{J("native code called abort()")},_emscripten_get_now_is_monotonic:()=>1,_emscripten_memcpy_js:function(e,t,n){return e>>>=0,t>>>=0,n>>>=0,l.copyWithin(e>>>0,t>>>0,t+n>>>0)},_emscripten_throw_longjmp:()=>{throw 1/0},_gmtime_js:function(e,t,n){var r=ep(e,t);n>>>=0;var i=new Date(1e3*r);c[n>>>2>>>0]=i.getUTCSeconds(),c[n+4>>>2>>>0]=i.getUTCMinutes(),c[n+8>>>2>>>0]=i.getUTCHours(),c[n+12>>>2>>>0]=i.getUTCDate(),c[n+16>>>2>>>0]=i.getUTCMonth(),c[n+20>>>2>>>0]=i.getUTCFullYear()-1900,c[n+24>>>2>>>0]=i.getUTCDay();var o=Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0),a=(i.getTime()-o)/864e5|0;c[n+28>>>2>>>0]=a},_localtime_js:function(e,t,n){let r;var i=ep(e,t);n>>>=0;var o=new Date(1e3*i);c[n>>>2>>>0]=o.getSeconds(),c[n+4>>>2>>>0]=o.getMinutes(),c[n+8>>>2>>>0]=o.getHours(),c[n+12>>>2>>>0]=o.getDate(),c[n+16>>>2>>>0]=o.getMonth(),c[n+20>>>2>>>0]=o.getFullYear()-1900,c[n+24>>>2>>>0]=o.getDay();var a=0|((r=o.getFullYear())%4==0&&(r%100!=0||r%400==0)?eM:eR)[o.getMonth()]+o.getDate()-1;c[n+28>>>2>>>0]=a,c[n+36>>>2>>>0]=-(60*o.getTimezoneOffset());var s=new Date(o.getFullYear(),0,1),l=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=s.getTimezoneOffset(),d=0|(l!=u&&o.getTimezoneOffset()==Math.min(u,l));c[n+32>>>2>>>0]=d},_mmap_js:function(e,t,n,r,i,o,a,s){e>>>=0;var l=ep(i,o);a>>>=0,s>>>=0;try{if(isNaN(l))return 61;var u=eC.getStreamFromFD(r),d=eN.mmap(u,e,l,t,n),m=d.ptr;return c[a>>>2>>>0]=d.allocated,f[s>>>2>>>0]=m,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_munmap_js:function(e,t,n,r,i,o,a){e>>>=0,t>>>=0;var s=ep(o,a);try{var l=eC.getStreamFromFD(i);2&n&&eC.doMsync(e,l,t,r,s)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_tzset_js:function(e,t,n,r){e>>>=0,t>>>=0,n>>>=0,r>>>=0;var i=(new Date).getFullYear(),o=new Date(i,0,1),a=new Date(i,6,1),s=o.getTimezoneOffset(),l=a.getTimezoneOffset(),u=Math.max(s,l);f[e>>>2>>>0]=60*u,c[t>>>2>>>0]=Number(s!=l);var d=e=>{var t=Math.abs(e),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");return`UTC${e>=0?"-":"+"}${n}${r}`},m=d(s),p=d(l);M(m),M(p),M(16>=ew(m),`timezone name truncated to fit in TZNAME_MAX (${m})`),M(16>=ew(p),`timezone name truncated to fit in TZNAME_MAX (${p})`),lDate.now(),emscripten_err:function(e){return e>>>=0,N(eg(e))},emscripten_get_now:()=>performance.now(),emscripten_resize_heap:function(e){e>>>=0;var t=l.length;M(e>t);if(e>0xffff0000)return N(`Cannot enlarge memory, requested ${e} bytes, but the limit is 4294901760 bytes!`),!1;for(var n=1;n<=4;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+0x6000000);var i=Math.min(0xffff0000,eS(Math.max(e,r),65536));if(eT(i))return!0}return N(`Failed to grow the heap from ${t} bytes to ${i} bytes, not enough memory!`),!1},environ_get:function(e,t){e>>>=0,t>>>=0;var n=0;return eL().forEach((r,i)=>{var o=t+n;f[e+4*i>>>2>>>0]=o;for(var a=o,l=0;l>>0]=r.charCodeAt(l);s[a>>>0]=0,n+=r.length+1}),0},environ_sizes_get:function(e,t){e>>>=0,t>>>=0;var n=eL();f[e>>>2>>>0]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),f[t>>>2>>>0]=r,0},exit:(e,n)=>{if(function(){var e=I,t=N,n=!1;I=N=e=>{n=!0};try{eJ(0),["stdout","stderr"].forEach(e=>{var t=eN.analyzePath("/dev/"+e);if(t){var r=t.object.rdev,i=ev.ttys[r];i?.output?.length&&(n=!0)}})}catch{}I=e,N=t,n&&em("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}(),(ed||0)&&!n){var i=`program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=0) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;r(i),N(i)}throw ed||(t.onExit?.(e),j=!0),new el(e)},fd_close:function(e){try{var t=eC.getStreamFromFD(e);return eN.close(t),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_read:function(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=eC.getStreamFromFD(e),o=((e,t,n,r)=>{for(var i=0,o=0;o>>2>>>0],l=f[t+4>>>2>>>0];t+=8;var u=eN.read(e,s,a,l,r);if(u<0)return -1;if(i+=u,u>>2>>>0]=o,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_seek:function(e,t,n,r,i){var o=ep(t,n);i>>>=0;try{if(isNaN(o))return 61;var a=eC.getStreamFromFD(e);return eN.llseek(a,o,r),g=[a.position>>>0,(F=a.position,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[i>>>2>>>0]=g[0],c[i+4>>>2>>>0]=g[1],a.getdents&&0===o&&0===r&&(a.getdents=null),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_sync:function(e){try{var t=eC.getStreamFromFD(e);if(t.stream_ops?.fsync)return t.stream_ops.fsync(t);return 0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_write:function(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=eC.getStreamFromFD(e),o=((e,t,n,r)=>{for(var i=0,o=0;o>>2>>>0],l=f[t+4>>>2>>>0];t+=8;var u=eN.write(e,s,a,l,r);if(u<0)return -1;if(i+=u,u>>2>>>0]=o,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},invoke_ii:function(e,t){var n=ef();try{return ez(e)(t)}catch(e){if(e3(n),e!==e+0)throw e;eY(1,0)}},invoke_iii:function(e,t,n){var r=ef();try{return ez(e)(t,n)}catch(e){if(e3(r),e!==e+0)throw e;eY(1,0)}},invoke_iiii:function(e,t,n,r){var i=ef();try{return ez(e)(t,n,r)}catch(e){if(e3(i),e!==e+0)throw e;eY(1,0)}},invoke_iiiii:function(e,t,n,r,i){var o=ef();try{return ez(e)(t,n,r,i)}catch(e){if(e3(o),e!==e+0)throw e;eY(1,0)}},invoke_iiiiii:function(e,t,n,r,i,o){var a=ef();try{return ez(e)(t,n,r,i,o)}catch(e){if(e3(a),e!==e+0)throw e;eY(1,0)}},invoke_iiiiiii:function(e,t,n,r,i,o,a){var s=ef();try{return ez(e)(t,n,r,i,o,a)}catch(e){if(e3(s),e!==e+0)throw e;eY(1,0)}},invoke_v:function(e){var t=ef();try{ez(e)()}catch(e){if(e3(t),e!==e+0)throw e;eY(1,0)}},invoke_vi:function(e,t){var n=ef();try{ez(e)(t)}catch(e){if(e3(n),e!==e+0)throw e;eY(1,0)}},invoke_vii:function(e,t,n){var r=ef();try{ez(e)(t,n)}catch(e){if(e3(r),e!==e+0)throw e;eY(1,0)}},invoke_viii:function(e,t,n,r){var i=ef();try{ez(e)(t,n,r)}catch(e){if(e3(i),e!==e+0)throw e;eY(1,0)}},invoke_viiii:function(e,t,n,r,i){var o=ef();try{ez(e)(t,n,r,i)}catch(e){if(e3(o),e!==e+0)throw e;eY(1,0)}},invoke_viiiiiiiii:function(e,t,n,r,i,o,a,s,l,u){var d=ef();try{ez(e)(t,n,r,i,o,a,s,l,u)}catch(e){if(e3(d),e!==e+0)throw e;eY(1,0)}},random_get:function(e,t){e>>>=0,t>>>=0;try{return eD(l.subarray(e>>>0,e+t>>>0)),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}}},eZ=function(){function e(e,n){var r,i,o,s;let l,u;return i=Object.assign({},i=eZ=e.exports),o=e=>t=>e(t)>>>0,s=e=>()=>e()>>>0,i.strerror=(l=i.strerror,e=>l(e)>>>0),i.emscripten_builtin_memalign=(u=i.emscripten_builtin_memalign,(e,t)=>u(e,t)>>>0),i.malloc=o(i.malloc),i.emscripten_stack_get_base=s(i.emscripten_stack_get_base),i.emscripten_stack_get_end=s(i.emscripten_stack_get_end),i._emscripten_stack_alloc=o(i._emscripten_stack_alloc),i.emscripten_stack_get_current=s(i.emscripten_stack_get_current),t.wasmExports=eZ=i,M(a=eZ.memory,"memory not found in wasm exports"),R(),M(_=eZ.__indirect_function_table,"table not found in wasm exports"),r=eZ.__wasm_call_ctors,L.unshift(r),Z("wasm-instantiate"),eZ}K("wasm-instantiate");var n,i,o=t,s={env:eK,wasi_snapshot_preview1:eK};if(t.instantiateWasm)try{return t.instantiateWasm(s,e)}catch(e){N(`Module.instantiateWasm callback failed with error: ${e}`),r(e)}return h??(h=function(){if(t.locateFile){var e="embedpdf.wasm";return e.startsWith("data:application/octet-stream;base64,")?e:t.locateFile?t.locateFile(e,O):O+e}return new URL("embedpdf.wasm",self.location.href).href}()),(n=h,i=function(n){M(t===o,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),o=null,e(n.instance)},!C&&"function"==typeof WebAssembly.instantiateStreaming&&!n.startsWith("data:application/octet-stream;base64,")&&"function"==typeof fetch?fetch(n,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,s).then(i,function(e){return N(`wasm streaming compile failed: ${e}`),N("falling back to ArrayBuffer instantiation"),ee(n,s,i)})):ee(n,s,i)).catch(r),{}}();X("__wasm_call_ctors",0),t._EPDFAction_CloseModel=X("EPDFAction_CloseModel",1),t._EPDFAction_LoadModel=X("EPDFAction_LoadModel",1),t._EPDFAction_GetRootNode=X("EPDFAction_GetRootNode",1),t._EPDFAction_GetNodeCount=X("EPDFAction_GetNodeCount",1),t._EPDFAction_GetNodeType=X("EPDFAction_GetNodeType",2),t._EPDFAction_GetNodeSubtype=X("EPDFAction_GetNodeSubtype",4),t._EPDFAction_NodeHasJavaScript=X("EPDFAction_NodeHasJavaScript",2),t._EPDFAction_GetNodeJavaScript=X("EPDFAction_GetNodeJavaScript",4),t._EPDFAction_GetNodeDest=X("EPDFAction_GetNodeDest",3),t._EPDFAction_GetNodeURI=X("EPDFAction_GetNodeURI",5),t._EPDFAction_GetNodeFilePath=X("EPDFAction_GetNodeFilePath",4),t._EPDFAction_GetNodeName=X("EPDFAction_GetNodeName",4),t._EPDFAction_GetNodeTargetCount=X("EPDFAction_GetNodeTargetCount",2),t._EPDFAction_GetNodeTargetName=X("EPDFAction_GetNodeTargetName",5),t._EPDFAction_GetNodeTargetObjectNumber=X("EPDFAction_GetNodeTargetObjectNumber",4),t._EPDFAction_GetNodeHideFlag=X("EPDFAction_GetNodeHideFlag",3),t._EPDFAction_GetNodeResetForm=X("EPDFAction_GetNodeResetForm",4),t._EPDFAction_GetNodeSubmitForm=X("EPDFAction_GetNodeSubmitForm",4),t._EPDFAction_GetNodeSubmitFormURL=X("EPDFAction_GetNodeSubmitFormURL",4),t._EPDFAction_GetNodeSubmitFormCharSet=X("EPDFAction_GetNodeSubmitFormCharSet",4),t._EPDFAction_GetNodeURIIsMap=X("EPDFAction_GetNodeURIIsMap",3),t._EPDFAction_GetNextCount=X("EPDFAction_GetNextCount",2),t._EPDFAction_GetNextAt=X("EPDFAction_GetNextAt",3),t._EPDFAction_GetWarningFlags=X("EPDFAction_GetWarningFlags",1),t._EPDFAction_IsComplete=X("EPDFAction_IsComplete",1),t._EPDFDoc_GetOpenActionModel=X("EPDFDoc_GetOpenActionModel",1),t._EPDFDoc_GetOpenActionDest=X("EPDFDoc_GetOpenActionDest",1),t._EPDFDoc_GetAdditionalActionModel=X("EPDFDoc_GetAdditionalActionModel",2),t._EPDFDoc_GetPageActionModel=X("EPDFDoc_GetPageActionModel",3),t._EPDFAnnot_GetActionModel=X("EPDFAnnot_GetActionModel",2),t._EPDFAction_CreateJavaScript=X("EPDFAction_CreateJavaScript",2),t._EPDFAction_CreateHide=X("EPDFAction_CreateHide",4),t._EPDFAction_CreateResetForm=X("EPDFAction_CreateResetForm",4),t._EPDFAction_CreateSubmitForm=X("EPDFAction_CreateSubmitForm",5),t._EPDFAction_SetNext=X("EPDFAction_SetNext",4),t._EPDFAnnot_SetEventAction=X("EPDFAnnot_SetEventAction",3),t._EPDFAnnot_SetNumberValue=X("EPDFAnnot_SetNumberValue",3),t._EPDFAnnot_HasEmbedMetadata=X("EPDFAnnot_HasEmbedMetadata",1),t._EPDFAnnot_ClearEmbedMetadata=X("EPDFAnnot_ClearEmbedMetadata",1),t._EPDFAnnot_ClearEmbedMetadataKey=X("EPDFAnnot_ClearEmbedMetadataKey",2),t._EPDFAnnot_SetEmbedMetadataString=X("EPDFAnnot_SetEmbedMetadataString",3),t._EPDFAnnot_GetEmbedMetadataString=X("EPDFAnnot_GetEmbedMetadataString",4),t._EPDFAnnot_SetEmbedMetadataNumber=X("EPDFAnnot_SetEmbedMetadataNumber",3),t._EPDFAnnot_GetEmbedMetadataNumber=X("EPDFAnnot_GetEmbedMetadataNumber",3),t._EPDFAnnot_SetEmbedMetadataBoolean=X("EPDFAnnot_SetEmbedMetadataBoolean",3),t._EPDFAnnot_GetEmbedMetadataBoolean=X("EPDFAnnot_GetEmbedMetadataBoolean",3),t._EPDFAnnot_SetEmbedMetadataRect=X("EPDFAnnot_SetEmbedMetadataRect",3),t._EPDFAnnot_GetEmbedMetadataRect=X("EPDFAnnot_GetEmbedMetadataRect",3),t._EPDFAnnot_SetEmbedMetadataJSON=X("EPDFAnnot_SetEmbedMetadataJSON",2),t._EPDFAnnot_GetEmbedMetadataJSON=X("EPDFAnnot_GetEmbedMetadataJSON",3),t._EPDFDocument_ClearEmbedMetadata=X("EPDFDocument_ClearEmbedMetadata",1),t._EPDFAnnot_SetAction=X("EPDFAnnot_SetAction",2),t._EPDFAnnot_RemoveAction=X("EPDFAnnot_RemoveAction",1),t._EPDFAnnot_RemoveDest=X("EPDFAnnot_RemoveDest",1),t._EPDFAnnot_RemoveKey=X("EPDFAnnot_RemoveKey",2),t._EPDFAnnot_GetFileAttachmentForWrite=X("EPDFAnnot_GetFileAttachmentForWrite",1),t._EPDFAnnot_SetColor=X("EPDFAnnot_SetColor",5),t._EPDFAnnot_GetColor=X("EPDFAnnot_GetColor",5),t._EPDFAnnot_ClearColor=X("EPDFAnnot_ClearColor",2),t._EPDFAnnot_SetNoColor=X("EPDFAnnot_SetNoColor",2),t._EPDFAnnot_SetOpacity=X("EPDFAnnot_SetOpacity",2),t._EPDFAnnot_GetOpacity=X("EPDFAnnot_GetOpacity",2),t._EPDFAnnot_GetBorderEffect=X("EPDFAnnot_GetBorderEffect",2),t._EPDFAnnot_SetBorderEffect=X("EPDFAnnot_SetBorderEffect",2),t._EPDFAnnot_ClearBorderEffect=X("EPDFAnnot_ClearBorderEffect",1),t._EPDFAnnot_GetRectangleDifferences=X("EPDFAnnot_GetRectangleDifferences",5),t._EPDFAnnot_ClearRectangleDifferences=X("EPDFAnnot_ClearRectangleDifferences",1),t._EPDFAnnot_GetBorderDashPatternCount=X("EPDFAnnot_GetBorderDashPatternCount",1),t._EPDFAnnot_GetBorderDashPattern=X("EPDFAnnot_GetBorderDashPattern",3),t._EPDFAnnot_SetBorderDashPattern=X("EPDFAnnot_SetBorderDashPattern",3),t._EPDFAnnot_GetBorderStyle=X("EPDFAnnot_GetBorderStyle",2),t._EPDFAnnot_SetBorderStyle=X("EPDFAnnot_SetBorderStyle",3),t._EPDFAnnot_GenerateAppearance=X("EPDFAnnot_GenerateAppearance",1),t._EPDFAnnot_GenerateAppearanceWithBlend=X("EPDFAnnot_GenerateAppearanceWithBlend",2),t._EPDFAnnot_GetBlendMode=X("EPDFAnnot_GetBlendMode",1),t._EPDFAnnot_SetIntent=X("EPDFAnnot_SetIntent",2),t._EPDFAnnot_GetIntent=X("EPDFAnnot_GetIntent",3),t._EPDFAnnot_GetRichContent=X("EPDFAnnot_GetRichContent",3),t._EPDFAnnot_GetRichTextJSON=X("EPDFAnnot_GetRichTextJSON",3),t._EPDFAnnot_SetRichTextJSON=X("EPDFAnnot_SetRichTextJSON",2),t._EPDFAnnot_SetRichTextXHTML=X("EPDFAnnot_SetRichTextXHTML",2),t._EPDFDoc_SetTypographicFeatures=X("EPDFDoc_SetTypographicFeatures",2),t._EPDFDoc_GetTypographicFeatures=X("EPDFDoc_GetTypographicFeatures",1),t._EPDFAnnot_SetLineEndings=X("EPDFAnnot_SetLineEndings",3),t._EPDFAnnot_GetLineEndings=X("EPDFAnnot_GetLineEndings",3),t._EPDFAnnot_SetVertices=X("EPDFAnnot_SetVertices",3),t._EPDFAnnot_SetLine=X("EPDFAnnot_SetLine",3),t._EPDFAnnot_SetDefaultAppearance=X("EPDFAnnot_SetDefaultAppearance",6),t._EPDFAnnot_SetDefaultAppearanceRegisteredFont=X("EPDFAnnot_SetDefaultAppearanceRegisteredFont",6),t._EPDFAnnot_GetDefaultAppearance=X("EPDFAnnot_GetDefaultAppearance",6),t._EPDFAnnot_GetDefaultAppearanceFontFace=X("EPDFAnnot_GetDefaultAppearanceFontFace",5),t._EPDFAnnot_GetDefaultAppearanceFontPostScriptName=X("EPDFAnnot_GetDefaultAppearanceFontPostScriptName",3),t._EPDFAnnot_SetDefaultAppearanceDocumentFont=X("EPDFAnnot_SetDefaultAppearanceDocumentFont",6),t._EPDFAnnot_SetTextAlignment=X("EPDFAnnot_SetTextAlignment",2),t._EPDFAnnot_GetTextAlignment=X("EPDFAnnot_GetTextAlignment",1),t._EPDFPage_GetAnnotByName=X("EPDFPage_GetAnnotByName",2),t._EPDFPage_RemoveAnnotByName=X("EPDFPage_RemoveAnnotByName",2),t._EPDFAnnot_SetLinkedAnnot=X("EPDFAnnot_SetLinkedAnnot",3),t._EPDFPage_GetAnnotIndexByNameRaw=X("EPDFPage_GetAnnotIndexByNameRaw",3),t._EPDFPage_GetAnnotIndexByObjectNumberRaw=X("EPDFPage_GetAnnotIndexByObjectNumberRaw",3),t._EPDFPage_GetAnnotCountRaw=X("EPDFPage_GetAnnotCountRaw",2),t._EPDFPage_GetAnnotRaw=X("EPDFPage_GetAnnotRaw",3),t._EPDFPage_CreateAnnotRaw=X("EPDFPage_CreateAnnotRaw",4),t._EPDFPage_RemoveAnnotRaw=X("EPDFPage_RemoveAnnotRaw",3),t._EPDFPage_PromoteInlineAnnotsRaw=X("EPDFPage_PromoteInlineAnnotsRaw",2),t._EPDFAnnot_IsValid=X("EPDFAnnot_IsValid",1),t._EPDFAnnot_SetSubtype=X("EPDFAnnot_SetSubtype",2),t._EPDFAnnot_SetName=X("EPDFAnnot_SetName",2),t._EPDFAnnot_GetName=X("EPDFAnnot_GetName",3),t._EPDFAnnot_UpdateAppearanceToRect=X("EPDFAnnot_UpdateAppearanceToRect",2),t._EPDFAnnot_SetStampOpacity=X("EPDFAnnot_SetStampOpacity",3),t._EPDFPage_CreateAnnot=X("EPDFPage_CreateAnnot",2),t._EPDFAnnot_SetRotate=X("EPDFAnnot_SetRotate",2),t._EPDFAnnot_GetRotate=X("EPDFAnnot_GetRotate",2),t._EPDFAnnot_GetAppearanceTransform=X("EPDFAnnot_GetAppearanceTransform",3),t._EPDFAnnot_GetReplyType=X("EPDFAnnot_GetReplyType",1),t._EPDFAnnot_SetReplyType=X("EPDFAnnot_SetReplyType",2),t._EPDFAnnot_GetBooleanValue=X("EPDFAnnot_GetBooleanValue",3),t._EPDFAnnot_SetBooleanValue=X("EPDFAnnot_SetBooleanValue",3),t._EPDFAnnot_SetOverlayText=X("EPDFAnnot_SetOverlayText",2),t._EPDFAnnot_GetOverlayText=X("EPDFAnnot_GetOverlayText",3),t._EPDFAnnot_SetOverlayTextRepeat=X("EPDFAnnot_SetOverlayTextRepeat",2),t._EPDFAnnot_GetOverlayTextRepeat=X("EPDFAnnot_GetOverlayTextRepeat",1),t._EPDFAnnot_SetAppearanceFromPage=X("EPDFAnnot_SetAppearanceFromPage",3),t._EPDFAnnot_ExportAppearance=X("EPDFAnnot_ExportAppearance",3),t._EPDFDoc_CanonicalDrawing=X("EPDFDoc_CanonicalDrawing",2),t._EPDFDoc_ImportDrawing=X("EPDFDoc_ImportDrawing",2),t._EPDFDoc_ExportDrawing=X("EPDFDoc_ExportDrawing",2),t._EPDFDoc_GetDrawings=X("EPDFDoc_GetDrawings",3),t._EPDFAnnot_SetDrawing=X("EPDFAnnot_SetDrawing",3),t._EPDFAnnot_GetDrawing=X("EPDFAnnot_GetDrawing",1),t._EPDFAnnot_GetRect=X("EPDFAnnot_GetRect",2),t._EPDFAnnot_SetRect=X("EPDFAnnot_SetRect",2),t._EPDFAnnot_SetAPMatrix=X("EPDFAnnot_SetAPMatrix",3),t._EPDFAnnot_GetAPMatrix=X("EPDFAnnot_GetAPMatrix",3),t._EPDFAnnot_GetAvailableAppearanceModes=X("EPDFAnnot_GetAvailableAppearanceModes",1),t._EPDFAnnot_GetAppearanceStateCount=X("EPDFAnnot_GetAppearanceStateCount",2),t._EPDFAnnot_GetAppearanceStateName=X("EPDFAnnot_GetAppearanceStateName",5),t._EPDFAnnot_GetAppearanceState=X("EPDFAnnot_GetAppearanceState",3),t._EPDFAnnot_HasAppearanceStream=X("EPDFAnnot_HasAppearanceStream",2),t._EPDFAnnot_GetDrawingRect=X("EPDFAnnot_GetDrawingRect",3),t._EPDFAnnot_SetMKColor=X("EPDFAnnot_SetMKColor",5),t._EPDFAnnot_GetMKColor=X("EPDFAnnot_GetMKColor",5),t._EPDFAnnot_ClearMKColor=X("EPDFAnnot_ClearMKColor",2),t._EPDFAnnot_SetMKText=X("EPDFAnnot_SetMKText",3),t._EPDFAnnot_GetMKText=X("EPDFAnnot_GetMKText",4),t._EPDFAnnot_SetMKTextPosition=X("EPDFAnnot_SetMKTextPosition",2),t._EPDFAnnot_GetMKTextPosition=X("EPDFAnnot_GetMKTextPosition",1),t._EPDFAnnot_SetMKIcon=X("EPDFAnnot_SetMKIcon",3),t._EPDFAnnot_GetMKIcon=X("EPDFAnnot_GetMKIcon",2),t._EPDFAnnot_ClearMKIcon=X("EPDFAnnot_ClearMKIcon",2),t._EPDFAnnot_HasMKIcon=X("EPDFAnnot_HasMKIcon",2),t._EPDFAnnot_SetMKRotation=X("EPDFAnnot_SetMKRotation",2),t._EPDFAnnot_GetMKRotation=X("EPDFAnnot_GetMKRotation",1),t._EPDFAnnot_GenerateFormFieldAP=X("EPDFAnnot_GenerateFormFieldAP",1),t._EPDFAnnot_GetCalloutLineCount=X("EPDFAnnot_GetCalloutLineCount",1),t._EPDFAnnot_GetCalloutLine=X("EPDFAnnot_GetCalloutLine",3),t._EPDFAnnot_SetCalloutLine=X("EPDFAnnot_SetCalloutLine",3),t._EPDFAnnot_GetObjectNumber=X("EPDFAnnot_GetObjectNumber",1),t._EPDFAnnot_GetStructurePosition=X("EPDFAnnot_GetStructurePosition",3),t._EPDFPage_GetAnnotByObjectNumber=X("EPDFPage_GetAnnotByObjectNumber",2),t._EPDFPage_RemoveAnnot=X("EPDFPage_RemoveAnnot",2),t._EPDFPage_RemoveAnnotByObjectNumber=X("EPDFPage_RemoveAnnotByObjectNumber",2),t._EPDFPage_MoveAnnots=X("EPDFPage_MoveAnnots",4),t._EPDFPage_MoveAnnotsRaw=X("EPDFPage_MoveAnnotsRaw",5),t._EPDF_LoadBaseDocument=X("EPDF_LoadBaseDocument",2),t._EPDF_LoadMemBaseDocument=X("EPDF_LoadMemBaseDocument",3),t._EPDF_LoadMemBaseDocument64=X("EPDF_LoadMemBaseDocument64",3),t._EPDF_ReleaseBaseDocument=X("EPDF_ReleaseBaseDocument",1),t._EPDFPage_ExportAnnotsRawToOwnedBuffer=X("EPDFPage_ExportAnnotsRawToOwnedBuffer",5),t._EPDFPage_ImportAnnotsRaw=X("EPDFPage_ImportAnnotsRaw",4),t._EPDFDoc_ExportDictRawToOwnedBuffer=X("EPDFDoc_ExportDictRawToOwnedBuffer",4),t._EPDFDoc_ExportDictCanonicalToOwnedBuffer=X("EPDFDoc_ExportDictCanonicalToOwnedBuffer",5),t._EPDFDoc_ImportDictRaw=X("EPDFDoc_ImportDictRaw",3),t._EPDFForm_ExportFieldRawToOwnedBuffer=X("EPDFForm_ExportFieldRawToOwnedBuffer",3),t._EPDFForm_ImportFieldRaw=X("EPDFForm_ImportFieldRaw",3),t._EPDFOutline_ExportItemRawToOwnedBuffer=X("EPDFOutline_ExportItemRawToOwnedBuffer",3),t._EPDFOutline_ImportItemRaw=X("EPDFOutline_ImportItemRaw",3),t._EPDFPage_ExportRawToOwnedBuffer=X("EPDFPage_ExportRawToOwnedBuffer",3),t._EPDFPage_ImportRaw=X("EPDFPage_ImportRaw",3),t._EPDFAttachment_ExportRawToOwnedBuffer=X("EPDFAttachment_ExportRawToOwnedBuffer",3),t._EPDFAttachment_ExportCanonicalToOwnedBuffer=X("EPDFAttachment_ExportCanonicalToOwnedBuffer",3),t._EPDFAttachment_ImportRaw=X("EPDFAttachment_ImportRaw",3),t._EPDFCatalog_GetMetadata=X("EPDFCatalog_GetMetadata",3),t._EPDFCatalog_SetMetadata=X("EPDFCatalog_SetMetadata",3),t._EPDFFont_RegisterFont=X("EPDFFont_RegisterFont",4),t._EPDFFont_RegisterMemFont=X("EPDFFont_RegisterMemFont",5),t._EPDFFont_RegisterMemFont64=X("EPDFFont_RegisterMemFont64",5),t._EPDFFont_ClearRegisteredFonts=X("EPDFFont_ClearRegisteredFonts",0),t._EPDFFont_GetEmbeddingPermission=X("EPDFFont_GetEmbeddingPermission",1),t._EPDFFont_IsEditingAuthorized=X("EPDFFont_IsEditingAuthorized",1),t._EPDFFont_AuthorizeEditing=X("EPDFFont_AuthorizeEditing",1),t._EPDFFont_IsInstanced=X("EPDFFont_IsInstanced",1),t._EPDFFont_GetFamilyName=X("EPDFFont_GetFamilyName",3),t._EPDFFont_GetWeight=X("EPDFFont_GetWeight",1),t._EPDFFont_IsItalic=X("EPDFFont_IsItalic",1),t._EPDFDoc_SetFontEmbeddingPolicy=X("EPDFDoc_SetFontEmbeddingPolicy",2),t._EPDFDoc_GetFontEmbeddingPolicy=X("EPDFDoc_GetFontEmbeddingPolicy",1),t._EPDFFont_AddFallbackFont=X("EPDFFont_AddFallbackFont",2),t._EPDFFont_ClearFallbackFonts=X("EPDFFont_ClearFallbackFonts",0),t._EPDFFont_SetLastResortFont=X("EPDFFont_SetLastResortFont",1),t._EPDFFont_GetLastResortFont=X("EPDFFont_GetLastResortFont",0),t._EPDFFont_GetFallbackOrder=X("EPDFFont_GetFallbackOrder",4),t._EPDFFont_GetProgramData=X("EPDFFont_GetProgramData",3),t._EPDFFont_GetProgramFormat=X("EPDFFont_GetProgramFormat",1),t._EPDFFont_GetProgramHash=X("EPDFFont_GetProgramHash",2),t._EPDFFont_GetCoverage=X("EPDFFont_GetCoverage",3),t._EPDFFont_GetMetrics=X("EPDFFont_GetMetrics",3),t._EPDFFont_GetPostScriptName=X("EPDFFont_GetPostScriptName",3),t._EPDFFontFaces_Load=X("EPDFFontFaces_Load",1),t._EPDFFontFaces_Close=X("EPDFFontFaces_Close",1),t._EPDFDoc_GetFontsFingerprint=X("EPDFDoc_GetFontsFingerprint",2),t._EPDFFontFaces_Count=X("EPDFFontFaces_Count",1),t._EPDFFontFaces_GetFamily=X("EPDFFontFaces_GetFamily",4),t._EPDFFontFaces_GetWeight=X("EPDFFontFaces_GetWeight",2),t._EPDFFontFaces_IsItalic=X("EPDFFontFaces_IsItalic",2),t._EPDFFontFaces_CountPrograms=X("EPDFFontFaces_CountPrograms",2),t._EPDFFontFaces_GetProgramObjNum=X("EPDFFontFaces_GetProgramObjNum",3),t._EPDFFontFaces_GetProgramFormat=X("EPDFFontFaces_GetProgramFormat",3),t._EPDFFontFaces_GetProgramEmbedded=X("EPDFFontFaces_GetProgramEmbedded",3),t._EPDFFontFaces_GetProgramPostScriptName=X("EPDFFontFaces_GetProgramPostScriptName",5),t._EPDFFontFaces_GetProgramEmbeddingPermission=X("EPDFFontFaces_GetProgramEmbeddingPermission",3),t._EPDFFontFaces_ProgramMapsUnicode=X("EPDFFontFaces_ProgramMapsUnicode",3),t._EPDFFontFaces_GetProgramHash=X("EPDFFontFaces_GetProgramHash",4),t._EPDFFontFaces_GetProgramDisplayHash=X("EPDFFontFaces_GetProgramDisplayHash",4),t._EPDFFontFaces_GetProgramMetrics=X("EPDFFontFaces_GetProgramMetrics",5),t._EPDFDoc_GetFontProgramData=X("EPDFDoc_GetFontProgramData",4),t._EPDFDoc_GetFontDisplayProgramData=X("EPDFDoc_GetFontDisplayProgramData",4),t._EPDFDoc_GetFontDisplayProgramCoverage=X("EPDFDoc_GetFontDisplayProgramCoverage",4),t._EPDFDoc_ResolveFonts=X("EPDFDoc_ResolveFonts",8),t._EPDFFontResolution_Close=X("EPDFFontResolution_Close",1),t._EPDFFontResolution_GetSource=X("EPDFFontResolution_GetSource",2),t._EPDFFontResolution_GetRegisteredFont=X("EPDFFontResolution_GetRegisteredFont",2),t._EPDFFontResolution_GetProgramObjNum=X("EPDFFontResolution_GetProgramObjNum",2),t._EPDFFontResolution_GetProgramDisplayHash=X("EPDFFontResolution_GetProgramDisplayHash",3),t._EPDFFontResolution_GetBaseFontName=X("EPDFFontResolution_GetBaseFontName",4),t._EPDFFontResolution_GetFamily=X("EPDFFontResolution_GetFamily",4),t._EPDFFontResolution_GetWeight=X("EPDFFontResolution_GetWeight",2),t._EPDFFontResolution_IsItalic=X("EPDFFontResolution_IsItalic",2),t._EPDFFontResolution_IsDegraded=X("EPDFFontResolution_IsDegraded",2),t._EPDFFontResolution_GetFallbacks=X("EPDFFontResolution_GetFallbacks",4),t._EPDFFontResolution_CountMissingCharacters=X("EPDFFontResolution_CountMissingCharacters",1),t._EPDFFontResolution_GetMissingCharacter=X("EPDFFontResolution_GetMissingCharacter",4),t._EPDFDoc_ClearMissingCharacters=X("EPDFDoc_ClearMissingCharacters",1),t._EPDFDoc_CountMissingCharacters=X("EPDFDoc_CountMissingCharacters",1),t._EPDFDoc_GetMissingCharacter=X("EPDFDoc_GetMissingCharacter",4),t._EPDFForm_LoadModel=X("EPDFForm_LoadModel",1),t._EPDFForm_CloseModel=X("EPDFForm_CloseModel",1),t._EPDFForm_GetFormKind=X("EPDFForm_GetFormKind",1),t._EPDFForm_GetNeedAppearances=X("EPDFForm_GetNeedAppearances",1),t._EPDFForm_CountFields=X("EPDFForm_CountFields",1),t._EPDFForm_GetFieldActionModel=X("EPDFForm_GetFieldActionModel",3),t._EPDFForm_CountCalculationOrder=X("EPDFForm_CountCalculationOrder",1),t._EPDFForm_GetCalculationOrderFieldIndex=X("EPDFForm_GetCalculationOrderFieldIndex",2),t._EPDFForm_GetFieldObjNum=X("EPDFForm_GetFieldObjNum",2),t._EPDFForm_GetFieldFamily=X("EPDFForm_GetFieldFamily",2),t._EPDFForm_GetFieldFlags=X("EPDFForm_GetFieldFlags",2),t._EPDFForm_GetFieldOrigin=X("EPDFForm_GetFieldOrigin",2),t._EPDFForm_GetFieldName=X("EPDFForm_GetFieldName",4),t._EPDFForm_GetFieldAlternateName=X("EPDFForm_GetFieldAlternateName",4),t._EPDFForm_GetFieldMappingName=X("EPDFForm_GetFieldMappingName",4),t._EPDFForm_HasFieldEmbedMetadata=X("EPDFForm_HasFieldEmbedMetadata",2),t._EPDFForm_HasFieldValuesList=X("EPDFForm_HasFieldValuesList",2),t._EPDFForm_GetFieldEmbedMetadataString=X("EPDFForm_GetFieldEmbedMetadataString",5),t._EPDFForm_GetFieldEmbedMetadataNumber=X("EPDFForm_GetFieldEmbedMetadataNumber",4),t._EPDFForm_GetFieldEmbedMetadataBoolean=X("EPDFForm_GetFieldEmbedMetadataBoolean",4),t._EPDFForm_GetFieldEmbedMetadataJSON=X("EPDFForm_GetFieldEmbedMetadataJSON",4),t._EPDFForm_GetFieldValueKind=X("EPDFForm_GetFieldValueKind",2),t._EPDFForm_CountFieldValues=X("EPDFForm_CountFieldValues",2),t._EPDFForm_GetFieldValueAt=X("EPDFForm_GetFieldValueAt",5),t._EPDFForm_GetFieldDefaultValueKind=X("EPDFForm_GetFieldDefaultValueKind",2),t._EPDFForm_CountFieldDefaultValues=X("EPDFForm_CountFieldDefaultValues",2),t._EPDFForm_GetFieldDefaultValueAt=X("EPDFForm_GetFieldDefaultValueAt",5),t._EPDFForm_GetFieldMaxLen=X("EPDFForm_GetFieldMaxLen",2),t._EPDFForm_GetFieldTopIndex=X("EPDFForm_GetFieldTopIndex",2),t._EPDFForm_CountFieldOptions=X("EPDFForm_CountFieldOptions",2),t._EPDFForm_GetFieldOptionLabel=X("EPDFForm_GetFieldOptionLabel",5),t._EPDFForm_GetFieldOptionValue=X("EPDFForm_GetFieldOptionValue",5),t._EPDFForm_IsFieldOptionSelected=X("EPDFForm_IsFieldOptionSelected",3),t._EPDFForm_CountFieldWidgets=X("EPDFForm_CountFieldWidgets",2),t._EPDFForm_GetFieldWidgetObjNum=X("EPDFForm_GetFieldWidgetObjNum",3),t._EPDFForm_GetFieldWidgetPageObjNum=X("EPDFForm_GetFieldWidgetPageObjNum",3),t._EPDFForm_GetFieldWidgetRect=X("EPDFForm_GetFieldWidgetRect",4),t._EPDFForm_GetFieldWidgetOnState=X("EPDFForm_GetFieldWidgetOnState",5),t._EPDFForm_GetFieldWidgetExportValue=X("EPDFForm_GetFieldWidgetExportValue",5),t._EPDFForm_IsFieldWidgetChecked=X("EPDFForm_IsFieldWidgetChecked",3),t._EPDFForm_GetFieldIndexByObjNum=X("EPDFForm_GetFieldIndexByObjNum",2),t._EPDFForm_GetFieldIndexForWidget=X("EPDFForm_GetFieldIndexForWidget",2),t._EPDFForm_SetFieldValue=X("EPDFForm_SetFieldValue",5),t._EPDFForm_SetFieldDefaultValue=X("EPDFForm_SetFieldDefaultValue",5),t._EPDFForm_SetFieldSelectedIndices=X("EPDFForm_SetFieldSelectedIndices",4),t._EPDFForm_SetFieldWidgetsChecked=X("EPDFForm_SetFieldWidgetsChecked",7),t._EPDFForm_RedrawFieldWidgets=X("EPDFForm_RedrawFieldWidgets",5),t._EPDFForm_SetFieldDisplay=X("EPDFForm_SetFieldDisplay",6),t._EPDFForm_SetFieldAppearanceText=X("EPDFForm_SetFieldAppearanceText",6),t._EPDFForm_ExportFDF=X("EPDFForm_ExportFDF",5),t._EPDFForm_ExportXFDF=X("EPDFForm_ExportXFDF",5),t._EPDFForm_Repair=X("EPDFForm_Repair",3),t._EPDFForm_CreateField=X("EPDFForm_CreateField",4),t._EPDFForm_AttachWidget=X("EPDFForm_AttachWidget",6),t._EPDFForm_DetachWidget=X("EPDFForm_DetachWidget",3),t._EPDFForm_DeleteField=X("EPDFForm_DeleteField",5),t._EPDFForm_SetFieldName=X("EPDFForm_SetFieldName",3),t._EPDFForm_GetFieldPartialName=X("EPDFForm_GetFieldPartialName",4),t._EPDFForm_SetFieldFlags=X("EPDFForm_SetFieldFlags",4),t._EPDFForm_SetFieldEventAction=X("EPDFForm_SetFieldEventAction",4),t._EPDFForm_SetCalculationOrder=X("EPDFForm_SetCalculationOrder",3),t._EPDFForm_SetFieldMaxLen=X("EPDFForm_SetFieldMaxLen",3),t._EPDFForm_SetFieldAlternateName=X("EPDFForm_SetFieldAlternateName",3),t._EPDFForm_SetFieldMappingName=X("EPDFForm_SetFieldMappingName",3),t._EPDFForm_SetFieldEmbedMetadataString=X("EPDFForm_SetFieldEmbedMetadataString",4),t._EPDFForm_SetFieldEmbedMetadataNumber=X("EPDFForm_SetFieldEmbedMetadataNumber",4),t._EPDFForm_SetFieldEmbedMetadataBoolean=X("EPDFForm_SetFieldEmbedMetadataBoolean",4),t._EPDFForm_SetFieldEmbedMetadataJSON=X("EPDFForm_SetFieldEmbedMetadataJSON",3),t._EPDFForm_ClearFieldEmbedMetadataKey=X("EPDFForm_ClearFieldEmbedMetadataKey",3),t._EPDFForm_ClearFieldEmbedMetadata=X("EPDFForm_ClearFieldEmbedMetadata",2),t._EPDFForm_SetFieldOptions=X("EPDFForm_SetFieldOptions",5),t._EPDFPage_Flatten=X("EPDFPage_Flatten",2),t._EPDFPage_FlattenAnnotations=X("EPDFPage_FlattenAnnotations",5),t._EPDFPage_ExportAnnotationsAsDocument=X("EPDFPage_ExportAnnotationsAsDocument",3),t._EPDFDoc_ExportPagesFlattened=X("EPDFDoc_ExportPagesFlattened",5),t._EPDFLayer_OpenLayer=X("EPDFLayer_OpenLayer",4),t._EPDFLayer_OpenLayerArtifact=X("EPDFLayer_OpenLayerArtifact",4),t._EPDFLayer_OpenLayerArtifactFromPath=X("EPDFLayer_OpenLayerArtifactFromPath",4),t._EPDFLayer_IsObjectPromoted=X("EPDFLayer_IsObjectPromoted",2),t._EPDFPage_IsValid=X("EPDFPage_IsValid",1),t._EPDFLayer_IsPagePromoted=X("EPDFLayer_IsPagePromoted",2),t._EPDFLayer_GetBirthObjectNumber=X("EPDFLayer_GetBirthObjectNumber",3),t._EPDFLayer_GetBirthName=X("EPDFLayer_GetBirthName",4),t._EPDFLayer_BeginTransaction=X("EPDFLayer_BeginTransaction",1),t._EPDFLayer_CommitTransaction=X("EPDFLayer_CommitTransaction",1),t._EPDFLayer_AbortTransaction=X("EPDFLayer_AbortTransaction",1),t._EPDFLayer_IsInTransaction=X("EPDFLayer_IsInTransaction",1),t._EPDFLayer_GetLastObjectNumber=X("EPDFLayer_GetLastObjectNumber",1),t._EPDFLayer_RaiseLastObjectNumber=X("EPDFLayer_RaiseLastObjectNumber",2),t._EPDFLayer_GetPromotedObjectCount=X("EPDFLayer_GetPromotedObjectCount",1),t._EPDFLayer_GetBaseDocument=X("EPDFLayer_GetBaseDocument",1),t._EPDF_SetBaseDocumentSha256=X("EPDF_SetBaseDocumentSha256",2),t._EPDFLayer_GetBaseSha256=X("EPDFLayer_GetBaseSha256",2),t._EPDFLayer_SaveDelta=X("EPDFLayer_SaveDelta",3),t._EPDFLayer_SaveDeltaEx=X("EPDFLayer_SaveDeltaEx",4),t._EPDFLayer_SaveDeltaToOwnedBuffer=X("EPDFLayer_SaveDeltaToOwnedBuffer",3),t._EPDFLayer_SaveDeltaToOwnedBufferEx=X("EPDFLayer_SaveDeltaToOwnedBufferEx",4),t._EPDFLayer_SaveLayerArtifact=X("EPDFLayer_SaveLayerArtifact",3),t._EPDFLayer_SaveLayerArtifactEx=X("EPDFLayer_SaveLayerArtifactEx",4),t._EPDFLayer_SaveLayerArtifactToOwnedBuffer=X("EPDFLayer_SaveLayerArtifactToOwnedBuffer",3),t._EPDFLayer_SaveLayerArtifactToOwnedBufferEx=X("EPDFLayer_SaveLayerArtifactToOwnedBufferEx",4),t._EPDFNamedDest_SetDest=X("EPDFNamedDest_SetDest",3),t._EPDFNamedDest_Remove=X("EPDFNamedDest_Remove",2),t._EPDFDest_CreateView=X("EPDFDest_CreateView",4),t._EPDFDest_CreateXYZ=X("EPDFDest_CreateXYZ",7),t._EPDFDest_CreateRemoteView=X("EPDFDest_CreateRemoteView",5),t._EPDFDest_CreateRemoteXYZ=X("EPDFDest_CreateRemoteXYZ",8),t._EPDFDest_CreateXYZByObjectNumber=X("EPDFDest_CreateXYZByObjectNumber",8),t._EPDFDest_CreateViewByObjectNumber=X("EPDFDest_CreateViewByObjectNumber",5),t._EPDFDest_GetViewNullParams=X("EPDFDest_GetViewNullParams",1),t._EPDFAction_CreateGoTo=X("EPDFAction_CreateGoTo",2),t._EPDFAction_CreateGoToNamed=X("EPDFAction_CreateGoToNamed",2),t._EPDFAction_CreateLaunch=X("EPDFAction_CreateLaunch",2),t._EPDFAction_CreateRemoteGoToByName=X("EPDFAction_CreateRemoteGoToByName",3),t._EPDFAction_CreateRemoteGoToDest=X("EPDFAction_CreateRemoteGoToDest",3),t._EPDFAction_CreateURI=X("EPDFAction_CreateURI",2),t._EPDFAction_CreateNamed=X("EPDFAction_CreateNamed",2),t._EPDFOutline_GetObjectNumber=X("EPDFOutline_GetObjectNumber",1),t._EPDFOutline_GetItem=X("EPDFOutline_GetItem",2),t._EPDFOutline_CreateItem=X("EPDFOutline_CreateItem",5),t._EPDFOutline_MoveItem=X("EPDFOutline_MoveItem",4),t._EPDFOutline_DeleteItem=X("EPDFOutline_DeleteItem",2),t._EPDFOutline_SetTitle=X("EPDFOutline_SetTitle",3),t._EPDFOutline_SetOpen=X("EPDFOutline_SetOpen",3),t._EPDFOutline_SetColor=X("EPDFOutline_SetColor",6),t._EPDFOutline_SetStyle=X("EPDFOutline_SetStyle",3),t._EPDFOutline_SetAction=X("EPDFOutline_SetAction",3),t._EPDFDoc_GetNamedPageCount=X("EPDFDoc_GetNamedPageCount",2),t._EPDFDoc_GetNamedPageAt=X("EPDFDoc_GetNamedPageAt",7),t._EPDFDoc_SetNamedPage=X("EPDFDoc_SetNamedPage",3),t._EPDFDoc_RemoveNamedPage=X("EPDFDoc_RemoveNamedPage",2),t._EPDFDoc_RemoveNamedPagesForPage=X("EPDFDoc_RemoveNamedPagesForPage",2),t._EPDFDoc_GetPageLabelSectionCount=X("EPDFDoc_GetPageLabelSectionCount",1),t._EPDFDoc_GetPageLabelSectionAt=X("EPDFDoc_GetPageLabelSectionAt",7),t._EPDFDoc_SetPageLabelSections=X("EPDFDoc_SetPageLabelSections",6),t._EPDF_DigestBuffer=X("EPDF_DigestBuffer",5),t._EPDFDoc_GetRevisionCount=X("EPDFDoc_GetRevisionCount",1),t._EPDFDoc_GetRevision=X("EPDFDoc_GetRevision",4),t._EPDFDoc_OpenRevision=X("EPDFDoc_OpenRevision",3),t._EPDFDoc_OpenBaseOverlayFromPath=X("EPDFDoc_OpenBaseOverlayFromPath",2),t._EPDFDoc_OpenBaseOverlay=X("EPDFDoc_OpenBaseOverlay",3),t._EPDFSig_LoadModel=X("EPDFSig_LoadModel",1),t._EPDFSig_CloseModel=X("EPDFSig_CloseModel",1),t._EPDFSig_Count=X("EPDFSig_Count",1),t._EPDFSig_IsRevisionChainValid=X("EPDFSig_IsRevisionChainValid",1),t._EPDFSig_GetIndexByFieldObjNum=X("EPDFSig_GetIndexByFieldObjNum",2),t._EPDFSig_GetFieldObjNum=X("EPDFSig_GetFieldObjNum",2),t._EPDFSig_GetWidgetObjNum=X("EPDFSig_GetWidgetObjNum",2),t._EPDFSig_GetWidgetPageObjNum=X("EPDFSig_GetWidgetPageObjNum",2),t._EPDFSig_GetValueObjNum=X("EPDFSig_GetValueObjNum",2),t._EPDFSig_GetFieldName=X("EPDFSig_GetFieldName",4),t._EPDFSig_IsSigned=X("EPDFSig_IsSigned",2),t._EPDFSig_GetKind=X("EPDFSig_GetKind",2),t._EPDFSig_GetByteRange=X("EPDFSig_GetByteRange",3),t._EPDFSig_GetCoverage=X("EPDFSig_GetCoverage",2),t._EPDFSig_GetRevisionIndex=X("EPDFSig_GetRevisionIndex",2),t._EPDFSig_GetContents=X("EPDFSig_GetContents",4),t._EPDFSig_GetString=X("EPDFSig_GetString",5),t._EPDFSig_GetDocMDPPermission=X("EPDFSig_GetDocMDPPermission",2),t._EPDFSig_IsCatalogCertification=X("EPDFSig_IsCatalogCertification",2),t._EPDFSig_GetFieldMDPAction=X("EPDFSig_GetFieldMDPAction",2),t._EPDFSig_GetLockAction=X("EPDFSig_GetLockAction",2),t._EPDFSig_GetLockPermission=X("EPDFSig_GetLockPermission",2),t._EPDFSig_GetFieldNameCount=X("EPDFSig_GetFieldNameCount",3),t._EPDFSig_GetFieldNameAt=X("EPDFSig_GetFieldNameAt",6),t._EPDFSig_HasSeedValue=X("EPDFSig_HasSeedValue",2),t._EPDFSig_GetSeedValueRequiredFlags=X("EPDFSig_GetSeedValueRequiredFlags",2),t._EPDFSig_GetSeedValuePresentFlags=X("EPDFSig_GetSeedValuePresentFlags",2),t._EPDFSig_GetSeedValueMDP=X("EPDFSig_GetSeedValueMDP",2),t._EPDFSig_GetSeedValueVersion=X("EPDFSig_GetSeedValueVersion",2),t._EPDFSig_GetSeedValueFilter=X("EPDFSig_GetSeedValueFilter",4),t._EPDFSig_GetSeedValueListCount=X("EPDFSig_GetSeedValueListCount",3),t._EPDFSig_GetSeedValueListAt=X("EPDFSig_GetSeedValueListAt",6),t._EPDFSig_DigestByteRange=X("EPDFSig_DigestByteRange",5),t._EPDFSig_DigestFileRange=X("EPDFSig_DigestFileRange",5),t._EPDFDoc_GetLoadedBytesSize=X("EPDFDoc_GetLoadedBytesSize",1),t._EPDFDoc_GetBaseBytesSize=X("EPDFDoc_GetBaseBytesSize",1),t._EPDFDoc_GetStructureObjectNumbers=X("EPDFDoc_GetStructureObjectNumbers",4),t._EPDFDoc_ReadLoadedBytes=X("EPDFDoc_ReadLoadedBytes",5),t._EPDFSig_Prepare=X("EPDFSig_Prepare",3),t._EPDFSig_SetFieldLock=X("EPDFSig_SetFieldLock",6),t._EPDFSig_SaveCandidateToOwnedBuffer=X("EPDFSig_SaveCandidateToOwnedBuffer",5),t._EPDFSig_SaveCandidate=X("EPDFSig_SaveCandidate",6),t._EPDFSig_Seal=X("EPDFSig_Seal",13),t._EPDFSig_SealSpan=X("EPDFSig_SealSpan",10),t._EPDFSig_WriteContents=X("EPDFSig_WriteContents",9),t._EPDFDss_GetCount=X("EPDFDss_GetCount",2),t._EPDFDss_GetData=X("EPDFDss_GetData",5),t._EPDFDss_Add=X("EPDFDss_Add",4),t._EPDFDoc_CompareRevisions=X("EPDFDoc_CompareRevisions",2),t._EPDFObjectDiff_Close=X("EPDFObjectDiff_Close",1),t._EPDFObjectDiff_GetCount=X("EPDFObjectDiff_GetCount",1),t._EPDFObjectDiff_GetEntry=X("EPDFObjectDiff_GetEntry",8),t._EPDFObjectDiff_GetValue=X("EPDFObjectDiff_GetValue",6),t._EPDFObjectDiff_GetReadStatus=X("EPDFObjectDiff_GetReadStatus",3),t._EPDFObjectDiff_GetRevisionHealth=X("EPDFObjectDiff_GetRevisionHealth",5),t._EPDFObjectDiff_GetReferrerCount=X("EPDFObjectDiff_GetReferrerCount",3),t._EPDFObjectDiff_GetReferrer=X("EPDFObjectDiff_GetReferrer",7),t._EPDFDoc_GetLoadedObjectValue=X("EPDFDoc_GetLoadedObjectValue",6),t._EPDFDoc_HasPieceInfoEntry=X("EPDFDoc_HasPieceInfoEntry",2),t._EPDFDoc_GetPieceInfoEntryCount=X("EPDFDoc_GetPieceInfoEntryCount",1),t._EPDFDoc_GetPieceInfoEntryAt=X("EPDFDoc_GetPieceInfoEntryAt",4),t._EPDFDoc_GetLastModified=X("EPDFDoc_GetLastModified",3),t._EPDFDoc_GetPieceInfoLastModified=X("EPDFDoc_GetPieceInfoLastModified",4),t._EPDFDoc_GetPieceInfoKeyCount=X("EPDFDoc_GetPieceInfoKeyCount",2),t._EPDFDoc_GetPieceInfoKeyAt=X("EPDFDoc_GetPieceInfoKeyAt",5),t._EPDFDoc_GetPieceInfoValueType=X("EPDFDoc_GetPieceInfoValueType",3),t._EPDFDoc_SetPieceInfoString=X("EPDFDoc_SetPieceInfoString",5),t._EPDFDoc_GetPieceInfoString=X("EPDFDoc_GetPieceInfoString",5),t._EPDFDoc_SetPieceInfoNumber=X("EPDFDoc_SetPieceInfoNumber",5),t._EPDFDoc_GetPieceInfoNumber=X("EPDFDoc_GetPieceInfoNumber",4),t._EPDFDoc_SetPieceInfoBoolean=X("EPDFDoc_SetPieceInfoBoolean",5),t._EPDFDoc_GetPieceInfoBoolean=X("EPDFDoc_GetPieceInfoBoolean",4),t._EPDFDoc_SetPieceInfoName=X("EPDFDoc_SetPieceInfoName",5),t._EPDFDoc_GetPieceInfoName=X("EPDFDoc_GetPieceInfoName",5),t._EPDFDoc_SetPieceInfoStringArray=X("EPDFDoc_SetPieceInfoStringArray",6),t._EPDFDoc_GetPieceInfoStringArrayCount=X("EPDFDoc_GetPieceInfoStringArrayCount",3),t._EPDFDoc_GetPieceInfoStringArrayAt=X("EPDFDoc_GetPieceInfoStringArrayAt",6),t._EPDFDoc_ClearPieceInfoKey=X("EPDFDoc_ClearPieceInfoKey",4),t._EPDFDoc_ClearPieceInfoEntry=X("EPDFDoc_ClearPieceInfoEntry",2),t._EPDFDoc_HasPagePieceInfoEntry=X("EPDFDoc_HasPagePieceInfoEntry",3),t._EPDFDoc_GetPagePieceInfoEntryCount=X("EPDFDoc_GetPagePieceInfoEntryCount",2),t._EPDFDoc_GetPagePieceInfoEntryAt=X("EPDFDoc_GetPagePieceInfoEntryAt",5),t._EPDFDoc_GetPageLastModified=X("EPDFDoc_GetPageLastModified",4),t._EPDFDoc_GetPagePieceInfoLastModified=X("EPDFDoc_GetPagePieceInfoLastModified",5),t._EPDFDoc_GetPagePieceInfoKeyCount=X("EPDFDoc_GetPagePieceInfoKeyCount",3),t._EPDFDoc_GetPagePieceInfoKeyAt=X("EPDFDoc_GetPagePieceInfoKeyAt",6),t._EPDFDoc_GetPagePieceInfoValueType=X("EPDFDoc_GetPagePieceInfoValueType",4),t._EPDFDoc_SetPagePieceInfoString=X("EPDFDoc_SetPagePieceInfoString",6),t._EPDFDoc_GetPagePieceInfoString=X("EPDFDoc_GetPagePieceInfoString",6),t._EPDFDoc_SetPagePieceInfoNumber=X("EPDFDoc_SetPagePieceInfoNumber",6),t._EPDFDoc_GetPagePieceInfoNumber=X("EPDFDoc_GetPagePieceInfoNumber",5),t._EPDFDoc_SetPagePieceInfoBoolean=X("EPDFDoc_SetPagePieceInfoBoolean",6),t._EPDFDoc_GetPagePieceInfoBoolean=X("EPDFDoc_GetPagePieceInfoBoolean",5),t._EPDFDoc_SetPagePieceInfoName=X("EPDFDoc_SetPagePieceInfoName",6),t._EPDFDoc_GetPagePieceInfoName=X("EPDFDoc_GetPagePieceInfoName",6),t._EPDFDoc_SetPagePieceInfoStringArray=X("EPDFDoc_SetPagePieceInfoStringArray",7),t._EPDFDoc_GetPagePieceInfoStringArrayCount=X("EPDFDoc_GetPagePieceInfoStringArrayCount",4),t._EPDFDoc_GetPagePieceInfoStringArrayAt=X("EPDFDoc_GetPagePieceInfoStringArrayAt",7),t._EPDFDoc_ClearPagePieceInfoKey=X("EPDFDoc_ClearPagePieceInfoKey",5),t._EPDFDoc_ClearPagePieceInfoEntry=X("EPDFDoc_ClearPagePieceInfoEntry",3),t._EPDFAnnot_GetMeasure=X("EPDFAnnot_GetMeasure",1),t._EPDFAnnot_AddMeasure=X("EPDFAnnot_AddMeasure",1),t._EPDFAnnot_RemoveMeasure=X("EPDFAnnot_RemoveMeasure",1),t._EPDFPage_CountViewports=X("EPDFPage_CountViewports",1),t._EPDFPage_GetViewport=X("EPDFPage_GetViewport",2),t._EPDFPage_AddViewport=X("EPDFPage_AddViewport",2),t._EPDFPage_RemoveViewport=X("EPDFPage_RemoveViewport",2),t._EPDFPage_CountViewportsRaw=X("EPDFPage_CountViewportsRaw",2),t._EPDFPage_GetViewportRaw=X("EPDFPage_GetViewportRaw",3),t._EPDFPage_AddViewportRaw=X("EPDFPage_AddViewportRaw",3),t._EPDFPage_RemoveViewportRaw=X("EPDFPage_RemoveViewportRaw",3),t._EPDFViewport_Close=X("EPDFViewport_Close",1),t._EPDFPage_FindViewport=X("EPDFPage_FindViewport",2),t._EPDFViewport_GetBBox=X("EPDFViewport_GetBBox",2),t._EPDFViewport_SetBBox=X("EPDFViewport_SetBBox",2),t._EPDFViewport_GetMeasure=X("EPDFViewport_GetMeasure",1),t._EPDFViewport_AddMeasure=X("EPDFViewport_AddMeasure",1),t._EPDFViewport_RemoveMeasure=X("EPDFViewport_RemoveMeasure",1),t._EPDFMeasure_GetSubtype=X("EPDFMeasure_GetSubtype",1),t._EPDFMeasure_GetOrigin=X("EPDFMeasure_GetOrigin",2),t._EPDFMeasure_SetOrigin=X("EPDFMeasure_SetOrigin",2),t._EPDFMeasure_GetCYX=X("EPDFMeasure_GetCYX",2),t._EPDFMeasure_SetCYX=X("EPDFMeasure_SetCYX",2),t._EPDFMeasure_CountFormats=X("EPDFMeasure_CountFormats",2),t._EPDFMeasure_GetFormat=X("EPDFMeasure_GetFormat",3),t._EPDFMeasure_AddFormat=X("EPDFMeasure_AddFormat",4),t._EPDFMeasure_RemoveFormats=X("EPDFMeasure_RemoveFormats",2),t._EPDFViewport_GetName=X("EPDFViewport_GetName",3),t._EPDFViewport_SetName=X("EPDFViewport_SetName",2),t._EPDFMeasure_GetRatio=X("EPDFMeasure_GetRatio",3),t._EPDFMeasure_SetRatio=X("EPDFMeasure_SetRatio",2),t._EPDFNumberFormat_GetUnit=X("EPDFNumberFormat_GetUnit",3),t._EPDFNumberFormat_SetUnit=X("EPDFNumberFormat_SetUnit",2),t._EPDFNumberFormat_GetConversion=X("EPDFNumberFormat_GetConversion",2),t._EPDFNumberFormat_SetConversion=X("EPDFNumberFormat_SetConversion",2),t._EPDFNumberFormat_GetPrecision=X("EPDFNumberFormat_GetPrecision",2),t._EPDFNumberFormat_SetPrecision=X("EPDFNumberFormat_SetPrecision",2),t._EPDFNumberFormat_GetFixedDenominator=X("EPDFNumberFormat_GetFixedDenominator",2),t._EPDFNumberFormat_SetFixedDenominator=X("EPDFNumberFormat_SetFixedDenominator",2),t._EPDFNumberFormat_GetText=X("EPDFNumberFormat_GetText",4),t._EPDFNumberFormat_SetText=X("EPDFNumberFormat_SetText",3),t._EPDFNumberFormat_GetFraction=X("EPDFNumberFormat_GetFraction",2),t._EPDFNumberFormat_SetFraction=X("EPDFNumberFormat_SetFraction",2),t._EPDFNumberFormat_GetLabelPosition=X("EPDFNumberFormat_GetLabelPosition",2),t._EPDFNumberFormat_SetLabelPosition=X("EPDFNumberFormat_SetLabelPosition",2),t._EPDFAnnot_SetLineLeader=X("EPDFAnnot_SetLineLeader",4),t._EPDFAnnot_GetLineLeader=X("EPDFAnnot_GetLineLeader",4),t._EPDFAnnot_SetLineCaption=X("EPDFAnnot_SetLineCaption",4),t._EPDFAnnot_GetLineCaption=X("EPDFAnnot_GetLineCaption",4),t._EPDFAnnot_SetShapeCaption=X("EPDFAnnot_SetShapeCaption",3),t._EPDFAnnot_GetShapeCaption=X("EPDFAnnot_GetShapeCaption",4),t._EPDFPage_GetParsedSize=X("EPDFPage_GetParsedSize",2),t._EPDFPage_IsContentCurrent=X("EPDFPage_IsContentCurrent",1),t._EPDF_PNG_EncodeRGBA=X("EPDF_PNG_EncodeRGBA",6),t._EPDFDoc_ImportPages=X("EPDFDoc_ImportPages",6),t._EPDFDoc_GetImportFieldRoots=X("EPDFDoc_GetImportFieldRoots",5),t._EPDFPage_ApplyRedactions=X("EPDFPage_ApplyRedactions",4),t._EPDF_InitThread=X("EPDF_InitThread",0),t._EPDF_ShutdownThread=X("EPDF_ShutdownThread",0),t._FPDFAnnot_IsSupportedSubtype=X("FPDFAnnot_IsSupportedSubtype",1),t._FPDFPage_CreateAnnot=X("FPDFPage_CreateAnnot",2),t._FPDFPage_GetAnnotCount=X("FPDFPage_GetAnnotCount",1),t._FPDFPage_GetAnnot=X("FPDFPage_GetAnnot",2),t._FPDFPage_GetAnnotIndex=X("FPDFPage_GetAnnotIndex",2),t._FPDFPage_CloseAnnot=X("FPDFPage_CloseAnnot",1),t._FPDFPage_RemoveAnnot=X("FPDFPage_RemoveAnnot",2),t._FPDFAnnot_GetSubtype=X("FPDFAnnot_GetSubtype",1),t._FPDFAnnot_IsObjectSupportedSubtype=X("FPDFAnnot_IsObjectSupportedSubtype",1),t._FPDFAnnot_UpdateObject=X("FPDFAnnot_UpdateObject",2),t._FPDFAnnot_AddInkStroke=X("FPDFAnnot_AddInkStroke",3),t._FPDFAnnot_RemoveInkList=X("FPDFAnnot_RemoveInkList",1),t._FPDFAnnot_AppendObject=X("FPDFAnnot_AppendObject",2),t._FPDFAnnot_GetObjectCount=X("FPDFAnnot_GetObjectCount",1),t._FPDFAnnot_GetObject=X("FPDFAnnot_GetObject",2),t._FPDFAnnot_RemoveObject=X("FPDFAnnot_RemoveObject",2),t._FPDFAnnot_SetColor=X("FPDFAnnot_SetColor",6),t._FPDFAnnot_GetColor=X("FPDFAnnot_GetColor",6),t._FPDFAnnot_HasAttachmentPoints=X("FPDFAnnot_HasAttachmentPoints",1),t._FPDFAnnot_SetAttachmentPoints=X("FPDFAnnot_SetAttachmentPoints",3),t._FPDFAnnot_AppendAttachmentPoints=X("FPDFAnnot_AppendAttachmentPoints",2),t._FPDFAnnot_CountAttachmentPoints=X("FPDFAnnot_CountAttachmentPoints",1),t._FPDFAnnot_GetAttachmentPoints=X("FPDFAnnot_GetAttachmentPoints",3),t._FPDFAnnot_SetRect=X("FPDFAnnot_SetRect",2),t._FPDFAnnot_GetRect=X("FPDFAnnot_GetRect",2),t._FPDFAnnot_GetVertices=X("FPDFAnnot_GetVertices",3),t._FPDFAnnot_GetInkListCount=X("FPDFAnnot_GetInkListCount",1),t._FPDFAnnot_GetInkListPath=X("FPDFAnnot_GetInkListPath",4),t._FPDFAnnot_GetLine=X("FPDFAnnot_GetLine",3),t._FPDFAnnot_SetBorder=X("FPDFAnnot_SetBorder",4),t._FPDFAnnot_GetBorder=X("FPDFAnnot_GetBorder",4),t._FPDFAnnot_HasKey=X("FPDFAnnot_HasKey",2),t._FPDFAnnot_GetValueType=X("FPDFAnnot_GetValueType",2),t._FPDFAnnot_SetStringValue=X("FPDFAnnot_SetStringValue",3),t._FPDFAnnot_GetStringValue=X("FPDFAnnot_GetStringValue",4),t._FPDFAnnot_GetNumberValue=X("FPDFAnnot_GetNumberValue",3),t._FPDFAnnot_SetAP=X("FPDFAnnot_SetAP",3),t._FPDFAnnot_GetAP=X("FPDFAnnot_GetAP",4),t._FPDFAnnot_GetLinkedAnnot=X("FPDFAnnot_GetLinkedAnnot",2),t._FPDFAnnot_GetFlags=X("FPDFAnnot_GetFlags",1),t._FPDFAnnot_SetFlags=X("FPDFAnnot_SetFlags",2),t._FPDFAnnot_GetFormFieldFlags=X("FPDFAnnot_GetFormFieldFlags",2),t._FPDFAnnot_SetFormFieldFlags=X("FPDFAnnot_SetFormFieldFlags",3),t._FPDFAnnot_GetFormFieldAtPoint=X("FPDFAnnot_GetFormFieldAtPoint",3),t._FPDFAnnot_GetFormFieldName=X("FPDFAnnot_GetFormFieldName",4),t._FPDFAnnot_GetFormFieldType=X("FPDFAnnot_GetFormFieldType",2),t._FPDFAnnot_GetFormAdditionalActionJavaScript=X("FPDFAnnot_GetFormAdditionalActionJavaScript",5),t._FPDFAnnot_GetFormFieldAlternateName=X("FPDFAnnot_GetFormFieldAlternateName",4),t._FPDFAnnot_GetFormFieldValue=X("FPDFAnnot_GetFormFieldValue",4),t._FPDFAnnot_GetOptionCount=X("FPDFAnnot_GetOptionCount",2),t._FPDFAnnot_GetOptionLabel=X("FPDFAnnot_GetOptionLabel",5),t._FPDFAnnot_IsOptionSelected=X("FPDFAnnot_IsOptionSelected",3),t._FPDFAnnot_GetFontSize=X("FPDFAnnot_GetFontSize",3),t._FPDFAnnot_SetFontColor=X("FPDFAnnot_SetFontColor",5),t._FPDFAnnot_GetFontColor=X("FPDFAnnot_GetFontColor",5),t._FPDFAnnot_IsChecked=X("FPDFAnnot_IsChecked",2),t._FPDFAnnot_SetFocusableSubtypes=X("FPDFAnnot_SetFocusableSubtypes",3),t._FPDFAnnot_GetFocusableSubtypesCount=X("FPDFAnnot_GetFocusableSubtypesCount",1),t._FPDFAnnot_GetFocusableSubtypes=X("FPDFAnnot_GetFocusableSubtypes",3),t._FPDFAnnot_GetLink=X("FPDFAnnot_GetLink",1),t._FPDFAnnot_GetFormControlCount=X("FPDFAnnot_GetFormControlCount",2),t._FPDFAnnot_GetFormControlIndex=X("FPDFAnnot_GetFormControlIndex",2),t._FPDFAnnot_GetFormFieldExportValue=X("FPDFAnnot_GetFormFieldExportValue",4),t._FPDFAnnot_SetURI=X("FPDFAnnot_SetURI",2),t._FPDFAnnot_GetFileAttachment=X("FPDFAnnot_GetFileAttachment",1),t._FPDFAnnot_AddFileAttachment=X("FPDFAnnot_AddFileAttachment",2),t._FPDFDoc_GetAttachmentCount=X("FPDFDoc_GetAttachmentCount",1),t._FPDFDoc_AddAttachment=X("FPDFDoc_AddAttachment",2),t._FPDFDoc_GetAttachment=X("FPDFDoc_GetAttachment",2),t._EPDFDoc_GetAttachmentKey=X("EPDFDoc_GetAttachmentKey",4),t._EPDFDoc_GetAttachmentIndexByKey=X("EPDFDoc_GetAttachmentIndexByKey",2),t._FPDFDoc_DeleteAttachment=X("FPDFDoc_DeleteAttachment",2),t._FPDFAttachment_GetName=X("FPDFAttachment_GetName",3),t._FPDFAttachment_HasKey=X("FPDFAttachment_HasKey",2),t._FPDFAttachment_GetValueType=X("FPDFAttachment_GetValueType",2),t._FPDFAttachment_SetStringValue=X("FPDFAttachment_SetStringValue",3),t._FPDFAttachment_GetStringValue=X("FPDFAttachment_GetStringValue",4),t._FPDFAttachment_SetDescription=X("FPDFAttachment_SetDescription",2),t._FPDFAttachment_GetDescription=X("FPDFAttachment_GetDescription",3),t._FPDFAttachment_SetFile=X("FPDFAttachment_SetFile",4),t._FPDFAttachment_GetFile=X("FPDFAttachment_GetFile",4),t._FPDFAttachment_GetSubtype=X("FPDFAttachment_GetSubtype",3),t._FPDFAttachment_GetAFRelationship=X("FPDFAttachment_GetAFRelationship",3),t._EPDFAttachment_SetSubtype=X("EPDFAttachment_SetSubtype",2),t._EPDFAttachment_SetDescription=X("EPDFAttachment_SetDescription",2),t._EPDFAttachment_SetName=X("EPDFAttachment_SetName",2),t._EPDFAttachment_GetDescription=X("EPDFAttachment_GetDescription",3),t._EPDFAttachment_GetIntegerValue=X("EPDFAttachment_GetIntegerValue",3),t._EPDFAttachment_ExtractFile=X("EPDFAttachment_ExtractFile",6),t._EPDFAttachment_ExtractFileToOwnedBuffer=X("EPDFAttachment_ExtractFileToOwnedBuffer",6),t._FPDFCatalog_IsTagged=X("FPDFCatalog_IsTagged",1),t._FPDFCatalog_GetLanguage=X("FPDFCatalog_GetLanguage",3),t._FPDFCatalog_SetLanguage=X("FPDFCatalog_SetLanguage",2),t._EPDFCatalog_GetLanguage=X("EPDFCatalog_GetLanguage",3),t._FPDFAvail_Create=X("FPDFAvail_Create",2),t._FPDFAvail_Destroy=X("FPDFAvail_Destroy",1),t._FPDFAvail_IsDocAvail=X("FPDFAvail_IsDocAvail",2),t._FPDFAvail_GetDocument=X("FPDFAvail_GetDocument",2),t._FPDFAvail_GetFirstPageNum=X("FPDFAvail_GetFirstPageNum",1),t._FPDFAvail_IsPageAvail=X("FPDFAvail_IsPageAvail",3),t._FPDFAvail_IsFormAvail=X("FPDFAvail_IsFormAvail",2),t._FPDFAvail_IsLinearized=X("FPDFAvail_IsLinearized",1),t._FPDFBookmark_GetFirstChild=X("FPDFBookmark_GetFirstChild",2),t._FPDFBookmark_GetNextSibling=X("FPDFBookmark_GetNextSibling",2),t._FPDFBookmark_GetTitle=X("FPDFBookmark_GetTitle",3),t._FPDFBookmark_GetCount=X("FPDFBookmark_GetCount",1),t._FPDFBookmark_Find=X("FPDFBookmark_Find",2),t._FPDFBookmark_GetDest=X("FPDFBookmark_GetDest",2),t._FPDFBookmark_GetAction=X("FPDFBookmark_GetAction",1),t._FPDFBookmark_GetColor=X("FPDFBookmark_GetColor",4),t._FPDFBookmark_GetStyle=X("FPDFBookmark_GetStyle",1),t._FPDFAction_GetType=X("FPDFAction_GetType",1),t._FPDFAction_GetDest=X("FPDFAction_GetDest",2),t._FPDFAction_GetFilePath=X("FPDFAction_GetFilePath",3),t._FPDFAction_GetURIPath=X("FPDFAction_GetURIPath",4),t._FPDFDest_GetDestPageIndex=X("FPDFDest_GetDestPageIndex",2),t._EPDFDest_GetPageObjectNumber=X("EPDFDest_GetPageObjectNumber",2),t._FPDFDest_GetView=X("FPDFDest_GetView",3),t._FPDFDest_GetLocationInPage=X("FPDFDest_GetLocationInPage",7),t._FPDFLink_GetLinkAtPoint=X("FPDFLink_GetLinkAtPoint",3),t._FPDFLink_GetLinkZOrderAtPoint=X("FPDFLink_GetLinkZOrderAtPoint",3),t._FPDFLink_GetDest=X("FPDFLink_GetDest",2),t._FPDFLink_GetAction=X("FPDFLink_GetAction",1),t._FPDFLink_Enumerate=X("FPDFLink_Enumerate",3),t._FPDFLink_GetAnnot=X("FPDFLink_GetAnnot",2),t._FPDFLink_GetAnnotRect=X("FPDFLink_GetAnnotRect",2),t._FPDFLink_CountQuadPoints=X("FPDFLink_CountQuadPoints",1),t._FPDFLink_GetQuadPoints=X("FPDFLink_GetQuadPoints",3),t._FPDF_GetPageAAction=X("FPDF_GetPageAAction",2),t._FPDF_GetFileIdentifier=X("FPDF_GetFileIdentifier",4),t._FPDF_GetMetaText=X("FPDF_GetMetaText",4),t._FPDF_GetPageLabel=X("FPDF_GetPageLabel",4),t._EPDF_SetMetaText=X("EPDF_SetMetaText",3),t._EPDF_HasMetaText=X("EPDF_HasMetaText",2),t._EPDF_GetMetaTrapped=X("EPDF_GetMetaTrapped",1),t._EPDF_SetMetaTrapped=X("EPDF_SetMetaTrapped",2),t._EPDF_GetMetaKeyCount=X("EPDF_GetMetaKeyCount",2),t._EPDF_GetMetaKeyName=X("EPDF_GetMetaKeyName",5),t._FPDFPageObj_NewImageObj=X("FPDFPageObj_NewImageObj",1),t._FPDFImageObj_LoadJpegFile=X("FPDFImageObj_LoadJpegFile",4),t._FPDFImageObj_LoadJpegFileInline=X("FPDFImageObj_LoadJpegFileInline",4),t._FPDFImageObj_SetMatrix=X("FPDFImageObj_SetMatrix",7),t._FPDFImageObj_SetBitmap=X("FPDFImageObj_SetBitmap",4),t._FPDFImageObj_GetBitmap=X("FPDFImageObj_GetBitmap",1),t._FPDFImageObj_GetRenderedBitmap=X("FPDFImageObj_GetRenderedBitmap",3),t._FPDFImageObj_GetImageDataDecoded=X("FPDFImageObj_GetImageDataDecoded",3),t._FPDFImageObj_GetImageDataRaw=X("FPDFImageObj_GetImageDataRaw",3),t._FPDFImageObj_GetImageFilterCount=X("FPDFImageObj_GetImageFilterCount",1),t._FPDFImageObj_GetImageFilter=X("FPDFImageObj_GetImageFilter",4),t._FPDFImageObj_GetImageMetadata=X("FPDFImageObj_GetImageMetadata",3),t._FPDFImageObj_GetImagePixelSize=X("FPDFImageObj_GetImagePixelSize",3),t._FPDFImageObj_GetIccProfileDataDecoded=X("FPDFImageObj_GetIccProfileDataDecoded",5),t._EPDFImageObj_SetPng=X("EPDFImageObj_SetPng",5),t._EPDFImageObj_SetJpeg=X("EPDFImageObj_SetJpeg",5),t._FPDF_CreateNewDocument=X("FPDF_CreateNewDocument",0),t._FPDFPage_Delete=X("FPDFPage_Delete",2),t._FPDF_MovePages=X("FPDF_MovePages",4),t._FPDFPage_New=X("FPDFPage_New",4),t._EPDFPage_InsertBlankRaw=X("EPDFPage_InsertBlankRaw",5),t._FPDFPage_GetRotation=X("FPDFPage_GetRotation",1),t._FPDFPage_InsertObject=X("FPDFPage_InsertObject",2),t._FPDFPage_InsertObjectAtIndex=X("FPDFPage_InsertObjectAtIndex",3),t._FPDFPage_RemoveObject=X("FPDFPage_RemoveObject",2),t._FPDFPage_CountObjects=X("FPDFPage_CountObjects",1),t._FPDFPage_GetObject=X("FPDFPage_GetObject",2),t._FPDFPage_HasTransparency=X("FPDFPage_HasTransparency",1),t._FPDFPageObj_Destroy=X("FPDFPageObj_Destroy",1),t._FPDFPageObj_GetMarkedContentID=X("FPDFPageObj_GetMarkedContentID",1),t._FPDFPageObj_CountMarks=X("FPDFPageObj_CountMarks",1),t._FPDFPageObj_GetMark=X("FPDFPageObj_GetMark",2),t._FPDFPageObj_AddExistingMark=X("FPDFPageObj_AddExistingMark",2),t._FPDFPageObj_AddMark=X("FPDFPageObj_AddMark",2),t._FPDFPageObj_RemoveMark=X("FPDFPageObj_RemoveMark",2),t._FPDFPageObjMark_GetName=X("FPDFPageObjMark_GetName",4),t._FPDFPageObjMark_CountParams=X("FPDFPageObjMark_CountParams",1),t._FPDFPageObjMark_GetParamKey=X("FPDFPageObjMark_GetParamKey",5),t._FPDFPageObjMark_GetParamValueType=X("FPDFPageObjMark_GetParamValueType",2),t._FPDFPageObjMark_GetParamIntValue=X("FPDFPageObjMark_GetParamIntValue",3),t._FPDFPageObjMark_GetParamFloatValue=X("FPDFPageObjMark_GetParamFloatValue",3),t._FPDFPageObjMark_GetParamStringValue=X("FPDFPageObjMark_GetParamStringValue",5),t._FPDFPageObjMark_GetParamBlobValue=X("FPDFPageObjMark_GetParamBlobValue",5),t._FPDFPageObj_HasTransparency=X("FPDFPageObj_HasTransparency",1),t._FPDFPageObjMark_SetIntParam=X("FPDFPageObjMark_SetIntParam",5),t._FPDFPageObjMark_SetFloatParam=X("FPDFPageObjMark_SetFloatParam",5),t._FPDFPageObjMark_SetStringParam=X("FPDFPageObjMark_SetStringParam",5),t._FPDFPageObjMark_SetBlobParam=X("FPDFPageObjMark_SetBlobParam",6),t._FPDFPageObjMark_RemoveParam=X("FPDFPageObjMark_RemoveParam",3),t._FPDFPageObj_GetType=X("FPDFPageObj_GetType",1),t._FPDFPageObj_GetIsActive=X("FPDFPageObj_GetIsActive",2),t._FPDFPageObj_SetIsActive=X("FPDFPageObj_SetIsActive",2),t._FPDFPage_GenerateContent=X("FPDFPage_GenerateContent",1),t._FPDFPageObj_Transform=X("FPDFPageObj_Transform",7),t._FPDFPageObj_TransformF=X("FPDFPageObj_TransformF",2),t._FPDFPageObj_GetMatrix=X("FPDFPageObj_GetMatrix",2),t._FPDFPageObj_SetMatrix=X("FPDFPageObj_SetMatrix",2),t._FPDFPageObj_SetBlendMode=X("FPDFPageObj_SetBlendMode",2),t._FPDFPage_TransformAnnots=X("FPDFPage_TransformAnnots",7),t._FPDFPage_SetRotation=X("FPDFPage_SetRotation",2),t._FPDFPageObj_SetFillColor=X("FPDFPageObj_SetFillColor",5),t._FPDFPageObj_GetFillColor=X("FPDFPageObj_GetFillColor",5),t._FPDFPageObj_GetBounds=X("FPDFPageObj_GetBounds",5),t._FPDFPageObj_GetRotatedBounds=X("FPDFPageObj_GetRotatedBounds",2),t._FPDFPageObj_SetStrokeColor=X("FPDFPageObj_SetStrokeColor",5),t._FPDFPageObj_GetStrokeColor=X("FPDFPageObj_GetStrokeColor",5),t._FPDFPageObj_SetStrokeWidth=X("FPDFPageObj_SetStrokeWidth",2),t._FPDFPageObj_GetStrokeWidth=X("FPDFPageObj_GetStrokeWidth",2),t._FPDFPageObj_GetLineJoin=X("FPDFPageObj_GetLineJoin",1),t._FPDFPageObj_SetLineJoin=X("FPDFPageObj_SetLineJoin",2),t._FPDFPageObj_GetLineCap=X("FPDFPageObj_GetLineCap",1),t._FPDFPageObj_SetLineCap=X("FPDFPageObj_SetLineCap",2),t._FPDFPageObj_GetDashPhase=X("FPDFPageObj_GetDashPhase",2),t._FPDFPageObj_SetDashPhase=X("FPDFPageObj_SetDashPhase",2),t._FPDFPageObj_GetDashCount=X("FPDFPageObj_GetDashCount",1),t._FPDFPageObj_GetDashArray=X("FPDFPageObj_GetDashArray",3),t._FPDFPageObj_SetDashArray=X("FPDFPageObj_SetDashArray",4),t._FPDFPageObj_GetRenderedStrokePattern=X("FPDFPageObj_GetRenderedStrokePattern",2),t._FPDFPageObj_GetRenderedFillPattern=X("FPDFPageObj_GetRenderedFillPattern",2),t._FPDFFormObj_CountObjects=X("FPDFFormObj_CountObjects",1),t._FPDFFormObj_GetObject=X("FPDFFormObj_GetObject",2),t._FPDFFormObj_RemoveObject=X("FPDFFormObj_RemoveObject",2),t._FPDFPageObj_CreateNewPath=X("FPDFPageObj_CreateNewPath",2),t._FPDFPageObj_CreateNewRect=X("FPDFPageObj_CreateNewRect",4),t._FPDFPath_CountSegments=X("FPDFPath_CountSegments",1),t._FPDFPath_GetPathSegment=X("FPDFPath_GetPathSegment",2),t._FPDFPath_MoveTo=X("FPDFPath_MoveTo",3),t._FPDFPath_LineTo=X("FPDFPath_LineTo",3),t._FPDFPath_BezierTo=X("FPDFPath_BezierTo",7),t._FPDFPath_GetBezierControlPoints=X("FPDFPath_GetBezierControlPoints",4),t._FPDFPath_Close=X("FPDFPath_Close",1),t._FPDFPath_SetDrawMode=X("FPDFPath_SetDrawMode",3),t._FPDFPath_GetDrawMode=X("FPDFPath_GetDrawMode",3),t._FPDFPathSegment_GetPoint=X("FPDFPathSegment_GetPoint",3),t._FPDFPathSegment_GetType=X("FPDFPathSegment_GetType",1),t._FPDFPathSegment_GetClose=X("FPDFPathSegment_GetClose",1),t._FPDFPageObj_NewTextObj=X("FPDFPageObj_NewTextObj",3),t._FPDFText_SetText=X("FPDFText_SetText",2),t._FPDFText_SetCharcodes=X("FPDFText_SetCharcodes",3),t._FPDFText_SetPositions=X("FPDFText_SetPositions",3),t._FPDFText_LoadFont=X("FPDFText_LoadFont",5),t._FPDFText_LoadStandardFont=X("FPDFText_LoadStandardFont",2),t._FPDFText_LoadCidType2Font=X("FPDFText_LoadCidType2Font",6),t._FPDFTextObj_GetFontSize=X("FPDFTextObj_GetFontSize",2),t._FPDFTextObj_SetFontSize=X("FPDFTextObj_SetFontSize",2),t._FPDFTextObj_GetText=X("FPDFTextObj_GetText",4),t._FPDFTextObj_GetRenderedBitmap=X("FPDFTextObj_GetRenderedBitmap",4),t._FPDFFont_Close=X("FPDFFont_Close",1),t._FPDFPageObj_CreateTextObj=X("FPDFPageObj_CreateTextObj",3),t._FPDFTextObj_GetTextRenderMode=X("FPDFTextObj_GetTextRenderMode",1),t._FPDFTextObj_SetTextRenderMode=X("FPDFTextObj_SetTextRenderMode",2),t._FPDFTextObj_GetFont=X("FPDFTextObj_GetFont",1),t._FPDFFont_GetBaseFontName=X("FPDFFont_GetBaseFontName",3),t._FPDFFont_GetFamilyName=X("FPDFFont_GetFamilyName",3),t._FPDFFont_GetFontData=X("FPDFFont_GetFontData",4),t._FPDFFont_GetIsEmbedded=X("FPDFFont_GetIsEmbedded",1),t._FPDFFont_GetFlags=X("FPDFFont_GetFlags",1),t._FPDFFont_GetWeight=X("FPDFFont_GetWeight",1),t._FPDFFont_GetItalicAngle=X("FPDFFont_GetItalicAngle",2),t._FPDFFont_GetAscent=X("FPDFFont_GetAscent",3),t._FPDFFont_GetDescent=X("FPDFFont_GetDescent",3),t._FPDFFont_GetGlyphWidth=X("FPDFFont_GetGlyphWidth",4),t._FPDFFont_GetGlyphPath=X("FPDFFont_GetGlyphPath",3),t._FPDFGlyphPath_CountGlyphSegments=X("FPDFGlyphPath_CountGlyphSegments",1),t._FPDFGlyphPath_GetGlyphPathSegment=X("FPDFGlyphPath_GetGlyphPathSegment",2),t._EPDFText_RedactInRect=X("EPDFText_RedactInRect",4),t._EPDFText_RedactInQuads=X("EPDFText_RedactInQuads",5),t._FPDFDoc_GetPageMode=X("FPDFDoc_GetPageMode",1),t._FPDFPage_Flatten=X("FPDFPage_Flatten",2),t._FPDFPage_HasFormFieldAtPoint=X("FPDFPage_HasFormFieldAtPoint",4),t._FPDFPage_FormFieldZOrderAtPoint=X("FPDFPage_FormFieldZOrderAtPoint",4),t._FPDFDOC_InitFormFillEnvironment=X("FPDFDOC_InitFormFillEnvironment",2),t._FPDFDOC_ExitFormFillEnvironment=X("FPDFDOC_ExitFormFillEnvironment",1),t._FORM_OnMouseMove=X("FORM_OnMouseMove",5),t._FORM_OnMouseWheel=X("FORM_OnMouseWheel",6),t._FORM_OnFocus=X("FORM_OnFocus",5),t._FORM_OnLButtonDown=X("FORM_OnLButtonDown",5),t._FORM_OnLButtonUp=X("FORM_OnLButtonUp",5),t._FORM_OnLButtonDoubleClick=X("FORM_OnLButtonDoubleClick",5),t._FORM_OnRButtonDown=X("FORM_OnRButtonDown",5),t._FORM_OnRButtonUp=X("FORM_OnRButtonUp",5),t._FORM_OnKeyDown=X("FORM_OnKeyDown",4),t._FORM_OnKeyUp=X("FORM_OnKeyUp",4),t._FORM_OnChar=X("FORM_OnChar",4),t._FORM_GetFocusedText=X("FORM_GetFocusedText",4),t._FORM_GetSelectedText=X("FORM_GetSelectedText",4),t._FORM_ReplaceAndKeepSelection=X("FORM_ReplaceAndKeepSelection",3),t._FORM_ReplaceSelection=X("FORM_ReplaceSelection",3),t._FORM_SelectAllText=X("FORM_SelectAllText",2),t._FORM_CanUndo=X("FORM_CanUndo",2),t._FORM_CanRedo=X("FORM_CanRedo",2),t._FORM_Undo=X("FORM_Undo",2),t._FORM_Redo=X("FORM_Redo",2),t._FORM_ForceToKillFocus=X("FORM_ForceToKillFocus",1),t._FORM_GetFocusedAnnot=X("FORM_GetFocusedAnnot",3),t._FORM_SetFocusedAnnot=X("FORM_SetFocusedAnnot",2),t._FPDF_FFLDraw=X("FPDF_FFLDraw",9),t._FPDF_SetFormFieldHighlightColor=X("FPDF_SetFormFieldHighlightColor",3),t._FPDF_SetFormFieldHighlightAlpha=X("FPDF_SetFormFieldHighlightAlpha",2),t._FPDF_RemoveFormFieldHighlight=X("FPDF_RemoveFormFieldHighlight",1),t._FORM_OnAfterLoadPage=X("FORM_OnAfterLoadPage",2),t._FORM_OnBeforeClosePage=X("FORM_OnBeforeClosePage",2),t._FORM_DoDocumentJSAction=X("FORM_DoDocumentJSAction",1),t._FORM_DoDocumentOpenAction=X("FORM_DoDocumentOpenAction",1),t._FORM_DoDocumentAAction=X("FORM_DoDocumentAAction",2),t._FORM_DoPageAAction=X("FORM_DoPageAAction",3),t._FORM_SetIndexSelected=X("FORM_SetIndexSelected",4),t._FORM_IsIndexSelected=X("FORM_IsIndexSelected",3),t._FORM_GetTextDirection=X("FORM_GetTextDirection",2),t._FORM_SetTextDirection=X("FORM_SetTextDirection",3),t._FPDFDoc_GetJavaScriptActionCount=X("FPDFDoc_GetJavaScriptActionCount",1),t._FPDFDoc_GetJavaScriptAction=X("FPDFDoc_GetJavaScriptAction",2),t._EPDFDoc_GetNamedJavaScriptActionModel=X("EPDFDoc_GetNamedJavaScriptActionModel",2),t._FPDFDoc_CloseJavaScriptAction=X("FPDFDoc_CloseJavaScriptAction",1),t._FPDFJavaScriptAction_GetName=X("FPDFJavaScriptAction_GetName",3),t._FPDFJavaScriptAction_GetScript=X("FPDFJavaScriptAction_GetScript",3),t._FPDF_ImportPagesByIndex=X("FPDF_ImportPagesByIndex",5),t._FPDF_ImportPages=X("FPDF_ImportPages",4),t._FPDF_ImportNPagesToOne=X("FPDF_ImportNPagesToOne",5),t._FPDF_NewXObjectFromPage=X("FPDF_NewXObjectFromPage",3),t._FPDF_CloseXObject=X("FPDF_CloseXObject",1),t._FPDF_NewFormObjectFromXObject=X("FPDF_NewFormObjectFromXObject",1),t._FPDF_CopyViewerPreferences=X("FPDF_CopyViewerPreferences",2),t._FPDF_RenderPageBitmapWithColorScheme_Start=X("FPDF_RenderPageBitmapWithColorScheme_Start",10),t._FPDF_RenderPageBitmap_Start=X("FPDF_RenderPageBitmap_Start",9),t._FPDF_RenderPage_Continue=X("FPDF_RenderPage_Continue",2),t._FPDF_RenderPage_Close=X("FPDF_RenderPage_Close",1),t._EPDF_RenderPageBitmapWithMatrix_Start=X("EPDF_RenderPageBitmapWithMatrix_Start",6),t._EPDF_RenderPage_Continue=X("EPDF_RenderPage_Continue",2),t._EPDF_FreeBuffer=X("EPDF_FreeBuffer",1),t._FPDF_SaveAsCopy=X("FPDF_SaveAsCopy",3),t._FPDF_SaveWithVersion=X("FPDF_SaveWithVersion",4),t._EPDF_SaveDocumentToOwnedBuffer=X("EPDF_SaveDocumentToOwnedBuffer",3),t._EPDF_SaveDocumentToOwnedBufferWithVersion=X("EPDF_SaveDocumentToOwnedBufferWithVersion",4),t._EPDF_SaveDocumentToOwnedBufferEx=X("EPDF_SaveDocumentToOwnedBufferEx",5),t._EPDF_SaveAsCopyEx=X("EPDF_SaveAsCopyEx",4),t._FPDFText_GetCharIndexFromTextIndex=X("FPDFText_GetCharIndexFromTextIndex",2),t._FPDFText_GetTextIndexFromCharIndex=X("FPDFText_GetTextIndexFromCharIndex",2),t._FPDF_GetSignatureCount=X("FPDF_GetSignatureCount",1),t._FPDF_GetSignatureObject=X("FPDF_GetSignatureObject",2),t._FPDFSignatureObj_GetContents=X("FPDFSignatureObj_GetContents",3),t._FPDFSignatureObj_GetByteRange=X("FPDFSignatureObj_GetByteRange",3),t._FPDFSignatureObj_GetSubFilter=X("FPDFSignatureObj_GetSubFilter",3),t._FPDFSignatureObj_GetReason=X("FPDFSignatureObj_GetReason",3),t._FPDFSignatureObj_GetTime=X("FPDFSignatureObj_GetTime",3),t._FPDFSignatureObj_GetDocMDPPermission=X("FPDFSignatureObj_GetDocMDPPermission",1),t._FPDF_StructTree_GetForPage=X("FPDF_StructTree_GetForPage",1),t._FPDF_StructTree_Close=X("FPDF_StructTree_Close",1),t._FPDF_StructTree_CountChildren=X("FPDF_StructTree_CountChildren",1),t._FPDF_StructTree_GetChildAtIndex=X("FPDF_StructTree_GetChildAtIndex",2),t._FPDF_StructElement_GetAltText=X("FPDF_StructElement_GetAltText",3),t._FPDF_StructElement_GetActualText=X("FPDF_StructElement_GetActualText",3),t._FPDF_StructElement_GetExpansion=X("FPDF_StructElement_GetExpansion",3),t._FPDF_StructElement_GetID=X("FPDF_StructElement_GetID",3),t._FPDF_StructElement_GetLang=X("FPDF_StructElement_GetLang",3),t._FPDF_StructElement_GetAttributeCount=X("FPDF_StructElement_GetAttributeCount",1),t._FPDF_StructElement_GetAttributeAtIndex=X("FPDF_StructElement_GetAttributeAtIndex",2),t._FPDF_StructElement_GetStringAttribute=X("FPDF_StructElement_GetStringAttribute",4),t._FPDF_StructElement_GetMarkedContentID=X("FPDF_StructElement_GetMarkedContentID",1),t._FPDF_StructElement_GetRawType=X("FPDF_StructElement_GetRawType",3),t._FPDF_StructElement_GetType=X("FPDF_StructElement_GetType",3),t._FPDF_StructElement_GetObjType=X("FPDF_StructElement_GetObjType",3),t._FPDF_StructElement_GetTitle=X("FPDF_StructElement_GetTitle",3),t._FPDF_StructElement_CountChildren=X("FPDF_StructElement_CountChildren",1),t._FPDF_StructElement_GetChildAtIndex=X("FPDF_StructElement_GetChildAtIndex",2),t._FPDF_StructElement_GetChildMarkedContentID=X("FPDF_StructElement_GetChildMarkedContentID",2),t._FPDF_StructElement_GetParent=X("FPDF_StructElement_GetParent",1),t._FPDF_StructElement_Attr_GetCount=X("FPDF_StructElement_Attr_GetCount",1),t._FPDF_StructElement_Attr_GetName=X("FPDF_StructElement_Attr_GetName",5),t._FPDF_StructElement_Attr_GetValue=X("FPDF_StructElement_Attr_GetValue",2),t._FPDF_StructElement_Attr_GetType=X("FPDF_StructElement_Attr_GetType",1),t._FPDF_StructElement_Attr_GetBooleanValue=X("FPDF_StructElement_Attr_GetBooleanValue",2),t._FPDF_StructElement_Attr_GetNumberValue=X("FPDF_StructElement_Attr_GetNumberValue",2),t._FPDF_StructElement_Attr_GetStringValue=X("FPDF_StructElement_Attr_GetStringValue",4),t._FPDF_StructElement_Attr_GetBlobValue=X("FPDF_StructElement_Attr_GetBlobValue",4),t._FPDF_StructElement_Attr_CountChildren=X("FPDF_StructElement_Attr_CountChildren",1),t._FPDF_StructElement_Attr_GetChildAtIndex=X("FPDF_StructElement_Attr_GetChildAtIndex",2),t._FPDF_StructElement_GetMarkedContentIdCount=X("FPDF_StructElement_GetMarkedContentIdCount",1),t._FPDF_StructElement_GetMarkedContentIdAtIndex=X("FPDF_StructElement_GetMarkedContentIdAtIndex",2),t._FPDF_AddInstalledFont=X("FPDF_AddInstalledFont",3),t._FPDF_SetSystemFontInfo=X("FPDF_SetSystemFontInfo",1),t._FPDF_GetDefaultTTFMap=X("FPDF_GetDefaultTTFMap",0),t._FPDF_GetDefaultTTFMapCount=X("FPDF_GetDefaultTTFMapCount",0),t._FPDF_GetDefaultTTFMapEntry=X("FPDF_GetDefaultTTFMapEntry",1),t._FPDF_GetDefaultSystemFontInfo=X("FPDF_GetDefaultSystemFontInfo",0),t._FPDF_FreeDefaultSystemFontInfo=X("FPDF_FreeDefaultSystemFontInfo",1),t._FPDFText_LoadPage=X("FPDFText_LoadPage",1),t._FPDFText_ClosePage=X("FPDFText_ClosePage",1),t._FPDFText_CountChars=X("FPDFText_CountChars",1),t._FPDFText_GetUnicode=X("FPDFText_GetUnicode",2),t._FPDFText_GetTextObject=X("FPDFText_GetTextObject",2),t._FPDFText_IsGenerated=X("FPDFText_IsGenerated",2),t._FPDFText_IsHyphen=X("FPDFText_IsHyphen",2),t._FPDFText_HasUnicodeMapError=X("FPDFText_HasUnicodeMapError",2),t._FPDFText_GetFontSize=X("FPDFText_GetFontSize",2),t._FPDFText_GetFontInfo=X("FPDFText_GetFontInfo",5),t._FPDFText_GetFontWeight=X("FPDFText_GetFontWeight",2),t._FPDFText_GetFillColor=X("FPDFText_GetFillColor",6),t._FPDFText_GetStrokeColor=X("FPDFText_GetStrokeColor",6),t._FPDFText_GetCharAngle=X("FPDFText_GetCharAngle",2),t._FPDFText_GetCharBox=X("FPDFText_GetCharBox",6),t._FPDFText_GetLooseCharBox=X("FPDFText_GetLooseCharBox",3),t._EPDFText_GetCharGeometry=X("EPDFText_GetCharGeometry",3),t._EPDFText_GetPageGeometry=X("EPDFText_GetPageGeometry",4),t._EPDFText_GetTextFull=X("EPDFText_GetTextFull",3),t._EPDFText_GetCharToTextMap=X("EPDFText_GetCharToTextMap",3),t._FPDFText_GetMatrix=X("FPDFText_GetMatrix",3),t._FPDFText_GetCharOrigin=X("FPDFText_GetCharOrigin",4),t._FPDFText_GetCharIndexAtPos=X("FPDFText_GetCharIndexAtPos",5),t._FPDFText_GetText=X("FPDFText_GetText",4),t._FPDFText_CountRects=X("FPDFText_CountRects",3),t._FPDFText_GetRect=X("FPDFText_GetRect",6),t._FPDFText_GetBoundedText=X("FPDFText_GetBoundedText",7),t._FPDFText_FindStart=X("FPDFText_FindStart",4),t._FPDFText_FindNext=X("FPDFText_FindNext",1),t._FPDFText_FindPrev=X("FPDFText_FindPrev",1),t._FPDFText_GetSchResultIndex=X("FPDFText_GetSchResultIndex",1),t._FPDFText_GetSchCount=X("FPDFText_GetSchCount",1),t._FPDFText_FindClose=X("FPDFText_FindClose",1),t._FPDFLink_LoadWebLinks=X("FPDFLink_LoadWebLinks",1),t._FPDFLink_CountWebLinks=X("FPDFLink_CountWebLinks",1),t._FPDFLink_GetURL=X("FPDFLink_GetURL",4),t._FPDFLink_CountRects=X("FPDFLink_CountRects",2),t._FPDFLink_GetRect=X("FPDFLink_GetRect",7),t._FPDFLink_GetTextRange=X("FPDFLink_GetTextRange",4),t._FPDFLink_CloseWebLinks=X("FPDFLink_CloseWebLinks",1),t._FPDFPage_GetDecodedThumbnailData=X("FPDFPage_GetDecodedThumbnailData",3),t._FPDFPage_GetRawThumbnailData=X("FPDFPage_GetRawThumbnailData",3),t._FPDFPage_GetThumbnailAsBitmap=X("FPDFPage_GetThumbnailAsBitmap",1),t._FPDFPage_SetMediaBox=X("FPDFPage_SetMediaBox",5),t._FPDFPage_SetCropBox=X("FPDFPage_SetCropBox",5),t._FPDFPage_SetBleedBox=X("FPDFPage_SetBleedBox",5),t._FPDFPage_SetTrimBox=X("FPDFPage_SetTrimBox",5),t._FPDFPage_SetArtBox=X("FPDFPage_SetArtBox",5),t._FPDFPage_GetMediaBox=X("FPDFPage_GetMediaBox",5),t._FPDFPage_GetCropBox=X("FPDFPage_GetCropBox",5),t._FPDFPage_GetBleedBox=X("FPDFPage_GetBleedBox",5),t._FPDFPage_GetTrimBox=X("FPDFPage_GetTrimBox",5),t._FPDFPage_GetArtBox=X("FPDFPage_GetArtBox",5),t._FPDFPage_TransFormWithClip=X("FPDFPage_TransFormWithClip",3),t._FPDFPageObj_TransformClipPath=X("FPDFPageObj_TransformClipPath",7),t._FPDFPageObj_GetClipPath=X("FPDFPageObj_GetClipPath",1),t._FPDFClipPath_CountPaths=X("FPDFClipPath_CountPaths",1),t._FPDFClipPath_CountPathSegments=X("FPDFClipPath_CountPathSegments",2),t._FPDFClipPath_GetPathSegment=X("FPDFClipPath_GetPathSegment",3),t._FPDF_CreateClipPath=X("FPDF_CreateClipPath",4),t._FPDF_DestroyClipPath=X("FPDF_DestroyClipPath",1),t._FPDFPage_InsertClipPath=X("FPDFPage_InsertClipPath",2),t._FPDF_InitLibrary=X("FPDF_InitLibrary",0),t._FPDF_InitLibraryWithConfig=X("FPDF_InitLibraryWithConfig",1),t._FPDF_DestroyLibrary=X("FPDF_DestroyLibrary",0),t._FPDF_SetSandBoxPolicy=X("FPDF_SetSandBoxPolicy",2),t._FPDF_LoadDocument=X("FPDF_LoadDocument",2),t._FPDF_GetFormType=X("FPDF_GetFormType",1),t._FPDF_LoadXFA=X("FPDF_LoadXFA",1),t._FPDF_LoadMemDocument=X("FPDF_LoadMemDocument",3),t._FPDF_LoadMemDocument64=X("FPDF_LoadMemDocument64",3),t._FPDF_LoadCustomDocument=X("FPDF_LoadCustomDocument",2),t._FPDF_GetFileVersion=X("FPDF_GetFileVersion",2),t._FPDF_DocumentHasValidCrossReferenceTable=X("FPDF_DocumentHasValidCrossReferenceTable",1),t._FPDF_GetDocPermissions=X("FPDF_GetDocPermissions",1),t._FPDF_GetDocUserPermissions=X("FPDF_GetDocUserPermissions",1),t._FPDF_GetSecurityHandlerRevision=X("FPDF_GetSecurityHandlerRevision",1),t._EPDF_SetEncryption=X("EPDF_SetEncryption",4),t._EPDF_RemoveEncryption=X("EPDF_RemoveEncryption",1),t._EPDF_UnlockOwnerPermissions=X("EPDF_UnlockOwnerPermissions",2),t._EPDF_CheckPasswordPermissions=X("EPDF_CheckPasswordPermissions",6),t._EPDF_SetRuntimeOwnerPermissions=X("EPDF_SetRuntimeOwnerPermissions",2),t._EPDF_IsEncrypted=X("EPDF_IsEncrypted",1),t._EPDF_IsOwnerUnlocked=X("EPDF_IsOwnerUnlocked",1),t._FPDF_GetPageCount=X("FPDF_GetPageCount",1),t._FPDF_LoadPage=X("FPDF_LoadPage",2),t._EPDFDoc_LoadPageByObjectNumber=X("EPDFDoc_LoadPageByObjectNumber",2),t._EPDFDoc_LoadPageByObjectNumberNormalized=X("EPDFDoc_LoadPageByObjectNumberNormalized",2),t._EPDFDoc_GetPageObjectNumberByIndex=X("EPDFDoc_GetPageObjectNumberByIndex",2),t._EPDFDoc_DeletePageByObjectNumber=X("EPDFDoc_DeletePageByObjectNumber",2),t._EPDFDoc_SetPageRotationByObjectNumber=X("EPDFDoc_SetPageRotationByObjectNumber",3),t._EPDFDoc_StartLoadPageByObjectNumber=X("EPDFDoc_StartLoadPageByObjectNumber",3),t._EPDFPage_ContinueLoad=X("EPDFPage_ContinueLoad",2),t._EPDFPage_GetObjectNumber=X("EPDFPage_GetObjectNumber",1),t._FPDF_GetPageWidthF=X("FPDF_GetPageWidthF",1),t._FPDF_GetPageWidth=X("FPDF_GetPageWidth",1),t._FPDF_GetPageHeightF=X("FPDF_GetPageHeightF",1),t._FPDF_GetPageHeight=X("FPDF_GetPageHeight",1),t._FPDF_GetPageBoundingBox=X("FPDF_GetPageBoundingBox",2),t._FPDF_RenderPageBitmap=X("FPDF_RenderPageBitmap",8),t._FPDF_RenderPageBitmapWithMatrix=X("FPDF_RenderPageBitmapWithMatrix",5),t._EPDF_RenderAnnotBitmap=X("EPDF_RenderAnnotBitmap",7),t._EPDF_RenderAnnotBitmapUnrotated=X("EPDF_RenderAnnotBitmapUnrotated",9),t._EPDF_SetDecodedImageBudget=X("EPDF_SetDecodedImageBudget",1),t._EPDF_GetDecodedImageBytes=X("EPDF_GetDecodedImageBytes",0),t._EPDFPage_ResetRenderCache=X("EPDFPage_ResetRenderCache",1),t._FPDF_ClosePage=X("FPDF_ClosePage",1),t._FPDF_CloseDocument=X("FPDF_CloseDocument",1),t._FPDF_GetLastError=X("FPDF_GetLastError",0),t._FPDF_DeviceToPage=X("FPDF_DeviceToPage",10),t._FPDF_PageToDevice=X("FPDF_PageToDevice",10),t._FPDFBitmap_Create=X("FPDFBitmap_Create",3),t._FPDFBitmap_CreateEx=X("FPDFBitmap_CreateEx",5),t._FPDFBitmap_GetFormat=X("FPDFBitmap_GetFormat",1),t._FPDFBitmap_FillRect=X("FPDFBitmap_FillRect",6),t._FPDFBitmap_GetBuffer=X("FPDFBitmap_GetBuffer",1),t._FPDFBitmap_GetWidth=X("FPDFBitmap_GetWidth",1),t._FPDFBitmap_GetHeight=X("FPDFBitmap_GetHeight",1),t._FPDFBitmap_GetStride=X("FPDFBitmap_GetStride",1),t._FPDFBitmap_Destroy=X("FPDFBitmap_Destroy",1),t._FPDF_GetPageSizeByIndexF=X("FPDF_GetPageSizeByIndexF",3),t._EPDF_GetPageRotateByIndex=X("EPDF_GetPageRotateByIndex",3),t._EPDF_GetPageTabOrderByIndex=X("EPDF_GetPageTabOrderByIndex",4),t._EPDF_GetPageBoxByIndex=X("EPDF_GetPageBoxByIndex",4),t._EPDF_GetPageUserUnitByIndex=X("EPDF_GetPageUserUnitByIndex",3),t._EPDF_LoadPageNormalized=X("EPDF_LoadPageNormalized",3),t._FPDF_GetPageSizeByIndex=X("FPDF_GetPageSizeByIndex",4),t._FPDF_VIEWERREF_GetPrintScaling=X("FPDF_VIEWERREF_GetPrintScaling",1),t._FPDF_VIEWERREF_GetNumCopies=X("FPDF_VIEWERREF_GetNumCopies",1),t._FPDF_VIEWERREF_GetPrintPageRange=X("FPDF_VIEWERREF_GetPrintPageRange",1),t._FPDF_VIEWERREF_GetPrintPageRangeCount=X("FPDF_VIEWERREF_GetPrintPageRangeCount",1),t._FPDF_VIEWERREF_GetPrintPageRangeElement=X("FPDF_VIEWERREF_GetPrintPageRangeElement",2),t._FPDF_VIEWERREF_GetDuplex=X("FPDF_VIEWERREF_GetDuplex",1),t._FPDF_VIEWERREF_GetName=X("FPDF_VIEWERREF_GetName",4),t._FPDF_CountNamedDests=X("FPDF_CountNamedDests",1),t._FPDF_GetNamedDestByName=X("FPDF_GetNamedDestByName",2),t._FPDF_GetNamedDest=X("FPDF_GetNamedDest",4),t._FPDF_GetXFAPacketCount=X("FPDF_GetXFAPacketCount",1),t._FPDF_GetXFAPacketName=X("FPDF_GetXFAPacketName",4),t._FPDF_GetXFAPacketContent=X("FPDF_GetXFAPacketContent",5),t._FPDF_GetTrailerEnds=X("FPDF_GetTrailerEnds",3);var eJ=X("fflush",1),eQ=X("strerror",1),eX=X("emscripten_builtin_memalign",2);t._malloc=X("malloc",1),t._free=X("free",1);var eY=X("setThrew",2);X("_emscripten_tempret_set",1);var e0=()=>(e0=eZ.emscripten_stack_init)(),e1=()=>(e1=eZ.emscripten_stack_get_end)(),e3=e=>(e3=eZ._emscripten_stack_restore)(e),e2=e=>(e2=eZ._emscripten_stack_alloc)(e),e6=()=>(e6=eZ.emscripten_stack_get_current)();function e5(){var e,r;if(!(U>0)){if(e0(),M((3&(e=e1()))==0),0==e&&(e+=4),f[e>>>2>>>0]=0x2135467,f[e+4>>>2>>>0]=0x89bacdfe,f[0]=0x63736d65,t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)r=t.preRun.shift(),B.unshift(r);eu(B),U>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>t.setStatus(""),1),i()},1)):i(),T())}function i(){if(!D&&(D=!0,t.calledRun=!0,!j)){if(M(!z),z=!0,T(),t.noFSInit||eN.initialized||eN.init(),eN.ignorePermissions=!1,ev.init(),eu(L),n(t),t.onRuntimeInitialized?.(),M(!t._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),T(),t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;){var e;e=t.postRun.shift(),$.unshift(e)}eu($)}}}if(t.dynCall_jiji=X("dynCall_jiji",5),t.dynCall_iiiiij=X("dynCall_iiiiij",7),t.dynCall_iiiiijj=X("dynCall_iiiiijj",9),t.dynCall_iiiiiijj=X("dynCall_iiiiiijj",10),t.dynCall_viijii=X("dynCall_viijii",7),t.dynCall_ji=X("dynCall_ji",2),t.dynCall_iiij=X("dynCall_iiij",5),t.dynCall_j=X("dynCall_j",1),t.dynCall_iji=X("dynCall_iji",4),t.dynCall_jji=X("dynCall_jji",4),t.dynCall_iiji=X("dynCall_iiji",5),t.dynCall_viijj=X("dynCall_viijj",7),t.dynCall_jij=X("dynCall_jij",4),t.dynCall_iij=X("dynCall_iij",4),t.dynCall_viji=X("dynCall_viji",5),t.wasmExports=eZ,t.ccall=eH,t.cwrap=(e,t,n,r)=>(...i)=>eH(e,t,n,i,r),t.addFunction=(e,t)=>{M(void 0!==e);var n=(e=>{if(!P){P=new WeakMap;var t=_.length;if(P)for(var n=0;n<0+t;n++){var r=ez(n);r&&P.set(r,n)}}return P.get(e)||0})(e);if(n)return n;var r=(()=>{if(eW.length)return eW.pop();try{_.grow(1)}catch(e){if(!(e instanceof RangeError))throw e;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return _.length-1})();try{eq(r,e)}catch(n){if(!(n instanceof TypeError))throw n;M(void 0!==t,"Missing signature argument to addFunction: "+e),eq(r,((e,t)=>{if(M(!t.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled"),"function"==typeof WebAssembly.Function)return new WebAssembly.Function((e=>{M(!e.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled");for(var t={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},n={parameters:[],results:"v"==e[0]?[]:[t[e[0]]]},r=1;r{P.delete(ez(e)),eq(e,null),eW.push(e)},t.setValue=function(e,t,n="i8"){switch(n.endsWith("*")&&(n="*"),n){case"i1":case"i8":s[e>>>0]=t;break;case"i16":u[e>>>1>>>0]=t;break;case"i32":c[e>>>2>>>0]=t;break;case"i64":J("to do setValue(i64) use WASM_BIGINT");case"float":m[e>>>2>>>0]=t;break;case"double":p[e>>>3>>>0]=t;break;case"*":f[e>>>2>>>0]=t;break;default:J(`invalid type for setValue: ${n}`)}},t.getValue=function(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return s[e>>>0];case"i16":return u[e>>>1>>>0];case"i32":return c[e>>>2>>>0];case"i64":J("to do getValue(i64) use WASM_BIGINT");case"float":return m[e>>>2>>>0];case"double":return p[e>>>3>>>0];case"*":return f[e>>>2>>>0];default:J(`invalid type for getValue: ${t}`)}},t.UTF8ToString=eg,t.stringToUTF8=ej,t.UTF16ToString=(e,t)=>{M(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var n=e,r=n>>1,i=r+t/2;!(r>=i)&&d[r>>>0];)++r;if((n=r<<1)-e>32&&eU)return eU.decode(l.subarray(e>>>0,n>>>0));for(var o="",a=0;!(a>=t/2);++a){var s=u[e+2*a>>>1>>>0];if(0==s)break;o+=String.fromCharCode(s)}return o},t.stringToUTF16=(e,t,n)=>{if(M(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),M("number"==typeof n,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),n??(n=0x7fffffff),n<2)return 0;for(var r=t,i=(n-=2)<2*e.length?n/2:e.length,o=0;o>>1>>>0]=a,t+=2}return u[t>>>1>>>0]=0,t-r},["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertU32PairToI53","getTempRet0","setTempRet0","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","readEmAsmArgs","jstoi_q","listenOnce","autoResumeAudioContext","dynCallLegacy","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","checkWasiClock","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","safeSetTimeout","setImmediateWrapped","safeRequestAnimationFrame","clearImmediateWrapped","polyfillSetImmediate","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","ExceptionInfo","findMatchingCatch","Browser_asyncPrepareDataCounter","arraySum","addDays","getSocketFromFD","getSocketAddress","FS_unlink","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace"].forEach(function(e){eo(e,()=>{var t=`\`${e}\` 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=e;n.startsWith("_")||(n="$"+e),t+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${n}')`,ei(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),em(t)}),es(e)}),["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","out","err","callMain","abort","wasmMemory","writeStackCookie","checkStackCookie","convertI32PairToI53Checked","stackSave","stackRestore","stackAlloc","ptrToString","zeroMemory","exitJS","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","jstoi_s","getExecutableName","keepRuntimeAlive","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","freeTableIndexes","functionsInTableMap","getEmptyTableSlot","updateTableMap","getFunctionAddress","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","stringToUTF8Array","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","stringToUTF8OnStack","writeArrayToMemory","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","doReadv","doWritev","initRandomFill","randomFill","promiseMap","uncaughtExceptionCount","exceptionLast","exceptionCaught","Browser","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","ydayFromDate","SYSCALLS","preloadPlugins","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_createPath","FS_createDevice","FS_readFile","FS","FS_createDataFile","FS_createLazyFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack","print","printErr"].forEach(es),W=function e(){D||e5(),D||(W=e)},t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();for(let e of(e5(),Object.keys(t)))e in t||Object.defineProperty(t,e,{configurable:!0,get(){J(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return y}}},function(){if(r)throw r[0];try{return t&&(n=(0,t[E(t)[0]])(t=0)),n}catch(e){throw r=[e],e}}),G={Unknown:"Unknown",InvalidArg:"InvalidArg",DocNotOpen:"DocNotOpen",DocOpenFailed:"DocOpenFailed",DocPasswordRequired:"DocPasswordRequired",DocPasswordIncorrect:"DocPasswordIncorrect",GrantPassphraseRequired:"GrantPassphraseRequired",Aborted:"Aborted",Network:"Network",Unauthenticated:"Unauthenticated",Forbidden:"Forbidden",NotFound:"NotFound",WireFormat:"WireFormat",RuntimeUnavailable:"RuntimeUnavailable",LayerVersionConflict:"LayerVersionConflict",NotImplemented:"NotImplemented",MalformedPdf:"MalformedPdf",SigningPending:"SigningPending",SigningExpired:"SigningExpired",SigningVersionMismatch:"SigningVersionMismatch",SignatureRefused:"SignatureRefused",ProtectedDocument:"ProtectedDocument",PayloadTooLarge:"PayloadTooLarge",ObjectNumberUnavailable:"ObjectNumberUnavailable",LayerFull:"LayerFull",ChangeConflict:"ChangeConflict",UndoUnavailable:"UndoUnavailable",IdempotencyKeyReused:"IdempotencyKeyReused",LayerDeleted:"LayerDeleted",VisitorIdentityRequired:"VisitorIdentityRequired",Conflict:"Conflict",EngineBusy:"EngineBusy",EngineRestarting:"EngineRestarting",DocumentQuarantined:"DocumentQuarantined",ThumbnailNotReady:"ThumbnailNotReady",TooManyRequests:"TooManyRequests",GrantExpired:"GrantExpired",OriginRequired:"OriginRequired",OriginNotAllowed:"OriginNotAllowed",FeatureNotEnabled:"FeatureNotEnabled",FeatureStopped:"FeatureStopped",LicenseInvalid:"LicenseInvalid",LicenseUsageLimit:"LicenseUsageLimit",UpstreamError:"UpstreamError"};function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(e,t,n){var r;return(r=function(e,t){if("object"!=O(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=O(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==O(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.values(G);var N=class e extends Error{constructor(e,t,n={}){super(t??e,void 0===n.cause?void 0:{cause:n.cause}),I(this,"name","EngineError"),I(this,"code",void 0),I(this,"details",void 0),this.code=e,this.details=n.details}static is(t,n){return(t instanceof e||t?.name==="EngineError")&&(void 0===n||t.code===n)}toJSON(){return{code:this.code,message:this.message,details:this.details}}};function C(e){return N.is(e)?e.toJSON():e instanceof Error?{code:"AbortError"===e.name?G.Aborted:G.Unknown,message:e.message}:{code:G.Unknown,message:String(e??"unknown error")}}var j=e=>{let t=t=>(e&1<[[1,e.exclude],[2,e.includeNoValueFields],[3,"html"===e.format],[4,"get"===e.method],[5,e.submitCoordinates],[6,"xfdf"===e.format],[7,e.includeAppendSaves],[8,e.includeAnnotations],[9,"pdf"===e.format],[10,e.canonicalFormat],[11,e.exclNonUserAnnots],[12,e.exclFKey],[14,e.embedForm]].reduce((e,[t,n])=>n?e|1<null!=e&&!("root"in e)&&R(e))}function B(e){return e.incomplete||!e.root?null:function e(t){let n=[];for(let r of t.next){let t=e(r);if(!t)return null;n.push(t)}let r=n.length>0?{next:n}:{};switch(t.type){case"javascript":return{type:"javascript",script:t.script,...r};case"goto":return{type:"goto",destination:t.destination,...r};case"uri":return{type:"uri",uri:t.uri,...r};case"named":return{type:"named",name:t.name,...r};case"hide":return{type:"hide",targets:t.targets,hide:t.hide,...r};case"reset-form":return{type:"reset-form",fields:t.fields,exclude:t.exclude,...r};case"submit-form":return t.payload?{...function(e){let{url:t,fields:n,charSet:r,...i}=e;return i}(t.payload),type:"submit-form",url:t.payload.url,fields:t.payload.fields,...r}:null;default:return null}}(e.root)}var L={javascript:"JavaScript",goto:"GoTo",uri:"URI",named:"Named",hide:"Hide","reset-form":"ResetForm","submit-form":"SubmitForm"};function $(e){return{root:function e(t){let n={subtype:L[t.type],next:(t.next??[]).map(e)};switch(t.type){case"javascript":return{type:"javascript",script:t.script,...n};case"goto":return{type:"goto",destination:t.destination,...n};case"uri":return{type:"uri",uri:t.uri,isMap:!1,...n};case"named":return{type:"named",name:t.name,...n};case"hide":return{type:"hide",targets:t.targets,hide:t.hide,...n};case"reset-form":return{type:"reset-form",fields:t.fields,exclude:t.exclude,...n};case"submit-form":return{type:"submit-form",payload:{url:t.url,fields:t.fields,...j(M(t))},...n}}}(e),incomplete:!1,warnings:[]}}var z=["activate","cursorEnter","cursorExit","mouseDown","mouseUp","focus","blur","pageOpen","pageClose","pageVisible","pageInvisible"];function U(e){let t=B(e);return t&&V(t)?t:null}function V(e){return"javascript"===e.type&&(e.next??[]).every(V)}function W(e){return"number"==typeof e&&Number.isInteger(e)&&e>0}function q(e){return{kind:"objectNumber",objectNumber:e}}function H(e){if(!W(e.objectNumber))throw RangeError(`encodePageKey: objectNumber must be a positive integer, got ${e.objectNumber}`);return`obj:${e.objectNumber}`}function K(e){switch(e.kind){case"objectNumber":return`obj:${e.objectNumber}`;case"baseIndex":return`base:${e.page.objectNumber}:${e.baseIndex}`}}var Z=["courier","courier-bold","courier-bold-oblique","courier-oblique","helvetica","helvetica-bold","helvetica-bold-oblique","helvetica-oblique","times-roman","times-bold","times-bold-italic","times-italic","symbol","zapf-dingbats"],J={invisible:!1,hidden:!1,print:!1,noZoom:!1,noRotate:!1,noView:!1,readOnly:!1,locked:!1,toggleNoView:!1,lockedContents:!1};function Q(e){return void 0!==e.layout?e:{...e,layout:"pushbutton"===e.fieldKind?"caption":null}}function X(e){return null===e?{kind:"unassigned"}:{kind:"group",groupId:e}}function Y(e){return"group"===e.kind?e.groupId:null}function ee(e){return eo(er(e)??{kind:"unassigned"},e.kind)}function et(e,t){let n=er(e);return void 0===n?t.assignment:eo(n,t.kind)}function en(e){if(void 0!==e.assignment)return e;let t="string"==typeof e.groupId?e.groupId:null;return{...e,assignment:X(t)}}function er(e){if(void 0!==e.assignment&&void 0!==e.groupId)throw ea("assignment",'name a field\'s assignment or its groupId, not both: { kind: "group", groupId } says both');return void 0!==e.assignment?function(e){let t=null!==e&&"object"==typeof e?e.kind:void 0;if("anyone"===t||"unassigned"===t)return{kind:t};if("group"===t){let n=e.groupId;return ei(n,"assignment"),{kind:t,groupId:n}}throw ea("assignment","a field's assignment is { kind: 'group', groupId }, { kind: 'anyone' } or { kind: 'unassigned' }")}(e.assignment):void 0!==e.groupId?(null!==e.groupId&&ei(e.groupId,"groupId"),X(e.groupId)):void 0}function ei(e,t){if("string"!=typeof e||e.length<1||e.length>256)throw ea(t,`a field's groupId is 1 to 256 characters${"groupId"===t?", or null for no group":""}`)}function eo(e,t){if("anyone"===e.kind&&"signature"===t)throw ea("assignment","a signature field is signed by one signer, so it is never for anyone");return e}function ea(e,t){return new N(G.InvalidArg,t,{details:{field:e}})}function es(e){return void 0===e.lockedBy?{...e,lockedBy:null}:e}function el(e){if("pushbutton"!==e.kind)return e;let t=void 0===e.hasImage,n=void 0===e.takesImage;return t||n?{...e,...t?{hasImage:!1}:{},...n?{takesImage:!1}:{}}:e}var eu=Object.freeze(["m/d","m/d/yy","mm/dd/yy","mm/yy","d-mmm","d-mmm-yy","dd-mmm-yy","yy-mm-dd","mmm-yy","mmmm-yy","mmm d, yyyy","mmmm d, yyyy","m/d/yy h:MM tt","m/d/yy HH:MM"]),ed=Object.freeze(["HH:MM","h:MM tt","HH:MM:ss","h:MM:ss tt"]),ec=new Map([["yyyy",{part:"year",written:"digits"}],["yy",{part:"year",written:"digits"}],["mmmm",{part:"month",written:"letters"}],["mmm",{part:"month",written:"letters"}],["mm",{part:"month",written:"digits"}],["m",{part:"month",written:"digits"}],["dd",{part:"day",written:"digits"}],["d",{part:"day",written:"digits"}]]),ef=/(?:HH|H|hh|h):MM(?::ss)?(?: *tt)?/;function em(e){let t={written:[],groups:[]};for(let n of e.match(/([A-Za-z])\1*|[^A-Za-z]/g)??[]){let e=ec.get(n);if(e)t.written.push(e.written),t.groups.push(e.part);else{if(!" /-.,".includes(n))return null;t.written.push("separator")}}return t}function ep(e){if("string"!=typeof e||e.length<1||e.length>64)return!1;let t=ef.exec(e),n=em(t?e.slice(0,t.index):e),r=em(t?e.slice(t.index+t[0].length):"");if(!n||!r)return!1;let i=[...n.groups,...r.groups];if(0===i.length||new Set(i).size!==i.length)return!1;let o=t?["digits",t[0].endsWith("tt")?"letters":"digits"]:[],a=[...n.written,...o,...r.written];return!a.some((e,t)=>"digits"===e&&"digits"===a[t+1]&&t!==n.written.length)}var eh=RegExp(`^${ef.source}$`);function eF(e){return"string"==typeof e&&e.length<=64&&eh.test(e)}function eg(e){return"text"===e||"combobox"===e}var e_={date:{format:"AFDate_FormatEx",numberedFormat:"AFDate_Format",keystroke:"AFDate_KeystrokeEx",numberedKeystroke:"AFDate_Keystroke",standard:eu,isPattern:ep},time:{format:"AFTime_FormatEx",numberedFormat:"AFTime_Format",keystroke:"AFTime_KeystrokeEx",numberedKeystroke:"AFTime_Keystroke",standard:ed,isPattern:eF}},eP=["date","time"];function eD(e,t,n,r){let i=e.trim();i.endsWith(";")&&(i=i.slice(0,-1).trimEnd());let o=/^([A-Za-z_]+)\(\s*(?:(["'])([^"'\\]*)\2|(\d{1,2}))\s*\)$/.exec(i);if(!o)return null;let[,a,,s,l]=o,{isPattern:u,standard:d}=e_[t];return a===n&&void 0!==s?u(s)?s:null:a===r&&void 0!==l?d[Number(l)]??null:null}function eb(e){let t=e?.format;if(null==t)return null;if("object"!=typeof t)return{kind:"other"};let n=ew(t);return null===n?{kind:"other"}:function(e){for(let t of eP){let n=e_[t],r=eD(e,t,n.format,n.numberedFormat);if(null!==r)return{kind:t,pattern:r}}return{kind:"other"}}(n)}function ey(e){let t=void 0===e.purpose,n=void 0===e.format&&"string"==typeof e.kind&&eg(e.kind);return t||n?{...e,...t?{purpose:null}:{},...n?{format:eb(e.actions)}:{}}:e}function ew(e){let t=e.root;return!1===e.incomplete&&t&&"javascript"===t.type&&Array.isArray(t.next)&&!(t.next.length>0)&&"string"==typeof t.script?t.script:null}function eE(e){var t;let n=e_[e.kind];return{format:`${n.format}("${e.pattern}");`,keystroke:"date"===e.kind?`${n.keystroke}("${e.pattern}");`:`${n.numberedKeystroke}(${2*!!(t=e.pattern).includes("ss")+ +!!t.includes("tt")});`}}function eA(e){if(null===e)return{keystroke:null,format:null};let t=eE(e),n=e=>({type:"javascript",script:e});return{keystroke:n(t.keystroke),format:n(t.format)}}function ev(e){return null!==e&&"other"!==e.kind}function eS(e,t){return null===e||null===t?e===t:e.kind===t.kind&&("other"===e.kind||e.pattern===t.pattern)}var ek={date:"a date format's pattern is 1 to 64 characters: the groups yyyy yy mmmm mmm mm m dd d, at least one of them and the year, the month and the day each once at most, with spaces and / - . , between them, and at most one time (HH, H, hh or h, then :MM, then :ss and tt when it has them); two groups written in digits never touch",time:"a time format's pattern is a time and nothing else, at most 64 characters: HH, H, hh or h, then :MM, then :ss when it has seconds, then tt when it has one"};function ex(e,t){if(void 0===e.format)return;if(!eg(t))throw new N(G.InvalidArg,`'format' does not apply to a ${t} field`,{details:{field:"format"}});let n=function(e){if(null===e)return null;let t="object"==typeof e?e:{};if("other"===t.kind)throw new N(G.InvalidArg,"a format of kind 'other' is read, never written: write its scripts in actions",{details:{field:"format"}});if("date"!==t.kind&&"time"!==t.kind)throw new N(G.InvalidArg,"a field's format is a date or a time with a pattern, or null for none",{details:{field:"format"}});let{pattern:n}=t;if(!e_[t.kind].isPattern(n))throw new N(G.InvalidArg,ek[t.kind],{details:{field:"format.pattern"}});return{kind:t.kind,pattern:n}}(e.format);for(let t of["format","keystroke"])if(e.actions?.[t]!==void 0)throw new N(G.InvalidArg,`'format' writes the field's ${t} script: name it or actions.${t}, not both`,{details:{field:`actions.${t}`}});return n}function eG(e){return $({type:"javascript",script:e})}function eO(e){return"string"==typeof e&&e.length>=1&&e.length<=256&&e.trim()===e&&!e.includes("\0")}function eI(e,t){if(null==e)return null;if(!eO(e))throw new N(G.InvalidArg,`a field's ${t} is 1 to 256 characters with no space at its start or end and no NUL character, or null for none`,{details:{field:t}});return e}function eN(e){return eO(e)}function eC(e){return eI(e,"placeholder")}function ej(e){return void 0!==e.placeholder?e:{...e,placeholder:null}}function eM(e){if("objectNumber"===e.kind){if(!Number.isInteger(e.objectNumber)||e.objectNumber<=0)throw RangeError(`encodeFieldRefKey: objectNumber must be a positive integer, got ${e.objectNumber}`);return`obj:${e.objectNumber}`}return`fqn:${e.name}`}function eR(e,t){return{ref:e>0&&t?{kind:"objectNumber",page:t,objectNumber:e}:null,objectNumber:e,page:t}}var eT=(e,t)=>e.replace(/\B(?=(\d{3})+(?!\d))/g,()=>t),eB=(e,t)=>t?eB(t,e%t):e;function eL(e){let t=Math.fround(e.conversion??0/0);if(!Number.isFinite(t)||t<=0)return!1;let n=e.precision??("fraction"===e.fraction?16:100);return!!Number.isInteger(n)&&!(n<1)&&!(n>0x7fffffff)&&((e.fraction??"decimal")!=="decimal"||!!Number.isInteger(Math.log10(n)))}function e$(e,t){if(!Number.isFinite(e)||!t.length||!t.every(eL))throw new N(G.InvalidArg,"Measurement requires a finite value and valid number formats");let n=Math.abs(e),r=[];for(let[e,i]of t.entries()){if(!Number.isFinite(n*=Math.fround(i.conversion)))throw new N(G.InvalidArg,"Measurement overflow");let o=Math.floor(n),a=n-o,s=e===t.length-1,l=s||0===a,u=s?function(e,t){let n=t.fraction??"decimal",r=t.thousands??",";if("round"===n)return eT(String(Math.round(e)),r);if("truncate"===n)return eT(String(Math.trunc(e)),r);if("fraction"===n){let n=t.precision??16,i=Math.floor(e),o=Math.round((e-i)*n);if(o===n&&(i++,o=0),!o)return eT(String(i),r);let a=t.fixed?1:eB(o,n);return`${i?`${eT(String(i),r)} `:""}${o/a}/${n/a}`}let i=Math.log10(t.precision??100),[o,a=""]=e.toFixed(i).split(".");return eT(o,r)+(a?(t.decimal||".")+a:"")}(n,i):eT(String(o),i.thousands??","),d="prefix"===i.labelPosition,c=i.prefixSpacing??(d&&0===e?"":" "),f=i.suffixSpacing??(!d&&l?"":" "),m=c+i.unit+f;if(r.push(d?m+u:u+m),l)break;n=a}return(e<0?"-":"")+r.join("")}var ez={courier:{family:"Courier",weight:400,italic:!1},"courier-bold":{family:"Courier",weight:700,italic:!1},"courier-bold-oblique":{family:"Courier",weight:700,italic:!0},"courier-oblique":{family:"Courier",weight:400,italic:!0},helvetica:{family:"Helvetica",weight:400,italic:!1},"helvetica-bold":{family:"Helvetica",weight:700,italic:!1},"helvetica-bold-oblique":{family:"Helvetica",weight:700,italic:!0},"helvetica-oblique":{family:"Helvetica",weight:400,italic:!0},"times-roman":{family:"Times",weight:400,italic:!1},"times-bold":{family:"Times",weight:700,italic:!1},"times-bold-italic":{family:"Times",weight:700,italic:!0},"times-italic":{family:"Times",weight:400,italic:!0},symbol:{family:"Symbol",weight:400,italic:!1},"zapf-dingbats":{family:"ZapfDingbats",weight:400,italic:!1}};function eU(e,t){if(Z.includes(e)){let t=ez[e];return{family:t.family,weight:t.weight,italic:t.italic}}let n=t?.(e);return n?{family:n.familyName,weight:n.weight,italic:n.italic}:{family:e}}function eV(e){return e.toLowerCase().replace(/[\s\-_'"]/g,"")}var eW={helvetica:"Helvetica",arial:"Helvetica",arialmt:"Helvetica",sansserif:"Helvetica",times:"Times",timesroman:"Times",timesnewroman:"Times",timesnewromanpsmt:"Times",serif:"Times",courier:"Courier",couriernew:"Courier",couriernewpsmt:"Courier",monospace:"Courier",symbol:"Symbol",zapfdingbats:"ZapfDingbats",dingbats:"ZapfDingbats"};function eq(e){if("object"!=typeof e||null===e)return!1;let{left:t,bottom:n,right:r,top:i}=e;return[t,n,r,i].every(e=>"number"==typeof e&&Number.isFinite(e))}function eH(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),bottom:Math.min(e.top,e.bottom),top:Math.max(e.top,e.bottom)}}var eK=e=>Number.isFinite(e.x)&&Number.isFinite(e.y);function eZ([e,t,n,r]){if(![e,t,n,r].every(eK))return!1;let i={x:t.x-e.x,y:t.y-e.y},o={x:r.x-n.x,y:r.y-n.y},a={x:n.x-e.x,y:n.y-e.y},s={x:r.x-t.x,y:r.y-t.y},l=[i,o,a,s].map(e=>Math.hypot(e.x,e.y));if(l.some(e=>e<=1e-6)||i.x*o.x+i.y*o.y<=0||a.x*s.x+a.y*s.y<=0)return!1;let u=i.x*a.y-i.y*a.x,d=o.x*s.y-o.y*s.x;return!(Math.abs(u)<=1e-6*l[0]*l[2]||Math.abs(d)<=1e-6*l[1]*l[3])&&Math.sign(u)===Math.sign(d)}function eJ(e,t){let n=eQ(t);if(null!==n)return eX(e,n);let r=t*Math.PI/180,i=Math.abs(Math.cos(r)),o=Math.abs(Math.sin(r)),a=e.right-e.left,s=e.top-e.bottom,l=(a*i+s*o)/2,u=(a*o+s*i)/2,d=(e.left+e.right)/2,c=(e.bottom+e.top)/2;return{left:d-l,bottom:c-u,right:d+l,top:c+u}}function eQ(e){let t=(e%360+360)%360;return t%90==0?t:null}function eX(e,t){if(0===t||180===t)return e;let n=(e.left+e.right)/2,r=(e.bottom+e.top)/2,i=(e.top-e.bottom)/2,o=(e.right-e.left)/2;return{left:n-i,bottom:r-o,right:n+i,top:r+o}}function eY(e,t){let n=.01+1e-4*Math.max(e.right-e.left,e.top-e.bottom,t.right-t.left,t.top-t.bottom);return Math.abs(e.left-t.left)<=n&&Math.abs(e.bottom-t.bottom)<=n&&Math.abs(e.right-t.right)<=n&&Math.abs(e.top-t.top)<=n}function e0(e){if(0===e.length)return{left:0,bottom:0,right:0,top:0};let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let{x:o,y:a}of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),i=Math.max(i,a);return{left:t,bottom:n,right:r,top:i}}function e1(e,t){let n=t.degrees*Math.PI/180,r=Math.cos(n),i=Math.sin(n),o=e.x-t.center.x,a=e.y-t.center.y;return{x:t.center.x+o*r+a*i,y:t.center.y-o*i+a*r}}function e3(e,t){return e1(e,{degrees:-t.degrees,center:t.center})}function e2(e,t){return e.replace(/\r\n|\r|\n/g,t)}var e6={family:"Helvetica",weight:400,italic:!1,size:12,color:"#000000",decoration:[],script:"normal",letterSpacing:0,horizontalScale:1,align:"left",dir:"ltr"};function e5(e){return e2(e.paragraphs.map(e=>e.runs.map(e=>e.text).join("")).join(` +"use strict";(()=>{let e,t,n,r,i,o,a,s,l,u,d,c,f,m,p;var h,F,g,_,P,D,b,y,w=Object.defineProperty,E=Object.getOwnPropertyNames,A=(e=function(e){if("u">typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')},"u">typeof require?require:"u">typeof Proxy?new Proxy(e,{get:(e,t)=>("u">typeof require?require:e)[t]}):e),v=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},S=(e,t,n)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?w(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n},k={};v(k,{default:()=>_});var x=(t={"../runtime/npm/wasm32/lib/embedpdf.browser.js"(){var e;e=self.location.href,_=function(t={}){var n,r,i,o,a,s,l,u,d,c,f,m,p,h,F,g,_,P,D,b,y=new Promise((e,t)=>{n=e,r=t});["_EPDF_CheckPasswordPermissions","_EPDF_DigestBuffer","_EPDF_FreeBuffer","_EPDF_GetDecodedImageBytes","_EPDF_GetMetaKeyCount","_EPDF_GetMetaKeyName","_EPDF_GetMetaTrapped","_EPDF_GetPageBoxByIndex","_EPDF_GetPageRotateByIndex","_EPDF_GetPageTabOrderByIndex","_EPDF_GetPageUserUnitByIndex","_EPDF_HasMetaText","_EPDF_InitThread","_EPDF_IsEncrypted","_EPDF_IsOwnerUnlocked","_EPDF_LoadBaseDocument","_EPDF_LoadMemBaseDocument","_EPDF_LoadMemBaseDocument64","_EPDF_LoadPageNormalized","_EPDF_PNG_EncodeRGBA","_EPDF_ReleaseBaseDocument","_EPDF_RemoveEncryption","_EPDF_RenderAnnotBitmap","_EPDF_RenderAnnotBitmapUnrotated","_EPDF_RenderPage_Continue","_EPDF_RenderPageBitmapWithMatrix_Start","_EPDF_SaveAsCopyEx","_EPDF_SaveDocumentToOwnedBuffer","_EPDF_SaveDocumentToOwnedBufferEx","_EPDF_SaveDocumentToOwnedBufferWithVersion","_EPDF_SetBaseDocumentSha256","_EPDF_SetDecodedImageBudget","_EPDF_SetEncryption","_EPDF_SetMetaText","_EPDF_SetMetaTrapped","_EPDF_SetRuntimeOwnerPermissions","_EPDF_ShutdownThread","_EPDF_UnlockOwnerPermissions","_EPDFAction_CloseModel","_EPDFAction_CreateGoTo","_EPDFAction_CreateGoToNamed","_EPDFAction_CreateHide","_EPDFAction_CreateJavaScript","_EPDFAction_CreateLaunch","_EPDFAction_CreateNamed","_EPDFAction_CreateRemoteGoToByName","_EPDFAction_CreateRemoteGoToDest","_EPDFAction_CreateResetForm","_EPDFAction_CreateSubmitForm","_EPDFAction_CreateURI","_EPDFAction_GetNextAt","_EPDFAction_GetNextCount","_EPDFAction_GetNodeCount","_EPDFAction_GetNodeDest","_EPDFAction_GetNodeFilePath","_EPDFAction_GetNodeHideFlag","_EPDFAction_GetNodeJavaScript","_EPDFAction_GetNodeName","_EPDFAction_GetNodeResetForm","_EPDFAction_GetNodeSubmitForm","_EPDFAction_GetNodeSubmitFormCharSet","_EPDFAction_GetNodeSubmitFormURL","_EPDFAction_GetNodeSubtype","_EPDFAction_GetNodeTargetCount","_EPDFAction_GetNodeTargetName","_EPDFAction_GetNodeTargetObjectNumber","_EPDFAction_GetNodeType","_EPDFAction_GetNodeURI","_EPDFAction_GetNodeURIIsMap","_EPDFAction_GetRootNode","_EPDFAction_GetWarningFlags","_EPDFAction_IsComplete","_EPDFAction_LoadModel","_EPDFAction_NodeHasJavaScript","_EPDFAction_SetNext","_EPDFAnnot_AddMeasure","_EPDFAnnot_ClearBorderEffect","_EPDFAnnot_ClearColor","_EPDFAnnot_ClearEmbedMetadata","_EPDFAnnot_ClearEmbedMetadataKey","_EPDFAnnot_ClearMKColor","_EPDFAnnot_ClearMKIcon","_EPDFAnnot_ClearRectangleDifferences","_EPDFAnnot_ExportAppearance","_EPDFAnnot_GenerateAppearance","_EPDFAnnot_GenerateAppearanceWithBlend","_EPDFAnnot_GenerateFormFieldAP","_EPDFAnnot_GetActionModel","_EPDFAnnot_GetAPMatrix","_EPDFAnnot_GetAppearanceState","_EPDFAnnot_GetAppearanceStateCount","_EPDFAnnot_GetAppearanceStateName","_EPDFAnnot_GetAppearanceTransform","_EPDFAnnot_GetAvailableAppearanceModes","_EPDFAnnot_GetBlendMode","_EPDFAnnot_GetBooleanValue","_EPDFAnnot_GetBorderDashPattern","_EPDFAnnot_GetBorderDashPatternCount","_EPDFAnnot_GetBorderEffect","_EPDFAnnot_GetBorderStyle","_EPDFAnnot_GetCalloutLine","_EPDFAnnot_GetCalloutLineCount","_EPDFAnnot_GetColor","_EPDFAnnot_GetDefaultAppearance","_EPDFAnnot_GetDefaultAppearanceFontFace","_EPDFAnnot_GetDefaultAppearanceFontPostScriptName","_EPDFAnnot_GetDrawing","_EPDFAnnot_GetDrawingRect","_EPDFAnnot_GetEmbedMetadataBoolean","_EPDFAnnot_GetEmbedMetadataJSON","_EPDFAnnot_GetEmbedMetadataNumber","_EPDFAnnot_GetEmbedMetadataRect","_EPDFAnnot_GetEmbedMetadataString","_EPDFAnnot_GetFileAttachmentForWrite","_EPDFAnnot_GetIntent","_EPDFAnnot_GetLineCaption","_EPDFAnnot_GetLineEndings","_EPDFAnnot_GetLineLeader","_EPDFAnnot_GetMeasure","_EPDFAnnot_GetMKColor","_EPDFAnnot_GetMKIcon","_EPDFAnnot_GetMKRotation","_EPDFAnnot_GetMKText","_EPDFAnnot_GetMKTextPosition","_EPDFAnnot_GetName","_EPDFAnnot_GetObjectNumber","_EPDFAnnot_GetOpacity","_EPDFAnnot_GetOverlayText","_EPDFAnnot_GetOverlayTextRepeat","_EPDFAnnot_GetRect","_EPDFAnnot_GetRectangleDifferences","_EPDFAnnot_GetReplyType","_EPDFAnnot_GetRichContent","_EPDFAnnot_GetRichTextJSON","_EPDFAnnot_GetRotate","_EPDFAnnot_GetShapeCaption","_EPDFAnnot_GetStructurePosition","_EPDFAnnot_GetTextAlignment","_EPDFAnnot_HasAppearanceStream","_EPDFAnnot_HasEmbedMetadata","_EPDFAnnot_HasMKIcon","_EPDFAnnot_IsValid","_EPDFAnnot_RemoveAction","_EPDFAnnot_RemoveDest","_EPDFAnnot_RemoveKey","_EPDFAnnot_RemoveMeasure","_EPDFAnnot_SetAction","_EPDFAnnot_SetAPMatrix","_EPDFAnnot_SetAppearanceFromPage","_EPDFAnnot_SetBooleanValue","_EPDFAnnot_SetBorderDashPattern","_EPDFAnnot_SetBorderEffect","_EPDFAnnot_SetBorderStyle","_EPDFAnnot_SetCalloutLine","_EPDFAnnot_SetColor","_EPDFAnnot_SetDefaultAppearance","_EPDFAnnot_SetDefaultAppearanceDocumentFont","_EPDFAnnot_SetDefaultAppearanceRegisteredFont","_EPDFAnnot_SetDrawing","_EPDFAnnot_SetEmbedMetadataBoolean","_EPDFAnnot_SetEmbedMetadataJSON","_EPDFAnnot_SetEmbedMetadataNumber","_EPDFAnnot_SetEmbedMetadataRect","_EPDFAnnot_SetEmbedMetadataString","_EPDFAnnot_SetEventAction","_EPDFAnnot_SetIntent","_EPDFAnnot_SetLine","_EPDFAnnot_SetLineCaption","_EPDFAnnot_SetLineEndings","_EPDFAnnot_SetLineLeader","_EPDFAnnot_SetLinkedAnnot","_EPDFAnnot_SetMKColor","_EPDFAnnot_SetMKIcon","_EPDFAnnot_SetMKRotation","_EPDFAnnot_SetMKText","_EPDFAnnot_SetMKTextPosition","_EPDFAnnot_SetName","_EPDFAnnot_SetNoColor","_EPDFAnnot_SetNumberValue","_EPDFAnnot_SetOpacity","_EPDFAnnot_SetOverlayText","_EPDFAnnot_SetOverlayTextRepeat","_EPDFAnnot_SetRect","_EPDFAnnot_SetReplyType","_EPDFAnnot_SetRichTextJSON","_EPDFAnnot_SetRichTextXHTML","_EPDFAnnot_SetRotate","_EPDFAnnot_SetShapeCaption","_EPDFAnnot_SetStampOpacity","_EPDFAnnot_SetSubtype","_EPDFAnnot_SetTextAlignment","_EPDFAnnot_SetVertices","_EPDFAnnot_UpdateAppearanceToRect","_EPDFAttachment_ExportCanonicalToOwnedBuffer","_EPDFAttachment_ExportRawToOwnedBuffer","_EPDFAttachment_ExtractFile","_EPDFAttachment_ExtractFileToOwnedBuffer","_EPDFAttachment_GetDescription","_EPDFAttachment_GetIntegerValue","_EPDFAttachment_ImportRaw","_EPDFAttachment_SetDescription","_EPDFAttachment_SetName","_EPDFAttachment_SetSubtype","_EPDFCatalog_GetLanguage","_EPDFCatalog_GetMetadata","_EPDFCatalog_SetMetadata","_EPDFDest_CreateRemoteView","_EPDFDest_CreateRemoteXYZ","_EPDFDest_CreateView","_EPDFDest_CreateViewByObjectNumber","_EPDFDest_CreateXYZ","_EPDFDest_CreateXYZByObjectNumber","_EPDFDest_GetPageObjectNumber","_EPDFDest_GetViewNullParams","_EPDFDoc_CanonicalDrawing","_EPDFDoc_ClearMissingCharacters","_EPDFDoc_ClearPagePieceInfoEntry","_EPDFDoc_ClearPagePieceInfoKey","_EPDFDoc_ClearPieceInfoEntry","_EPDFDoc_ClearPieceInfoKey","_EPDFDoc_CompareRevisions","_EPDFDoc_CountMissingCharacters","_EPDFDoc_DeletePageByObjectNumber","_EPDFDoc_ExportDictCanonicalToOwnedBuffer","_EPDFDoc_ExportDictRawToOwnedBuffer","_EPDFDoc_ExportDrawing","_EPDFDoc_ExportPagesFlattened","_EPDFDoc_GetAdditionalActionModel","_EPDFDoc_GetAttachmentIndexByKey","_EPDFDoc_GetAttachmentKey","_EPDFDoc_GetBaseBytesSize","_EPDFDoc_GetDrawings","_EPDFDoc_GetFontDisplayProgramCoverage","_EPDFDoc_GetFontDisplayProgramData","_EPDFDoc_GetFontEmbeddingPolicy","_EPDFDoc_GetFontProgramData","_EPDFDoc_GetFontsFingerprint","_EPDFDoc_GetImportFieldRoots","_EPDFDoc_GetLastModified","_EPDFDoc_GetLoadedBytesSize","_EPDFDoc_GetLoadedObjectValue","_EPDFDoc_GetMissingCharacter","_EPDFDoc_GetNamedJavaScriptActionModel","_EPDFDoc_GetNamedPageAt","_EPDFDoc_GetNamedPageCount","_EPDFDoc_GetOpenActionDest","_EPDFDoc_GetOpenActionModel","_EPDFDoc_GetPageActionModel","_EPDFDoc_GetPageLabelSectionAt","_EPDFDoc_GetPageLabelSectionCount","_EPDFDoc_GetPageLastModified","_EPDFDoc_GetPageObjectNumberByIndex","_EPDFDoc_GetPagePieceInfoBoolean","_EPDFDoc_GetPagePieceInfoEntryAt","_EPDFDoc_GetPagePieceInfoEntryCount","_EPDFDoc_GetPagePieceInfoKeyAt","_EPDFDoc_GetPagePieceInfoKeyCount","_EPDFDoc_GetPagePieceInfoLastModified","_EPDFDoc_GetPagePieceInfoName","_EPDFDoc_GetPagePieceInfoNumber","_EPDFDoc_GetPagePieceInfoString","_EPDFDoc_GetPagePieceInfoStringArrayAt","_EPDFDoc_GetPagePieceInfoStringArrayCount","_EPDFDoc_GetPagePieceInfoValueType","_EPDFDoc_GetPieceInfoBoolean","_EPDFDoc_GetPieceInfoEntryAt","_EPDFDoc_GetPieceInfoEntryCount","_EPDFDoc_GetPieceInfoKeyAt","_EPDFDoc_GetPieceInfoKeyCount","_EPDFDoc_GetPieceInfoLastModified","_EPDFDoc_GetPieceInfoName","_EPDFDoc_GetPieceInfoNumber","_EPDFDoc_GetPieceInfoString","_EPDFDoc_GetPieceInfoStringArrayAt","_EPDFDoc_GetPieceInfoStringArrayCount","_EPDFDoc_GetPieceInfoValueType","_EPDFDoc_GetRevision","_EPDFDoc_GetRevisionCount","_EPDFDoc_GetStructureObjectNumbers","_EPDFDoc_GetTypographicFeatures","_EPDFDoc_HasPagePieceInfoEntry","_EPDFDoc_HasPieceInfoEntry","_EPDFDoc_ImportDictRaw","_EPDFDoc_ImportDrawing","_EPDFDoc_ImportPages","_EPDFDoc_LoadPageByObjectNumber","_EPDFDoc_LoadPageByObjectNumberNormalized","_EPDFDoc_OpenBaseOverlay","_EPDFDoc_OpenBaseOverlayFromPath","_EPDFDoc_OpenRevision","_EPDFDoc_ReadLoadedBytes","_EPDFDoc_RemoveNamedPage","_EPDFDoc_RemoveNamedPagesForPage","_EPDFDoc_ResolveFonts","_EPDFDoc_SetFontEmbeddingPolicy","_EPDFDoc_SetNamedPage","_EPDFDoc_SetPageLabelSections","_EPDFDoc_SetPagePieceInfoBoolean","_EPDFDoc_SetPagePieceInfoName","_EPDFDoc_SetPagePieceInfoNumber","_EPDFDoc_SetPagePieceInfoString","_EPDFDoc_SetPagePieceInfoStringArray","_EPDFDoc_SetPageRotationByObjectNumber","_EPDFDoc_SetPieceInfoBoolean","_EPDFDoc_SetPieceInfoName","_EPDFDoc_SetPieceInfoNumber","_EPDFDoc_SetPieceInfoString","_EPDFDoc_SetPieceInfoStringArray","_EPDFDoc_SetTypographicFeatures","_EPDFDoc_StartLoadPageByObjectNumber","_EPDFDocument_ClearEmbedMetadata","_EPDFDss_Add","_EPDFDss_GetCount","_EPDFDss_GetData","_EPDFFont_AddFallbackFont","_EPDFFont_AuthorizeEditing","_EPDFFont_ClearFallbackFonts","_EPDFFont_ClearRegisteredFonts","_EPDFFont_GetCoverage","_EPDFFont_GetEmbeddingPermission","_EPDFFont_GetFallbackOrder","_EPDFFont_GetFamilyName","_EPDFFont_GetLastResortFont","_EPDFFont_GetMetrics","_EPDFFont_GetPostScriptName","_EPDFFont_GetProgramData","_EPDFFont_GetProgramFormat","_EPDFFont_GetProgramHash","_EPDFFont_GetWeight","_EPDFFont_IsEditingAuthorized","_EPDFFont_IsInstanced","_EPDFFont_IsItalic","_EPDFFont_RegisterFont","_EPDFFont_RegisterMemFont","_EPDFFont_RegisterMemFont64","_EPDFFont_SetLastResortFont","_EPDFFontFaces_Close","_EPDFFontFaces_Count","_EPDFFontFaces_CountPrograms","_EPDFFontFaces_GetFamily","_EPDFFontFaces_GetProgramDisplayHash","_EPDFFontFaces_GetProgramEmbedded","_EPDFFontFaces_GetProgramEmbeddingPermission","_EPDFFontFaces_GetProgramFormat","_EPDFFontFaces_GetProgramHash","_EPDFFontFaces_GetProgramMetrics","_EPDFFontFaces_GetProgramObjNum","_EPDFFontFaces_GetProgramPostScriptName","_EPDFFontFaces_GetWeight","_EPDFFontFaces_IsItalic","_EPDFFontFaces_Load","_EPDFFontFaces_ProgramMapsUnicode","_EPDFFontResolution_Close","_EPDFFontResolution_CountMissingCharacters","_EPDFFontResolution_GetBaseFontName","_EPDFFontResolution_GetFallbacks","_EPDFFontResolution_GetFamily","_EPDFFontResolution_GetMissingCharacter","_EPDFFontResolution_GetProgramDisplayHash","_EPDFFontResolution_GetProgramObjNum","_EPDFFontResolution_GetRegisteredFont","_EPDFFontResolution_GetSource","_EPDFFontResolution_GetWeight","_EPDFFontResolution_IsDegraded","_EPDFFontResolution_IsItalic","_EPDFForm_AttachWidget","_EPDFForm_ClearFieldEmbedMetadata","_EPDFForm_ClearFieldEmbedMetadataKey","_EPDFForm_CloseModel","_EPDFForm_CountCalculationOrder","_EPDFForm_CountFieldDefaultValues","_EPDFForm_CountFieldOptions","_EPDFForm_CountFields","_EPDFForm_CountFieldValues","_EPDFForm_CountFieldWidgets","_EPDFForm_CreateField","_EPDFForm_DeleteField","_EPDFForm_DetachWidget","_EPDFForm_ExportFDF","_EPDFForm_ExportFieldRawToOwnedBuffer","_EPDFForm_ExportXFDF","_EPDFForm_GetCalculationOrderFieldIndex","_EPDFForm_GetFieldActionModel","_EPDFForm_GetFieldAlternateName","_EPDFForm_GetFieldDefaultValueAt","_EPDFForm_GetFieldDefaultValueKind","_EPDFForm_GetFieldEmbedMetadataBoolean","_EPDFForm_GetFieldEmbedMetadataJSON","_EPDFForm_GetFieldEmbedMetadataNumber","_EPDFForm_GetFieldEmbedMetadataString","_EPDFForm_GetFieldFamily","_EPDFForm_GetFieldFlags","_EPDFForm_GetFieldIndexByObjNum","_EPDFForm_GetFieldIndexForWidget","_EPDFForm_GetFieldMappingName","_EPDFForm_GetFieldMaxLen","_EPDFForm_GetFieldName","_EPDFForm_GetFieldObjNum","_EPDFForm_GetFieldOptionLabel","_EPDFForm_GetFieldOptionValue","_EPDFForm_GetFieldOrigin","_EPDFForm_GetFieldPartialName","_EPDFForm_GetFieldTopIndex","_EPDFForm_GetFieldValueAt","_EPDFForm_GetFieldValueKind","_EPDFForm_GetFieldWidgetExportValue","_EPDFForm_GetFieldWidgetObjNum","_EPDFForm_GetFieldWidgetOnState","_EPDFForm_GetFieldWidgetPageObjNum","_EPDFForm_GetFieldWidgetRect","_EPDFForm_GetFormKind","_EPDFForm_GetNeedAppearances","_EPDFForm_HasFieldEmbedMetadata","_EPDFForm_HasFieldValuesList","_EPDFForm_ImportFieldRaw","_EPDFForm_IsFieldOptionSelected","_EPDFForm_IsFieldWidgetChecked","_EPDFForm_LoadModel","_EPDFForm_RedrawFieldWidgets","_EPDFForm_Repair","_EPDFForm_SetCalculationOrder","_EPDFForm_SetFieldAlternateName","_EPDFForm_SetFieldAppearanceText","_EPDFForm_SetFieldDefaultValue","_EPDFForm_SetFieldDisplay","_EPDFForm_SetFieldEmbedMetadataBoolean","_EPDFForm_SetFieldEmbedMetadataJSON","_EPDFForm_SetFieldEmbedMetadataNumber","_EPDFForm_SetFieldEmbedMetadataString","_EPDFForm_SetFieldEventAction","_EPDFForm_SetFieldFlags","_EPDFForm_SetFieldMappingName","_EPDFForm_SetFieldMaxLen","_EPDFForm_SetFieldName","_EPDFForm_SetFieldOptions","_EPDFForm_SetFieldSelectedIndices","_EPDFForm_SetFieldValue","_EPDFForm_SetFieldWidgetsChecked","_EPDFImageObj_SetJpeg","_EPDFImageObj_SetPng","_EPDFLayer_AbortTransaction","_EPDFLayer_BeginTransaction","_EPDFLayer_CommitTransaction","_EPDFLayer_GetBaseDocument","_EPDFLayer_GetBaseSha256","_EPDFLayer_GetBirthName","_EPDFLayer_GetBirthObjectNumber","_EPDFLayer_GetLastObjectNumber","_EPDFLayer_GetPromotedObjectCount","_EPDFLayer_IsInTransaction","_EPDFLayer_IsObjectPromoted","_EPDFLayer_IsPagePromoted","_EPDFLayer_OpenLayer","_EPDFLayer_OpenLayerArtifact","_EPDFLayer_OpenLayerArtifactFromPath","_EPDFLayer_RaiseLastObjectNumber","_EPDFLayer_SaveDelta","_EPDFLayer_SaveDeltaEx","_EPDFLayer_SaveDeltaToOwnedBuffer","_EPDFLayer_SaveDeltaToOwnedBufferEx","_EPDFLayer_SaveLayerArtifact","_EPDFLayer_SaveLayerArtifactEx","_EPDFLayer_SaveLayerArtifactToOwnedBuffer","_EPDFLayer_SaveLayerArtifactToOwnedBufferEx","_EPDFMeasure_AddFormat","_EPDFMeasure_CountFormats","_EPDFMeasure_GetCYX","_EPDFMeasure_GetFormat","_EPDFMeasure_GetOrigin","_EPDFMeasure_GetRatio","_EPDFMeasure_GetSubtype","_EPDFMeasure_RemoveFormats","_EPDFMeasure_SetCYX","_EPDFMeasure_SetOrigin","_EPDFMeasure_SetRatio","_EPDFNamedDest_Remove","_EPDFNamedDest_SetDest","_EPDFNumberFormat_GetConversion","_EPDFNumberFormat_GetFixedDenominator","_EPDFNumberFormat_GetFraction","_EPDFNumberFormat_GetLabelPosition","_EPDFNumberFormat_GetPrecision","_EPDFNumberFormat_GetText","_EPDFNumberFormat_GetUnit","_EPDFNumberFormat_SetConversion","_EPDFNumberFormat_SetFixedDenominator","_EPDFNumberFormat_SetFraction","_EPDFNumberFormat_SetLabelPosition","_EPDFNumberFormat_SetPrecision","_EPDFNumberFormat_SetText","_EPDFNumberFormat_SetUnit","_EPDFObjectDiff_Close","_EPDFObjectDiff_GetCount","_EPDFObjectDiff_GetEntry","_EPDFObjectDiff_GetReadStatus","_EPDFObjectDiff_GetReferrer","_EPDFObjectDiff_GetReferrerCount","_EPDFObjectDiff_GetRevisionHealth","_EPDFObjectDiff_GetValue","_EPDFOutline_CreateItem","_EPDFOutline_DeleteItem","_EPDFOutline_ExportItemRawToOwnedBuffer","_EPDFOutline_GetItem","_EPDFOutline_GetObjectNumber","_EPDFOutline_ImportItemRaw","_EPDFOutline_MoveItem","_EPDFOutline_SetAction","_EPDFOutline_SetColor","_EPDFOutline_SetOpen","_EPDFOutline_SetStyle","_EPDFOutline_SetTitle","_EPDFPage_AddViewport","_EPDFPage_AddViewportRaw","_EPDFPage_ApplyRedactions","_EPDFPage_ContinueLoad","_EPDFPage_CountViewports","_EPDFPage_CountViewportsRaw","_EPDFPage_CreateAnnot","_EPDFPage_CreateAnnotRaw","_EPDFPage_ExportAnnotationsAsDocument","_EPDFPage_ExportAnnotsRawToOwnedBuffer","_EPDFPage_ExportRawToOwnedBuffer","_EPDFPage_FindViewport","_EPDFPage_Flatten","_EPDFPage_FlattenAnnotations","_EPDFPage_GetAnnotByName","_EPDFPage_GetAnnotByObjectNumber","_EPDFPage_GetAnnotCountRaw","_EPDFPage_GetAnnotIndexByNameRaw","_EPDFPage_GetAnnotIndexByObjectNumberRaw","_EPDFPage_GetAnnotRaw","_EPDFPage_GetObjectNumber","_EPDFPage_GetParsedSize","_EPDFPage_GetViewport","_EPDFPage_GetViewportRaw","_EPDFPage_ImportAnnotsRaw","_EPDFPage_ImportRaw","_EPDFPage_InsertBlankRaw","_EPDFPage_IsContentCurrent","_EPDFPage_IsValid","_EPDFPage_MoveAnnots","_EPDFPage_MoveAnnotsRaw","_EPDFPage_PromoteInlineAnnotsRaw","_EPDFPage_RemoveAnnot","_EPDFPage_RemoveAnnotByName","_EPDFPage_RemoveAnnotByObjectNumber","_EPDFPage_RemoveAnnotRaw","_EPDFPage_RemoveViewport","_EPDFPage_RemoveViewportRaw","_EPDFPage_ResetRenderCache","_EPDFSig_CloseModel","_EPDFSig_Count","_EPDFSig_DigestByteRange","_EPDFSig_DigestFileRange","_EPDFSig_GetByteRange","_EPDFSig_GetContents","_EPDFSig_GetCoverage","_EPDFSig_GetDocMDPPermission","_EPDFSig_GetFieldMDPAction","_EPDFSig_GetFieldName","_EPDFSig_GetFieldNameAt","_EPDFSig_GetFieldNameCount","_EPDFSig_GetFieldObjNum","_EPDFSig_GetIndexByFieldObjNum","_EPDFSig_GetKind","_EPDFSig_GetLockAction","_EPDFSig_GetLockPermission","_EPDFSig_GetRevisionIndex","_EPDFSig_GetSeedValueFilter","_EPDFSig_GetSeedValueListAt","_EPDFSig_GetSeedValueListCount","_EPDFSig_GetSeedValueMDP","_EPDFSig_GetSeedValuePresentFlags","_EPDFSig_GetSeedValueRequiredFlags","_EPDFSig_GetSeedValueVersion","_EPDFSig_GetString","_EPDFSig_GetValueObjNum","_EPDFSig_GetWidgetObjNum","_EPDFSig_GetWidgetPageObjNum","_EPDFSig_HasSeedValue","_EPDFSig_IsCatalogCertification","_EPDFSig_IsRevisionChainValid","_EPDFSig_IsSigned","_EPDFSig_LoadModel","_EPDFSig_Prepare","_EPDFSig_SaveCandidate","_EPDFSig_SaveCandidateToOwnedBuffer","_EPDFSig_Seal","_EPDFSig_SealSpan","_EPDFSig_SetFieldLock","_EPDFSig_WriteContents","_EPDFText_GetCharGeometry","_EPDFText_GetCharToTextMap","_EPDFText_GetPageGeometry","_EPDFText_GetTextFull","_EPDFText_RedactInQuads","_EPDFText_RedactInRect","_EPDFViewport_AddMeasure","_EPDFViewport_Close","_EPDFViewport_GetBBox","_EPDFViewport_GetMeasure","_EPDFViewport_GetName","_EPDFViewport_RemoveMeasure","_EPDFViewport_SetBBox","_EPDFViewport_SetName","_FORM_CanRedo","_FORM_CanUndo","_FORM_DoDocumentAAction","_FORM_DoDocumentJSAction","_FORM_DoDocumentOpenAction","_FORM_DoPageAAction","_FORM_ForceToKillFocus","_FORM_GetFocusedAnnot","_FORM_GetFocusedText","_FORM_GetSelectedText","_FORM_GetTextDirection","_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_SetTextDirection","_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_GetExpansion","_FPDF_StructElement_GetID","_FPDF_StructElement_GetLang","_FPDF_StructElement_GetMarkedContentID","_FPDF_StructElement_GetMarkedContentIdAtIndex","_FPDF_StructElement_GetMarkedContentIdCount","_FPDF_StructElement_GetObjType","_FPDF_StructElement_GetParent","_FPDF_StructElement_GetRawType","_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_SetFontColor","_FPDFAnnot_SetFormFieldFlags","_FPDFAnnot_SetRect","_FPDFAnnot_SetStringValue","_FPDFAnnot_SetURI","_FPDFAnnot_UpdateObject","_FPDFAttachment_GetAFRelationship","_FPDFAttachment_GetDescription","_FPDFAttachment_GetFile","_FPDFAttachment_GetName","_FPDFAttachment_GetStringValue","_FPDFAttachment_GetSubtype","_FPDFAttachment_GetValueType","_FPDFAttachment_HasKey","_FPDFAttachment_SetDescription","_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_GetColor","_FPDFBookmark_GetCount","_FPDFBookmark_GetDest","_FPDFBookmark_GetFirstChild","_FPDFBookmark_GetNextSibling","_FPDFBookmark_GetStyle","_FPDFBookmark_GetTitle","_FPDFCatalog_GetLanguage","_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","_FPDFFormObj_RemoveObject","_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_InsertObjectAtIndex","_FPDFPage_New","_FPDFPage_RemoveAnnot","_FPDFPage_RemoveObject","_FPDFPage_SetArtBox","_FPDFPage_SetBleedBox","_FPDFPage_SetCropBox","_FPDFPage_SetMediaBox","_FPDFPage_SetRotation","_FPDFPage_SetTrimBox","_FPDFPage_TransformAnnots","_FPDFPage_TransFormWithClip","_FPDFPageObj_AddExistingMark","_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_GetRenderedFillPattern","_FPDFPageObj_GetRenderedStrokePattern","_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_GetParamFloatValue","_FPDFPageObjMark_GetParamIntValue","_FPDFPageObjMark_GetParamKey","_FPDFPageObjMark_GetParamStringValue","_FPDFPageObjMark_GetParamValueType","_FPDFPageObjMark_RemoveParam","_FPDFPageObjMark_SetBlobParam","_FPDFPageObjMark_SetFloatParam","_FPDFPageObjMark_SetIntParam","_FPDFPageObjMark_SetStringParam","_FPDFPath_BezierTo","_FPDFPath_Close","_FPDFPath_CountSegments","_FPDFPath_GetBezierControlPoints","_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_SetPositions","_FPDFText_SetText","_FPDFTextObj_GetFont","_FPDFTextObj_GetFontSize","_FPDFTextObj_GetRenderedBitmap","_FPDFTextObj_GetText","_FPDFTextObj_GetTextRenderMode","_FPDFTextObj_SetFontSize","_FPDFTextObj_SetTextRenderMode","_malloc","_free","_memory","_EPDF_FillFromHostCrypto","___indirect_function_table","onRuntimeInitialized"].forEach(e=>{Object.getOwnPropertyDescriptor(y,e)||Object.defineProperty(y,e,{get:()=>J("You are getting "+e+" 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"),set:()=>J("You are setting "+e+" 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")})});var w="object"==typeof window,E="u">typeof WorkerGlobalScope,v="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type,k=!w&&!v&&!E,x=Object.assign({},t),G="./this.program",O="";if(k){if("object"==typeof process&&"function"==typeof A||"object"==typeof window||"u">typeof WorkerGlobalScope)throw 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?)")}else if(w||E){if(E?O=self.location.href:"u">typeof document&&document.currentScript&&(O=document.currentScript.src),e&&(O=e),O=O.startsWith("blob:")?"":O.substr(0,O.replace(/[?#].*/,"").lastIndexOf("/")+1),"object"!=typeof window&&"u"{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=e=>(M(!Q(e),"readAsync does not work with file:// URLs"),fetch(e,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+" : "+e.url))))}else throw Error("environment detection error");var I=t.print||console.log.bind(console),N=t.printErr||console.error.bind(console);Object.assign(t,x),x=null,Object.getOwnPropertyDescriptor(t,b="fetchSettings")&&J(`\`Module.${b}\` was supplied but \`${b}\` not included in INCOMING_MODULE_JS_API`),t.arguments&&t.arguments,er("arguments","arguments_"),t.thisProgram&&(G=t.thisProgram),er("thisProgram","thisProgram"),M(void 0===t.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),M(void 0===t.read,"Module.read option was removed"),M(void 0===t.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),M(void 0===t.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),M(void 0===t.setWindowTitle,"Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),M(void 0===t.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),er("asm","wasmExports"),er("readAsync","readAsync"),er("readBinary","readBinary"),er("setWindowTitle","setWindowTitle"),M(!v,"node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."),M(!k,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var C=t.wasmBinary;er("wasmBinary","wasmBinary"),"object"!=typeof WebAssembly&&N("no native wasm support detected");var j=!1;function M(e,t){e||J("Assertion failed"+(t?": "+t:""))}function R(){var e=a.buffer;t.HEAP8=s=new Int8Array(e),t.HEAP16=u=new Int16Array(e),t.HEAPU8=l=new Uint8Array(e),t.HEAPU16=d=new Uint16Array(e),t.HEAP32=c=new Int32Array(e),t.HEAPU32=f=new Uint32Array(e),t.HEAPF32=m=new Float32Array(e),t.HEAPF64=p=new Float64Array(e)}function T(){if(!j){var e=e1();0==e&&(e+=4);var t=f[e>>>2>>>0],n=f[e+4>>>2>>>0];(0x2135467!=t||0x89bacdfe!=n)&&J(`Stack overflow! Stack cookie has been overwritten at ${ec(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ec(n)} ${ec(t)}`),0x63736d65!=f[0]&&J("Runtime error: The application has corrupted its heap memory area (address zero)!")}}M(!t.STACK_SIZE,"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),M("u">typeof Int32Array&&"u">typeof Float64Array&&void 0!=Int32Array.prototype.subarray&&void 0!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),M(!t.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),M(!t.INITIAL_MEMORY,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var B=[],L=[],$=[],z=!1;M(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),M(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var U=0,V=null,W=null,q={};function H(e){for(var t=e;;){if(!q[e])return e;e=t+Math.random()}}function K(e){U++,t.monitorRunDependencies?.(U),e?(M(!q[e]),q[e]=1,null===V&&"u">typeof setInterval&&(V=setInterval(()=>{if(j){clearInterval(V),V=null;return}var e=!1;for(var t in q)e||(e=!0,N("still waiting on run dependencies:")),N(`dependency: ${t}`);e&&N("(end of list)")},1e4))):N("warning: run dependency added without ID")}function Z(e){if(U--,t.monitorRunDependencies?.(U),e?(M(q[e]),delete q[e]):N("warning: run dependency removed without ID"),0==U&&(null!==V&&(clearInterval(V),V=null),W)){var n=W;W=null,n()}}function J(e){t.onAbort?.(e),N(e="Aborted("+e+")"),j=!0;var n=new WebAssembly.RuntimeError(e);throw r(n),n}var Q=e=>e.startsWith("file://");function X(e,t){return(...n)=>{M(z,`native function \`${e}\` called before runtime initialization`);var r=eZ[e];return M(r,`exported native function \`${e}\` not found`),M(n.length<=t,`native function \`${e}\` called with ${n.length} args but expects ${t}`),r(...n)}}function Y(e){if(e==h&&C)return new Uint8Array(C);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e,t,n){return(!C?i(e).then(e=>new Uint8Array(e),()=>Y(e)):Promise.resolve().then(()=>Y(e))).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{N(`failed to asynchronously prepare wasm: ${e}`),Q(h)&&N(`warning: Loading from a file URI (${h}) 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`),J(e)})}var et=new Int16Array(1),en=new Int8Array(et.buffer);if(et[0]=25459,115!==en[0]||99!==en[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";if(t.ENVIRONMENT)throw Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");function er(e,n,r=!0){Object.getOwnPropertyDescriptor(t,e)||Object.defineProperty(t,e,{configurable:!0,get(){J(`\`Module.${e}\` has been replaced by \`${n}\``+(r?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":""))}})}function ei(e){return"FS_createPath"===e||"FS_createDataFile"===e||"FS_createPreloadedFile"===e||"FS_unlink"===e||"addRunDependency"===e||"FS_createLazyFile"===e||"FS_createDevice"===e||"removeRunDependency"===e}function eo(e,t){"u">typeof globalThis&&!Object.getOwnPropertyDescriptor(globalThis,e)&&Object.defineProperty(globalThis,e,{configurable:!0,get(){t()}})}function ea(e,t){eo(e,()=>{em(`\`${e}\` is not longer defined by emscripten. ${t}`)})}function es(e){Object.getOwnPropertyDescriptor(t,e)||Object.defineProperty(t,e,{configurable:!0,get(){var t=`'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;ei(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),J(t)}})}ea("buffer","Please use HEAP8.buffer or wasmMemory.buffer"),ea("asm","Please use wasmExports instead");class el{constructor(e){S(this,"name","ExitStatus"),this.message=`Program terminated with exit(${e})`,this.status=e}}var eu=e=>{for(;e.length>0;)e.shift()(t)},ed=t.noExitRuntime||!0,ec=e=>(M("number"==typeof e),"0x"+e.toString(16).padStart(8,"0")),ef=()=>e6(),em=e=>{em.shown||(em.shown={}),em.shown[e]||(em.shown[e]=1,N(e))},ep=(e,t)=>(M(e==e>>>0||e==(0|e)),M(t===(0|t)),t+2097152>>>0<4194305-!!e?(e>>>0)+0x100000000*t:0/0),eh="u">typeof TextDecoder?new TextDecoder:void 0,eF=(e,t=0,n=0/0)=>{for(var r=(t>>>=0)+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&eh)return eh.decode(e.subarray(t,i));for(var o="";t>10,56320|1023&u)}}return o},eg=(e,t)=>(M("number"==typeof e,`UTF8ToString expects a number (got ${typeof e})`),(e>>>=0)?eF(l,e,t):""),e_=()=>{M(void 0!=eC.varargs);var e=c[eC.varargs>>>2>>>0];return eC.varargs+=4,e},eP={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},normalize:e=>{var t=eP.isAbs(e),n="/"===e.substr(-1);return(e=eP.normalizeArray(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=eP.splitPath(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=eP.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return -1===t?e:e.substr(t+1)},join:(...e)=>eP.normalize(e.join("/")),join2:(e,t)=>eP.normalize(e+"/"+t)},eD=e=>(eD=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);J("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")})())(e),eb={resolve:(...e)=>{for(var t="",n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:eN.cwd();if("string"!=typeof i)throw TypeError("Arguments to path.resolve must be strings");if(!i)return"";t=i+"/"+t,n=eP.isAbs(i)}return t=eP.normalizeArray(t.split("/").filter(e=>!!e),!n).join("/"),(n?"/":"")+t||"."},relative:(e,t)=>{function n(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=eb.resolve(e).substr(1),t=eb.resolve(t).substr(1);for(var r=n(e.split("/")),i=n(t.split("/")),o=Math.min(r.length,i.length),a=o,s=0;s{for(var t=0,n=0;n=55296&&r<=57343?(t+=4,++n):t+=3}return t},eE=(e,t,n,r)=>{if(n>>>=0,M("string"==typeof e,`stringToUTF8Array expects a string (got ${typeof e})`),!(r>0))return 0;for(var i=n,o=n+r-1,a=0;a=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=o)break;t[n++>>>0]=s}else if(s<=2047){if(n+1>=o)break;t[n++>>>0]=192|s>>6,t[n++>>>0]=128|63&s}else if(s<=65535){if(n+2>=o)break;t[n++>>>0]=224|s>>12,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|63&s}else{if(n+3>=o)break;s>1114111&&em("Invalid Unicode code point "+ec(s)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[n++>>>0]=240|s>>18,t[n++>>>0]=128|s>>12&63,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|63&s}}return t[n>>>0]=0,n-i};function eA(e,t,n){var r=Array(n>0?n:ew(e)+1),i=eE(e,r,0,r.length);return t&&(r.length=i),r}var ev={ttys:[],init(){},shutdown(){},register(e,t){ev.ttys[e]={input:[],output:[],ops:t},eN.registerDevice(e,ev.stream_ops)},stream_ops:{open(e){var t=ev.ttys[e.node.rdev];if(!t)throw new eN.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new eN.ErrnoError(60);for(var o,a=0,s=0;s(()=>{if(!ey.length){var e=null;if("u">typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+=` +`),!e)return null;ey=eA(e,!0)}return ey.shift()})(),put_char(e,t){null===t||10===t?(I(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(I(eF(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,n)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(N(eF(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(N(eF(e.output)),e.output=[])}}},eS=(e,t)=>(M(t,"alignment argument is required"),Math.ceil(e/t)*t),ek=e=>{var t,n=eX(65536,e=eS(e,65536));return n&&(t=e,l.fill(0,n,n+t)),n},ex={ops_table:null,mount:e=>ex.createNode(null,"/",16895,0),createNode(e,t,n,r){if(eN.isBlkdev(n)||eN.isFIFO(n))throw new eN.ErrnoError(63);ex.ops_table||(ex.ops_table={dir:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr,lookup:ex.node_ops.lookup,mknod:ex.node_ops.mknod,rename:ex.node_ops.rename,unlink:ex.node_ops.unlink,rmdir:ex.node_ops.rmdir,readdir:ex.node_ops.readdir,symlink:ex.node_ops.symlink},stream:{llseek:ex.stream_ops.llseek}},file:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr},stream:{llseek:ex.stream_ops.llseek,read:ex.stream_ops.read,write:ex.stream_ops.write,allocate:ex.stream_ops.allocate,mmap:ex.stream_ops.mmap,msync:ex.stream_ops.msync}},link:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr,readlink:ex.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ex.node_ops.getattr,setattr:ex.node_ops.setattr},stream:eN.chrdev_stream_ops}});var i=eN.createNode(e,t,n,r);return eN.isDir(i.mode)?(i.node_ops=ex.ops_table.dir.node,i.stream_ops=ex.ops_table.dir.stream,i.contents={}):eN.isFile(i.mode)?(i.node_ops=ex.ops_table.file.node,i.stream_ops=ex.ops_table.file.stream,i.usedBytes=0,i.contents=null):eN.isLink(i.mode)?(i.node_ops=ex.ops_table.link.node,i.stream_ops=ex.ops_table.link.stream):eN.isChrdev(i.mode)&&(i.node_ops=ex.ops_table.chrdev.node,i.stream_ops=ex.ops_table.chrdev.stream),i.timestamp=Date.now(),e&&(e.contents[t]=i,e.timestamp=i.timestamp),i},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),0!=n&&(t=Math.max(t,256));var r=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=eN.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,eN.isDir(e.mode)?t.size=4096:eN.isFile(e.mode)?t.size=e.usedBytes:eN.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&ex.resizeFileStorage(e,t.size)},lookup(e,t){throw new eN.ErrnoError(44)},mknod:(e,t,n,r)=>ex.createNode(e,t,n,r),rename(e,t,n){if(eN.isDir(e.mode)){var r;try{r=eN.lookupNode(t,n)}catch{}if(r)for(var i in r.contents)throw new eN.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var n=eN.lookupNode(e,t);for(var r in n.contents)throw new eN.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=ex.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!eN.isLink(e.mode))throw new eN.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var o=e.node.contents;if(i>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-i,r);if(M(a>=0),a>8&&o.subarray)t.set(o.subarray(i,i+a),n);else for(var s=0;s0||n+t>>0))}return{ptr:o,allocated:a}},msync:(e,t,n,r,i)=>(ex.stream_ops.write(e,t,0,r,n,!1),0)}},eG=t.preloadPlugins||[],eO=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},eI={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},eN={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class extends Error{constructor(e){for(var t in super(z?eg(eQ(e)):""),S(this,"name","ErrnoError"),this.errno=e,eI)if(eI[t]===e){this.code=t;break}}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){S(this,"shared",{})}get object(){return this.node}set object(e){this.node=e}get isRead(){return(2097155&this.flags)!=1}get isWrite(){return(2097155&this.flags)!=0}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){S(this,"node_ops",{}),S(this,"stream_ops",{}),S(this,"readMode",365),S(this,"writeMode",146),S(this,"mounted",null),e||(e=this),this.parent=e,this.mount=e.mount,this.id=eN.nextInode++,this.name=t,this.mode=n,this.rdev=r}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return eN.isDir(this.mode)}get isDevice(){return eN.isChrdev(this.mode)}},lookupPath(e,t={}){if(!(e=eb.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new eN.ErrnoError(32);for(var n=e.split("/").filter(e=>!!e),r=eN.root,i="/",o=0;o40)throw new eN.ErrnoError(32)}}return{path:i,node:r}},getPath(e){for(var t;;){if(eN.isRoot(e)){var n=e.mount.mountpoint;if(!t)return n;return"/"!==n[n.length-1]?`${n}/${t}`:n+t}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r>>0)%eN.nameTable.length},hashAddNode(e){var t=eN.hashName(e.parent.id,e.name);e.name_next=eN.nameTable[t],eN.nameTable[t]=e},hashRemoveNode(e){var t=eN.hashName(e.parent.id,e.name);if(eN.nameTable[t]===e)eN.nameTable[t]=e.name_next;else for(var n=eN.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=eN.mayLookup(e);if(n)throw new eN.ErrnoError(n);for(var r=eN.hashName(e.id,t),i=eN.nameTable[r];i;i=i.name_next){var o=i.name;if(i.parent.id===e.id&&o===t)return i}return eN.lookup(e,t)},createNode(e,t,n,r){M("object"==typeof e);var i=new eN.FSNode(e,t,n,r);return eN.hashAddNode(i),i},destroyNode(e){eN.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(61440&e)==32768,isDir:e=>(61440&e)==16384,isLink:e=>(61440&e)==40960,isChrdev:e=>(61440&e)==8192,isBlkdev:e=>(61440&e)==24576,isFIFO:e=>(61440&e)==4096,isSocket:e=>(49152&e)==49152,flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>eN.ignorePermissions?0:t.includes("r")&&!(292&e.mode)||t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0,mayLookup:e=>eN.isDir(e.mode)?eN.nodePermissions(e,"x")||2*!e.node_ops.lookup:54,mayCreate(e,t){try{return eN.lookupNode(e,t),20}catch(e){}return eN.nodePermissions(e,"wx")},mayDelete(e,t,n){try{r=eN.lookupNode(e,t)}catch(e){return e.errno}var r,i=eN.nodePermissions(e,"wx");if(i)return i;if(n){if(!eN.isDir(r.mode))return 54;if(eN.isRoot(r)||eN.getPath(r)===eN.cwd())return 10}else if(eN.isDir(r.mode))return 31;return 0},mayOpen:(e,t)=>e?eN.isLink(e.mode)?32:eN.isDir(e.mode)&&("r"!==eN.flagsToPermissionString(t)||512&t)?31:eN.nodePermissions(e,eN.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=eN.MAX_OPEN_FDS;e++)if(!eN.streams[e])return e;throw new eN.ErrnoError(33)},getStreamChecked(e){var t=eN.getStream(e);if(!t)throw new eN.ErrnoError(8);return t},getStream:e=>eN.streams[e],createStream:(e,t=-1)=>(M(t>=-1),e=Object.assign(new eN.FSStream,e),-1==t&&(t=eN.nextfd()),e.fd=t,eN.streams[t]=e,e),closeStream(e){eN.streams[e]=null},dupStream(e,t=-1){var n=eN.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){var t=eN.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new eN.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){eN.devices[e]={stream_ops:t}},getDevice:e=>eN.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),eN.syncFSRequests++,eN.syncFSRequests>1&&N(`warning: ${eN.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=eN.getMounts(eN.root.mount),r=0;function i(e){return M(eN.syncFSRequests>0),eN.syncFSRequests--,t(e)}function o(e){if(e)return o.errored?void 0:(o.errored=!0,i(e));++r>=n.length&&i(null)}n.forEach(t=>{if(!t.type.syncfs)return o(null);t.type.syncfs(t,e,o)})},mount(e,t,n){if("string"==typeof e)throw e;var r,i="/"===n,o=!n;if(i&&eN.root)throw new eN.ErrnoError(10);if(!i&&!o){var a=eN.lookupPath(n,{follow_mount:!1});if(n=a.path,r=a.node,eN.isMountpoint(r))throw new eN.ErrnoError(10);if(!eN.isDir(r.mode))throw new eN.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},l=e.mount(s);return l.mount=s,s.root=l,i?eN.root=l:r&&(r.mounted=s,r.mount&&r.mount.mounts.push(s)),l},unmount(e){var t=eN.lookupPath(e,{follow_mount:!1});if(!eN.isMountpoint(t.node))throw new eN.ErrnoError(28);var n=t.node,r=n.mounted,i=eN.getMounts(r);Object.keys(eN.nameTable).forEach(e=>{for(var t=eN.nameTable[e];t;){var n=t.name_next;i.includes(t.mount)&&eN.destroyNode(t),t=n}}),n.mounted=null;var o=n.mount.mounts.indexOf(r);M(-1!==o),n.mount.mounts.splice(o,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,n){var r=eN.lookupPath(e,{parent:!0}).node,i=eP.basename(e);if(!i||"."===i||".."===i)throw new eN.ErrnoError(28);var o=eN.mayCreate(r,i);if(o)throw new eN.ErrnoError(o);if(!r.node_ops.mknod)throw new eN.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},create:(e,t)=>(t=(void 0!==t?t:438)&4095|32768,eN.mknod(e,t,0)),mkdir:(e,t)=>(t=(void 0!==t?t:511)&1023|16384,eN.mknod(e,t,0)),mkdirTree(e,t){for(var n=e.split("/"),r="",i=0;i(void 0===n&&(n=t,t=438),t|=8192,eN.mknod(e,t,n)),symlink(e,t){if(!eb.resolve(e))throw new eN.ErrnoError(44);var n=eN.lookupPath(t,{parent:!0}).node;if(!n)throw new eN.ErrnoError(44);var r=eP.basename(t),i=eN.mayCreate(n,r);if(i)throw new eN.ErrnoError(i);if(!n.node_ops.symlink)throw new eN.ErrnoError(63);return n.node_ops.symlink(n,r,e)},rename(e,t){var n,r,i,o=eP.dirname(e),a=eP.dirname(t),s=eP.basename(e),l=eP.basename(t);if(n=eN.lookupPath(e,{parent:!0}).node,r=eN.lookupPath(t,{parent:!0}).node,!n||!r)throw new eN.ErrnoError(44);if(n.mount!==r.mount)throw new eN.ErrnoError(75);var u=eN.lookupNode(n,s),d=eb.relative(e,a);if("."!==d.charAt(0))throw new eN.ErrnoError(28);if("."!==(d=eb.relative(t,o)).charAt(0))throw new eN.ErrnoError(55);try{i=eN.lookupNode(r,l)}catch(e){}if(u!==i){var c=eN.isDir(u.mode),f=eN.mayDelete(n,s,c);if(f||(f=i?eN.mayDelete(r,l,c):eN.mayCreate(r,l)))throw new eN.ErrnoError(f);if(!n.node_ops.rename)throw new eN.ErrnoError(63);if(eN.isMountpoint(u)||i&&eN.isMountpoint(i))throw new eN.ErrnoError(10);if(r!==n&&(f=eN.nodePermissions(n,"w")))throw new eN.ErrnoError(f);eN.hashRemoveNode(u);try{n.node_ops.rename(u,r,l),u.parent=r}catch(e){throw e}finally{eN.hashAddNode(u)}}},rmdir(e){var t=eN.lookupPath(e,{parent:!0}).node,n=eP.basename(e),r=eN.lookupNode(t,n),i=eN.mayDelete(t,n,!0);if(i)throw new eN.ErrnoError(i);if(!t.node_ops.rmdir)throw new eN.ErrnoError(63);if(eN.isMountpoint(r))throw new eN.ErrnoError(10);t.node_ops.rmdir(t,n),eN.destroyNode(r)},readdir(e){var t=eN.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new eN.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=eN.lookupPath(e,{parent:!0}).node;if(!t)throw new eN.ErrnoError(44);var n=eP.basename(e),r=eN.lookupNode(t,n),i=eN.mayDelete(t,n,!1);if(i)throw new eN.ErrnoError(i);if(!t.node_ops.unlink)throw new eN.ErrnoError(63);if(eN.isMountpoint(r))throw new eN.ErrnoError(10);t.node_ops.unlink(t,n),eN.destroyNode(r)},readlink(e){var t=eN.lookupPath(e).node;if(!t)throw new eN.ErrnoError(44);if(!t.node_ops.readlink)throw new eN.ErrnoError(28);return eb.resolve(eN.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var n=eN.lookupPath(e,{follow:!t}).node;if(!n)throw new eN.ErrnoError(44);if(!n.node_ops.getattr)throw new eN.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>eN.stat(e,!0),chmod(e,t,n){var r;if(!(r="string"==typeof e?eN.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new eN.ErrnoError(63);r.node_ops.setattr(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})},lchmod(e,t){eN.chmod(e,t,!0)},fchmod(e,t){var n=eN.getStreamChecked(e);eN.chmod(n.node,t)},chown(e,t,n,r){var i;if(!(i="string"==typeof e?eN.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new eN.ErrnoError(63);i.node_ops.setattr(i,{timestamp:Date.now()})},lchown(e,t,n){eN.chown(e,t,n,!0)},fchown(e,t,n){var r=eN.getStreamChecked(e);eN.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new eN.ErrnoError(28);if("string"==typeof e){var n;n=eN.lookupPath(e,{follow:!0}).node}else n=e;if(!n.node_ops.setattr)throw new eN.ErrnoError(63);if(eN.isDir(n.mode))throw new eN.ErrnoError(31);if(!eN.isFile(n.mode))throw new eN.ErrnoError(28);var r=eN.nodePermissions(n,"w");if(r)throw new eN.ErrnoError(r);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=eN.getStreamChecked(e);if((2097155&n.flags)==0)throw new eN.ErrnoError(28);eN.truncate(n.node,t)},utime(e,t,n){var r=eN.lookupPath(e,{follow:!0}).node;r.node_ops.setattr(r,{timestamp:Math.max(t,n)})},open(e,n,r){if(""===e)throw new eN.ErrnoError(44);if(r=64&(n="string"==typeof n?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw Error(`Unknown file open mode: ${e}`);return t})(n):n)?4095&(r=void 0===r?438:r)|32768:0,"object"==typeof e)i=e;else{e=eP.normalize(e);try{var i;i=eN.lookupPath(e,{follow:!(131072&n)}).node}catch(e){}}var o=!1;if(64&n)if(i){if(128&n)throw new eN.ErrnoError(20)}else i=eN.mknod(e,r,0),o=!0;if(!i)throw new eN.ErrnoError(44);if(eN.isChrdev(i.mode)&&(n&=-513),65536&n&&!eN.isDir(i.mode))throw new eN.ErrnoError(54);if(!o){var a=eN.mayOpen(i,n);if(a)throw new eN.ErrnoError(a)}512&n&&!o&&eN.truncate(i,0),n&=-131713;var s=eN.createStream({node:i,path:eN.getPath(i),flags:n,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!t.logReadFiles||1&n||e in eN.readFiles||(eN.readFiles[e]=1),s},close(e){if(eN.isClosed(e))throw new eN.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{eN.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,n){if(eN.isClosed(e))throw new eN.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new eN.ErrnoError(70);if(0!=n&&1!=n&&2!=n)throw new eN.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(M(n>=0),r<0||i<0)throw new eN.ErrnoError(28);if(eN.isClosed(e)||(2097155&e.flags)==1)throw new eN.ErrnoError(8);if(eN.isDir(e.node.mode))throw new eN.ErrnoError(31);if(!e.stream_ops.read)throw new eN.ErrnoError(28);var o=void 0!==i;if(o){if(!e.seekable)throw new eN.ErrnoError(70)}else i=e.position;var a=e.stream_ops.read(e,t,n,r,i);return o||(e.position+=a),a},write(e,t,n,r,i,o){if(M(n>=0),r<0||i<0)throw new eN.ErrnoError(28);if(eN.isClosed(e)||(2097155&e.flags)==0)throw new eN.ErrnoError(8);if(eN.isDir(e.node.mode))throw new eN.ErrnoError(31);if(!e.stream_ops.write)throw new eN.ErrnoError(28);e.seekable&&1024&e.flags&&eN.llseek(e,0,2);var a=void 0!==i;if(a){if(!e.seekable)throw new eN.ErrnoError(70)}else i=e.position;var s=e.stream_ops.write(e,t,n,r,i,o);return a||(e.position+=s),s},allocate(e,t,n){if(eN.isClosed(e))throw new eN.ErrnoError(8);if(t<0||n<=0)throw new eN.ErrnoError(28);if((2097155&e.flags)==0)throw new eN.ErrnoError(8);if(!eN.isFile(e.node.mode)&&!eN.isDir(e.node.mode))throw new eN.ErrnoError(43);if(!e.stream_ops.allocate)throw new eN.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,i){if((2&r)!=0&&(2&i)==0&&(2097155&e.flags)!=2||(2097155&e.flags)==1)throw new eN.ErrnoError(2);if(!e.stream_ops.mmap)throw new eN.ErrnoError(43);if(!t)throw new eN.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync:(e,t,n,r,i)=>(M(n>=0),e.stream_ops.msync)?e.stream_ops.msync(e,t,n,r,i):0,ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new eN.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw Error(`Invalid encoding type "${t.encoding}"`);var n,r=eN.open(e,t.flags),i=eN.stat(e).size,o=new Uint8Array(i);return eN.read(r,o,0,i,0),"utf8"===t.encoding?n=eF(o):"binary"===t.encoding&&(n=o),eN.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=eN.open(e,n.flags,n.mode);if("string"==typeof t){var i=new Uint8Array(ew(t)+1),o=eE(t,i,0,i.length);eN.write(r,i,0,o,void 0,n.canOwn)}else if(ArrayBuffer.isView(t))eN.write(r,t,0,t.byteLength,void 0,n.canOwn);else throw Error("Unsupported data type");eN.close(r)},cwd:()=>eN.currentPath,chdir(e){var t=eN.lookupPath(e,{follow:!0});if(null===t.node)throw new eN.ErrnoError(44);if(!eN.isDir(t.node.mode))throw new eN.ErrnoError(54);var n=eN.nodePermissions(t.node,"x");if(n)throw new eN.ErrnoError(n);eN.currentPath=t.path},createDefaultDirectories(){eN.mkdir("/tmp"),eN.mkdir("/home"),eN.mkdir("/home/web_user")},createDefaultDevices(){eN.mkdir("/dev"),eN.registerDevice(eN.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r,llseek:()=>0}),eN.mkdev("/dev/null",eN.makedev(1,3)),ev.register(eN.makedev(5,0),ev.default_tty_ops),ev.register(eN.makedev(6,0),ev.default_tty1_ops),eN.mkdev("/dev/tty",eN.makedev(5,0)),eN.mkdev("/dev/tty1",eN.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(0===t&&(t=eD(e).byteLength),e[--t]);eN.createDevice("/dev","random",n),eN.createDevice("/dev","urandom",n),eN.mkdir("/dev/shm"),eN.mkdir("/dev/shm/tmp")},createSpecialDirectories(){eN.mkdir("/proc");var e=eN.mkdir("/proc/self");eN.mkdir("/proc/self/fd"),eN.mount({mount(){var t=eN.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var n=eN.getStreamChecked(+t),r={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return r.parent=r,r}},t}},{},"/proc/self/fd")},createStandardStreams(e,t,n){e?eN.createDevice("/dev","stdin",e):eN.symlink("/dev/tty","/dev/stdin"),t?eN.createDevice("/dev","stdout",null,t):eN.symlink("/dev/tty","/dev/stdout"),n?eN.createDevice("/dev","stderr",null,n):eN.symlink("/dev/tty1","/dev/stderr");var r=eN.open("/dev/stdin",0),i=eN.open("/dev/stdout",1),o=eN.open("/dev/stderr",1);M(0===r.fd,`invalid handle for stdin (${r.fd})`),M(1===i.fd,`invalid handle for stdout (${i.fd})`),M(2===o.fd,`invalid handle for stderr (${o.fd})`)},staticInit(){eN.nameTable=Array(4096),eN.mount(ex,{},"/"),eN.createDefaultDirectories(),eN.createDefaultDevices(),eN.createSpecialDirectories(),eN.filesystems={MEMFS:ex}},init(e,n,r){M(!eN.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),eN.initialized=!0,e??(e=t.stdin),n??(n=t.stdout),r??(r=t.stderr),eN.createStandardStreams(e,n,r)},quit(){eN.initialized=!1,eJ(0);for(var e=0;etypeof XMLHttpRequest)throw Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=o(e.url),e.usedBytes=e.contents.length}catch(e){throw new eN.ErrnoError(29)}},createLazyFile(e,t,n,r,i){if("u">typeof XMLHttpRequest){if(!E)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o={isDevice:!1,contents:new class{constructor(){S(this,"lengthKnown",!1),S(this,"chunks",[])}get(e){if(!(e>this.length-1)&&!(e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e,t=new XMLHttpRequest;if(t.open("HEAD",n,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw Error("Couldn't load "+n+". Status: "+t.status);var r=Number(t.getResponseHeader("Content-length")),i=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,o=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,a=1048576;i||(a=r);var s=this;s.setDataGetter(e=>{var t=e*a,i=(e+1)*a-1;if(i=Math.min(i,r-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,t)=>{if(e>t)throw Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>r-1)throw Error("only "+r+" bytes available! programmer error!");var i=new XMLHttpRequest;if(i.open("GET",n,!1),r!==a&&i.setRequestHeader("Range","bytes="+e+"-"+t),i.responseType="arraybuffer",i.overrideMimeType&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.send(null),!(i.status>=200&&i.status<300||304===i.status))throw Error("Couldn't load "+n+". Status: "+i.status);return void 0!==i.response?new Uint8Array(i.response||[]):eA(i.responseText||"",!0)})(t,i)),void 0===s.chunks[e])throw Error("doXHR failed!");return s.chunks[e]}),(o||!r)&&(a=r=1,a=r=this.getter(0).length,I("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=r,this._chunkSize=a,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}}}else var o={isDevice:!1,url:n};var a=eN.createFile(e,t,o,r,i);o.contents?a.contents=o.contents:o.url&&(a.contents=null,a.url=o.url),Object.defineProperties(a,{usedBytes:{get:function(){return this.contents.length}}});var l={};function u(e,t,n,r,i){var o=e.node.contents;if(i>=o.length)return 0;var a=Math.min(o.length-i,r);if(M(a>=0),o.slice)for(var s=0;s{var t=a.stream_ops[e];l[e]=(...e)=>(eN.forceLoadFile(a),t(...e))}),l.read=(e,t,n,r,i)=>(eN.forceLoadFile(a),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{eN.forceLoadFile(a);var o=ek(t);if(!o)throw new eN.ErrnoError(48);return u(e,s,o,t,n),{ptr:o,allocated:!0}},a.stream_ops=l,a},absolutePath(){J("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){J("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){J("FS.createLink has been removed; use FS.symlink instead")},joinPath(){J("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){J("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){J("FS.standardizePath has been removed; use PATH.normalize instead")}},eC={DEFAULT_POLLMASK:5,calculateAt(e,t,n){if(eP.isAbs(t))return t;if(-100===e)r=eN.cwd();else{var r;r=eC.getStreamFromFD(e).path}if(0==t.length){if(!n)throw new eN.ErrnoError(44);return r}return eP.join2(r,t)},doStat(e,t,n){var r=e(t);c[n>>>2>>>0]=r.dev,c[n+4>>>2>>>0]=r.mode,f[n+8>>>2>>>0]=r.nlink,c[n+12>>>2>>>0]=r.uid,c[n+16>>>2>>>0]=r.gid,c[n+20>>>2>>>0]=r.rdev,g=[r.size>>>0,+Math.abs(F=r.size)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+24>>>2>>>0]=g[0],c[n+28>>>2>>>0]=g[1],c[n+32>>>2>>>0]=4096,c[n+36>>>2>>>0]=r.blocks;var i=r.atime.getTime(),o=r.mtime.getTime(),a=r.ctime.getTime();return g=[Math.floor(i/1e3)>>>0,+Math.abs(F=Math.floor(i/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+40>>>2>>>0]=g[0],c[n+44>>>2>>>0]=g[1],f[n+48>>>2>>>0]=i%1e3*1e6,g=[Math.floor(o/1e3)>>>0,+Math.abs(F=Math.floor(o/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+56>>>2>>>0]=g[0],c[n+60>>>2>>>0]=g[1],f[n+64>>>2>>>0]=o%1e3*1e6,g=[Math.floor(a/1e3)>>>0,+Math.abs(F=Math.floor(a/1e3))>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+72>>>2>>>0]=g[0],c[n+76>>>2>>>0]=g[1],f[n+80>>>2>>>0]=a%1e3*1e6,g=[r.ino>>>0,+Math.abs(F=r.ino)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0],c[n+88>>>2>>>0]=g[0],c[n+92>>>2>>>0]=g[1],0},doMsync(e,t,n,r,i){if(!eN.isFile(t.node.mode))throw new eN.ErrnoError(43);if(2&r)return 0;var o=l.slice(e,e+n);eN.msync(t,o,i,n,r)},getStreamFromFD:e=>eN.getStreamChecked(e),varargs:void 0,getStr:e=>eg(e)},ej=(e,t,n)=>(M("number"==typeof n,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),eE(e,l,t,n)),eM=[0,31,60,91,121,152,182,213,244,274,305,335],eR=[0,31,59,90,120,151,181,212,243,273,304,334],eT=e=>{var t=a.buffer,n=(e-t.byteLength+65535)/65536|0;try{return a.grow(n),R(),1}catch(n){N(`growMemory: Attempted to grow heap from ${t.byteLength} bytes to ${e} bytes, but got error: ${n}`)}},eB={},eL=()=>{if(!eL.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:G||"./this.program"};for(var t in eB)void 0===eB[t]?delete e[t]:e[t]=eB[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);eL.strings=n}return eL.strings},e$=[],ez=e=>{var t=e$[e];return t||(e>=e$.length&&(e$.length=e+1),e$[e]=t=_.get(e)),M(_.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t},eU="u">typeof TextDecoder?new TextDecoder("utf-16le"):void 0,eV=(e,t)=>{M(e<16384),e<128?t.push(e):t.push(e%128|128,e>>7)},eW=[],eq=(e,t)=>{_.set(e,t),e$[e]=_.get(e)},eH=(e,n,r,i,o)=>{var a,l,u={string:e=>{var t,n,r=0;return null!=e&&0!==e&&(t=ew(e)+1,ej(e,n=e2(t),t),r=n),r},array:e=>{let t;var n=(t=e.length,e2(t));return M(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),s.set(e,n>>>0),n}},d=(M(a=t["_"+e],"Cannot call unknown function "+e+", make sure it is exported"),a),c=[],f=0;if(M("array"!==n,'Return type should not be "array".'),i)for(var m=0;m{var c,f=t?eb.resolve(eP.join2(e,t)):e,m=H(`cp ${f}`);function p(n){var i,c;function p(n){d?.(),l||eN.createDataFile(e,t,n,r,o,u),a?.(),Z(m)}i=()=>{s?.(),Z(m)},"u">typeof Browser&&Browser.init(),c=!1,eG.forEach(e=>{!c&&e.canHandle(f)&&(e.handle(n,f,p,i),c=!0)}),c||p(n)}(K(m),"string"==typeof n)?(c=H(`al ${n}`),i(n).then(e=>{M(e,`Loading data file "${n}" failed (no arrayBuffer).`),p(new Uint8Array(e)),c&&Z(c)},e=>{if(s)s();else throw`Loading data file "${n}" failed.`}),c&&K(c)):p(n)},eN.staticInit();var eK={EPDF_FillFromHostCrypto:function(e,t){var n=globalThis.crypto;if(!n||"function"!=typeof n.getRandomValues)return 0;e>>>=0,t>>>=0;try{n.getRandomValues(l.subarray(e>>>0,e+t>>>0))}catch{return 0}return 1},__assert_fail:function(e,t,n,r){e>>>=0,t>>>=0,r>>>=0,J(`Assertion failed: ${eg(e)}, at: `+[t?eg(t):"unknown filename",n,r?eg(r):"unknown function"])},__syscall_fcntl64:function(e,t,n){eC.varargs=n>>>=0;try{var r=eC.getStreamFromFD(e);switch(t){case 0:var i=e_();if(i<0)break;for(;eN.streams[i];)i++;return eN.dupStream(r,i).fd;case 1:case 2:case 13:case 14:return 0;case 3:return r.flags;case 4:var i=e_();return r.flags|=i,0;case 12:var i=e_();return u[i+0>>>1>>>0]=2,0}return -28}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_fstat64:function(e,t){t>>>=0;try{var n=eC.getStreamFromFD(e);return eC.doStat(eN.stat,n.path,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ftruncate64:function(e,t,n){var r=ep(t,n);try{if(isNaN(r))return 61;return eN.ftruncate(e,r),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_getdents64:function(e,t,n){t>>>=0,n>>>=0;try{var r=eC.getStreamFromFD(e);r.getdents||(r.getdents=eN.readdir(r.path));for(var i=0,o=eN.llseek(r,0,1),a=Math.floor(o/280);a>>0,(F=l,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[t+i>>>2>>>0]=g[0],c[t+i+4>>>2>>>0]=g[1],g=[(a+1)*280>>>0,(F=(a+1)*280,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[t+i+8>>>2>>>0]=g[0],c[t+i+12>>>2>>>0]=g[1],u[t+i+16>>>1>>>0]=280,s[t+i+18>>>0]=d,ej(f,t+i+19,256),i+=280,a+=1}return eN.llseek(r,280*a,0),i}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ioctl:function(e,t,n){eC.varargs=n>>>=0;try{var r=eC.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:if(!r.tty)return -59;return 0;case 21505:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),o=e_();c[o>>>2>>>0]=i.c_iflag||0,c[o+4>>>2>>>0]=i.c_oflag||0,c[o+8>>>2>>>0]=i.c_cflag||0,c[o+12>>>2>>>0]=i.c_lflag||0;for(var a=0;a<32;a++)s[o+a+17>>>0]=i.c_cc[a]||0}return 0;case 21506:case 21507:case 21508:if(!r.tty)return -59;if(r.tty.ops.ioctl_tcsets){for(var o=e_(),l=c[o>>>2>>>0],d=c[o+4>>>2>>>0],f=c[o+8>>>2>>>0],m=c[o+12>>>2>>>0],p=[],a=0;a<32;a++)p.push(s[o+a+17>>>0]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:l,c_oflag:d,c_cflag:f,c_lflag:m,c_cc:p})}return 0;case 21519:if(!r.tty)return -59;var o=e_();return c[o>>>2>>>0]=0,0;case 21520:if(!r.tty)return -59;return -28;case 21531:var o=e_();return eN.ioctl(r,t,o);case 21523:if(!r.tty)return -59;if(r.tty.ops.ioctl_tiocgwinsz){var h=r.tty.ops.ioctl_tiocgwinsz(r.tty),o=e_();u[o>>>1>>>0]=h[0],u[o+2>>>1>>>0]=h[1]}return 0;default:return -28}}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_lstat64:function(e,t){e>>>=0,t>>>=0;try{return e=eC.getStr(e),eC.doStat(eN.lstat,e,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_newfstatat:function(e,t,n,r){t>>>=0,n>>>=0;try{t=eC.getStr(t);var i=256&r,o=4096&r;return r&=-6401,M(!r,`unknown flags in __syscall_newfstatat: ${r}`),t=eC.calculateAt(e,t,o),eC.doStat(i?eN.lstat:eN.stat,t,n)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_openat:function(e,t,n,r){t>>>=0,eC.varargs=r>>>=0;try{t=eC.getStr(t),t=eC.calculateAt(e,t);var i=r?e_():0;return eN.open(t,n,i).fd}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_rmdir:function(e){e>>>=0;try{return e=eC.getStr(e),eN.rmdir(e),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_stat64:function(e,t){e>>>=0,t>>>=0;try{return e=eC.getStr(e),eC.doStat(eN.stat,e,t)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_unlinkat:function(e,t,n){t>>>=0;try{return t=eC.getStr(t),t=eC.calculateAt(e,t),0===n?eN.unlink(t):512===n?eN.rmdir(t):J("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_abort_js:()=>{J("native code called abort()")},_emscripten_get_now_is_monotonic:()=>1,_emscripten_memcpy_js:function(e,t,n){return e>>>=0,t>>>=0,n>>>=0,l.copyWithin(e>>>0,t>>>0,t+n>>>0)},_emscripten_throw_longjmp:()=>{throw 1/0},_gmtime_js:function(e,t,n){var r=ep(e,t);n>>>=0;var i=new Date(1e3*r);c[n>>>2>>>0]=i.getUTCSeconds(),c[n+4>>>2>>>0]=i.getUTCMinutes(),c[n+8>>>2>>>0]=i.getUTCHours(),c[n+12>>>2>>>0]=i.getUTCDate(),c[n+16>>>2>>>0]=i.getUTCMonth(),c[n+20>>>2>>>0]=i.getUTCFullYear()-1900,c[n+24>>>2>>>0]=i.getUTCDay();var o=Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0),a=(i.getTime()-o)/864e5|0;c[n+28>>>2>>>0]=a},_localtime_js:function(e,t,n){let r;var i=ep(e,t);n>>>=0;var o=new Date(1e3*i);c[n>>>2>>>0]=o.getSeconds(),c[n+4>>>2>>>0]=o.getMinutes(),c[n+8>>>2>>>0]=o.getHours(),c[n+12>>>2>>>0]=o.getDate(),c[n+16>>>2>>>0]=o.getMonth(),c[n+20>>>2>>>0]=o.getFullYear()-1900,c[n+24>>>2>>>0]=o.getDay();var a=0|((r=o.getFullYear())%4==0&&(r%100!=0||r%400==0)?eM:eR)[o.getMonth()]+o.getDate()-1;c[n+28>>>2>>>0]=a,c[n+36>>>2>>>0]=-(60*o.getTimezoneOffset());var s=new Date(o.getFullYear(),0,1),l=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=s.getTimezoneOffset(),d=0|(l!=u&&o.getTimezoneOffset()==Math.min(u,l));c[n+32>>>2>>>0]=d},_mmap_js:function(e,t,n,r,i,o,a,s){e>>>=0;var l=ep(i,o);a>>>=0,s>>>=0;try{if(isNaN(l))return 61;var u=eC.getStreamFromFD(r),d=eN.mmap(u,e,l,t,n),m=d.ptr;return c[a>>>2>>>0]=d.allocated,f[s>>>2>>>0]=m,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_munmap_js:function(e,t,n,r,i,o,a){e>>>=0,t>>>=0;var s=ep(o,a);try{var l=eC.getStreamFromFD(i);2&n&&eC.doMsync(e,l,t,r,s)}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return-e.errno}},_tzset_js:function(e,t,n,r){e>>>=0,t>>>=0,n>>>=0,r>>>=0;var i=(new Date).getFullYear(),o=new Date(i,0,1),a=new Date(i,6,1),s=o.getTimezoneOffset(),l=a.getTimezoneOffset(),u=Math.max(s,l);f[e>>>2>>>0]=60*u,c[t>>>2>>>0]=Number(s!=l);var d=e=>{var t=Math.abs(e),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");return`UTC${e>=0?"-":"+"}${n}${r}`},m=d(s),p=d(l);M(m),M(p),M(16>=ew(m),`timezone name truncated to fit in TZNAME_MAX (${m})`),M(16>=ew(p),`timezone name truncated to fit in TZNAME_MAX (${p})`),lDate.now(),emscripten_err:function(e){return e>>>=0,N(eg(e))},emscripten_get_now:()=>performance.now(),emscripten_resize_heap:function(e){e>>>=0;var t=l.length;M(e>t);if(e>0xffff0000)return N(`Cannot enlarge memory, requested ${e} bytes, but the limit is 4294901760 bytes!`),!1;for(var n=1;n<=4;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+0x6000000);var i=Math.min(0xffff0000,eS(Math.max(e,r),65536));if(eT(i))return!0}return N(`Failed to grow the heap from ${t} bytes to ${i} bytes, not enough memory!`),!1},environ_get:function(e,t){e>>>=0,t>>>=0;var n=0;return eL().forEach((r,i)=>{var o=t+n;f[e+4*i>>>2>>>0]=o;for(var a=o,l=0;l>>0]=r.charCodeAt(l);s[a>>>0]=0,n+=r.length+1}),0},environ_sizes_get:function(e,t){e>>>=0,t>>>=0;var n=eL();f[e>>>2>>>0]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),f[t>>>2>>>0]=r,0},exit:(e,n)=>{if(function(){var e=I,t=N,n=!1;I=N=e=>{n=!0};try{eJ(0),["stdout","stderr"].forEach(e=>{var t=eN.analyzePath("/dev/"+e);if(t){var r=t.object.rdev,i=ev.ttys[r];i?.output?.length&&(n=!0)}})}catch{}I=e,N=t,n&&em("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}(),(ed||0)&&!n){var i=`program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=0) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;r(i),N(i)}throw ed||(t.onExit?.(e),j=!0),new el(e)},fd_close:function(e){try{var t=eC.getStreamFromFD(e);return eN.close(t),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_read:function(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=eC.getStreamFromFD(e),o=((e,t,n,r)=>{for(var i=0,o=0;o>>2>>>0],l=f[t+4>>>2>>>0];t+=8;var u=eN.read(e,s,a,l,r);if(u<0)return -1;if(i+=u,u>>2>>>0]=o,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_seek:function(e,t,n,r,i){var o=ep(t,n);i>>>=0;try{if(isNaN(o))return 61;var a=eC.getStreamFromFD(e);return eN.llseek(a,o,r),g=[a.position>>>0,(F=a.position,+Math.abs(F)>=1?F>0?Math.floor(F/0x100000000)>>>0:~~Math.ceil((F-(~~F>>>0))/0x100000000)>>>0:0)],c[i>>>2>>>0]=g[0],c[i+4>>>2>>>0]=g[1],a.getdents&&0===o&&0===r&&(a.getdents=null),0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_sync:function(e){try{var t=eC.getStreamFromFD(e);if(t.stream_ops?.fsync)return t.stream_ops.fsync(t);return 0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},fd_write:function(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=eC.getStreamFromFD(e),o=((e,t,n,r)=>{for(var i=0,o=0;o>>2>>>0],l=f[t+4>>>2>>>0];t+=8;var u=eN.write(e,s,a,l,r);if(u<0)return -1;if(i+=u,u>>2>>>0]=o,0}catch(e){if(void 0===eN||"ErrnoError"!==e.name)throw e;return e.errno}},invoke_ii:function(e,t){var n=ef();try{return ez(e)(t)}catch(e){if(e3(n),e!==e+0)throw e;eY(1,0)}},invoke_iii:function(e,t,n){var r=ef();try{return ez(e)(t,n)}catch(e){if(e3(r),e!==e+0)throw e;eY(1,0)}},invoke_iiii:function(e,t,n,r){var i=ef();try{return ez(e)(t,n,r)}catch(e){if(e3(i),e!==e+0)throw e;eY(1,0)}},invoke_iiiii:function(e,t,n,r,i){var o=ef();try{return ez(e)(t,n,r,i)}catch(e){if(e3(o),e!==e+0)throw e;eY(1,0)}},invoke_iiiiii:function(e,t,n,r,i,o){var a=ef();try{return ez(e)(t,n,r,i,o)}catch(e){if(e3(a),e!==e+0)throw e;eY(1,0)}},invoke_iiiiiii:function(e,t,n,r,i,o,a){var s=ef();try{return ez(e)(t,n,r,i,o,a)}catch(e){if(e3(s),e!==e+0)throw e;eY(1,0)}},invoke_v:function(e){var t=ef();try{ez(e)()}catch(e){if(e3(t),e!==e+0)throw e;eY(1,0)}},invoke_vi:function(e,t){var n=ef();try{ez(e)(t)}catch(e){if(e3(n),e!==e+0)throw e;eY(1,0)}},invoke_vii:function(e,t,n){var r=ef();try{ez(e)(t,n)}catch(e){if(e3(r),e!==e+0)throw e;eY(1,0)}},invoke_viii:function(e,t,n,r){var i=ef();try{ez(e)(t,n,r)}catch(e){if(e3(i),e!==e+0)throw e;eY(1,0)}},invoke_viiii:function(e,t,n,r,i){var o=ef();try{ez(e)(t,n,r,i)}catch(e){if(e3(o),e!==e+0)throw e;eY(1,0)}},invoke_viiiiiiiii:function(e,t,n,r,i,o,a,s,l,u){var d=ef();try{ez(e)(t,n,r,i,o,a,s,l,u)}catch(e){if(e3(d),e!==e+0)throw e;eY(1,0)}}},eZ=function(){function e(e,n){var r,i,o,s;let l,u;return i=Object.assign({},i=eZ=e.exports),o=e=>t=>e(t)>>>0,s=e=>()=>e()>>>0,i.strerror=(l=i.strerror,e=>l(e)>>>0),i.emscripten_builtin_memalign=(u=i.emscripten_builtin_memalign,(e,t)=>u(e,t)>>>0),i.malloc=o(i.malloc),i.emscripten_stack_get_base=s(i.emscripten_stack_get_base),i.emscripten_stack_get_end=s(i.emscripten_stack_get_end),i._emscripten_stack_alloc=o(i._emscripten_stack_alloc),i.emscripten_stack_get_current=s(i.emscripten_stack_get_current),t.wasmExports=eZ=i,M(a=eZ.memory,"memory not found in wasm exports"),R(),M(_=eZ.__indirect_function_table,"table not found in wasm exports"),r=eZ.__wasm_call_ctors,L.unshift(r),Z("wasm-instantiate"),eZ}K("wasm-instantiate");var n,i,o=t,s={env:eK,wasi_snapshot_preview1:eK};if(t.instantiateWasm)try{return t.instantiateWasm(s,e)}catch(e){N(`Module.instantiateWasm callback failed with error: ${e}`),r(e)}return h??(h=function(){if(t.locateFile){var e="embedpdf.wasm";return e.startsWith("data:application/octet-stream;base64,")?e:t.locateFile?t.locateFile(e,O):O+e}return new URL("embedpdf.wasm",self.location.href).href}()),(n=h,i=function(n){M(t===o,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),o=null,e(n.instance)},!C&&"function"==typeof WebAssembly.instantiateStreaming&&!n.startsWith("data:application/octet-stream;base64,")&&"function"==typeof fetch?fetch(n,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,s).then(i,function(e){return N(`wasm streaming compile failed: ${e}`),N("falling back to ArrayBuffer instantiation"),ee(n,s,i)})):ee(n,s,i)).catch(r),{}}();X("__wasm_call_ctors",0),t._EPDFAction_CloseModel=X("EPDFAction_CloseModel",1),t._EPDFAction_LoadModel=X("EPDFAction_LoadModel",1),t._EPDFAction_GetRootNode=X("EPDFAction_GetRootNode",1),t._EPDFAction_GetNodeCount=X("EPDFAction_GetNodeCount",1),t._EPDFAction_GetNodeType=X("EPDFAction_GetNodeType",2),t._EPDFAction_GetNodeSubtype=X("EPDFAction_GetNodeSubtype",4),t._EPDFAction_NodeHasJavaScript=X("EPDFAction_NodeHasJavaScript",2),t._EPDFAction_GetNodeJavaScript=X("EPDFAction_GetNodeJavaScript",4),t._EPDFAction_GetNodeDest=X("EPDFAction_GetNodeDest",3),t._EPDFAction_GetNodeURI=X("EPDFAction_GetNodeURI",5),t._EPDFAction_GetNodeFilePath=X("EPDFAction_GetNodeFilePath",4),t._EPDFAction_GetNodeName=X("EPDFAction_GetNodeName",4),t._EPDFAction_GetNodeTargetCount=X("EPDFAction_GetNodeTargetCount",2),t._EPDFAction_GetNodeTargetName=X("EPDFAction_GetNodeTargetName",5),t._EPDFAction_GetNodeTargetObjectNumber=X("EPDFAction_GetNodeTargetObjectNumber",4),t._EPDFAction_GetNodeHideFlag=X("EPDFAction_GetNodeHideFlag",3),t._EPDFAction_GetNodeResetForm=X("EPDFAction_GetNodeResetForm",4),t._EPDFAction_GetNodeSubmitForm=X("EPDFAction_GetNodeSubmitForm",4),t._EPDFAction_GetNodeSubmitFormURL=X("EPDFAction_GetNodeSubmitFormURL",4),t._EPDFAction_GetNodeSubmitFormCharSet=X("EPDFAction_GetNodeSubmitFormCharSet",4),t._EPDFAction_GetNodeURIIsMap=X("EPDFAction_GetNodeURIIsMap",3),t._EPDFAction_GetNextCount=X("EPDFAction_GetNextCount",2),t._EPDFAction_GetNextAt=X("EPDFAction_GetNextAt",3),t._EPDFAction_GetWarningFlags=X("EPDFAction_GetWarningFlags",1),t._EPDFAction_IsComplete=X("EPDFAction_IsComplete",1),t._EPDFDoc_GetOpenActionModel=X("EPDFDoc_GetOpenActionModel",1),t._EPDFDoc_GetOpenActionDest=X("EPDFDoc_GetOpenActionDest",1),t._EPDFDoc_GetAdditionalActionModel=X("EPDFDoc_GetAdditionalActionModel",2),t._EPDFDoc_GetPageActionModel=X("EPDFDoc_GetPageActionModel",3),t._EPDFAnnot_GetActionModel=X("EPDFAnnot_GetActionModel",2),t._EPDFAction_CreateJavaScript=X("EPDFAction_CreateJavaScript",2),t._EPDFAction_CreateHide=X("EPDFAction_CreateHide",4),t._EPDFAction_CreateResetForm=X("EPDFAction_CreateResetForm",4),t._EPDFAction_CreateSubmitForm=X("EPDFAction_CreateSubmitForm",5),t._EPDFAction_SetNext=X("EPDFAction_SetNext",4),t._EPDFAnnot_SetEventAction=X("EPDFAnnot_SetEventAction",3),t._EPDFAnnot_SetNumberValue=X("EPDFAnnot_SetNumberValue",3),t._EPDFAnnot_HasEmbedMetadata=X("EPDFAnnot_HasEmbedMetadata",1),t._EPDFAnnot_ClearEmbedMetadata=X("EPDFAnnot_ClearEmbedMetadata",1),t._EPDFAnnot_ClearEmbedMetadataKey=X("EPDFAnnot_ClearEmbedMetadataKey",2),t._EPDFAnnot_SetEmbedMetadataString=X("EPDFAnnot_SetEmbedMetadataString",3),t._EPDFAnnot_GetEmbedMetadataString=X("EPDFAnnot_GetEmbedMetadataString",4),t._EPDFAnnot_SetEmbedMetadataNumber=X("EPDFAnnot_SetEmbedMetadataNumber",3),t._EPDFAnnot_GetEmbedMetadataNumber=X("EPDFAnnot_GetEmbedMetadataNumber",3),t._EPDFAnnot_SetEmbedMetadataBoolean=X("EPDFAnnot_SetEmbedMetadataBoolean",3),t._EPDFAnnot_GetEmbedMetadataBoolean=X("EPDFAnnot_GetEmbedMetadataBoolean",3),t._EPDFAnnot_SetEmbedMetadataRect=X("EPDFAnnot_SetEmbedMetadataRect",3),t._EPDFAnnot_GetEmbedMetadataRect=X("EPDFAnnot_GetEmbedMetadataRect",3),t._EPDFAnnot_SetEmbedMetadataJSON=X("EPDFAnnot_SetEmbedMetadataJSON",2),t._EPDFAnnot_GetEmbedMetadataJSON=X("EPDFAnnot_GetEmbedMetadataJSON",3),t._EPDFDocument_ClearEmbedMetadata=X("EPDFDocument_ClearEmbedMetadata",1),t._EPDFAnnot_SetAction=X("EPDFAnnot_SetAction",2),t._EPDFAnnot_RemoveAction=X("EPDFAnnot_RemoveAction",1),t._EPDFAnnot_RemoveDest=X("EPDFAnnot_RemoveDest",1),t._EPDFAnnot_RemoveKey=X("EPDFAnnot_RemoveKey",2),t._EPDFAnnot_GetFileAttachmentForWrite=X("EPDFAnnot_GetFileAttachmentForWrite",1),t._EPDFAnnot_SetColor=X("EPDFAnnot_SetColor",5),t._EPDFAnnot_GetColor=X("EPDFAnnot_GetColor",5),t._EPDFAnnot_ClearColor=X("EPDFAnnot_ClearColor",2),t._EPDFAnnot_SetNoColor=X("EPDFAnnot_SetNoColor",2),t._EPDFAnnot_SetOpacity=X("EPDFAnnot_SetOpacity",2),t._EPDFAnnot_GetOpacity=X("EPDFAnnot_GetOpacity",2),t._EPDFAnnot_GetBorderEffect=X("EPDFAnnot_GetBorderEffect",2),t._EPDFAnnot_SetBorderEffect=X("EPDFAnnot_SetBorderEffect",2),t._EPDFAnnot_ClearBorderEffect=X("EPDFAnnot_ClearBorderEffect",1),t._EPDFAnnot_GetRectangleDifferences=X("EPDFAnnot_GetRectangleDifferences",5),t._EPDFAnnot_ClearRectangleDifferences=X("EPDFAnnot_ClearRectangleDifferences",1),t._EPDFAnnot_GetBorderDashPatternCount=X("EPDFAnnot_GetBorderDashPatternCount",1),t._EPDFAnnot_GetBorderDashPattern=X("EPDFAnnot_GetBorderDashPattern",3),t._EPDFAnnot_SetBorderDashPattern=X("EPDFAnnot_SetBorderDashPattern",3),t._EPDFAnnot_GetBorderStyle=X("EPDFAnnot_GetBorderStyle",2),t._EPDFAnnot_SetBorderStyle=X("EPDFAnnot_SetBorderStyle",3),t._EPDFAnnot_GenerateAppearance=X("EPDFAnnot_GenerateAppearance",1),t._EPDFAnnot_GenerateAppearanceWithBlend=X("EPDFAnnot_GenerateAppearanceWithBlend",2),t._EPDFAnnot_GetBlendMode=X("EPDFAnnot_GetBlendMode",1),t._EPDFAnnot_SetIntent=X("EPDFAnnot_SetIntent",2),t._EPDFAnnot_GetIntent=X("EPDFAnnot_GetIntent",3),t._EPDFAnnot_GetRichContent=X("EPDFAnnot_GetRichContent",3),t._EPDFAnnot_GetRichTextJSON=X("EPDFAnnot_GetRichTextJSON",3),t._EPDFAnnot_SetRichTextJSON=X("EPDFAnnot_SetRichTextJSON",2),t._EPDFAnnot_SetRichTextXHTML=X("EPDFAnnot_SetRichTextXHTML",2),t._EPDFDoc_SetTypographicFeatures=X("EPDFDoc_SetTypographicFeatures",2),t._EPDFDoc_GetTypographicFeatures=X("EPDFDoc_GetTypographicFeatures",1),t._EPDFAnnot_SetLineEndings=X("EPDFAnnot_SetLineEndings",3),t._EPDFAnnot_GetLineEndings=X("EPDFAnnot_GetLineEndings",3),t._EPDFAnnot_SetVertices=X("EPDFAnnot_SetVertices",3),t._EPDFAnnot_SetLine=X("EPDFAnnot_SetLine",3),t._EPDFAnnot_SetDefaultAppearance=X("EPDFAnnot_SetDefaultAppearance",6),t._EPDFAnnot_SetDefaultAppearanceRegisteredFont=X("EPDFAnnot_SetDefaultAppearanceRegisteredFont",6),t._EPDFAnnot_GetDefaultAppearance=X("EPDFAnnot_GetDefaultAppearance",6),t._EPDFAnnot_GetDefaultAppearanceFontFace=X("EPDFAnnot_GetDefaultAppearanceFontFace",5),t._EPDFAnnot_GetDefaultAppearanceFontPostScriptName=X("EPDFAnnot_GetDefaultAppearanceFontPostScriptName",3),t._EPDFAnnot_SetDefaultAppearanceDocumentFont=X("EPDFAnnot_SetDefaultAppearanceDocumentFont",6),t._EPDFAnnot_SetTextAlignment=X("EPDFAnnot_SetTextAlignment",2),t._EPDFAnnot_GetTextAlignment=X("EPDFAnnot_GetTextAlignment",1),t._EPDFPage_GetAnnotByName=X("EPDFPage_GetAnnotByName",2),t._EPDFPage_RemoveAnnotByName=X("EPDFPage_RemoveAnnotByName",2),t._EPDFAnnot_SetLinkedAnnot=X("EPDFAnnot_SetLinkedAnnot",3),t._EPDFPage_GetAnnotIndexByNameRaw=X("EPDFPage_GetAnnotIndexByNameRaw",3),t._EPDFPage_GetAnnotIndexByObjectNumberRaw=X("EPDFPage_GetAnnotIndexByObjectNumberRaw",3),t._EPDFPage_GetAnnotCountRaw=X("EPDFPage_GetAnnotCountRaw",2),t._EPDFPage_GetAnnotRaw=X("EPDFPage_GetAnnotRaw",3),t._EPDFPage_CreateAnnotRaw=X("EPDFPage_CreateAnnotRaw",4),t._EPDFPage_RemoveAnnotRaw=X("EPDFPage_RemoveAnnotRaw",3),t._EPDFPage_PromoteInlineAnnotsRaw=X("EPDFPage_PromoteInlineAnnotsRaw",2),t._EPDFAnnot_IsValid=X("EPDFAnnot_IsValid",1),t._EPDFAnnot_SetSubtype=X("EPDFAnnot_SetSubtype",2),t._EPDFAnnot_SetName=X("EPDFAnnot_SetName",2),t._EPDFAnnot_GetName=X("EPDFAnnot_GetName",3),t._EPDFAnnot_UpdateAppearanceToRect=X("EPDFAnnot_UpdateAppearanceToRect",2),t._EPDFAnnot_SetStampOpacity=X("EPDFAnnot_SetStampOpacity",3),t._EPDFPage_CreateAnnot=X("EPDFPage_CreateAnnot",2),t._EPDFAnnot_SetRotate=X("EPDFAnnot_SetRotate",2),t._EPDFAnnot_GetRotate=X("EPDFAnnot_GetRotate",2),t._EPDFAnnot_GetAppearanceTransform=X("EPDFAnnot_GetAppearanceTransform",3),t._EPDFAnnot_GetReplyType=X("EPDFAnnot_GetReplyType",1),t._EPDFAnnot_SetReplyType=X("EPDFAnnot_SetReplyType",2),t._EPDFAnnot_GetBooleanValue=X("EPDFAnnot_GetBooleanValue",3),t._EPDFAnnot_SetBooleanValue=X("EPDFAnnot_SetBooleanValue",3),t._EPDFAnnot_SetOverlayText=X("EPDFAnnot_SetOverlayText",2),t._EPDFAnnot_GetOverlayText=X("EPDFAnnot_GetOverlayText",3),t._EPDFAnnot_SetOverlayTextRepeat=X("EPDFAnnot_SetOverlayTextRepeat",2),t._EPDFAnnot_GetOverlayTextRepeat=X("EPDFAnnot_GetOverlayTextRepeat",1),t._EPDFAnnot_SetAppearanceFromPage=X("EPDFAnnot_SetAppearanceFromPage",3),t._EPDFAnnot_ExportAppearance=X("EPDFAnnot_ExportAppearance",3),t._EPDFDoc_CanonicalDrawing=X("EPDFDoc_CanonicalDrawing",2),t._EPDFDoc_ImportDrawing=X("EPDFDoc_ImportDrawing",2),t._EPDFDoc_ExportDrawing=X("EPDFDoc_ExportDrawing",2),t._EPDFDoc_GetDrawings=X("EPDFDoc_GetDrawings",3),t._EPDFAnnot_SetDrawing=X("EPDFAnnot_SetDrawing",3),t._EPDFAnnot_GetDrawing=X("EPDFAnnot_GetDrawing",1),t._EPDFAnnot_GetRect=X("EPDFAnnot_GetRect",2),t._EPDFAnnot_SetRect=X("EPDFAnnot_SetRect",2),t._EPDFAnnot_SetAPMatrix=X("EPDFAnnot_SetAPMatrix",3),t._EPDFAnnot_GetAPMatrix=X("EPDFAnnot_GetAPMatrix",3),t._EPDFAnnot_GetAvailableAppearanceModes=X("EPDFAnnot_GetAvailableAppearanceModes",1),t._EPDFAnnot_GetAppearanceStateCount=X("EPDFAnnot_GetAppearanceStateCount",2),t._EPDFAnnot_GetAppearanceStateName=X("EPDFAnnot_GetAppearanceStateName",5),t._EPDFAnnot_GetAppearanceState=X("EPDFAnnot_GetAppearanceState",3),t._EPDFAnnot_HasAppearanceStream=X("EPDFAnnot_HasAppearanceStream",2),t._EPDFAnnot_GetDrawingRect=X("EPDFAnnot_GetDrawingRect",3),t._EPDFAnnot_SetMKColor=X("EPDFAnnot_SetMKColor",5),t._EPDFAnnot_GetMKColor=X("EPDFAnnot_GetMKColor",5),t._EPDFAnnot_ClearMKColor=X("EPDFAnnot_ClearMKColor",2),t._EPDFAnnot_SetMKText=X("EPDFAnnot_SetMKText",3),t._EPDFAnnot_GetMKText=X("EPDFAnnot_GetMKText",4),t._EPDFAnnot_SetMKTextPosition=X("EPDFAnnot_SetMKTextPosition",2),t._EPDFAnnot_GetMKTextPosition=X("EPDFAnnot_GetMKTextPosition",1),t._EPDFAnnot_SetMKIcon=X("EPDFAnnot_SetMKIcon",3),t._EPDFAnnot_GetMKIcon=X("EPDFAnnot_GetMKIcon",2),t._EPDFAnnot_ClearMKIcon=X("EPDFAnnot_ClearMKIcon",2),t._EPDFAnnot_HasMKIcon=X("EPDFAnnot_HasMKIcon",2),t._EPDFAnnot_SetMKRotation=X("EPDFAnnot_SetMKRotation",2),t._EPDFAnnot_GetMKRotation=X("EPDFAnnot_GetMKRotation",1),t._EPDFAnnot_GenerateFormFieldAP=X("EPDFAnnot_GenerateFormFieldAP",1),t._EPDFAnnot_GetCalloutLineCount=X("EPDFAnnot_GetCalloutLineCount",1),t._EPDFAnnot_GetCalloutLine=X("EPDFAnnot_GetCalloutLine",3),t._EPDFAnnot_SetCalloutLine=X("EPDFAnnot_SetCalloutLine",3),t._EPDFAnnot_GetObjectNumber=X("EPDFAnnot_GetObjectNumber",1),t._EPDFAnnot_GetStructurePosition=X("EPDFAnnot_GetStructurePosition",3),t._EPDFPage_GetAnnotByObjectNumber=X("EPDFPage_GetAnnotByObjectNumber",2),t._EPDFPage_RemoveAnnot=X("EPDFPage_RemoveAnnot",2),t._EPDFPage_RemoveAnnotByObjectNumber=X("EPDFPage_RemoveAnnotByObjectNumber",2),t._EPDFPage_MoveAnnots=X("EPDFPage_MoveAnnots",4),t._EPDFPage_MoveAnnotsRaw=X("EPDFPage_MoveAnnotsRaw",5),t._EPDF_LoadBaseDocument=X("EPDF_LoadBaseDocument",2),t._EPDF_LoadMemBaseDocument=X("EPDF_LoadMemBaseDocument",3),t._EPDF_LoadMemBaseDocument64=X("EPDF_LoadMemBaseDocument64",3),t._EPDF_ReleaseBaseDocument=X("EPDF_ReleaseBaseDocument",1),t._EPDFPage_ExportAnnotsRawToOwnedBuffer=X("EPDFPage_ExportAnnotsRawToOwnedBuffer",5),t._EPDFPage_ImportAnnotsRaw=X("EPDFPage_ImportAnnotsRaw",4),t._EPDFDoc_ExportDictRawToOwnedBuffer=X("EPDFDoc_ExportDictRawToOwnedBuffer",4),t._EPDFDoc_ExportDictCanonicalToOwnedBuffer=X("EPDFDoc_ExportDictCanonicalToOwnedBuffer",5),t._EPDFDoc_ImportDictRaw=X("EPDFDoc_ImportDictRaw",3),t._EPDFForm_ExportFieldRawToOwnedBuffer=X("EPDFForm_ExportFieldRawToOwnedBuffer",3),t._EPDFForm_ImportFieldRaw=X("EPDFForm_ImportFieldRaw",3),t._EPDFOutline_ExportItemRawToOwnedBuffer=X("EPDFOutline_ExportItemRawToOwnedBuffer",3),t._EPDFOutline_ImportItemRaw=X("EPDFOutline_ImportItemRaw",3),t._EPDFPage_ExportRawToOwnedBuffer=X("EPDFPage_ExportRawToOwnedBuffer",3),t._EPDFPage_ImportRaw=X("EPDFPage_ImportRaw",3),t._EPDFAttachment_ExportRawToOwnedBuffer=X("EPDFAttachment_ExportRawToOwnedBuffer",3),t._EPDFAttachment_ExportCanonicalToOwnedBuffer=X("EPDFAttachment_ExportCanonicalToOwnedBuffer",3),t._EPDFAttachment_ImportRaw=X("EPDFAttachment_ImportRaw",3),t._EPDFCatalog_GetMetadata=X("EPDFCatalog_GetMetadata",3),t._EPDFCatalog_SetMetadata=X("EPDFCatalog_SetMetadata",3),t._EPDFFont_RegisterFont=X("EPDFFont_RegisterFont",4),t._EPDFFont_RegisterMemFont=X("EPDFFont_RegisterMemFont",5),t._EPDFFont_RegisterMemFont64=X("EPDFFont_RegisterMemFont64",5),t._EPDFFont_ClearRegisteredFonts=X("EPDFFont_ClearRegisteredFonts",0),t._EPDFFont_GetEmbeddingPermission=X("EPDFFont_GetEmbeddingPermission",1),t._EPDFFont_IsEditingAuthorized=X("EPDFFont_IsEditingAuthorized",1),t._EPDFFont_AuthorizeEditing=X("EPDFFont_AuthorizeEditing",1),t._EPDFFont_IsInstanced=X("EPDFFont_IsInstanced",1),t._EPDFFont_GetFamilyName=X("EPDFFont_GetFamilyName",3),t._EPDFFont_GetWeight=X("EPDFFont_GetWeight",1),t._EPDFFont_IsItalic=X("EPDFFont_IsItalic",1),t._EPDFDoc_SetFontEmbeddingPolicy=X("EPDFDoc_SetFontEmbeddingPolicy",2),t._EPDFDoc_GetFontEmbeddingPolicy=X("EPDFDoc_GetFontEmbeddingPolicy",1),t._EPDFFont_AddFallbackFont=X("EPDFFont_AddFallbackFont",2),t._EPDFFont_ClearFallbackFonts=X("EPDFFont_ClearFallbackFonts",0),t._EPDFFont_SetLastResortFont=X("EPDFFont_SetLastResortFont",1),t._EPDFFont_GetLastResortFont=X("EPDFFont_GetLastResortFont",0),t._EPDFFont_GetFallbackOrder=X("EPDFFont_GetFallbackOrder",4),t._EPDFFont_GetProgramData=X("EPDFFont_GetProgramData",3),t._EPDFFont_GetProgramFormat=X("EPDFFont_GetProgramFormat",1),t._EPDFFont_GetProgramHash=X("EPDFFont_GetProgramHash",2),t._EPDFFont_GetCoverage=X("EPDFFont_GetCoverage",3),t._EPDFFont_GetMetrics=X("EPDFFont_GetMetrics",3),t._EPDFFont_GetPostScriptName=X("EPDFFont_GetPostScriptName",3),t._EPDFFontFaces_Load=X("EPDFFontFaces_Load",1),t._EPDFFontFaces_Close=X("EPDFFontFaces_Close",1),t._EPDFDoc_GetFontsFingerprint=X("EPDFDoc_GetFontsFingerprint",2),t._EPDFFontFaces_Count=X("EPDFFontFaces_Count",1),t._EPDFFontFaces_GetFamily=X("EPDFFontFaces_GetFamily",4),t._EPDFFontFaces_GetWeight=X("EPDFFontFaces_GetWeight",2),t._EPDFFontFaces_IsItalic=X("EPDFFontFaces_IsItalic",2),t._EPDFFontFaces_CountPrograms=X("EPDFFontFaces_CountPrograms",2),t._EPDFFontFaces_GetProgramObjNum=X("EPDFFontFaces_GetProgramObjNum",3),t._EPDFFontFaces_GetProgramFormat=X("EPDFFontFaces_GetProgramFormat",3),t._EPDFFontFaces_GetProgramEmbedded=X("EPDFFontFaces_GetProgramEmbedded",3),t._EPDFFontFaces_GetProgramPostScriptName=X("EPDFFontFaces_GetProgramPostScriptName",5),t._EPDFFontFaces_GetProgramEmbeddingPermission=X("EPDFFontFaces_GetProgramEmbeddingPermission",3),t._EPDFFontFaces_ProgramMapsUnicode=X("EPDFFontFaces_ProgramMapsUnicode",3),t._EPDFFontFaces_GetProgramHash=X("EPDFFontFaces_GetProgramHash",4),t._EPDFFontFaces_GetProgramDisplayHash=X("EPDFFontFaces_GetProgramDisplayHash",4),t._EPDFFontFaces_GetProgramMetrics=X("EPDFFontFaces_GetProgramMetrics",5),t._EPDFDoc_GetFontProgramData=X("EPDFDoc_GetFontProgramData",4),t._EPDFDoc_GetFontDisplayProgramData=X("EPDFDoc_GetFontDisplayProgramData",4),t._EPDFDoc_GetFontDisplayProgramCoverage=X("EPDFDoc_GetFontDisplayProgramCoverage",4),t._EPDFDoc_ResolveFonts=X("EPDFDoc_ResolveFonts",8),t._EPDFFontResolution_Close=X("EPDFFontResolution_Close",1),t._EPDFFontResolution_GetSource=X("EPDFFontResolution_GetSource",2),t._EPDFFontResolution_GetRegisteredFont=X("EPDFFontResolution_GetRegisteredFont",2),t._EPDFFontResolution_GetProgramObjNum=X("EPDFFontResolution_GetProgramObjNum",2),t._EPDFFontResolution_GetProgramDisplayHash=X("EPDFFontResolution_GetProgramDisplayHash",3),t._EPDFFontResolution_GetBaseFontName=X("EPDFFontResolution_GetBaseFontName",4),t._EPDFFontResolution_GetFamily=X("EPDFFontResolution_GetFamily",4),t._EPDFFontResolution_GetWeight=X("EPDFFontResolution_GetWeight",2),t._EPDFFontResolution_IsItalic=X("EPDFFontResolution_IsItalic",2),t._EPDFFontResolution_IsDegraded=X("EPDFFontResolution_IsDegraded",2),t._EPDFFontResolution_GetFallbacks=X("EPDFFontResolution_GetFallbacks",4),t._EPDFFontResolution_CountMissingCharacters=X("EPDFFontResolution_CountMissingCharacters",1),t._EPDFFontResolution_GetMissingCharacter=X("EPDFFontResolution_GetMissingCharacter",4),t._EPDFDoc_ClearMissingCharacters=X("EPDFDoc_ClearMissingCharacters",1),t._EPDFDoc_CountMissingCharacters=X("EPDFDoc_CountMissingCharacters",1),t._EPDFDoc_GetMissingCharacter=X("EPDFDoc_GetMissingCharacter",4),t._EPDFForm_LoadModel=X("EPDFForm_LoadModel",1),t._EPDFForm_CloseModel=X("EPDFForm_CloseModel",1),t._EPDFForm_GetFormKind=X("EPDFForm_GetFormKind",1),t._EPDFForm_GetNeedAppearances=X("EPDFForm_GetNeedAppearances",1),t._EPDFForm_CountFields=X("EPDFForm_CountFields",1),t._EPDFForm_GetFieldActionModel=X("EPDFForm_GetFieldActionModel",3),t._EPDFForm_CountCalculationOrder=X("EPDFForm_CountCalculationOrder",1),t._EPDFForm_GetCalculationOrderFieldIndex=X("EPDFForm_GetCalculationOrderFieldIndex",2),t._EPDFForm_GetFieldObjNum=X("EPDFForm_GetFieldObjNum",2),t._EPDFForm_GetFieldFamily=X("EPDFForm_GetFieldFamily",2),t._EPDFForm_GetFieldFlags=X("EPDFForm_GetFieldFlags",2),t._EPDFForm_GetFieldOrigin=X("EPDFForm_GetFieldOrigin",2),t._EPDFForm_GetFieldName=X("EPDFForm_GetFieldName",4),t._EPDFForm_GetFieldAlternateName=X("EPDFForm_GetFieldAlternateName",4),t._EPDFForm_GetFieldMappingName=X("EPDFForm_GetFieldMappingName",4),t._EPDFForm_HasFieldEmbedMetadata=X("EPDFForm_HasFieldEmbedMetadata",2),t._EPDFForm_HasFieldValuesList=X("EPDFForm_HasFieldValuesList",2),t._EPDFForm_GetFieldEmbedMetadataString=X("EPDFForm_GetFieldEmbedMetadataString",5),t._EPDFForm_GetFieldEmbedMetadataNumber=X("EPDFForm_GetFieldEmbedMetadataNumber",4),t._EPDFForm_GetFieldEmbedMetadataBoolean=X("EPDFForm_GetFieldEmbedMetadataBoolean",4),t._EPDFForm_GetFieldEmbedMetadataJSON=X("EPDFForm_GetFieldEmbedMetadataJSON",4),t._EPDFForm_GetFieldValueKind=X("EPDFForm_GetFieldValueKind",2),t._EPDFForm_CountFieldValues=X("EPDFForm_CountFieldValues",2),t._EPDFForm_GetFieldValueAt=X("EPDFForm_GetFieldValueAt",5),t._EPDFForm_GetFieldDefaultValueKind=X("EPDFForm_GetFieldDefaultValueKind",2),t._EPDFForm_CountFieldDefaultValues=X("EPDFForm_CountFieldDefaultValues",2),t._EPDFForm_GetFieldDefaultValueAt=X("EPDFForm_GetFieldDefaultValueAt",5),t._EPDFForm_GetFieldMaxLen=X("EPDFForm_GetFieldMaxLen",2),t._EPDFForm_GetFieldTopIndex=X("EPDFForm_GetFieldTopIndex",2),t._EPDFForm_CountFieldOptions=X("EPDFForm_CountFieldOptions",2),t._EPDFForm_GetFieldOptionLabel=X("EPDFForm_GetFieldOptionLabel",5),t._EPDFForm_GetFieldOptionValue=X("EPDFForm_GetFieldOptionValue",5),t._EPDFForm_IsFieldOptionSelected=X("EPDFForm_IsFieldOptionSelected",3),t._EPDFForm_CountFieldWidgets=X("EPDFForm_CountFieldWidgets",2),t._EPDFForm_GetFieldWidgetObjNum=X("EPDFForm_GetFieldWidgetObjNum",3),t._EPDFForm_GetFieldWidgetPageObjNum=X("EPDFForm_GetFieldWidgetPageObjNum",3),t._EPDFForm_GetFieldWidgetRect=X("EPDFForm_GetFieldWidgetRect",4),t._EPDFForm_GetFieldWidgetOnState=X("EPDFForm_GetFieldWidgetOnState",5),t._EPDFForm_GetFieldWidgetExportValue=X("EPDFForm_GetFieldWidgetExportValue",5),t._EPDFForm_IsFieldWidgetChecked=X("EPDFForm_IsFieldWidgetChecked",3),t._EPDFForm_GetFieldIndexByObjNum=X("EPDFForm_GetFieldIndexByObjNum",2),t._EPDFForm_GetFieldIndexForWidget=X("EPDFForm_GetFieldIndexForWidget",2),t._EPDFForm_SetFieldValue=X("EPDFForm_SetFieldValue",5),t._EPDFForm_SetFieldDefaultValue=X("EPDFForm_SetFieldDefaultValue",5),t._EPDFForm_SetFieldSelectedIndices=X("EPDFForm_SetFieldSelectedIndices",4),t._EPDFForm_SetFieldWidgetsChecked=X("EPDFForm_SetFieldWidgetsChecked",7),t._EPDFForm_RedrawFieldWidgets=X("EPDFForm_RedrawFieldWidgets",5),t._EPDFForm_SetFieldDisplay=X("EPDFForm_SetFieldDisplay",6),t._EPDFForm_SetFieldAppearanceText=X("EPDFForm_SetFieldAppearanceText",6),t._EPDFForm_ExportFDF=X("EPDFForm_ExportFDF",5),t._EPDFForm_ExportXFDF=X("EPDFForm_ExportXFDF",5),t._EPDFForm_Repair=X("EPDFForm_Repair",3),t._EPDFForm_CreateField=X("EPDFForm_CreateField",4),t._EPDFForm_AttachWidget=X("EPDFForm_AttachWidget",6),t._EPDFForm_DetachWidget=X("EPDFForm_DetachWidget",3),t._EPDFForm_DeleteField=X("EPDFForm_DeleteField",5),t._EPDFForm_SetFieldName=X("EPDFForm_SetFieldName",3),t._EPDFForm_GetFieldPartialName=X("EPDFForm_GetFieldPartialName",4),t._EPDFForm_SetFieldFlags=X("EPDFForm_SetFieldFlags",4),t._EPDFForm_SetFieldEventAction=X("EPDFForm_SetFieldEventAction",4),t._EPDFForm_SetCalculationOrder=X("EPDFForm_SetCalculationOrder",3),t._EPDFForm_SetFieldMaxLen=X("EPDFForm_SetFieldMaxLen",3),t._EPDFForm_SetFieldAlternateName=X("EPDFForm_SetFieldAlternateName",3),t._EPDFForm_SetFieldMappingName=X("EPDFForm_SetFieldMappingName",3),t._EPDFForm_SetFieldEmbedMetadataString=X("EPDFForm_SetFieldEmbedMetadataString",4),t._EPDFForm_SetFieldEmbedMetadataNumber=X("EPDFForm_SetFieldEmbedMetadataNumber",4),t._EPDFForm_SetFieldEmbedMetadataBoolean=X("EPDFForm_SetFieldEmbedMetadataBoolean",4),t._EPDFForm_SetFieldEmbedMetadataJSON=X("EPDFForm_SetFieldEmbedMetadataJSON",3),t._EPDFForm_ClearFieldEmbedMetadataKey=X("EPDFForm_ClearFieldEmbedMetadataKey",3),t._EPDFForm_ClearFieldEmbedMetadata=X("EPDFForm_ClearFieldEmbedMetadata",2),t._EPDFForm_SetFieldOptions=X("EPDFForm_SetFieldOptions",5),t._EPDFPage_Flatten=X("EPDFPage_Flatten",2),t._EPDFPage_FlattenAnnotations=X("EPDFPage_FlattenAnnotations",5),t._EPDFPage_ExportAnnotationsAsDocument=X("EPDFPage_ExportAnnotationsAsDocument",3),t._EPDFDoc_ExportPagesFlattened=X("EPDFDoc_ExportPagesFlattened",5),t._EPDFLayer_OpenLayer=X("EPDFLayer_OpenLayer",4),t._EPDFLayer_OpenLayerArtifact=X("EPDFLayer_OpenLayerArtifact",4),t._EPDFLayer_OpenLayerArtifactFromPath=X("EPDFLayer_OpenLayerArtifactFromPath",4),t._EPDFLayer_IsObjectPromoted=X("EPDFLayer_IsObjectPromoted",2),t._EPDFPage_IsValid=X("EPDFPage_IsValid",1),t._EPDFLayer_IsPagePromoted=X("EPDFLayer_IsPagePromoted",2),t._EPDFLayer_GetBirthObjectNumber=X("EPDFLayer_GetBirthObjectNumber",3),t._EPDFLayer_GetBirthName=X("EPDFLayer_GetBirthName",4),t._EPDFLayer_BeginTransaction=X("EPDFLayer_BeginTransaction",1),t._EPDFLayer_CommitTransaction=X("EPDFLayer_CommitTransaction",1),t._EPDFLayer_AbortTransaction=X("EPDFLayer_AbortTransaction",1),t._EPDFLayer_IsInTransaction=X("EPDFLayer_IsInTransaction",1),t._EPDFLayer_GetLastObjectNumber=X("EPDFLayer_GetLastObjectNumber",1),t._EPDFLayer_RaiseLastObjectNumber=X("EPDFLayer_RaiseLastObjectNumber",2),t._EPDFLayer_GetPromotedObjectCount=X("EPDFLayer_GetPromotedObjectCount",1),t._EPDFLayer_GetBaseDocument=X("EPDFLayer_GetBaseDocument",1),t._EPDF_SetBaseDocumentSha256=X("EPDF_SetBaseDocumentSha256",2),t._EPDFLayer_GetBaseSha256=X("EPDFLayer_GetBaseSha256",2),t._EPDFLayer_SaveDelta=X("EPDFLayer_SaveDelta",3),t._EPDFLayer_SaveDeltaEx=X("EPDFLayer_SaveDeltaEx",4),t._EPDFLayer_SaveDeltaToOwnedBuffer=X("EPDFLayer_SaveDeltaToOwnedBuffer",3),t._EPDFLayer_SaveDeltaToOwnedBufferEx=X("EPDFLayer_SaveDeltaToOwnedBufferEx",4),t._EPDFLayer_SaveLayerArtifact=X("EPDFLayer_SaveLayerArtifact",3),t._EPDFLayer_SaveLayerArtifactEx=X("EPDFLayer_SaveLayerArtifactEx",4),t._EPDFLayer_SaveLayerArtifactToOwnedBuffer=X("EPDFLayer_SaveLayerArtifactToOwnedBuffer",3),t._EPDFLayer_SaveLayerArtifactToOwnedBufferEx=X("EPDFLayer_SaveLayerArtifactToOwnedBufferEx",4),t._EPDFNamedDest_SetDest=X("EPDFNamedDest_SetDest",3),t._EPDFNamedDest_Remove=X("EPDFNamedDest_Remove",2),t._EPDFDest_CreateView=X("EPDFDest_CreateView",4),t._EPDFDest_CreateXYZ=X("EPDFDest_CreateXYZ",7),t._EPDFDest_CreateRemoteView=X("EPDFDest_CreateRemoteView",5),t._EPDFDest_CreateRemoteXYZ=X("EPDFDest_CreateRemoteXYZ",8),t._EPDFDest_CreateXYZByObjectNumber=X("EPDFDest_CreateXYZByObjectNumber",8),t._EPDFDest_CreateViewByObjectNumber=X("EPDFDest_CreateViewByObjectNumber",5),t._EPDFDest_GetViewNullParams=X("EPDFDest_GetViewNullParams",1),t._EPDFAction_CreateGoTo=X("EPDFAction_CreateGoTo",2),t._EPDFAction_CreateGoToNamed=X("EPDFAction_CreateGoToNamed",2),t._EPDFAction_CreateLaunch=X("EPDFAction_CreateLaunch",2),t._EPDFAction_CreateRemoteGoToByName=X("EPDFAction_CreateRemoteGoToByName",3),t._EPDFAction_CreateRemoteGoToDest=X("EPDFAction_CreateRemoteGoToDest",3),t._EPDFAction_CreateURI=X("EPDFAction_CreateURI",2),t._EPDFAction_CreateNamed=X("EPDFAction_CreateNamed",2),t._EPDFOutline_GetObjectNumber=X("EPDFOutline_GetObjectNumber",1),t._EPDFOutline_GetItem=X("EPDFOutline_GetItem",2),t._EPDFOutline_CreateItem=X("EPDFOutline_CreateItem",5),t._EPDFOutline_MoveItem=X("EPDFOutline_MoveItem",4),t._EPDFOutline_DeleteItem=X("EPDFOutline_DeleteItem",2),t._EPDFOutline_SetTitle=X("EPDFOutline_SetTitle",3),t._EPDFOutline_SetOpen=X("EPDFOutline_SetOpen",3),t._EPDFOutline_SetColor=X("EPDFOutline_SetColor",6),t._EPDFOutline_SetStyle=X("EPDFOutline_SetStyle",3),t._EPDFOutline_SetAction=X("EPDFOutline_SetAction",3),t._EPDFDoc_GetNamedPageCount=X("EPDFDoc_GetNamedPageCount",2),t._EPDFDoc_GetNamedPageAt=X("EPDFDoc_GetNamedPageAt",7),t._EPDFDoc_SetNamedPage=X("EPDFDoc_SetNamedPage",3),t._EPDFDoc_RemoveNamedPage=X("EPDFDoc_RemoveNamedPage",2),t._EPDFDoc_RemoveNamedPagesForPage=X("EPDFDoc_RemoveNamedPagesForPage",2),t._EPDFDoc_GetPageLabelSectionCount=X("EPDFDoc_GetPageLabelSectionCount",1),t._EPDFDoc_GetPageLabelSectionAt=X("EPDFDoc_GetPageLabelSectionAt",7),t._EPDFDoc_SetPageLabelSections=X("EPDFDoc_SetPageLabelSections",6),t._EPDF_DigestBuffer=X("EPDF_DigestBuffer",5),t._EPDFDoc_GetRevisionCount=X("EPDFDoc_GetRevisionCount",1),t._EPDFDoc_GetRevision=X("EPDFDoc_GetRevision",4),t._EPDFDoc_OpenRevision=X("EPDFDoc_OpenRevision",3),t._EPDFDoc_OpenBaseOverlayFromPath=X("EPDFDoc_OpenBaseOverlayFromPath",2),t._EPDFDoc_OpenBaseOverlay=X("EPDFDoc_OpenBaseOverlay",3),t._EPDFSig_LoadModel=X("EPDFSig_LoadModel",1),t._EPDFSig_CloseModel=X("EPDFSig_CloseModel",1),t._EPDFSig_Count=X("EPDFSig_Count",1),t._EPDFSig_IsRevisionChainValid=X("EPDFSig_IsRevisionChainValid",1),t._EPDFSig_GetIndexByFieldObjNum=X("EPDFSig_GetIndexByFieldObjNum",2),t._EPDFSig_GetFieldObjNum=X("EPDFSig_GetFieldObjNum",2),t._EPDFSig_GetWidgetObjNum=X("EPDFSig_GetWidgetObjNum",2),t._EPDFSig_GetWidgetPageObjNum=X("EPDFSig_GetWidgetPageObjNum",2),t._EPDFSig_GetValueObjNum=X("EPDFSig_GetValueObjNum",2),t._EPDFSig_GetFieldName=X("EPDFSig_GetFieldName",4),t._EPDFSig_IsSigned=X("EPDFSig_IsSigned",2),t._EPDFSig_GetKind=X("EPDFSig_GetKind",2),t._EPDFSig_GetByteRange=X("EPDFSig_GetByteRange",3),t._EPDFSig_GetCoverage=X("EPDFSig_GetCoverage",2),t._EPDFSig_GetRevisionIndex=X("EPDFSig_GetRevisionIndex",2),t._EPDFSig_GetContents=X("EPDFSig_GetContents",4),t._EPDFSig_GetString=X("EPDFSig_GetString",5),t._EPDFSig_GetDocMDPPermission=X("EPDFSig_GetDocMDPPermission",2),t._EPDFSig_IsCatalogCertification=X("EPDFSig_IsCatalogCertification",2),t._EPDFSig_GetFieldMDPAction=X("EPDFSig_GetFieldMDPAction",2),t._EPDFSig_GetLockAction=X("EPDFSig_GetLockAction",2),t._EPDFSig_GetLockPermission=X("EPDFSig_GetLockPermission",2),t._EPDFSig_GetFieldNameCount=X("EPDFSig_GetFieldNameCount",3),t._EPDFSig_GetFieldNameAt=X("EPDFSig_GetFieldNameAt",6),t._EPDFSig_HasSeedValue=X("EPDFSig_HasSeedValue",2),t._EPDFSig_GetSeedValueRequiredFlags=X("EPDFSig_GetSeedValueRequiredFlags",2),t._EPDFSig_GetSeedValuePresentFlags=X("EPDFSig_GetSeedValuePresentFlags",2),t._EPDFSig_GetSeedValueMDP=X("EPDFSig_GetSeedValueMDP",2),t._EPDFSig_GetSeedValueVersion=X("EPDFSig_GetSeedValueVersion",2),t._EPDFSig_GetSeedValueFilter=X("EPDFSig_GetSeedValueFilter",4),t._EPDFSig_GetSeedValueListCount=X("EPDFSig_GetSeedValueListCount",3),t._EPDFSig_GetSeedValueListAt=X("EPDFSig_GetSeedValueListAt",6),t._EPDFSig_DigestByteRange=X("EPDFSig_DigestByteRange",5),t._EPDFSig_DigestFileRange=X("EPDFSig_DigestFileRange",5),t._EPDFDoc_GetLoadedBytesSize=X("EPDFDoc_GetLoadedBytesSize",1),t._EPDFDoc_GetBaseBytesSize=X("EPDFDoc_GetBaseBytesSize",1),t._EPDFDoc_GetStructureObjectNumbers=X("EPDFDoc_GetStructureObjectNumbers",4),t._EPDFDoc_ReadLoadedBytes=X("EPDFDoc_ReadLoadedBytes",5),t._EPDFSig_Prepare=X("EPDFSig_Prepare",3),t._EPDFSig_SetFieldLock=X("EPDFSig_SetFieldLock",6),t._EPDFSig_SaveCandidateToOwnedBuffer=X("EPDFSig_SaveCandidateToOwnedBuffer",5),t._EPDFSig_SaveCandidate=X("EPDFSig_SaveCandidate",6),t._EPDFSig_Seal=X("EPDFSig_Seal",13),t._EPDFSig_SealSpan=X("EPDFSig_SealSpan",10),t._EPDFSig_WriteContents=X("EPDFSig_WriteContents",9),t._EPDFDss_GetCount=X("EPDFDss_GetCount",2),t._EPDFDss_GetData=X("EPDFDss_GetData",5),t._EPDFDss_Add=X("EPDFDss_Add",4),t._EPDFDoc_CompareRevisions=X("EPDFDoc_CompareRevisions",2),t._EPDFObjectDiff_Close=X("EPDFObjectDiff_Close",1),t._EPDFObjectDiff_GetCount=X("EPDFObjectDiff_GetCount",1),t._EPDFObjectDiff_GetEntry=X("EPDFObjectDiff_GetEntry",8),t._EPDFObjectDiff_GetValue=X("EPDFObjectDiff_GetValue",6),t._EPDFObjectDiff_GetReadStatus=X("EPDFObjectDiff_GetReadStatus",3),t._EPDFObjectDiff_GetRevisionHealth=X("EPDFObjectDiff_GetRevisionHealth",5),t._EPDFObjectDiff_GetReferrerCount=X("EPDFObjectDiff_GetReferrerCount",3),t._EPDFObjectDiff_GetReferrer=X("EPDFObjectDiff_GetReferrer",7),t._EPDFDoc_GetLoadedObjectValue=X("EPDFDoc_GetLoadedObjectValue",6),t._EPDFDoc_HasPieceInfoEntry=X("EPDFDoc_HasPieceInfoEntry",2),t._EPDFDoc_GetPieceInfoEntryCount=X("EPDFDoc_GetPieceInfoEntryCount",1),t._EPDFDoc_GetPieceInfoEntryAt=X("EPDFDoc_GetPieceInfoEntryAt",4),t._EPDFDoc_GetLastModified=X("EPDFDoc_GetLastModified",3),t._EPDFDoc_GetPieceInfoLastModified=X("EPDFDoc_GetPieceInfoLastModified",4),t._EPDFDoc_GetPieceInfoKeyCount=X("EPDFDoc_GetPieceInfoKeyCount",2),t._EPDFDoc_GetPieceInfoKeyAt=X("EPDFDoc_GetPieceInfoKeyAt",5),t._EPDFDoc_GetPieceInfoValueType=X("EPDFDoc_GetPieceInfoValueType",3),t._EPDFDoc_SetPieceInfoString=X("EPDFDoc_SetPieceInfoString",5),t._EPDFDoc_GetPieceInfoString=X("EPDFDoc_GetPieceInfoString",5),t._EPDFDoc_SetPieceInfoNumber=X("EPDFDoc_SetPieceInfoNumber",5),t._EPDFDoc_GetPieceInfoNumber=X("EPDFDoc_GetPieceInfoNumber",4),t._EPDFDoc_SetPieceInfoBoolean=X("EPDFDoc_SetPieceInfoBoolean",5),t._EPDFDoc_GetPieceInfoBoolean=X("EPDFDoc_GetPieceInfoBoolean",4),t._EPDFDoc_SetPieceInfoName=X("EPDFDoc_SetPieceInfoName",5),t._EPDFDoc_GetPieceInfoName=X("EPDFDoc_GetPieceInfoName",5),t._EPDFDoc_SetPieceInfoStringArray=X("EPDFDoc_SetPieceInfoStringArray",6),t._EPDFDoc_GetPieceInfoStringArrayCount=X("EPDFDoc_GetPieceInfoStringArrayCount",3),t._EPDFDoc_GetPieceInfoStringArrayAt=X("EPDFDoc_GetPieceInfoStringArrayAt",6),t._EPDFDoc_ClearPieceInfoKey=X("EPDFDoc_ClearPieceInfoKey",4),t._EPDFDoc_ClearPieceInfoEntry=X("EPDFDoc_ClearPieceInfoEntry",2),t._EPDFDoc_HasPagePieceInfoEntry=X("EPDFDoc_HasPagePieceInfoEntry",3),t._EPDFDoc_GetPagePieceInfoEntryCount=X("EPDFDoc_GetPagePieceInfoEntryCount",2),t._EPDFDoc_GetPagePieceInfoEntryAt=X("EPDFDoc_GetPagePieceInfoEntryAt",5),t._EPDFDoc_GetPageLastModified=X("EPDFDoc_GetPageLastModified",4),t._EPDFDoc_GetPagePieceInfoLastModified=X("EPDFDoc_GetPagePieceInfoLastModified",5),t._EPDFDoc_GetPagePieceInfoKeyCount=X("EPDFDoc_GetPagePieceInfoKeyCount",3),t._EPDFDoc_GetPagePieceInfoKeyAt=X("EPDFDoc_GetPagePieceInfoKeyAt",6),t._EPDFDoc_GetPagePieceInfoValueType=X("EPDFDoc_GetPagePieceInfoValueType",4),t._EPDFDoc_SetPagePieceInfoString=X("EPDFDoc_SetPagePieceInfoString",6),t._EPDFDoc_GetPagePieceInfoString=X("EPDFDoc_GetPagePieceInfoString",6),t._EPDFDoc_SetPagePieceInfoNumber=X("EPDFDoc_SetPagePieceInfoNumber",6),t._EPDFDoc_GetPagePieceInfoNumber=X("EPDFDoc_GetPagePieceInfoNumber",5),t._EPDFDoc_SetPagePieceInfoBoolean=X("EPDFDoc_SetPagePieceInfoBoolean",6),t._EPDFDoc_GetPagePieceInfoBoolean=X("EPDFDoc_GetPagePieceInfoBoolean",5),t._EPDFDoc_SetPagePieceInfoName=X("EPDFDoc_SetPagePieceInfoName",6),t._EPDFDoc_GetPagePieceInfoName=X("EPDFDoc_GetPagePieceInfoName",6),t._EPDFDoc_SetPagePieceInfoStringArray=X("EPDFDoc_SetPagePieceInfoStringArray",7),t._EPDFDoc_GetPagePieceInfoStringArrayCount=X("EPDFDoc_GetPagePieceInfoStringArrayCount",4),t._EPDFDoc_GetPagePieceInfoStringArrayAt=X("EPDFDoc_GetPagePieceInfoStringArrayAt",7),t._EPDFDoc_ClearPagePieceInfoKey=X("EPDFDoc_ClearPagePieceInfoKey",5),t._EPDFDoc_ClearPagePieceInfoEntry=X("EPDFDoc_ClearPagePieceInfoEntry",3),t._EPDFAnnot_GetMeasure=X("EPDFAnnot_GetMeasure",1),t._EPDFAnnot_AddMeasure=X("EPDFAnnot_AddMeasure",1),t._EPDFAnnot_RemoveMeasure=X("EPDFAnnot_RemoveMeasure",1),t._EPDFPage_CountViewports=X("EPDFPage_CountViewports",1),t._EPDFPage_GetViewport=X("EPDFPage_GetViewport",2),t._EPDFPage_AddViewport=X("EPDFPage_AddViewport",2),t._EPDFPage_RemoveViewport=X("EPDFPage_RemoveViewport",2),t._EPDFPage_CountViewportsRaw=X("EPDFPage_CountViewportsRaw",2),t._EPDFPage_GetViewportRaw=X("EPDFPage_GetViewportRaw",3),t._EPDFPage_AddViewportRaw=X("EPDFPage_AddViewportRaw",3),t._EPDFPage_RemoveViewportRaw=X("EPDFPage_RemoveViewportRaw",3),t._EPDFViewport_Close=X("EPDFViewport_Close",1),t._EPDFPage_FindViewport=X("EPDFPage_FindViewport",2),t._EPDFViewport_GetBBox=X("EPDFViewport_GetBBox",2),t._EPDFViewport_SetBBox=X("EPDFViewport_SetBBox",2),t._EPDFViewport_GetMeasure=X("EPDFViewport_GetMeasure",1),t._EPDFViewport_AddMeasure=X("EPDFViewport_AddMeasure",1),t._EPDFViewport_RemoveMeasure=X("EPDFViewport_RemoveMeasure",1),t._EPDFMeasure_GetSubtype=X("EPDFMeasure_GetSubtype",1),t._EPDFMeasure_GetOrigin=X("EPDFMeasure_GetOrigin",2),t._EPDFMeasure_SetOrigin=X("EPDFMeasure_SetOrigin",2),t._EPDFMeasure_GetCYX=X("EPDFMeasure_GetCYX",2),t._EPDFMeasure_SetCYX=X("EPDFMeasure_SetCYX",2),t._EPDFMeasure_CountFormats=X("EPDFMeasure_CountFormats",2),t._EPDFMeasure_GetFormat=X("EPDFMeasure_GetFormat",3),t._EPDFMeasure_AddFormat=X("EPDFMeasure_AddFormat",4),t._EPDFMeasure_RemoveFormats=X("EPDFMeasure_RemoveFormats",2),t._EPDFViewport_GetName=X("EPDFViewport_GetName",3),t._EPDFViewport_SetName=X("EPDFViewport_SetName",2),t._EPDFMeasure_GetRatio=X("EPDFMeasure_GetRatio",3),t._EPDFMeasure_SetRatio=X("EPDFMeasure_SetRatio",2),t._EPDFNumberFormat_GetUnit=X("EPDFNumberFormat_GetUnit",3),t._EPDFNumberFormat_SetUnit=X("EPDFNumberFormat_SetUnit",2),t._EPDFNumberFormat_GetConversion=X("EPDFNumberFormat_GetConversion",2),t._EPDFNumberFormat_SetConversion=X("EPDFNumberFormat_SetConversion",2),t._EPDFNumberFormat_GetPrecision=X("EPDFNumberFormat_GetPrecision",2),t._EPDFNumberFormat_SetPrecision=X("EPDFNumberFormat_SetPrecision",2),t._EPDFNumberFormat_GetFixedDenominator=X("EPDFNumberFormat_GetFixedDenominator",2),t._EPDFNumberFormat_SetFixedDenominator=X("EPDFNumberFormat_SetFixedDenominator",2),t._EPDFNumberFormat_GetText=X("EPDFNumberFormat_GetText",4),t._EPDFNumberFormat_SetText=X("EPDFNumberFormat_SetText",3),t._EPDFNumberFormat_GetFraction=X("EPDFNumberFormat_GetFraction",2),t._EPDFNumberFormat_SetFraction=X("EPDFNumberFormat_SetFraction",2),t._EPDFNumberFormat_GetLabelPosition=X("EPDFNumberFormat_GetLabelPosition",2),t._EPDFNumberFormat_SetLabelPosition=X("EPDFNumberFormat_SetLabelPosition",2),t._EPDFAnnot_SetLineLeader=X("EPDFAnnot_SetLineLeader",4),t._EPDFAnnot_GetLineLeader=X("EPDFAnnot_GetLineLeader",4),t._EPDFAnnot_SetLineCaption=X("EPDFAnnot_SetLineCaption",4),t._EPDFAnnot_GetLineCaption=X("EPDFAnnot_GetLineCaption",4),t._EPDFAnnot_SetShapeCaption=X("EPDFAnnot_SetShapeCaption",3),t._EPDFAnnot_GetShapeCaption=X("EPDFAnnot_GetShapeCaption",4),t._EPDFPage_GetParsedSize=X("EPDFPage_GetParsedSize",2),t._EPDFPage_IsContentCurrent=X("EPDFPage_IsContentCurrent",1),t._EPDF_PNG_EncodeRGBA=X("EPDF_PNG_EncodeRGBA",6),t._EPDFDoc_ImportPages=X("EPDFDoc_ImportPages",6),t._EPDFDoc_GetImportFieldRoots=X("EPDFDoc_GetImportFieldRoots",5),t._EPDFPage_ApplyRedactions=X("EPDFPage_ApplyRedactions",4),t._EPDF_InitThread=X("EPDF_InitThread",0),t._EPDF_ShutdownThread=X("EPDF_ShutdownThread",0),t._FPDFAnnot_IsSupportedSubtype=X("FPDFAnnot_IsSupportedSubtype",1),t._FPDFPage_CreateAnnot=X("FPDFPage_CreateAnnot",2),t._FPDFPage_GetAnnotCount=X("FPDFPage_GetAnnotCount",1),t._FPDFPage_GetAnnot=X("FPDFPage_GetAnnot",2),t._FPDFPage_GetAnnotIndex=X("FPDFPage_GetAnnotIndex",2),t._FPDFPage_CloseAnnot=X("FPDFPage_CloseAnnot",1),t._FPDFPage_RemoveAnnot=X("FPDFPage_RemoveAnnot",2),t._FPDFAnnot_GetSubtype=X("FPDFAnnot_GetSubtype",1),t._FPDFAnnot_IsObjectSupportedSubtype=X("FPDFAnnot_IsObjectSupportedSubtype",1),t._FPDFAnnot_UpdateObject=X("FPDFAnnot_UpdateObject",2),t._FPDFAnnot_AddInkStroke=X("FPDFAnnot_AddInkStroke",3),t._FPDFAnnot_RemoveInkList=X("FPDFAnnot_RemoveInkList",1),t._FPDFAnnot_AppendObject=X("FPDFAnnot_AppendObject",2),t._FPDFAnnot_GetObjectCount=X("FPDFAnnot_GetObjectCount",1),t._FPDFAnnot_GetObject=X("FPDFAnnot_GetObject",2),t._FPDFAnnot_RemoveObject=X("FPDFAnnot_RemoveObject",2),t._FPDFAnnot_SetColor=X("FPDFAnnot_SetColor",6),t._FPDFAnnot_GetColor=X("FPDFAnnot_GetColor",6),t._FPDFAnnot_HasAttachmentPoints=X("FPDFAnnot_HasAttachmentPoints",1),t._FPDFAnnot_SetAttachmentPoints=X("FPDFAnnot_SetAttachmentPoints",3),t._FPDFAnnot_AppendAttachmentPoints=X("FPDFAnnot_AppendAttachmentPoints",2),t._FPDFAnnot_CountAttachmentPoints=X("FPDFAnnot_CountAttachmentPoints",1),t._FPDFAnnot_GetAttachmentPoints=X("FPDFAnnot_GetAttachmentPoints",3),t._FPDFAnnot_SetRect=X("FPDFAnnot_SetRect",2),t._FPDFAnnot_GetRect=X("FPDFAnnot_GetRect",2),t._FPDFAnnot_GetVertices=X("FPDFAnnot_GetVertices",3),t._FPDFAnnot_GetInkListCount=X("FPDFAnnot_GetInkListCount",1),t._FPDFAnnot_GetInkListPath=X("FPDFAnnot_GetInkListPath",4),t._FPDFAnnot_GetLine=X("FPDFAnnot_GetLine",3),t._FPDFAnnot_SetBorder=X("FPDFAnnot_SetBorder",4),t._FPDFAnnot_GetBorder=X("FPDFAnnot_GetBorder",4),t._FPDFAnnot_HasKey=X("FPDFAnnot_HasKey",2),t._FPDFAnnot_GetValueType=X("FPDFAnnot_GetValueType",2),t._FPDFAnnot_SetStringValue=X("FPDFAnnot_SetStringValue",3),t._FPDFAnnot_GetStringValue=X("FPDFAnnot_GetStringValue",4),t._FPDFAnnot_GetNumberValue=X("FPDFAnnot_GetNumberValue",3),t._FPDFAnnot_SetAP=X("FPDFAnnot_SetAP",3),t._FPDFAnnot_GetAP=X("FPDFAnnot_GetAP",4),t._FPDFAnnot_GetLinkedAnnot=X("FPDFAnnot_GetLinkedAnnot",2),t._FPDFAnnot_GetFlags=X("FPDFAnnot_GetFlags",1),t._FPDFAnnot_SetFlags=X("FPDFAnnot_SetFlags",2),t._FPDFAnnot_GetFormFieldFlags=X("FPDFAnnot_GetFormFieldFlags",2),t._FPDFAnnot_SetFormFieldFlags=X("FPDFAnnot_SetFormFieldFlags",3),t._FPDFAnnot_GetFormFieldAtPoint=X("FPDFAnnot_GetFormFieldAtPoint",3),t._FPDFAnnot_GetFormFieldName=X("FPDFAnnot_GetFormFieldName",4),t._FPDFAnnot_GetFormFieldType=X("FPDFAnnot_GetFormFieldType",2),t._FPDFAnnot_GetFormAdditionalActionJavaScript=X("FPDFAnnot_GetFormAdditionalActionJavaScript",5),t._FPDFAnnot_GetFormFieldAlternateName=X("FPDFAnnot_GetFormFieldAlternateName",4),t._FPDFAnnot_GetFormFieldValue=X("FPDFAnnot_GetFormFieldValue",4),t._FPDFAnnot_GetOptionCount=X("FPDFAnnot_GetOptionCount",2),t._FPDFAnnot_GetOptionLabel=X("FPDFAnnot_GetOptionLabel",5),t._FPDFAnnot_IsOptionSelected=X("FPDFAnnot_IsOptionSelected",3),t._FPDFAnnot_GetFontSize=X("FPDFAnnot_GetFontSize",3),t._FPDFAnnot_SetFontColor=X("FPDFAnnot_SetFontColor",5),t._FPDFAnnot_GetFontColor=X("FPDFAnnot_GetFontColor",5),t._FPDFAnnot_IsChecked=X("FPDFAnnot_IsChecked",2),t._FPDFAnnot_SetFocusableSubtypes=X("FPDFAnnot_SetFocusableSubtypes",3),t._FPDFAnnot_GetFocusableSubtypesCount=X("FPDFAnnot_GetFocusableSubtypesCount",1),t._FPDFAnnot_GetFocusableSubtypes=X("FPDFAnnot_GetFocusableSubtypes",3),t._FPDFAnnot_GetLink=X("FPDFAnnot_GetLink",1),t._FPDFAnnot_GetFormControlCount=X("FPDFAnnot_GetFormControlCount",2),t._FPDFAnnot_GetFormControlIndex=X("FPDFAnnot_GetFormControlIndex",2),t._FPDFAnnot_GetFormFieldExportValue=X("FPDFAnnot_GetFormFieldExportValue",4),t._FPDFAnnot_SetURI=X("FPDFAnnot_SetURI",2),t._FPDFAnnot_GetFileAttachment=X("FPDFAnnot_GetFileAttachment",1),t._FPDFAnnot_AddFileAttachment=X("FPDFAnnot_AddFileAttachment",2),t._FPDFDoc_GetAttachmentCount=X("FPDFDoc_GetAttachmentCount",1),t._FPDFDoc_AddAttachment=X("FPDFDoc_AddAttachment",2),t._FPDFDoc_GetAttachment=X("FPDFDoc_GetAttachment",2),t._EPDFDoc_GetAttachmentKey=X("EPDFDoc_GetAttachmentKey",4),t._EPDFDoc_GetAttachmentIndexByKey=X("EPDFDoc_GetAttachmentIndexByKey",2),t._FPDFDoc_DeleteAttachment=X("FPDFDoc_DeleteAttachment",2),t._FPDFAttachment_GetName=X("FPDFAttachment_GetName",3),t._FPDFAttachment_HasKey=X("FPDFAttachment_HasKey",2),t._FPDFAttachment_GetValueType=X("FPDFAttachment_GetValueType",2),t._FPDFAttachment_SetStringValue=X("FPDFAttachment_SetStringValue",3),t._FPDFAttachment_GetStringValue=X("FPDFAttachment_GetStringValue",4),t._FPDFAttachment_SetDescription=X("FPDFAttachment_SetDescription",2),t._FPDFAttachment_GetDescription=X("FPDFAttachment_GetDescription",3),t._FPDFAttachment_SetFile=X("FPDFAttachment_SetFile",4),t._FPDFAttachment_GetFile=X("FPDFAttachment_GetFile",4),t._FPDFAttachment_GetSubtype=X("FPDFAttachment_GetSubtype",3),t._FPDFAttachment_GetAFRelationship=X("FPDFAttachment_GetAFRelationship",3),t._EPDFAttachment_SetSubtype=X("EPDFAttachment_SetSubtype",2),t._EPDFAttachment_SetDescription=X("EPDFAttachment_SetDescription",2),t._EPDFAttachment_SetName=X("EPDFAttachment_SetName",2),t._EPDFAttachment_GetDescription=X("EPDFAttachment_GetDescription",3),t._EPDFAttachment_GetIntegerValue=X("EPDFAttachment_GetIntegerValue",3),t._EPDFAttachment_ExtractFile=X("EPDFAttachment_ExtractFile",6),t._EPDFAttachment_ExtractFileToOwnedBuffer=X("EPDFAttachment_ExtractFileToOwnedBuffer",6),t._FPDFCatalog_IsTagged=X("FPDFCatalog_IsTagged",1),t._FPDFCatalog_GetLanguage=X("FPDFCatalog_GetLanguage",3),t._FPDFCatalog_SetLanguage=X("FPDFCatalog_SetLanguage",2),t._EPDFCatalog_GetLanguage=X("EPDFCatalog_GetLanguage",3),t._FPDFAvail_Create=X("FPDFAvail_Create",2),t._FPDFAvail_Destroy=X("FPDFAvail_Destroy",1),t._FPDFAvail_IsDocAvail=X("FPDFAvail_IsDocAvail",2),t._FPDFAvail_GetDocument=X("FPDFAvail_GetDocument",2),t._FPDFAvail_GetFirstPageNum=X("FPDFAvail_GetFirstPageNum",1),t._FPDFAvail_IsPageAvail=X("FPDFAvail_IsPageAvail",3),t._FPDFAvail_IsFormAvail=X("FPDFAvail_IsFormAvail",2),t._FPDFAvail_IsLinearized=X("FPDFAvail_IsLinearized",1),t._FPDFBookmark_GetFirstChild=X("FPDFBookmark_GetFirstChild",2),t._FPDFBookmark_GetNextSibling=X("FPDFBookmark_GetNextSibling",2),t._FPDFBookmark_GetTitle=X("FPDFBookmark_GetTitle",3),t._FPDFBookmark_GetCount=X("FPDFBookmark_GetCount",1),t._FPDFBookmark_Find=X("FPDFBookmark_Find",2),t._FPDFBookmark_GetDest=X("FPDFBookmark_GetDest",2),t._FPDFBookmark_GetAction=X("FPDFBookmark_GetAction",1),t._FPDFBookmark_GetColor=X("FPDFBookmark_GetColor",4),t._FPDFBookmark_GetStyle=X("FPDFBookmark_GetStyle",1),t._FPDFAction_GetType=X("FPDFAction_GetType",1),t._FPDFAction_GetDest=X("FPDFAction_GetDest",2),t._FPDFAction_GetFilePath=X("FPDFAction_GetFilePath",3),t._FPDFAction_GetURIPath=X("FPDFAction_GetURIPath",4),t._FPDFDest_GetDestPageIndex=X("FPDFDest_GetDestPageIndex",2),t._EPDFDest_GetPageObjectNumber=X("EPDFDest_GetPageObjectNumber",2),t._FPDFDest_GetView=X("FPDFDest_GetView",3),t._FPDFDest_GetLocationInPage=X("FPDFDest_GetLocationInPage",7),t._FPDFLink_GetLinkAtPoint=X("FPDFLink_GetLinkAtPoint",3),t._FPDFLink_GetLinkZOrderAtPoint=X("FPDFLink_GetLinkZOrderAtPoint",3),t._FPDFLink_GetDest=X("FPDFLink_GetDest",2),t._FPDFLink_GetAction=X("FPDFLink_GetAction",1),t._FPDFLink_Enumerate=X("FPDFLink_Enumerate",3),t._FPDFLink_GetAnnot=X("FPDFLink_GetAnnot",2),t._FPDFLink_GetAnnotRect=X("FPDFLink_GetAnnotRect",2),t._FPDFLink_CountQuadPoints=X("FPDFLink_CountQuadPoints",1),t._FPDFLink_GetQuadPoints=X("FPDFLink_GetQuadPoints",3),t._FPDF_GetPageAAction=X("FPDF_GetPageAAction",2),t._FPDF_GetFileIdentifier=X("FPDF_GetFileIdentifier",4),t._FPDF_GetMetaText=X("FPDF_GetMetaText",4),t._FPDF_GetPageLabel=X("FPDF_GetPageLabel",4),t._EPDF_SetMetaText=X("EPDF_SetMetaText",3),t._EPDF_HasMetaText=X("EPDF_HasMetaText",2),t._EPDF_GetMetaTrapped=X("EPDF_GetMetaTrapped",1),t._EPDF_SetMetaTrapped=X("EPDF_SetMetaTrapped",2),t._EPDF_GetMetaKeyCount=X("EPDF_GetMetaKeyCount",2),t._EPDF_GetMetaKeyName=X("EPDF_GetMetaKeyName",5),t._FPDFPageObj_NewImageObj=X("FPDFPageObj_NewImageObj",1),t._FPDFImageObj_LoadJpegFile=X("FPDFImageObj_LoadJpegFile",4),t._FPDFImageObj_LoadJpegFileInline=X("FPDFImageObj_LoadJpegFileInline",4),t._FPDFImageObj_SetMatrix=X("FPDFImageObj_SetMatrix",7),t._FPDFImageObj_SetBitmap=X("FPDFImageObj_SetBitmap",4),t._FPDFImageObj_GetBitmap=X("FPDFImageObj_GetBitmap",1),t._FPDFImageObj_GetRenderedBitmap=X("FPDFImageObj_GetRenderedBitmap",3),t._FPDFImageObj_GetImageDataDecoded=X("FPDFImageObj_GetImageDataDecoded",3),t._FPDFImageObj_GetImageDataRaw=X("FPDFImageObj_GetImageDataRaw",3),t._FPDFImageObj_GetImageFilterCount=X("FPDFImageObj_GetImageFilterCount",1),t._FPDFImageObj_GetImageFilter=X("FPDFImageObj_GetImageFilter",4),t._FPDFImageObj_GetImageMetadata=X("FPDFImageObj_GetImageMetadata",3),t._FPDFImageObj_GetImagePixelSize=X("FPDFImageObj_GetImagePixelSize",3),t._FPDFImageObj_GetIccProfileDataDecoded=X("FPDFImageObj_GetIccProfileDataDecoded",5),t._EPDFImageObj_SetPng=X("EPDFImageObj_SetPng",5),t._EPDFImageObj_SetJpeg=X("EPDFImageObj_SetJpeg",5),t._FPDF_CreateNewDocument=X("FPDF_CreateNewDocument",0),t._FPDFPage_Delete=X("FPDFPage_Delete",2),t._FPDF_MovePages=X("FPDF_MovePages",4),t._FPDFPage_New=X("FPDFPage_New",4),t._EPDFPage_InsertBlankRaw=X("EPDFPage_InsertBlankRaw",5),t._FPDFPage_GetRotation=X("FPDFPage_GetRotation",1),t._FPDFPage_InsertObject=X("FPDFPage_InsertObject",2),t._FPDFPage_InsertObjectAtIndex=X("FPDFPage_InsertObjectAtIndex",3),t._FPDFPage_RemoveObject=X("FPDFPage_RemoveObject",2),t._FPDFPage_CountObjects=X("FPDFPage_CountObjects",1),t._FPDFPage_GetObject=X("FPDFPage_GetObject",2),t._FPDFPage_HasTransparency=X("FPDFPage_HasTransparency",1),t._FPDFPageObj_Destroy=X("FPDFPageObj_Destroy",1),t._FPDFPageObj_GetMarkedContentID=X("FPDFPageObj_GetMarkedContentID",1),t._FPDFPageObj_CountMarks=X("FPDFPageObj_CountMarks",1),t._FPDFPageObj_GetMark=X("FPDFPageObj_GetMark",2),t._FPDFPageObj_AddExistingMark=X("FPDFPageObj_AddExistingMark",2),t._FPDFPageObj_AddMark=X("FPDFPageObj_AddMark",2),t._FPDFPageObj_RemoveMark=X("FPDFPageObj_RemoveMark",2),t._FPDFPageObjMark_GetName=X("FPDFPageObjMark_GetName",4),t._FPDFPageObjMark_CountParams=X("FPDFPageObjMark_CountParams",1),t._FPDFPageObjMark_GetParamKey=X("FPDFPageObjMark_GetParamKey",5),t._FPDFPageObjMark_GetParamValueType=X("FPDFPageObjMark_GetParamValueType",2),t._FPDFPageObjMark_GetParamIntValue=X("FPDFPageObjMark_GetParamIntValue",3),t._FPDFPageObjMark_GetParamFloatValue=X("FPDFPageObjMark_GetParamFloatValue",3),t._FPDFPageObjMark_GetParamStringValue=X("FPDFPageObjMark_GetParamStringValue",5),t._FPDFPageObjMark_GetParamBlobValue=X("FPDFPageObjMark_GetParamBlobValue",5),t._FPDFPageObj_HasTransparency=X("FPDFPageObj_HasTransparency",1),t._FPDFPageObjMark_SetIntParam=X("FPDFPageObjMark_SetIntParam",5),t._FPDFPageObjMark_SetFloatParam=X("FPDFPageObjMark_SetFloatParam",5),t._FPDFPageObjMark_SetStringParam=X("FPDFPageObjMark_SetStringParam",5),t._FPDFPageObjMark_SetBlobParam=X("FPDFPageObjMark_SetBlobParam",6),t._FPDFPageObjMark_RemoveParam=X("FPDFPageObjMark_RemoveParam",3),t._FPDFPageObj_GetType=X("FPDFPageObj_GetType",1),t._FPDFPageObj_GetIsActive=X("FPDFPageObj_GetIsActive",2),t._FPDFPageObj_SetIsActive=X("FPDFPageObj_SetIsActive",2),t._FPDFPage_GenerateContent=X("FPDFPage_GenerateContent",1),t._FPDFPageObj_Transform=X("FPDFPageObj_Transform",7),t._FPDFPageObj_TransformF=X("FPDFPageObj_TransformF",2),t._FPDFPageObj_GetMatrix=X("FPDFPageObj_GetMatrix",2),t._FPDFPageObj_SetMatrix=X("FPDFPageObj_SetMatrix",2),t._FPDFPageObj_SetBlendMode=X("FPDFPageObj_SetBlendMode",2),t._FPDFPage_TransformAnnots=X("FPDFPage_TransformAnnots",7),t._FPDFPage_SetRotation=X("FPDFPage_SetRotation",2),t._FPDFPageObj_SetFillColor=X("FPDFPageObj_SetFillColor",5),t._FPDFPageObj_GetFillColor=X("FPDFPageObj_GetFillColor",5),t._FPDFPageObj_GetBounds=X("FPDFPageObj_GetBounds",5),t._FPDFPageObj_GetRotatedBounds=X("FPDFPageObj_GetRotatedBounds",2),t._FPDFPageObj_SetStrokeColor=X("FPDFPageObj_SetStrokeColor",5),t._FPDFPageObj_GetStrokeColor=X("FPDFPageObj_GetStrokeColor",5),t._FPDFPageObj_SetStrokeWidth=X("FPDFPageObj_SetStrokeWidth",2),t._FPDFPageObj_GetStrokeWidth=X("FPDFPageObj_GetStrokeWidth",2),t._FPDFPageObj_GetLineJoin=X("FPDFPageObj_GetLineJoin",1),t._FPDFPageObj_SetLineJoin=X("FPDFPageObj_SetLineJoin",2),t._FPDFPageObj_GetLineCap=X("FPDFPageObj_GetLineCap",1),t._FPDFPageObj_SetLineCap=X("FPDFPageObj_SetLineCap",2),t._FPDFPageObj_GetDashPhase=X("FPDFPageObj_GetDashPhase",2),t._FPDFPageObj_SetDashPhase=X("FPDFPageObj_SetDashPhase",2),t._FPDFPageObj_GetDashCount=X("FPDFPageObj_GetDashCount",1),t._FPDFPageObj_GetDashArray=X("FPDFPageObj_GetDashArray",3),t._FPDFPageObj_SetDashArray=X("FPDFPageObj_SetDashArray",4),t._FPDFPageObj_GetRenderedStrokePattern=X("FPDFPageObj_GetRenderedStrokePattern",2),t._FPDFPageObj_GetRenderedFillPattern=X("FPDFPageObj_GetRenderedFillPattern",2),t._FPDFFormObj_CountObjects=X("FPDFFormObj_CountObjects",1),t._FPDFFormObj_GetObject=X("FPDFFormObj_GetObject",2),t._FPDFFormObj_RemoveObject=X("FPDFFormObj_RemoveObject",2),t._FPDFPageObj_CreateNewPath=X("FPDFPageObj_CreateNewPath",2),t._FPDFPageObj_CreateNewRect=X("FPDFPageObj_CreateNewRect",4),t._FPDFPath_CountSegments=X("FPDFPath_CountSegments",1),t._FPDFPath_GetPathSegment=X("FPDFPath_GetPathSegment",2),t._FPDFPath_MoveTo=X("FPDFPath_MoveTo",3),t._FPDFPath_LineTo=X("FPDFPath_LineTo",3),t._FPDFPath_BezierTo=X("FPDFPath_BezierTo",7),t._FPDFPath_GetBezierControlPoints=X("FPDFPath_GetBezierControlPoints",4),t._FPDFPath_Close=X("FPDFPath_Close",1),t._FPDFPath_SetDrawMode=X("FPDFPath_SetDrawMode",3),t._FPDFPath_GetDrawMode=X("FPDFPath_GetDrawMode",3),t._FPDFPathSegment_GetPoint=X("FPDFPathSegment_GetPoint",3),t._FPDFPathSegment_GetType=X("FPDFPathSegment_GetType",1),t._FPDFPathSegment_GetClose=X("FPDFPathSegment_GetClose",1),t._FPDFPageObj_NewTextObj=X("FPDFPageObj_NewTextObj",3),t._FPDFText_SetText=X("FPDFText_SetText",2),t._FPDFText_SetCharcodes=X("FPDFText_SetCharcodes",3),t._FPDFText_SetPositions=X("FPDFText_SetPositions",3),t._FPDFText_LoadFont=X("FPDFText_LoadFont",5),t._FPDFText_LoadStandardFont=X("FPDFText_LoadStandardFont",2),t._FPDFText_LoadCidType2Font=X("FPDFText_LoadCidType2Font",6),t._FPDFTextObj_GetFontSize=X("FPDFTextObj_GetFontSize",2),t._FPDFTextObj_SetFontSize=X("FPDFTextObj_SetFontSize",2),t._FPDFTextObj_GetText=X("FPDFTextObj_GetText",4),t._FPDFTextObj_GetRenderedBitmap=X("FPDFTextObj_GetRenderedBitmap",4),t._FPDFFont_Close=X("FPDFFont_Close",1),t._FPDFPageObj_CreateTextObj=X("FPDFPageObj_CreateTextObj",3),t._FPDFTextObj_GetTextRenderMode=X("FPDFTextObj_GetTextRenderMode",1),t._FPDFTextObj_SetTextRenderMode=X("FPDFTextObj_SetTextRenderMode",2),t._FPDFTextObj_GetFont=X("FPDFTextObj_GetFont",1),t._FPDFFont_GetBaseFontName=X("FPDFFont_GetBaseFontName",3),t._FPDFFont_GetFamilyName=X("FPDFFont_GetFamilyName",3),t._FPDFFont_GetFontData=X("FPDFFont_GetFontData",4),t._FPDFFont_GetIsEmbedded=X("FPDFFont_GetIsEmbedded",1),t._FPDFFont_GetFlags=X("FPDFFont_GetFlags",1),t._FPDFFont_GetWeight=X("FPDFFont_GetWeight",1),t._FPDFFont_GetItalicAngle=X("FPDFFont_GetItalicAngle",2),t._FPDFFont_GetAscent=X("FPDFFont_GetAscent",3),t._FPDFFont_GetDescent=X("FPDFFont_GetDescent",3),t._FPDFFont_GetGlyphWidth=X("FPDFFont_GetGlyphWidth",4),t._FPDFFont_GetGlyphPath=X("FPDFFont_GetGlyphPath",3),t._FPDFGlyphPath_CountGlyphSegments=X("FPDFGlyphPath_CountGlyphSegments",1),t._FPDFGlyphPath_GetGlyphPathSegment=X("FPDFGlyphPath_GetGlyphPathSegment",2),t._EPDFText_RedactInRect=X("EPDFText_RedactInRect",4),t._EPDFText_RedactInQuads=X("EPDFText_RedactInQuads",5),t._FPDFDoc_GetPageMode=X("FPDFDoc_GetPageMode",1),t._FPDFPage_Flatten=X("FPDFPage_Flatten",2),t._FPDFPage_HasFormFieldAtPoint=X("FPDFPage_HasFormFieldAtPoint",4),t._FPDFPage_FormFieldZOrderAtPoint=X("FPDFPage_FormFieldZOrderAtPoint",4),t._FPDFDOC_InitFormFillEnvironment=X("FPDFDOC_InitFormFillEnvironment",2),t._FPDFDOC_ExitFormFillEnvironment=X("FPDFDOC_ExitFormFillEnvironment",1),t._FORM_OnMouseMove=X("FORM_OnMouseMove",5),t._FORM_OnMouseWheel=X("FORM_OnMouseWheel",6),t._FORM_OnFocus=X("FORM_OnFocus",5),t._FORM_OnLButtonDown=X("FORM_OnLButtonDown",5),t._FORM_OnLButtonUp=X("FORM_OnLButtonUp",5),t._FORM_OnLButtonDoubleClick=X("FORM_OnLButtonDoubleClick",5),t._FORM_OnRButtonDown=X("FORM_OnRButtonDown",5),t._FORM_OnRButtonUp=X("FORM_OnRButtonUp",5),t._FORM_OnKeyDown=X("FORM_OnKeyDown",4),t._FORM_OnKeyUp=X("FORM_OnKeyUp",4),t._FORM_OnChar=X("FORM_OnChar",4),t._FORM_GetFocusedText=X("FORM_GetFocusedText",4),t._FORM_GetSelectedText=X("FORM_GetSelectedText",4),t._FORM_ReplaceAndKeepSelection=X("FORM_ReplaceAndKeepSelection",3),t._FORM_ReplaceSelection=X("FORM_ReplaceSelection",3),t._FORM_SelectAllText=X("FORM_SelectAllText",2),t._FORM_CanUndo=X("FORM_CanUndo",2),t._FORM_CanRedo=X("FORM_CanRedo",2),t._FORM_Undo=X("FORM_Undo",2),t._FORM_Redo=X("FORM_Redo",2),t._FORM_ForceToKillFocus=X("FORM_ForceToKillFocus",1),t._FORM_GetFocusedAnnot=X("FORM_GetFocusedAnnot",3),t._FORM_SetFocusedAnnot=X("FORM_SetFocusedAnnot",2),t._FPDF_FFLDraw=X("FPDF_FFLDraw",9),t._FPDF_SetFormFieldHighlightColor=X("FPDF_SetFormFieldHighlightColor",3),t._FPDF_SetFormFieldHighlightAlpha=X("FPDF_SetFormFieldHighlightAlpha",2),t._FPDF_RemoveFormFieldHighlight=X("FPDF_RemoveFormFieldHighlight",1),t._FORM_OnAfterLoadPage=X("FORM_OnAfterLoadPage",2),t._FORM_OnBeforeClosePage=X("FORM_OnBeforeClosePage",2),t._FORM_DoDocumentJSAction=X("FORM_DoDocumentJSAction",1),t._FORM_DoDocumentOpenAction=X("FORM_DoDocumentOpenAction",1),t._FORM_DoDocumentAAction=X("FORM_DoDocumentAAction",2),t._FORM_DoPageAAction=X("FORM_DoPageAAction",3),t._FORM_SetIndexSelected=X("FORM_SetIndexSelected",4),t._FORM_IsIndexSelected=X("FORM_IsIndexSelected",3),t._FORM_GetTextDirection=X("FORM_GetTextDirection",2),t._FORM_SetTextDirection=X("FORM_SetTextDirection",3),t._FPDFDoc_GetJavaScriptActionCount=X("FPDFDoc_GetJavaScriptActionCount",1),t._FPDFDoc_GetJavaScriptAction=X("FPDFDoc_GetJavaScriptAction",2),t._EPDFDoc_GetNamedJavaScriptActionModel=X("EPDFDoc_GetNamedJavaScriptActionModel",2),t._FPDFDoc_CloseJavaScriptAction=X("FPDFDoc_CloseJavaScriptAction",1),t._FPDFJavaScriptAction_GetName=X("FPDFJavaScriptAction_GetName",3),t._FPDFJavaScriptAction_GetScript=X("FPDFJavaScriptAction_GetScript",3),t._FPDF_ImportPagesByIndex=X("FPDF_ImportPagesByIndex",5),t._FPDF_ImportPages=X("FPDF_ImportPages",4),t._FPDF_ImportNPagesToOne=X("FPDF_ImportNPagesToOne",5),t._FPDF_NewXObjectFromPage=X("FPDF_NewXObjectFromPage",3),t._FPDF_CloseXObject=X("FPDF_CloseXObject",1),t._FPDF_NewFormObjectFromXObject=X("FPDF_NewFormObjectFromXObject",1),t._FPDF_CopyViewerPreferences=X("FPDF_CopyViewerPreferences",2),t._FPDF_RenderPageBitmapWithColorScheme_Start=X("FPDF_RenderPageBitmapWithColorScheme_Start",10),t._FPDF_RenderPageBitmap_Start=X("FPDF_RenderPageBitmap_Start",9),t._FPDF_RenderPage_Continue=X("FPDF_RenderPage_Continue",2),t._FPDF_RenderPage_Close=X("FPDF_RenderPage_Close",1),t._EPDF_RenderPageBitmapWithMatrix_Start=X("EPDF_RenderPageBitmapWithMatrix_Start",6),t._EPDF_RenderPage_Continue=X("EPDF_RenderPage_Continue",2),t._EPDF_FreeBuffer=X("EPDF_FreeBuffer",1),t._FPDF_SaveAsCopy=X("FPDF_SaveAsCopy",3),t._FPDF_SaveWithVersion=X("FPDF_SaveWithVersion",4),t._EPDF_SaveDocumentToOwnedBuffer=X("EPDF_SaveDocumentToOwnedBuffer",3),t._EPDF_SaveDocumentToOwnedBufferWithVersion=X("EPDF_SaveDocumentToOwnedBufferWithVersion",4),t._EPDF_SaveDocumentToOwnedBufferEx=X("EPDF_SaveDocumentToOwnedBufferEx",5),t._EPDF_SaveAsCopyEx=X("EPDF_SaveAsCopyEx",4),t._FPDFText_GetCharIndexFromTextIndex=X("FPDFText_GetCharIndexFromTextIndex",2),t._FPDFText_GetTextIndexFromCharIndex=X("FPDFText_GetTextIndexFromCharIndex",2),t._FPDF_GetSignatureCount=X("FPDF_GetSignatureCount",1),t._FPDF_GetSignatureObject=X("FPDF_GetSignatureObject",2),t._FPDFSignatureObj_GetContents=X("FPDFSignatureObj_GetContents",3),t._FPDFSignatureObj_GetByteRange=X("FPDFSignatureObj_GetByteRange",3),t._FPDFSignatureObj_GetSubFilter=X("FPDFSignatureObj_GetSubFilter",3),t._FPDFSignatureObj_GetReason=X("FPDFSignatureObj_GetReason",3),t._FPDFSignatureObj_GetTime=X("FPDFSignatureObj_GetTime",3),t._FPDFSignatureObj_GetDocMDPPermission=X("FPDFSignatureObj_GetDocMDPPermission",1),t._FPDF_StructTree_GetForPage=X("FPDF_StructTree_GetForPage",1),t._FPDF_StructTree_Close=X("FPDF_StructTree_Close",1),t._FPDF_StructTree_CountChildren=X("FPDF_StructTree_CountChildren",1),t._FPDF_StructTree_GetChildAtIndex=X("FPDF_StructTree_GetChildAtIndex",2),t._FPDF_StructElement_GetAltText=X("FPDF_StructElement_GetAltText",3),t._FPDF_StructElement_GetActualText=X("FPDF_StructElement_GetActualText",3),t._FPDF_StructElement_GetExpansion=X("FPDF_StructElement_GetExpansion",3),t._FPDF_StructElement_GetID=X("FPDF_StructElement_GetID",3),t._FPDF_StructElement_GetLang=X("FPDF_StructElement_GetLang",3),t._FPDF_StructElement_GetAttributeCount=X("FPDF_StructElement_GetAttributeCount",1),t._FPDF_StructElement_GetAttributeAtIndex=X("FPDF_StructElement_GetAttributeAtIndex",2),t._FPDF_StructElement_GetStringAttribute=X("FPDF_StructElement_GetStringAttribute",4),t._FPDF_StructElement_GetMarkedContentID=X("FPDF_StructElement_GetMarkedContentID",1),t._FPDF_StructElement_GetRawType=X("FPDF_StructElement_GetRawType",3),t._FPDF_StructElement_GetType=X("FPDF_StructElement_GetType",3),t._FPDF_StructElement_GetObjType=X("FPDF_StructElement_GetObjType",3),t._FPDF_StructElement_GetTitle=X("FPDF_StructElement_GetTitle",3),t._FPDF_StructElement_CountChildren=X("FPDF_StructElement_CountChildren",1),t._FPDF_StructElement_GetChildAtIndex=X("FPDF_StructElement_GetChildAtIndex",2),t._FPDF_StructElement_GetChildMarkedContentID=X("FPDF_StructElement_GetChildMarkedContentID",2),t._FPDF_StructElement_GetParent=X("FPDF_StructElement_GetParent",1),t._FPDF_StructElement_Attr_GetCount=X("FPDF_StructElement_Attr_GetCount",1),t._FPDF_StructElement_Attr_GetName=X("FPDF_StructElement_Attr_GetName",5),t._FPDF_StructElement_Attr_GetValue=X("FPDF_StructElement_Attr_GetValue",2),t._FPDF_StructElement_Attr_GetType=X("FPDF_StructElement_Attr_GetType",1),t._FPDF_StructElement_Attr_GetBooleanValue=X("FPDF_StructElement_Attr_GetBooleanValue",2),t._FPDF_StructElement_Attr_GetNumberValue=X("FPDF_StructElement_Attr_GetNumberValue",2),t._FPDF_StructElement_Attr_GetStringValue=X("FPDF_StructElement_Attr_GetStringValue",4),t._FPDF_StructElement_Attr_GetBlobValue=X("FPDF_StructElement_Attr_GetBlobValue",4),t._FPDF_StructElement_Attr_CountChildren=X("FPDF_StructElement_Attr_CountChildren",1),t._FPDF_StructElement_Attr_GetChildAtIndex=X("FPDF_StructElement_Attr_GetChildAtIndex",2),t._FPDF_StructElement_GetMarkedContentIdCount=X("FPDF_StructElement_GetMarkedContentIdCount",1),t._FPDF_StructElement_GetMarkedContentIdAtIndex=X("FPDF_StructElement_GetMarkedContentIdAtIndex",2),t._FPDF_AddInstalledFont=X("FPDF_AddInstalledFont",3),t._FPDF_SetSystemFontInfo=X("FPDF_SetSystemFontInfo",1),t._FPDF_GetDefaultTTFMap=X("FPDF_GetDefaultTTFMap",0),t._FPDF_GetDefaultTTFMapCount=X("FPDF_GetDefaultTTFMapCount",0),t._FPDF_GetDefaultTTFMapEntry=X("FPDF_GetDefaultTTFMapEntry",1),t._FPDF_GetDefaultSystemFontInfo=X("FPDF_GetDefaultSystemFontInfo",0),t._FPDF_FreeDefaultSystemFontInfo=X("FPDF_FreeDefaultSystemFontInfo",1),t._FPDFText_LoadPage=X("FPDFText_LoadPage",1),t._FPDFText_ClosePage=X("FPDFText_ClosePage",1),t._FPDFText_CountChars=X("FPDFText_CountChars",1),t._FPDFText_GetUnicode=X("FPDFText_GetUnicode",2),t._FPDFText_GetTextObject=X("FPDFText_GetTextObject",2),t._FPDFText_IsGenerated=X("FPDFText_IsGenerated",2),t._FPDFText_IsHyphen=X("FPDFText_IsHyphen",2),t._FPDFText_HasUnicodeMapError=X("FPDFText_HasUnicodeMapError",2),t._FPDFText_GetFontSize=X("FPDFText_GetFontSize",2),t._FPDFText_GetFontInfo=X("FPDFText_GetFontInfo",5),t._FPDFText_GetFontWeight=X("FPDFText_GetFontWeight",2),t._FPDFText_GetFillColor=X("FPDFText_GetFillColor",6),t._FPDFText_GetStrokeColor=X("FPDFText_GetStrokeColor",6),t._FPDFText_GetCharAngle=X("FPDFText_GetCharAngle",2),t._FPDFText_GetCharBox=X("FPDFText_GetCharBox",6),t._FPDFText_GetLooseCharBox=X("FPDFText_GetLooseCharBox",3),t._EPDFText_GetCharGeometry=X("EPDFText_GetCharGeometry",3),t._EPDFText_GetPageGeometry=X("EPDFText_GetPageGeometry",4),t._EPDFText_GetTextFull=X("EPDFText_GetTextFull",3),t._EPDFText_GetCharToTextMap=X("EPDFText_GetCharToTextMap",3),t._FPDFText_GetMatrix=X("FPDFText_GetMatrix",3),t._FPDFText_GetCharOrigin=X("FPDFText_GetCharOrigin",4),t._FPDFText_GetCharIndexAtPos=X("FPDFText_GetCharIndexAtPos",5),t._FPDFText_GetText=X("FPDFText_GetText",4),t._FPDFText_CountRects=X("FPDFText_CountRects",3),t._FPDFText_GetRect=X("FPDFText_GetRect",6),t._FPDFText_GetBoundedText=X("FPDFText_GetBoundedText",7),t._FPDFText_FindStart=X("FPDFText_FindStart",4),t._FPDFText_FindNext=X("FPDFText_FindNext",1),t._FPDFText_FindPrev=X("FPDFText_FindPrev",1),t._FPDFText_GetSchResultIndex=X("FPDFText_GetSchResultIndex",1),t._FPDFText_GetSchCount=X("FPDFText_GetSchCount",1),t._FPDFText_FindClose=X("FPDFText_FindClose",1),t._FPDFLink_LoadWebLinks=X("FPDFLink_LoadWebLinks",1),t._FPDFLink_CountWebLinks=X("FPDFLink_CountWebLinks",1),t._FPDFLink_GetURL=X("FPDFLink_GetURL",4),t._FPDFLink_CountRects=X("FPDFLink_CountRects",2),t._FPDFLink_GetRect=X("FPDFLink_GetRect",7),t._FPDFLink_GetTextRange=X("FPDFLink_GetTextRange",4),t._FPDFLink_CloseWebLinks=X("FPDFLink_CloseWebLinks",1),t._FPDFPage_GetDecodedThumbnailData=X("FPDFPage_GetDecodedThumbnailData",3),t._FPDFPage_GetRawThumbnailData=X("FPDFPage_GetRawThumbnailData",3),t._FPDFPage_GetThumbnailAsBitmap=X("FPDFPage_GetThumbnailAsBitmap",1),t._FPDFPage_SetMediaBox=X("FPDFPage_SetMediaBox",5),t._FPDFPage_SetCropBox=X("FPDFPage_SetCropBox",5),t._FPDFPage_SetBleedBox=X("FPDFPage_SetBleedBox",5),t._FPDFPage_SetTrimBox=X("FPDFPage_SetTrimBox",5),t._FPDFPage_SetArtBox=X("FPDFPage_SetArtBox",5),t._FPDFPage_GetMediaBox=X("FPDFPage_GetMediaBox",5),t._FPDFPage_GetCropBox=X("FPDFPage_GetCropBox",5),t._FPDFPage_GetBleedBox=X("FPDFPage_GetBleedBox",5),t._FPDFPage_GetTrimBox=X("FPDFPage_GetTrimBox",5),t._FPDFPage_GetArtBox=X("FPDFPage_GetArtBox",5),t._FPDFPage_TransFormWithClip=X("FPDFPage_TransFormWithClip",3),t._FPDFPageObj_TransformClipPath=X("FPDFPageObj_TransformClipPath",7),t._FPDFPageObj_GetClipPath=X("FPDFPageObj_GetClipPath",1),t._FPDFClipPath_CountPaths=X("FPDFClipPath_CountPaths",1),t._FPDFClipPath_CountPathSegments=X("FPDFClipPath_CountPathSegments",2),t._FPDFClipPath_GetPathSegment=X("FPDFClipPath_GetPathSegment",3),t._FPDF_CreateClipPath=X("FPDF_CreateClipPath",4),t._FPDF_DestroyClipPath=X("FPDF_DestroyClipPath",1),t._FPDFPage_InsertClipPath=X("FPDFPage_InsertClipPath",2),t._FPDF_InitLibrary=X("FPDF_InitLibrary",0),t._FPDF_InitLibraryWithConfig=X("FPDF_InitLibraryWithConfig",1),t._FPDF_DestroyLibrary=X("FPDF_DestroyLibrary",0),t._FPDF_SetSandBoxPolicy=X("FPDF_SetSandBoxPolicy",2),t._FPDF_LoadDocument=X("FPDF_LoadDocument",2),t._FPDF_GetFormType=X("FPDF_GetFormType",1),t._FPDF_LoadXFA=X("FPDF_LoadXFA",1),t._FPDF_LoadMemDocument=X("FPDF_LoadMemDocument",3),t._FPDF_LoadMemDocument64=X("FPDF_LoadMemDocument64",3),t._FPDF_LoadCustomDocument=X("FPDF_LoadCustomDocument",2),t._FPDF_GetFileVersion=X("FPDF_GetFileVersion",2),t._FPDF_DocumentHasValidCrossReferenceTable=X("FPDF_DocumentHasValidCrossReferenceTable",1),t._FPDF_GetDocPermissions=X("FPDF_GetDocPermissions",1),t._FPDF_GetDocUserPermissions=X("FPDF_GetDocUserPermissions",1),t._FPDF_GetSecurityHandlerRevision=X("FPDF_GetSecurityHandlerRevision",1),t._EPDF_SetEncryption=X("EPDF_SetEncryption",4),t._EPDF_RemoveEncryption=X("EPDF_RemoveEncryption",1),t._EPDF_UnlockOwnerPermissions=X("EPDF_UnlockOwnerPermissions",2),t._EPDF_CheckPasswordPermissions=X("EPDF_CheckPasswordPermissions",6),t._EPDF_SetRuntimeOwnerPermissions=X("EPDF_SetRuntimeOwnerPermissions",2),t._EPDF_IsEncrypted=X("EPDF_IsEncrypted",1),t._EPDF_IsOwnerUnlocked=X("EPDF_IsOwnerUnlocked",1),t._FPDF_GetPageCount=X("FPDF_GetPageCount",1),t._FPDF_LoadPage=X("FPDF_LoadPage",2),t._EPDFDoc_LoadPageByObjectNumber=X("EPDFDoc_LoadPageByObjectNumber",2),t._EPDFDoc_LoadPageByObjectNumberNormalized=X("EPDFDoc_LoadPageByObjectNumberNormalized",2),t._EPDFDoc_GetPageObjectNumberByIndex=X("EPDFDoc_GetPageObjectNumberByIndex",2),t._EPDFDoc_DeletePageByObjectNumber=X("EPDFDoc_DeletePageByObjectNumber",2),t._EPDFDoc_SetPageRotationByObjectNumber=X("EPDFDoc_SetPageRotationByObjectNumber",3),t._EPDFDoc_StartLoadPageByObjectNumber=X("EPDFDoc_StartLoadPageByObjectNumber",3),t._EPDFPage_ContinueLoad=X("EPDFPage_ContinueLoad",2),t._EPDFPage_GetObjectNumber=X("EPDFPage_GetObjectNumber",1),t._FPDF_GetPageWidthF=X("FPDF_GetPageWidthF",1),t._FPDF_GetPageWidth=X("FPDF_GetPageWidth",1),t._FPDF_GetPageHeightF=X("FPDF_GetPageHeightF",1),t._FPDF_GetPageHeight=X("FPDF_GetPageHeight",1),t._FPDF_GetPageBoundingBox=X("FPDF_GetPageBoundingBox",2),t._FPDF_RenderPageBitmap=X("FPDF_RenderPageBitmap",8),t._FPDF_RenderPageBitmapWithMatrix=X("FPDF_RenderPageBitmapWithMatrix",5),t._EPDF_RenderAnnotBitmap=X("EPDF_RenderAnnotBitmap",7),t._EPDF_RenderAnnotBitmapUnrotated=X("EPDF_RenderAnnotBitmapUnrotated",9),t._EPDF_SetDecodedImageBudget=X("EPDF_SetDecodedImageBudget",1),t._EPDF_GetDecodedImageBytes=X("EPDF_GetDecodedImageBytes",0),t._EPDFPage_ResetRenderCache=X("EPDFPage_ResetRenderCache",1),t._FPDF_ClosePage=X("FPDF_ClosePage",1),t._FPDF_CloseDocument=X("FPDF_CloseDocument",1),t._FPDF_GetLastError=X("FPDF_GetLastError",0),t._FPDF_DeviceToPage=X("FPDF_DeviceToPage",10),t._FPDF_PageToDevice=X("FPDF_PageToDevice",10),t._FPDFBitmap_Create=X("FPDFBitmap_Create",3),t._FPDFBitmap_CreateEx=X("FPDFBitmap_CreateEx",5),t._FPDFBitmap_GetFormat=X("FPDFBitmap_GetFormat",1),t._FPDFBitmap_FillRect=X("FPDFBitmap_FillRect",6),t._FPDFBitmap_GetBuffer=X("FPDFBitmap_GetBuffer",1),t._FPDFBitmap_GetWidth=X("FPDFBitmap_GetWidth",1),t._FPDFBitmap_GetHeight=X("FPDFBitmap_GetHeight",1),t._FPDFBitmap_GetStride=X("FPDFBitmap_GetStride",1),t._FPDFBitmap_Destroy=X("FPDFBitmap_Destroy",1),t._FPDF_GetPageSizeByIndexF=X("FPDF_GetPageSizeByIndexF",3),t._EPDF_GetPageRotateByIndex=X("EPDF_GetPageRotateByIndex",3),t._EPDF_GetPageTabOrderByIndex=X("EPDF_GetPageTabOrderByIndex",4),t._EPDF_GetPageBoxByIndex=X("EPDF_GetPageBoxByIndex",4),t._EPDF_GetPageUserUnitByIndex=X("EPDF_GetPageUserUnitByIndex",3),t._EPDF_LoadPageNormalized=X("EPDF_LoadPageNormalized",3),t._FPDF_GetPageSizeByIndex=X("FPDF_GetPageSizeByIndex",4),t._FPDF_VIEWERREF_GetPrintScaling=X("FPDF_VIEWERREF_GetPrintScaling",1),t._FPDF_VIEWERREF_GetNumCopies=X("FPDF_VIEWERREF_GetNumCopies",1),t._FPDF_VIEWERREF_GetPrintPageRange=X("FPDF_VIEWERREF_GetPrintPageRange",1),t._FPDF_VIEWERREF_GetPrintPageRangeCount=X("FPDF_VIEWERREF_GetPrintPageRangeCount",1),t._FPDF_VIEWERREF_GetPrintPageRangeElement=X("FPDF_VIEWERREF_GetPrintPageRangeElement",2),t._FPDF_VIEWERREF_GetDuplex=X("FPDF_VIEWERREF_GetDuplex",1),t._FPDF_VIEWERREF_GetName=X("FPDF_VIEWERREF_GetName",4),t._FPDF_CountNamedDests=X("FPDF_CountNamedDests",1),t._FPDF_GetNamedDestByName=X("FPDF_GetNamedDestByName",2),t._FPDF_GetNamedDest=X("FPDF_GetNamedDest",4),t._FPDF_GetXFAPacketCount=X("FPDF_GetXFAPacketCount",1),t._FPDF_GetXFAPacketName=X("FPDF_GetXFAPacketName",4),t._FPDF_GetXFAPacketContent=X("FPDF_GetXFAPacketContent",5),t._FPDF_GetTrailerEnds=X("FPDF_GetTrailerEnds",3);var eJ=X("fflush",1),eQ=X("strerror",1),eX=X("emscripten_builtin_memalign",2);t._malloc=X("malloc",1),t._free=X("free",1);var eY=X("setThrew",2);X("_emscripten_tempret_set",1);var e0=()=>(e0=eZ.emscripten_stack_init)(),e1=()=>(e1=eZ.emscripten_stack_get_end)(),e3=e=>(e3=eZ._emscripten_stack_restore)(e),e2=e=>(e2=eZ._emscripten_stack_alloc)(e),e6=()=>(e6=eZ.emscripten_stack_get_current)();function e5(){var e,r;if(!(U>0)){if(e0(),M((3&(e=e1()))==0),0==e&&(e+=4),f[e>>>2>>>0]=0x2135467,f[e+4>>>2>>>0]=0x89bacdfe,f[0]=0x63736d65,t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)r=t.preRun.shift(),B.unshift(r);eu(B),U>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>t.setStatus(""),1),i()},1)):i(),T())}function i(){if(!D&&(D=!0,t.calledRun=!0,!j)){if(M(!z),z=!0,T(),t.noFSInit||eN.initialized||eN.init(),eN.ignorePermissions=!1,ev.init(),eu(L),n(t),t.onRuntimeInitialized?.(),M(!t._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),T(),t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;){var e;e=t.postRun.shift(),$.unshift(e)}eu($)}}}if(t.dynCall_jiji=X("dynCall_jiji",5),t.dynCall_iiiiij=X("dynCall_iiiiij",7),t.dynCall_iiiiijj=X("dynCall_iiiiijj",9),t.dynCall_iiiiiijj=X("dynCall_iiiiiijj",10),t.dynCall_viijii=X("dynCall_viijii",7),t.dynCall_ji=X("dynCall_ji",2),t.dynCall_iiij=X("dynCall_iiij",5),t.dynCall_j=X("dynCall_j",1),t.dynCall_iji=X("dynCall_iji",4),t.dynCall_jji=X("dynCall_jji",4),t.dynCall_iiji=X("dynCall_iiji",5),t.dynCall_viijj=X("dynCall_viijj",7),t.dynCall_jij=X("dynCall_jij",4),t.dynCall_iij=X("dynCall_iij",4),t.dynCall_viji=X("dynCall_viji",5),t.wasmExports=eZ,t.ccall=eH,t.cwrap=(e,t,n,r)=>(...i)=>eH(e,t,n,i,r),t.addFunction=(e,t)=>{M(void 0!==e);var n=(e=>{if(!P){P=new WeakMap;var t=_.length;if(P)for(var n=0;n<0+t;n++){var r=ez(n);r&&P.set(r,n)}}return P.get(e)||0})(e);if(n)return n;var r=(()=>{if(eW.length)return eW.pop();try{_.grow(1)}catch(e){if(!(e instanceof RangeError))throw e;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return _.length-1})();try{eq(r,e)}catch(n){if(!(n instanceof TypeError))throw n;M(void 0!==t,"Missing signature argument to addFunction: "+e),eq(r,((e,t)=>{if(M(!t.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled"),"function"==typeof WebAssembly.Function)return new WebAssembly.Function((e=>{M(!e.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled");for(var t={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},n={parameters:[],results:"v"==e[0]?[]:[t[e[0]]]},r=1;r{P.delete(ez(e)),eq(e,null),eW.push(e)},t.setValue=function(e,t,n="i8"){switch(n.endsWith("*")&&(n="*"),n){case"i1":case"i8":s[e>>>0]=t;break;case"i16":u[e>>>1>>>0]=t;break;case"i32":c[e>>>2>>>0]=t;break;case"i64":J("to do setValue(i64) use WASM_BIGINT");case"float":m[e>>>2>>>0]=t;break;case"double":p[e>>>3>>>0]=t;break;case"*":f[e>>>2>>>0]=t;break;default:J(`invalid type for setValue: ${n}`)}},t.getValue=function(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return s[e>>>0];case"i16":return u[e>>>1>>>0];case"i32":return c[e>>>2>>>0];case"i64":J("to do getValue(i64) use WASM_BIGINT");case"float":return m[e>>>2>>>0];case"double":return p[e>>>3>>>0];case"*":return f[e>>>2>>>0];default:J(`invalid type for getValue: ${t}`)}},t.UTF8ToString=eg,t.stringToUTF8=ej,t.UTF16ToString=(e,t)=>{M(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var n=e,r=n>>1,i=r+t/2;!(r>=i)&&d[r>>>0];)++r;if((n=r<<1)-e>32&&eU)return eU.decode(l.subarray(e>>>0,n>>>0));for(var o="",a=0;!(a>=t/2);++a){var s=u[e+2*a>>>1>>>0];if(0==s)break;o+=String.fromCharCode(s)}return o},t.stringToUTF16=(e,t,n)=>{if(M(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),M("number"==typeof n,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),n??(n=0x7fffffff),n<2)return 0;for(var r=t,i=(n-=2)<2*e.length?n/2:e.length,o=0;o>>1>>>0]=a,t+=2}return u[t>>>1>>>0]=0,t-r},["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertU32PairToI53","getTempRet0","setTempRet0","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","readEmAsmArgs","jstoi_q","listenOnce","autoResumeAudioContext","dynCallLegacy","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","checkWasiClock","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","safeSetTimeout","setImmediateWrapped","safeRequestAnimationFrame","clearImmediateWrapped","polyfillSetImmediate","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","ExceptionInfo","findMatchingCatch","Browser_asyncPrepareDataCounter","arraySum","addDays","getSocketFromFD","getSocketAddress","FS_unlink","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace"].forEach(function(e){eo(e,()=>{var t=`\`${e}\` 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=e;n.startsWith("_")||(n="$"+e),t+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${n}')`,ei(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),em(t)}),es(e)}),["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","out","err","callMain","abort","wasmMemory","writeStackCookie","checkStackCookie","convertI32PairToI53Checked","stackSave","stackRestore","stackAlloc","ptrToString","zeroMemory","exitJS","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","jstoi_s","getExecutableName","keepRuntimeAlive","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","freeTableIndexes","functionsInTableMap","getEmptyTableSlot","updateTableMap","getFunctionAddress","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","stringToUTF8Array","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","stringToUTF8OnStack","writeArrayToMemory","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","doReadv","doWritev","initRandomFill","randomFill","promiseMap","uncaughtExceptionCount","exceptionLast","exceptionCaught","Browser","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","ydayFromDate","SYSCALLS","preloadPlugins","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_createPath","FS_createDevice","FS_readFile","FS","FS_createDataFile","FS_createLazyFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack","print","printErr"].forEach(es),W=function e(){D||e5(),D||(W=e)},t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();for(let e of(e5(),Object.keys(t)))e in t||Object.defineProperty(t,e,{configurable:!0,get(){J(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return y}}},function(){if(r)throw r[0];try{return t&&(n=(0,t[E(t)[0]])(t=0)),n}catch(e){throw r=[e],e}}),G={Unknown:"Unknown",InvalidArg:"InvalidArg",DocNotOpen:"DocNotOpen",DocOpenFailed:"DocOpenFailed",DocPasswordRequired:"DocPasswordRequired",DocPasswordIncorrect:"DocPasswordIncorrect",GrantPassphraseRequired:"GrantPassphraseRequired",Aborted:"Aborted",Network:"Network",Unauthenticated:"Unauthenticated",Forbidden:"Forbidden",NotFound:"NotFound",WireFormat:"WireFormat",RuntimeUnavailable:"RuntimeUnavailable",LayerVersionConflict:"LayerVersionConflict",NotImplemented:"NotImplemented",MalformedPdf:"MalformedPdf",SigningPending:"SigningPending",SigningExpired:"SigningExpired",SigningVersionMismatch:"SigningVersionMismatch",SignatureRefused:"SignatureRefused",ProtectedDocument:"ProtectedDocument",PayloadTooLarge:"PayloadTooLarge",ObjectNumberUnavailable:"ObjectNumberUnavailable",LayerFull:"LayerFull",ChangeConflict:"ChangeConflict",UndoUnavailable:"UndoUnavailable",IdempotencyKeyReused:"IdempotencyKeyReused",LayerDeleted:"LayerDeleted",VisitorIdentityRequired:"VisitorIdentityRequired",Conflict:"Conflict",EngineBusy:"EngineBusy",EngineRestarting:"EngineRestarting",DocumentQuarantined:"DocumentQuarantined",ThumbnailNotReady:"ThumbnailNotReady",TooManyRequests:"TooManyRequests",GrantExpired:"GrantExpired",OriginRequired:"OriginRequired",OriginNotAllowed:"OriginNotAllowed",FeatureNotEnabled:"FeatureNotEnabled",FeatureStopped:"FeatureStopped",LicenseInvalid:"LicenseInvalid",LicenseUsageLimit:"LicenseUsageLimit",UpstreamError:"UpstreamError"};function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(e,t,n){var r;return(r=function(e,t){if("object"!=O(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=O(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==O(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.values(G);var N=class e extends Error{constructor(e,t,n={}){super(t??e,void 0===n.cause?void 0:{cause:n.cause}),I(this,"name","EngineError"),I(this,"code",void 0),I(this,"details",void 0),this.code=e,this.details=n.details}static is(t,n){return(t instanceof e||t?.name==="EngineError")&&(void 0===n||t.code===n)}toJSON(){return{code:this.code,message:this.message,details:this.details}}};function C(e){return N.is(e)?e.toJSON():e instanceof Error?{code:"AbortError"===e.name?G.Aborted:G.Unknown,message:e.message}:{code:G.Unknown,message:String(e??"unknown error")}}var j=e=>{let t=t=>(e&1<[[1,e.exclude],[2,e.includeNoValueFields],[3,"html"===e.format],[4,"get"===e.method],[5,e.submitCoordinates],[6,"xfdf"===e.format],[7,e.includeAppendSaves],[8,e.includeAnnotations],[9,"pdf"===e.format],[10,e.canonicalFormat],[11,e.exclNonUserAnnots],[12,e.exclFKey],[14,e.embedForm]].reduce((e,[t,n])=>n?e|1<null!=e&&!("root"in e)&&R(e))}function B(e){return e.incomplete||!e.root?null:function e(t){let n=[];for(let r of t.next){let t=e(r);if(!t)return null;n.push(t)}let r=n.length>0?{next:n}:{};switch(t.type){case"javascript":return{type:"javascript",script:t.script,...r};case"goto":return{type:"goto",destination:t.destination,...r};case"uri":return{type:"uri",uri:t.uri,...r};case"named":return{type:"named",name:t.name,...r};case"hide":return{type:"hide",targets:t.targets,hide:t.hide,...r};case"reset-form":return{type:"reset-form",fields:t.fields,exclude:t.exclude,...r};case"submit-form":return t.payload?{...function(e){let{url:t,fields:n,charSet:r,...i}=e;return i}(t.payload),type:"submit-form",url:t.payload.url,fields:t.payload.fields,...r}:null;default:return null}}(e.root)}var L={javascript:"JavaScript",goto:"GoTo",uri:"URI",named:"Named",hide:"Hide","reset-form":"ResetForm","submit-form":"SubmitForm"};function $(e){return{root:function e(t){let n={subtype:L[t.type],next:(t.next??[]).map(e)};switch(t.type){case"javascript":return{type:"javascript",script:t.script,...n};case"goto":return{type:"goto",destination:t.destination,...n};case"uri":return{type:"uri",uri:t.uri,isMap:!1,...n};case"named":return{type:"named",name:t.name,...n};case"hide":return{type:"hide",targets:t.targets,hide:t.hide,...n};case"reset-form":return{type:"reset-form",fields:t.fields,exclude:t.exclude,...n};case"submit-form":return{type:"submit-form",payload:{url:t.url,fields:t.fields,...j(M(t))},...n}}}(e),incomplete:!1,warnings:[]}}var z=["activate","cursorEnter","cursorExit","mouseDown","mouseUp","focus","blur","pageOpen","pageClose","pageVisible","pageInvisible"];function U(e){let t=B(e);return t&&V(t)?t:null}function V(e){return"javascript"===e.type&&(e.next??[]).every(V)}function W(e){return"number"==typeof e&&Number.isInteger(e)&&e>0}function q(e){return{kind:"objectNumber",objectNumber:e}}function H(e){if(!W(e.objectNumber))throw RangeError(`encodePageKey: objectNumber must be a positive integer, got ${e.objectNumber}`);return`obj:${e.objectNumber}`}function K(e){switch(e.kind){case"objectNumber":return`obj:${e.objectNumber}`;case"baseIndex":return`base:${e.page.objectNumber}:${e.baseIndex}`}}var Z=["courier","courier-bold","courier-bold-oblique","courier-oblique","helvetica","helvetica-bold","helvetica-bold-oblique","helvetica-oblique","times-roman","times-bold","times-bold-italic","times-italic","symbol","zapf-dingbats"],J={invisible:!1,hidden:!1,print:!1,noZoom:!1,noRotate:!1,noView:!1,readOnly:!1,locked:!1,toggleNoView:!1,lockedContents:!1};function Q(e){return void 0!==e.layout?e:{...e,layout:"pushbutton"===e.fieldKind?"caption":null}}function X(e){return null===e?{kind:"unassigned"}:{kind:"group",groupId:e}}function Y(e){return"group"===e.kind?e.groupId:null}function ee(e){return eo(er(e)??{kind:"unassigned"},e.kind)}function et(e,t){let n=er(e);return void 0===n?t.assignment:eo(n,t.kind)}function en(e){if(void 0!==e.assignment)return e;let t="string"==typeof e.groupId?e.groupId:null;return{...e,assignment:X(t)}}function er(e){if(void 0!==e.assignment&&void 0!==e.groupId)throw ea("assignment",'name a field\'s assignment or its groupId, not both: { kind: "group", groupId } says both');return void 0!==e.assignment?function(e){let t=null!==e&&"object"==typeof e?e.kind:void 0;if("anyone"===t||"unassigned"===t)return{kind:t};if("group"===t){let n=e.groupId;return ei(n,"assignment"),{kind:t,groupId:n}}throw ea("assignment","a field's assignment is { kind: 'group', groupId }, { kind: 'anyone' } or { kind: 'unassigned' }")}(e.assignment):void 0!==e.groupId?(null!==e.groupId&&ei(e.groupId,"groupId"),X(e.groupId)):void 0}function ei(e,t){if("string"!=typeof e||e.length<1||e.length>256)throw ea(t,`a field's groupId is 1 to 256 characters${"groupId"===t?", or null for no group":""}`)}function eo(e,t){if("anyone"===e.kind&&"signature"===t)throw ea("assignment","a signature field is signed by one signer, so it is never for anyone");return e}function ea(e,t){return new N(G.InvalidArg,t,{details:{field:e}})}function es(e){return void 0===e.lockedBy?{...e,lockedBy:null}:e}function el(e){if("pushbutton"!==e.kind)return e;let t=void 0===e.hasImage,n=void 0===e.takesImage;return t||n?{...e,...t?{hasImage:!1}:{},...n?{takesImage:!1}:{}}:e}var eu=Object.freeze(["m/d","m/d/yy","mm/dd/yy","mm/yy","d-mmm","d-mmm-yy","dd-mmm-yy","yy-mm-dd","mmm-yy","mmmm-yy","mmm d, yyyy","mmmm d, yyyy","m/d/yy h:MM tt","m/d/yy HH:MM"]),ed=Object.freeze(["HH:MM","h:MM tt","HH:MM:ss","h:MM:ss tt"]),ec=new Map([["yyyy",{part:"year",written:"digits"}],["yy",{part:"year",written:"digits"}],["mmmm",{part:"month",written:"letters"}],["mmm",{part:"month",written:"letters"}],["mm",{part:"month",written:"digits"}],["m",{part:"month",written:"digits"}],["dd",{part:"day",written:"digits"}],["d",{part:"day",written:"digits"}]]),ef=/(?:HH|H|hh|h):MM(?::ss)?(?: *tt)?/;function em(e){let t={written:[],groups:[]};for(let n of e.match(/([A-Za-z])\1*|[^A-Za-z]/g)??[]){let e=ec.get(n);if(e)t.written.push(e.written),t.groups.push(e.part);else{if(!" /-.,".includes(n))return null;t.written.push("separator")}}return t}function ep(e){if("string"!=typeof e||e.length<1||e.length>64)return!1;let t=ef.exec(e),n=em(t?e.slice(0,t.index):e),r=em(t?e.slice(t.index+t[0].length):"");if(!n||!r)return!1;let i=[...n.groups,...r.groups];if(0===i.length||new Set(i).size!==i.length)return!1;let o=t?["digits",t[0].endsWith("tt")?"letters":"digits"]:[],a=[...n.written,...o,...r.written];return!a.some((e,t)=>"digits"===e&&"digits"===a[t+1]&&t!==n.written.length)}var eh=RegExp(`^${ef.source}$`);function eF(e){return"string"==typeof e&&e.length<=64&&eh.test(e)}function eg(e){return"text"===e||"combobox"===e}var e_={date:{format:"AFDate_FormatEx",numberedFormat:"AFDate_Format",keystroke:"AFDate_KeystrokeEx",numberedKeystroke:"AFDate_Keystroke",standard:eu,isPattern:ep},time:{format:"AFTime_FormatEx",numberedFormat:"AFTime_Format",keystroke:"AFTime_KeystrokeEx",numberedKeystroke:"AFTime_Keystroke",standard:ed,isPattern:eF}},eP=["date","time"];function eD(e,t,n,r){let i=e.trim();i.endsWith(";")&&(i=i.slice(0,-1).trimEnd());let o=/^([A-Za-z_]+)\(\s*(?:(["'])([^"'\\]*)\2|(\d{1,2}))\s*\)$/.exec(i);if(!o)return null;let[,a,,s,l]=o,{isPattern:u,standard:d}=e_[t];return a===n&&void 0!==s?u(s)?s:null:a===r&&void 0!==l?d[Number(l)]??null:null}function eb(e){let t=e?.format;if(null==t)return null;if("object"!=typeof t)return{kind:"other"};let n=ew(t);return null===n?{kind:"other"}:function(e){for(let t of eP){let n=e_[t],r=eD(e,t,n.format,n.numberedFormat);if(null!==r)return{kind:t,pattern:r}}return{kind:"other"}}(n)}function ey(e){let t=void 0===e.purpose,n=void 0===e.format&&"string"==typeof e.kind&&eg(e.kind);return t||n?{...e,...t?{purpose:null}:{},...n?{format:eb(e.actions)}:{}}:e}function ew(e){let t=e.root;return!1===e.incomplete&&t&&"javascript"===t.type&&Array.isArray(t.next)&&!(t.next.length>0)&&"string"==typeof t.script?t.script:null}function eE(e){var t;let n=e_[e.kind];return{format:`${n.format}("${e.pattern}");`,keystroke:"date"===e.kind?`${n.keystroke}("${e.pattern}");`:`${n.numberedKeystroke}(${2*!!(t=e.pattern).includes("ss")+ +!!t.includes("tt")});`}}function eA(e){if(null===e)return{keystroke:null,format:null};let t=eE(e),n=e=>({type:"javascript",script:e});return{keystroke:n(t.keystroke),format:n(t.format)}}function ev(e){return null!==e&&"other"!==e.kind}function eS(e,t){return null===e||null===t?e===t:e.kind===t.kind&&("other"===e.kind||e.pattern===t.pattern)}var ek={date:"a date format's pattern is 1 to 64 characters: the groups yyyy yy mmmm mmm mm m dd d, at least one of them and the year, the month and the day each once at most, with spaces and / - . , between them, and at most one time (HH, H, hh or h, then :MM, then :ss and tt when it has them); two groups written in digits never touch",time:"a time format's pattern is a time and nothing else, at most 64 characters: HH, H, hh or h, then :MM, then :ss when it has seconds, then tt when it has one"};function ex(e,t){if(void 0===e.format)return;if(!eg(t))throw new N(G.InvalidArg,`'format' does not apply to a ${t} field`,{details:{field:"format"}});let n=function(e){if(null===e)return null;let t="object"==typeof e?e:{};if("other"===t.kind)throw new N(G.InvalidArg,"a format of kind 'other' is read, never written: write its scripts in actions",{details:{field:"format"}});if("date"!==t.kind&&"time"!==t.kind)throw new N(G.InvalidArg,"a field's format is a date or a time with a pattern, or null for none",{details:{field:"format"}});let{pattern:n}=t;if(!e_[t.kind].isPattern(n))throw new N(G.InvalidArg,ek[t.kind],{details:{field:"format.pattern"}});return{kind:t.kind,pattern:n}}(e.format);for(let t of["format","keystroke"])if(e.actions?.[t]!==void 0)throw new N(G.InvalidArg,`'format' writes the field's ${t} script: name it or actions.${t}, not both`,{details:{field:`actions.${t}`}});return n}function eG(e){return $({type:"javascript",script:e})}function eO(e){return"string"==typeof e&&e.length>=1&&e.length<=256&&e.trim()===e&&!e.includes("\0")}function eI(e,t){if(null==e)return null;if(!eO(e))throw new N(G.InvalidArg,`a field's ${t} is 1 to 256 characters with no space at its start or end and no NUL character, or null for none`,{details:{field:t}});return e}function eN(e){return eO(e)}function eC(e){return eI(e,"placeholder")}function ej(e){return void 0!==e.placeholder?e:{...e,placeholder:null}}function eM(e){if("objectNumber"===e.kind){if(!Number.isInteger(e.objectNumber)||e.objectNumber<=0)throw RangeError(`encodeFieldRefKey: objectNumber must be a positive integer, got ${e.objectNumber}`);return`obj:${e.objectNumber}`}return`fqn:${e.name}`}function eR(e,t){return{ref:e>0&&t?{kind:"objectNumber",page:t,objectNumber:e}:null,objectNumber:e,page:t}}var eT=(e,t)=>e.replace(/\B(?=(\d{3})+(?!\d))/g,()=>t),eB=(e,t)=>t?eB(t,e%t):e;function eL(e){let t=Math.fround(e.conversion??0/0);if(!Number.isFinite(t)||t<=0)return!1;let n=e.precision??("fraction"===e.fraction?16:100);return!!Number.isInteger(n)&&!(n<1)&&!(n>0x7fffffff)&&((e.fraction??"decimal")!=="decimal"||!!Number.isInteger(Math.log10(n)))}function e$(e,t){if(!Number.isFinite(e)||!t.length||!t.every(eL))throw new N(G.InvalidArg,"Measurement requires a finite value and valid number formats");let n=Math.abs(e),r=[];for(let[e,i]of t.entries()){if(!Number.isFinite(n*=Math.fround(i.conversion)))throw new N(G.InvalidArg,"Measurement overflow");let o=Math.floor(n),a=n-o,s=e===t.length-1,l=s||0===a,u=s?function(e,t){let n=t.fraction??"decimal",r=t.thousands??",";if("round"===n)return eT(String(Math.round(e)),r);if("truncate"===n)return eT(String(Math.trunc(e)),r);if("fraction"===n){let n=t.precision??16,i=Math.floor(e),o=Math.round((e-i)*n);if(o===n&&(i++,o=0),!o)return eT(String(i),r);let a=t.fixed?1:eB(o,n);return`${i?`${eT(String(i),r)} `:""}${o/a}/${n/a}`}let i=Math.log10(t.precision??100),[o,a=""]=e.toFixed(i).split(".");return eT(o,r)+(a?(t.decimal||".")+a:"")}(n,i):eT(String(o),i.thousands??","),d="prefix"===i.labelPosition,c=i.prefixSpacing??(d&&0===e?"":" "),f=i.suffixSpacing??(!d&&l?"":" "),m=c+i.unit+f;if(r.push(d?m+u:u+m),l)break;n=a}return(e<0?"-":"")+r.join("")}var ez={courier:{family:"Courier",weight:400,italic:!1},"courier-bold":{family:"Courier",weight:700,italic:!1},"courier-bold-oblique":{family:"Courier",weight:700,italic:!0},"courier-oblique":{family:"Courier",weight:400,italic:!0},helvetica:{family:"Helvetica",weight:400,italic:!1},"helvetica-bold":{family:"Helvetica",weight:700,italic:!1},"helvetica-bold-oblique":{family:"Helvetica",weight:700,italic:!0},"helvetica-oblique":{family:"Helvetica",weight:400,italic:!0},"times-roman":{family:"Times",weight:400,italic:!1},"times-bold":{family:"Times",weight:700,italic:!1},"times-bold-italic":{family:"Times",weight:700,italic:!0},"times-italic":{family:"Times",weight:400,italic:!0},symbol:{family:"Symbol",weight:400,italic:!1},"zapf-dingbats":{family:"ZapfDingbats",weight:400,italic:!1}};function eU(e,t){if(Z.includes(e)){let t=ez[e];return{family:t.family,weight:t.weight,italic:t.italic}}let n=t?.(e);return n?{family:n.familyName,weight:n.weight,italic:n.italic}:{family:e}}function eV(e){return e.toLowerCase().replace(/[\s\-_'"]/g,"")}var eW={helvetica:"Helvetica",arial:"Helvetica",arialmt:"Helvetica",sansserif:"Helvetica",times:"Times",timesroman:"Times",timesnewroman:"Times",timesnewromanpsmt:"Times",serif:"Times",courier:"Courier",couriernew:"Courier",couriernewpsmt:"Courier",monospace:"Courier",symbol:"Symbol",zapfdingbats:"ZapfDingbats",dingbats:"ZapfDingbats"};function eq(e){if("object"!=typeof e||null===e)return!1;let{left:t,bottom:n,right:r,top:i}=e;return[t,n,r,i].every(e=>"number"==typeof e&&Number.isFinite(e))}function eH(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),bottom:Math.min(e.top,e.bottom),top:Math.max(e.top,e.bottom)}}var eK=e=>Number.isFinite(e.x)&&Number.isFinite(e.y);function eZ([e,t,n,r]){if(![e,t,n,r].every(eK))return!1;let i={x:t.x-e.x,y:t.y-e.y},o={x:r.x-n.x,y:r.y-n.y},a={x:n.x-e.x,y:n.y-e.y},s={x:r.x-t.x,y:r.y-t.y},l=[i,o,a,s].map(e=>Math.hypot(e.x,e.y));if(l.some(e=>e<=1e-6)||i.x*o.x+i.y*o.y<=0||a.x*s.x+a.y*s.y<=0)return!1;let u=i.x*a.y-i.y*a.x,d=o.x*s.y-o.y*s.x;return!(Math.abs(u)<=1e-6*l[0]*l[2]||Math.abs(d)<=1e-6*l[1]*l[3])&&Math.sign(u)===Math.sign(d)}function eJ(e,t){let n=eQ(t);if(null!==n)return eX(e,n);let r=t*Math.PI/180,i=Math.abs(Math.cos(r)),o=Math.abs(Math.sin(r)),a=e.right-e.left,s=e.top-e.bottom,l=(a*i+s*o)/2,u=(a*o+s*i)/2,d=(e.left+e.right)/2,c=(e.bottom+e.top)/2;return{left:d-l,bottom:c-u,right:d+l,top:c+u}}function eQ(e){let t=(e%360+360)%360;return t%90==0?t:null}function eX(e,t){if(0===t||180===t)return e;let n=(e.left+e.right)/2,r=(e.bottom+e.top)/2,i=(e.top-e.bottom)/2,o=(e.right-e.left)/2;return{left:n-i,bottom:r-o,right:n+i,top:r+o}}function eY(e,t){let n=.01+1e-4*Math.max(e.right-e.left,e.top-e.bottom,t.right-t.left,t.top-t.bottom);return Math.abs(e.left-t.left)<=n&&Math.abs(e.bottom-t.bottom)<=n&&Math.abs(e.right-t.right)<=n&&Math.abs(e.top-t.top)<=n}function e0(e){if(0===e.length)return{left:0,bottom:0,right:0,top:0};let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let{x:o,y:a}of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),i=Math.max(i,a);return{left:t,bottom:n,right:r,top:i}}function e1(e,t){let n=t.degrees*Math.PI/180,r=Math.cos(n),i=Math.sin(n),o=e.x-t.center.x,a=e.y-t.center.y;return{x:t.center.x+o*r+a*i,y:t.center.y-o*i+a*r}}function e3(e,t){return e1(e,{degrees:-t.degrees,center:t.center})}function e2(e,t){return e.replace(/\r\n|\r|\n/g,t)}var e6={family:"Helvetica",weight:400,italic:!1,size:12,color:"#000000",decoration:[],script:"normal",letterSpacing:0,horizontalScale:1,align:"left",dir:"ltr"};function e5(e){return e2(e.paragraphs.map(e=>e.runs.map(e=>e.text).join("")).join(` `),` `)}function e4(e){return e.split(/\r\n|\r|\n/).map(e=>({runs:[{text:e}]}))}var e8=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");function e7(e,t,n){return`#${e8(e)}${e8(t)}${e8(n)}`}function e9(e){let t=Number.parseInt(e.slice(1),16);return{r:t>>16&255,g:t>>8&255,b:255&t}}var te={highlight:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},underline:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},squiggly:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},strikeout:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data",intent:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},circle:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",box:"data",rotation:"data",cloudyIntensity:"data"},readBack:["rect","borderStyle"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{}},square:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",box:"data",rotation:"data",cloudyIntensity:"data"},readBack:["rect","borderStyle"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{}},polygon:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",vertices:"data",rotation:"data",captionEnabled:"data",captionCenter:"data",intent:"data",measure:"data",cloudyIntensity:"data"},readBack:["rect","borderStyle","vertices"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",vertices:"points",captionCenter:"point",measure:"measure"},resources:{}},polyline:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",vertices:"data",rotation:"data",captionEnabled:"data",captionCenter:"data",intent:"data",measure:"data",lineEndings:"data"},readBack:["rect","borderStyle","vertices"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",vertices:"points",captionCenter:"point",measure:"measure"},resources:{}},line:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",interiorColor:"data",linePoints:"data",lineEndings:"data",rotation:"data",intent:"data",measure:"data",captionEnabled:"data",captionPosition:"data",captionOffset:"data",leader:"data"},readBack:["rect","borderStyle"],colors:["color","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",linePoints:"linePoints",measure:"measure"},resources:{}},link:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",target:"data"},readBack:["target"],colors:[],spaces:{rect:"box",actions:"actions",target:"linkTarget"},resources:{}},ink:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",inkList:"data",intent:"data",rotation:"data"},readBack:["rect","strokeWidth","borderStyle","inkList"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",inkList:"strokes"},resources:{}},"free-text":{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",box:"data",rotation:"data",intent:"data",fontFamily:"data",fontSize:"data",textAlign:"data",verticalAlign:"data",color:"data",fontColor:"data",interiorColor:"data",opacity:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",cloudyIntensity:"data",calloutLine:"data",lineEnding:"data"},readBack:["rect","intent","borderStyle"],colors:["color","fontColor","interiorColor"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box",calloutLine:"calloutLine"},resources:{}},caret:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",box:"data",rotation:"data",intent:"data"},readBack:["rect"],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{}},text:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",icon:"data",open:"data",state:"data",stateModel:"data"},readBack:[],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length"},resources:{}},stamp:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",box:"data",rotation:"data",name:"data",fit:"data",opacity:"data"},readBack:["rect"],colors:[],spaces:{rect:"box",actions:"actions",richText:"length",box:"box"},resources:{appearance:"required"}},"file-attachment":{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",icon:"data",file:"data"},readBack:[],colors:["color"],spaces:{rect:"box",actions:"actions",richText:"length"},resources:{file:"required"}},widget:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"engine",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"data",box:"data",rotation:"data",color:"data",interiorColor:"data",strokeWidth:"data",borderStyle:"data",dashArray:"data",fontFamily:"data",fontSize:"data",fontColor:"data",textAlign:"data",caption:"data",checkStyle:"data",layout:"data",field:"engine",fieldKind:"engine",hasMark:"engine"},readBack:["rect","actions"],colors:["color","interiorColor","fontColor"],spaces:{rect:"box",actions:"actions",box:"box"},resources:{}},redact:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",richText:"data",color:"data",opacity:"data",quadPoints:"data",interiorColor:"data",overlayText:"data",repeat:"data",fontFamily:"data",fontSize:"data",fontColor:"data",textAlign:"data"},readBack:[],colors:["color","interiorColor","fontColor"],spaces:{rect:"box",actions:"actions",richText:"length",quadPoints:"quads"},resources:{}},popup:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",parent:"data",open:"data"},readBack:["parent"],colors:[],spaces:{rect:"box",actions:"actions"},resources:{}},unsupported:{owners:{ref:"engine",page:"engine",hasAppearance:"engine",appearanceState:"engine",structurePosition:"engine",nm:"data",rect:"data",contents:"data",subject:"data",blendMode:"data",invisible:"data",hidden:"data",print:"data",noZoom:"data",noRotate:"data",noView:"data",readOnly:"data",locked:"data",toggleNoView:"data",lockedContents:"data",reply:"data",popup:"engine",groupId:"data",author:"attribution",createdAt:"attribution",modifiedAt:"attribution",userId:"attribution",createdBy:"attribution",modifiedBy:"attribution",importedBy:"engine",actions:"preserved",rawSubtypeCode:"engine",rawSubtypeName:"engine"},readBack:[],colors:[],spaces:{rect:"box",actions:"actions"},resources:{}}};function tt(e){let t={};for(let n of Object.keys(te))t[n]=e(te[n]);return t}function tn(e){return Object.prototype.hasOwnProperty.call(te,e)?te[e]:null}var tr=tt(e=>Object.keys(e.owners)),ti=tt(e=>e.resources),to=tt(e=>e.spaces),ta=Object.assign({},...Object.values(to)),ts=[["highlight","underline","squiggly","strikeout"],["square","circle"]],tl=/^sha256-[0-9a-f]{64}$/,tu=["page","position","size"];async function td(e){let t=new Uint8Array(await crypto.subtle.digest("SHA-256",e)),n="";for(let e of t)n+=e.toString(16).padStart(2,"0");return`sha256-${n}`}async function tc(e,t){for(let[n,r]of Object.entries(t))await td(r)!==n&&tF(e,`resource ${n} doesn't match its id`)}function tf(e,t){let n=new Set,r=new Set;for(let o of t){var i;tg(o)&&t_(o.page)&&tg(i=o.size)&&[i.width,i.height].every(e=>"number"==typeof e&&Number.isFinite(e)&&e>=0)||tF(e,"a page needs a page ref, a position and a size"),th(e,"a page",o,tu);let{position:t}=o;(!Number.isInteger(t)||t<0)&&tF(e,`page position ${JSON.stringify(t)} is not a position`);let a=H(o.page);n.has(a)&&tF(e,`page ${a} is listed twice`),r.has(t)&&tF(e,`position ${t} is listed twice`),n.add(a),r.add(t)}return n}function tm(e,t,n,r,i,o){for(let[a,s]of(tg(n)||tF(e,`${t} has no resources`),Object.entries(n)))r.includes(a)||tF(e,`${t} names an unknown resource role '${a}'`),"string"==typeof s&&tl.test(s)||tF(e,`${t} names ${JSON.stringify(s)}, which is not a resource id`),i.has(s)||tF(e,`${t} names ${s}, which the bundle doesn't hold`),o.add(s)}function tp(e,t,n,r){for(let i of n.keys())tl.test(i)||tF(e,`${JSON.stringify(i)} is not a resource id`),r.has(i)||tF(e,`resource ${i} is named by no ${t}`)}function th(e,t,n,r){for(let i of Object.keys(n))r.includes(i)||tF(e,`${t} has an unknown field '${i}'`)}function tF(e,t){throw new N(G.InvalidArg,`${e} bundle: ${t}`)}function tg(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function t_(e){return tg(e)&&"objectNumber"===e.kind&&Number.isInteger(e.objectNumber)&&e.objectNumber>0}function tP(e){let t=function(e,t,n){let r=new Map(n.map(e=>[H(e.page),e.page])),i=new Map;if("same"===t)for(let t of e){let e=r.get(H(t.page));e&&i.set(H(t.page),e)}else if("by-position"===t){let t=new Map(n.map(e=>[e.position,e.page]));for(let n of e){let e=t.get(n.position);e&&i.set(H(n.page),e)}}else for(let{from:e,to:n}of t){let t=H(e);if(i.has(t))throw new N(G.InvalidArg,`import: page ${t} is mapped twice`);let o=r.get(H(n));if(!o)throw new N(G.NotFound,`import: the document has no page ${H(n)}`);i.set(t,o)}return i}(e.bundlePages,e.pages,e.target),n=new Set;for(let r of e.named)t.has(H(r))||n.add(H(r));if(n.size>0){let e=[...n];throw new N(G.InvalidArg,`import: ${1===e.length?"page":"pages"} ${e.join(", ")} map to no page of this document`,{details:{pages:e}})}return e=>t.get(H(e))}var tD=new Set(["subtype","invisible","hidden","print","noZoom","noRotate","noView","readOnly","locked","toggleNoView","lockedContents","nm","reply","popup","parent","open","groupId","subject","state","stateModel","ref","page","hasAppearance","appearanceState","author","createdAt","modifiedAt","userId","createdBy","modifiedBy","importedBy","actions","file","field","fieldKind"]),tb=new Set(["free-text","redact"]),ty=new Set(["square","circle","free-text","stamp","caret","widget","line","polyline","polygon","ink"]),tw={square:["box"],circle:["box"],"free-text":["box","calloutLine"],line:["linePoints"],polygon:["vertices"],polyline:["vertices"],ink:["inkList"],highlight:["quadPoints"],underline:["quadPoints"],squiggly:["quadPoints"],strikeout:["quadPoints"],redact:["rect","quadPoints"],caret:["box"],text:["rect"],stamp:["box"],"file-attachment":["rect"],link:["rect"],widget:["box"]},tE=(e,t)=>.001>=Math.abs(e-t),tA=e=>"number"==typeof e?(e%360+360)%360:0;function tv(e,t){if(null==e||null==t)return null==e&&null==t;if("number"==typeof e&&"number"==typeof t)return tE(e,t);if(Array.isArray(e)||Array.isArray(t))return!!Array.isArray(e)&&!!Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>tv(e,t[n]));if("object"==typeof e&&"object"==typeof t){for(let n of new Set([...Object.keys(e),...Object.keys(t)]))if(!tv(e[n],t[n]))return!1;return!0}return e===t}function tS(e){return null==e||"object"!=typeof e?void 0:Array.isArray(e)?e.length>0?tS(e[0]):void 0:"number"==typeof e.x&&"number"==typeof e.y?{x:e.x,y:e.y}:"number"==typeof e.left&&"number"==typeof e.bottom?{x:e.left,y:e.bottom}:tS(e.start??e.upperLeft)}var tk={impact:"inert"},tx={impact:"regenerate"};function tG(e,t){let n=new Map(e.map(e=>[K(e.ref),e])),r=n.get(K(t));if(!r)return[];let i=new Map,o=new Map,a=(e,t,n)=>e.set(t,[...e.get(t)??[],n]);for(let t of e){let e=t.reply?n.get(K(t.reply.to)):void 0;e&&e!==t&&a(i,e,t);let r="popup"===t.subtype&&t.parent?n.get(K(t.parent)):void 0;r&&r!==t&&a(o,r,t);let s=t.popup?n.get(K(t.popup)):void 0;s&&s!==t&&"popup"===s.subtype&&a(o,t,s)}let s=[],l=new Set,u=e=>{if(!l.has(e)){for(let t of(l.add(e),i.get(e)??[]))u(t);for(let t of o.get(e)??[])l.has(t)||(l.add(t),s.push(t));s.push(e)}};return u(r),s}var tO=new Set(["accepted","rejected","cancelled","completed","none"]),tI=new Set(["marked","unmarked"]);function tN(e){return tO.has(e)?"review":tI.has(e)?"marked":null}var tC=new Set(["highlight","underline","squiggly","strikeout","square","circle","free-text","stamp","caret","widget","line","polyline","polygon","ink"]),tj=new Set(["box","point","points","strokes","quads","linePoints","calloutLine"]);function tM(e){return[...Object.entries(to[e]).filter(([e,t])=>"rect"!==e&&tj.has(t)).map(([e])=>e),"rotation"]}function tR(e,t){return new N(G.InvalidArg,`${e} field 'rect': ${t}`,{details:{field:"rect"}})}var tT=e=>Number.isFinite(e)&&e>0,tB=e=>({x:Math.fround(e.x),y:Math.fround(e.y)});function tL(e,t,n){let r=0,i=e.map(tB);for(let e=0;e<(t?i.length:i.length-1);e++){let t=i[e],o=i[(e+1)%i.length];r+=Math.hypot((o.x-t.x)*n.sx,(o.y-t.y)*n.sy)}return r}function t$(e,t){if(e.length<3)return 0;let n=e.map(tB),r=n[0],i=0;for(let e=1;e!Number.isFinite(Math.fround(e.x))||!Number.isFinite(Math.fround(e.y))))return{unavailable:"invalid-geometry"};let i="polygon"===e.subtype;if(i&&!function(e){let t=e.map(tB),n=(e,t)=>e.x===t.x&&e.y===t.y;if(t.length>1&&n(t[0],t[t.length-1])&&t.pop(),t.length<3||0===t$(t,{sx:1,sy:1}))return!1;let r=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),i=(e,t,n)=>0===r(e,t,n)&&n.x>=Math.min(e.x,t.x)&&n.x<=Math.max(e.x,t.x)&&n.y>=Math.min(e.y,t.y)&&n.y<=Math.max(e.y,t.y);for(let e=0;e=Math.fround(e.cyx)))throw new N(G.InvalidArg,"Invalid CYX")}function tW(e){if("number"!=typeof e||!Number.isFinite(Math.fround(e)))throw new N(G.InvalidArg,"Value is outside PDF float range")}var tq=["linePoints","vertices","measure","intent","contents"],tH=["captionEnabled","captionPosition","captionOffset","captionCenter"],tK=e=>tH.some(t=>void 0!==e[t]);function tZ(e,t){try{if(null!=t.measure&&"rectilinear"===t.measure.subtype&&tV(t.measure),"line"===e&&"leader"in t&&null!=t.leader&&("object"!=typeof t.leader||Array.isArray(t.leader)))throw new N(G.InvalidArg,"Invalid line leader");if(null!=t.intent&&!("line"===e?["line-dimension","line-arrow"]:"polygon"===e?["polygon-dimension","polygon-cloud"]:["polyline-dimension"]).includes(t.intent))throw new N(G.InvalidArg,"Invalid measurement intent");if(null!=t.captionEnabled&&"boolean"!=typeof t.captionEnabled)throw new N(G.InvalidArg,"Invalid caption visibility");if("captionPosition"in t&&null!=t.captionPosition&&!["inline","top"].includes(t.captionPosition))throw new N(G.InvalidArg,"Invalid caption position");if("captionOffset"in t&&t.captionOffset&&(tW(t.captionOffset.along),tW(t.captionOffset.perpendicular)),"captionCenter"in t&&t.captionCenter&&(tW(t.captionCenter.x),tW(t.captionCenter.y)),"leader"in t&&t.leader){for(let e of[t.leader.length,t.leader.extension??0,t.leader.offset??0])tW(e);if((t.leader.extension??0)<0||(t.leader.offset??0)<0)throw new N(G.InvalidArg,"Leader extension and offset must be nonnegative")}for(let e of"linePoints"in t?t.linePoints?[t.linePoints.start,t.linePoints.end]:[]:"vertices"in t?t.vertices??[]:[])tW(e.x),tW(e.y)}catch(e){throw new N(G.InvalidArg,e.message)}}function tJ(e){if(void 0!==e.richText&&null!==e.richText&&void 0!==e.contents&&null!==e.contents&&e2(e.contents,` `)!==e5(e.richText))throw new N(G.InvalidArg,`${e.subtype??"annotation"}: \`contents\` must equal the plain projection of \`richText\` when both are given`)}function tQ(e){return void 0!==e&&"free-text"!==e&&(tr[e]?.includes("richText")??!1)}var tX="#ff0000",tY="#000000",t0="#ffff00",t1={invisible:!1,hidden:!1,print:!0,noZoom:!1,noRotate:!1,noView:!1,readOnly:!1,locked:!1,toggleNoView:!1,lockedContents:!1,blendMode:"normal"},t3={...t1,color:tX,opacity:1,strokeWidth:1,borderStyle:"solid"},t2={start:"none",end:"none"},t6={...t1,color:tY,opacity:1},t5={square:t3,circle:t3,line:{...t3,lineEndings:t2,captionEnabled:!1,captionPosition:"inline"},polygon:t3,polyline:{...t3,lineEndings:t2},ink:t3,highlight:{...t1,blendMode:"multiply",color:t0,opacity:1},underline:t6,squiggly:t6,strikeout:t6,caret:{...t1,color:tX,opacity:1},"free-text":{...t1,contents:"",intent:"free-text",fontFamily:"helvetica",fontSize:12,textAlign:"left",verticalAlign:"top",color:tY,fontColor:tY,opacity:1,strokeWidth:1,borderStyle:"solid"},text:{...t1,icon:"note",open:!1,color:t0,opacity:1},"file-attachment":{...t1,icon:"paperclip",color:t0,opacity:1},link:t1,redact:{...t1,quadPoints:[],color:tX,opacity:1,repeat:!1,fontFamily:"helvetica",fontSize:12,fontColor:tY,textAlign:"left"},stamp:{...t1,fit:"contain",opacity:1},widget:{...t1,strokeWidth:1,borderStyle:"solid",textAlign:"left"},popup:{...t1,print:!1,open:!1}};function t4(e){return"unsupported"===e?{}:t5[e]}var t8=[3,3];function t7(e,t){return"dashed"===e&&void 0===t}var t9=e=>tn(e)?.owners.dashArray!==void 0;function ne(e,t,n){let r={...e};if(void 0!==t.fontFamily){let e=eU(t.fontFamily,n);r.family=e.family,void 0!==e.weight&&(r.weight=e.weight),void 0!==e.italic&&(r.italic=e.italic)}return void 0!==t.fontSize&&(r.size=t.fontSize),null!=t.fontColor&&(r.color=t.fontColor),void 0!==t.textAlign&&(r.align=t.textAlign),r}function nt(e,t){if(null!=t&&"free-text-callout"!==e)throw new N(G.InvalidArg,`free-text: a callout line needs intent 'free-text-callout', not '${e}'`,{details:{field:"intent"}})}function nn(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>"subtype"===e||!t(e,n)))}function nr(e){return new N(G.InvalidArg,`text: the custom state '${e}' needs a stateModel`,{details:{field:"stateModel"}})}function ni(e,t){let n=tr[e],r=Object.keys(t).filter(e=>"subtype"!==e&&!n.includes(e));if(r.length>0)throw new N(G.InvalidArg,`${e} has no field ${r.map(e=>`'${e}'`).join(", ")}`)}var no=class extends N{constructor(e,t){super(G.InvalidArg,`invalid scope "${e}": ${t}`,{details:{scope:e,reason:t}}),this.scope=e,I(this,"name","InvalidScope")}},na=class extends N{constructor(e,t,n,r){super(G.Forbidden,`permission denied${t?` (${t})`:""}: ${n?`one of ${n.join(", ")}`:e}${r?` for ${r.length} annotation${1===r.length?"":"s"}`:""}`,{details:{required:e,...void 0===t?{}:{context:t},...void 0===n?{}:{anyOf:[...n]},...void 0===r?{}:{refs:[...r]}}}),this.required=e,this.context=t,this.anyOf=n,this.refs=r,I(this,"name","PermissionDenied")}},ns=class extends N{constructor(e){super(G.Aborted,function(e){if(null==e)return"aborted";if("string"==typeof e)return e;if(e instanceof Error)return e.message||"aborted";try{return JSON.stringify(e)}catch{return"aborted"}}(e)),I(this,"name","AbortError"),I(this,"reason",void 0),this.reason=e}};function nl(e,t){throw new N(G.InvalidArg,t,{details:{field:e}})}var nu=["normal","rollover","down"],nd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nc=Uint8Array.from(nd,e=>e.charCodeAt(0)),nf=(()=>{let e=(new Int16Array(128)).fill(-1);for(let t=0;t<64;t++)e[nd.charCodeAt(t)]=t;return e})();function nm(e){let t=e.length;for(;t>0&&61===e.charCodeAt(t-1);)t-=1;return t}var np=(e,t,n)=>Math.min(Math.max(Math.floor(e),t),n);function nh(e,t){let n=np(t,0,e.charCount),r=e.charMap;if(!r||0===r.length)return Math.min(n,e.text.length);let[i,o]=function(e,t){let n=0,r=e.length-1,i=null;for(;n<=r;){let o=n+r>>1;e[o][0]<=t?(i=e[o],n=o+1):r=o-1}return i??[0,0]}(r,n);return o+(n-i)}function nF(e,t,n){let r=np(t,0,e.text.length),i=0,o=e.charCount;if("start"===n){for(;i>1;nh(e,t)>=r?o=t:i=t+1}return i}var ng=/[\r\p{Noncharacter_Code_Point}]/u;function n_(e){return"start"===e||"end"===e?null:"before"in e?e.before:e.after}function nP(e,t,n){if("start"===t)return 0;if("end"===t)return e.length;let r=n_(t),i=e.findIndex(e=>n(e)===n(r));if(i<0)throw new N(G.NotFound,`no neighbour ${n(r)} in the list`,{details:{field:"position"}});return"before"in t?i:i+1}function nD(e,t,n,r){let i=new Set(t.map(r));if(i.size!==t.length)throw new N(G.InvalidArg,"a row is named twice",{details:{field:"refs"}});let o=new Set(e.map(r)),a=t.find(e=>!o.has(r(e)));if(void 0!==a)throw new N(G.NotFound,`no row ${r(a)} in the list`,{details:{field:"refs"}});let s=n_(n);if(null!==s&&i.has(r(s)))throw new N(G.InvalidArg,`the neighbour ${r(s)} is one of the rows that move`,{details:{field:"position"}});let l=e.filter(e=>!i.has(r(e))),u=nP(l,n,r);return[...l.slice(0,u),...t,...l.slice(u)]}var nb="EmbedPDF";function ny(e,t){return{x:e.x-t.left,y:t.top-e.y}}function nw(e,t){return{x:e.x+t.left,y:t.top-e.y}}function nE(e,t){return{x:e.left-t.left,y:t.top-e.top,width:e.right-e.left,height:e.top-e.bottom}}function nA(e,t){let n=e.x+t.left,r=t.top-e.y;return{left:n,right:n+e.width,bottom:r-e.height,top:r}}function nv(e,t){return{upperLeft:ny(e.upperLeft,t),upperRight:ny(e.upperRight,t),lowerLeft:ny(e.lowerLeft,t),lowerRight:ny(e.lowerRight,t)}}function nS(e){return"rotation"in e}function nk(e){return{kind:"objectNumber",objectNumber:e}}function nx(e){if(e.byteLength<4)return null;let t=new Uint8Array(e);return 137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]?function(e){if(e.byteLength<24)return null;let t=new DataView(e),n=t.getUint32(16),r=t.getUint32(20);return 0===n||0===r?null:{mimeType:"image/png",width:n,height:r}}(e):255===t[0]&&216===t[1]&&255===t[2]?function(e){let t=new Uint8Array(e),n=2;for(;n+4=192&&r<=195){if(n+9>t.byteLength)return null;let r=new DataView(e,n+5),i=r.getUint16(0),o=r.getUint16(2);if(0===o||0===i)return null;return{mimeType:"image/jpeg",width:o,height:i}}if(216===r||217===r)n+=2;else if(255===r)n+=1;else{let e=t[n+2]<<8|t[n+3];n+=2+e}}return null}(e):37===t[0]&&80===t[1]&&68===t[2]&&70===t[3]?{mimeType:"application/pdf"}:null}var nG=["appearance","file"];function nO(e,t,n){let r=ti[e]??{};for(let i of nG){let o=t?.[i]!==void 0;if(o&&void 0===r[i])throw new N(G.InvalidArg,`a ${e} annotation takes no '${i}' resource`);if(!o&&"create"===n&&"required"===r[i])throw new N(G.InvalidArg,`creating a ${e} annotation needs its '${i}' resource`)}}var nI=Object.freeze({bundleBytes:0x3200000,manifestBytes:0x1000000,items:1e4,pages:2e3,resources:2e3,resourceBytes:0x3200000,imagePixels:4e7});function nN(e){return new TextEncoder().encode(JSON.stringify(e)).length}function nC(e,t,n,r){let i=t[n];if(!(r<=i))throw new N(G.PayloadTooLarge,`the ${e} bundle is past its ${n} limit: ${r} > ${i}`,{details:{limit:n,max:i,value:r}})}var nj={annotation:"an annotation bundle",form:"a form bundle"};function nM(e){let t=t=>new N(G.InvalidArg,`the file is not ${nj[e.kind]}`,void 0===t?void 0:{cause:t});return{stringify(t,n){let r=n?.limits??nI,i=new Map;for(let[e,n]of Object.entries(t.resources))i.set(e,n.length);e.assertManifest(t,i,r);let o={};for(let n of e.keys)o[n]=t[n];let a={};for(let[e,n]of Object.entries(t.resources))a[e]=function(e){let t=new Uint8Array(4*Math.ceil(e.length/3)),n=0,r=0;for(;r+2>18],t[n++]=nc[i>>12&63],t[n++]=nc[i>>6&63],t[n++]=nc[63&i]}let i=e.length-r;if(i>0){let o=e[r]<<16|(2===i?e[r+1]<<8:0);t[n++]=nc[o>>18],t[n++]=nc[o>>12&63],t[n++]=2===i?nc[o>>6&63]:61,t[n++]=61}return new TextDecoder().decode(t)}(n);return o.resources=a,JSON.stringify(o)},async parse(n,r){let i,o=r?.limits??nI,a=Math.ceil(4*o.bundleBytes/3)+81*o.resources+256;if(n.length>a)throw new N(G.PayloadTooLarge,`the file is ${n.length} characters, more than a bundle within ${o.bundleBytes} bytes can be`,{details:{limit:"bundleBytes",max:o.bundleBytes,fileLength:n.length}});try{i=JSON.parse(n)}catch(e){throw t(e)}let s="object"==typeof i&&null!==i?i.resources:null;if("object"!=typeof s||null===s||Array.isArray(s))throw t();let l=new Map;for(let[e,t]of Object.entries(s)){let n="string"==typeof t?function(e){let t=nm(e);return t%4==1?null:Math.floor(3*t/4)}(t):null;if(null===n)throw new N(G.InvalidArg,`resource ${e} is not base64`);l.set(e,n)}e.assertManifest(i,l,o);let u={};for(let[e,t]of Object.entries(s))try{u[e]=function(e){let t=nm(e);if(t%4==1)throw Error("malformed base64");let n=new Uint8Array(Math.floor(3*t/4)),r=0,i=0,o=0;for(let a=0;a=8&&(o-=8,n[r++]=i>>o&255)}return n}(t)}catch(t){throw new N(G.InvalidArg,`resource ${e} is not base64`,{cause:t})}await tc(e.kind,u);let d={};for(let t of e.keys)d[t]=i[t];return d.resources=u,e.complete?e.complete(d):d}}}var nR=["format","version","pages","items"],nT=[...nR,"resources"],nB=["data","resources"];function nL(e,t,n){tg(e)||tF("annotation","not an annotation bundle"),th("annotation","the bundle",e,nT),"embedpdf/annotations"!==e.format&&tF("annotation",`unknown format ${JSON.stringify(e.format)}`),1!==e.version&&tF("annotation",`unknown version ${JSON.stringify(e.version)}`);let{pages:r,items:i}=e;Array.isArray(r)||tF("annotation","pages is not a list"),Array.isArray(i)||tF("annotation","items is not a list"),nC("annotation",n,"items",i.length),nC("annotation",n,"pages",r.length),nC("annotation",n,"resources",t.size);let o=nN({pages:r,items:i});for(let e of(nC("annotation",n,"manifestBytes",o),t.values()))nC("annotation",n,"resourceBytes",e),o+=e;nC("annotation",n,"bundleBytes",o);let a=tf("annotation",r),s=new Set;i.forEach((e,n)=>{tg(e)&&tg(e.data)&&"string"==typeof e.data.subtype||tF("annotation",`item ${n} has no annotation data`),th("annotation",`item ${n}`,e,nB);let r=e.data.ref,i=tg(r)?r.page:void 0;t_(i)&&a.has(H(i))||tF("annotation",`item ${n} is on a page the bundle doesn't list`),tm("annotation",`item ${n}`,e.resources,nG,t,s)}),tp("annotation","item",t,s)}function n$(e){return{kind:"key",key:e}}nM({kind:"annotation",keys:nR,assertManifest:nL});var nz=new Set(["square","circle","free-text","stamp","caret"]),nU=(e,t)=>"function"==typeof t?t(e):t,nV=(e,t)=>null===e?null:t(e);function nW(e,t){let{left:n,top:r}=nU(e.page,t),i=e=>nV(e,e=>e-n),o=e=>nV(e,e=>r-e);switch(e.kind){case"xyz":{let{left:t,top:n,...r}=e;return{...r,x:i(t),y:o(n)}}case"fitH":case"fitBH":{let{top:t,...n}=e;return{...n,y:o(t)}}case"fitV":case"fitBV":{let{left:t,...n}=e;return{...n,x:i(t)}}case"fitR":{let{left:t,bottom:i,right:o,top:a,...s}=e,l=Math.min(i,a),u=Math.max(i,a);return{...s,x:Math.min(t,o)-n,y:r-u,width:Math.abs(o-t),height:u-l}}case"fit":case"fitB":return e}}function nq(e,t){let{left:n,top:r}=nU(e.page,t),i=e=>nV(e,e=>e+n),o=e=>nV(e,e=>r-e);switch(e.kind){case"xyz":{let{x:t,y:n,...r}=e;return{...r,left:i(t),top:o(n)}}case"fitH":case"fitBH":{let{y:t,...n}=e;return{...n,top:o(t)}}case"fitV":case"fitBV":{let{x:t,...n}=e;return{...n,left:i(t)}}case"fitR":{let{x:t,y:i,width:o,height:a,...s}=e,l=r-i;return{...s,left:t+n,bottom:l-a,right:t+n+o,top:l}}case"fit":case"fitB":return e}}function nH(e,t){return"goto"===e.kind?{...e,destination:t(e.destination)}:e}function nK(e,t){return{...e,root:e.root?function e(t,n){let r=t.next.map(t=>e(t,n));return"goto"===t.type?{...t,next:r,destination:n(t.destination)}:{...t,next:r}}(e.root,t):null}}function nZ(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>null==n?[e,n]:[e,"root"in n?nK(n,t):function e(t,n){let r=t.next?.map(t=>e(t,n)),i="goto"===t.type?{...t,destination:n(t.destination)}:t;return r?{...i,next:r}:i}(n,t)]))}function nJ(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,n?nK(n,t):n]))}var nQ=(e,t)=>"rectilinear"===e.subtype&&e.origin?{...e,origin:t(e.origin)}:e;function nX(e,t){return nQ(e,e=>ny(e,t))}function nY(e,t){return nQ(e,e=>nw(e,t))}function n0(e,t){return e.map(e=>({...e,bbox:nE(e.bbox,t),measure:e.measure?nX(e.measure,t):null}))}var n1={length:e=>e,point:(e,{visible:t})=>ny(e,t),points:(e,{visible:t})=>e.map(e=>ny(e,t)),strokes:(e,{visible:t})=>e.map(e=>e.map(e=>ny(e,t))),box:(e,{visible:t})=>nE(e,t),quads:(e,{visible:t})=>e.map(e=>nv(e,t)),linePoints:(e,{visible:t})=>({start:ny(e.start,t),end:ny(e.end,t)}),calloutLine:(e,{visible:t})=>e.map(e=>ny(e,t)),measure:(e,{visible:t})=>nX(e,t),linkTarget:(e,{boxOf:t})=>nH(e,e=>nW(e,t)),actions:(e,{boxOf:t})=>nZ(e,e=>nW(e,t))},n3={length:e=>e,point:(e,{visible:t})=>nw(e,t),points:(e,{visible:t})=>e.map(e=>nw(e,t)),strokes:(e,{visible:t})=>e.map(e=>e.map(e=>nw(e,t))),box:(e,{visible:t})=>nA(e,t),quads:(e,{visible:t})=>e.map(e=>({upperLeft:nw(e.upperLeft,t),upperRight:nw(e.upperRight,t),lowerLeft:nw(e.lowerLeft,t),lowerRight:nw(e.lowerRight,t)})),linePoints:(e,{visible:t})=>({start:nw(e.start,t),end:nw(e.end,t)}),calloutLine:(e,{visible:t})=>e.map(e=>nw(e,t)),measure:(e,{visible:t})=>nY(e,t),linkTarget:(e,{boxOf:t})=>nH(e,e=>nq(e,t)),actions:(e,{boxOf:t})=>nZ(e,e=>nq(e,t))};function n2(e,t,n,r){let i=void 0===e?ta:to[e]??to.unsupported;return Object.fromEntries(Object.entries(t).map(([e,t])=>{let o=i[e];if(!o||null==t)return[e,t];let a=r[o](t,n);if(r===n3&&function e(t){return"number"==typeof t?Number.isNaN(t):"object"==typeof t&&null!==t&&Object.values(t).some(e)}(a)){var s,l;throw s=e,l=o,new N(G.InvalidArg,`field '${s}': expected page space, ${"box"===l?"{ x, y, width, height }":"points as { x, y }"} from the page's top-left`,{details:{field:s}})}return[e,a]}))}function n6(e,t,n){return n2(e.subtype,e,{visible:t,boxOf:n},n1)}function n5(e,t,n){return n2(e.subtype,e,{visible:t,boxOf:n},n3)}function n4(e,t,n){return n2(e.subtype,e,{visible:t,boxOf:n},n3)}var n8=e=>!!(e.space||e.empty),n7=e=>!!e.empty,n9={baseline:{x:1,y:0},ascent:{x:0,y:1}},re=(e,t)=>({x:t.x*e.baseline.x+t.y*e.baseline.y,y:t.x*e.ascent.x+t.y*e.ascent.y}),rt=(e,t)=>({x:e.baseline.x*t.x+e.ascent.x*t.y,y:e.baseline.y*t.x+e.ascent.y*t.y}),rn={left:0,bottom:0,right:0,top:0};function rr(e,t){let n=[t.upperLeft,t.upperRight,t.lowerLeft,t.lowerRight].map(t=>re(e,t)),r=n.map(e=>e.x),i=n.map(e=>e.y);return{left:Math.min(...r),bottom:Math.min(...i),right:Math.max(...r),top:Math.max(...i)}}var ri=(e,t)=>t.x>=e.left&&t.x<=e.right&&t.y>=e.bottom&&t.y<=e.top;function ro(e,t,n=1.5){let r=e.frames.map((e,n)=>0===n?t:re(e,t));for(let t of e.runs){let n=r[t.frame];if(ri(t.rect,n))for(let r=0;rs.right+i)&&!(n.ys.top+i))for(let r=0;rl.right+i||n.yl.top+i)continue;let u=Math.min(Math.abs(n.x-l.left),Math.abs(n.x-l.right)),d=Math.min(Math.abs(n.y-l.bottom),Math.abs(n.y-l.top));u+d=0?o:null}function ra(e,t,n){return 0===t?{upperLeft:{x:n.left,y:n.top},upperRight:{x:n.right,y:n.top},lowerLeft:{x:n.left,y:n.bottom},lowerRight:{x:n.right,y:n.bottom}}:{upperLeft:rt(e,{x:n.left,y:n.top}),upperRight:rt(e,{x:n.right,y:n.top}),lowerLeft:rt(e,{x:n.left,y:n.bottom}),lowerRight:rt(e,{x:n.right,y:n.bottom})}}var rs=e=>e.right===e.left&&e.top===e.bottom;function rl(e,t,n,r){let i=Math.max(t,r)-Math.min(e,n);return 0!==i&&Math.max(0,Math.min(t,r)-Math.max(e,n))/i>=.5}var ru={x:0,y:0,width:0,height:0},rd={upperLeft:{x:0,y:0},upperRight:{x:0,y:0},lowerLeft:{x:0,y:0},lowerRight:{x:0,y:0}},rc=/\s/,rf=/\p{M}/gu,rm=/^(?![\t\n\v\f\r])[\p{Cf}\p{Cc}\p{Noncharacter_Code_Point}]$/u;function rp(e,t={}){let n=[],r=[],i=!1,o=0;for(let a of e){let e;if(rm.test(a)){o+=a.length;continue}rc.test(a)?e=" ":(e=a.normalize("NFKD"),t.keepMarks||(e=e.replace(rf,"")),t.keepCase||(e=e.toUpperCase().toLowerCase()));for(let a=0;a=55296&&n<=56319&&t+1=56320&&n<=57343)return 2}return 1}(e.original,i)-r}}var rF=["format","version","pages","fields","widgets","calculationOrder"],rg=["image"],r_=[...rF,"resources"],rP=["data"],rD=["data","resources"];function rb(e){let t=ry(e.fields,e=>es(ej(en(el(ey(e)))))),n=e.widgets&&ry(e.widgets,Q);return t===e.fields&&n===e.widgets?e:{...e,fields:t,...n?{widgets:n}:{}}}function ry(e,t){let n=!1,r=e.map(e=>{let r=t(e.data);return r===e.data?e:(n=!0,{...e,data:r})});return n?r:e}function rw(e,t,n){tg(e)||tF("form","not a form bundle"),th("form","the bundle",e,r_),"embedpdf/form"!==e.format&&tF("form",`unknown format ${JSON.stringify(e.format)}`),1!==e.version&&tF("form",`unknown version ${JSON.stringify(e.version)}`);let{pages:r,fields:i,widgets:o,calculationOrder:a}=e;Array.isArray(r)||tF("form","pages is not a list"),Array.isArray(i)||tF("form","fields is not a list"),Array.isArray(o)||tF("form","widgets is not a list"),Array.isArray(a)||tF("form","calculationOrder is not a list"),nC("form",n,"items",i.length+o.length),nC("form",n,"pages",r.length),nC("form",n,"resources",t.size);let s=nN({pages:r,fields:i,widgets:o,calculationOrder:a});for(let e of(nC("form",n,"manifestBytes",s),t.values()))nC("form",n,"resourceBytes",e),s+=e;nC("form",n,"bundleBytes",s);let l=tf("form",r);i.forEach((e,t)=>{tg(e)&&tg(e.data)&&"string"==typeof e.data.kind&&"string"==typeof e.data.name&&tg(e.data.ref)||tF("form",`field ${t} has no field data`),th("form",`field ${t}`,e,rP)});let u=new Set;o.forEach((e,n)=>{tg(e)&&tg(e.data)&&"widget"===e.data.subtype||tF("form",`widget ${n} has no widget data`),th("form",`widget ${n}`,e,rD);let r=e.data.ref,i=tg(r)?r.page:void 0;t_(i)&&l.has(H(i))||tF("form",`widget ${n} is on a page the bundle doesn't list`),tm("form",`widget ${n}`,e.resources,rg,t,u)}),a.forEach((e,t)=>{tg(e)||tF("form",`calculation order entry ${t} is not a field ref`)}),tp("form","widget",t,u)}function rE(e){return{keepCase:!!e.matchCase,keepMarks:!!e.matchDiacritics,dropWhitespace:!!e.ignoreWhitespace}}nM({kind:"form",keys:rF,assertManifest:rw,complete:rb});var rA=/[\p{L}\p{N}_]/u,rv=/\p{M}/u;function rS(e,t){if(t<=0)return!1;let n=e.charCodeAt(t-1);return rA.test(String.fromCodePoint(e.codePointAt(n>=56320&&n<=57343&&t>=2?t-2:t-1)))}function rk(e,t){return!(t>=e.length)&&rA.test(String.fromCodePoint(e.codePointAt(t)))}function rx(e,t){let n=rp(t.text,rE(t)).folded;if(0===n.trim().length)return[];let r=[],i=0;for(;i<=e.folded.length-n.length;){let o=e.folded.indexOf(n,i);if(o<0)break;if(t.wholeWord&&!function(e,t,n,r){if(!r.ignoreWhitespace)return!rS(e.folded,t)&&!rk(e.folded,t+n);let{start:i,count:o}=rh(e,t,n);return!rS(e.original,i)&&!rk(e.original,i+o)}(e,o,n.length,t)){i=o+1;continue}if(t.matchDiacritics&&o+n.length512)return{ok:!1,issue:"too-long",message:"Pattern exceeds 512 characters."};let t=!1;for(let n=0;n="1"&&r<="9")return{ok:!1,issue:"backreference",message:`Backreference \\${r} is not supported.`};if(!t&&"k"===r&&"<"===e[n+2])return{ok:!1,issue:"backreference",message:"Named backreferences (\\k<\u2026>) are not supported."};n++;continue}if(t){"]"===r&&(t=!1);continue}if("["===r){t=!0;continue}if("("===r&&"?"===e[n+1]){let t=e[n+2]??"";if("="===t||"!"===t)return{ok:!1,issue:"lookaround",message:"Lookahead ((?=\u2026), (?!\u2026)) is not supported."};if("<"===t&&("="===e[n+3]||"!"===e[n+3]))return{ok:!1,issue:"lookaround",message:"Lookbehind ((?<=\u2026), (?{var r;let i;return"link"!==e.subtype||"activate"!==t||o&&(r=n,i=r?.root,!r||!!r.incomplete||!i||!!(i.next.length>0)||!!("uri"===i.type&&i.isMap))})&&n.push({field:"actions",reason:"unsupported-action"}),n}var rT=new Set(["NextPage","PrevPage","FirstPage","LastPage"]);function rB(e){let t=[],n=(e,r)=>{if("object"==typeof e&&null!==e){if(Array.isArray(e))return void e.forEach(e=>n(e));if("page"===r&&r$(e))return void t.push(e);Object.entries(e).forEach(([e,t])=>n(t,e))}};return n(e),t}function rL(e,t){let n=(e,r)=>"object"!=typeof e||null===e?e:Array.isArray(e)?e.map(e=>n(e)):"page"===r&&r$(e)?t(e):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,n(t,e)]));return n(e)}function r$(e){return 2===Object.keys(e).length&&"objectNumber"===e.kind&&"number"==typeof e.objectNumber}var rz=/^\s*event\s*\.\s*target\s*\.\s*buttonImportIcon\s*\(\s*\)\s*(?:;\s*)?$/,rU=["activate","mouseUp"];function rV(e){let t,n=rU.flatMap(t=>{let n=e?.[t];return null==n?[]:[n]});return 1===n.length&&null!==(t=ew(n[0]))&&rz.test(t)}function rW(e){return e.length>0&&e.every(rV)}function rq(){return{type:"javascript",script:"event.target.buttonImportIcon();"}}function rH(e){return rU.some(t=>e?.[t]!==void 0)?e??{}:{...e,activate:rq()}}function rK(e,t){let{takesImage:n}=e;if(void 0!==n){if("pushbutton"!==t)throw new N(G.InvalidArg,`'takesImage' does not apply to a ${t} field`,{details:{field:"takesImage"}});if("boolean"!=typeof n)throw new N(G.InvalidArg,"'takesImage' is true or false",{details:{field:"takesImage"}});return n}}function rZ(e,t){if(!t)return rV(e)?{kind:"remove",event:e?.activate!=null?"activate":"mouseUp"}:{kind:"keep"};if(rV(e))return{kind:"keep"};if(rU.some(t=>e?.[t]!=null))throw new N(G.InvalidArg,"'takesImage' can't be set: a widget's press already runs another action, which is never overwritten. Remove it first (updateWidget, actions.activate and actions.mouseUp)",{details:{field:"takesImage"}});return{kind:"write"}}function rJ(e,t=0){if(e.length+t===0)throw rX();if(t>0)throw new N(G.InvalidArg,"'takesImage' can't be set: a widget of the button is on no page, so its press can't be written",{details:{field:"takesImage"}});for(let t of e)rZ(t,!0)}function rQ(e){return"write"===e.kind?{activate:rq()}:"remove"===e.kind?{[e.event]:null}:{}}function rX(){return new N(G.InvalidArg,"'takesImage' needs a widget: the script that makes an image field is its widgets' press",{details:{field:"takesImage"}})}function rY(e,t,n){if(0===e.length||0===n.length)return e;let r=new Set(n),i=[0];for(let e=0;ei[Math.min(Math.max(e,0),t)],a=[];return e.forEach((n,r)=>{if(o(e[r+1]?.firstPage??t)===o(n.firstPage))return;let i=o(n.firstPage);a.push(i===n.firstPage?n:{...n,firstPage:i})}),r1(a,e)?e:a}function r0(e,t,n){if(n<=0)return e;let r=!1,i=e.map(e=>0===e.firstPage||e.firstPage{let r=t[n];return e.firstPage===r.firstPage&&e.style===r.style&&e.firstNumber===r.firstNumber&&e.prefix===r.prefix})}var r3=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function r2(e){let t=e%1e6,n="";for(let[e,r]of r3)for(;t>=e;)n+=r,t-=e;return n}function r6(e){if(e<=0)return"";let t=e-1;return String.fromCharCode(97+t%26).repeat((Math.floor(t/26)+1)%1e3)}var r5={text:"{ value }",checkbox:"{ checked } or { value }",radio:"{ value }",combobox:"{ value }",listbox:"{ selectedValues }"};function r4(e,t){var n;switch(e.kind){case"text":if("value"in t)return{kind:"text",value:t.value??""};break;case"checkbox":if("checked"in t){if(!t.checked)return{kind:"toggle",state:null};let n=e.widgets[0];if(!n)throw it(`'${e.name}' has no widget to check`);return{kind:"toggle",state:n.onState}}if("value"in t)return{kind:"toggle",state:r9(e,t.value)};break;case"radio":if("value"in t){let n=r9(e,t.value);if(null===n&&e.noToggleToOff)throw it(`'${e.name}' must keep a choice: it can't be cleared`);return{kind:"toggle",state:n}}break;case"combobox":if("value"in t)return ie(e,null===t.value?[]:[t.value]);break;case"listbox":if("selectedValues"in t)return ie(e,t.selectedValues);break;default:throw it(`${e.kind} fields hold no value you can set`)}throw it(`a ${e.kind} field takes ${r5[e.kind]}, not ${"checked"in(n=t)?"{ checked }":"selectedValues"in n?"{ selectedValues }":"{ value }"}`)}function r8(e,t){let n=e=>new N(G.InvalidArg,e,{details:{field:"defaultValue"}});if(new Set(t).size!==t.length)throw n("the default values must not repeat");if(t.length>1&&!("listbox"===e.kind&&e.multiSelect))throw n(`a ${"listbox"===e.kind?"list without multiSelect":"dropdown"} has one default`);let r="combobox"===e.kind&&!0===e.edit,i=new Set(e.options.map(e=>e.value)),o=t.find(e=>!i.has(e));if(void 0!==o&&!r)throw n(`'${o}' is not an option value of the ${"listbox"===e.kind?"list":"dropdown"}`)}function r7(e,t){return e.kind===t.kind&&("scalar"===e.kind&&"scalar"===t.kind?e.value===t.value:"array"!==e.kind||"array"!==t.kind||e.values.length===t.values.length&&e.values.every((e,n)=>e===t.values[n]))}function r9(e,t){if(null===t||"Off"===t)return null;let n=e.widgets.find(e=>e.exportValue===t);if(!n)throw it(`no widget of '${e.name}' has the export value '${t}'`);return n.onState}function ie(e,t){if(new Set(t).size!==t.length)throw it("the values must not repeat");if("listbox"===e.kind&&!e.multiSelect&&t.length>1)throw it(`'${e.name}' takes one value (it has no multiSelect)`);let n=new Set(e.options.map(e=>e.value)),r="combobox"===e.kind&&e.edit&&1===t.length,i=t.find(e=>!n.has(e));if(!r&&void 0!==i)throw it(`'${i}' is not an option value of '${e.name}'`);return{kind:"choice",values:t}}function it(e){return new N(G.InvalidArg,e,{details:{field:"value"}})}function ir(e,t){let n="checkbox"===e||"radio"===e,r="pushbutton"===e,i=ii(e,t,"caption",r,"a push button's");if(r&&null===t.layout)throw new N(G.InvalidArg,"a push button's widget always has a layout: 'caption' shows its caption alone",{details:{field:"layout"}});return ii(e,ii(e,i,"layout",r,"a push button's"),"checkStyle",n,"a checkbox's or radio button's")}function ii(e,t,n,r,i){if(r||void 0===t[n])return t;if(null!==t[n]){let t="unknown"===e?"this widget":`a ${e} field's widget`;throw new N(G.InvalidArg,`'${n}' applies to ${i} widgets, not to ${t}`,{details:{field:n}})}let{[n]:o,...a}=t;return a}function io(e){if(("combobox"===e.kind||"listbox"===e.kind)&&void 0!==e.defaultValue){let t=Array.isArray(e.defaultValue)?e.defaultValue:[e.defaultValue];r8({...e,options:e.options??[]},t)}switch(e.kind){case"text":case"combobox":return void 0!==e.defaultValue?ib(e.defaultValue):iy();case"listbox":return ip(ih((e.options??[]).map(iP),e.defaultValue??[]));default:return iy()}}function ia(e,t){var n,r,i;let o,a,s,l,u,d={...e.field};if(void 0!==t.name){let e=d.name.lastIndexOf(".");d.name=e<0?t.name:`${d.name.slice(0,e+1)}${t.name}`}for(let e of is)"boolean"==typeof t[e]&&e in d&&(d[e]=t[e]);if(void 0!==t.alternateName&&(d.alternateName=t.alternateName||null),void 0!==t.mappingName&&(d.mappingName=t.mappingName||null),d.assignment=et(t,d),d.groupId=Y(d.assignment),void 0!==t.purpose&&(d.purpose=rj(t.purpose)),void 0!==t.placeholder&&(d.placeholder=eC(t.placeholder)),"text"===d.kind||"combobox"===d.kind){let e=ex(t,d.kind);if(void 0!==e&&!eS(e,d.format)){let t=function(e,t){let{keystroke:n,format:r,...i}=e??{};if(null===t)return Object.keys(i).length>0?i:void 0;let o=eE(t);return{keystroke:eG(o.keystroke),format:eG(o.format),...i}}(d.actions,e);d.format=e,t?d.actions=t:delete d.actions}}if("text"===d.kind&&("maxLength"in t&&void 0!==t.maxLength&&(d.maxLength=t.maxLength),"defaultValue"in t&&void 0!==t.defaultValue)){let e=t.defaultValue;d.defaultValue=e??"",d.defaultValueEntry=null===e?iy():ib(e)}let c=!1;if(("combobox"===d.kind||"listbox"===d.kind)&&("options"in t&&t.options&&(n=d,o=(r=t.options.map(iP)).map(e=>e.value),a="combobox"===n.kind&&n.edit,s=ig("combobox"===n.kind?""===n.value?[]:[n.value]:n.selectedValues,o,a),l=im("listbox"===n.kind?{...n,options:r,topIndex:iF(n.topIndex,r)}:{...n,options:r},s),u="scalar"===(i=n.defaultValueEntry).kind?[i.value]:"array"===i.kind?[...i.values]:[],d="none"===n.defaultValueEntry.kind?l:i_(l,ig(u,o,a),!0),c=!0),"defaultValue"in t&&void 0!==t.defaultValue)){let e=null===t.defaultValue?[]:Array.isArray(t.defaultValue)?t.defaultValue:[t.defaultValue];r8(d,e),d=i_(d,e)}let f={...e,field:d},m=rK(t,d.kind);return void 0!==m?function(e,t){if("pushbutton"!==e.field.kind)return e;let n=new Set(e.field.widgets.map(e=>e.objectNumber)),r=e=>n.has(iD(e.ref)),i=e.widgets.filter(r);t&&rJ(i.map(e=>e.actions),e.field.widgets.length-i.length);let o=e.widgets.map(e=>{if(!r(e))return e;let n=rQ(rZ(e.actions,t)),i=function(e,t){if(null===t)return null;let n={...e},r=!1;for(let e of z){let i=t[e];void 0!==i&&(null===i?(void 0!==n[e]&&(r=!0),delete n[e]):"root"in i||(n[e]=$(i),r=!0))}let i=r?n:e??{};return Object.keys(i).length>0?i:null}(e.actions,n);return i===(e.actions??null)?e:{...e,actions:i}});return{field:{...e.field,takesImage:t},widgets:o}}(f,m):c?il(f.field,f):f}var is=["readOnly","required","noExport","multiline","password","comb","radiosInUnison","noToggleToOff","edit","multiSelect"];function il(e,t){return{field:e,widgets:t.widgets.map(e=>e.hasAppearance?e:{...e,hasAppearance:!0})}}function iu(e,t){let n=e.field;if("checkbox"!==n.kind&&"radio"!==n.kind)return e;let r="checkbox"===n.kind||n.radiosInUnison,i=t>=0?n.widgets[t]:null,o=n.widgets.map((e,n)=>{let o=null!==i&&(r?e.exportValue===i.exportValue&&e.onState===i.onState:n===t);return e.checked===o?e:{...e,checked:o}}),a=ib(i?i.onState:"Off"),s="checkbox"===n.kind?{...n,widgets:o,valueEntry:a,checked:o.some(e=>e.checked)}:{...n,widgets:o,valueEntry:a,value:o.find(e=>e.checked)?.exportValue??"Off"},l=new Map(o.map(e=>[e.objectNumber,e.checked?e.onState:"Off"]));return{field:s,widgets:e.widgets.map(e=>{let t=l.get(iD(e.ref));return void 0===t||e.appearanceState===t?e:{...e,appearanceState:t}})}}function id(e,t){let n=new Set;for(let r of t){let t=e.findIndex(e=>e.value===r);t>=0&&n.add(t)}return[...n].sort((e,t)=>e-t)}var ic=(e,t)=>t.every(t=>e.options.some(e=>e.value===t));function im(e,t){let n=ic(e,t)?id(e.options,t):[],r=t.length>0&&0===n.length,i=e.options.map((e,t)=>{let r=n.includes(t);return e.selected===r?e:{...e,selected:r}}),o=r?[...t]:n.map(t=>e.options[t].value),a=ip(o);return"combobox"===e.kind?{...e,options:i,valueEntry:a,value:o[0]??""}:{...e,options:i,valueEntry:a,selectedValues:o}}function ip(e){return 0===e.length?iy():1===e.length?ib(e[0]):{kind:"array",values:[...e]}}function ih(e,t){return id(e,t).map(t=>e[t].value)}function iF(e,t){return Math.max(0,Math.min(e,t.length-1))}function ig(e,t,n){let r=e.filter(e=>t.includes(e));return 0===r.length&&n&&e.length>0?[...e]:r}function i_(e,t,n=!1){if(0===t.length){let t=n?"listbox"===e.kind&&e.multiSelect?{kind:"array",values:[]}:ib(""):iy();return"combobox"===e.kind?{...e,defaultValueEntry:t,defaultValue:""}:{...e,defaultValueEntry:t,defaultValue:[]}}let r=ic(e,t),i=r?ih(e.options,t):[...t],o=r?ip(i):ib(t[0]);return"combobox"===e.kind?{...e,defaultValueEntry:o,defaultValue:i[0]??""}:{...e,defaultValueEntry:o,defaultValue:i}}var iP=e=>({label:e.label,value:e.value,selected:!1}),iD=e=>"objectNumber"===e.kind?e.objectNumber:0,ib=e=>({kind:"scalar",value:e}),iy=()=>({kind:"none"});function iw(e){return new N(G.Unknown,`'${e.name}' could not be reset`)}function iE(e){var t,n;if(null===e)return null;let r=!ArrayBuffer.isView(t=e)&&(n=t,!("u">typeof Blob&&n instanceof Blob)),i=r?e.pdf:e;if(ArrayBuffer.isView(i))return{bytes:i,declaredPdf:r};throw new N(G.InvalidArg,"a signature appearance reaches a write as bytes, never as a Blob")}function iA(e){return"skipped"===e.type}function iv(e){switch(e.type){case"skipped":return!1;case"annotations.import":case"annotations.copy":return e.annotations.length>0;case"forms.import":case"forms.importValues":case"forms.copy":return e.fields.length>0;case"forms.repeat":return e.meta.changedFields.length>0;default:return!0}}function iS(e){return"undoOf"in e}function ik(e,t){return{all:()=>`${e}:${t}:all`,self:()=>`${e}:${t}:self`,createdBy:n=>`${e}:${t}:createdBy=${n}`,group:n=>`${e}:${t}:group=${n}`}}function ix(e,t){return{all:()=>`${e}:${t}:all`,group:n=>`${e}:${t}:group=${n}`}}Object.assign(()=>"doc.render",{thumbnail:()=>"doc.render.thumbnail"}),Object.assign(()=>"doc.download",{flattened:()=>"doc.download.flattened"}),Object.assign(()=>"doc.print",{high:()=>"doc.print.high"}),Object.assign(()=>"doc.sign",{certify:()=>"doc.sign.certify"}),ik("annotations","create"),ik("annotations","update"),ik("annotations","delete"),ix("annotations","set-group"),ik("annotations","*"),ix("fields","fill"),ix("fields","sign"),ix("fields","set-group"),ix("fields","*");var iG={none:0,lta:1,fill:2,annotate:3};function iO(e){return 1===e?"lta":2===e?"fill":"annotate"}function iI(e,t){return iG[e]<=iG[t]?e:t}function iN(e,t){return null===e||iG[e]>=iG[t]}function iC(e,t){return t===e||t.startsWith(`${e}.`)}function ij(e,t){switch(e.action){case"all":return!0;case"include":return e.fields.some(e=>iC(e,t));case"exclude":return!e.fields.some(e=>iC(e,t))}}function iM(e){let t=!1,n=null,r=null,i=[];for(let o of e)o.signed&&(t=!0,o.catalogCertification&&null!==o.docMdp&&null===r&&(r={signatureIndex:o.index,permission:o.docMdp},n=iI(n??"annotate",iO(o.docMdp))),o.fieldMdp&&i.push({signatureIndex:o.index,source:"fieldmdp",spec:o.fieldMdp}),o.lock&&(i.push({signatureIndex:o.index,source:"lock",spec:o.lock}),void 0!==o.lock.permission&&(n=iI(n??"annotate",iO(o.lock.permission)))));return{enforced:n,judged:t?n??"annotate":null,certification:r,fieldLocks:i,policyVersion:6}}function iR(e){let t=new Set;return e&&null!==e.judged&&(t.add("doc.download.flattened"),null===e.enforced||(t.add("doc.pages.modify"),t.add("doc.pages.assemble"),t.add("doc.redact"),t.add("doc.attachments.modify"),t.add("doc.outline.modify"),t.add("doc.forms.modify"),t.add("doc.forms.script"),iN(e.enforced,"annotate")||(t.add("doc.annotate.modify"),t.add("doc.annotate.import")),iN(e.enforced,"fill")||(t.add("doc.forms.fill"),t.add("doc.forms.import"),t.add("doc.metadata.modify"),t.add("doc.sign")))),t}var iT=new Set(["doc.open","doc.render","doc.render.thumbnail","doc.text.select","doc.text.copy","doc.text.search","doc.content.copy","doc.download","doc.download.flattened","doc.print","doc.print.high","doc.pages.modify","doc.pages.assemble","doc.forms.read","doc.forms.fill","doc.forms.modify","doc.forms.import","doc.forms.script","doc.forms.submit","doc.annotate.read","doc.annotate.modify","doc.annotate.import","doc.metadata.modify","doc.attachments.modify","doc.outline.modify","doc.redact","doc.sign","doc.sign.certify"]);function iB(e){if("*"===e)return{kind:"wildcard"};if("pdf.permissions"===e)return{kind:"virtual",name:"pdf.permissions"};if(e.includes(":"))return function(e){let t=e.indexOf(":"),n=e.indexOf(":",t+1);if(-1===t||-1===n)throw new no(e,"collab scope requires entity:action:filter");let r=e.slice(0,t),i=e.slice(t+1,n),o=e.slice(n+1);if("fields"===r){var a=e,s=i,l=o;if("fill"!==s&&"sign"!==s&&"set-group"!==s&&"*"!==s)throw new no(a,`unknown fields action: ${s}`);let t=i$(l,a);if("all"!==t.kind&&"group"!==t.kind)throw new no(a,`fields only support :all or :group= filters (got :${t.kind})`);return{kind:"collab",entity:"fields",action:s,filter:t}}if("annotations"!==r)throw new no(e,`unknown collab entity: ${r}`);if("create"!==i&&"update"!==i&&"delete"!==i&&"set-group"!==i&&"*"!==i)throw new no(e,`unknown collab action: ${i}`);let u=i$(o,e);if("set-group"===i&&("self"===u.kind||"createdBy"===u.kind))throw new no(e,`set-group only supports :all or :group= filters (got :${u.kind})`);return{kind:"collab",entity:r,action:i,filter:u}}(e);let t=function(e){if(e.includes(":"))return null;let t=e.indexOf(".");if(t<=0)return null;let n=e.slice(0,t);return iL.has(n)?null:n}(e);return null!==t?function(e,t){if(!iU.test(e))throw new no(e,"invalid plugin permission shape (expected .)");return{kind:"plugin",name:e,plugin:t}}(e,t):function(e){if(!iz.test(e))throw new no(e,"invalid capability name shape");if(!iT.has(e))throw new no(e,`unknown capability: ${e}`);return{kind:"capability",name:e}}(e)}var iL=new Set(["doc","docs","pdf","annotations","fields","tokens","grants","shares","tenants","layer","visitor","document","submission","signature"]);function i$(e,t){if("all"===e)return{kind:"all"};if("self"===e)return{kind:"self"};if(e.startsWith("createdBy=")){let n=e.slice(10);if(!n)throw new no(t,"createdBy= requires a value");return{kind:"createdBy",userId:n}}if(e.startsWith("group=")){let n=e.slice(6);if(!n)throw new no(t,"group= requires a value");return{kind:"group",groupId:n}}throw new no(t,`unknown filter: ${e}`)}var iz=/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/,iU=/^[a-z][a-z0-9]*(-[a-z0-9]+)*(\.[a-z][a-z0-9]*(-[a-z0-9]+)*)+$/;function iV(e){return{...e.userId?{userId:e.userId}:{},...e.groupId?{groupId:e.groupId}:{}}}function iW(e,t,n,r=null){if(iR(r).has(e))return!1;let i=t.map(iB);return!!i.some(e=>"wildcard"===e.kind)||iH(i,n,r).has(e)}function iq(e,t,n,r,i){let o=n.map(iB);if(o.some(e=>"wildcard"===e.kind))return!0;let a=o.filter(t=>"collab"===t.kind&&"annotations"===t.entity&&(t.action===e||"*"===t.action));return a.length>0?a.some(e=>(function(e,t,n){switch(e.kind){case"all":return!0;case"self":return!!n.userId&&t.userId===n.userId;case"createdBy":return t.userId===e.userId;case"group":return t.groupId===e.groupId}})(e.filter,t,r)):iH(o,i).has("doc.annotate.modify")}function iH(e,t,n=null){let r=new Set,i=!1,o=!1;for(let n of e)"capability"===n.kind?r.add(n.name):"virtual"===n.kind&&"pdf.permissions"===n.name?function(e,t){let n;for(let r of((n=new Set).add("doc.open"),n.add("doc.render"),n.add("doc.annotate.read"),n.add("doc.forms.read"),n.add("doc.text.search"),n.add("doc.text.select"),t.copy&&(n.add("doc.text.copy"),n.add("doc.content.copy")),t.print&&n.add("doc.print"),t.printHighQuality&&t.print&&n.add("doc.print.high"),t.modifyContents&&(n.add("doc.pages.modify"),n.add("doc.redact"),n.add("doc.metadata.modify"),n.add("doc.attachments.modify")),(t.modifyContents||t.assemble)&&(n.add("doc.pages.assemble"),n.add("doc.outline.modify")),t.modifyAnnotations&&n.add("doc.annotate.modify"),(t.modifyContents||t.modifyAnnotations||t.fillForms)&&(n.add("doc.forms.fill"),n.add("doc.sign")),t.modifyAnnotations&&t.modifyContents&&n.add("doc.forms.modify"),[...n]))e.add(r)}(r,t):"collab"===n.kind&&"annotations"===n.entity?i=!0:"collab"===n.kind&&"fields"===n.entity&&(o=!0);for(let e of(r.has("doc.render")&&r.add("doc.render.thumbnail"),r.has("doc.annotate.modify")&&r.add("doc.annotate.read"),r.has("doc.forms.modify")&&(r.add("doc.forms.fill"),r.add("doc.forms.read")),r.has("doc.forms.fill")&&r.add("doc.forms.read"),i&&r.add("doc.annotate.read"),o&&r.add("doc.forms.read"),iR(n)))r.delete(e);return r}function iK(e,t,n,r){if(t===n)return!0;let i=r.map(iB);if(i.some(e=>"wildcard"===e.kind))return!0;for(let n of i)if("collab"===n.kind&&n.entity===e&&("set-group"===n.action||"*"===n.action)&&("all"===n.filter.kind||"group"===n.filter.kind&&n.filter.groupId===t))return!0;return!1}function iZ(e,t,n,r=null){let i="fill"===e?"doc.forms.fill":"doc.sign";if(iR(r).has(i))return!1;let o=t.map(iB);return!!(o.some(e=>"wildcard"===e.kind)||o.some(t=>"collab"===t.kind&&"fields"===t.entity&&(t.action===e||"*"===t.action)))||iH(o,n,r).has(i)}var iJ={left:0,bottom:0,right:612,top:792},iQ={left:0,right:0,bottom:0,top:0};function iX(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));return e[6]=15&e[6]|64,e[8]=63&e[8]|128,i0(e)}function iY(e=Date.now()){let t=globalThis.crypto.getRandomValues(new Uint8Array(16)),n=Math.max(0,Math.floor(e));for(let e=5;e>=0;e--)t[e]=n%256,n=Math.floor(n/256);return t[6]=15&t[6]|112,t[8]=63&t[8]|128,i0(t)}function i0(e){let t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function i1(e){let t,n=(t=new Map(e.pages.map(e=>[e.ref.objectNumber,e.boxes.crop])),e=>{let n=t.get(e.objectNumber);if(!n)throw new N(G.InvalidArg,`No page ${e.objectNumber} in this document`);return n});return{...e,pages:e.pages.map(e=>(function(e,t){var n;let r,{actions:i,viewports:o,...a}=e;return{...a,boxes:(r=(n=e.boxes).crop,{media:nE(n.media,r),crop:nE(n.crop,r),bleed:nE(n.bleed,r),trim:nE(n.trim,r),art:nE(n.art,r)}),...i?{actions:nJ(i,e=>nW(e,t))}:{},...o?{viewports:n0(o,e.boxes.crop)}:{}}})(e,n))}}function i3(e,t){return e.map(e=>({...e,rect:nE(e.rect,t)}))}function i2(e,t){let{actions:n,...r}=e,i=t(e.page);return{...r,...e.rect?{rect:nA(e.rect,i)}:{},...e.box?{box:nA(e.box,i)}:{},...n?{actions:nZ(n,e=>nq(e,t))}:{}}}function i6(e,t){return e.widgets?{...e,widgets:e.widgets.map(e=>i2(e,t))}:e}function i5(e,t){var n,r;return e.actions?{...e,actions:(n=e.actions,r=t,nJ(n,e=>nW(e,r)))}:e}function i4(e,t){return n6(e,t(e.page),t)}function i8(e,t){return{...e,fields:e.fields.map(e=>i5(e,t)),widgets:e.widgets.map(e=>i4(e,t))}}function i7(e,t){let{target:n,...r}=e;return void 0===n?r:{...r,target:n&&"goto"===n.kind?{...n,destination:t(n.destination)}:n}}function i9(e,t){var n;return n=e=>nW(e,t),{...e,target:e.target&&nH(e.target,n),action:e.action&&nK(e.action,n)}}function oe(e,t){return i7(e,e=>nq(e,t))}function ot(e){let{box:t,rect:n,rotation:r,...i}=e;if(void 0!==r&&![0,90,180,270].includes(r))throw new N(G.InvalidArg,`a widget turns by a quarter turn (0, 90, 180 or 270), not ${r}`,{details:{field:"rotation"}});let o=t?eJ(eH(t),r??0):n;if(!o)throw new N(G.InvalidArg,"a widget's placement needs its `rect` or its `box`",{details:{field:"rect"}});return{...i,rect:o,...void 0!==r?{rotation:r}:{},...t7(i.borderStyle,i.dashArray)?{dashArray:[...t8]}:{}}}var on=["certificates","ocspResponses","crls"];function or(e,t,n){let r=t;if(r>=n)return null;let i=e[r++];if((31&i)==31)for(;;){if(r>=n)return null;if((128&e[r++])==0)break}if(r>=n)return null;let o=e[r++],a=o;if(128&o){let t=127&o;if(0===t||t>4||r+t>n)return null;a=0;for(let n=0;nn?null:{constructed:(32&i)!=0,contents:r,end:s}}function oi(e){let t=new oo(e),n=t.value();if(t.skipSpaces(),!t.atEnd())throw Error(`trailing input at ${t.pos}: ${e.slice(t.pos,t.pos+20)}`);return n}var oo=class{constructor(e){this.text=e,I(this,"pos",0)}atEnd(){return this.pos>=this.text.length}skipSpaces(){for(;this.pos>",this.pos))return this.pos+=2,e;if("/"!==this.text[this.pos])throw Error(`expected a key at ${this.pos}`);let t=this.name();this.skipSpaces(),e[t]=this.value()}}stream(){let e=/^stream\((\d+),([0-9a-fA-F]*)\)/.exec(this.text.slice(this.pos));if(!e)throw Error(`malformed stream signature at ${this.pos}`);this.pos+=e[0].length;let t=this.dictEntries();return{t:"stream",length:Number(e[1]),sha256:e[2].toLowerCase(),dict:t}}array(){this.expect("[");let e=[];for(;;){if(this.skipSpaces(),"]"===this.text[this.pos])return this.pos++,{t:"array",items:e};e.push(this.value())}}name(){this.expect("/");let e="";for(;this.pos"===t||"("===t||")"===t)break;if("#"===t&&/^[0-9A-Fa-f]{2}/.test(this.text.slice(this.pos+1,this.pos+3))){e+=String.fromCharCode(parseInt(this.text.slice(this.pos+1,this.pos+3),16)),this.pos+=3;continue}e+=t,this.pos++}return e}literalString(){this.expect("(");let e=1,t="";for(;this.pos - 11.0.4 + 11.0.5 Exe