@ryuzaki13/react-foundation-lib 2.31.1 → 2.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -5
- package/dist/analytical-table/definition/analyticalDefinitionConstants.d.ts +17 -0
- package/dist/analytical-table/definition/analyticalDefinitionConstants.d.ts.map +1 -0
- package/dist/analytical-table/definition/compileAnalyticalTableDefinition.d.ts.map +1 -1
- package/dist/analytical-table/definition/types.d.ts +6 -5
- package/dist/analytical-table/definition/types.d.ts.map +1 -1
- package/dist/analytical-table/dynamic-columns/analyticalDateColumnConstants.d.ts +7 -0
- package/dist/analytical-table/dynamic-columns/analyticalDateColumnConstants.d.ts.map +1 -0
- package/dist/analytical-table/dynamic-columns/dateColumns.d.ts.map +1 -1
- package/dist/analytical-table/dynamic-columns/types.d.ts +2 -1
- package/dist/analytical-table/dynamic-columns/types.d.ts.map +1 -1
- package/dist/analytical-table/index.js +124 -114
- package/dist/analytical-table/index.js.map +1 -1
- package/dist/analytical-table/projections/analyticalExportConstants.d.ts +7 -0
- package/dist/analytical-table/projections/analyticalExportConstants.d.ts.map +1 -0
- package/dist/analytical-table/projections/expansion.d.ts +2 -1
- package/dist/analytical-table/projections/expansion.d.ts.map +1 -1
- package/dist/analytical-table/projections/exportProjection.d.ts.map +1 -1
- package/dist/analytical-table/projections/types.d.ts +3 -2
- package/dist/analytical-table/projections/types.d.ts.map +1 -1
- package/dist/analytical-table/runtime/aggregation.d.ts.map +1 -1
- package/dist/analytical-table/runtime/analyticalRowConstants.d.ts +4 -0
- package/dist/analytical-table/runtime/analyticalRowConstants.d.ts.map +1 -0
- package/dist/analytical-table/runtime/analyticalViewConstants.d.ts +16 -0
- package/dist/analytical-table/runtime/analyticalViewConstants.d.ts.map +1 -0
- package/dist/analytical-table/runtime/buildGroupedModel.d.ts.map +1 -1
- package/dist/analytical-table/runtime/filtering.d.ts.map +1 -1
- package/dist/analytical-table/runtime/grouping.d.ts.map +1 -1
- package/dist/analytical-table/runtime/hierarchy.d.ts +2 -1
- package/dist/analytical-table/runtime/hierarchy.d.ts.map +1 -1
- package/dist/analytical-table/runtime/totals.d.ts +2 -2
- package/dist/analytical-table/runtime/totals.d.ts.map +1 -1
- package/dist/analytical-table/runtime/types.d.ts +5 -3
- package/dist/analytical-table/runtime/types.d.ts.map +1 -1
- package/dist/analytical-table/runtime/valueComparison.d.ts.map +1 -1
- package/dist/array/index.js +1 -1
- package/dist/array/reorder.d.ts +6 -1
- package/dist/array/reorder.d.ts.map +1 -1
- package/dist/async-task-runner/createCoalescingTaskRunner.d.ts.map +1 -1
- package/dist/async-task-runner/createDeadlineTimer.d.ts.map +1 -1
- package/dist/async-task-runner/index.js +39 -36
- package/dist/async-task-runner/index.js.map +1 -1
- package/dist/async-task-runner/nativeTimerConstants.d.ts +3 -0
- package/dist/async-task-runner/nativeTimerConstants.d.ts.map +1 -0
- package/dist/binary/base64Constants.d.ts +6 -0
- package/dist/binary/base64Constants.d.ts.map +1 -0
- package/dist/binary/binaryToBlob.d.ts.map +1 -1
- package/dist/binary/getBase64DecodedSize.d.ts.map +1 -1
- package/dist/binary/index.js +95 -70
- package/dist/binary/index.js.map +1 -1
- package/dist/browser-notifications/browserNotificationConstants.d.ts +3 -0
- package/dist/browser-notifications/browserNotificationConstants.d.ts.map +1 -0
- package/dist/browser-notifications/browserNotificationTypes.d.ts +2 -1
- package/dist/browser-notifications/browserNotificationTypes.d.ts.map +1 -1
- package/dist/browser-notifications/createBrowserNotificationPresenter.d.ts.map +1 -1
- package/dist/browser-notifications/index.js +38 -37
- package/dist/browser-notifications/index.js.map +1 -1
- package/dist/chunks/{array-D-_yMMUK.js → array-bd7LYFto.js} +1 -3
- package/dist/chunks/{array-D-_yMMUK.js.map → array-bd7LYFto.js.map} +1 -1
- package/dist/chunks/{dom-BK22UmgF.js → dom-ZSeWZ0Gg.js} +103 -98
- package/dist/chunks/dom-ZSeWZ0Gg.js.map +1 -0
- package/dist/chunks/formatDate-CNPcfNte.js +133 -0
- package/dist/chunks/formatDate-CNPcfNte.js.map +1 -0
- package/dist/chunks/{formatters-rxriDRPk.js → formatters-CO40zvVB.js} +496 -497
- package/dist/chunks/formatters-CO40zvVB.js.map +1 -0
- package/dist/chunks/{formulas-BXT_XBWI.js → formulas-Y0HOcFhe.js} +90 -86
- package/dist/chunks/formulas-Y0HOcFhe.js.map +1 -0
- package/dist/chunks/hasSignatureBytes-D2wO_Myl.js +11 -0
- package/dist/chunks/hasSignatureBytes-D2wO_Myl.js.map +1 -0
- package/dist/chunks/keyboardConstants-BZKskWsm.js +6 -0
- package/dist/chunks/keyboardConstants-BZKskWsm.js.map +1 -0
- package/dist/chunks/media-imBOXWwa.js +192 -0
- package/dist/chunks/media-imBOXWwa.js.map +1 -0
- package/dist/chunks/mimeTypeConstants-BzONV-b1.js +6 -0
- package/dist/chunks/mimeTypeConstants-BzONV-b1.js.map +1 -0
- package/dist/chunks/{query-client-CVRfrYZM.js → query-client-D0HQZ84w.js} +142 -142
- package/dist/chunks/query-client-D0HQZ84w.js.map +1 -0
- package/dist/chunks/scalarTypeClassification-D4YcGxtQ.js +766 -0
- package/dist/chunks/scalarTypeClassification-D4YcGxtQ.js.map +1 -0
- package/dist/chunks/scalarTypeConstants-CnSsjpGO.js +6 -0
- package/dist/chunks/scalarTypeConstants-CnSsjpGO.js.map +1 -0
- package/dist/chunks/utils-DW0Yso1Q.js +210 -0
- package/dist/chunks/utils-DW0Yso1Q.js.map +1 -0
- package/dist/chunks/{uuid-CUJPAbRY.js → uuid-izDzLv18.js} +1 -2
- package/dist/chunks/uuid-izDzLv18.js.map +1 -0
- package/dist/chunks/validate-8URYKKly.js +613 -0
- package/dist/chunks/validate-8URYKKly.js.map +1 -0
- package/dist/copy/index.js +5 -5
- package/dist/copy/index.js.map +1 -1
- package/dist/copy/useCopyFeedback.d.ts.map +1 -1
- package/dist/crypto/hashString.d.ts.map +1 -1
- package/dist/crypto/hexadecimalConstants.d.ts +3 -0
- package/dist/crypto/hexadecimalConstants.d.ts.map +1 -0
- package/dist/crypto/index.js +25 -24
- package/dist/crypto/index.js.map +1 -1
- package/dist/crypto/uuid.d.ts.map +1 -1
- package/dist/date-segments/index.js +81 -81
- package/dist/date-segments/index.js.map +1 -1
- package/dist/date-segments/mask.d.ts +13 -3
- package/dist/date-segments/mask.d.ts.map +1 -1
- package/dist/decimal/decimalConstants.d.ts +3 -0
- package/dist/decimal/decimalConstants.d.ts.map +1 -0
- package/dist/decimal/index.js +0 -2
- package/dist/decimal/index.js.map +1 -1
- package/dist/decimal/normalizeDecimal.d.ts.map +1 -1
- package/dist/decimal/normalizeDecimalLiteral.d.ts.map +1 -1
- package/dist/decimal/resolveDecimalMaxLength.d.ts.map +1 -1
- package/dist/decimal/sumDecimals.d.ts.map +1 -1
- package/dist/decimal/writeDecimalParts.d.ts.map +1 -1
- package/dist/dom/document-scroll/acquireDocumentScrollLock.d.ts.map +1 -1
- package/dist/dom/document-scroll/attachDocumentTouchScrollGuard.d.ts.map +1 -1
- package/dist/dom/document-scroll/canConsumeVerticalTouchScroll.d.ts.map +1 -1
- package/dist/dom/domEventConstants.d.ts +4 -0
- package/dist/dom/domEventConstants.d.ts.map +1 -0
- package/dist/dom/domScrollConstants.d.ts +3 -0
- package/dist/dom/domScrollConstants.d.ts.map +1 -0
- package/dist/dom/index.js +1 -1
- package/dist/dom/installFaviconOverride.d.ts.map +1 -1
- package/dist/dom/overlayFocusConstants.d.ts +4 -0
- package/dist/dom/overlayFocusConstants.d.ts.map +1 -0
- package/dist/dom/scroll-anchor/captureScrollAnchor.d.ts.map +1 -1
- package/dist/dom/useClickOutside.d.ts +1 -1
- package/dist/dom/useClickOutside.d.ts.map +1 -1
- package/dist/dom/useEscapeDismiss.d.ts +1 -1
- package/dist/dom/useEscapeDismiss.d.ts.map +1 -1
- package/dist/dom/useFocusTrap.d.ts.map +1 -1
- package/dist/dom/useIsTouchDevice.d.ts.map +1 -1
- package/dist/dom/useOverlayFocus.d.ts +3 -2
- package/dist/dom/useOverlayFocus.d.ts.map +1 -1
- package/dist/dom/visual-viewport/attachVisualViewportFrame.d.ts.map +1 -1
- package/dist/error-report/breadcrumbs.d.ts.map +1 -1
- package/dist/error-report/capture.d.ts.map +1 -1
- package/dist/error-report/captureOptions.d.ts +3 -2
- package/dist/error-report/captureOptions.d.ts.map +1 -1
- package/dist/error-report/capturePolicyConstants.d.ts +4 -0
- package/dist/error-report/capturePolicyConstants.d.ts.map +1 -0
- package/dist/error-report/dataPreview.d.ts.map +1 -1
- package/dist/error-report/diagnostics.d.ts.map +1 -1
- package/dist/error-report/drafts.d.ts.map +1 -1
- package/dist/error-report/environment.d.ts.map +1 -1
- package/dist/error-report/errorInfo.d.ts.map +1 -1
- package/dist/error-report/errorReportCaptureLimits.d.ts +26 -0
- package/dist/error-report/errorReportCaptureLimits.d.ts.map +1 -0
- package/dist/error-report/errorReportContractConstants.d.ts +32 -0
- package/dist/error-report/errorReportContractConstants.d.ts.map +1 -0
- package/dist/error-report/index.js +586 -587
- package/dist/error-report/index.js.map +1 -1
- package/dist/error-report/payload.d.ts.map +1 -1
- package/dist/error-report/queue.d.ts.map +1 -1
- package/dist/error-report/queueContract.d.ts +7 -6
- package/dist/error-report/queueContract.d.ts.map +1 -1
- package/dist/error-report/queueRecord.d.ts.map +1 -1
- package/dist/error-report/queueResultConstants.d.ts +14 -0
- package/dist/error-report/queueResultConstants.d.ts.map +1 -0
- package/dist/error-report/runtimeDeduplication.d.ts +2 -1
- package/dist/error-report/runtimeDeduplication.d.ts.map +1 -1
- package/dist/error-report/safeValue.d.ts.map +1 -1
- package/dist/error-report/safeValueMarkerConstants.d.ts +16 -0
- package/dist/error-report/safeValueMarkerConstants.d.ts.map +1 -0
- package/dist/error-report/schema.d.ts.map +1 -1
- package/dist/error-report/types.d.ts +10 -8
- package/dist/error-report/types.d.ts.map +1 -1
- package/dist/error-report-source-maps/archive.d.ts.map +1 -1
- package/dist/error-report-source-maps/artifact.d.ts.map +1 -1
- package/dist/error-report-source-maps/index.js +238 -238
- package/dist/error-report-source-maps/index.js.map +1 -1
- package/dist/error-report-source-maps/manifest.d.ts.map +1 -1
- package/dist/error-report-source-maps/package.d.ts.map +1 -1
- package/dist/error-report-source-maps/sourceMapArtifactConstants.d.ts +11 -0
- package/dist/error-report-source-maps/sourceMapArtifactConstants.d.ts.map +1 -0
- package/dist/error-report-source-maps/symbolicate.d.ts.map +1 -1
- package/dist/error-report-source-maps/symbolicationResultConstants.d.ts +6 -0
- package/dist/error-report-source-maps/symbolicationResultConstants.d.ts.map +1 -0
- package/dist/error-report-source-maps/types.d.ts +4 -2
- package/dist/error-report-source-maps/types.d.ts.map +1 -1
- package/dist/excel/excel.d.ts.map +1 -1
- package/dist/excel/excelWorkbookConstants.d.ts +6 -0
- package/dist/excel/excelWorkbookConstants.d.ts.map +1 -0
- package/dist/excel/index.js +117 -116
- package/dist/excel/index.js.map +1 -1
- package/dist/excel/matrixWorkbook.d.ts +6 -1
- package/dist/excel/matrixWorkbook.d.ts.map +1 -1
- package/dist/excel/tableExport.d.ts.map +1 -1
- package/dist/file/checkFileSignature.d.ts.map +1 -1
- package/dist/file/contentDisposition.d.ts.map +1 -1
- package/dist/file/fileSignatureConstants.d.ts +14 -18
- package/dist/file/fileSignatureConstants.d.ts.map +1 -1
- package/dist/file/fileSignatureTypes.d.ts +3 -3
- package/dist/file/fileSignatureTypes.d.ts.map +1 -1
- package/dist/file/image/imageReadConstants.d.ts +3 -0
- package/dist/file/image/imageReadConstants.d.ts.map +1 -0
- package/dist/file/image/readImageFile.d.ts +3 -2
- package/dist/file/image/readImageFile.d.ts.map +1 -1
- package/dist/file/image/types.d.ts +5 -3
- package/dist/file/image/types.d.ts.map +1 -1
- package/dist/file/index.js +139 -165
- package/dist/file/index.js.map +1 -1
- package/dist/file/mimeType.d.ts.map +1 -1
- package/dist/file/mimeTypeConstants.d.ts +18 -0
- package/dist/file/mimeTypeConstants.d.ts.map +1 -0
- package/dist/file/read-file/assert.d.ts.map +1 -1
- package/dist/file/read-file/readFile.d.ts +3 -11
- package/dist/file/read-file/readFile.d.ts.map +1 -1
- package/dist/file/read-file/readFileConstants.d.ts +13 -0
- package/dist/file/read-file/readFileConstants.d.ts.map +1 -0
- package/dist/file/read-file/types.d.ts +7 -6
- package/dist/file/read-file/types.d.ts.map +1 -1
- package/dist/file/signature/checkArchiveSignature.d.ts.map +1 -1
- package/dist/file-system/fileSystemConstants.d.ts +5 -0
- package/dist/file-system/fileSystemConstants.d.ts.map +1 -0
- package/dist/file-system/fileSystemTypes.d.ts +2 -1
- package/dist/file-system/fileSystemTypes.d.ts.map +1 -1
- package/dist/file-system/index.js +11 -10
- package/dist/file-system/index.js.map +1 -1
- package/dist/file-system/resolvePathInsideRoot.d.ts.map +1 -1
- package/dist/formatters/boolean/parseAbapBoolean.d.ts.map +1 -1
- package/dist/formatters/boolean/toAbapBoolean.d.ts.map +1 -1
- package/dist/formatters/date/calendarDate.d.ts.map +1 -1
- package/dist/formatters/date/calendarDateConstants.d.ts +13 -0
- package/dist/formatters/date/calendarDateConstants.d.ts.map +1 -0
- package/dist/formatters/date/calendarPeriod.d.ts +11 -2
- package/dist/formatters/date/calendarPeriod.d.ts.map +1 -1
- package/dist/formatters/date/dateFormatConstants.d.ts +17 -0
- package/dist/formatters/date/dateFormatConstants.d.ts.map +1 -0
- package/dist/formatters/date/datePatternConstants.d.ts +16 -0
- package/dist/formatters/date/datePatternConstants.d.ts.map +1 -0
- package/dist/formatters/date/datePresetNameConstants.d.ts +27 -0
- package/dist/formatters/date/datePresetNameConstants.d.ts.map +1 -0
- package/dist/formatters/date/dateRange.d.ts +3 -1
- package/dist/formatters/date/dateRange.d.ts.map +1 -1
- package/dist/formatters/date/dateValueConstants.d.ts +15 -0
- package/dist/formatters/date/dateValueConstants.d.ts.map +1 -0
- package/dist/formatters/date/educationDate.d.ts.map +1 -1
- package/dist/formatters/date/formatDate.d.ts.map +1 -1
- package/dist/formatters/date/formatInstantDateTime.d.ts.map +1 -1
- package/dist/formatters/date/parseDate.d.ts.map +1 -1
- package/dist/formatters/date/pattern.d.ts.map +1 -1
- package/dist/formatters/date/presets.d.ts.map +1 -1
- package/dist/formatters/date/types.d.ts +8 -6
- package/dist/formatters/date/types.d.ts.map +1 -1
- package/dist/formatters/formatDurationMinutes.d.ts.map +1 -1
- package/dist/formatters/formatFileSize.d.ts.map +1 -1
- package/dist/formatters/formatPhone.d.ts.map +1 -1
- package/dist/formatters/index.js +6 -6
- package/dist/formatters/normalizeLeadingZeros.d.ts.map +1 -1
- package/dist/formatters/number/compact.d.ts.map +1 -1
- package/dist/formatters/number/formatCompactNumber.d.ts.map +1 -1
- package/dist/formatters/number/formatNumber.d.ts.map +1 -1
- package/dist/formatters/number/numberFormatConstants.d.ts +11 -0
- package/dist/formatters/number/numberFormatConstants.d.ts.map +1 -0
- package/dist/formatters/number/numberPresetNameConstants.d.ts +16 -0
- package/dist/formatters/number/numberPresetNameConstants.d.ts.map +1 -0
- package/dist/formatters/number/parseNumber.d.ts.map +1 -1
- package/dist/formatters/number/presets.d.ts.map +1 -1
- package/dist/formatters/number/types.d.ts +2 -1
- package/dist/formatters/number/types.d.ts.map +1 -1
- package/dist/formatters/pipeline/clone.d.ts.map +1 -1
- package/dist/formatters/pipeline/definitions.d.ts.map +1 -1
- package/dist/formatters/pipeline/dependencies.d.ts.map +1 -1
- package/dist/formatters/pipeline/execute.d.ts +4 -1
- package/dist/formatters/pipeline/execute.d.ts.map +1 -1
- package/dist/formatters/pipeline/formattersPipelineConstants.d.ts +19 -0
- package/dist/formatters/pipeline/formattersPipelineConstants.d.ts.map +1 -0
- package/dist/formatters/pipeline/normalize.d.ts.map +1 -1
- package/dist/formatters/pipeline/pipelineValidationConstants.d.ts +40 -0
- package/dist/formatters/pipeline/pipelineValidationConstants.d.ts.map +1 -0
- package/dist/formatters/pipeline/registry.d.ts +1 -1
- package/dist/formatters/pipeline/registry.d.ts.map +1 -1
- package/dist/formatters/pipeline/rekey.d.ts.map +1 -1
- package/dist/formatters/pipeline/runtime.d.ts.map +1 -1
- package/dist/formatters/pipeline/types.d.ts +24 -21
- package/dist/formatters/pipeline/types.d.ts.map +1 -1
- package/dist/formatters/pipeline/validate.d.ts +2 -1
- package/dist/formatters/pipeline/validate.d.ts.map +1 -1
- package/dist/formatters/strings/spaceCharacterConstants.d.ts +5 -0
- package/dist/formatters/strings/spaceCharacterConstants.d.ts.map +1 -0
- package/dist/formatters/strings/stripInnerSpaces.d.ts.map +1 -1
- package/dist/formatters/strings/stripLeadingZeros.d.ts.map +1 -1
- package/dist/formatters/valueState/fixedValueStateResolver.d.ts.map +1 -1
- package/dist/formatters/valueState/presentation.d.ts.map +1 -1
- package/dist/formatters/valueState/resolveValueStateClassName.d.ts.map +1 -1
- package/dist/formatters/valueState/thresholdValueStateResolver.d.ts.map +1 -1
- package/dist/formatters/valueState/types.d.ts +2 -1
- package/dist/formatters/valueState/types.d.ts.map +1 -1
- package/dist/formatters/valueState/valueStateRegistry.d.ts.map +1 -1
- package/dist/formatters/valueState/valueStateResolverConstants.d.ts +6 -0
- package/dist/formatters/valueState/valueStateResolverConstants.d.ts.map +1 -0
- package/dist/formulas/execute.d.ts +3 -2
- package/dist/formulas/execute.d.ts.map +1 -1
- package/dist/formulas/index.js +1 -1
- package/dist/formulas/isTableFormulaDependency.d.ts.map +1 -1
- package/dist/formulas/tableFormulaConstants.d.ts +12 -0
- package/dist/formulas/tableFormulaConstants.d.ts.map +1 -0
- package/dist/formulas/types.d.ts +2 -1
- package/dist/formulas/types.d.ts.map +1 -1
- package/dist/formulas/validate.d.ts +2 -1
- package/dist/formulas/validate.d.ts.map +1 -1
- package/dist/hooks/index.js +110 -107
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useBlockBrowserZoom.d.ts.map +1 -1
- package/dist/hooks/useDndSortableSensors.d.ts.map +1 -1
- package/dist/hooks/useFloatingListbox.d.ts +15 -33
- package/dist/hooks/useFloatingListbox.d.ts.map +1 -1
- package/dist/http/index.js +8 -7
- package/dist/http/index.js.map +1 -1
- package/dist/http/textResponse.d.ts.map +1 -1
- package/dist/indexed-records/createIndexedRecordsSchema.d.ts.map +1 -1
- package/dist/indexed-records/schema.js +24 -23
- package/dist/indexed-records/schema.js.map +1 -1
- package/dist/media/breakpointConstants.d.ts +5 -0
- package/dist/media/breakpointConstants.d.ts.map +1 -0
- package/dist/media/breakpoints.d.ts +2 -1
- package/dist/media/breakpoints.d.ts.map +1 -1
- package/dist/media/createNotificationTonePlayer.d.ts.map +1 -1
- package/dist/media/getCurrentFontSize.d.ts.map +1 -1
- package/dist/media/index.js +1 -1
- package/dist/media/mediaQueryConstants.d.ts +3 -0
- package/dist/media/mediaQueryConstants.d.ts.map +1 -0
- package/dist/media/responsive.d.ts +1 -1
- package/dist/media/responsive.d.ts.map +1 -1
- package/dist/media/useMatchMedia.d.ts.map +1 -1
- package/dist/media/useMediaQuery.d.ts.map +1 -1
- package/dist/metadata/baseMetaTypes.d.ts.map +1 -1
- package/dist/metadata/metadataTypes.d.ts +8 -7
- package/dist/metadata/metadataTypes.d.ts.map +1 -1
- package/dist/metadata/scalarTypeClassification.d.ts.map +1 -1
- package/dist/metadata/scalarTypeConstants.d.ts +21 -0
- package/dist/metadata/scalarTypeConstants.d.ts.map +1 -0
- package/dist/notifications/index.js +62 -62
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/notificationTypeConstants.d.ts +6 -0
- package/dist/notifications/notificationTypeConstants.d.ts.map +1 -0
- package/dist/notifications/notify.d.ts.map +1 -1
- package/dist/notifications/store.d.ts.map +1 -1
- package/dist/notifications/types.d.ts +2 -1
- package/dist/notifications/types.d.ts.map +1 -1
- package/dist/number-scale/index.js +47 -46
- package/dist/number-scale/index.js.map +1 -1
- package/dist/number-scale/marksPositionConstants.d.ts +4 -0
- package/dist/number-scale/marksPositionConstants.d.ts.map +1 -0
- package/dist/number-scale/numberScale.d.ts +1 -1
- package/dist/number-scale/numberScale.d.ts.map +1 -1
- package/dist/number-scale/types.d.ts +2 -1
- package/dist/number-scale/types.d.ts.map +1 -1
- package/dist/odata-service/builder.d.ts.map +1 -1
- package/dist/odata-service/columns.d.ts.map +1 -1
- package/dist/odata-service/entityOperationConstants.d.ts +4 -0
- package/dist/odata-service/entityOperationConstants.d.ts.map +1 -0
- package/dist/odata-service/filterDefinitionConstants.d.ts +24 -0
- package/dist/odata-service/filterDefinitionConstants.d.ts.map +1 -0
- package/dist/odata-service/filterDefinitions.d.ts +19 -17
- package/dist/odata-service/filterDefinitions.d.ts.map +1 -1
- package/dist/odata-service/filterOperationConstants.d.ts +14 -0
- package/dist/odata-service/filterOperationConstants.d.ts.map +1 -0
- package/dist/odata-service/filters.d.ts.map +1 -1
- package/dist/odata-service/formatters.d.ts.map +1 -1
- package/dist/odata-service/index.js +439 -433
- package/dist/odata-service/index.js.map +1 -1
- package/dist/odata-service/odataMetadataConstants.d.ts +8 -0
- package/dist/odata-service/odataMetadataConstants.d.ts.map +1 -0
- package/dist/odata-service/parser.d.ts +1 -3
- package/dist/odata-service/parser.d.ts.map +1 -1
- package/dist/odata-service/schema.d.ts.map +1 -1
- package/dist/odata-service/sorts.d.ts.map +1 -1
- package/dist/odata-service/sqlFilters.d.ts +10 -5
- package/dist/odata-service/sqlFilters.d.ts.map +1 -1
- package/dist/odata-service/types.d.ts +5 -3
- package/dist/odata-service/types.d.ts.map +1 -1
- package/dist/pwa/index.js +72 -71
- package/dist/pwa/index.js.map +1 -1
- package/dist/pwa/sw-cache-policy.js +47 -47
- package/dist/pwa/sw-cache-policy.js.map +1 -1
- package/dist/pwa/swCachePolicy.d.ts +5 -1
- package/dist/pwa/swCachePolicy.d.ts.map +1 -1
- package/dist/pwa/useBrowserOnlineStatus.d.ts.map +1 -1
- package/dist/query-client/broadcast.d.ts +4 -3
- package/dist/query-client/broadcast.d.ts.map +1 -1
- package/dist/query-client/createQueryRestoreSchedulerGuard.d.ts.map +1 -1
- package/dist/query-client/createQueryRestoreStorage.d.ts.map +1 -1
- package/dist/query-client/index.js +1 -1
- package/dist/query-client/invalidationBroadcast.d.ts +2 -1
- package/dist/query-client/invalidationBroadcast.d.ts.map +1 -1
- package/dist/query-client/persistence.d.ts +9 -6
- package/dist/query-client/persistence.d.ts.map +1 -1
- package/dist/query-client/queryCacheEventConstants.d.ts +11 -0
- package/dist/query-client/queryCacheEventConstants.d.ts.map +1 -0
- package/dist/query-client/queryClient.d.ts +2 -1
- package/dist/query-client/queryClient.d.ts.map +1 -1
- package/dist/query-client/queryMeta.d.ts.map +1 -1
- package/dist/query-client/sessionPersistenceConstants.d.ts +5 -0
- package/dist/query-client/sessionPersistenceConstants.d.ts.map +1 -0
- package/dist/query-client/sessionScoped.d.ts.map +1 -1
- package/dist/query-client/sessionScopedResetConstants.d.ts +4 -0
- package/dist/query-client/sessionScopedResetConstants.d.ts.map +1 -0
- package/dist/query-client/sessionScopedResetLifecycleTypes.d.ts +2 -1
- package/dist/query-client/sessionScopedResetLifecycleTypes.d.ts.map +1 -1
- package/dist/seo/index.js +0 -1
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/seo.d.ts +3 -2
- package/dist/seo/seo.d.ts.map +1 -1
- package/dist/seo/seoContentTypeConstants.d.ts +6 -0
- package/dist/seo/seoContentTypeConstants.d.ts.map +1 -0
- package/dist/seo/types.d.ts +2 -1
- package/dist/seo/types.d.ts.map +1 -1
- package/dist/session-storage/index.js +1 -1
- package/dist/table/cellSelection.d.ts.map +1 -1
- package/dist/table/columnSizing.d.ts +11 -3
- package/dist/table/columnSizing.d.ts.map +1 -1
- package/dist/table/index.d.ts +1 -0
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +102 -92
- package/dist/table/index.js.map +1 -1
- package/dist/table/odataAdapter.d.ts +3 -3
- package/dist/table/odataAdapter.d.ts.map +1 -1
- package/dist/table/resolveTableColumnsWidth.d.ts +9 -0
- package/dist/table/resolveTableColumnsWidth.d.ts.map +1 -0
- package/dist/table/selection.d.ts +2 -2
- package/dist/table/selection.d.ts.map +1 -1
- package/dist/table/tableColumnConstants.d.ts +5 -0
- package/dist/table/tableColumnConstants.d.ts.map +1 -0
- package/dist/table/tableSelectionConstants.d.ts +8 -0
- package/dist/table/tableSelectionConstants.d.ts.map +1 -0
- package/dist/table/tanStackFeatures.d.ts +8 -8
- package/dist/table/types.d.ts +6 -4
- package/dist/table/types.d.ts.map +1 -1
- package/dist/table/useTableRowSelection.d.ts +2 -2
- package/dist/table/useTableRowSelection.d.ts.map +1 -1
- package/dist/table-document/index.js +88 -87
- package/dist/table-document/index.js.map +1 -1
- package/dist/table-document/insertTableDocumentAxis.d.ts +2 -1
- package/dist/table-document/insertTableDocumentAxis.d.ts.map +1 -1
- package/dist/table-document/tableDocument.d.ts +2 -1
- package/dist/table-document/tableDocument.d.ts.map +1 -1
- package/dist/table-document/tableDocumentAxisGroups.d.ts +4 -3
- package/dist/table-document/tableDocumentAxisGroups.d.ts.map +1 -1
- package/dist/table-document/tableDocumentConstants.d.ts +8 -0
- package/dist/table-document/tableDocumentConstants.d.ts.map +1 -0
- package/dist/table-document/tableDocumentGeometry.d.ts.map +1 -1
- package/dist/three-scene/index.js +32 -32
- package/dist/three-scene/index.js.map +1 -1
- package/dist/three-scene/threeSceneAvailability.d.ts +4 -3
- package/dist/three-scene/threeSceneAvailability.d.ts.map +1 -1
- package/dist/three-scene/threeSceneConstants.d.ts +14 -0
- package/dist/three-scene/threeSceneConstants.d.ts.map +1 -0
- package/dist/three-scene/useThreeSceneAvailability.d.ts.map +1 -1
- package/dist/tree-table/index.js +1 -1
- package/dist/types/abapBooleanConstants.d.ts +4 -0
- package/dist/types/abapBooleanConstants.d.ts.map +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/types.d.ts +4 -2
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/valueStateConstants.d.ts +8 -0
- package/dist/types/valueStateConstants.d.ts.map +1 -0
- package/dist/utils/cloneFunctionStrategyConstants.d.ts +4 -0
- package/dist/utils/cloneFunctionStrategyConstants.d.ts.map +1 -0
- package/dist/utils/createLazyComponent.d.ts.map +1 -1
- package/dist/utils/deepCloneWithoutFunctions.d.ts +2 -1
- package/dist/utils/deepCloneWithoutFunctions.d.ts.map +1 -1
- package/dist/utils/deepCopyWithoutFunctions.d.ts +2 -1
- package/dist/utils/deepCopyWithoutFunctions.d.ts.map +1 -1
- package/dist/utils/index.js +2 -209
- package/dist/utils/keyboard.d.ts +2 -1
- package/dist/utils/keyboard.d.ts.map +1 -1
- package/dist/utils/keyboardConstants.d.ts +16 -0
- package/dist/utils/keyboardConstants.d.ts.map +1 -0
- package/dist/validators/index.js +3 -3
- package/dist/validators/index.js.map +1 -1
- package/dist/validators/validateUrl.d.ts.map +1 -1
- package/dist/value-transformers/execute.d.ts.map +1 -1
- package/dist/value-transformers/index.js +9 -6
- package/dist/value-transformers/index.js.map +1 -1
- package/dist/value-transformers/types.d.ts +3 -2
- package/dist/value-transformers/types.d.ts.map +1 -1
- package/dist/value-transformers/valueTransformerConstants.d.ts +4 -0
- package/dist/value-transformers/valueTransformerConstants.d.ts.map +1 -0
- package/package.json +6 -5
- package/src/binary/README.mdx +1 -1
- package/src/dom/README.mdx +1 -1
- package/src/query-client/README.mdx +4 -4
- package/src/table/README.mdx +49 -23
- package/dist/chunks/dom-BK22UmgF.js.map +0 -1
- package/dist/chunks/formatDate-BUvpRI7H.js +0 -133
- package/dist/chunks/formatDate-BUvpRI7H.js.map +0 -1
- package/dist/chunks/formatters-rxriDRPk.js.map +0 -1
- package/dist/chunks/formulas-BXT_XBWI.js.map +0 -1
- package/dist/chunks/media-WK38KtMl.js +0 -191
- package/dist/chunks/media-WK38KtMl.js.map +0 -1
- package/dist/chunks/query-client-CVRfrYZM.js.map +0 -1
- package/dist/chunks/scalarTypeClassification-BZcFmIyR.js +0 -764
- package/dist/chunks/scalarTypeClassification-BZcFmIyR.js.map +0 -1
- package/dist/chunks/uuid-CUJPAbRY.js.map +0 -1
- package/dist/chunks/validate-DsUR-bFF.js +0 -608
- package/dist/chunks/validate-DsUR-bFF.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
|
@@ -1,65 +1,68 @@
|
|
|
1
|
-
//#region src/async-task-runner/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
let
|
|
1
|
+
//#region src/async-task-runner/nativeTimerConstants.ts
|
|
2
|
+
var e = "retry";
|
|
3
|
+
function t(t) {
|
|
4
|
+
for (let e of [t.retryDelayMs, ...t.pollIntervalMs === void 0 ? [] : [t.pollIntervalMs]]) if (!Number.isInteger(e) || e < 1 || e > 2147483647) throw RangeError("Задержки runner должны быть целыми числами от 1 до 2147483647 ms.");
|
|
5
|
+
let n = null, r = null, i = 0, a = (e) => {
|
|
5
6
|
e.scheduledWake && clearTimeout(e.scheduledWake.timer), e.scheduledWake = null;
|
|
6
|
-
}, a = (e) => {
|
|
7
|
-
i(e), e.pollTimer !== null && clearInterval(e.pollTimer), e.pollTimer = null;
|
|
8
7
|
}, o = (e) => {
|
|
9
|
-
|
|
10
|
-
}, s = (
|
|
11
|
-
|
|
8
|
+
a(e), e.pollTimer !== null && clearInterval(e.pollTimer), e.pollTimer = null;
|
|
9
|
+
}, s = (t) => {
|
|
10
|
+
n !== t || t.reportingFailure || t.scheduledWake?.kind === e || l().catch(() => {});
|
|
11
|
+
}, c = (e, t, r) => {
|
|
12
|
+
if (n !== e || e.reportingFailure || e.scheduledWake) return;
|
|
12
13
|
let i = setTimeout(() => {
|
|
13
|
-
|
|
14
|
+
n === e && e.scheduledWake?.timer === i && (e.scheduledWake = null, s(e));
|
|
14
15
|
}, r);
|
|
15
16
|
e.scheduledWake = {
|
|
16
|
-
kind:
|
|
17
|
+
kind: t,
|
|
17
18
|
timer: i
|
|
18
19
|
}, i.unref?.();
|
|
19
|
-
},
|
|
20
|
-
let
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
}).catch(async (
|
|
20
|
+
}, l = () => {
|
|
21
|
+
let r = n;
|
|
22
|
+
return r ? r.reportingFailure ? Promise.reject(r.reportingFailure.error) : r.pending ? (r.rerun = !0, r.pending) : (a(r), r.rerun = !1, r.pending = Promise.resolve().then(async () => {
|
|
23
|
+
n === r && await t.run();
|
|
24
|
+
}).catch(async (n) => {
|
|
24
25
|
try {
|
|
25
|
-
await
|
|
26
|
+
await t.onError(n);
|
|
26
27
|
} catch (e) {
|
|
27
|
-
|
|
28
|
+
r.reportingFailure = { error: e }, r.rerun = !1, o(r);
|
|
28
29
|
}
|
|
29
|
-
throw
|
|
30
|
+
throw c(r, e, t.retryDelayMs), n;
|
|
30
31
|
}).finally(() => {
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
-
},
|
|
34
|
-
if (
|
|
35
|
-
if (
|
|
36
|
-
let
|
|
32
|
+
r.pending = null, r.rerun && c(r, "tail", 0);
|
|
33
|
+
}), r.pending) : Promise.resolve();
|
|
34
|
+
}, u = (e) => {
|
|
35
|
+
if (e !== i) return Promise.reject(/* @__PURE__ */ Error("Запуск runner отменён более поздней остановкой."));
|
|
36
|
+
if (n) return n.reportingFailure ? Promise.reject(n.reportingFailure.error) : n.pending ?? Promise.resolve();
|
|
37
|
+
let r = {
|
|
37
38
|
pending: null,
|
|
38
39
|
rerun: !1,
|
|
39
40
|
pollTimer: null,
|
|
40
41
|
scheduledWake: null,
|
|
41
42
|
reportingFailure: null
|
|
42
43
|
};
|
|
43
|
-
return
|
|
44
|
+
return n = r, t.pollIntervalMs !== void 0 && (r.pollTimer = setInterval(() => s(r), t.pollIntervalMs), r.pollTimer.unref?.()), l();
|
|
44
45
|
};
|
|
45
46
|
return {
|
|
46
47
|
start() {
|
|
47
|
-
let e =
|
|
48
|
-
return
|
|
48
|
+
let e = i;
|
|
49
|
+
return r ? r.then(() => u(e)) : u(e);
|
|
49
50
|
},
|
|
50
|
-
wake:
|
|
51
|
+
wake: l,
|
|
51
52
|
stop() {
|
|
52
|
-
if (
|
|
53
|
-
let e =
|
|
54
|
-
return e ? (
|
|
53
|
+
if (i++, r) return r;
|
|
54
|
+
let e = n;
|
|
55
|
+
return e ? (n = null, e.rerun = !1, o(e), r = (async () => {
|
|
55
56
|
if (await e.pending?.catch(() => {}), e.reportingFailure) throw e.reportingFailure.error;
|
|
56
57
|
})().finally(() => {
|
|
57
|
-
|
|
58
|
-
}),
|
|
58
|
+
r = null;
|
|
59
|
+
}), r) : Promise.resolve();
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/async-task-runner/createDeadlineTimer.ts
|
|
65
|
+
function n({ onDue: e }) {
|
|
63
66
|
let t = null, n = () => {
|
|
64
67
|
let e = t;
|
|
65
68
|
t = null, e && e.timer !== null && (clearTimeout(e.timer), e.timer = null);
|
|
@@ -94,6 +97,6 @@ function t({ onDue: e }) {
|
|
|
94
97
|
};
|
|
95
98
|
}
|
|
96
99
|
//#endregion
|
|
97
|
-
export {
|
|
100
|
+
export { t as createCoalescingTaskRunner, n as createDeadlineTimer };
|
|
98
101
|
|
|
99
102
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/async-task-runner/createCoalescingTaskRunner.ts","../../src/async-task-runner/createDeadlineTimer.ts"],"sourcesContent":["import { type CoalescingTaskRunner, type CoalescingTaskRunnerOptions } from \"./asyncTaskRunnerTypes\";\n\ntype ScheduledWake = { kind: \"retry\" | \"tail\"; timer: ReturnType<typeof setTimeout> };\ntype RunnerGeneration = {\n\tpending: Promise<void> | null;\n\trerun: boolean;\n\tpollTimer: ReturnType<typeof setInterval> | null;\n\tscheduledWake: ScheduledWake | null;\n\treportingFailure: Readonly<{ error: unknown }> | null;\n};\n\n/**\n * Создаёт неактивный runner. Поколение защищает от поздних таймеров, single-flight\n * объединяет сигналы в один следующий проход, stop не имитирует отмену уже\n * выполняющейся атомарной задачи. Предметная запись и диагностика принадлежат caller.\n */\nexport function createCoalescingTaskRunner(options: CoalescingTaskRunnerOptions): CoalescingTaskRunner {\n\tfor (const delay of [options.retryDelayMs, ...(options.pollIntervalMs === undefined ? [] : [options.pollIntervalMs])]) {\n\t\t// Более длинную задержку Node превращает в 1 ms: молчаливое ограничение здесь опасно.\n\t\tif (!Number.isInteger(delay) || delay < 1 || delay > 2_147_483_647) {\n\t\t\tthrow new RangeError(\"Задержки runner должны быть целыми числами от 1 до 2147483647 ms.\");\n\t\t}\n\t}\n\tlet active: RunnerGeneration | null = null;\n\tlet stopping: Promise<void> | null = null;\n\tlet stopRevision = 0;\n\n\tconst clearScheduledWake = (generation: RunnerGeneration) => {\n\t\tif (generation.scheduledWake) clearTimeout(generation.scheduledWake.timer);\n\t\tgeneration.scheduledWake = null;\n\t};\n\tconst clearTimers = (generation: RunnerGeneration) => {\n\t\tclearScheduledWake(generation);\n\t\tif (generation.pollTimer !== null) clearInterval(generation.pollTimer);\n\t\tgeneration.pollTimer = null;\n\t};\n\tconst backgroundWake = (generation: RunnerGeneration) => {\n\t\tif (active !== generation || generation.reportingFailure || generation.scheduledWake?.kind === \"retry\") return;\n\t\t// Обычный отказ уже передан onError; отказ самого onError сохранён для\n\t\t// admission/stop. Timer не создаёт unhandled rejection и не теряет reporter error.\n\t\tvoid wake().catch(() => {});\n\t};\n\tconst schedule = (generation: RunnerGeneration, kind: ScheduledWake[\"kind\"], delay: number) => {\n\t\tif (active !== generation || generation.reportingFailure || generation.scheduledWake) return;\n\t\tconst timer = setTimeout(() => {\n\t\t\tif (active !== generation || generation.scheduledWake?.timer !== timer) return;\n\t\t\tgeneration.scheduledWake = null;\n\t\t\tbackgroundWake(generation);\n\t\t}, delay);\n\t\tgeneration.scheduledWake = { kind, timer };\n\t\ttimer.unref?.();\n\t};\n\tconst wake = (): Promise<void> => {\n\t\tconst generation = active;\n\t\tif (!generation) return Promise.resolve();\n\t\tif (generation.reportingFailure) return Promise.reject(generation.reportingFailure.error);\n\t\tif (generation.pending) {\n\t\t\tgeneration.rerun = true;\n\t\t\treturn generation.pending;\n\t\t}\n\t\t// Явный wake ускоряет retry. Только caller, не poll, может принять это решение.\n\t\tclearScheduledWake(generation);\n\t\tgeneration.rerun = false;\n\t\tgeneration.pending = Promise.resolve()\n\t\t\t.then(async () => {\n\t\t\t\t// stop до первой microtask не разрешает позднее выполнение callback.\n\t\t\t\tif (active === generation) await options.run();\n\t\t\t})\n\t\t\t.catch(async (error: unknown) => {\n\t\t\t\t// Уже начатый run сообщает отказ даже после stop; shutdown не скрывает ошибку.\n\t\t\t\ttry {\n\t\t\t\t\tawait options.onError(error);\n\t\t\t\t} catch (reporterError: unknown) {\n\t\t\t\t\t// Wrapper различает отсутствие отказа и реальные throw undefined/null.\n\t\t\t\t\tgeneration.reportingFailure = { error: reporterError };\n\t\t\t\t\tgeneration.rerun = false;\n\t\t\t\t\tclearTimers(generation);\n\t\t\t\t}\n\t\t\t\tschedule(generation, \"retry\", options.retryDelayMs);\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tgeneration.pending = null;\n\t\t\t\t// При отказе retry timer уже существует и не заменяется немедленным хвостом.\n\t\t\t\tif (generation.rerun) schedule(generation, \"tail\", 0);\n\t\t\t});\n\t\treturn generation.pending;\n\t};\n\tconst startGeneration = (requestedBeforeStop: number): Promise<void> => {\n\t\tif (requestedBeforeStop !== stopRevision) return Promise.reject(new Error(\"Запуск runner отменён более поздней остановкой.\"));\n\t\tif (active) {\n\t\t\tif (active.reportingFailure) return Promise.reject(active.reportingFailure.error);\n\t\t\t// Повторный start не является wake и не создаёт лишний хвост или обход retry.\n\t\t\treturn active.pending ?? Promise.resolve();\n\t\t}\n\t\tconst generation: RunnerGeneration = { pending: null, rerun: false, pollTimer: null, scheduledWake: null, reportingFailure: null };\n\t\tactive = generation;\n\t\tif (options.pollIntervalMs !== undefined) {\n\t\t\tgeneration.pollTimer = setInterval(() => backgroundWake(generation), options.pollIntervalMs);\n\t\t\tgeneration.pollTimer.unref?.();\n\t\t}\n\t\treturn wake();\n\t};\n\treturn {\n\t\tstart() {\n\t\t\tconst requestedBeforeStop = stopRevision;\n\t\t\treturn stopping ? stopping.then(() => startGeneration(requestedBeforeStop)) : startGeneration(requestedBeforeStop);\n\t\t},\n\t\twake,\n\t\tstop() {\n\t\t\tstopRevision++;\n\t\t\tif (stopping) return stopping;\n\t\t\tconst generation = active;\n\t\t\tif (!generation) return Promise.resolve();\n\t\t\tactive = null;\n\t\t\tgeneration.rerun = false;\n\t\t\tclearTimers(generation);\n\t\t\tstopping = (async () => {\n\t\t\t\t// Task failure уже обработан onError и остаётся у start/wake caller;\n\t\t\t\t// drain отдельно передаёт точный отказ reporter, если тот не сработал.\n\t\t\t\tawait generation.pending?.catch(() => {});\n\t\t\t\tif (generation.reportingFailure) throw generation.reportingFailure.error;\n\t\t\t})().finally(() => {\n\t\t\t\tstopping = null;\n\t\t\t});\n\t\t\treturn stopping;\n\t\t}\n\t};\n}\n","import { type DeadlineTimer, type DeadlineTimerOptions } from \"./deadlineTimerTypes\";\n\nconst MAX_NATIVE_DELAY_MS = 2_147_483_647;\n\ntype DeadlineGeneration = {\n\tdeadlineAtMs: number;\n\ttimer: ReturnType<typeof setTimeout> | null;\n};\n\n/**\n * Ожидает один абсолютный срок. Длинное ожидание разбивается только на native\n * timers: промежуточные части не вызывают предметный callback. Создание не\n * запускает таймер, а отменённое поколение не оживает от позднего callback.\n */\nexport function createDeadlineTimer({ onDue }: DeadlineTimerOptions): DeadlineTimer {\n\tlet active: DeadlineGeneration | null = null;\n\n\tconst cancel = (): void => {\n\t\tconst generation = active;\n\t\tactive = null;\n\t\tif (generation && generation.timer !== null) {\n\t\t\tclearTimeout(generation.timer);\n\t\t\tgeneration.timer = null;\n\t\t}\n\t};\n\tconst arm = (generation: DeadlineGeneration): void => {\n\t\t// Node превращает переполнение delay в 1 ms. Даже годовой deadline нельзя\n\t\t// передавать напрямую; оставшийся срок перепроверяется после каждой части.\n\t\tconst delay = Math.max(1, Math.min(MAX_NATIVE_DELAY_MS, generation.deadlineAtMs - Date.now()));\n\t\tconst timer = setTimeout(() => {\n\t\t\tif (active !== generation || generation.timer !== timer) return;\n\t\t\tgeneration.timer = null;\n\t\t\tif (Date.now() < generation.deadlineAtMs) {\n\t\t\t\tarm(generation);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Срок отзывается до callback: onDue может безопасно назначить следующий.\n\t\t\t// Ошибки и async rejection принадлежат caller, а не timer primitive.\n\t\t\tactive = null;\n\t\t\tonDue();\n\t\t}, delay);\n\t\tgeneration.timer = timer;\n\t\ttimer.unref?.();\n\t};\n\n\treturn {\n\t\tschedule(deadlineAtMs) {\n\t\t\tif (deadlineAtMs === null) {\n\t\t\t\tcancel();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!Number.isSafeInteger(deadlineAtMs)) {\n\t\t\t\tthrow new RangeError(\"Абсолютный срок должен быть безопасным целым числом Unix milliseconds.\");\n\t\t\t}\n\t\t\tif (active?.deadlineAtMs === deadlineAtMs) return;\n\t\t\tcancel();\n\t\t\tconst generation: DeadlineGeneration = { deadlineAtMs, timer: null };\n\t\t\tactive = generation;\n\t\t\tarm(generation);\n\t\t},\n\t\tcancel\n\t};\n}\n"],"mappings":";AAgBA,SAAgB,EAA2B,GAA4D;CACtG,KAAK,IAAM,KAAS,CAAC,EAAQ,cAAc,GAAI,EAAQ,mBAAmB,KAAA,IAAY,CAAC,IAAI,CAAC,EAAQ,cAAc,CAAE,GAEnH,IAAI,CAAC,OAAO,UAAU,CAAK,KAAK,IAAQ,KAAK,IAAQ,YACpD,MAAU,WAAW,mEAAmE;CAG1F,IAAI,IAAkC,MAClC,IAAiC,MACjC,IAAe,GAEb,KAAsB,MAAiC;EAE5D,AADI,EAAW,iBAAe,aAAa,EAAW,cAAc,KAAK,GACzE,EAAW,gBAAgB;CAC5B,GACM,KAAe,MAAiC;EAGrD,AAFA,EAAmB,CAAU,GACzB,EAAW,cAAc,QAAM,cAAc,EAAW,SAAS,GACrE,EAAW,YAAY;CACxB,GACM,KAAk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AAQ;CACf;CAEA,OAAO;EACN,SAAS,GAAc;GACtB,IAAI,MAAiB,MAAM;IAC1B,EAAO;IACP;GACD;GACA,IAAI,CAAC,OAAO,cAAc,CAAY,GACrC,MAAU,WAAW,wEAAwE;GAE9F,IAAI,GAAQ,iBAAiB,GAAc;GAC3C,EAAO;GACP,IAAM,IAAiC;IAAE;IAAc,OAAO;GAAK;GAEnE,AADA,IAAS,GACT,EAAI,CAAU;EACf;EACA;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/async-task-runner/nativeTimerConstants.ts","../../src/async-task-runner/createCoalescingTaskRunner.ts","../../src/async-task-runner/createDeadlineTimer.ts"],"sourcesContent":["/** Верхняя безопасная задержка общая для retry runner и частей длинного deadline. */\nexport const MAX_NATIVE_DELAY_MS = 2_147_483_647;\n","import { type CoalescingTaskRunner, type CoalescingTaskRunnerOptions } from \"./asyncTaskRunnerTypes\";\nimport { MAX_NATIVE_DELAY_MS } from \"./nativeTimerConstants\";\n\n// Причина отложенного запуска отличает retry от немедленного хвоста single-flight.\nconst SCHEDULED_WAKE_RETRY = \"retry\";\nconst SCHEDULED_WAKE_TAIL = \"tail\";\n\ntype ScheduledWake = { kind: typeof SCHEDULED_WAKE_RETRY | typeof SCHEDULED_WAKE_TAIL; timer: ReturnType<typeof setTimeout> };\ntype RunnerGeneration = {\n\tpending: Promise<void> | null;\n\trerun: boolean;\n\tpollTimer: ReturnType<typeof setInterval> | null;\n\tscheduledWake: ScheduledWake | null;\n\treportingFailure: Readonly<{ error: unknown }> | null;\n};\n\n/**\n * Создаёт неактивный runner. Поколение защищает от поздних таймеров, single-flight\n * объединяет сигналы в один следующий проход, stop не имитирует отмену уже\n * выполняющейся атомарной задачи. Предметная запись и диагностика принадлежат caller.\n */\nexport function createCoalescingTaskRunner(options: CoalescingTaskRunnerOptions): CoalescingTaskRunner {\n\tfor (const delay of [options.retryDelayMs, ...(options.pollIntervalMs === undefined ? [] : [options.pollIntervalMs])]) {\n\t\t// Более длинную задержку Node превращает в 1 ms: молчаливое ограничение здесь опасно.\n\t\tif (!Number.isInteger(delay) || delay < 1 || delay > MAX_NATIVE_DELAY_MS) {\n\t\t\tthrow new RangeError(\"Задержки runner должны быть целыми числами от 1 до 2147483647 ms.\");\n\t\t}\n\t}\n\tlet active: RunnerGeneration | null = null;\n\tlet stopping: Promise<void> | null = null;\n\tlet stopRevision = 0;\n\n\tconst clearScheduledWake = (generation: RunnerGeneration) => {\n\t\tif (generation.scheduledWake) clearTimeout(generation.scheduledWake.timer);\n\t\tgeneration.scheduledWake = null;\n\t};\n\tconst clearTimers = (generation: RunnerGeneration) => {\n\t\tclearScheduledWake(generation);\n\t\tif (generation.pollTimer !== null) clearInterval(generation.pollTimer);\n\t\tgeneration.pollTimer = null;\n\t};\n\tconst backgroundWake = (generation: RunnerGeneration) => {\n\t\tif (active !== generation || generation.reportingFailure || generation.scheduledWake?.kind === SCHEDULED_WAKE_RETRY) return;\n\t\t// Обычный отказ уже передан onError; отказ самого onError сохранён для\n\t\t// admission/stop. Timer не создаёт unhandled rejection и не теряет reporter error.\n\t\tvoid wake().catch(() => {});\n\t};\n\tconst schedule = (generation: RunnerGeneration, kind: ScheduledWake[\"kind\"], delay: number) => {\n\t\tif (active !== generation || generation.reportingFailure || generation.scheduledWake) return;\n\t\tconst timer = setTimeout(() => {\n\t\t\tif (active !== generation || generation.scheduledWake?.timer !== timer) return;\n\t\t\tgeneration.scheduledWake = null;\n\t\t\tbackgroundWake(generation);\n\t\t}, delay);\n\t\tgeneration.scheduledWake = { kind, timer };\n\t\ttimer.unref?.();\n\t};\n\tconst wake = (): Promise<void> => {\n\t\tconst generation = active;\n\t\tif (!generation) return Promise.resolve();\n\t\tif (generation.reportingFailure) return Promise.reject(generation.reportingFailure.error);\n\t\tif (generation.pending) {\n\t\t\tgeneration.rerun = true;\n\t\t\treturn generation.pending;\n\t\t}\n\t\t// Явный wake ускоряет retry. Только caller, не poll, может принять это решение.\n\t\tclearScheduledWake(generation);\n\t\tgeneration.rerun = false;\n\t\tgeneration.pending = Promise.resolve()\n\t\t\t.then(async () => {\n\t\t\t\t// stop до первой microtask не разрешает позднее выполнение callback.\n\t\t\t\tif (active === generation) await options.run();\n\t\t\t})\n\t\t\t.catch(async (error: unknown) => {\n\t\t\t\t// Уже начатый run сообщает отказ даже после stop; shutdown не скрывает ошибку.\n\t\t\t\ttry {\n\t\t\t\t\tawait options.onError(error);\n\t\t\t\t} catch (reporterError: unknown) {\n\t\t\t\t\t// Wrapper различает отсутствие отказа и реальные throw undefined/null.\n\t\t\t\t\tgeneration.reportingFailure = { error: reporterError };\n\t\t\t\t\tgeneration.rerun = false;\n\t\t\t\t\tclearTimers(generation);\n\t\t\t\t}\n\t\t\t\tschedule(generation, SCHEDULED_WAKE_RETRY, options.retryDelayMs);\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tgeneration.pending = null;\n\t\t\t\t// При отказе retry timer уже существует и не заменяется немедленным хвостом.\n\t\t\t\tif (generation.rerun) schedule(generation, SCHEDULED_WAKE_TAIL, 0);\n\t\t\t});\n\t\treturn generation.pending;\n\t};\n\tconst startGeneration = (requestedBeforeStop: number): Promise<void> => {\n\t\tif (requestedBeforeStop !== stopRevision) return Promise.reject(new Error(\"Запуск runner отменён более поздней остановкой.\"));\n\t\tif (active) {\n\t\t\tif (active.reportingFailure) return Promise.reject(active.reportingFailure.error);\n\t\t\t// Повторный start не является wake и не создаёт лишний хвост или обход retry.\n\t\t\treturn active.pending ?? Promise.resolve();\n\t\t}\n\t\tconst generation: RunnerGeneration = { pending: null, rerun: false, pollTimer: null, scheduledWake: null, reportingFailure: null };\n\t\tactive = generation;\n\t\tif (options.pollIntervalMs !== undefined) {\n\t\t\tgeneration.pollTimer = setInterval(() => backgroundWake(generation), options.pollIntervalMs);\n\t\t\tgeneration.pollTimer.unref?.();\n\t\t}\n\t\treturn wake();\n\t};\n\treturn {\n\t\tstart() {\n\t\t\tconst requestedBeforeStop = stopRevision;\n\t\t\treturn stopping ? stopping.then(() => startGeneration(requestedBeforeStop)) : startGeneration(requestedBeforeStop);\n\t\t},\n\t\twake,\n\t\tstop() {\n\t\t\tstopRevision++;\n\t\t\tif (stopping) return stopping;\n\t\t\tconst generation = active;\n\t\t\tif (!generation) return Promise.resolve();\n\t\t\tactive = null;\n\t\t\tgeneration.rerun = false;\n\t\t\tclearTimers(generation);\n\t\t\tstopping = (async () => {\n\t\t\t\t// Task failure уже обработан onError и остаётся у start/wake caller;\n\t\t\t\t// drain отдельно передаёт точный отказ reporter, если тот не сработал.\n\t\t\t\tawait generation.pending?.catch(() => {});\n\t\t\t\tif (generation.reportingFailure) throw generation.reportingFailure.error;\n\t\t\t})().finally(() => {\n\t\t\t\tstopping = null;\n\t\t\t});\n\t\t\treturn stopping;\n\t\t}\n\t};\n}\n","import { type DeadlineTimer, type DeadlineTimerOptions } from \"./deadlineTimerTypes\";\nimport { MAX_NATIVE_DELAY_MS } from \"./nativeTimerConstants\";\n\ntype DeadlineGeneration = {\n\tdeadlineAtMs: number;\n\ttimer: ReturnType<typeof setTimeout> | null;\n};\n\n/**\n * Ожидает один абсолютный срок. Длинное ожидание разбивается только на native\n * timers: промежуточные части не вызывают предметный callback. Создание не\n * запускает таймер, а отменённое поколение не оживает от позднего callback.\n */\nexport function createDeadlineTimer({ onDue }: DeadlineTimerOptions): DeadlineTimer {\n\tlet active: DeadlineGeneration | null = null;\n\n\tconst cancel = (): void => {\n\t\tconst generation = active;\n\t\tactive = null;\n\t\tif (generation && generation.timer !== null) {\n\t\t\tclearTimeout(generation.timer);\n\t\t\tgeneration.timer = null;\n\t\t}\n\t};\n\tconst arm = (generation: DeadlineGeneration): void => {\n\t\t// Node превращает переполнение delay в 1 ms. Даже годовой deadline нельзя\n\t\t// передавать напрямую; оставшийся срок перепроверяется после каждой части.\n\t\tconst delay = Math.max(1, Math.min(MAX_NATIVE_DELAY_MS, generation.deadlineAtMs - Date.now()));\n\t\tconst timer = setTimeout(() => {\n\t\t\tif (active !== generation || generation.timer !== timer) return;\n\t\t\tgeneration.timer = null;\n\t\t\tif (Date.now() < generation.deadlineAtMs) {\n\t\t\t\tarm(generation);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Срок отзывается до callback: onDue может безопасно назначить следующий.\n\t\t\t// Ошибки и async rejection принадлежат caller, а не timer primitive.\n\t\t\tactive = null;\n\t\t\tonDue();\n\t\t}, delay);\n\t\tgeneration.timer = timer;\n\t\ttimer.unref?.();\n\t};\n\n\treturn {\n\t\tschedule(deadlineAtMs) {\n\t\t\tif (deadlineAtMs === null) {\n\t\t\t\tcancel();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!Number.isSafeInteger(deadlineAtMs)) {\n\t\t\t\tthrow new RangeError(\"Абсолютный срок должен быть безопасным целым числом Unix milliseconds.\");\n\t\t\t}\n\t\t\tif (active?.deadlineAtMs === deadlineAtMs) return;\n\t\t\tcancel();\n\t\t\tconst generation: DeadlineGeneration = { deadlineAtMs, timer: null };\n\t\t\tactive = generation;\n\t\t\tarm(generation);\n\t\t},\n\t\tcancel\n\t};\n}\n"],"mappings":";AACA,ICGM,IAAuB;AAiB7B,SAAgB,EAA2B,GAA4D;CACtG,KAAK,IAAM,KAAS,CAAC,EAAQ,cAAc,GAAI,EAAQ,mBAAmB,KAAA,IAAY,CAAC,IAAI,CAAC,EAAQ,cAAc,CAAE,GAEnH,IAAI,CAAC,OAAO,UAAU,CAAK,KAAK,IAAQ,KAAK,IAAA,YAC5C,MAAU,WAAW,mEAAmE;CAG1F,IAAI,IAAkC,MAClC,IAAiC,MACjC,IAAe,GAEb,KAAsB,MAAiC;EAE5D,AADI,EAAW,iBAAe,aAAa,EAAW,cAAc,KAAK,GACzE,EAAW,gBAAgB;CAC5B,GACM,KAAe,MAAiC;EAGrD,AAFA,EAAmB,CAAU,GACzB,EAAW,cAAc,QAAM,cAAc,EAAW,SAAS,GACrE,EAAW,YAAY;CACxB,GACM,KAAkB,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QAAQ;CACf;CAEA,OAAO;EACN,SAAS,GAAc;GACtB,IAAI,MAAiB,MAAM;IAC1B,EAAO;IACP;GACD;GACA,IAAI,CAAC,OAAO,cAAc,CAAY,GACrC,MAAU,WAAW,wEAAwE;GAE9F,IAAI,GAAQ,iBAAiB,GAAc;GAC3C,EAAO;GACP,IAAM,IAAiC;IAAE;IAAc,OAAO;GAAK;GAEnE,AADA,IAAS,GACT,EAAI,CAAU;EACf;EACA;CACD;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeTimerConstants.d.ts","sourceRoot":"","sources":["../../src/async-task-runner/nativeTimerConstants.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,aAAgB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Base64 кодирует три байта четырьмя символами; padding не является частью payload. */
|
|
2
|
+
export declare const BASE64_ENCODED_BLOCK_CHARACTERS = 4;
|
|
3
|
+
export declare const BASE64_DECODED_BLOCK_BYTES = 3;
|
|
4
|
+
export declare const BASE64_PADDING = "=";
|
|
5
|
+
export declare const BASE64_DOUBLE_PADDING = "==";
|
|
6
|
+
//# sourceMappingURL=base64Constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64Constants.d.ts","sourceRoot":"","sources":["../../src/binary/base64Constants.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,eAAO,MAAM,+BAA+B,IAAI,CAAC;AACjD,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,qBAAqB,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binaryToBlob.d.ts","sourceRoot":"","sources":["../../src/binary/binaryToBlob.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"binaryToBlob.d.ts","sourceRoot":"","sources":["../../src/binary/binaryToBlob.ts"],"names":[],"mappings":"AAoMA;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,YAAY,MAAM,EAAE,WAAU,MAA+B,EAAE,kBAAe,KAAG,IAmB7G,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,EAAE,aAAa,MAAM,KAAG,MAwBvE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBase64DecodedSize.d.ts","sourceRoot":"","sources":["../../src/binary/getBase64DecodedSize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBase64DecodedSize.d.ts","sourceRoot":"","sources":["../../src/binary/getBase64DecodedSize.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMjE"}
|
package/dist/binary/index.js
CHANGED
|
@@ -1,34 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { l as e } from "../chunks/utils-DW0Yso1Q.js";
|
|
2
|
+
import { a as t, c as n, d as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "../chunks/mimeTypeConstants-BzONV-b1.js";
|
|
3
|
+
import { t as g } from "../chunks/hasSignatureBytes-D2wO_Myl.js";
|
|
4
|
+
import { useEffect as _, useEffectEvent as v, useState as y } from "react";
|
|
3
5
|
//#region src/binary/binaryToBlob.ts
|
|
4
|
-
var
|
|
6
|
+
var b = /^data:([^,]*);base64,([\s\S]*)$/i, x = 128, S = 16, C = [
|
|
7
|
+
37,
|
|
8
|
+
80,
|
|
9
|
+
68,
|
|
10
|
+
70
|
|
11
|
+
], w = [
|
|
12
|
+
255,
|
|
13
|
+
216,
|
|
14
|
+
255
|
|
15
|
+
], T = [
|
|
16
|
+
137,
|
|
17
|
+
80,
|
|
18
|
+
78,
|
|
19
|
+
71
|
|
20
|
+
], E = [
|
|
21
|
+
71,
|
|
22
|
+
73,
|
|
23
|
+
70
|
|
24
|
+
], D = [
|
|
25
|
+
82,
|
|
26
|
+
73,
|
|
27
|
+
70,
|
|
28
|
+
70
|
|
29
|
+
], O = [80, 75], k = {
|
|
5
30
|
bmp: "image/bmp",
|
|
6
31
|
csv: "text/csv",
|
|
7
|
-
doc:
|
|
8
|
-
docx:
|
|
9
|
-
gif:
|
|
10
|
-
jpeg:
|
|
11
|
-
jpg:
|
|
32
|
+
doc: p,
|
|
33
|
+
docx: m,
|
|
34
|
+
gif: l,
|
|
35
|
+
jpeg: f,
|
|
36
|
+
jpg: f,
|
|
12
37
|
json: "application/json",
|
|
13
|
-
pdf:
|
|
14
|
-
png:
|
|
15
|
-
ppt:
|
|
16
|
-
pptx:
|
|
38
|
+
pdf: s,
|
|
39
|
+
png: o,
|
|
40
|
+
ppt: h,
|
|
41
|
+
pptx: r,
|
|
17
42
|
svg: "image/svg+xml",
|
|
18
|
-
tif:
|
|
19
|
-
tiff:
|
|
43
|
+
tif: t,
|
|
44
|
+
tiff: t,
|
|
20
45
|
txt: "text/plain",
|
|
21
|
-
webp:
|
|
22
|
-
xls:
|
|
23
|
-
xlsx:
|
|
24
|
-
xml:
|
|
25
|
-
zip:
|
|
26
|
-
},
|
|
46
|
+
webp: u,
|
|
47
|
+
xls: d,
|
|
48
|
+
xlsx: c,
|
|
49
|
+
xml: a,
|
|
50
|
+
zip: i
|
|
51
|
+
}, A = (e) => {
|
|
27
52
|
let t = e.replace(/\s/g, "").replace(/-/g, "+").replace(/_/g, "/"), n = t.length % 4;
|
|
28
53
|
if (n === 1 || !/^[A-Za-z0-9+/]*={0,2}$/.test(t)) throw Error("Некорректный формат base64");
|
|
29
54
|
return n === 0 ? t : `${t}${"=".repeat(4 - n)}`;
|
|
30
|
-
},
|
|
31
|
-
let t = e.match(
|
|
55
|
+
}, j = (e) => {
|
|
56
|
+
let t = e.match(b);
|
|
32
57
|
if (!t) return {
|
|
33
58
|
data: e,
|
|
34
59
|
mimeType: null
|
|
@@ -38,94 +63,94 @@ var i = "application/octet-stream", a = "application/pdf", o = /^data:([^,]*);ba
|
|
|
38
63
|
data: r,
|
|
39
64
|
mimeType: n.split(";")[0].trim() || null
|
|
40
65
|
};
|
|
41
|
-
},
|
|
42
|
-
let t =
|
|
66
|
+
}, M = (e) => {
|
|
67
|
+
let t = j(e);
|
|
43
68
|
return {
|
|
44
|
-
data:
|
|
69
|
+
data: A(t.data),
|
|
45
70
|
mimeType: t.mimeType
|
|
46
71
|
};
|
|
47
|
-
},
|
|
48
|
-
let t = e.match(
|
|
72
|
+
}, N = (e) => {
|
|
73
|
+
let t = e.match(b);
|
|
49
74
|
return t && t[1].split(";")[0].trim() || null;
|
|
50
|
-
},
|
|
51
|
-
let { data: t } =
|
|
75
|
+
}, P = (e) => {
|
|
76
|
+
let { data: t } = M(e), n = atob(t), r = new Uint8Array(n.length);
|
|
52
77
|
for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
|
|
53
78
|
return r;
|
|
54
|
-
},
|
|
79
|
+
}, F = (e) => {
|
|
55
80
|
let t = new Uint8Array(e.length);
|
|
56
81
|
for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n);
|
|
57
82
|
return t;
|
|
58
|
-
},
|
|
83
|
+
}, I = (e) => {
|
|
59
84
|
let t = new ArrayBuffer(e.byteLength);
|
|
60
85
|
return new Uint8Array(t).set(e), t;
|
|
61
|
-
},
|
|
86
|
+
}, L = (e) => {
|
|
62
87
|
try {
|
|
63
|
-
let { data: t } =
|
|
64
|
-
return atob(
|
|
88
|
+
let { data: t } = j(e), n = t.slice(0, x);
|
|
89
|
+
return atob(A(n));
|
|
65
90
|
} catch {
|
|
66
91
|
return null;
|
|
67
92
|
}
|
|
68
|
-
},
|
|
69
|
-
let t =
|
|
93
|
+
}, R = (e) => {
|
|
94
|
+
let t = L(e);
|
|
70
95
|
if (!t) return null;
|
|
71
96
|
let n = new Uint8Array(t.length);
|
|
72
97
|
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
73
|
-
if (n
|
|
74
|
-
if (n
|
|
75
|
-
if (n
|
|
76
|
-
if (n
|
|
77
|
-
if (n
|
|
78
|
-
if (n
|
|
79
|
-
let r = t.replace(/^\uFEFF/, "").trimStart().slice(0,
|
|
80
|
-
return r.startsWith("<?xml") || r.startsWith("<") ?
|
|
81
|
-
},
|
|
98
|
+
if (g(n, C)) return s;
|
|
99
|
+
if (g(n, w)) return f;
|
|
100
|
+
if (g(n, T)) return o;
|
|
101
|
+
if (g(n, E)) return l;
|
|
102
|
+
if (g(n, D)) return u;
|
|
103
|
+
if (g(n, O)) return i;
|
|
104
|
+
let r = t.replace(/^\uFEFF/, "").trimStart().slice(0, S);
|
|
105
|
+
return r.startsWith("<?xml") || r.startsWith("<") ? a : null;
|
|
106
|
+
}, z = (e, t = n, r = !0) => {
|
|
82
107
|
if (!e) throw Error("Не переданы бинарные данные");
|
|
83
108
|
try {
|
|
84
|
-
let
|
|
85
|
-
if (
|
|
86
|
-
return new Blob([
|
|
109
|
+
let n = r ? P(e) : F(e);
|
|
110
|
+
if (n.length === 0) throw Error("После преобразования не осталось данных");
|
|
111
|
+
return new Blob([I(n)], { type: t.trim() || "application/octet-stream" });
|
|
87
112
|
} catch (e) {
|
|
88
113
|
throw e instanceof Error ? e : Error("Некорректный формат бинарных данных");
|
|
89
114
|
}
|
|
90
|
-
},
|
|
115
|
+
}, B = (e, t) => {
|
|
91
116
|
if (e) {
|
|
92
117
|
let t = e.toLowerCase().split(".").pop();
|
|
93
|
-
if (t &&
|
|
118
|
+
if (t && k[t]) return k[t];
|
|
94
119
|
}
|
|
95
120
|
if (t) {
|
|
96
|
-
let e =
|
|
121
|
+
let e = N(t);
|
|
97
122
|
if (e) return e;
|
|
98
|
-
let n =
|
|
123
|
+
let n = R(t);
|
|
99
124
|
if (n) return n;
|
|
100
125
|
}
|
|
101
|
-
return
|
|
102
|
-
},
|
|
103
|
-
function
|
|
104
|
-
if (e.length % 4 != 0 ||
|
|
126
|
+
return s;
|
|
127
|
+
}, V = /[^A-Za-z0-9+/=]/;
|
|
128
|
+
function H(e) {
|
|
129
|
+
if (e.length % 4 != 0 || V.test(e)) return null;
|
|
105
130
|
let t = e.endsWith("==") ? 2 : +!!e.endsWith("="), n = e.indexOf("=");
|
|
106
131
|
return n !== -1 && n !== e.length - t ? null : Math.floor(e.length * 3 / 4) - t;
|
|
107
132
|
}
|
|
108
133
|
//#endregion
|
|
109
134
|
//#region src/binary/useBinaryFile.ts
|
|
110
|
-
function
|
|
111
|
-
let [
|
|
112
|
-
return
|
|
113
|
-
if (
|
|
114
|
-
let e =
|
|
115
|
-
|
|
116
|
-
blob:
|
|
135
|
+
function U(t) {
|
|
136
|
+
let [n, r] = y(null), [i, a] = y(null), o = v((e) => r(e)), s = v((e) => a(e));
|
|
137
|
+
return _(() => {
|
|
138
|
+
if (t) try {
|
|
139
|
+
let e = B(void 0, t), n = z(t, e, !0);
|
|
140
|
+
o({
|
|
141
|
+
blob: n,
|
|
117
142
|
mime: e
|
|
118
|
-
}),
|
|
143
|
+
}), s(null);
|
|
119
144
|
} catch (t) {
|
|
120
|
-
e(t),
|
|
145
|
+
e(t), s(String(t)), o(null);
|
|
121
146
|
}
|
|
122
|
-
else
|
|
123
|
-
}, [
|
|
124
|
-
data:
|
|
125
|
-
error:
|
|
147
|
+
else o(null), s(null);
|
|
148
|
+
}, [t]), {
|
|
149
|
+
data: n,
|
|
150
|
+
error: i
|
|
126
151
|
};
|
|
127
152
|
}
|
|
128
153
|
//#endregion
|
|
129
|
-
export {
|
|
154
|
+
export { z as binaryToBlob, B as detectMimeType, H as getBase64DecodedSize, U as useBinaryFile };
|
|
130
155
|
|
|
131
156
|
//# sourceMappingURL=index.js.map
|
package/dist/binary/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/binary/binaryToBlob.ts","../../src/binary/getBase64DecodedSize.ts","../../src/binary/useBinaryFile.ts"],"sourcesContent":["const DEFAULT_BLOB_MIME_TYPE = \"application/octet-stream\";\nconst DEFAULT_DOCUMENT_MIME_TYPE = \"application/pdf\";\nconst BASE64_DATA_URL_PATTERN = /^data:([^,]*);base64,([\\s\\S]*)$/i;\n\nconst MIME_TYPE_BY_EXTENSION: Record<string, string> = {\n\tbmp: \"image/bmp\",\n\tcsv: \"text/csv\",\n\tdoc: \"application/msword\",\n\tdocx: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n\tgif: \"image/gif\",\n\tjpeg: \"image/jpeg\",\n\tjpg: \"image/jpeg\",\n\tjson: \"application/json\",\n\tpdf: \"application/pdf\",\n\tpng: \"image/png\",\n\tppt: \"application/vnd.ms-powerpoint\",\n\tpptx: \"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\n\tsvg: \"image/svg+xml\",\n\ttif: \"image/tiff\",\n\ttiff: \"image/tiff\",\n\ttxt: \"text/plain\",\n\twebp: \"image/webp\",\n\txls: \"application/vnd.ms-excel\",\n\txlsx: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n\txml: \"application/xml\",\n\tzip: \"application/zip\"\n};\n\nconst normalizeBase64 = (value: string): string => {\n\tconst normalized = value.replace(/\\s/g, \"\").replace(/-/g, \"+\").replace(/_/g, \"/\");\n\tconst paddingRest = normalized.length % 4;\n\n\tif (paddingRest === 1 || !/^[A-Za-z0-9+/]*={0,2}$/.test(normalized)) {\n\t\tthrow new Error(\"Некорректный формат base64\");\n\t}\n\n\treturn paddingRest === 0 ? normalized : `${normalized}${\"=\".repeat(4 - paddingRest)}`;\n};\n\nconst getBase64RawPayload = (binaryData: string): { data: string; mimeType: string | null } => {\n\tconst dataUrlMatch = binaryData.match(BASE64_DATA_URL_PATTERN);\n\n\tif (!dataUrlMatch) {\n\t\treturn { data: binaryData, mimeType: null };\n\t}\n\n\tconst [, rawMimeType, rawData] = dataUrlMatch;\n\tconst mimeType = rawMimeType.split(\";\")[0].trim();\n\n\treturn {\n\t\tdata: rawData,\n\t\tmimeType: mimeType || null\n\t};\n};\n\nconst getBase64Payload = (binaryData: string): { data: string; mimeType: string | null } => {\n\tconst payload = getBase64RawPayload(binaryData);\n\n\treturn {\n\t\tdata: normalizeBase64(payload.data),\n\t\tmimeType: payload.mimeType\n\t};\n};\n\nconst getDataUrlMimeType = (binaryData: string): string | null => {\n\tconst dataUrlMatch = binaryData.match(BASE64_DATA_URL_PATTERN);\n\n\tif (!dataUrlMatch) {\n\t\treturn null;\n\t}\n\n\tconst mimeType = dataUrlMatch[1].split(\";\")[0].trim();\n\n\treturn mimeType || null;\n};\n\nconst decodeBase64ToBytes = (binaryData: string): Uint8Array => {\n\tconst { data } = getBase64Payload(binaryData);\n\tconst binaryString = atob(data);\n\tconst byteArray = new Uint8Array(binaryString.length);\n\n\tfor (let index = 0; index < binaryString.length; index++) {\n\t\tbyteArray[index] = binaryString.charCodeAt(index);\n\t}\n\n\treturn byteArray;\n};\n\nconst binaryStringToBytes = (binaryData: string): Uint8Array => {\n\tconst byteArray = new Uint8Array(binaryData.length);\n\n\tfor (let index = 0; index < binaryData.length; index++) {\n\t\tbyteArray[index] = binaryData.charCodeAt(index);\n\t}\n\n\treturn byteArray;\n};\n\nconst copyBytesToArrayBuffer = (byteArray: Uint8Array): ArrayBuffer => {\n\tconst buffer = new ArrayBuffer(byteArray.byteLength);\n\tconst view = new Uint8Array(buffer);\n\n\tview.set(byteArray);\n\n\treturn buffer;\n};\n\nconst decodeHeaderFromBase64 = (binaryData: string): string | null => {\n\ttry {\n\t\tconst { data } = getBase64RawPayload(binaryData);\n\t\tconst headerData = data.slice(0, 128);\n\t\tconst binaryString = atob(normalizeBase64(headerData));\n\n\t\treturn binaryString;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\nconst detectMimeTypeBySignature = (binaryData: string): string | null => {\n\tconst header = decodeHeaderFromBase64(binaryData);\n\n\tif (!header) {\n\t\treturn null;\n\t}\n\n\tconst bytes = new Uint8Array(header.length);\n\n\tfor (let index = 0; index < header.length; index++) {\n\t\tbytes[index] = header.charCodeAt(index);\n\t}\n\n\tif (bytes[0] === 0x25 && bytes[1] === 0x50 && bytes[2] === 0x44 && bytes[3] === 0x46) {\n\t\treturn \"application/pdf\";\n\t}\n\n\tif (bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff) {\n\t\treturn \"image/jpeg\";\n\t}\n\n\tif (bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47) {\n\t\treturn \"image/png\";\n\t}\n\n\tif (bytes[0] === 0x47 && bytes[1] === 0x49 && bytes[2] === 0x46) {\n\t\treturn \"image/gif\";\n\t}\n\n\tif (bytes[0] === 0x52 && bytes[1] === 0x49 && bytes[2] === 0x46 && bytes[3] === 0x46) {\n\t\treturn \"image/webp\";\n\t}\n\n\tif (bytes[0] === 0x50 && bytes[1] === 0x4b) {\n\t\treturn \"application/zip\";\n\t}\n\n\tconst textHeader = header\n\t\t.replace(/^\\uFEFF/, \"\")\n\t\t.trimStart()\n\t\t.slice(0, 16);\n\n\tif (textHeader.startsWith(\"<?xml\") || textHeader.startsWith(\"<\")) {\n\t\treturn \"application/xml\";\n\t}\n\n\treturn null;\n};\n\n/**\n * Преобразует base64 или бинарную строку в Blob.\n *\n * Data URL с префиксом `data:*;base64,` поддерживается, сам URL здесь не создаётся.\n */\nexport const binaryToBlob = (binaryData: string, mimeType: string = DEFAULT_BLOB_MIME_TYPE, isBase64 = true): Blob => {\n\tif (!binaryData) {\n\t\tthrow new Error(\"Не переданы бинарные данные\");\n\t}\n\n\ttry {\n\t\tconst byteArray = isBase64 ? decodeBase64ToBytes(binaryData) : binaryStringToBytes(binaryData);\n\n\t\tif (byteArray.length === 0) {\n\t\t\tthrow new Error(\"После преобразования не осталось данных\");\n\t\t}\n\n\t\treturn new Blob([copyBytesToArrayBuffer(byteArray)], { type: mimeType.trim() || DEFAULT_BLOB_MIME_TYPE });\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\tthrow error;\n\t\t}\n\t\tthrow new Error(\"Некорректный формат бинарных данных\");\n\t}\n};\n\n/**\n * Определяет MIME-тип по имени файла, data URL или сигнатуре base64-данных.\n *\n * Если определить тип не удалось, используется PDF: большинство документов в этом контуре приходят именно так.\n */\nexport const detectMimeType = (fileName?: string, binaryData?: string): string => {\n\tif (fileName) {\n\t\tconst extension = fileName.toLowerCase().split(\".\").pop();\n\n\t\tif (extension && MIME_TYPE_BY_EXTENSION[extension]) {\n\t\t\treturn MIME_TYPE_BY_EXTENSION[extension];\n\t\t}\n\t}\n\n\tif (binaryData) {\n\t\tconst dataUrlMimeType = getDataUrlMimeType(binaryData);\n\n\t\tif (dataUrlMimeType) {\n\t\t\treturn dataUrlMimeType;\n\t\t}\n\n\t\tconst signatureMimeType = detectMimeTypeBySignature(binaryData);\n\n\t\tif (signatureMimeType) {\n\t\t\treturn signatureMimeType;\n\t\t}\n\t}\n\n\treturn DEFAULT_DOCUMENT_MIME_TYPE;\n};\n","const INVALID_BASE64_CHARACTER_PATTERN = /[^A-Za-z0-9+/=]/;\n\n/**\n * Проверяет стандартную Base64-форму и считает байты без декодирования или создания Buffer/Blob.\n * Невалидный payload возвращает null, пустая строка — 0; допустимый размер определяет вызывающий контракт.\n * Data URL, whitespace, URL-safe алфавит и отсутствующий padding здесь не нормализуются.\n */\nexport function getBase64DecodedSize(value: string): number | null {\n\tif (value.length % 4 !== 0 || INVALID_BASE64_CHARACTER_PATTERN.test(value)) return null;\n\tconst paddingLength = value.endsWith(\"==\") ? 2 : value.endsWith(\"=\") ? 1 : 0;\n\tconst firstPaddingIndex = value.indexOf(\"=\");\n\tif (firstPaddingIndex !== -1 && firstPaddingIndex !== value.length - paddingLength) return null;\n\treturn Math.floor((value.length * 3) / 4) - paddingLength;\n}\n","import { useEffect, useEffectEvent, useState } from \"react\";\n\nimport { logError } from \"../utils\";\n\nimport { binaryToBlob, detectMimeType } from \"./binaryToBlob\";\n\nexport function useBinaryFile(bin: string | undefined) {\n\tconst [entry, setEntry] = useState<{ blob: Blob; mime: string } | null>(null);\n\tconst [error, setError] = useState<string | null>(null);\n\n\tconst updateEntry = useEffectEvent((data: { blob: Blob; mime: string } | null) => setEntry(data));\n\tconst updateError = useEffectEvent((error: string | null) => setError(error));\n\n\tuseEffect(() => {\n\t\tif (bin) {\n\t\t\ttry {\n\t\t\t\tconst mime = detectMimeType(undefined, bin);\n\t\t\t\tconst blob = binaryToBlob(bin, mime, true);\n\n\t\t\t\tupdateEntry({ blob, mime });\n\t\t\t\tupdateError(null);\n\t\t\t} catch (e) {\n\t\t\t\tlogError(e);\n\n\t\t\t\tupdateError(String(e));\n\t\t\t\tupdateEntry(null);\n\t\t\t}\n\t\t} else {\n\t\t\tupdateEntry(null);\n\t\t\tupdateError(null);\n\t\t}\n\t}, [bin]);\n\n\treturn { data: entry, error };\n}\n"],"mappings":";;;AAAA,IAAM,IAAyB,4BACzB,IAA6B,mBAC7B,IAA0B,oCAE1B,IAAiD;CACtD,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;AACN,GAEM,KAAmB,MAA0B;CAClD,IAAM,IAAa,EAAM,QAAQ,OAAO,EAAE,CAAC,CAAC,QAAQ,MAAM,GAAG,CAAC,CAAC,QAAQ,MAAM,GAAG,GAC1E,IAAc,EAAW,SAAS;CAExC,IAAI,MAAgB,KAAK,CAAC,yBAAyB,KAAK,CAAU,GACjE,MAAU,MAAM,4BAA4B;CAG7C,OAAO,MAAgB,IAAI,IAAa,GAAG,IAAa,IAAI,OAAO,IAAI,CAAW;AACnF,GAEM,KAAuB,MAAkE;CAC9F,IAAM,IAAe,EAAW,MAAM,CAAuB;CAE7D,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/binary/binaryToBlob.ts","../../src/binary/getBase64DecodedSize.ts","../../src/binary/useBinaryFile.ts"],"sourcesContent":["import {\n\tMIME_TYPE_DOCX,\n\tMIME_TYPE_IMAGE_GIF,\n\tMIME_TYPE_IMAGE_JPEG,\n\tMIME_TYPE_IMAGE_PNG,\n\tMIME_TYPE_IMAGE_TIFF,\n\tMIME_TYPE_IMAGE_WEBP,\n\tMIME_TYPE_MSWORD,\n\tMIME_TYPE_OCTET_STREAM,\n\tMIME_TYPE_PDF,\n\tMIME_TYPE_PPT,\n\tMIME_TYPE_PPTX,\n\tMIME_TYPE_XLS,\n\tMIME_TYPE_XLSX,\n\tMIME_TYPE_XML,\n\tMIME_TYPE_ZIP\n} from \"../file/mimeTypeConstants\";\nimport { hasSignatureBytes } from \"../file/signature/hasSignatureBytes\";\n\nimport { BASE64_ENCODED_BLOCK_CHARACTERS, BASE64_PADDING } from \"./base64Constants\";\n\nconst BASE64_DATA_URL_PATTERN = /^data:([^,]*);base64,([\\s\\S]*)$/i;\nconst BASE64_HEADER_SCAN_CHARACTERS = 128;\nconst XML_HEADER_SCAN_CHARACTERS = 16;\n// Здесь распознаётся только прежний короткий prefix, без усиления проверки формата.\nconst PDF_HEADER_PREFIX = [0x25, 0x50, 0x44, 0x46];\nconst JPEG_HEADER_PREFIX = [0xff, 0xd8, 0xff];\nconst PNG_HEADER_PREFIX = [0x89, 0x50, 0x4e, 0x47];\nconst GIF_HEADER_PREFIX = [0x47, 0x49, 0x46];\nconst WEBP_HEADER_PREFIX = [0x52, 0x49, 0x46, 0x46];\nconst ZIP_HEADER_PREFIX = [0x50, 0x4b];\n\nconst MIME_TYPE_BY_EXTENSION: Record<string, string> = {\n\tbmp: \"image/bmp\",\n\tcsv: \"text/csv\",\n\tdoc: MIME_TYPE_MSWORD,\n\tdocx: MIME_TYPE_DOCX,\n\tgif: MIME_TYPE_IMAGE_GIF,\n\tjpeg: MIME_TYPE_IMAGE_JPEG,\n\tjpg: MIME_TYPE_IMAGE_JPEG,\n\tjson: \"application/json\",\n\tpdf: MIME_TYPE_PDF,\n\tpng: MIME_TYPE_IMAGE_PNG,\n\tppt: MIME_TYPE_PPT,\n\tpptx: MIME_TYPE_PPTX,\n\tsvg: \"image/svg+xml\",\n\ttif: MIME_TYPE_IMAGE_TIFF,\n\ttiff: MIME_TYPE_IMAGE_TIFF,\n\ttxt: \"text/plain\",\n\twebp: MIME_TYPE_IMAGE_WEBP,\n\txls: MIME_TYPE_XLS,\n\txlsx: MIME_TYPE_XLSX,\n\txml: MIME_TYPE_XML,\n\tzip: MIME_TYPE_ZIP\n};\n\nconst normalizeBase64 = (value: string): string => {\n\tconst normalized = value.replace(/\\s/g, \"\").replace(/-/g, \"+\").replace(/_/g, \"/\");\n\tconst paddingRest = normalized.length % BASE64_ENCODED_BLOCK_CHARACTERS;\n\n\tif (paddingRest === 1 || !/^[A-Za-z0-9+/]*={0,2}$/.test(normalized)) {\n\t\tthrow new Error(\"Некорректный формат base64\");\n\t}\n\n\treturn paddingRest === 0 ? normalized : `${normalized}${BASE64_PADDING.repeat(BASE64_ENCODED_BLOCK_CHARACTERS - paddingRest)}`;\n};\n\nconst getBase64RawPayload = (binaryData: string): { data: string; mimeType: string | null } => {\n\tconst dataUrlMatch = binaryData.match(BASE64_DATA_URL_PATTERN);\n\n\tif (!dataUrlMatch) {\n\t\treturn { data: binaryData, mimeType: null };\n\t}\n\n\tconst [, rawMimeType, rawData] = dataUrlMatch;\n\tconst mimeType = rawMimeType.split(\";\")[0].trim();\n\n\treturn {\n\t\tdata: rawData,\n\t\tmimeType: mimeType || null\n\t};\n};\n\nconst getBase64Payload = (binaryData: string): { data: string; mimeType: string | null } => {\n\tconst payload = getBase64RawPayload(binaryData);\n\n\treturn {\n\t\tdata: normalizeBase64(payload.data),\n\t\tmimeType: payload.mimeType\n\t};\n};\n\nconst getDataUrlMimeType = (binaryData: string): string | null => {\n\tconst dataUrlMatch = binaryData.match(BASE64_DATA_URL_PATTERN);\n\n\tif (!dataUrlMatch) {\n\t\treturn null;\n\t}\n\n\tconst mimeType = dataUrlMatch[1].split(\";\")[0].trim();\n\n\treturn mimeType || null;\n};\n\nconst decodeBase64ToBytes = (binaryData: string): Uint8Array => {\n\tconst { data } = getBase64Payload(binaryData);\n\tconst binaryString = atob(data);\n\tconst byteArray = new Uint8Array(binaryString.length);\n\n\tfor (let index = 0; index < binaryString.length; index++) {\n\t\tbyteArray[index] = binaryString.charCodeAt(index);\n\t}\n\n\treturn byteArray;\n};\n\nconst binaryStringToBytes = (binaryData: string): Uint8Array => {\n\tconst byteArray = new Uint8Array(binaryData.length);\n\n\tfor (let index = 0; index < binaryData.length; index++) {\n\t\tbyteArray[index] = binaryData.charCodeAt(index);\n\t}\n\n\treturn byteArray;\n};\n\nconst copyBytesToArrayBuffer = (byteArray: Uint8Array): ArrayBuffer => {\n\tconst buffer = new ArrayBuffer(byteArray.byteLength);\n\tconst view = new Uint8Array(buffer);\n\n\tview.set(byteArray);\n\n\treturn buffer;\n};\n\nconst decodeHeaderFromBase64 = (binaryData: string): string | null => {\n\ttry {\n\t\tconst { data } = getBase64RawPayload(binaryData);\n\t\tconst headerData = data.slice(0, BASE64_HEADER_SCAN_CHARACTERS);\n\t\tconst binaryString = atob(normalizeBase64(headerData));\n\n\t\treturn binaryString;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\nconst detectMimeTypeBySignature = (binaryData: string): string | null => {\n\tconst header = decodeHeaderFromBase64(binaryData);\n\n\tif (!header) {\n\t\treturn null;\n\t}\n\n\tconst bytes = new Uint8Array(header.length);\n\n\tfor (let index = 0; index < header.length; index++) {\n\t\tbytes[index] = header.charCodeAt(index);\n\t}\n\n\tif (hasSignatureBytes(bytes, PDF_HEADER_PREFIX)) {\n\t\treturn MIME_TYPE_PDF;\n\t}\n\n\tif (hasSignatureBytes(bytes, JPEG_HEADER_PREFIX)) {\n\t\treturn MIME_TYPE_IMAGE_JPEG;\n\t}\n\n\tif (hasSignatureBytes(bytes, PNG_HEADER_PREFIX)) {\n\t\treturn MIME_TYPE_IMAGE_PNG;\n\t}\n\n\tif (hasSignatureBytes(bytes, GIF_HEADER_PREFIX)) {\n\t\treturn MIME_TYPE_IMAGE_GIF;\n\t}\n\n\tif (hasSignatureBytes(bytes, WEBP_HEADER_PREFIX)) {\n\t\treturn MIME_TYPE_IMAGE_WEBP;\n\t}\n\n\tif (hasSignatureBytes(bytes, ZIP_HEADER_PREFIX)) {\n\t\treturn MIME_TYPE_ZIP;\n\t}\n\n\tconst textHeader = header\n\t\t.replace(/^\\uFEFF/, \"\")\n\t\t.trimStart()\n\t\t.slice(0, XML_HEADER_SCAN_CHARACTERS);\n\n\tif (textHeader.startsWith(\"<?xml\") || textHeader.startsWith(\"<\")) {\n\t\treturn MIME_TYPE_XML;\n\t}\n\n\treturn null;\n};\n\n/**\n * Преобразует base64 или бинарную строку в Blob.\n *\n * Data URL с префиксом `data:*;base64,` поддерживается, сам URL здесь не создаётся.\n */\nexport const binaryToBlob = (binaryData: string, mimeType: string = MIME_TYPE_OCTET_STREAM, isBase64 = true): Blob => {\n\tif (!binaryData) {\n\t\tthrow new Error(\"Не переданы бинарные данные\");\n\t}\n\n\ttry {\n\t\tconst byteArray = isBase64 ? decodeBase64ToBytes(binaryData) : binaryStringToBytes(binaryData);\n\n\t\tif (byteArray.length === 0) {\n\t\t\tthrow new Error(\"После преобразования не осталось данных\");\n\t\t}\n\n\t\treturn new Blob([copyBytesToArrayBuffer(byteArray)], { type: mimeType.trim() || MIME_TYPE_OCTET_STREAM });\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\tthrow error;\n\t\t}\n\t\tthrow new Error(\"Некорректный формат бинарных данных\");\n\t}\n};\n\n/**\n * Определяет MIME-тип по имени файла, data URL или сигнатуре base64-данных.\n *\n * Если определить тип не удалось, используется PDF: большинство документов в этом контуре приходят именно так.\n */\nexport const detectMimeType = (fileName?: string, binaryData?: string): string => {\n\tif (fileName) {\n\t\tconst extension = fileName.toLowerCase().split(\".\").pop();\n\n\t\tif (extension && MIME_TYPE_BY_EXTENSION[extension]) {\n\t\t\treturn MIME_TYPE_BY_EXTENSION[extension];\n\t\t}\n\t}\n\n\tif (binaryData) {\n\t\tconst dataUrlMimeType = getDataUrlMimeType(binaryData);\n\n\t\tif (dataUrlMimeType) {\n\t\t\treturn dataUrlMimeType;\n\t\t}\n\n\t\tconst signatureMimeType = detectMimeTypeBySignature(binaryData);\n\n\t\tif (signatureMimeType) {\n\t\t\treturn signatureMimeType;\n\t\t}\n\t}\n\n\treturn MIME_TYPE_PDF;\n};\n","import { BASE64_DECODED_BLOCK_BYTES, BASE64_DOUBLE_PADDING, BASE64_ENCODED_BLOCK_CHARACTERS, BASE64_PADDING } from \"./base64Constants\";\n\nconst INVALID_BASE64_CHARACTER_PATTERN = /[^A-Za-z0-9+/=]/;\n\n/**\n * Проверяет стандартную Base64-форму и считает байты без декодирования или создания Buffer/Blob.\n * Невалидный payload возвращает null, пустая строка — 0; допустимый размер определяет вызывающий контракт.\n * Data URL, whitespace, URL-safe алфавит и отсутствующий padding здесь не нормализуются.\n */\nexport function getBase64DecodedSize(value: string): number | null {\n\tif (value.length % BASE64_ENCODED_BLOCK_CHARACTERS !== 0 || INVALID_BASE64_CHARACTER_PATTERN.test(value)) return null;\n\tconst paddingLength = value.endsWith(BASE64_DOUBLE_PADDING) ? 2 : value.endsWith(BASE64_PADDING) ? 1 : 0;\n\tconst firstPaddingIndex = value.indexOf(BASE64_PADDING);\n\tif (firstPaddingIndex !== -1 && firstPaddingIndex !== value.length - paddingLength) return null;\n\treturn Math.floor((value.length * BASE64_DECODED_BLOCK_BYTES) / BASE64_ENCODED_BLOCK_CHARACTERS) - paddingLength;\n}\n","import { useEffect, useEffectEvent, useState } from \"react\";\n\nimport { logError } from \"../utils\";\n\nimport { binaryToBlob, detectMimeType } from \"./binaryToBlob\";\n\nexport function useBinaryFile(bin: string | undefined) {\n\tconst [entry, setEntry] = useState<{ blob: Blob; mime: string } | null>(null);\n\tconst [error, setError] = useState<string | null>(null);\n\n\tconst updateEntry = useEffectEvent((data: { blob: Blob; mime: string } | null) => setEntry(data));\n\tconst updateError = useEffectEvent((error: string | null) => setError(error));\n\n\tuseEffect(() => {\n\t\tif (bin) {\n\t\t\ttry {\n\t\t\t\tconst mime = detectMimeType(undefined, bin);\n\t\t\t\tconst blob = binaryToBlob(bin, mime, true);\n\n\t\t\t\tupdateEntry({ blob, mime });\n\t\t\t\tupdateError(null);\n\t\t\t} catch (e) {\n\t\t\t\tlogError(e);\n\n\t\t\t\tupdateError(String(e));\n\t\t\t\tupdateEntry(null);\n\t\t\t}\n\t\t} else {\n\t\t\tupdateEntry(null);\n\t\t\tupdateError(null);\n\t\t}\n\t}, [bin]);\n\n\treturn { data: entry, error };\n}\n"],"mappings":";;;;;AAqBA,IAAM,IAA0B,oCAC1B,IAAgC,KAChC,IAA6B,IAE7B,IAAoB;CAAC;CAAM;CAAM;CAAM;AAAI,GAC3C,IAAqB;CAAC;CAAM;CAAM;AAAI,GACtC,IAAoB;CAAC;CAAM;CAAM;CAAM;AAAI,GAC3C,IAAoB;CAAC;CAAM;CAAM;AAAI,GACrC,IAAqB;CAAC;CAAM;CAAM;CAAM;AAAI,GAC5C,IAAoB,CAAC,IAAM,EAAI,GAE/B,IAAiD;CACtD,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;AACN,GAEM,KAAmB,MAA0B;CAClD,IAAM,IAAa,EAAM,QAAQ,OAAO,EAAE,CAAC,CAAC,QAAQ,MAAM,GAAG,CAAC,CAAC,QAAQ,MAAM,GAAG,GAC1E,IAAc,EAAW,SAAA;CAE/B,IAAI,MAAgB,KAAK,CAAC,yBAAyB,KAAK,CAAU,GAC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browser-notifications/browserNotificationConstants.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,eAAO,MAAM,gCAAgC,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type BROWSER_NOTIFICATION_UNSUPPORTED } from "./browserNotificationConstants";
|
|
1
2
|
/** Состояние системного разрешения; unsupported не подменяется отказом пользователя. */
|
|
2
|
-
export type BrowserNotificationPermission = NotificationPermission |
|
|
3
|
+
export type BrowserNotificationPermission = NotificationPermission | typeof BROWSER_NOTIFICATION_UNSUPPORTED;
|
|
3
4
|
export type BrowserNotificationRequest = Readonly<{
|
|
4
5
|
title: string;
|
|
5
6
|
body: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserNotificationTypes.d.ts","sourceRoot":"","sources":["../../src/browser-notifications/browserNotificationTypes.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,MAAM,MAAM,6BAA6B,GAAG,sBAAsB,GAAG,
|
|
1
|
+
{"version":3,"file":"browserNotificationTypes.d.ts","sourceRoot":"","sources":["../../src/browser-notifications/browserNotificationTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAEvF,wFAAwF;AACxF,MAAM,MAAM,6BAA6B,GAAG,sBAAsB,GAAG,OAAO,gCAAgC,CAAC;AAE7G,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CAAC;IACnD,UAAU,EAAE,MAAM,6BAA6B,CAAC;IAChD,6EAA6E;IAC7E,iBAAiB,EAAE,MAAM,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAChE,wEAAwE;IACxE,IAAI,EAAE,CAAC,OAAO,EAAE,0BAA0B,KAAK,MAAM,IAAI,CAAC;IAC1D,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,mCAAmC,GAAG,QAAQ,CAAC;IAC1D,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBrowserNotificationPresenter.d.ts","sourceRoot":"","sources":["../../src/browser-notifications/createBrowserNotificationPresenter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createBrowserNotificationPresenter.d.ts","sourceRoot":"","sources":["../../src/browser-notifications/createBrowserNotificationPresenter.ts"],"names":[],"mappings":"AAIA,OAAO,EAEN,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EACxC,MAAM,4BAA4B,CAAC;AAIpC;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mCAAmC,GAAG,4BAA4B,CA8EzI"}
|