diff --git a/.editorconfig b/.editorconfig index 65365be..8faf7cf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,7 @@ end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true + +[*.{kt,kts}] +# Kotlin extension filenames intentionally mirror Swift's Type+operation style. +ktlint_standard_filename = disabled diff --git a/.gitattributes b/.gitattributes index e27f70f..548d575 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,2 @@ -*.pbxproj -text -# specific for windows script files -*.bat text eol=crlf +# Nitrogen owns generated formatting, including intentional trailing spaces. +nitrogen/generated/** -whitespace diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index d9cb0d6..4d7cbce 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -2,19 +2,29 @@ name: Build Example (Android) on: pull_request: - branches: [main] + branches: [main, develop] paths: + - '.github/workflows/build-android.yml' - 'android/**' + - 'cpp/**' - 'example/android/**' + - 'nitrogen/**' + - 'nitro.json' + - 'src/specs/**' - 'package.json' - 'yarn.lock' - '*.gradle' - '*.gradle.kts' push: - branches: [main] + branches: [main, develop] paths: + - '.github/workflows/build-android.yml' - 'android/**' + - 'cpp/**' - 'example/android/**' + - 'nitrogen/**' + - 'nitro.json' + - 'src/specs/**' - 'package.json' - 'yarn.lock' - '*.gradle' @@ -79,3 +89,9 @@ jobs: - name: Build Android example run: yarn turbo run build:android + + - name: Compile library with v2 features disabled + working-directory: example/android + env: + VISION_CAMERA_MLKIT_DISABLE_V2_FEATURES: 'true' + run: ./gradlew :react-native-vision-camera-mlkit:compileDebugKotlin --no-daemon diff --git a/.github/workflows/build-ios.yml b/.github/workflows/build-ios.yml index 8ed619d..aab7a2a 100644 --- a/.github/workflows/build-ios.yml +++ b/.github/workflows/build-ios.yml @@ -2,18 +2,28 @@ name: Build Example (iOS) on: pull_request: - branches: [main] + branches: [main, develop] paths: + - '.github/workflows/build-ios.yml' + - 'cpp/**' - 'ios/**' - 'example/ios/**' + - 'nitrogen/**' + - 'nitro.json' + - 'src/specs/**' - '*.podspec' - 'package.json' - 'yarn.lock' push: - branches: [main] + branches: [main, develop] paths: + - '.github/workflows/build-ios.yml' + - 'cpp/**' - 'ios/**' - 'example/ios/**' + - 'nitrogen/**' + - 'nitro.json' + - 'src/specs/**' - '*.podspec' - 'package.json' - 'yarn.lock' @@ -32,7 +42,7 @@ jobs: runs-on: macos-latest env: - XCODE_VERSION: 16.3 + XCODE_VERSION: latest-stable RCT_USE_RN_DEP: 1 RCT_USE_PREBUILT_RNCORE: 1 @@ -86,7 +96,7 @@ jobs: exit 1 fi - echo "IOS_DESTINATION=platform=iOS Simulator,OS=${IOS_RUNTIME},name=iPhone 15" >> "$GITHUB_ENV" + echo "IOS_DESTINATION=OS=${IOS_RUNTIME},name=iPhone 15" >> "$GITHUB_ENV" - name: Install CocoaPods run: | diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index 110f739..c52bb1c 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -2,9 +2,9 @@ name: Build Package on: pull_request: - branches: [main] + branches: [main, develop] push: - branches: [main] + branches: [main, develop] permissions: contents: read @@ -23,5 +23,15 @@ jobs: - name: Setup environment uses: ./.github/actions/setup + - name: Verify generated Nitro specs are current + run: | + yarn specs + if [ -n "$(git status --porcelain --untracked-files=all -- nitrogen)" ]; then + echo "Generated Nitro specs are out of date. Run 'yarn specs' and commit the results." + git status --short --untracked-files=all -- nitrogen + git diff -- nitrogen + exit 1 + fi + - name: Build library run: yarn prepare diff --git a/.github/workflows/ktlint-format.yml b/.github/workflows/ktlint-format.yml index 65f867a..3955319 100644 --- a/.github/workflows/ktlint-format.yml +++ b/.github/workflows/ktlint-format.yml @@ -2,14 +2,14 @@ name: Ktlint Format (Android) on: push: - branches: [main] + branches: [main, develop] paths: - '.github/workflows/ktlint-format.yml' - 'android/**/*.kt' - 'android/**/*.kts' - '.editorconfig' pull_request: - branches: [main] + branches: [main, develop] paths: - '.github/workflows/ktlint-format.yml' - 'android/**/*.kt' diff --git a/.github/workflows/lint-typecheck.yml b/.github/workflows/lint-typecheck.yml index f9d24de..1c5b1f3 100644 --- a/.github/workflows/lint-typecheck.yml +++ b/.github/workflows/lint-typecheck.yml @@ -2,9 +2,9 @@ name: Lint & Typecheck on: pull_request: - branches: [main] + branches: [main, develop] push: - branches: [main] + branches: [main, develop] permissions: contents: read diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml index 9f77bb3..c406bcc 100644 --- a/.github/workflows/npm-release.yml +++ b/.github/workflows/npm-release.yml @@ -3,38 +3,55 @@ name: NPM Release on: release: types: [published] - workflow_dispatch: permissions: contents: read - id-token: write jobs: build: name: Build package runs-on: ubuntu-latest + outputs: + tarball: ${{ steps.pack.outputs.tarball }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup environment uses: ./.github/actions/setup + - name: Validate release tag + run: | + PACKAGE_VERSION="$(node -p "require('./package.json').version")" + EXPECTED_TAG="v${PACKAGE_VERSION}" + + if [[ "$GITHUB_REF_TYPE" != "tag" || "$GITHUB_REF_NAME" != "$EXPECTED_TAG" ]]; then + echo "Release ref must be the package version tag: $EXPECTED_TAG" >&2 + exit 1 + fi + - name: Build package run: yarn prepare - - name: Upload build artifacts - uses: actions/upload-artifact@v4 + - name: Pack package + id: pack + run: | + TARBALL="$(npm pack | tail -n 1)" + + if [[ ! "$TARBALL" =~ ^react-native-vision-camera-mlkit-[0-9A-Za-z._-]+\.tgz$ ]]; then + echo "Unexpected package tarball name: $TARBALL" >&2 + exit 1 + fi + + echo "tarball=$TARBALL" >> "$GITHUB_OUTPUT" + + - name: Upload package tarball + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: - name: lib - path: | - bin - android - ios - package.json - README.md - LICENSE* + name: package-tarball + path: ${{ steps.pack.outputs.tarball }} + if-no-files-found: error publish: name: Publish to npm @@ -46,22 +63,18 @@ jobs: id-token: write steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup environment - uses: ./.github/actions/setup - - name: Setup Node.js for npm - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: - node-version: 20 + # npm trusted publishing requires npm >=11.5.1 and Node >=22.14.0. + # Node 24.7.0 ships npm 11.5.1. + node-version: 24.7.0 registry-url: https://registry.npmjs.org - - name: Download build artifacts (overwrite into repo root) - uses: actions/download-artifact@v4 + - name: Download package tarball + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: - name: lib + name: package-tarball path: . - name: Determine npm tag @@ -80,9 +93,11 @@ jobs: fi - name: Publish package + env: + PACKAGE_TARBALL: ${{ needs.build.outputs.tarball }} run: | if [ "${{ steps.npm-tag.outputs.tag }}" = "latest" ]; then - npm publish --provenance --access public + npm publish "$PACKAGE_TARBALL" --ignore-scripts --provenance --access public else - npm publish --provenance --access public --tag ${{ steps.npm-tag.outputs.tag }} + npm publish "$PACKAGE_TARBALL" --ignore-scripts --provenance --access public --tag ${{ steps.npm-tag.outputs.tag }} fi diff --git a/.github/workflows/swift-format.yml b/.github/workflows/swift-format.yml index 82df3de..26ee93a 100644 --- a/.github/workflows/swift-format.yml +++ b/.github/workflows/swift-format.yml @@ -2,13 +2,13 @@ name: Swift Format (iOS) on: pull_request: - branches: [main] + branches: [main, develop] paths: - '.github/workflows/swift-format.yml' - 'ios/**/*.swift' - '.swift-format' push: - branches: [main] + branches: [main, develop] paths: - '.github/workflows/swift-format.yml' - 'ios/**/*.swift' diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index f5be3ba..240e6ca 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -2,9 +2,9 @@ name: Unit Tests on: pull_request: - branches: [main] + branches: [main, develop] push: - branches: [main] + branches: [main, develop] permissions: contents: read diff --git a/.gitignore b/.gitignore index 7b8793a..512508d 100644 --- a/.gitignore +++ b/.gitignore @@ -92,6 +92,3 @@ lib/ # React Native Codegen ios/generated android/generated - -# React Native Nitro Modules -nitrogen/ diff --git a/README.md b/README.md index f6881d6..3dff1a5 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,14 @@ [![MIT License][license-shield]][license-url] [![NPM Version][npm-version-shield]][npm-version-url] -A [React Native Vision Camera](https://github.com/mrousavy/react-native-vision-camera) plugin that exposes high-performance [Google ML Kit](https://developers.google.com/ml-kit) [frame output](https://visioncamera.margelo.com/docs/frame-output) features. Ships today: text recognition (OCR) and barcode scanning. Face detection, pose detection, and other ML Kit vision features are planned — see the [roadmap](#google-ml-kit-vision-features-roadmap) below. +A Nitro-based [React Native Vision Camera](https://github.com/mrousavy/react-native-vision-camera) v5 plugin that exposes high-performance [Google ML Kit](https://developers.google.com/ml-kit) [frame output](https://visioncamera.margelo.com/docs/frame-output) features. v2 implements text recognition (OCR) and barcode scanning for live frames and static images. Other ML Kit vision features are post-v2 roadmap items. > The example app is intentionally heavy and demo-focused. For integration details, follow the documentation below. ## Requirements -- iOS 12+ and Android SDK 21+ +- React Native 0.86+ +- iOS 15.1+ and Android SDK 24+ - [react-native-vision-camera](https://www.npmjs.com/package/react-native-vision-camera) `>=5` (Nitro-based v5, not v4) - [react-native-nitro-modules](https://www.npmjs.com/package/react-native-nitro-modules) @@ -54,8 +55,9 @@ module.exports = { ``` The **static-image APIs** (`processImageTextRecognition`, -`processImageBarcodeScanning`) don't use frame processors and don't need -Vision Camera, Worklets, or a camera at all. +`processImageBarcodeScanning`) don't use frame outputs, Worklets, or a camera. +They do use the package's configured Nitro recognizers, so VisionCamera v5 and +Nitro Modules remain installation requirements for the native package. > For Expo, follow the Vision Camera guide for camera permissions/setup: > [visioncamera.margelo.com/docs](https://visioncamera.margelo.com/docs). @@ -74,7 +76,17 @@ cd ios && pod install ## ML Kit Models Installation (Selective) -By default, all ML Kit features are enabled. You can selectively include only the models you need to reduce binary size. +v2 implements two feature families: text recognition and barcode scanning. +Both are enabled by default, including all five OCR language models. Disable +OCR languages you do not need to reduce binary size. Configuration keys for +post-v2 roadmap features remain reserved and disabled; enabling one does not +provide a public JS/Nitro API in v2. + +On Android, the Latin OCR and barcode base SDKs remain compile-time +dependencies even when their feature flags are disabled because v2's native +implementation references their API types. Those flags control runtime +availability; the four optional OCR language modules are still omitted when +disabled. ### Android (Gradle) @@ -88,17 +100,7 @@ ext["react-native-vision-camera-mlkit"] = [ textRecognitionDevanagari: false, textRecognitionJapanese: false, textRecognitionKorean: false, - faceDetection: false, - faceMeshDetection: false, - poseDetection: false, - poseDetectionAccurate: false, - selfieSegmentation: false, - subjectSegmentation: false, - documentScanner: false, barcodeScanning: true, - imageLabeling: false, - objectDetection: false, - digitalInkRecognition: false, ] ] ``` @@ -114,19 +116,10 @@ $VisionCameraMLKit = { 'textRecognitionDevanagari' => false, 'textRecognitionJapanese' => false, 'textRecognitionKorean' => false, - 'faceDetection' => false, - 'poseDetection' => false, - 'poseDetectionAccurate' => false, - 'selfieSegmentation' => false, 'barcodeScanning' => true, - 'imageLabeling' => false, - 'objectDetection' => false, - 'digitalInkRecognition' => false, } ``` -Android-only keys: `faceMeshDetection`, `subjectSegmentation`, `documentScanner`. - ### Expo (config plugin) If you're using an Expo prebuild workflow (`expo prebuild`, EAS Build, or a @@ -143,8 +136,7 @@ you don't have to hand-edit native config. Add it to your `app.json`/ "react-native-vision-camera-mlkit", { "textRecognition": true, - "barcodeScanning": true, - "faceDetection": false + "barcodeScanning": true } ] ] @@ -157,12 +149,20 @@ sections above). Passing an unrecognized key throws at prebuild time instead of silently being ignored. Requires `@expo/config-plugins` (already a dependency of `expo` itself, so Expo projects have it for free). +Static-image processing accepts local files up to 25 MB encoded size. iOS +accepts sources up to 25 megapixels and 10,000 pixels on either dimension, then +downsamples them to at most 4 megapixels and 4,096 pixels per dimension during +ImageIO decode. Android currently accepts decoded dimensions up to 4 megapixels +and 4,096 pixels per dimension. Larger inputs are rejected before full decode +to protect application disk, memory, and CPU resources. + ## Usage ### API Docs - [Text Recognition API](docs/text-recognition.md) - [Barcode Scanning API](docs/barcode-scanning.md) +- [Migrating from v1 to v2](docs/migration-v1-to-v2.md) ### Text Recognition (Frame Output) @@ -211,7 +211,7 @@ const frameOutput = useFrameOutput({ - `scaleFactor?: number` (0.9-1.0) - `invertColors?: boolean` - `roi?: RegionOfInterest` (crop processing to a rectangle of the frame; see [Region of Interest](#region-of-interest)) -- `frameProcessInterval?: number` (deprecated, throttle frames manually inside `onFrame` instead) +- `frameProcessInterval?: number` (deprecated compatibility field; v2 does not use it to throttle processing) `TextRecognitionArguments`: @@ -219,7 +219,10 @@ const frameOutput = useFrameOutput({ ### Image Processing (Static Images) -Use `processImageTextRecognition` to analyze a file path or URI without the camera (for example, images picked from the gallery). +Use `processImageTextRecognition` to analyze a local image without the camera +(for example, an image picked from the gallery). Each call creates a Nitro text +recognizer configured with the supplied options, then processes the image +asynchronously. ```ts import { processImageTextRecognition } from 'react-native-vision-camera-mlkit'; @@ -236,11 +239,16 @@ console.log(result.blocks); `TextRecognitionImageOptions`: - `language?: 'LATIN' | 'CHINESE' | 'DEVANAGARI' | 'JAPANESE' | 'KOREAN'` -- `orientation?: 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right'` +- `orientation?: 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right'` (overrides EXIF orientation; omit it to use image metadata) - `invertColors?: boolean` +- `scaleFactor?: number` (0.9-1.0) - `roi?: RegionOfInterest` (crop processing to a rectangle of the image; see [Region of Interest](#region-of-interest)) -> The native bridge normalizes URIs (`file://` is removed on iOS and added on Android if missing). Supported formats: JPEG, PNG, WebP. +> Static images must be local and readable. On iOS, the target must be a +> regular, non-symlink file supplied as an absolute path or `file://` URI. +> Android accepts an absolute path, `file://` URI, or +> `content://` URI (copied to a temporary cache file for processing). Remote +> URLs and platform-library schemes such as `ph://` are not supported. ### Barcode Scanning (Frame Output) @@ -301,7 +309,7 @@ const frameOutput = useFrameOutput({ - `scaleFactor?: number` (0.9-1.0) - `invertColors?: boolean` - `roi?: RegionOfInterest` (crop processing to a rectangle of the frame; see [Region of Interest](#region-of-interest)) -- `frameProcessInterval?: number` (deprecated, throttle frames manually inside `onFrame` instead) +- `frameProcessInterval?: number` (deprecated compatibility field; v2 does not use it to throttle processing) Supported `formats` values: @@ -329,7 +337,9 @@ Supported `formats` values: ### Barcode Scanning (Static Images) -Use `processImageBarcodeScanning` to analyze a file path or URI without the camera. +Use `processImageBarcodeScanning` to analyze a local image without the camera. +Each call creates a Nitro barcode scanner configured with the supplied options, +then processes the image asynchronously. ```ts import { processImageBarcodeScanning } from 'react-native-vision-camera-mlkit'; @@ -351,7 +361,7 @@ for (const barcode of result.barcodes) { - `formats?: ('UNKNOWN' | 'ALL_FORMATS' | 'CODE_128' | 'CODE_39' | 'CODE_93' | 'CODABAR' | 'DATA_MATRIX' | 'EAN_13' | 'EAN_8' | 'ITF' | 'QR_CODE' | 'UPC_A' | 'UPC_E' | 'PDF417' | 'AZTEC')[]` - `enableAllPotentialBarcodes?: boolean` (Android only) -- `orientation?: 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right'` +- `orientation?: 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right'` (overrides EXIF orientation; omit it to use image metadata) - `invertColors?: boolean` - `scaleFactor?: number` (0.9-1.0) - `roi?: RegionOfInterest` (crop processing to a rectangle of the image; see [Region of Interest](#region-of-interest)) @@ -381,13 +391,20 @@ import { ### Error Handling -Frame processors throw a setup error when the feature is not enabled in Gradle/Podfile. For static image processing, the following error strings are exported: +Recognizer creation throws a setup error when OCR or barcode scanning is not +enabled in Gradle/Podfile. Static Nitro calls reject invalid schemes, missing +or unreadable files, and images the platform decoder cannot read. The package +also exports these compatibility error-message constants: - `IMAGE_NOT_FOUND_ERROR` - `INVALID_URI_ERROR` - `IMAGE_PROCESSING_FAILED_ERROR` - `UNSUPPORTED_IMAGE_FORMAT_ERROR` +These constants are retained for source compatibility and user-facing fallback +messages. Nitro rejection messages include platform-specific file details and +are not guaranteed to equal these strings; do not branch on `error.message`. + Use the feature helpers to provide user-friendly configuration hints: ```ts @@ -425,8 +442,8 @@ const { textRecognition } = useTextRecognition({ ## Performance - Follow the Vision Camera [performance guide](https://visioncamera.margelo.com/docs/performance) -- Always call `frame.dispose()` exactly once per frame inside `onFrame` - the Camera pipeline reuses a small buffer pool and stalls (dropping frames) if buffers aren't released. -- Throttle processing by skipping frames yourself inside `onFrame` (see the `frameProcessInterval` deprecation note above) instead of relying on a native-side interval. +- Always call `frame.dispose()` exactly once for every frame delivered to `onFrame`, including skipped frames. A `try`/`finally` around the whole callback is the safest pattern; unreleased v5 frames can stall the camera buffer pool. +- `frameProcessInterval` is retained only for source compatibility and has no throttling effect in the Nitro recognizers. Throttle in `onFrame` by deciding whether to call the recognizer while still disposing every frame. - `useAsyncRunner()` can offload genuinely independent heavy work to a separate thread, but avoid wrapping a single native plugin call in it - passing a plugin's worklet-callable method through nested worklet closures into a different Worklet Runtime is fragile and can throw at runtime. ## iOS Orientation Notes (Text Recognition) @@ -448,19 +465,22 @@ If your iOS build fails in Pods with errors referencing `fmt/include/fmt/base.h` ## Google ML Kit Vision Features Roadmap -| # | Feature | Status | Platform | -| --- | --------------------------------- | ------------------------------------------ | ------------------------------------------------- | -| 0 | **Text recognition v2** | [![complete][complete]][complete] | [![android][android]][android] [![ios][ios]][ios] | -| 1 | **Barcode scanning** | [![complete][complete]][complete] | [![android][android]][android] [![ios][ios]][ios] | -| 2 | **Face detection** | [![in-progress][in-progress]][in-progress] | [![android][android]][android] [![ios][ios]][ios] | -| 3 | **Face mesh detection** | [![in-progress][in-progress]][in-progress] | [![android][android]][android] | -| 4 | **Pose detection** | [![in-progress][in-progress]][in-progress] | [![android][android]][android] [![ios][ios]][ios] | -| 5 | **Selfie segmentation** | [![in-progress][in-progress]][in-progress] | [![android][android]][android] [![ios][ios]][ios] | -| 6 | **Subject segmentation** | [![in-progress][in-progress]][in-progress] | [![android][android]][android] | -| 7 | **Document scanner** | [![in-progress][in-progress]][in-progress] | [![android][android]][android] | -| 8 | **Image labeling** | [![in-progress][in-progress]][in-progress] | [![android][android]][android] [![ios][ios]][ios] | -| 9 | **Object detection and tracking** | [![in-progress][in-progress]][in-progress] | [![android][android]][android] [![ios][ios]][ios] | -| 10 | **Digital ink recognition** | [![in-progress][in-progress]][in-progress] | [![android][android]][android] [![ios][ios]][ios] | +| Feature | Release status | Intended platform | +| --------------------------------- | ----------------- | ----------------- | +| **Text recognition v2** | Available in v2 | Android and iOS | +| **Barcode scanning** | Available in v2 | Android and iOS | +| **Face detection** | Post-v2 roadmap | Android and iOS | +| **Face mesh detection** | Post-v2 roadmap | Android | +| **Pose detection** | Post-v2 roadmap | Android and iOS | +| **Selfie segmentation** | Post-v2 roadmap | Android and iOS | +| **Subject segmentation** | Post-v2 roadmap | Android | +| **Document scanner** | Post-v2 roadmap | Android | +| **Image labeling** | Post-v2 roadmap | Android and iOS | +| **Object detection and tracking** | Post-v2 roadmap | Android and iOS | +| **Digital ink recognition** | Post-v2 roadmap | Android and iOS | + +Roadmap entries are not implemented public APIs and are not commitments to a +particular release. ## Sponsor on GitHub @@ -470,10 +490,6 @@ react-native-vision-camera-mlkit is provided as is and maintained in my free tim If you’re integrating this library into a production app, consider funding the project. -[complete]: https://img.shields.io/badge/COMPLETE-5E5CE6 -[in-progress]: https://img.shields.io/badge/IN%20PROGRESS-FFD60A -[android]: https://img.shields.io/badge/ANDROID-3DDC84 -[ios]: https://img.shields.io/badge/IOS-0A84FF [contributors-shield]: https://img.shields.io/github/contributors/pedrol2b/react-native-vision-camera-mlkit.svg?style=for-the-badge [contributors-url]: https://github.com/pedrol2b/react-native-vision-camera-mlkit/graphs/contributors [forks-shield]: https://img.shields.io/github/forks/pedrol2b/react-native-vision-camera-mlkit.svg?style=for-the-badge diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index f71a5c6..d229575 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -34,7 +34,6 @@ target_sources( find_library(LOG_LIB log) find_package(fbjni REQUIRED) find_package(ReactAndroid REQUIRED) -find_package(react-native-nitro-image REQUIRED) find_package(react-native-nitro-modules REQUIRED) find_package(react-native-vision-camera REQUIRED) @@ -44,7 +43,6 @@ target_link_libraries( android fbjni::fbjni ReactAndroid::jsi - react-native-nitro-image::NitroImage react-native-nitro-modules::NitroModules react-native-vision-camera::VisionCamera ) diff --git a/android/build.gradle b/android/build.gradle index 5dccb88..070c506 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -188,15 +188,14 @@ dependencies { implementation "androidx.exifinterface:exifinterface:1.3.7" // ===== GoogleMLKit Vision ===== - // Only include dependencies for enabled features + // Base SDKs for the two v2 features are compile-time dependencies because + // their public types are referenced by unconditional Kotlin sources. Feature + // flags still control runtime availability; optional OCR language models stay + // selective so consumers can trim those larger model artifacts. // Text recognition v2 // https://developers.google.com/ml-kit/vision/text-recognition/v2/android - // Base text-recognition is required whenever any text recognition variant is enabled, - // as it provides shared types (TextRecognizer, TextRecognizerOptions, etc.) - if (anyTextRecognition) { - implementation "com.google.mlkit:text-recognition:16.0.1" - } + implementation "com.google.mlkit:text-recognition:16.0.1" if (mlkitConfig.textRecognitionChinese) { implementation "com.google.mlkit:text-recognition-chinese:16.0.1" } @@ -251,9 +250,7 @@ dependencies { // Barcode scanning // https://developers.google.com/ml-kit/vision/barcode-scanning/android - if (mlkitConfig.barcodeScanning) { - implementation "com.google.mlkit:barcode-scanning:17.3.0" - } + implementation "com.google.mlkit:barcode-scanning:17.3.0" // Image labeling (Base Model) -> Custom models will be added soon // https://developers.google.com/ml-kit/vision/image-labeling/android diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeParsedValue+toNitroAnyMap.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeParsedValue+toNitroAnyMap.kt new file mode 100644 index 0000000..ab2479f --- /dev/null +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeParsedValue+toNitroAnyMap.kt @@ -0,0 +1,13 @@ +package com.margelo.nitro.visioncameramlkit + +import com.margelo.nitro.core.AnyMap +import com.visioncameramlkit.domain.models.BarcodeParsedValue + +internal fun BarcodeParsedValue.toNitroAnyMap(): AnyMap = + AnyMap.fromMap( + mapOf( + "type" to type, + "data" to data, + ), + ignoreIncompatible = false, + ) diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeScannerOptions+toDomain.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeScannerOptions+toDomain.kt index 0e1d027..9958ec1 100644 --- a/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeScannerOptions+toDomain.kt +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeScannerOptions+toDomain.kt @@ -16,4 +16,5 @@ internal fun BarcodeScannerOptions.toImagePreprocessingOptions(): ImagePreproces invertColors = invertColors ?: false, scaleFactor = scaleFactor?.toFloat() ?: 1.0f, roi = roi.toDomainRegionOfInterest(), + orientation = orientation.toDomainOrientation(), ) diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeScanningResult+toNitro.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeScanningResult+toNitro.kt index 40717fe..87d2e41 100644 --- a/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeScanningResult+toNitro.kt +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/BarcodeScanningResult+toNitro.kt @@ -16,11 +16,11 @@ private fun com.visioncameramlkit.domain.models.BarcodeData.toNitroBarcode(): Ba rawValue = rawValue, displayValue = displayValue, rawBytes = rawBytes?.map { it.toDouble() }?.toDoubleArray(), + value = value?.toNitroAnyMap(), isPotential = isPotential, ) -private fun String.toNitroBarcodeFormat(): BarcodeFormat = - runCatching { BarcodeFormat.valueOf(this) }.getOrDefault(BarcodeFormat.UNKNOWN) +private fun String.toNitroBarcodeFormat(): BarcodeFormat = runCatching { BarcodeFormat.valueOf(this) }.getOrDefault(BarcodeFormat.UNKNOWN) private fun String.toNitroBarcodeValueTypeName(): BarcodeValueTypeName = runCatching { BarcodeValueTypeName.valueOf(this) }.getOrDefault(BarcodeValueTypeName.TYPE_UNKNOWN) diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/HybridBarcodeScanner.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/HybridBarcodeScanner.kt index 5b72857..b3c19aa 100644 --- a/android/src/main/java/com/margelo/nitro/visioncameramlkit/HybridBarcodeScanner.kt +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/HybridBarcodeScanner.kt @@ -1,11 +1,14 @@ package com.margelo.nitro.visioncameramlkit +import android.util.Log import androidx.annotation.Keep import com.facebook.proguard.annotations.DoNotStrip import com.margelo.nitro.camera.HybridFrameSpec +import com.margelo.nitro.core.Promise import com.visioncameramlkit.domain.models.remap import com.visioncameramlkit.infrastructure.image.ImagePreprocessor import com.visioncameramlkit.infrastructure.mlkit.factories.BarcodeScanningServiceFactory +import java.util.concurrent.atomic.AtomicBoolean @DoNotStrip @Keep @@ -16,6 +19,7 @@ class HybridBarcodeScanner( private val barcodeOptions = options.toDomainBarcodeScanningOptions() private val imageOptions = options.toImagePreprocessingOptions() private val recognitionService = BarcodeScanningServiceFactory.create(barcodeOptions) + private val isDisposed = AtomicBoolean(false) override fun recognize( frame: HybridFrameSpec, @@ -25,4 +29,21 @@ class HybridBarcodeScanner( val result = recognitionService.recognize(processedImage) return result.remap(processedImage.metadata).toNitroResult() } + + override fun recognizeImage(uri: String): Promise = + Promise.parallel { + StaticImageUriResolver.resolve(uri).use { resolvedImage -> + val processedImage = imagePreprocessor.preprocessImage(resolvedImage.file, imageOptions) + val result = recognitionService.recognize(processedImage) + result.remap(processedImage.metadata).toNitroResult() + } + } + + override fun dispose() { + if (isDisposed.compareAndSet(false, true)) { + runCatching { recognitionService.close() } + .onFailure { error -> Log.w(TAG, "Failed to close barcode scanner", error) } + } + super.dispose() + } } diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/HybridTextRecognizer.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/HybridTextRecognizer.kt index 83c9653..bf281f8 100644 --- a/android/src/main/java/com/margelo/nitro/visioncameramlkit/HybridTextRecognizer.kt +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/HybridTextRecognizer.kt @@ -1,11 +1,14 @@ package com.margelo.nitro.visioncameramlkit +import android.util.Log import androidx.annotation.Keep import com.facebook.proguard.annotations.DoNotStrip import com.margelo.nitro.camera.HybridFrameSpec +import com.margelo.nitro.core.Promise import com.visioncameramlkit.domain.models.remap import com.visioncameramlkit.infrastructure.image.ImagePreprocessor import com.visioncameramlkit.infrastructure.mlkit.factories.TextRecognitionServiceFactory +import java.util.concurrent.atomic.AtomicBoolean @DoNotStrip @Keep @@ -16,6 +19,7 @@ class HybridTextRecognizer( private val textOptions = options.toDomainTextRecognitionOptions() private val imageOptions = options.toImagePreprocessingOptions() private val recognitionService = TextRecognitionServiceFactory.create(textOptions.language) + private val isDisposed = AtomicBoolean(false) override fun recognize( frame: HybridFrameSpec, @@ -25,4 +29,21 @@ class HybridTextRecognizer( val result = recognitionService.recognize(processedImage) return result.remap(processedImage.metadata).toNitroResult() } + + override fun recognizeImage(uri: String): Promise = + Promise.parallel { + StaticImageUriResolver.resolve(uri).use { resolvedImage -> + val processedImage = imagePreprocessor.preprocessImage(resolvedImage.file, imageOptions) + val result = recognitionService.recognize(processedImage) + result.remap(processedImage.metadata).toNitroResult() + } + } + + override fun dispose() { + if (isDisposed.compareAndSet(false, true)) { + runCatching { recognitionService.close() } + .onFailure { error -> Log.w(TAG, "Failed to close text recognizer", error) } + } + super.dispose() + } } diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/Orientation+toDomain.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/Orientation+toDomain.kt new file mode 100644 index 0000000..3b16a80 --- /dev/null +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/Orientation+toDomain.kt @@ -0,0 +1,12 @@ +package com.margelo.nitro.visioncameramlkit + +import com.visioncameramlkit.domain.models.Orientation as DomainOrientation + +internal fun Orientation?.toDomainOrientation(): DomainOrientation? = + when (this) { + Orientation.PORTRAIT -> DomainOrientation.PORTRAIT + Orientation.PORTRAIT_UPSIDE_DOWN -> DomainOrientation.PORTRAIT_UPSIDE_DOWN + Orientation.LANDSCAPE_LEFT -> DomainOrientation.LANDSCAPE_LEFT + Orientation.LANDSCAPE_RIGHT -> DomainOrientation.LANDSCAPE_RIGHT + null -> null + } diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/ResolvedStaticImage.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/ResolvedStaticImage.kt new file mode 100644 index 0000000..a5f4517 --- /dev/null +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/ResolvedStaticImage.kt @@ -0,0 +1,16 @@ +package com.margelo.nitro.visioncameramlkit + +import java.io.Closeable +import java.io.File +import java.io.IOException + +internal class ResolvedStaticImage( + val file: File, + private val deleteOnClose: Boolean, +) : Closeable { + override fun close() { + if (deleteOnClose && file.exists() && !file.delete()) { + throw IOException("Failed to delete temporary image file.") + } + } +} diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/StaticImageUriResolver.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/StaticImageUriResolver.kt new file mode 100644 index 0000000..227ebb0 --- /dev/null +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/StaticImageUriResolver.kt @@ -0,0 +1,90 @@ +package com.margelo.nitro.visioncameramlkit + +import android.net.Uri +import com.margelo.nitro.NitroModules +import com.visioncameramlkit.domain.models.StaticImageLimits +import java.io.File +import java.io.FileNotFoundException +import java.io.IOException + +internal object StaticImageUriResolver { + fun resolve(value: String): ResolvedStaticImage { + require(value.isNotBlank()) { "Image URI must not be blank." } + + val uri = Uri.parse(value) + val scheme = uri.scheme + return when { + scheme == null -> resolveAbsolutePath(value) + scheme.equals("content", ignoreCase = true) -> resolveContentUri(uri) + scheme.equals("file", ignoreCase = true) -> resolveFileUri(uri, value) + else -> throw IllegalArgumentException("Unsupported image URI scheme: $scheme") + } + } + + private fun resolveContentUri(uri: Uri): ResolvedStaticImage { + val context = + NitroModules.applicationContext + ?: throw IllegalStateException("NitroModules application context is unavailable.") + val temporaryFile = File.createTempFile("vision-camera-mlkit-", ".image", context.cacheDir) + val resolvedImage = ResolvedStaticImage(temporaryFile, deleteOnClose = true) + + try { + val input = + context.contentResolver.openInputStream(uri) + ?: throw FileNotFoundException("Unable to open content URI: $uri") + input.use { source -> + temporaryFile.outputStream().use { destination -> + val buffer = ByteArray(DEFAULT_BUFFER_SIZE) + var copiedBytes = 0L + while (true) { + val bytesRead = source.read(buffer) + if (bytesRead < 0) break + copiedBytes += bytesRead + require(copiedBytes <= StaticImageLimits.MAX_ENCODED_BYTES) { + "Static image exceeds the 25 MB encoded-size limit." + } + destination.write(buffer, 0, bytesRead) + } + } + } + return resolvedImage + } catch (error: Throwable) { + try { + resolvedImage.close() + } catch (cleanupError: Throwable) { + error.addSuppressed(cleanupError) + } + throw error + } + } + + private fun resolveFileUri( + uri: Uri, + originalValue: String, + ): ResolvedStaticImage { + val path = uri.path ?: throw IllegalArgumentException("File URI has no path: $originalValue") + return resolveExistingFile(File(path), originalValue) + } + + private fun resolveAbsolutePath(value: String): ResolvedStaticImage { + val file = File(value) + require(file.isAbsolute) { "Image path must be absolute: $value" } + return resolveExistingFile(file, value) + } + + private fun resolveExistingFile( + file: File, + originalValue: String, + ): ResolvedStaticImage { + if (!file.isFile) { + throw FileNotFoundException("Image file not found: $originalValue") + } + if (!file.canRead()) { + throw IOException("Image file is not readable: $originalValue") + } + require(file.length() <= StaticImageLimits.MAX_ENCODED_BYTES) { + "Static image exceeds the 25 MB encoded-size limit." + } + return ResolvedStaticImage(file, deleteOnClose = false) + } +} diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/TextRecognitionLanguage+toDomain.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/TextRecognitionLanguage+toDomain.kt index d3a0b31..e2e4776 100644 --- a/android/src/main/java/com/margelo/nitro/visioncameramlkit/TextRecognitionLanguage+toDomain.kt +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/TextRecognitionLanguage+toDomain.kt @@ -3,9 +3,13 @@ package com.margelo.nitro.visioncameramlkit internal fun TextRecognitionLanguage?.toDomainLanguage(): com.visioncameramlkit.domain.models.TextRecognitionLanguage = when (this) { TextRecognitionLanguage.CHINESE -> com.visioncameramlkit.domain.models.TextRecognitionLanguage.CHINESE + TextRecognitionLanguage.DEVANAGARI -> com.visioncameramlkit.domain.models.TextRecognitionLanguage.DEVANAGARI + TextRecognitionLanguage.JAPANESE -> com.visioncameramlkit.domain.models.TextRecognitionLanguage.JAPANESE + TextRecognitionLanguage.KOREAN -> com.visioncameramlkit.domain.models.TextRecognitionLanguage.KOREAN + TextRecognitionLanguage.LATIN, null, -> com.visioncameramlkit.domain.models.TextRecognitionLanguage.LATIN diff --git a/android/src/main/java/com/margelo/nitro/visioncameramlkit/TextRecognizerOptions+toDomain.kt b/android/src/main/java/com/margelo/nitro/visioncameramlkit/TextRecognizerOptions+toDomain.kt index fdea701..4b1b172 100644 --- a/android/src/main/java/com/margelo/nitro/visioncameramlkit/TextRecognizerOptions+toDomain.kt +++ b/android/src/main/java/com/margelo/nitro/visioncameramlkit/TextRecognizerOptions+toDomain.kt @@ -15,4 +15,5 @@ internal fun TextRecognizerOptions.toImagePreprocessingOptions(): ImagePreproces invertColors = invertColors ?: false, scaleFactor = scaleFactor?.toFloat() ?: 1.0f, roi = roi.toDomainRegionOfInterest(), + orientation = orientation.toDomainOrientation(), ) diff --git a/android/src/main/java/com/visioncameramlkit/VisionCameraMLKitPackage.kt b/android/src/main/java/com/visioncameramlkit/VisionCameraMLKitPackage.kt index 40ffb2b..16b0765 100644 --- a/android/src/main/java/com/visioncameramlkit/VisionCameraMLKitPackage.kt +++ b/android/src/main/java/com/visioncameramlkit/VisionCameraMLKitPackage.kt @@ -7,36 +7,16 @@ import com.facebook.react.module.model.ReactModuleInfo import com.facebook.react.module.model.ReactModuleInfoProvider import com.facebook.react.uimanager.ViewManager import com.margelo.nitro.visioncameramlkit.VisionCameraMLKitOnLoad -import com.visioncameramlkit.infrastructure.modules.VisionCameraMLKitModule class VisionCameraMLKitPackage : BaseReactPackage() { override fun getModule( name: String, reactContext: ReactApplicationContext, - ): NativeModule? = - when (name) { - VisionCameraMLKitModule.NAME -> { - VisionCameraMLKitModule(reactContext) - } - - else -> { - null - } - } + ): NativeModule? = null override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider { - mapOf( - VisionCameraMLKitModule.NAME to - ReactModuleInfo( - VisionCameraMLKitModule.NAME, - VisionCameraMLKitModule.NAME, - canOverrideExistingModule = false, - needsEagerInit = false, - isCxxModule = false, - isTurboModule = false, - ), - ) + emptyMap() } override fun createViewManagers(reactContext: ReactApplicationContext): List> = emptyList() diff --git a/android/src/main/java/com/visioncameramlkit/application/usecases/RecognizeBarcodesUseCase.kt b/android/src/main/java/com/visioncameramlkit/application/usecases/RecognizeBarcodesUseCase.kt deleted file mode 100644 index d03f17a..0000000 --- a/android/src/main/java/com/visioncameramlkit/application/usecases/RecognizeBarcodesUseCase.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.visioncameramlkit.application.usecases - -import com.visioncameramlkit.domain.models.BarcodeScanningOptions -import com.visioncameramlkit.domain.models.BarcodeScanningResult -import com.visioncameramlkit.domain.models.ImagePreprocessingOptions -import com.visioncameramlkit.domain.models.remap -import com.visioncameramlkit.domain.services.IImagePreprocessor -import com.visioncameramlkit.domain.services.IRecognitionService -import java.io.File - -class RecognizeBarcodesUseCase( - private val imagePreprocessor: IImagePreprocessor, - private val recognitionService: IRecognitionService, -) { - fun execute( - imageFile: File, - imageOptions: ImagePreprocessingOptions, - @Suppress("unused") barcodeOptions: BarcodeScanningOptions, - ): BarcodeScanningResult { - val preprocessingOptions = - ImagePreprocessingOptions( - invertColors = imageOptions.invertColors, - orientation = imageOptions.orientation, - scaleFactor = imageOptions.scaleFactor, - roi = imageOptions.roi, - ) - - val processedImage = imagePreprocessor.preprocessImage(imageFile, preprocessingOptions) - val result = recognitionService.recognize(processedImage) - return result.remap(processedImage.metadata) - } -} diff --git a/android/src/main/java/com/visioncameramlkit/application/usecases/RecognizeTextUseCase.kt b/android/src/main/java/com/visioncameramlkit/application/usecases/RecognizeTextUseCase.kt deleted file mode 100644 index 46883cd..0000000 --- a/android/src/main/java/com/visioncameramlkit/application/usecases/RecognizeTextUseCase.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.visioncameramlkit.application.usecases - -import com.visioncameramlkit.domain.models.ImagePreprocessingOptions -import com.visioncameramlkit.domain.models.TextRecognitionOptions -import com.visioncameramlkit.domain.models.TextRecognitionResult -import com.visioncameramlkit.domain.models.remap -import com.visioncameramlkit.domain.services.IImagePreprocessor -import com.visioncameramlkit.domain.services.IRecognitionService -import java.io.File - -class RecognizeTextUseCase( - private val imagePreprocessor: IImagePreprocessor, - private val recognitionService: IRecognitionService, -) { - fun execute( - imageFile: File, - imageOptions: ImagePreprocessingOptions, - @Suppress("unused") textOptions: TextRecognitionOptions, - ): TextRecognitionResult { - val preprocessingOptions = - ImagePreprocessingOptions( - invertColors = imageOptions.invertColors, - orientation = imageOptions.orientation, - scaleFactor = imageOptions.scaleFactor, - roi = imageOptions.roi, - ) - - val processedImage = imagePreprocessor.preprocessImage(imageFile, preprocessingOptions) - val result = recognitionService.recognize(processedImage) - return result.remap(processedImage.metadata) - } -} diff --git a/android/src/main/java/com/visioncameramlkit/bridge/constants/MLKitFeatureKeys.kt b/android/src/main/java/com/visioncameramlkit/bridge/constants/MLKitFeatureKeys.kt deleted file mode 100644 index 79ff40b..0000000 --- a/android/src/main/java/com/visioncameramlkit/bridge/constants/MLKitFeatureKeys.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.visioncameramlkit.bridge.constants - -@Suppress("unused") -object MLKitFeatureKeys { - const val TEXT_RECOGNITION = "TextRecognition" - const val FACE_DETECTION = "FaceDetection" - const val FACE_MESH_DETECTION = "FaceMeshDetection" - const val POSE_DETECTION = "PoseDetection" - const val SELFIE_SEGMENTATION = "SelfieSegmentation" - const val SUBJECT_SEGMENTATION = "SubjectSegmentation" - const val DOCUMENT_SCANNER = "DocumentScanner" - const val BARCODE_SCANNING = "BarcodeScanning" - const val IMAGE_LABELING = "ImageLabeling" - const val OBJECT_DETECTION = "ObjectDetection" - const val DIGITAL_INK_RECOGNITION = "DigitalInkRecognition" -} diff --git a/android/src/main/java/com/visioncameramlkit/bridge/handlers/IStaticImageHandler.kt b/android/src/main/java/com/visioncameramlkit/bridge/handlers/IStaticImageHandler.kt deleted file mode 100644 index 8b52d93..0000000 --- a/android/src/main/java/com/visioncameramlkit/bridge/handlers/IStaticImageHandler.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.visioncameramlkit.bridge.handlers - -import com.facebook.react.bridge.Promise -import com.facebook.react.bridge.ReadableMap - -interface IStaticImageHandler { - fun process( - path: String, - options: ReadableMap, - promise: Promise, - ) -} diff --git a/android/src/main/java/com/visioncameramlkit/bridge/handlers/StaticBarcodeScanningHandler.kt b/android/src/main/java/com/visioncameramlkit/bridge/handlers/StaticBarcodeScanningHandler.kt deleted file mode 100644 index 9fe891a..0000000 --- a/android/src/main/java/com/visioncameramlkit/bridge/handlers/StaticBarcodeScanningHandler.kt +++ /dev/null @@ -1,171 +0,0 @@ -package com.visioncameramlkit.bridge.handlers - -import android.net.Uri -import androidx.core.net.toUri -import com.facebook.react.bridge.Promise -import com.facebook.react.bridge.ReactApplicationContext -import com.facebook.react.bridge.ReadableMap -import com.visioncameramlkit.application.usecases.RecognizeBarcodesUseCase -import com.visioncameramlkit.bridge.parsers.BarcodeScanningOptionParser -import com.visioncameramlkit.bridge.parsers.RegionOfInterestOptionParser -import com.visioncameramlkit.domain.models.BarcodeScanningOptions -import com.visioncameramlkit.domain.models.ImagePreprocessingOptions -import com.visioncameramlkit.domain.models.Orientation -import com.visioncameramlkit.infrastructure.image.ImagePreprocessor -import com.visioncameramlkit.infrastructure.mlkit.factories.BarcodeScanningServiceFactory -import com.visioncameramlkit.infrastructure.serializers.BarcodeScanningSerializer -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import java.io.File -import java.io.FileOutputStream - -class StaticBarcodeScanningHandler( - private val reactContext: ReactApplicationContext, -) : IStaticImageHandler { - private val cachedUseCases = mutableMapOf() - - private fun getRecognizeBarcodesUseCase(options: BarcodeScanningOptions): RecognizeBarcodesUseCase { - val cacheKey = - buildString { - append(options.enableAllPotentialBarcodes) - append("|") - append(options.formats.joinToString(separator = ",") { it.name }) - } - - return cachedUseCases.getOrPut(cacheKey) { - RecognizeBarcodesUseCase( - ImagePreprocessor(), - BarcodeScanningServiceFactory.create(options), - ) - } - } - - override fun process( - path: String, - options: ReadableMap, - promise: Promise, - ) { - CoroutineScope(Dispatchers.IO).launch { - var resolvedImage: ResolvedImage? = null - try { - resolvedImage = resolveImage(path) - val imageFile = resolvedImage.file - if (!imageFile.exists()) { - promise.reject("IMAGE_NOT_FOUND_ERROR", "Image file not found at path: $path") - return@launch - } - - val imageOptions = parseImageOptions(options) - val barcodeOptions = parseBarcodeOptions(options) - val recognizeBarcodesUseCase = getRecognizeBarcodesUseCase(barcodeOptions) - - val result = recognizeBarcodesUseCase.execute(imageFile, imageOptions, barcodeOptions) - val serializedResult = BarcodeScanningSerializer.toWritableMap(result) - - promise.resolve(serializedResult) - } catch ( - @Suppress("TooGenericExceptionCaught") e: Exception, - ) { - when (e) { - is IllegalArgumentException -> { - promise.reject("INVALID_URI_ERROR", e.message) - } - - is UnsupportedOperationException -> { - promise.reject( - "UNSUPPORTED_IMAGE_FORMAT_ERROR", - e.message, - ) - } - - else -> { - promise.reject( - "IMAGE_PROCESSING_FAILED_ERROR", - e.message ?: "Barcode scanning failed", - ) - } - } - } finally { - val imageFile = resolvedImage?.file - if (resolvedImage?.shouldDelete == true && imageFile != null && imageFile.exists()) { - imageFile.delete() - } - } - } - } - - private data class ResolvedImage( - val file: File, - val shouldDelete: Boolean, - ) - - private fun resolveImage(path: String): ResolvedImage { - val uri = path.toUri() - return when (uri.scheme) { - "content" -> ResolvedImage(copyContentToCache(uri), true) - "file" -> ResolvedImage(File(uri.path ?: path), false) - null -> ResolvedImage(File(path), false) - else -> ResolvedImage(File(path), false) - } - } - - private fun copyContentToCache(uri: Uri): File { - val cacheFile = File(reactContext.cacheDir, "mlkit_${System.currentTimeMillis()}.tmp") - val inputStream = - reactContext.contentResolver.openInputStream(uri) - ?: throw IllegalArgumentException("Unable to open content URI: $uri") - inputStream.use { input -> - FileOutputStream(cacheFile).use { output -> - input.copyTo(output) - } - } - return cacheFile - } - - private fun parseImageOptions(options: ReadableMap): ImagePreprocessingOptions = - ImagePreprocessingOptions( - invertColors = options.getOrDefault("invertColors", false), - orientation = options.getString("orientation")?.let { parseOrientation(it) }, - scaleFactor = options.getOrDefault("scaleFactor", 1.0f), - roi = RegionOfInterestOptionParser.parse(options), - ) - - private fun parseBarcodeOptions(options: ReadableMap): BarcodeScanningOptions = - BarcodeScanningOptions( - formats = BarcodeScanningOptionParser.parseFormats(options), - enableAllPotentialBarcodes = - BarcodeScanningOptionParser.parseEnableAllPotentialBarcodes( - options, - ), - ) - - private fun parseOrientation(orientation: String): Orientation? = - when (orientation) { - "portrait" -> Orientation.PORTRAIT - "portrait-upside-down" -> Orientation.PORTRAIT_UPSIDE_DOWN - "landscape-left" -> Orientation.LANDSCAPE_LEFT - "landscape-right" -> Orientation.LANDSCAPE_RIGHT - else -> null - } - - private fun ReadableMap.getOrDefault( - key: String, - defaultValue: Boolean, - ): Boolean { - if (!hasKey(key) || isNull(key)) { - return defaultValue - } - return getBoolean(key) - } - - private fun ReadableMap.getOrDefault( - key: String, - defaultValue: Float, - ): Float { - if (!hasKey(key) || isNull(key)) { - return defaultValue - } - return getDouble(key).toFloat() - } -} diff --git a/android/src/main/java/com/visioncameramlkit/bridge/handlers/StaticTextRecognitionHandler.kt b/android/src/main/java/com/visioncameramlkit/bridge/handlers/StaticTextRecognitionHandler.kt deleted file mode 100644 index 14ff378..0000000 --- a/android/src/main/java/com/visioncameramlkit/bridge/handlers/StaticTextRecognitionHandler.kt +++ /dev/null @@ -1,159 +0,0 @@ -package com.visioncameramlkit.bridge.handlers - -import android.net.Uri -import androidx.core.net.toUri -import com.facebook.react.bridge.Promise -import com.facebook.react.bridge.ReactApplicationContext -import com.facebook.react.bridge.ReadableMap -import com.visioncameramlkit.application.usecases.RecognizeTextUseCase -import com.visioncameramlkit.bridge.parsers.RegionOfInterestOptionParser -import com.visioncameramlkit.domain.models.ImagePreprocessingOptions -import com.visioncameramlkit.domain.models.Orientation -import com.visioncameramlkit.domain.models.TextRecognitionLanguage -import com.visioncameramlkit.domain.models.TextRecognitionOptions -import com.visioncameramlkit.infrastructure.image.ImagePreprocessor -import com.visioncameramlkit.infrastructure.mlkit.factories.TextRecognitionServiceFactory -import com.visioncameramlkit.infrastructure.serializers.TextRecognitionSerializer -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import java.io.File -import java.io.FileOutputStream - -class StaticTextRecognitionHandler( - private val reactContext: ReactApplicationContext, -) : IStaticImageHandler { - private var cachedUseCase: RecognizeTextUseCase? = null - - private fun getRecognizeTextUseCase(language: TextRecognitionLanguage): RecognizeTextUseCase { - if (cachedUseCase != null) { - return cachedUseCase!! - } - val recognitionService = TextRecognitionServiceFactory.create(language) - val newUseCase = - RecognizeTextUseCase( - ImagePreprocessor(), - recognitionService, - ) - cachedUseCase = newUseCase - return newUseCase - } - - override fun process( - path: String, - options: ReadableMap, - promise: Promise, - ) { - CoroutineScope(Dispatchers.IO).launch { - var resolvedImage: ResolvedImage? = null - try { - resolvedImage = resolveImage(path) - val imageFile = resolvedImage.file - if (!imageFile.exists()) { - promise.reject("IMAGE_NOT_FOUND_ERROR", "Image file not found at path: $path") - return@launch - } - - val imageOptions = parseImageOptions(options) - - val languageString = options.getString("language") ?: "LATIN" - val language = parseLanguage(languageString) - val textOptions = TextRecognitionOptions(language = language) - - val recognizeTextUseCase = getRecognizeTextUseCase(language) - - val result = - recognizeTextUseCase.execute( - imageFile, - imageOptions, - textOptions, - ) - - val serializedResult = TextRecognitionSerializer.toWritableMap(result) - - promise.resolve(serializedResult) - } catch ( - @Suppress("TooGenericExceptionCaught") e: Exception, - ) { - when (e) { - is IllegalArgumentException -> { - promise.reject("INVALID_URI_ERROR", e.message) - } - - is UnsupportedOperationException -> { - promise.reject( - "UNSUPPORTED_IMAGE_FORMAT_ERROR", - e.message, - ) - } - - else -> { - promise.reject( - "IMAGE_PROCESSING_FAILED_ERROR", - e.message ?: "Text recognition failed", - ) - } - } - } finally { - val imageFile = resolvedImage?.file - if (resolvedImage?.shouldDelete == true && imageFile != null && imageFile.exists()) { - imageFile.delete() - } - } - } - } - - private data class ResolvedImage( - val file: File, - val shouldDelete: Boolean, - ) - - private fun resolveImage(path: String): ResolvedImage { - val uri = path.toUri() - return when (uri.scheme) { - "content" -> ResolvedImage(copyContentToCache(uri), true) - "file" -> ResolvedImage(File(uri.path ?: path), false) - null -> ResolvedImage(File(path), false) - else -> ResolvedImage(File(path), false) - } - } - - private fun copyContentToCache(uri: Uri): File { - val cacheFile = File(reactContext.cacheDir, "mlkit_${System.currentTimeMillis()}.tmp") - val inputStream = - reactContext.contentResolver.openInputStream(uri) - ?: throw IllegalArgumentException("Unable to open content URI: $uri") - inputStream.use { input -> - FileOutputStream(cacheFile).use { output -> - input.copyTo(output) - } - } - return cacheFile - } - - private fun parseImageOptions(options: ReadableMap): ImagePreprocessingOptions = - ImagePreprocessingOptions( - invertColors = options.getBoolean("invertColors"), - orientation = options.getString("orientation")?.let { parseOrientation(it) }, - roi = RegionOfInterestOptionParser.parse(options), - ) - - private fun parseOrientation(orientation: String): Orientation? = - when (orientation) { - "portrait" -> Orientation.PORTRAIT - "portrait-upside-down" -> Orientation.PORTRAIT_UPSIDE_DOWN - "landscape-left" -> Orientation.LANDSCAPE_LEFT - "landscape-right" -> Orientation.LANDSCAPE_RIGHT - else -> null - } - - private fun parseLanguage(language: String): TextRecognitionLanguage = - when (language) { - "LATIN" -> TextRecognitionLanguage.LATIN - "CHINESE" -> TextRecognitionLanguage.CHINESE - "DEVANAGARI" -> TextRecognitionLanguage.DEVANAGARI - "JAPANESE" -> TextRecognitionLanguage.JAPANESE - "KOREAN" -> TextRecognitionLanguage.KOREAN - else -> TextRecognitionLanguage.LATIN - } -} diff --git a/android/src/main/java/com/visioncameramlkit/bridge/parsers/BarcodeScanningOptionParser.kt b/android/src/main/java/com/visioncameramlkit/bridge/parsers/BarcodeScanningOptionParser.kt deleted file mode 100644 index 61c5912..0000000 --- a/android/src/main/java/com/visioncameramlkit/bridge/parsers/BarcodeScanningOptionParser.kt +++ /dev/null @@ -1,41 +0,0 @@ -package com.visioncameramlkit.bridge.parsers - -import com.facebook.react.bridge.ReadableArray -import com.facebook.react.bridge.ReadableMap -import com.visioncameramlkit.domain.models.BarcodeFormatOption - -object BarcodeScanningOptionParser { - fun parseFormats(value: Any?): List = - (value as? List<*>) - ?.mapNotNull { item -> parseFormat(item as? String) } - ?: emptyList() - - @Suppress("ReturnCount") - fun parseFormats(readableMap: ReadableMap): List { - if (!readableMap.hasKey("formats") || readableMap.isNull("formats")) { - return emptyList() - } - val readableArray: ReadableArray = readableMap.getArray("formats") ?: return emptyList() - val parsed = mutableListOf() - for (index in 0 until readableArray.size()) { - val formatString = readableArray.getString(index) - parseFormat(formatString)?.let(parsed::add) - } - return parsed - } - - fun parseEnableAllPotentialBarcodes(value: Any?): Boolean = value as? Boolean ?: false - - fun parseEnableAllPotentialBarcodes(readableMap: ReadableMap): Boolean { - if (!readableMap.hasKey("enableAllPotentialBarcodes") || readableMap.isNull("enableAllPotentialBarcodes")) { - return false - } - return readableMap.getBoolean("enableAllPotentialBarcodes") - } - - private fun parseFormat(format: String?): BarcodeFormatOption? = - format - ?.trim() - ?.takeIf { it.isNotEmpty() } - ?.let { name -> runCatching { BarcodeFormatOption.valueOf(name) }.getOrNull() } -} diff --git a/android/src/main/java/com/visioncameramlkit/bridge/parsers/RegionOfInterestOptionParser.kt b/android/src/main/java/com/visioncameramlkit/bridge/parsers/RegionOfInterestOptionParser.kt deleted file mode 100644 index 68303ce..0000000 --- a/android/src/main/java/com/visioncameramlkit/bridge/parsers/RegionOfInterestOptionParser.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.visioncameramlkit.bridge.parsers - -import com.facebook.react.bridge.ReadableMap -import com.visioncameramlkit.domain.models.RegionOfInterest -import com.visioncameramlkit.domain.models.RegionOfInterestUnit - -object RegionOfInterestOptionParser { - /** - * Parses an optional `roi` key from [readableMap] into a domain [RegionOfInterest]. - * Returns `null` when the key is absent, matching the "no ROI" default. - */ - fun parse(readableMap: ReadableMap): RegionOfInterest? { - if (!readableMap.hasKey("roi") || readableMap.isNull("roi")) { - return null - } - val roiMap = readableMap.getMap("roi") ?: return null - - return RegionOfInterest( - x = roiMap.getDouble("x").toFloat(), - y = roiMap.getDouble("y").toFloat(), - width = roiMap.getDouble("width").toFloat(), - height = roiMap.getDouble("height").toFloat(), - unit = parseUnit(roiMap.getString("unit")), - ) - } - - private fun parseUnit(unit: String?): RegionOfInterestUnit = - when (unit) { - "pixel" -> RegionOfInterestUnit.PIXEL - else -> RegionOfInterestUnit.NORMALIZED - } -} diff --git a/android/src/main/java/com/visioncameramlkit/domain/models/StaticImageLimits.kt b/android/src/main/java/com/visioncameramlkit/domain/models/StaticImageLimits.kt new file mode 100644 index 0000000..e9eb53e --- /dev/null +++ b/android/src/main/java/com/visioncameramlkit/domain/models/StaticImageLimits.kt @@ -0,0 +1,7 @@ +package com.visioncameramlkit.domain.models + +object StaticImageLimits { + const val MAX_ENCODED_BYTES: Long = 25L * 1024L * 1024L + const val MAX_PIXEL_COUNT: Long = 4_000_000L + const val MAX_DIMENSION: Int = 4_096 +} diff --git a/android/src/main/java/com/visioncameramlkit/domain/services/IRecognitionService.kt b/android/src/main/java/com/visioncameramlkit/domain/services/IRecognitionService.kt index 9f7f406..18b5cbf 100644 --- a/android/src/main/java/com/visioncameramlkit/domain/services/IRecognitionService.kt +++ b/android/src/main/java/com/visioncameramlkit/domain/services/IRecognitionService.kt @@ -2,6 +2,6 @@ package com.visioncameramlkit.domain.services import com.visioncameramlkit.domain.models.ProcessedImage -interface IRecognitionService { +interface IRecognitionService : AutoCloseable { fun recognize(image: ProcessedImage): T } diff --git a/android/src/main/java/com/visioncameramlkit/infrastructure/image/ImagePreprocessor.kt b/android/src/main/java/com/visioncameramlkit/infrastructure/image/ImagePreprocessor.kt index 070a9b4..231a944 100644 --- a/android/src/main/java/com/visioncameramlkit/infrastructure/image/ImagePreprocessor.kt +++ b/android/src/main/java/com/visioncameramlkit/infrastructure/image/ImagePreprocessor.kt @@ -17,6 +17,7 @@ import com.visioncameramlkit.domain.models.ImagePreprocessingOptions import com.visioncameramlkit.domain.models.Orientation import com.visioncameramlkit.domain.models.ProcessedImage import com.visioncameramlkit.domain.models.RegionOfInterest +import com.visioncameramlkit.domain.models.StaticImageLimits import com.visioncameramlkit.domain.models.resolveToPixelRect import com.visioncameramlkit.domain.services.IImagePreprocessor import java.io.File @@ -91,6 +92,19 @@ class ImagePreprocessor : IImagePreprocessor { imageFile: File, options: ImagePreprocessingOptions, ): ProcessedImage { + val bounds = BitmapFactory.Options().apply { inJustDecodeBounds = true } + BitmapFactory.decodeFile(imageFile.absolutePath, bounds) + require(bounds.outWidth > 0 && bounds.outHeight > 0) { + "Failed to read static image dimensions" + } + require( + bounds.outWidth <= StaticImageLimits.MAX_DIMENSION && + bounds.outHeight <= StaticImageLimits.MAX_DIMENSION && + bounds.outWidth.toLong() * bounds.outHeight.toLong() <= StaticImageLimits.MAX_PIXEL_COUNT, + ) { + "Static image exceeds the 4 MP or 4,096 px dimension limit." + } + val bitmap = BitmapFactory.decodeFile(imageFile.absolutePath) ?: throw UnsupportedOperationException("Failed to decode image file") @@ -100,33 +114,34 @@ class ImagePreprocessor : IImagePreprocessor { val effectiveOrientation = options.orientation ?: readExifOrientation(imageFile) val rotatedBitmap = rotateBitmap(bitmap, effectiveOrientation) + // Bitmap.createBitmap returns the source instance itself when no transform is + // actually applied (e.g. no rotation needed), so only recycle on a genuine copy. + if (rotatedBitmap !== bitmap) bitmap.recycle() + val effectiveScale = clampScale(options.scaleFactor) val (croppedBitmap, cropRect) = cropToRegionOfInterest(rotatedBitmap, options.roi) + if (croppedBitmap !== rotatedBitmap) rotatedBitmap.recycle() + + val scaledBitmap = + if (effectiveScale < 1.0f) { + croppedBitmap.scale( + (croppedBitmap.width * effectiveScale).toInt(), + (croppedBitmap.height * effectiveScale).toInt(), + false, + ) + } else { + croppedBitmap + } + if (scaledBitmap !== croppedBitmap) croppedBitmap.recycle() val processedBitmap = if (options.invertColors) { - val scaledBitmap = - if (effectiveScale < 1.0f) { - croppedBitmap.scale( - (croppedBitmap.width * effectiveScale).toInt(), - (croppedBitmap.height * effectiveScale).toInt(), - false, - ) - } else { - croppedBitmap - } - invertBitmap(scaledBitmap) + val invertedBitmap = invertBitmap(scaledBitmap) + scaledBitmap.recycle() + invertedBitmap } else { - if (effectiveScale < 1.0f) { - croppedBitmap.scale( - (croppedBitmap.width * effectiveScale).toInt(), - (croppedBitmap.height * effectiveScale).toInt(), - false, - ) - } else { - croppedBitmap - } + scaledBitmap } val inputImage = InputImage.fromBitmap(processedBitmap, 0) diff --git a/android/src/main/java/com/visioncameramlkit/infrastructure/mlkit/MLKitBarcodeScanningService.kt b/android/src/main/java/com/visioncameramlkit/infrastructure/mlkit/MLKitBarcodeScanningService.kt index 6c93181..b38a87b 100644 --- a/android/src/main/java/com/visioncameramlkit/infrastructure/mlkit/MLKitBarcodeScanningService.kt +++ b/android/src/main/java/com/visioncameramlkit/infrastructure/mlkit/MLKitBarcodeScanningService.kt @@ -11,9 +11,21 @@ import com.visioncameramlkit.infrastructure.mlkit.adapters.MLKitBarcodeAdapter class MLKitBarcodeScanningService( private val barcodeScanner: BarcodeScanner, ) : IRecognitionService { - override fun recognize(image: ProcessedImage): BarcodeScanningResult { - val task = barcodeScanner.process(image.image) - val barcodes: List = Tasks.await(task) - return MLKitBarcodeAdapter.toDomain(barcodes) + // ML Kit's on-device detectors are not documented as safe for concurrent use. + // This instance is shared between the synchronous frame-processor path and the + // async static-image path, so calls (and disposal) must be serialized. + private val lock = Any() + + override fun recognize(image: ProcessedImage): BarcodeScanningResult = + synchronized(lock) { + val task = barcodeScanner.process(image.image) + val barcodes: List = Tasks.await(task) + MLKitBarcodeAdapter.toDomain(barcodes) + } + + override fun close() { + synchronized(lock) { + barcodeScanner.close() + } } } diff --git a/android/src/main/java/com/visioncameramlkit/infrastructure/mlkit/MLKitTextRecognitionService.kt b/android/src/main/java/com/visioncameramlkit/infrastructure/mlkit/MLKitTextRecognitionService.kt index 08f7a00..1c3722e 100644 --- a/android/src/main/java/com/visioncameramlkit/infrastructure/mlkit/MLKitTextRecognitionService.kt +++ b/android/src/main/java/com/visioncameramlkit/infrastructure/mlkit/MLKitTextRecognitionService.kt @@ -11,9 +11,21 @@ import com.visioncameramlkit.infrastructure.mlkit.adapters.MLKitTextAdapter class MLKitTextRecognitionService( private val textRecognizer: TextRecognizer, ) : IRecognitionService { - override fun recognize(image: ProcessedImage): TextRecognitionResult { - val task = textRecognizer.process(image.image) - val mlkitText: Text? = Tasks.await(task) - return MLKitTextAdapter.toDomain(mlkitText) + // ML Kit's on-device detectors are not documented as safe for concurrent use. + // This instance is shared between the synchronous frame-processor path and the + // async static-image path, so calls (and disposal) must be serialized. + private val lock = Any() + + override fun recognize(image: ProcessedImage): TextRecognitionResult = + synchronized(lock) { + val task = textRecognizer.process(image.image) + val mlkitText: Text? = Tasks.await(task) + MLKitTextAdapter.toDomain(mlkitText) + } + + override fun close() { + synchronized(lock) { + textRecognizer.close() + } } } diff --git a/android/src/main/java/com/visioncameramlkit/infrastructure/modules/VisionCameraMLKitModule.kt b/android/src/main/java/com/visioncameramlkit/infrastructure/modules/VisionCameraMLKitModule.kt deleted file mode 100644 index 8222645..0000000 --- a/android/src/main/java/com/visioncameramlkit/infrastructure/modules/VisionCameraMLKitModule.kt +++ /dev/null @@ -1,61 +0,0 @@ -package com.visioncameramlkit.infrastructure.modules - -import com.facebook.react.bridge.Arguments -import com.facebook.react.bridge.Promise -import com.facebook.react.bridge.ReactApplicationContext -import com.facebook.react.bridge.ReactContextBaseJavaModule -import com.facebook.react.bridge.ReactMethod -import com.facebook.react.bridge.ReadableMap -import com.facebook.react.module.annotations.ReactModule -import com.visioncameramlkit.BuildConfig -import com.visioncameramlkit.bridge.constants.MLKitFeatureKeys -import com.visioncameramlkit.bridge.handlers.IStaticImageHandler -import com.visioncameramlkit.bridge.handlers.StaticBarcodeScanningHandler -import com.visioncameramlkit.bridge.handlers.StaticTextRecognitionHandler - -@ReactModule(name = VisionCameraMLKitModule.NAME) -class VisionCameraMLKitModule( - reactContext: ReactApplicationContext, -) : ReactContextBaseJavaModule(reactContext) { - companion object { - const val NAME = "VisionCameraMLKitModule" - } - - private val handlers by lazy { - val handlers = mutableMapOf() - - @Suppress("KotlinConstantConditions") - if (BuildConfig.MLKIT_TEXT_RECOGNITION_ANY) { - handlers[MLKitFeatureKeys.TEXT_RECOGNITION] = - StaticTextRecognitionHandler(reactApplicationContext) - } - - @Suppress("KotlinConstantConditions") - if (BuildConfig.MLKIT_BARCODE_SCANNING) { - handlers[MLKitFeatureKeys.BARCODE_SCANNING] = - StaticBarcodeScanningHandler(reactApplicationContext) - } - - handlers - } - - override fun getName(): String = NAME - - @Suppress("unused") - @ReactMethod - fun processImage( - feature: String, - path: String, - options: ReadableMap?, - promise: Promise, - ) { - val safeOptions = options ?: Arguments.createMap() - val handler = handlers[feature] - if (handler == null) { - promise.reject("UNSUPPORTED_FEATURE", "Feature $feature is not supported") - return - } - - handler.process(path, safeOptions, promise) - } -} diff --git a/android/src/main/java/com/visioncameramlkit/infrastructure/serializers/BarcodeScanningSerializer.kt b/android/src/main/java/com/visioncameramlkit/infrastructure/serializers/BarcodeScanningSerializer.kt deleted file mode 100644 index 8ce3192..0000000 --- a/android/src/main/java/com/visioncameramlkit/infrastructure/serializers/BarcodeScanningSerializer.kt +++ /dev/null @@ -1,190 +0,0 @@ -package com.visioncameramlkit.infrastructure.serializers - -import com.facebook.react.bridge.WritableNativeArray -import com.facebook.react.bridge.WritableNativeMap -import com.visioncameramlkit.domain.models.BarcodeData -import com.visioncameramlkit.domain.models.BarcodeParsedValue -import com.visioncameramlkit.domain.models.BarcodeScanningResult -import com.visioncameramlkit.domain.models.BoundingBox -import com.visioncameramlkit.domain.models.Corner - -@Suppress("TooManyFunctions") -object BarcodeScanningSerializer { - fun toWritableMap(result: BarcodeScanningResult): WritableNativeMap = - WritableNativeMap().apply { - putArray("barcodes", toBarcodesArray(result.barcodes)) - } - - fun toReactNativeMap(result: BarcodeScanningResult): HashMap { - @Suppress("UNCHECKED_CAST") - return toWritableMap(result).toHashMap() as HashMap - } - - private fun toBarcodesArray(barcodes: List): WritableNativeArray = - WritableNativeArray().apply { - barcodes.forEach { barcode -> pushMap(toBarcodeMap(barcode)) } - } - - private fun toBarcodeMap(barcode: BarcodeData): WritableNativeMap = - WritableNativeMap().apply { - barcode.bounds?.let { putMap("bounds", toBoundsMap(it)) } - barcode.corners?.let { putArray("corners", toCornersArray(it)) } - putInt("format", barcode.format) - putString("formatName", barcode.formatName) - putInt("valueType", barcode.valueType) - putString("valueTypeName", barcode.valueTypeName) - putString("rawValue", barcode.rawValue) - putString("displayValue", barcode.displayValue) - putBoolean("isPotential", barcode.isPotential) - barcode.rawBytes?.let { putArray("rawBytes", toByteArray(it)) } - barcode.value?.let { putMap("value", toParsedValueMap(it)) } - } - - private fun toBoundsMap(bounds: BoundingBox): WritableNativeMap = - WritableNativeMap().apply { - putDouble("x", bounds.x) - putDouble("y", bounds.y) - putDouble("centerX", bounds.centerX) - putDouble("centerY", bounds.centerY) - putDouble("width", bounds.width) - putDouble("height", bounds.height) - putDouble("top", bounds.top) - putDouble("left", bounds.left) - putDouble("bottom", bounds.bottom) - putDouble("right", bounds.right) - } - - private fun toCornersArray(corners: List): WritableNativeArray = - WritableNativeArray().apply { - corners.forEach { corner -> - pushMap( - WritableNativeMap().apply { - putDouble("x", corner.x) - putDouble("y", corner.y) - }, - ) - } - } - - private fun toByteArray(bytes: List): WritableNativeArray = - WritableNativeArray().apply { - bytes.forEach { byteValue -> pushInt(byteValue) } - } - - private fun toParsedValueMap(value: BarcodeParsedValue): WritableNativeMap = - WritableNativeMap().apply { - putString("type", value.type) - putMap("data", toDynamicMap(value.data)) - } - - private fun toDynamicMap(map: Map): WritableNativeMap = - WritableNativeMap().apply { - map.forEach { (key, value) -> - putDynamic(this, key, value) - } - } - - private fun toDynamicArray(list: List): WritableNativeArray = - WritableNativeArray().apply { - list.forEach { value -> pushDynamic(this, value) } - } - - private fun putDynamic( - target: WritableNativeMap, - key: String, - value: Any?, - ) { - when (value) { - null -> { - target.putNull(key) - } - - is String -> { - target.putString(key, value) - } - - is Boolean -> { - target.putBoolean(key, value) - } - - is Int -> { - target.putInt(key, value) - } - - is Long -> { - target.putDouble(key, value.toDouble()) - } - - is Float -> { - target.putDouble(key, value.toDouble()) - } - - is Double -> { - target.putDouble(key, value) - } - - is Map<*, *> -> { - @Suppress("UNCHECKED_CAST") - target.putMap(key, toDynamicMap(value as Map)) - } - - is List<*> -> { - @Suppress("UNCHECKED_CAST") - target.putArray(key, toDynamicArray(value)) - } - - else -> { - target.putString(key, value.toString()) - } - } - } - - private fun pushDynamic( - target: WritableNativeArray, - value: Any?, - ) { - when (value) { - null -> { - target.pushNull() - } - - is String -> { - target.pushString(value) - } - - is Boolean -> { - target.pushBoolean(value) - } - - is Int -> { - target.pushInt(value) - } - - is Long -> { - target.pushDouble(value.toDouble()) - } - - is Float -> { - target.pushDouble(value.toDouble()) - } - - is Double -> { - target.pushDouble(value) - } - - is Map<*, *> -> { - @Suppress("UNCHECKED_CAST") - target.pushMap(toDynamicMap(value as Map)) - } - - is List<*> -> { - @Suppress("UNCHECKED_CAST") - target.pushArray(toDynamicArray(value)) - } - - else -> { - target.pushString(value.toString()) - } - } - } -} diff --git a/android/src/main/java/com/visioncameramlkit/infrastructure/serializers/TextRecognitionSerializer.kt b/android/src/main/java/com/visioncameramlkit/infrastructure/serializers/TextRecognitionSerializer.kt deleted file mode 100644 index 292c30d..0000000 --- a/android/src/main/java/com/visioncameramlkit/infrastructure/serializers/TextRecognitionSerializer.kt +++ /dev/null @@ -1,116 +0,0 @@ -package com.visioncameramlkit.infrastructure.serializers - -import com.facebook.react.bridge.WritableNativeArray -import com.facebook.react.bridge.WritableNativeMap -import com.visioncameramlkit.domain.models.BoundingBox -import com.visioncameramlkit.domain.models.Corner -import com.visioncameramlkit.domain.models.TextBlock -import com.visioncameramlkit.domain.models.TextElement -import com.visioncameramlkit.domain.models.TextLine -import com.visioncameramlkit.domain.models.TextRecognitionResult -import com.visioncameramlkit.domain.models.TextSymbol - -@Suppress("TooManyFunctions") -object TextRecognitionSerializer { - fun toWritableMap(result: TextRecognitionResult): WritableNativeMap = - WritableNativeMap().apply { - putString("text", result.text) - putArray("blocks", toBlocksArray(result.blocks)) - } - - fun toReactNativeMap(result: TextRecognitionResult): HashMap { - @Suppress("UNCHECKED_CAST") - return toWritableMap(result).toHashMap() as HashMap - } - - private fun toBlocksArray(blocks: List): WritableNativeArray = - WritableNativeArray().apply { - blocks.forEach { block -> pushMap(toBlockMap(block)) } - } - - private fun toBlockMap(block: TextBlock): WritableNativeMap = - WritableNativeMap().apply { - putString("text", block.text) - block.bounds?.let { putMap("bounds", toBoundsMap(it)) } - block.corners?.let { putArray("corners", toCornersArray(it)) } - putArray("lines", toLinesArray(block.lines)) - putArray("languages", toLanguagesArray(block.languages)) - } - - private fun toLinesArray(lines: List): WritableNativeArray = - WritableNativeArray().apply { - lines.forEach { line -> pushMap(toLineMap(line)) } - } - - private fun toLineMap(line: TextLine): WritableNativeMap = - WritableNativeMap().apply { - putString("text", line.text) - line.bounds?.let { putMap("bounds", toBoundsMap(it)) } - line.corners?.let { putArray("corners", toCornersArray(it)) } - putArray("elements", toElementsArray(line.elements)) - line.confidence?.let { putDouble("confidence", it) } - line.angle?.let { putDouble("angle", it) } - putArray("languages", toLanguagesArray(line.languages)) - } - - private fun toElementsArray(elements: List): WritableNativeArray = - WritableNativeArray().apply { - elements.forEach { element -> pushMap(toElementMap(element)) } - } - - private fun toElementMap(element: TextElement): WritableNativeMap = - WritableNativeMap().apply { - putString("text", element.text) - element.bounds?.let { putMap("bounds", toBoundsMap(it)) } - element.corners?.let { putArray("corners", toCornersArray(it)) } - putArray("symbols", toSymbolsArray(element.symbols)) - element.confidence?.let { putDouble("confidence", it) } - element.angle?.let { putDouble("angle", it) } - putArray("languages", toLanguagesArray(element.languages)) - } - - private fun toSymbolsArray(symbols: List): WritableNativeArray = - WritableNativeArray().apply { - symbols.forEach { symbol -> pushMap(toSymbolMap(symbol)) } - } - - private fun toSymbolMap(symbol: TextSymbol): WritableNativeMap = - WritableNativeMap().apply { - putString("text", symbol.text) - symbol.bounds?.let { putMap("bounds", toBoundsMap(it)) } - symbol.corners?.let { putArray("corners", toCornersArray(it)) } - symbol.confidence?.let { putDouble("confidence", it) } - symbol.angle?.let { putDouble("angle", it) } - putArray("languages", toLanguagesArray(symbol.languages)) - } - - private fun toBoundsMap(bounds: BoundingBox): WritableNativeMap = - WritableNativeMap().apply { - putDouble("x", bounds.x) - putDouble("y", bounds.y) - putDouble("centerX", bounds.centerX) - putDouble("centerY", bounds.centerY) - putDouble("width", bounds.width) - putDouble("height", bounds.height) - putDouble("top", bounds.top) - putDouble("left", bounds.left) - putDouble("bottom", bounds.bottom) - putDouble("right", bounds.right) - } - - private fun toCornersArray(corners: List): WritableNativeArray = - WritableNativeArray().apply { - corners.forEach { corner -> pushMap(toCornerMap(corner)) } - } - - private fun toCornerMap(corner: Corner): WritableNativeMap = - WritableNativeMap().apply { - putDouble("x", corner.x) - putDouble("y", corner.y) - } - - private fun toLanguagesArray(languages: List): WritableNativeArray = - WritableNativeArray().apply { - languages.forEach { pushString(it) } - } -} diff --git a/docs/barcode-scanning.md b/docs/barcode-scanning.md index 7e1d5b2..c45496f 100644 --- a/docs/barcode-scanning.md +++ b/docs/barcode-scanning.md @@ -2,9 +2,13 @@ This page documents the Barcode Scanning API in more detail than the README quick-start. +Barcode scanning is implemented by configured Nitro recognizers for both live +frames and static images. + ## Imports ```ts +import { useFrameOutput } from 'react-native-vision-camera'; import { useBarcodeScanning, processImageBarcodeScanning, @@ -51,7 +55,7 @@ const frameOutput = useFrameOutput({ - `scaleFactor?: number` (`0.9`-`1.0`) - `invertColors?: boolean` - `roi?: RegionOfInterest` (crop processing to a rectangle of the frame; see the [Region of Interest](../README.md#region-of-interest) section in the main README) -- `frameProcessInterval?: number` (deprecated; throttle frames manually inside `onFrame` instead) +- `frameProcessInterval?: number` (deprecated compatibility field; v2 does not use it to throttle processing) ### Frame arguments @@ -59,7 +63,8 @@ const frameOutput = useFrameOutput({ ## Static Image Processing -Use `processImageBarcodeScanning(uri, options)` for gallery files / local images. +Use `processImageBarcodeScanning(uri, options)` for local images. Each call +creates a Nitro scanner with `options` and runs recognition asynchronously. ```ts const result = await processImageBarcodeScanning(imageUri, { @@ -75,11 +80,18 @@ const result = await processImageBarcodeScanning(imageUri, { - `formats?: BarcodeFormat[]` - `enableAllPotentialBarcodes?: boolean` (Android only) -- `orientation?: 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right'` +- `orientation?: 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right'` (overrides EXIF orientation; omit it to use image metadata) - `invertColors?: boolean` - `scaleFactor?: number` (`0.9`-`1.0`) - `roi?: RegionOfInterest` (crop processing to a rectangle of the image; see the [Region of Interest](../README.md#region-of-interest) section in the main README) +Static images must be local and readable. iOS accepts an absolute path or a +`file://` URI. Android also accepts `content://` URIs, which are copied to a +temporary cache file. Remote URLs and platform-library schemes such as +`ph://` are not supported. Static processing does not require Worklets or a +camera, but VisionCamera v5 and Nitro Modules remain native package +dependencies. + ## Supported formats - `ALL_FORMATS` @@ -129,17 +141,24 @@ Use `switch (barcode.value?.type)` for strong type inference in TypeScript. ## Errors -For static image processing, promise rejections can use: +Static Nitro calls reject invalid schemes, missing or unreadable files, and +images the platform decoder cannot read. The package exports these +compatibility error-message constants: - `IMAGE_NOT_FOUND_ERROR` - `INVALID_URI_ERROR` - `IMAGE_PROCESSING_FAILED_ERROR` - `UNSUPPORTED_IMAGE_FORMAT_ERROR` +These constants are retained for source compatibility and user-facing fallback +messages. Nitro rejection messages are platform-specific and are not guaranteed +to equal these strings; do not branch on `error.message`. + ## Performance guidance - Filter `formats` whenever possible for better performance. -- Always call `frame.dispose()` exactly once per frame inside `onFrame`. -- Throttle by skipping frames manually inside `onFrame` instead of relying on - a native-side interval. +- Always call `frame.dispose()` exactly once for every frame, including frames + you skip; keep disposal in a `finally` block around the whole callback. +- `frameProcessInterval` has no throttling effect in v2. Decide whether to call + the scanner inside `onFrame`, while still disposing every frame. - Keep `scaleFactor` as high as possible for decoding reliability. diff --git a/docs/migration-v1-to-v2.md b/docs/migration-v1-to-v2.md new file mode 100644 index 0000000..f1100f7 --- /dev/null +++ b/docs/migration-v1-to-v2.md @@ -0,0 +1,72 @@ +# Migrating from v1 to v2 + +v2 moves the library to React Native 0.86, VisionCamera v5 frame outputs, and +Nitro Modules. It supports iOS 15.1+ and Android SDK 24+. VisionCamera v4 users +must remain on a v1 tag until their camera integration can move to v5. + +## Dependency changes + +Install the v2 native dependencies: + +```sh +npm install react-native-vision-camera-mlkit@^2 \ + react-native-vision-camera@^5 \ + react-native-nitro-modules +cd ios && pod install +``` + +Live-frame recognition also needs VisionCamera's frame-output Worklets +dependencies: + +```sh +npm install react-native-vision-camera-worklets react-native-worklets +``` + +Configure `react-native-worklets/plugin` in `babel.config.js`. Remove the v1 +`react-native-worklets-core` dependency and Babel plugin if nothing else in +your app uses them. Static-image APIs do not need Worklets or a camera, but the +package still requires VisionCamera v5 and Nitro Modules at build time. + +## Live-frame API changes + +Replace the v1 `useFrameProcessor` integration with VisionCamera v5's +`useFrameOutput`. Call `textRecognition(frame, args)` or +`barcodeScanning(frame, args)` directly in its `onFrame` worklet. + +- Remove `runAsync(frame, ...)` and `runAtTargetFps(...)`; those v1 patterns do + not belong to the v5 frame-output API. +- Dispose every delivered frame exactly once, including skipped or failed + frames. Put `frame.dispose()` in a `finally` block around the whole callback. +- Remove `frameProcessInterval`. It remains in the type for compatibility but + has no throttling effect in the v2 Nitro recognizers. Make the call/skip + decision inside `onFrame` and dispose either way. +- Continue passing `outputOrientation` for iOS live frames when required. + +See the complete [text recognition](text-recognition.md) and +[barcode scanning](barcode-scanning.md) examples. + +## Static-image behavior + +The public functions remain `processImageTextRecognition(uri, options)` and +`processImageBarcodeScanning(uri, options)`, but v2 runs them through configured +Nitro recognizers. The supplied language, formats, orientation, scale, color +inversion, and ROI options configure that recognizer. + +Only local, readable images are accepted. iOS supports absolute paths and +`file://` URIs. Android additionally supports `content://` URIs. Remote URLs +and platform-library schemes such as `ph://` are not supported. Omit +`orientation` to use EXIF metadata; pass it only to override missing or wrong +metadata. + +## Feature availability + +v2 implements text recognition and barcode scanning. Both are enabled by +default, including all OCR language models. Other ML Kit feature keys are +reserved, disabled roadmap configuration and do not expose public APIs in v2. + +## v1 maintenance + +Published v1 tags remain available for applications that still use +VisionCamera v4, but v1 is not the active development line. The project does +not currently publish a security or critical-fix support guarantee for v1; +plan to migrate to v2 rather than relying on future v1 releases. diff --git a/docs/text-recognition.md b/docs/text-recognition.md index aa76c77..9ad9b51 100644 --- a/docs/text-recognition.md +++ b/docs/text-recognition.md @@ -2,9 +2,13 @@ This page documents the Text Recognition API in more detail than the README quick-start. +Text recognition is implemented by configured Nitro recognizers for both live +frames and static images. + ## Imports ```ts +import { useFrameOutput } from 'react-native-vision-camera'; import { useTextRecognition, processImageTextRecognition, @@ -49,7 +53,7 @@ const frameOutput = useFrameOutput({ - `scaleFactor?: number` (`0.9`-`1.0`) - `invertColors?: boolean` - `roi?: RegionOfInterest` (crop processing to a rectangle of the frame; see the [Region of Interest](../README.md#region-of-interest) section in the main README) -- `frameProcessInterval?: number` (deprecated; throttle frames manually inside `onFrame` instead) +- `frameProcessInterval?: number` (deprecated compatibility field; v2 does not use it to throttle processing) ### Frame arguments @@ -57,7 +61,8 @@ const frameOutput = useFrameOutput({ ## Static Image Processing -Use `processImageTextRecognition(uri, options)` for gallery files / local images. +Use `processImageTextRecognition(uri, options)` for local images. Each call +creates a Nitro recognizer with `options` and runs recognition asynchronously. ```ts const result = await processImageTextRecognition(imageUri, { @@ -71,11 +76,18 @@ const result = await processImageTextRecognition(imageUri, { ### Image options - `language?: 'LATIN' | 'CHINESE' | 'DEVANAGARI' | 'JAPANESE' | 'KOREAN'` -- `orientation?: 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right'` +- `orientation?: 'portrait' | 'portrait-upside-down' | 'landscape-left' | 'landscape-right'` (overrides EXIF orientation; omit it to use image metadata) - `invertColors?: boolean` - `scaleFactor?: number` (`0.9`-`1.0`) - `roi?: RegionOfInterest` (crop processing to a rectangle of the image; see the [Region of Interest](../README.md#region-of-interest) section in the main README) +Static images must be local and readable. iOS accepts an absolute path or a +`file://` URI. Android also accepts `content://` URIs, which are copied to a +temporary cache file. Remote URLs and platform-library schemes such as +`ph://` are not supported. Static processing does not require Worklets or a +camera, but VisionCamera v5 and Nitro Modules remain native package +dependencies. + ## Result shape `TextRecognitionResult` is a nested hierarchy: text → blocks → lines → elements @@ -101,16 +113,23 @@ Android rotation is handled automatically. ## Errors -For static image processing, promise rejections can use: +Static Nitro calls reject invalid schemes, missing or unreadable files, and +images the platform decoder cannot read. The package exports these +compatibility error-message constants: - `IMAGE_NOT_FOUND_ERROR` - `INVALID_URI_ERROR` - `IMAGE_PROCESSING_FAILED_ERROR` - `UNSUPPORTED_IMAGE_FORMAT_ERROR` +These constants are retained for source compatibility and user-facing fallback +messages. Nitro rejection messages are platform-specific and are not guaranteed +to equal these strings; do not branch on `error.message`. + ## Performance guidance -- Always call `frame.dispose()` exactly once per frame inside `onFrame`. -- Throttle by skipping frames manually inside `onFrame` instead of relying on - a native-side interval. +- Always call `frame.dispose()` exactly once for every frame, including frames + you skip; keep disposal in a `finally` block around the whole callback. +- `frameProcessInterval` has no throttling effect in v2. Decide whether to call + the recognizer inside `onFrame`, while still disposing every frame. - Keep `scaleFactor` as high as possible for OCR accuracy. diff --git a/example/Gemfile.lock b/example/Gemfile.lock index bc2bd1b..1f89b08 100644 --- a/example/Gemfile.lock +++ b/example/Gemfile.lock @@ -121,4 +121,4 @@ RUBY VERSION ruby 2.7.4p191 BUNDLED WITH - 2.1.4 + 4.0.17 diff --git a/example/android/build.gradle b/example/android/build.gradle index 2f2de8a..04c24b3 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,5 +1,8 @@ buildscript { ext { + def v2FeaturesEnabled = + !Boolean.parseBoolean(System.getenv("VISION_CAMERA_MLKIT_DISABLE_V2_FEATURES")) + buildToolsVersion = "36.0.0" minSdkVersion = 24 compileSdkVersion = 36 @@ -9,11 +12,11 @@ buildscript { set('react-native-vision-camera-mlkit', [ mlkit: [ - textRecognition : true, - textRecognitionChinese : true, - textRecognitionDevanagari: true, - textRecognitionJapanese : true, - textRecognitionKorean : true, + textRecognition : v2FeaturesEnabled, + textRecognitionChinese : v2FeaturesEnabled, + textRecognitionDevanagari: v2FeaturesEnabled, + textRecognitionJapanese : v2FeaturesEnabled, + textRecognitionKorean : v2FeaturesEnabled, faceDetection : false, faceMeshDetection : false, poseDetection : false, @@ -21,7 +24,7 @@ buildscript { selfieSegmentation : false, subjectSegmentation : false, documentScanner : false, - barcodeScanning : true, + barcodeScanning : v2FeaturesEnabled, imageLabeling : false, objectDetection : false, digitalInkRecognition : false, diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 3570963..dbdeaca 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1605,7 +1605,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - react-native-safe-area-context (5.6.2): + - react-native-safe-area-context (5.8.0): - hermes-engine - RCTRequired - RCTTypeSafety @@ -1617,8 +1617,8 @@ PODS: - React-graphics - React-ImageManager - React-jsi - - react-native-safe-area-context/common (= 5.6.2) - - react-native-safe-area-context/fabric (= 5.6.2) + - react-native-safe-area-context/common (= 5.8.0) + - react-native-safe-area-context/fabric (= 5.8.0) - React-NativeModulesApple - React-RCTFabric - React-renderercss @@ -1629,7 +1629,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - react-native-safe-area-context/common (5.6.2): + - react-native-safe-area-context/common (5.8.0): - hermes-engine - RCTRequired - RCTTypeSafety @@ -1651,7 +1651,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - react-native-safe-area-context/fabric (5.6.2): + - react-native-safe-area-context/fabric (5.8.0): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2138,7 +2138,7 @@ PODS: - ReactNativeDependencies - Yoga - ReactNativeDependencies (0.86.0) - - RNGestureHandler (3.0.2): + - RNGestureHandler (3.1.0): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2160,7 +2160,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - RNPermissions (5.4.4): + - RNPermissions (5.6.1): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2182,7 +2182,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - RNReanimated (4.5.1): + - RNReanimated (4.5.3): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2204,12 +2204,12 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - ReactNativeDependencies - - RNReanimated/apple (= 4.5.1) - - RNReanimated/common (= 4.5.1) - - RNReanimated/view (= 4.5.1) + - RNReanimated/apple (= 4.5.3) + - RNReanimated/common (= 4.5.3) + - RNReanimated/view (= 4.5.3) - RNWorklets - Yoga - - RNReanimated/apple (4.5.1): + - RNReanimated/apple (4.5.3): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2233,7 +2233,7 @@ PODS: - ReactNativeDependencies - RNWorklets - Yoga - - RNReanimated/common (4.5.1): + - RNReanimated/common (4.5.3): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2257,7 +2257,7 @@ PODS: - ReactNativeDependencies - RNWorklets - Yoga - - RNReanimated/view (4.5.1): + - RNReanimated/view (4.5.3): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2281,7 +2281,7 @@ PODS: - ReactNativeDependencies - RNWorklets - Yoga - - RNScreens (4.26.0): + - RNScreens (4.26.2): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2303,9 +2303,9 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - ReactNativeDependencies - - RNScreens/common (= 4.26.0) + - RNScreens/common (= 4.26.2) - Yoga - - RNScreens/common (4.26.0): + - RNScreens/common (4.26.2): - hermes-engine - RCTRequired - RCTTypeSafety @@ -2444,7 +2444,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - VisionCamera (5.1.0): + - VisionCamera (5.2.1): - hermes-engine - NitroImage - NitroModules @@ -2499,7 +2499,7 @@ PODS: - ReactNativeDependencies - VisionCamera - Yoga - - VisionCameraWorklets (5.1.0): + - VisionCameraWorklets (5.2.1): - hermes-engine - NitroModules - RCTRequired @@ -2889,7 +2889,7 @@ SPEC CHECKSUMS: React-mutationobservernativemodule: 2e568e13c98bd185fe83266795233fa7ad2cbc19 react-native-blur: baf5874b4abf3bb8b2012172a3d0905653a1a2b5 react-native-image-picker: 2146157d5d37a34c2063d1d2ed01081b56d0b87b - react-native-safe-area-context: 3cd1f988c96f187e15b49b86b0a2068a6cb19393 + react-native-safe-area-context: c1eb308f4b36372a4de4b3bdaa8ed695ec3dd461 react-native-slider: 73473ab537b86b7ca1b21a28d16019d3cb63e927 React-NativeModulesApple: a4713821c9caae40ae33eef933a6e692a6f4a81d React-networking: b344a1a41a4729ef859123b7a234f3092761cb25 @@ -2927,15 +2927,15 @@ SPEC CHECKSUMS: ReactCommon: 4d01bfb533b93a2103329dfefc74db6a9e272888 ReactNativeBottomSheet: 3551d418c1d10cd49e0907d68300374544fb8d00 ReactNativeDependencies: fa0a54b3f5319ae0e3b9aff32bfee7a424b88e66 - RNGestureHandler: ef19613372e4c87374fe9494862e366d82d1852c - RNPermissions: 38d9cf58be74d148123c93d0e0713092e8e59260 - RNReanimated: 516d842d105966ae05a6a1ad7ad2a0dc1e968d6b - RNScreens: 37cece0483decca1c3300bb1c2225c798039b8fc + RNGestureHandler: 6206fc566272f60a2d57a0b3258c495a73b7dc90 + RNPermissions: 509028712d9e899fcce678c315989a6d439b003c + RNReanimated: 5cc36a25f9e60c523734a60783f84d363e73b4dc + RNScreens: dcd5c85a822d9cbb21fc321bbbbcf918f3d48c23 RNSVG: ffe18ba0e8fbad864bf22d6f0060a4ee88ec9bf3 RNWorklets: 82a5f27dcf3bb69267ec6ce662a756a4d3f61522 - VisionCamera: 73a21a8ed0feecd7c579d79ae25eaf8c3e63c767 - VisionCameraMLKit: c85a989fbaae33532636fdf9cab21b287ddf8a3f - VisionCameraWorklets: 0f70d789dfce3d2efc67db7e106e2f4a32bbe72e + VisionCamera: 4e3e123f4d14c7d3934748c84fe6ddfa5046c5ee + VisionCameraMLKit: 08f7f64b2794cde438ca7ab82a4d904d52d44dd3 + VisionCameraWorklets: 0d8b34820c6aa351fbba9fab3d8ee8e8d98e1990 Yoga: 94172d87dd5d83fc929bf1ee53121b5d4490b5f2 PODFILE CHECKSUM: bfa9c28a161369f7b66f55890deec95fe59f1504 diff --git a/example/package.json b/example/package.json index 04adc3d..adeacbd 100644 --- a/example/package.json +++ b/example/package.json @@ -7,7 +7,7 @@ "ios": "react-native run-ios", "start": "react-native start", "build:android": "react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"", - "build:ios": "react-native build-ios --mode Debug --destination \"${IOS_DESTINATION:-generic/platform=iOS Simulator}\"" + "build:ios": "react-native build-ios --mode Debug --destination \"${IOS_DESTINATION:-OS=latest,name=iPhone 15}\"" }, "dependencies": { "@react-native-community/blur": "^4.4.1", diff --git a/example/react-native.config.js b/example/react-native.config.js index 59d9698..0b9606d 100644 --- a/example/react-native.config.js +++ b/example/react-native.config.js @@ -10,12 +10,6 @@ module.exports = { dependencies: { [pkg.name]: { root: path.join(__dirname, '..'), - platforms: { - // Codegen script incorrectly fails without this - // So we explicitly specify the platforms with empty object - ios: {}, - android: {}, - }, }, }, }; diff --git a/ios/Application/UseCases/RecognizeBarcodesUseCase.swift b/ios/Application/UseCases/RecognizeBarcodesUseCase.swift deleted file mode 100644 index 4a07b3d..0000000 --- a/ios/Application/UseCases/RecognizeBarcodesUseCase.swift +++ /dev/null @@ -1,81 +0,0 @@ -import Foundation - -#if MLKIT_BARCODE_SCANNING - #if canImport(VisionCamera) - import VisionCamera - - class RecognizeBarcodesUseCase { - private let imagePreprocessor: IImagePreprocessor - private let recognitionService: MLKitBarcodeScanningService - - init( - imagePreprocessor: IImagePreprocessor, - recognitionService: MLKitBarcodeScanningService - ) { - self.imagePreprocessor = imagePreprocessor - self.recognitionService = recognitionService - } - - func execute(frame: any HybridFrameSpec, options: BarcodeScanningOptions) throws - -> BarcodeScanningResult - { - return try autoreleasepool { - let preprocessingOptions = ImagePreprocessingOptions( - invertColors: options.invertColors, - outputOrientation: options.outputOrientation, - scaleFactor: options.scaleFactor - ) - - guard - let processedImage = imagePreprocessor.preprocessFrame( - frame: frame, - options: preprocessingOptions - ) - else { - throw NSError( - domain: "RecognizeBarcodesUseCase", - code: -1, - userInfo: [NSLocalizedDescriptionKey: "Failed to preprocess image"] - ) - } - - let result = try recognitionService.recognize(image: processedImage) - return result.remapped(using: processedImage.metadata) - } - } - - func execute( - imageFile: URL, - imageOptions: ImagePreprocessingOptions, - barcodeOptions: BarcodeScanningOptions - ) throws -> BarcodeScanningResult { - return try autoreleasepool { - let preprocessingOptions = ImagePreprocessingOptions( - invertColors: imageOptions.invertColors, - outputOrientation: imageOptions.outputOrientation, - scaleFactor: imageOptions.scaleFactor, - orientation: imageOptions.orientation, - roi: imageOptions.roi - ) - - guard - let processedImage = imagePreprocessor.preprocessImage( - imageFile: imageFile, - options: preprocessingOptions - ) - else { - throw NSError( - domain: "RecognizeBarcodesUseCase", - code: -1, - userInfo: [NSLocalizedDescriptionKey: "Failed to preprocess image"] - ) - } - - _ = barcodeOptions - let result = try recognitionService.recognize(image: processedImage) - return result.remapped(using: processedImage.metadata) - } - } - } - #endif -#endif // MLKIT_BARCODE_SCANNING diff --git a/ios/Application/UseCases/RecognizeTextUseCase.swift b/ios/Application/UseCases/RecognizeTextUseCase.swift deleted file mode 100644 index 2f4cafc..0000000 --- a/ios/Application/UseCases/RecognizeTextUseCase.swift +++ /dev/null @@ -1,76 +0,0 @@ -import Foundation - -#if MLKIT_TEXT_RECOGNITION_ANY - #if canImport(VisionCamera) - import VisionCamera - - class RecognizeTextUseCase { - private let imagePreprocessor: IImagePreprocessor - private let recognitionService: MLKitTextRecognitionService - - init( - imagePreprocessor: IImagePreprocessor, - recognitionService: MLKitTextRecognitionService - ) { - self.imagePreprocessor = imagePreprocessor - self.recognitionService = recognitionService - } - - func execute(frame: any HybridFrameSpec, options: TextRecognitionOptions) throws - -> DomainTextRecognitionResult - { - // autoreleasepool at frame boundary to drain autoreleased Obj-C objects - // after each frame is processed, preventing buildup across multiple frames - return try autoreleasepool { - let preprocessingOptions = ImagePreprocessingOptions( - invertColors: options.invertColors, - outputOrientation: options.outputOrientation, - scaleFactor: options.scaleFactor - ) - - guard - let processedImage = imagePreprocessor.preprocessFrame( - frame: frame, - options: preprocessingOptions - ) - else { - throw NSError( - domain: "RecognizeTextUseCase", - code: -1, - userInfo: [NSLocalizedDescriptionKey: "Failed to preprocess image"] - ) - } - - let result = try recognitionService.recognize(image: processedImage) - return result.remapped(using: processedImage.metadata) - } - } - - func execute( - imageFile: URL, - imageOptions: ImagePreprocessingOptions, - textOptions: TextRecognitionOptions - ) throws -> DomainTextRecognitionResult { - // autoreleasepool here ensures predictable memory cleanup, - // especially if this method is called repeatedly or in batches - return try autoreleasepool { - guard - let processedImage = imagePreprocessor.preprocessImage( - imageFile: imageFile, - options: imageOptions - ) - else { - throw NSError( - domain: "RecognizeTextUseCase", - code: -1, - userInfo: [NSLocalizedDescriptionKey: "Failed to preprocess image"] - ) - } - - let result = try recognitionService.recognize(image: processedImage) - return result.remapped(using: processedImage.metadata) - } - } - } - #endif -#endif // MLKIT_TEXT_RECOGNITION_ANY diff --git a/ios/Bridge/Constants/MLKitFeatureKeys.swift b/ios/Bridge/Constants/MLKitFeatureKeys.swift deleted file mode 100644 index 912f061..0000000 --- a/ios/Bridge/Constants/MLKitFeatureKeys.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation - -enum MLKitFeatureKeys { - static let TEXT_RECOGNITION = "TextRecognition" - static let FACE_DETECTION = "FaceDetection" - static let FACE_MESH_DETECTION = "FaceMeshDetection" - static let POSE_DETECTION = "PoseDetection" - static let SELFIE_SEGMENTATION = "SelfieSegmentation" - static let SUBJECT_SEGMENTATION = "SubjectSegmentation" - static let DOCUMENT_SCANNER = "DocumentScanner" - static let BARCODE_SCANNING = "BarcodeScanning" - static let IMAGE_LABELING = "ImageLabeling" - static let OBJECT_DETECTION = "ObjectDetection" - static let DIGITAL_INK_RECOGNITION = "DigitalInkRecognition" -} diff --git a/ios/Bridge/Handlers/IStaticImageHandler.swift b/ios/Bridge/Handlers/IStaticImageHandler.swift deleted file mode 100644 index de5ee0d..0000000 --- a/ios/Bridge/Handlers/IStaticImageHandler.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Foundation - -typealias PromiseResolver = (Any?) -> Void -typealias PromiseRejecter = (String, String, Error?) -> Void - -protocol IStaticImageHandler { - func process( - path: String, - options: [String: Any], - resolver: @escaping PromiseResolver, - rejecter: @escaping PromiseRejecter - ) -} diff --git a/ios/Bridge/Handlers/StaticBarcodeScanningHandler.swift b/ios/Bridge/Handlers/StaticBarcodeScanningHandler.swift deleted file mode 100644 index 218ae19..0000000 --- a/ios/Bridge/Handlers/StaticBarcodeScanningHandler.swift +++ /dev/null @@ -1,150 +0,0 @@ -import Foundation - -#if MLKIT_BARCODE_SCANNING - class StaticBarcodeScanningHandler: IStaticImageHandler { - private var cachedUseCases: [String: RecognizeBarcodesUseCase] = [:] - - private func getRecognizeBarcodesUseCase(for options: BarcodeScanningOptions) - -> RecognizeBarcodesUseCase - { - let key = - "\(options.enableAllPotentialBarcodes)|\(options.formats.map(\.rawValue).joined(separator: ","))" - - if let useCase = cachedUseCases[key] { - return useCase - } - - let newUseCase = RecognizeBarcodesUseCase( - imagePreprocessor: ImagePreprocessor(), - recognitionService: BarcodeScanningServiceFactory.create(options: options) - ) - cachedUseCases[key] = newUseCase - return newUseCase - } - - func process( - path: String, - options: [String: Any], - resolver: @escaping PromiseResolver, - rejecter: @escaping PromiseRejecter - ) { - Task { - do { - guard let fileURL = resolveFileURL(from: path) else { - rejecter( - "IMAGE_NOT_FOUND_ERROR", - "Unsupported image URI: \(path)", - nil - ) - return - } - - if fileURL.isFileURL - && !FileManager.default.fileExists(atPath: fileURL.path) - { - rejecter( - "IMAGE_NOT_FOUND_ERROR", - "Image file not found at path: \(path)", - nil - ) - return - } - - let imageOptions = parseImageOptions(options) - let barcodeOptions = parseBarcodeOptions(options) - let recognizeBarcodesUseCase = getRecognizeBarcodesUseCase(for: barcodeOptions) - - let result = try recognizeBarcodesUseCase.execute( - imageFile: fileURL, - imageOptions: imageOptions, - barcodeOptions: barcodeOptions - ) - - resolver(BarcodeScanningSerializer.toReactNativeMap(result)) - } catch { - switch error { - case let nsError as NSError: - if nsError.domain == NSCocoaErrorDomain - && nsError.code == NSFileReadNoSuchFileError - { - rejecter("IMAGE_NOT_FOUND_ERROR", "Image file not found", error) - } else { - rejecter( - "IMAGE_PROCESSING_FAILED_ERROR", - error.localizedDescription, - error - ) - } - default: - rejecter( - "IMAGE_PROCESSING_FAILED_ERROR", - error.localizedDescription, - error - ) - } - } - } - } - - private func parseImageOptions(_ options: [String: Any]) - -> ImagePreprocessingOptions - { - let invertColors = options["invertColors"] as? Bool ?? false - let orientation = (options["orientation"] as? String).flatMap { DomainOrientation(string: $0) } - let scaleFactor = CGFloat((options["scaleFactor"] as? NSNumber)?.doubleValue ?? 1.0) - let roi = parseRegionOfInterest(options["roi"]) - - return ImagePreprocessingOptions( - invertColors: invertColors, - scaleFactor: scaleFactor, - orientation: orientation, - roi: roi - ) - } - - private func parseRegionOfInterest(_ value: Any?) -> DomainRegionOfInterest? { - guard let dictionary = value as? [String: Any], - let x = (dictionary["x"] as? NSNumber)?.doubleValue, - let y = (dictionary["y"] as? NSNumber)?.doubleValue, - let width = (dictionary["width"] as? NSNumber)?.doubleValue, - let height = (dictionary["height"] as? NSNumber)?.doubleValue - else { - return nil - } - - let unit: DomainRegionOfInterestUnit = - (dictionary["unit"] as? String) == "pixel" ? .pixel : .normalized - - return DomainRegionOfInterest( - x: CGFloat(x), - y: CGFloat(y), - width: CGFloat(width), - height: CGFloat(height), - unit: unit - ) - } - - private func parseBarcodeOptions(_ options: [String: Any]) - -> BarcodeScanningOptions - { - return BarcodeScanningOptions( - formats: BarcodeScanningOptionParser.parseFormats(options["formats"]), - enableAllPotentialBarcodes: - BarcodeScanningOptionParser - .parseEnableAllPotentialBarcodes(options["enableAllPotentialBarcodes"]) - ) - } - - private func resolveFileURL(from path: String) -> URL? { - if path.hasPrefix("file://") { - return URL(string: path) - } - - if let url = URL(string: path), url.scheme != nil { - return url - } - - return URL(fileURLWithPath: path) - } - } -#endif // MLKIT_BARCODE_SCANNING diff --git a/ios/Bridge/Handlers/StaticTextRecognitionHandler.swift b/ios/Bridge/Handlers/StaticTextRecognitionHandler.swift deleted file mode 100644 index 3377065..0000000 --- a/ios/Bridge/Handlers/StaticTextRecognitionHandler.swift +++ /dev/null @@ -1,161 +0,0 @@ -import Foundation - -#if MLKIT_TEXT_RECOGNITION_ANY - class StaticTextRecognitionHandler: IStaticImageHandler { - private let textRecognitionSerializer = TextRecognitionSerializer() - private var cachedUseCase: RecognizeTextUseCase? - - private func getRecognizeTextUseCase(for language: DomainTextRecognitionLanguage) - -> RecognizeTextUseCase - { - if let useCase = cachedUseCase { - return useCase - } - let newUseCase = RecognizeTextUseCase( - imagePreprocessor: ImagePreprocessor(), - recognitionService: TextRecognitionServiceFactory.create( - language: language - ) - ) - cachedUseCase = newUseCase - return newUseCase - } - - func process( - path: String, - options: [String: Any], - resolver: @escaping PromiseResolver, - rejecter: @escaping PromiseRejecter - ) { - Task { - do { - guard let fileURL = resolveFileURL(from: path) else { - rejecter( - "IMAGE_NOT_FOUND_ERROR", - "Unsupported image URI: \(path)", - nil - ) - return - } - - if fileURL.isFileURL - && !FileManager.default.fileExists(atPath: fileURL.path) - { - rejecter( - "IMAGE_NOT_FOUND_ERROR", - "Image file not found at path: \(path)", - nil - ) - return - } - - let imageOptions = parseImageOptions(options) - - let languageString = options["language"] as? String ?? "LATIN" - let language = parseLanguage(languageString) - let textOptions = TextRecognitionOptions(language: language) - - let recognizeTextUseCase = getRecognizeTextUseCase(for: language) - - let result = try recognizeTextUseCase.execute( - imageFile: fileURL, - imageOptions: imageOptions, - textOptions: textOptions - ) - - let serializedResult = TextRecognitionSerializer.toReactNativeMap( - result - ) - - resolver(serializedResult) - } catch { - switch error { - case let nsError as NSError: - if nsError.domain == NSCocoaErrorDomain - && nsError.code == NSFileReadNoSuchFileError - { - rejecter("IMAGE_NOT_FOUND_ERROR", "Image file not found", error) - } else { - rejecter( - "IMAGE_PROCESSING_FAILED_ERROR", - error.localizedDescription, - error - ) - } - default: - rejecter( - "IMAGE_PROCESSING_FAILED_ERROR", - error.localizedDescription, - error - ) - } - } - } - } - - private func parseImageOptions(_ options: [String: Any]) - -> ImagePreprocessingOptions - { - let invertColors = options["invertColors"] as? Bool ?? false - let orientation = (options["orientation"] as? String).flatMap { DomainOrientation(string: $0) } - let roi = parseRegionOfInterest(options["roi"]) - - return ImagePreprocessingOptions( - invertColors: invertColors, - orientation: orientation, - roi: roi - ) - } - - private func parseRegionOfInterest(_ value: Any?) -> DomainRegionOfInterest? { - guard let dictionary = value as? [String: Any], - let x = (dictionary["x"] as? NSNumber)?.doubleValue, - let y = (dictionary["y"] as? NSNumber)?.doubleValue, - let width = (dictionary["width"] as? NSNumber)?.doubleValue, - let height = (dictionary["height"] as? NSNumber)?.doubleValue - else { - return nil - } - - let unit: DomainRegionOfInterestUnit = - (dictionary["unit"] as? String) == "pixel" ? .pixel : .normalized - - return DomainRegionOfInterest( - x: CGFloat(x), - y: CGFloat(y), - width: CGFloat(width), - height: CGFloat(height), - unit: unit - ) - } - - private func parseLanguage(_ language: String) -> DomainTextRecognitionLanguage { - switch language { - case "LATIN": - return .latin - case "CHINESE": - return .chinese - case "DEVANAGARI": - return .devanagari - case "JAPANESE": - return .japanese - case "KOREAN": - return .korean - default: - return .latin - } - } - - private func resolveFileURL(from path: String) -> URL? { - if path.hasPrefix("file://") { - return URL(string: path) - } - - if let url = URL(string: path), url.scheme != nil { - return url - } - - return URL(fileURLWithPath: path) - } - } -#endif // MLKIT_TEXT_RECOGNITION_ANY diff --git a/ios/Bridge/Hybrid/BarcodeParsedValue+toAnyMap.swift b/ios/Bridge/Hybrid/BarcodeParsedValue+toAnyMap.swift new file mode 100644 index 0000000..ed3ec08 --- /dev/null +++ b/ios/Bridge/Hybrid/BarcodeParsedValue+toAnyMap.swift @@ -0,0 +1,34 @@ +import Foundation +import NitroModules + +#if MLKIT_BARCODE_SCANNING + extension BarcodeParsedValue { + func toAnyMap() throws -> AnyMap { + let map = AnyMap(withPreallocatedSize: 2) + map.setString(key: "type", value: type) + map.setObject(key: "data", value: try data.mapValues { try toAnyValue($0) }) + return map + } + } + + private func toAnyValue(_ value: Any?) throws -> AnyValue { + switch value { + case nil, is NSNull: + return .null + case let value as Bool: + return .bool(value) + case let value as String: + return .string(value) + case let value as NSNumber: + return .number(value.doubleValue) + case let value as [Any?]: + return .array(try value.map { try toAnyValue($0) }) + case let value as [String: Any?]: + return .object(try value.mapValues { try toAnyValue($0) }) + default: + throw RuntimeError.error( + withMessage: "Barcode value contains an unsupported value: \(String(describing: value))" + ) + } + } +#endif diff --git a/ios/Bridge/Hybrid/BarcodeScannerOptions+toDomain.swift b/ios/Bridge/Hybrid/BarcodeScannerOptions+toDomain.swift index 371d095..f7f174f 100644 --- a/ios/Bridge/Hybrid/BarcodeScannerOptions+toDomain.swift +++ b/ios/Bridge/Hybrid/BarcodeScannerOptions+toDomain.swift @@ -14,6 +14,7 @@ extension BarcodeScannerOptions { return ImagePreprocessingOptions( invertColors: invertColors ?? false, scaleFactor: CGFloat(scaleFactor ?? 1.0), + orientation: orientation?.toDomainOrientation(), roi: roi?.toDomainRegionOfInterest() ) } diff --git a/ios/Bridge/Hybrid/BarcodeScanningResult+toNitro.swift b/ios/Bridge/Hybrid/BarcodeScanningResult+toNitro.swift index 1f7e49c..40fe015 100644 --- a/ios/Bridge/Hybrid/BarcodeScanningResult+toNitro.swift +++ b/ios/Bridge/Hybrid/BarcodeScanningResult+toNitro.swift @@ -1,24 +1,27 @@ -extension BarcodeScanningResult { - func toNitroResult() -> BarcodeScannerResult { - return BarcodeScannerResult( - barcodes: barcodes.map { $0.toNitroBarcode() } - ) +#if MLKIT_BARCODE_SCANNING + extension BarcodeScanningResult { + func toNitroResult() throws -> BarcodeScannerResult { + return BarcodeScannerResult( + barcodes: try barcodes.map { try $0.toNitroBarcode() } + ) + } } -} -private extension BarcodeData { - func toNitroBarcode() -> BarcodeScannerBarcode { - return BarcodeScannerBarcode( - bounds: bounds?.toNitroBoundingBox(), - corners: corners?.map { $0.toNitroCorner() }, - format: Double(format), - formatName: BarcodeFormat(fromString: formatName) ?? .unknown, - valueType: Double(valueType), - valueTypeName: BarcodeValueTypeName(fromString: valueTypeName) ?? .typeUnknown, - rawValue: rawValue, - displayValue: displayValue, - rawBytes: rawBytes?.map { Double($0) }, - isPotential: isPotential - ) + extension BarcodeData { + fileprivate func toNitroBarcode() throws -> BarcodeScannerBarcode { + return BarcodeScannerBarcode( + bounds: bounds?.toNitroBoundingBox(), + corners: corners?.map { $0.toNitroCorner() }, + format: Double(format), + formatName: BarcodeFormat(fromString: formatName) ?? .unknown, + valueType: Double(valueType), + valueTypeName: BarcodeValueTypeName(fromString: valueTypeName) ?? .typeUnknown, + rawValue: rawValue, + displayValue: displayValue, + rawBytes: rawBytes?.map { Double($0) }, + value: try value?.toAnyMap(), + isPotential: isPotential + ) + } } -} +#endif diff --git a/ios/Bridge/Hybrid/HybridBarcodeScanner.swift b/ios/Bridge/Hybrid/HybridBarcodeScanner.swift index 7f17eec..3dfb13c 100644 --- a/ios/Bridge/Hybrid/HybridBarcodeScanner.swift +++ b/ios/Bridge/Hybrid/HybridBarcodeScanner.swift @@ -4,11 +4,15 @@ import VisionCamera final class HybridBarcodeScanner: HybridBarcodeScannerSpec { private let options: BarcodeScannerOptions + private let recognitionQueue = DispatchQueue( + label: "com.visioncameramlkit.barcode-scanner" + ) #if MLKIT_BARCODE_SCANNING private let imagePreprocessor = ImagePreprocessor() private let barcodeOptions: BarcodeScanningOptions private let imageOptions: ImagePreprocessingOptions private let recognitionService: MLKitBarcodeScanningService + private let staticRecognitionService: MLKitBarcodeScanningService #endif init(options: BarcodeScannerOptions) { @@ -20,24 +24,58 @@ final class HybridBarcodeScanner: HybridBarcodeScannerSpec { self.recognitionService = BarcodeScanningServiceFactory.create( options: resolvedBarcodeOptions ) + self.staticRecognitionService = BarcodeScanningServiceFactory.create( + options: resolvedBarcodeOptions + ) #endif } - func recognize(frame: any HybridFrameSpec, args: MLKitBaseArguments?) throws -> BarcodeScannerResult { + func recognize(frame: any HybridFrameSpec, args: MLKitBaseArguments?) throws + -> BarcodeScannerResult + { #if MLKIT_BARCODE_SCANNING + let callImageOptions = imageOptions.withOutputOrientation( + args?.outputOrientation?.toOutputOrientation() + ) guard let processedImage = imagePreprocessor.preprocessFrame( frame: frame, - options: imageOptions + options: callImageOptions ) else { throw RuntimeError.error(withMessage: "Failed to preprocess VisionCamera frame.") } let result = try recognitionService.recognize(image: processedImage) - return result.remapped(using: processedImage.metadata).toNitroResult() + return try result.remapped(using: processedImage.metadata).toNitroResult() + #else + throw RuntimeError.error( + withMessage: "BarcodeScanning is not enabled in the native ML Kit configuration.") + #endif + } + + func recognizeImage(uri: String) throws -> Promise { + #if MLKIT_BARCODE_SCANNING + return Promise.parallel(recognitionQueue) { + let imageFile = try StaticImageURLResolver.resolve(uri) + guard + let processedImage = self.imagePreprocessor.preprocessImage( + imageFile: imageFile, + options: self.imageOptions + ) + else { + throw RuntimeError.error(withMessage: "Failed to preprocess static image: \(uri)") + } + + let result = try self.staticRecognitionService.recognize(image: processedImage) + return try result.remapped(using: processedImage.metadata).toNitroResult() + } #else - throw RuntimeError.error(withMessage: "BarcodeScanning is not enabled in the native ML Kit configuration.") + return Promise.rejected( + withError: RuntimeError.error( + withMessage: "BarcodeScanning is not enabled in the native ML Kit configuration." + ) + ) #endif } } diff --git a/ios/Bridge/Hybrid/HybridTextRecognizer.swift b/ios/Bridge/Hybrid/HybridTextRecognizer.swift index 75bff67..d9b42b0 100644 --- a/ios/Bridge/Hybrid/HybridTextRecognizer.swift +++ b/ios/Bridge/Hybrid/HybridTextRecognizer.swift @@ -4,11 +4,15 @@ import VisionCamera final class HybridTextRecognizer: HybridTextRecognizerSpec { private let options: TextRecognizerOptions + private let recognitionQueue = DispatchQueue( + label: "com.visioncameramlkit.text-recognizer" + ) #if MLKIT_TEXT_RECOGNITION_ANY private let imagePreprocessor = ImagePreprocessor() private let textOptions: TextRecognitionOptions private let imageOptions: ImagePreprocessingOptions private let recognitionService: MLKitTextRecognitionService + private let staticRecognitionService: MLKitTextRecognitionService #endif init(options: TextRecognizerOptions) { @@ -20,15 +24,23 @@ final class HybridTextRecognizer: HybridTextRecognizerSpec { self.recognitionService = TextRecognitionServiceFactory.create( language: resolvedTextOptions.language ) + self.staticRecognitionService = TextRecognitionServiceFactory.create( + language: resolvedTextOptions.language + ) #endif } - func recognize(frame: any HybridFrameSpec, args: MLKitBaseArguments?) throws -> TextRecognitionResult { + func recognize(frame: any HybridFrameSpec, args: MLKitBaseArguments?) throws + -> TextRecognitionResult + { #if MLKIT_TEXT_RECOGNITION_ANY + let callImageOptions = imageOptions.withOutputOrientation( + args?.outputOrientation?.toOutputOrientation() + ) guard let processedImage = imagePreprocessor.preprocessFrame( frame: frame, - options: imageOptions + options: callImageOptions ) else { throw RuntimeError.error(withMessage: "Failed to preprocess VisionCamera frame.") @@ -37,7 +49,33 @@ final class HybridTextRecognizer: HybridTextRecognizerSpec { let result = try recognitionService.recognize(image: processedImage) return result.remapped(using: processedImage.metadata).toNitroResult() #else - throw RuntimeError.error(withMessage: "TextRecognition is not enabled in the native ML Kit configuration.") + throw RuntimeError.error( + withMessage: "TextRecognition is not enabled in the native ML Kit configuration.") + #endif + } + + func recognizeImage(uri: String) throws -> Promise { + #if MLKIT_TEXT_RECOGNITION_ANY + return Promise.parallel(recognitionQueue) { + let imageFile = try StaticImageURLResolver.resolve(uri) + guard + let processedImage = self.imagePreprocessor.preprocessImage( + imageFile: imageFile, + options: self.imageOptions + ) + else { + throw RuntimeError.error(withMessage: "Failed to preprocess static image: \(uri)") + } + + let result = try self.staticRecognitionService.recognize(image: processedImage) + return result.remapped(using: processedImage.metadata).toNitroResult() + } + #else + return Promise.rejected( + withError: RuntimeError.error( + withMessage: "TextRecognition is not enabled in the native ML Kit configuration." + ) + ) #endif } } diff --git a/ios/Bridge/Hybrid/Orientation+toDomain.swift b/ios/Bridge/Hybrid/Orientation+toDomain.swift new file mode 100644 index 0000000..a750271 --- /dev/null +++ b/ios/Bridge/Hybrid/Orientation+toDomain.swift @@ -0,0 +1,19 @@ +extension Orientation { + func toDomainOrientation() -> DomainOrientation { + switch self { + case .portrait: return .portrait + case .portraitUpsideDown: return .portraitUpsideDown + case .landscapeLeft: return .landscapeLeft + case .landscapeRight: return .landscapeRight + } + } + + func toOutputOrientation() -> OutputOrientation { + switch self { + case .portrait: return .portrait + case .portraitUpsideDown: return .portraitUpsideDown + case .landscapeLeft: return .landscapeLeft + case .landscapeRight: return .landscapeRight + } + } +} diff --git a/ios/Bridge/Hybrid/TextRecognizerOptions+toDomain.swift b/ios/Bridge/Hybrid/TextRecognizerOptions+toDomain.swift index dfc3b86..3706487 100644 --- a/ios/Bridge/Hybrid/TextRecognizerOptions+toDomain.swift +++ b/ios/Bridge/Hybrid/TextRecognizerOptions+toDomain.swift @@ -13,6 +13,7 @@ extension TextRecognizerOptions { return ImagePreprocessingOptions( invertColors: invertColors ?? false, scaleFactor: CGFloat(scaleFactor ?? 1.0), + orientation: orientation?.toDomainOrientation(), roi: roi?.toDomainRegionOfInterest() ) } diff --git a/ios/Bridge/Parsers/BarcodeScanningOptionParser.swift b/ios/Bridge/Parsers/BarcodeScanningOptionParser.swift deleted file mode 100644 index 85a17aa..0000000 --- a/ios/Bridge/Parsers/BarcodeScanningOptionParser.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation - -#if MLKIT_BARCODE_SCANNING - enum BarcodeScanningOptionParser { - static func parseFormats(_ value: Any?) -> [BarcodeFormatOption] { - guard let items = value as? [Any] else { - return [] - } - return - items - .compactMap { $0 as? String } - .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) } - .compactMap { BarcodeFormatOption(rawValue: $0) } - } - - static func parseEnableAllPotentialBarcodes(_ value: Any?) -> Bool { - return value as? Bool ?? false - } - - } -#endif // MLKIT_BARCODE_SCANNING diff --git a/ios/Domain/Models/ImagePreprocessingOptions+withOutputOrientation.swift b/ios/Domain/Models/ImagePreprocessingOptions+withOutputOrientation.swift new file mode 100644 index 0000000..7639c93 --- /dev/null +++ b/ios/Domain/Models/ImagePreprocessingOptions+withOutputOrientation.swift @@ -0,0 +1,11 @@ +extension ImagePreprocessingOptions { + func withOutputOrientation(_ outputOrientation: OutputOrientation?) -> ImagePreprocessingOptions { + return ImagePreprocessingOptions( + invertColors: invertColors, + outputOrientation: outputOrientation, + scaleFactor: scaleFactor, + orientation: orientation, + roi: roi + ) + } +} diff --git a/ios/Domain/Models/StaticImageDecodePlan.swift b/ios/Domain/Models/StaticImageDecodePlan.swift new file mode 100644 index 0000000..f49d17f --- /dev/null +++ b/ios/Domain/Models/StaticImageDecodePlan.swift @@ -0,0 +1,80 @@ +import Foundation + +struct StaticImageDecodePlan: Equatable { + let sourceWidth: Int + let sourceHeight: Int + let outputWidth: Int + let outputHeight: Int + + var thumbnailMaxPixelSize: Int { + max(outputWidth, outputHeight) + } + + var outputPixelCount: Int { + outputWidth * outputHeight + } + + func sourceScaleFactor(decodedWidth: Int, decodedHeight: Int) -> Double { + Double(max(decodedWidth, decodedHeight)) + / Double(max(sourceWidth, sourceHeight)) + } + + static func make(sourceWidth: Int, sourceHeight: Int) -> StaticImageDecodePlan? { + guard + sourceWidth > 0, + sourceHeight > 0, + sourceWidth <= StaticImageLimits.maxSourceDimension, + sourceHeight <= StaticImageLimits.maxSourceDimension, + sourceWidth <= StaticImageLimits.maxSourcePixelCount / sourceHeight + else { + return nil + } + + let pixelScale = sqrt( + Double(StaticImageLimits.maxDecodedPixelCount) + / Double(sourceWidth * sourceHeight) + ) + let dimensionScale = + Double(StaticImageLimits.maxDecodedDimension) + / Double(max(sourceWidth, sourceHeight)) + let scale = min(1, pixelScale, dimensionScale) + + let sourceMaxDimension = max(sourceWidth, sourceHeight) + var maxPixelSize = max(1, Int(floor(Double(sourceMaxDimension) * scale))) + + while maxPixelSize > 0 { + // ImageIO may round the secondary dimension up. Plan with ceil so the actual + // thumbnail still satisfies the decoded pixel-count ceiling. + let outputWidth = max( + 1, + Int( + ceil( + Double(sourceWidth) * Double(maxPixelSize) + / Double(sourceMaxDimension) + ) + ) + ) + let outputHeight = max( + 1, + Int( + ceil( + Double(sourceHeight) * Double(maxPixelSize) + / Double(sourceMaxDimension) + ) + ) + ) + + if StaticImageLimits.acceptsDecoded(width: outputWidth, height: outputHeight) { + return StaticImageDecodePlan( + sourceWidth: sourceWidth, + sourceHeight: sourceHeight, + outputWidth: outputWidth, + outputHeight: outputHeight + ) + } + maxPixelSize -= 1 + } + + return nil + } +} diff --git a/ios/Domain/Models/StaticImageLimits.swift b/ios/Domain/Models/StaticImageLimits.swift new file mode 100644 index 0000000..d3b7b43 --- /dev/null +++ b/ios/Domain/Models/StaticImageLimits.swift @@ -0,0 +1,29 @@ +enum StaticImageLimits { + static let maxEncodedBytes = 25 * 1024 * 1024 + static let maxSourcePixelCount = 25_000_000 + static let maxSourceDimension = 10_000 + static let maxDecodedPixelCount = 4_000_000 + static let maxDecodedDimension = 4_096 + + static func acceptsFile( + isRegularFile: Bool?, + isSymbolicLink: Bool?, + encodedBytes: Int? + ) -> Bool { + guard let encodedBytes else { + return false + } + return isRegularFile == true + && isSymbolicLink == false + && encodedBytes >= 0 + && encodedBytes <= maxEncodedBytes + } + + static func acceptsDecoded(width: Int, height: Int) -> Bool { + width > 0 + && height > 0 + && width <= maxDecodedDimension + && height <= maxDecodedDimension + && width <= maxDecodedPixelCount / height + } +} diff --git a/ios/Infrastructure/Image/ImagePreprocessor.swift b/ios/Infrastructure/Image/ImagePreprocessor.swift index 4a617f8..0ff0756 100644 --- a/ios/Infrastructure/Image/ImagePreprocessor.swift +++ b/ios/Infrastructure/Image/ImagePreprocessor.swift @@ -1,4 +1,5 @@ import Foundation +import ImageIO #if canImport(MLKitVision) && canImport(VisionCamera) import MLKitVision @@ -6,6 +7,11 @@ import Foundation class ImagePreprocessor: IImagePreprocessor { + private struct DecodedStaticImage { + let image: UIImage + let sourceScaleFactor: CGFloat + } + // Reuse CIContext across frames to avoid repeated allocation overhead // CIContext creation is expensive (~10-20ms), reusing reduces per-frame cost significantly private static let sharedContext: CIContext = { @@ -31,8 +37,7 @@ import Foundation private func createScaledVisionImage( from ciImage: CIImage, scaleFactor: CGFloat, - frameOrientation: UIImage.Orientation, - outputOrientation: OutputOrientation?, + visionOrientation: UIImage.Orientation, roi: DomainRegionOfInterest? ) -> VisionImage? { var workingImage = ciImage @@ -75,10 +80,7 @@ import Foundation ) let visionImage = VisionImage(image: uiImage) - visionImage.orientation = getVisionOrientation( - frameOrientation: frameOrientation, - outputOrientation: outputOrientation - ) + visionImage.orientation = visionOrientation return visionImage } @@ -102,6 +104,10 @@ import Foundation let effectiveScale = clampScale(options.scaleFactor) let frameOrientation = frame.orientation.asUIImageOrientation + let visionOrientation = resolveVisionOrientation( + frameOrientation: frameOrientation, + outputOrientation: options.outputOrientation + ) if let roi = options.roi { guard (try? roi.validate()) != nil else { @@ -115,8 +121,7 @@ import Foundation guard let invertedImage = createInvertedVisionImageFromFrame( sampleBuffer: sampleBuffer, - frameOrientation: frameOrientation, - outputOrientation: options.outputOrientation, + visionOrientation: visionOrientation, scaleFactor: effectiveScale, roi: options.roi ) @@ -128,8 +133,7 @@ import Foundation guard let convertedImage = createVisionImageFromFrame( sampleBuffer: sampleBuffer, - frameOrientation: frameOrientation, - outputOrientation: options.outputOrientation, + visionOrientation: visionOrientation, scaleFactor: effectiveScale, roi: options.roi ) @@ -171,7 +175,7 @@ import Foundation let metadata = ImageMetadata( width: width, height: height, - orientation: frameOrientation, + orientation: visionOrientation, isInverted: options.invertColors, offsetX: offsetX, offsetY: offsetY, @@ -183,8 +187,7 @@ import Foundation private func createVisionImageFromFrame( sampleBuffer: CMSampleBuffer, - frameOrientation: UIImage.Orientation, - outputOrientation: OutputOrientation?, + visionOrientation: UIImage.Orientation, scaleFactor: CGFloat, roi: DomainRegionOfInterest? ) -> VisionImage? { @@ -213,8 +216,7 @@ import Foundation guard let convertedImage = convertToSupportedFormat( pixelBuffer: pixelBuffer, - frameOrientation: frameOrientation, - outputOrientation: outputOrientation, + visionOrientation: visionOrientation, scaleFactor: scaleFactor, roi: roi ) @@ -228,17 +230,13 @@ import Foundation // Fallback: Use CMSampleBuffer directly (for BGRA, scaleFactor == 1.0, and no ROI) let image = VisionImage(buffer: sampleBuffer) - image.orientation = getVisionOrientation( - frameOrientation: frameOrientation, - outputOrientation: outputOrientation - ) + image.orientation = visionOrientation return image } private func createInvertedVisionImageFromFrame( sampleBuffer: CMSampleBuffer, - frameOrientation: UIImage.Orientation, - outputOrientation: OutputOrientation?, + visionOrientation: UIImage.Orientation, scaleFactor: CGFloat, roi: DomainRegionOfInterest? ) -> VisionImage? { @@ -256,13 +254,12 @@ import Foundation return createScaledVisionImage( from: invertedCIImage, scaleFactor: scaleFactor, - frameOrientation: frameOrientation, - outputOrientation: outputOrientation, + visionOrientation: visionOrientation, roi: roi ) } - private func getVisionOrientation( + private func resolveVisionOrientation( frameOrientation: UIImage.Orientation, outputOrientation: OutputOrientation? ) @@ -290,8 +287,7 @@ import Foundation private func convertToSupportedFormat( pixelBuffer: CVPixelBuffer, - frameOrientation: UIImage.Orientation, - outputOrientation: OutputOrientation?, + visionOrientation: UIImage.Orientation, scaleFactor: CGFloat, roi: DomainRegionOfInterest? ) -> VisionImage? { @@ -302,8 +298,7 @@ import Foundation return createScaledVisionImage( from: ciImage, scaleFactor: scaleFactor, - frameOrientation: frameOrientation, - outputOrientation: outputOrientation, + visionOrientation: visionOrientation, roi: roi ) } @@ -311,24 +306,29 @@ import Foundation func preprocessImage(imageFile: URL, options: ImagePreprocessingOptions) -> ProcessedImage? { - guard let imageData = try? Data(contentsOf: imageFile), - let uiImage = UIImage(data: imageData) + guard + let decoded = decodeStaticImage( + imageFile, + explicitOrientation: options.orientation?.asUIImageOrientation + ) else { return nil } - // Use user-provided orientation override when available. - // Otherwise use the resulting UIImage orientation after processing. - let requestedOrientation = options.orientation?.asUIImageOrientation + // An explicit orientation describes the source pixels and overrides embedded EXIF. + // Normalize either orientation into pixels before resolving ROI coordinates. + let effectiveOrientation = + options.orientation?.asUIImageOrientation ?? decoded.image.imageOrientation + guard let normalizedImage = decoded.image.normalized(to: effectiveOrientation) else { + return nil + } let effectiveScale = clampScale(options.scaleFactor) - var processedImage = uiImage + var processedImage = normalizedImage var offsetX: CGFloat = 0 var offsetY: CGFloat = 0 - // Apply optional ROI crop, right after decode/orientation-resolution and before - // scale/invert (UIImage.imageOrientation metadata already encodes orientation for the - // static path, so there's no separate rotate step here). + // Apply optional ROI crop in normalized, visually oriented pixel coordinates. if let roi = options.roi { guard (try? roi.validate()) != nil else { return nil @@ -349,12 +349,12 @@ import Foundation return nil } - offsetX = pixelRect.origin.x - offsetY = pixelRect.origin.y + offsetX = pixelRect.origin.x / decoded.sourceScaleFactor + offsetY = pixelRect.origin.y / decoded.sourceScaleFactor processedImage = UIImage( cgImage: croppedCGImage, scale: processedImage.scale, - orientation: processedImage.imageOrientation + orientation: .up ) } @@ -370,8 +370,7 @@ import Foundation // Create VisionImage let visionImage = VisionImage(image: processedImage) - let visionOrientation = requestedOrientation ?? processedImage.imageOrientation - visionImage.orientation = visionOrientation + visionImage.orientation = .up let pixelWidth = processedImage.cgImage?.width @@ -383,16 +382,77 @@ import Foundation let metadata = ImageMetadata( width: pixelWidth, height: pixelHeight, - orientation: visionOrientation, + orientation: .up, isInverted: options.invertColors, offsetX: offsetX, offsetY: offsetY, - scaleFactor: effectiveScale + scaleFactor: decoded.sourceScaleFactor * effectiveScale ) return ProcessedImage(image: visionImage, metadata: metadata) } + private func decodeStaticImage( + _ imageFile: URL, + explicitOrientation: UIImage.Orientation? + ) -> DecodedStaticImage? { + guard + let source = CGImageSourceCreateWithURL(imageFile as CFURL, nil), + let properties = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) + as? [CFString: Any], + let width = properties[kCGImagePropertyPixelWidth] as? Int, + let height = properties[kCGImagePropertyPixelHeight] as? Int, + let decodePlan = StaticImageDecodePlan.make( + sourceWidth: width, + sourceHeight: height + ) + else { + return nil + } + + let thumbnailOptions: [CFString: Any] = [ + kCGImageSourceCreateThumbnailFromImageAlways: true, + kCGImageSourceCreateThumbnailWithTransform: explicitOrientation == nil, + kCGImageSourceThumbnailMaxPixelSize: decodePlan.thumbnailMaxPixelSize, + kCGImageSourceShouldCacheImmediately: true, + ] + + guard + let thumbnail = CGImageSourceCreateThumbnailAtIndex( + source, + 0, + thumbnailOptions as CFDictionary + ) + else { + return nil + } + + guard + StaticImageLimits.acceptsDecoded( + width: thumbnail.width, + height: thumbnail.height + ) + else { + return nil + } + + let actualScale = CGFloat( + decodePlan.sourceScaleFactor( + decodedWidth: thumbnail.width, + decodedHeight: thumbnail.height + ) + ) + + return DecodedStaticImage( + image: UIImage( + cgImage: thumbnail, + scale: 1, + orientation: explicitOrientation ?? .up + ), + sourceScaleFactor: actualScale + ) + } + private func scaleUIImage(_ image: UIImage, scaleFactor: CGFloat) -> UIImage { let targetSize = CGSize( width: image.size.width * scaleFactor, diff --git a/ios/Infrastructure/Image/StaticImageURLResolver.swift b/ios/Infrastructure/Image/StaticImageURLResolver.swift new file mode 100644 index 0000000..03eb9a4 --- /dev/null +++ b/ios/Infrastructure/Image/StaticImageURLResolver.swift @@ -0,0 +1,49 @@ +import Foundation +import NitroModules + +enum StaticImageURLResolver { + static func resolve(_ uri: String) throws -> URL { + let fileURL: URL + + if let url = URL(string: uri), url.scheme != nil { + guard url.isFileURL else { + throw RuntimeError.error( + withMessage: "Static image URI must use the file scheme: \(uri)" + ) + } + fileURL = url + } else { + guard uri.hasPrefix("/") else { + throw RuntimeError.error( + withMessage: "Static image URI must be a file URL or absolute path: \(uri)" + ) + } + fileURL = URL(fileURLWithPath: uri) + } + + let path = fileURL.standardizedFileURL.path + guard FileManager.default.fileExists(atPath: path) else { + throw RuntimeError.error(withMessage: "Static image file does not exist: \(path)") + } + guard FileManager.default.isReadableFile(atPath: path) else { + throw RuntimeError.error(withMessage: "Static image file is not readable: \(path)") + } + + let resourceValues = try fileURL.resourceValues( + forKeys: [.fileSizeKey, .isRegularFileKey, .isSymbolicLinkKey] + ) + guard + StaticImageLimits.acceptsFile( + isRegularFile: resourceValues.isRegularFile, + isSymbolicLink: resourceValues.isSymbolicLink, + encodedBytes: resourceValues.fileSize + ) + else { + throw RuntimeError.error( + withMessage: "Static image must be a regular, non-symlink file up to 25 MB." + ) + } + + return URL(fileURLWithPath: path) + } +} diff --git a/ios/Infrastructure/Image/UIImage+normalizedOrientation.swift b/ios/Infrastructure/Image/UIImage+normalizedOrientation.swift new file mode 100644 index 0000000..0b010c7 --- /dev/null +++ b/ios/Infrastructure/Image/UIImage+normalizedOrientation.swift @@ -0,0 +1,36 @@ +import UIKit + +extension UIImage { + func normalized(to orientation: UIImage.Orientation) -> UIImage? { + guard let cgImage else { + return nil + } + + // `.up` means the pixel data already matches the desired visual orientation, + // so there's nothing to bake in — skip the redundant render pass. + if orientation == .up { + return UIImage(cgImage: cgImage, scale: 1, orientation: .up) + } + + let swapsDimensions: Bool + switch orientation { + case .left, .leftMirrored, .right, .rightMirrored: + swapsDimensions = true + default: + swapsDimensions = false + } + + let pixelSize = CGSize( + width: swapsDimensions ? cgImage.height : cgImage.width, + height: swapsDimensions ? cgImage.width : cgImage.height + ) + let orientedImage = UIImage(cgImage: cgImage, scale: 1, orientation: orientation) + let rendererFormat = UIGraphicsImageRendererFormat.default() + rendererFormat.scale = 1 + let renderer = UIGraphicsImageRenderer(size: pixelSize, format: rendererFormat) + + return renderer.image { _ in + orientedImage.draw(in: CGRect(origin: .zero, size: pixelSize)) + } + } +} diff --git a/ios/Infrastructure/MLKit/Adapters/MLKitBarcodeAdapter.swift b/ios/Infrastructure/MLKit/Adapters/MLKitBarcodeAdapter.swift index 6041bf6..ab8d210 100644 --- a/ios/Infrastructure/MLKit/Adapters/MLKitBarcodeAdapter.swift +++ b/ios/Infrastructure/MLKit/Adapters/MLKitBarcodeAdapter.swift @@ -32,8 +32,8 @@ import Foundation data: [ "ssid": wifi.ssid, "password": wifi.password, - "type": String(describing: wifi.type), - "typeName": String(describing: wifi.type), + "encryptionType": Int(wifi.type.rawValue), + "encryptionTypeName": wifiEncryptionName(wifi.type), ] ) } @@ -65,8 +65,8 @@ import Foundation "address": email.address, "subject": email.subject, "body": email.body, - "type": String(describing: email.type), - "typeName": String(describing: email.type), + "type": Int(email.type.rawValue), + "typeName": emailTypeName(email.type), ] ) } @@ -76,8 +76,8 @@ import Foundation type: "TYPE_PHONE", data: [ "number": phone.number, - "type": String(describing: phone.type), - "typeName": String(describing: phone.type), + "type": Int(phone.type.rawValue), + "typeName": phoneTypeName(phone.type), ] ) } @@ -114,29 +114,9 @@ import Foundation "name": contactInfo.name.map { toPersonName($0) }, "organization": contactInfo.organization, "title": contactInfo.jobTitle, - "phones": contactInfo.phones?.map { phone in - [ - "number": phone.number, - "type": String(describing: phone.type), - "typeName": String(describing: phone.type), - ] - }, - "emails": contactInfo.emails?.map { email in - [ - "address": email.address, - "subject": email.subject, - "body": email.body, - "type": String(describing: email.type), - "typeName": String(describing: email.type), - ] - }, - "addresses": contactInfo.addresses?.map { address in - [ - "addressLines": address.addressLines, - "type": String(describing: address.type), - "typeName": String(describing: address.type), - ] - }, + "phones": contactInfo.phones?.map { toPhone($0) }, + "emails": contactInfo.emails?.map { toEmail($0) }, + "addresses": contactInfo.addresses?.map { toAddress($0) }, "urls": contactInfo.urls, ] ) @@ -165,9 +145,18 @@ import Foundation } if let rawValue = barcode.rawValue { + let type = valueTypeName(barcode.valueType) + let dataKey: String + switch type { + case "TYPE_TEXT": dataKey = "text" + case "TYPE_PRODUCT": dataKey = "product" + case "TYPE_ISBN": dataKey = "isbn" + default: dataKey = "rawValue" + } + return BarcodeParsedValue( - type: valueTypeName(barcode.valueType), - data: ["value": rawValue] + type: type, + data: [dataKey: rawValue] ) } @@ -186,6 +175,32 @@ import Foundation ] } + private static func toPhone(_ phone: BarcodePhone) -> [String: Any?] { + return [ + "number": phone.number, + "type": Int(phone.type.rawValue), + "typeName": phoneTypeName(phone.type), + ] + } + + private static func toEmail(_ email: BarcodeEmail) -> [String: Any?] { + return [ + "address": email.address, + "subject": email.subject, + "body": email.body, + "type": Int(email.type.rawValue), + "typeName": emailTypeName(email.type), + ] + } + + private static func toAddress(_ address: BarcodeAddress) -> [String: Any?] { + return [ + "addressLines": address.addressLines, + "type": Int(address.type.rawValue), + "typeName": addressTypeName(address.type), + ] + } + private static func toDateInfo(_ date: Date?) -> [String: Any?]? { guard let date else { return nil @@ -253,7 +268,8 @@ import Foundation } } - private static func valueTypeName(_ valueType: MLKitBarcodeScanning.BarcodeValueType) -> String { + private static func valueTypeName(_ valueType: MLKitBarcodeScanning.BarcodeValueType) -> String + { switch Int(valueType.rawValue) { case 1: return "TYPE_CONTACT_INFO" case 2: return "TYPE_EMAIL" @@ -270,5 +286,40 @@ import Foundation default: return "TYPE_UNKNOWN" } } + + private static func wifiEncryptionName(_ type: BarcodeWiFiEncryptionType) -> String { + switch Int(type.rawValue) { + case 1: return "OPEN" + case 2: return "WPA" + case 3: return "WEP" + default: return "UNKNOWN" + } + } + + private static func phoneTypeName(_ type: BarcodePhoneType) -> String { + switch Int(type.rawValue) { + case 1: return "WORK" + case 2: return "HOME" + case 3: return "FAX" + case 4: return "MOBILE" + default: return "UNKNOWN" + } + } + + private static func emailTypeName(_ type: BarcodeEmailType) -> String { + switch Int(type.rawValue) { + case 1: return "WORK" + case 2: return "HOME" + default: return "UNKNOWN" + } + } + + private static func addressTypeName(_ type: BarcodeAddressType) -> String { + switch Int(type.rawValue) { + case 1: return "WORK" + case 2: return "HOME" + default: return "UNKNOWN" + } + } } #endif // MLKIT_BARCODE_SCANNING diff --git a/ios/Infrastructure/Modules/VisionCameraMLKitModule.swift b/ios/Infrastructure/Modules/VisionCameraMLKitModule.swift deleted file mode 100644 index a52bb74..0000000 --- a/ios/Infrastructure/Modules/VisionCameraMLKitModule.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation -import React - -@objc(VisionCameraMLKitModule) -class VisionCameraMLKitModule: NSObject { - private lazy var handlers: [String: IStaticImageHandler] = { - var handlers: [String: IStaticImageHandler] = [:] - - #if MLKIT_TEXT_RECOGNITION_ANY - handlers[MLKitFeatureKeys.TEXT_RECOGNITION] = StaticTextRecognitionHandler() - #endif - - #if MLKIT_BARCODE_SCANNING - handlers[MLKitFeatureKeys.BARCODE_SCANNING] = StaticBarcodeScanningHandler() - #endif - - return handlers - }() - - @objc - func processImage( - _ feature: String, - path: String, - options: Any?, - resolver resolve: @escaping RCTPromiseResolveBlock, - rejecter reject: @escaping RCTPromiseRejectBlock - ) { - let safeOptions = options as? [String: Any] ?? [:] - guard let handler = handlers[feature] else { - reject("UNSUPPORTED_FEATURE", "Feature \(feature) is not supported", nil) - return - } - - handler.process( - path: path, - options: safeOptions, - resolver: { result in resolve(result) }, - rejecter: { code, message, error in reject(code, message, error) } - ) - } - - @objc static func requiresMainQueueSetup() -> Bool { - false - } -} diff --git a/ios/Infrastructure/Modules/VisionCameraMLKitModuleBridge.m b/ios/Infrastructure/Modules/VisionCameraMLKitModuleBridge.m deleted file mode 100644 index 3e5e466..0000000 --- a/ios/Infrastructure/Modules/VisionCameraMLKitModuleBridge.m +++ /dev/null @@ -1,11 +0,0 @@ -#import - -@interface RCT_EXTERN_MODULE(VisionCameraMLKitModule, NSObject) - -RCT_EXTERN_METHOD(processImage:(NSString *)feature - path:(NSString *)path - options:(id)options - resolver:(RCTPromiseResolveBlock)resolve - rejecter:(RCTPromiseRejectBlock)reject) - -@end diff --git a/ios/Infrastructure/Serializers/BarcodeScanningSerializer.swift b/ios/Infrastructure/Serializers/BarcodeScanningSerializer.swift deleted file mode 100644 index e692f93..0000000 --- a/ios/Infrastructure/Serializers/BarcodeScanningSerializer.swift +++ /dev/null @@ -1,89 +0,0 @@ -import Foundation - -#if MLKIT_BARCODE_SCANNING - class BarcodeScanningSerializer { - - static func toReactNativeMap(_ result: BarcodeScanningResult) -> [String: Any] { - var map = [String: Any]() - map["barcodes"] = result.barcodes.map { toBarcodeMap($0) } - return map - } - - private static func toBarcodeMap(_ barcode: BarcodeData) -> [String: Any] { - var map = [String: Any]() - if let bounds = barcode.bounds { - map["bounds"] = toBoundsMap(bounds) - } - if let corners = barcode.corners { - map["corners"] = corners.map { toCornerMap($0) } - } - map["format"] = barcode.format - map["formatName"] = barcode.formatName - map["valueType"] = barcode.valueType - map["valueTypeName"] = barcode.valueTypeName - map["rawValue"] = barcode.rawValue as Any - map["displayValue"] = barcode.displayValue as Any - map["rawBytes"] = barcode.rawBytes as Any - map["isPotential"] = barcode.isPotential - if let value = barcode.value { - map["value"] = toValueMap(value) - } - return map - } - - private static func toValueMap(_ value: BarcodeParsedValue) -> [String: Any] { - var map = [String: Any]() - map["type"] = value.type - map["data"] = toNonOptionalDictionary(value.data) - return map - } - - private static func toBoundsMap(_ bounds: DomainBoundingBox) -> [String: Double] { - return [ - "x": bounds.x, - "y": bounds.y, - "centerX": bounds.centerX, - "centerY": bounds.centerY, - "width": bounds.width, - "height": bounds.height, - "top": bounds.top, - "left": bounds.left, - "bottom": bounds.bottom, - "right": bounds.right, - ] - } - - private static func toCornerMap(_ corner: DomainCorner) -> [String: Double] { - return [ - "x": corner.x, - "y": corner.y, - ] - } - - private static func toNonOptionalDictionary(_ dictionary: [String: Any?]) - -> [String: Any] - { - var output: [String: Any] = [:] - for (key, value) in dictionary { - output[key] = normalize(value) - } - return output - } - - private static func normalize(_ value: Any?) -> Any { - guard let value = value else { - return NSNull() - } - - if let dictionary = value as? [String: Any?] { - return toNonOptionalDictionary(dictionary) - } - - if let array = value as? [Any?] { - return array.map { normalize($0) } - } - - return value - } - } -#endif // MLKIT_BARCODE_SCANNING diff --git a/ios/Infrastructure/Serializers/TextRecognitionSerializer.swift b/ios/Infrastructure/Serializers/TextRecognitionSerializer.swift deleted file mode 100644 index 47bf703..0000000 --- a/ios/Infrastructure/Serializers/TextRecognitionSerializer.swift +++ /dev/null @@ -1,112 +0,0 @@ -import Foundation - -class TextRecognitionSerializer { - - static func toReactNativeMap(_ result: DomainTextRecognitionResult) -> [String: Any] { - var map = [String: Any]() - map["text"] = result.text - map["blocks"] = toBlocksArray(result.blocks) - return map - } - - private static func toBlocksArray(_ blocks: [DomainTextBlock]) -> [[String: Any]] { - return blocks.map { toBlockMap($0) } - } - - private static func toBlockMap(_ block: DomainTextBlock) -> [String: Any] { - var map = [String: Any]() - map["text"] = block.text - if let bounds = block.bounds { - map["bounds"] = toBoundsMap(bounds) - } - if let corners = block.corners { - map["corners"] = toCornersArray(corners) - } - map["lines"] = toLinesArray(block.lines) - map["languages"] = block.languages - return map - } - - private static func toLinesArray(_ lines: [DomainTextLine]) -> [[String: Any]] { - return lines.map { toLineMap($0) } - } - - private static func toLineMap(_ line: DomainTextLine) -> [String: Any] { - var map = [String: Any]() - map["text"] = line.text - if let bounds = line.bounds { - map["bounds"] = toBoundsMap(bounds) - } - if let corners = line.corners { - map["corners"] = toCornersArray(corners) - } - map["elements"] = toElementsArray(line.elements) - map["confidence"] = line.confidence - map["angle"] = line.angle - map["languages"] = line.languages - return map - } - - private static func toElementsArray(_ elements: [DomainTextElement]) -> [[String: - Any]] - { - return elements.map { toElementMap($0) } - } - - private static func toElementMap(_ element: DomainTextElement) -> [String: Any] { - var map = [String: Any]() - map["text"] = element.text - if let bounds = element.bounds { - map["bounds"] = toBoundsMap(bounds) - } - if let corners = element.corners { - map["corners"] = toCornersArray(corners) - } - map["symbols"] = element.symbols.map { toSymbolMap($0) } - map["confidence"] = element.confidence - map["angle"] = element.angle - map["languages"] = element.languages - return map - } - - private static func toSymbolMap(_ symbol: DomainTextSymbol) -> [String: Any] { - var map = [String: Any]() - map["text"] = symbol.text - if let bounds = symbol.bounds { - map["bounds"] = toBoundsMap(bounds) - } - if let corners = symbol.corners { - map["corners"] = toCornersArray(corners) - } - map["confidence"] = symbol.confidence - map["angle"] = symbol.angle - map["languages"] = symbol.languages - return map - } - - private static func toBoundsMap(_ bounds: DomainBoundingBox) -> [String: Double] { - return [ - "x": bounds.x, - "y": bounds.y, - "centerX": bounds.centerX, - "centerY": bounds.centerY, - "width": bounds.width, - "height": bounds.height, - "top": bounds.top, - "left": bounds.left, - "bottom": bounds.bottom, - "right": bounds.right, - ] - } - - private static func toCornersArray(_ corners: [DomainCorner]) -> [[String: Double]] { - return corners.map { toCornerMap($0) } - } - - private static func toCornerMap(_ corner: DomainCorner) -> [String: Double] { - return [ - "x": corner.x, - "y": corner.y, - ] - } -} diff --git a/nitrogen/generated/.gitattributes b/nitrogen/generated/.gitattributes new file mode 100644 index 0000000..fb7a0d5 --- /dev/null +++ b/nitrogen/generated/.gitattributes @@ -0,0 +1 @@ +** linguist-generated=true diff --git a/nitrogen/generated/android/VisionCameraMLKit+autolinking.cmake b/nitrogen/generated/android/VisionCameraMLKit+autolinking.cmake new file mode 100644 index 0000000..45a377a --- /dev/null +++ b/nitrogen/generated/android/VisionCameraMLKit+autolinking.cmake @@ -0,0 +1,86 @@ +# +# VisionCameraMLKit+autolinking.cmake +# This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +# https://github.com/mrousavy/nitro +# Copyright © Marc Rousavy @ Margelo +# + +# This is a CMake file that adds all files generated by Nitrogen +# to the current CMake project. +# +# To use it, add this to your CMakeLists.txt: +# ```cmake +# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/VisionCameraMLKit+autolinking.cmake) +# ``` + +# Define a flag to check if we are building properly +add_definitions(-DBUILDING_VISIONCAMERAMLKIT_WITH_GENERATED_CMAKE_PROJECT) + +# Enable Raw Props parsing in react-native (for Nitro Views) +add_definitions(-DRN_SERIALIZABLE_STATE) + +# Add all headers that were generated by Nitrogen +include_directories( + "../nitrogen/generated/shared/c++" + "../nitrogen/generated/android/c++" + "../nitrogen/generated/android/" +) + +# Add all .cpp sources that were generated by Nitrogen +target_sources( + # CMake project name (Android C++ library name) + VisionCameraMLKit PRIVATE + # Autolinking Setup + ../nitrogen/generated/android/VisionCameraMLKitOnLoad.cpp + # Shared Nitrogen C++ sources + ../nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.cpp + ../nitrogen/generated/shared/c++/HybridTextRecognizerSpec.cpp + ../nitrogen/generated/shared/c++/HybridVisionCameraMLKitSpec.cpp + # Android-specific Nitrogen C++ sources + ../nitrogen/generated/android/c++/JHybridBarcodeScannerSpec.cpp + ../nitrogen/generated/android/c++/JHybridTextRecognizerSpec.cpp + ../nitrogen/generated/android/c++/JVariant_NullType_Double.cpp + ../nitrogen/generated/android/c++/JHybridVisionCameraMLKitSpec.cpp +) + +# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake +# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake +target_compile_definitions( + VisionCameraMLKit PRIVATE + -DFOLLY_NO_CONFIG=1 + -DFOLLY_HAVE_CLOCK_GETTIME=1 + -DFOLLY_USE_LIBCPP=1 + -DFOLLY_CFG_NO_COROUTINES=1 + -DFOLLY_MOBILE=1 + -DFOLLY_HAVE_RECVMMSG=1 + -DFOLLY_HAVE_PTHREAD=1 + # Once we target android-23 above, we can comment + # the following line. NDK uses GNU style stderror_r() after API 23. + -DFOLLY_HAVE_XSI_STRERROR_R=1 +) + +# Add all libraries required by the generated specs +find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++ +find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule) +find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library + +# Link all libraries together +target_link_libraries( + VisionCameraMLKit + fbjni::fbjni # <-- Facebook C++ JNI helpers + ReactAndroid::jsi # <-- RN: JSI + react-native-nitro-modules::NitroModules # <-- NitroModules Core :) +) + +# Link react-native (different prefab between RN 0.75 and RN 0.76) +if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) + target_link_libraries( + VisionCameraMLKit + ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab + ) +else() + target_link_libraries( + VisionCameraMLKit + ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core + ) +endif() diff --git a/nitrogen/generated/android/VisionCameraMLKit+autolinking.gradle b/nitrogen/generated/android/VisionCameraMLKit+autolinking.gradle new file mode 100644 index 0000000..de2ad60 --- /dev/null +++ b/nitrogen/generated/android/VisionCameraMLKit+autolinking.gradle @@ -0,0 +1,27 @@ +/// +/// VisionCameraMLKit+autolinking.gradle +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/// This is a Gradle file that adds all files generated by Nitrogen +/// to the current Gradle project. +/// +/// To use it, add this to your build.gradle: +/// ```gradle +/// apply from: '../nitrogen/generated/android/VisionCameraMLKit+autolinking.gradle' +/// ``` + +logger.warn("[NitroModules] 🔥 VisionCameraMLKit is boosted by nitro!") + +android { + sourceSets { + main { + java.srcDirs += [ + // Nitrogen files + "${project.projectDir}/../nitrogen/generated/android/kotlin" + ] + } + } +} diff --git a/nitrogen/generated/android/VisionCameraMLKitOnLoad.cpp b/nitrogen/generated/android/VisionCameraMLKitOnLoad.cpp new file mode 100644 index 0000000..8a5e802 --- /dev/null +++ b/nitrogen/generated/android/VisionCameraMLKitOnLoad.cpp @@ -0,0 +1,58 @@ +/// +/// VisionCameraMLKitOnLoad.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#ifndef BUILDING_VISIONCAMERAMLKIT_WITH_GENERATED_CMAKE_PROJECT +#error VisionCameraMLKitOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this? +#endif + +#include "VisionCameraMLKitOnLoad.hpp" + +#include +#include +#include + +#include "JHybridBarcodeScannerSpec.hpp" +#include "JHybridTextRecognizerSpec.hpp" +#include "JHybridVisionCameraMLKitSpec.hpp" +#include + +namespace margelo::nitro::visioncameramlkit { + +int initialize(JavaVM* vm) { + return facebook::jni::initialize(vm, []() { + ::margelo::nitro::visioncameramlkit::registerAllNatives(); + }); +} + +struct JHybridVisionCameraMLKitSpecImpl: public jni::JavaClass { + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/HybridVisionCameraMLKit;"; + static std::shared_ptr create() { + static const auto constructorFn = javaClassStatic()->getConstructor(); + jni::local_ref javaPart = javaClassStatic()->newObject(constructorFn); + return javaPart->getJHybridVisionCameraMLKitSpec(); + } +}; + +void registerAllNatives() { + using namespace margelo::nitro; + using namespace margelo::nitro::visioncameramlkit; + + // Register native JNI methods + margelo::nitro::visioncameramlkit::JHybridBarcodeScannerSpec::CxxPart::registerNatives(); + margelo::nitro::visioncameramlkit::JHybridTextRecognizerSpec::CxxPart::registerNatives(); + margelo::nitro::visioncameramlkit::JHybridVisionCameraMLKitSpec::CxxPart::registerNatives(); + + // Register Nitro Hybrid Objects + HybridObjectRegistry::registerHybridObjectConstructor( + "VisionCameraMLKit", + []() -> std::shared_ptr { + return JHybridVisionCameraMLKitSpecImpl::create(); + } + ); +} + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/VisionCameraMLKitOnLoad.hpp b/nitrogen/generated/android/VisionCameraMLKitOnLoad.hpp new file mode 100644 index 0000000..ae3c5bf --- /dev/null +++ b/nitrogen/generated/android/VisionCameraMLKitOnLoad.hpp @@ -0,0 +1,34 @@ +/// +/// VisionCameraMLKitOnLoad.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + [[deprecated("Use registerNatives() instead.")]] + int initialize(JavaVM* vm); + + /** + * Register the native (C++) part of VisionCameraMLKit, and autolinks all Hybrid Objects. + * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`), + * inside a `facebook::jni::initialize(vm, ...)` call. + * Example: + * ```cpp (cpp-adapter.cpp) + * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) { + * return facebook::jni::initialize(vm, []() { + * // register all VisionCameraMLKit HybridObjects + * margelo::nitro::visioncameramlkit::registerNatives(); + * // any other custom registrations go here. + * }); + * } + * ``` + */ + void registerAllNatives(); + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JBarcodeFormat.hpp b/nitrogen/generated/android/c++/JBarcodeFormat.hpp new file mode 100644 index 0000000..e7bac27 --- /dev/null +++ b/nitrogen/generated/android/c++/JBarcodeFormat.hpp @@ -0,0 +1,97 @@ +/// +/// JBarcodeFormat.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "BarcodeFormat.hpp" + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "BarcodeFormat" and the Kotlin enum "BarcodeFormat". + */ + struct JBarcodeFormat final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/BarcodeFormat;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum BarcodeFormat. + */ + [[maybe_unused]] + [[nodiscard]] + BarcodeFormat toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(BarcodeFormat value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case BarcodeFormat::UNKNOWN: + static const auto fieldUNKNOWN = clazz->getStaticField("UNKNOWN"); + return clazz->getStaticFieldValue(fieldUNKNOWN); + case BarcodeFormat::ALL_FORMATS: + static const auto fieldALL_FORMATS = clazz->getStaticField("ALL_FORMATS"); + return clazz->getStaticFieldValue(fieldALL_FORMATS); + case BarcodeFormat::CODE_128: + static const auto fieldCODE_128 = clazz->getStaticField("CODE_128"); + return clazz->getStaticFieldValue(fieldCODE_128); + case BarcodeFormat::CODE_39: + static const auto fieldCODE_39 = clazz->getStaticField("CODE_39"); + return clazz->getStaticFieldValue(fieldCODE_39); + case BarcodeFormat::CODE_93: + static const auto fieldCODE_93 = clazz->getStaticField("CODE_93"); + return clazz->getStaticFieldValue(fieldCODE_93); + case BarcodeFormat::CODABAR: + static const auto fieldCODABAR = clazz->getStaticField("CODABAR"); + return clazz->getStaticFieldValue(fieldCODABAR); + case BarcodeFormat::DATA_MATRIX: + static const auto fieldDATA_MATRIX = clazz->getStaticField("DATA_MATRIX"); + return clazz->getStaticFieldValue(fieldDATA_MATRIX); + case BarcodeFormat::EAN_13: + static const auto fieldEAN_13 = clazz->getStaticField("EAN_13"); + return clazz->getStaticFieldValue(fieldEAN_13); + case BarcodeFormat::EAN_8: + static const auto fieldEAN_8 = clazz->getStaticField("EAN_8"); + return clazz->getStaticFieldValue(fieldEAN_8); + case BarcodeFormat::ITF: + static const auto fieldITF = clazz->getStaticField("ITF"); + return clazz->getStaticFieldValue(fieldITF); + case BarcodeFormat::QR_CODE: + static const auto fieldQR_CODE = clazz->getStaticField("QR_CODE"); + return clazz->getStaticFieldValue(fieldQR_CODE); + case BarcodeFormat::UPC_A: + static const auto fieldUPC_A = clazz->getStaticField("UPC_A"); + return clazz->getStaticFieldValue(fieldUPC_A); + case BarcodeFormat::UPC_E: + static const auto fieldUPC_E = clazz->getStaticField("UPC_E"); + return clazz->getStaticFieldValue(fieldUPC_E); + case BarcodeFormat::PDF417: + static const auto fieldPDF417 = clazz->getStaticField("PDF417"); + return clazz->getStaticFieldValue(fieldPDF417); + case BarcodeFormat::AZTEC: + static const auto fieldAZTEC = clazz->getStaticField("AZTEC"); + return clazz->getStaticFieldValue(fieldAZTEC); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JBarcodeScannerBarcode.hpp b/nitrogen/generated/android/c++/JBarcodeScannerBarcode.hpp new file mode 100644 index 0000000..bc882bf --- /dev/null +++ b/nitrogen/generated/android/c++/JBarcodeScannerBarcode.hpp @@ -0,0 +1,137 @@ +/// +/// JBarcodeScannerBarcode.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "BarcodeScannerBarcode.hpp" + +#include "BarcodeFormat.hpp" +#include "BarcodeValueTypeName.hpp" +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "JBarcodeFormat.hpp" +#include "JBarcodeValueTypeName.hpp" +#include "JBoundingBox.hpp" +#include "JCorner.hpp" +#include +#include +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "BarcodeScannerBarcode" and the Kotlin data class "BarcodeScannerBarcode". + */ + struct JBarcodeScannerBarcode final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/BarcodeScannerBarcode;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct BarcodeScannerBarcode by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + BarcodeScannerBarcode toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldBounds = clazz->getField("bounds"); + jni::local_ref bounds = this->getFieldValue(fieldBounds); + static const auto fieldCorners = clazz->getField>("corners"); + jni::local_ref> corners = this->getFieldValue(fieldCorners); + static const auto fieldFormat = clazz->getField("format"); + double format = this->getFieldValue(fieldFormat); + static const auto fieldFormatName = clazz->getField("formatName"); + jni::local_ref formatName = this->getFieldValue(fieldFormatName); + static const auto fieldValueType = clazz->getField("valueType"); + double valueType = this->getFieldValue(fieldValueType); + static const auto fieldValueTypeName = clazz->getField("valueTypeName"); + jni::local_ref valueTypeName = this->getFieldValue(fieldValueTypeName); + static const auto fieldRawValue = clazz->getField("rawValue"); + jni::local_ref rawValue = this->getFieldValue(fieldRawValue); + static const auto fieldDisplayValue = clazz->getField("displayValue"); + jni::local_ref displayValue = this->getFieldValue(fieldDisplayValue); + static const auto fieldRawBytes = clazz->getField("rawBytes"); + jni::local_ref rawBytes = this->getFieldValue(fieldRawBytes); + static const auto fieldValue = clazz->getField("value"); + jni::local_ref value = this->getFieldValue(fieldValue); + static const auto fieldIsPotential = clazz->getField("isPotential"); + jboolean isPotential = this->getFieldValue(fieldIsPotential); + return BarcodeScannerBarcode( + bounds != nullptr ? std::make_optional(bounds->toCpp()) : std::nullopt, + corners != nullptr ? std::make_optional([&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(corners)) : std::nullopt, + format, + formatName->toCpp(), + valueType, + valueTypeName->toCpp(), + rawValue != nullptr ? std::make_optional(rawValue->toStdString()) : std::nullopt, + displayValue != nullptr ? std::make_optional(displayValue->toStdString()) : std::nullopt, + rawBytes != nullptr ? std::make_optional([&]() { + size_t __size = rawBytes->size(); + std::vector __vector(__size); + rawBytes->getRegion(0, __size, __vector.data()); + return __vector; + }()) : std::nullopt, + value != nullptr ? std::make_optional(value->cthis()->getMap()) : std::nullopt, + static_cast(isPotential) + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const BarcodeScannerBarcode& value) { + using JSignature = JBarcodeScannerBarcode(jni::alias_ref, jni::alias_ref>, double, jni::alias_ref, double, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jboolean); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.bounds.has_value() ? JBoundingBox::fromCpp(value.bounds.value()) : nullptr, + value.corners.has_value() ? [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JCorner::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.corners.value()) : nullptr, + value.format, + JBarcodeFormat::fromCpp(value.formatName), + value.valueType, + JBarcodeValueTypeName::fromCpp(value.valueTypeName), + value.rawValue.has_value() ? jni::make_jstring(value.rawValue.value()) : nullptr, + value.displayValue.has_value() ? jni::make_jstring(value.displayValue.value()) : nullptr, + value.rawBytes.has_value() ? [&]() { + size_t __size = value.rawBytes.value().size(); + jni::local_ref __array = jni::JArrayDouble::newArray(__size); + __array->setRegion(0, __size, value.rawBytes.value().data()); + return __array; + }() : nullptr, + value.value.has_value() ? JAnyMap::create(value.value.value()) : nullptr, + value.isPotential + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JBarcodeScannerOptions.hpp b/nitrogen/generated/android/c++/JBarcodeScannerOptions.hpp new file mode 100644 index 0000000..3fecf07 --- /dev/null +++ b/nitrogen/generated/android/c++/JBarcodeScannerOptions.hpp @@ -0,0 +1,108 @@ +/// +/// JBarcodeScannerOptions.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "BarcodeScannerOptions.hpp" + +#include "BarcodeFormat.hpp" +#include "JBarcodeFormat.hpp" +#include "JOrientation.hpp" +#include "JRegionOfInterest.hpp" +#include "JRegionOfInterestUnit.hpp" +#include "Orientation.hpp" +#include "RegionOfInterest.hpp" +#include "RegionOfInterestUnit.hpp" +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "BarcodeScannerOptions" and the Kotlin data class "BarcodeScannerOptions". + */ + struct JBarcodeScannerOptions final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/BarcodeScannerOptions;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct BarcodeScannerOptions by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + BarcodeScannerOptions toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldFormats = clazz->getField>("formats"); + jni::local_ref> formats = this->getFieldValue(fieldFormats); + static const auto fieldEnableAllPotentialBarcodes = clazz->getField("enableAllPotentialBarcodes"); + jni::local_ref enableAllPotentialBarcodes = this->getFieldValue(fieldEnableAllPotentialBarcodes); + static const auto fieldScaleFactor = clazz->getField("scaleFactor"); + jni::local_ref scaleFactor = this->getFieldValue(fieldScaleFactor); + static const auto fieldInvertColors = clazz->getField("invertColors"); + jni::local_ref invertColors = this->getFieldValue(fieldInvertColors); + static const auto fieldFrameProcessInterval = clazz->getField("frameProcessInterval"); + jni::local_ref frameProcessInterval = this->getFieldValue(fieldFrameProcessInterval); + static const auto fieldRoi = clazz->getField("roi"); + jni::local_ref roi = this->getFieldValue(fieldRoi); + static const auto fieldOrientation = clazz->getField("orientation"); + jni::local_ref orientation = this->getFieldValue(fieldOrientation); + return BarcodeScannerOptions( + formats != nullptr ? std::make_optional([&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(formats)) : std::nullopt, + enableAllPotentialBarcodes != nullptr ? std::make_optional(static_cast(enableAllPotentialBarcodes->value())) : std::nullopt, + scaleFactor != nullptr ? std::make_optional(scaleFactor->value()) : std::nullopt, + invertColors != nullptr ? std::make_optional(static_cast(invertColors->value())) : std::nullopt, + frameProcessInterval != nullptr ? std::make_optional(frameProcessInterval->value()) : std::nullopt, + roi != nullptr ? std::make_optional(roi->toCpp()) : std::nullopt, + orientation != nullptr ? std::make_optional(orientation->toCpp()) : std::nullopt + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const BarcodeScannerOptions& value) { + using JSignature = JBarcodeScannerOptions(jni::alias_ref>, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.formats.has_value() ? [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JBarcodeFormat::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.formats.value()) : nullptr, + value.enableAllPotentialBarcodes.has_value() ? jni::JBoolean::valueOf(value.enableAllPotentialBarcodes.value()) : nullptr, + value.scaleFactor.has_value() ? jni::JDouble::valueOf(value.scaleFactor.value()) : nullptr, + value.invertColors.has_value() ? jni::JBoolean::valueOf(value.invertColors.value()) : nullptr, + value.frameProcessInterval.has_value() ? jni::JDouble::valueOf(value.frameProcessInterval.value()) : nullptr, + value.roi.has_value() ? JRegionOfInterest::fromCpp(value.roi.value()) : nullptr, + value.orientation.has_value() ? JOrientation::fromCpp(value.orientation.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JBarcodeScannerResult.hpp b/nitrogen/generated/android/c++/JBarcodeScannerResult.hpp new file mode 100644 index 0000000..cd0a0c0 --- /dev/null +++ b/nitrogen/generated/android/c++/JBarcodeScannerResult.hpp @@ -0,0 +1,89 @@ +/// +/// JBarcodeScannerResult.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "BarcodeScannerResult.hpp" + +#include "BarcodeFormat.hpp" +#include "BarcodeScannerBarcode.hpp" +#include "BarcodeValueTypeName.hpp" +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "JBarcodeFormat.hpp" +#include "JBarcodeScannerBarcode.hpp" +#include "JBarcodeValueTypeName.hpp" +#include "JBoundingBox.hpp" +#include "JCorner.hpp" +#include +#include +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "BarcodeScannerResult" and the Kotlin data class "BarcodeScannerResult". + */ + struct JBarcodeScannerResult final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/BarcodeScannerResult;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct BarcodeScannerResult by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + BarcodeScannerResult toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldBarcodes = clazz->getField>("barcodes"); + jni::local_ref> barcodes = this->getFieldValue(fieldBarcodes); + return BarcodeScannerResult( + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(barcodes) + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const BarcodeScannerResult& value) { + using JSignature = JBarcodeScannerResult(jni::alias_ref>); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JBarcodeScannerBarcode::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.barcodes) + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JBarcodeValueTypeName.hpp b/nitrogen/generated/android/c++/JBarcodeValueTypeName.hpp new file mode 100644 index 0000000..6393072 --- /dev/null +++ b/nitrogen/generated/android/c++/JBarcodeValueTypeName.hpp @@ -0,0 +1,91 @@ +/// +/// JBarcodeValueTypeName.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "BarcodeValueTypeName.hpp" + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "BarcodeValueTypeName" and the Kotlin enum "BarcodeValueTypeName". + */ + struct JBarcodeValueTypeName final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/BarcodeValueTypeName;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum BarcodeValueTypeName. + */ + [[maybe_unused]] + [[nodiscard]] + BarcodeValueTypeName toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(BarcodeValueTypeName value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case BarcodeValueTypeName::TYPE_UNKNOWN: + static const auto fieldTYPE_UNKNOWN = clazz->getStaticField("TYPE_UNKNOWN"); + return clazz->getStaticFieldValue(fieldTYPE_UNKNOWN); + case BarcodeValueTypeName::TYPE_CONTACT_INFO: + static const auto fieldTYPE_CONTACT_INFO = clazz->getStaticField("TYPE_CONTACT_INFO"); + return clazz->getStaticFieldValue(fieldTYPE_CONTACT_INFO); + case BarcodeValueTypeName::TYPE_EMAIL: + static const auto fieldTYPE_EMAIL = clazz->getStaticField("TYPE_EMAIL"); + return clazz->getStaticFieldValue(fieldTYPE_EMAIL); + case BarcodeValueTypeName::TYPE_ISBN: + static const auto fieldTYPE_ISBN = clazz->getStaticField("TYPE_ISBN"); + return clazz->getStaticFieldValue(fieldTYPE_ISBN); + case BarcodeValueTypeName::TYPE_PHONE: + static const auto fieldTYPE_PHONE = clazz->getStaticField("TYPE_PHONE"); + return clazz->getStaticFieldValue(fieldTYPE_PHONE); + case BarcodeValueTypeName::TYPE_PRODUCT: + static const auto fieldTYPE_PRODUCT = clazz->getStaticField("TYPE_PRODUCT"); + return clazz->getStaticFieldValue(fieldTYPE_PRODUCT); + case BarcodeValueTypeName::TYPE_SMS: + static const auto fieldTYPE_SMS = clazz->getStaticField("TYPE_SMS"); + return clazz->getStaticFieldValue(fieldTYPE_SMS); + case BarcodeValueTypeName::TYPE_TEXT: + static const auto fieldTYPE_TEXT = clazz->getStaticField("TYPE_TEXT"); + return clazz->getStaticFieldValue(fieldTYPE_TEXT); + case BarcodeValueTypeName::TYPE_URL: + static const auto fieldTYPE_URL = clazz->getStaticField("TYPE_URL"); + return clazz->getStaticFieldValue(fieldTYPE_URL); + case BarcodeValueTypeName::TYPE_WIFI: + static const auto fieldTYPE_WIFI = clazz->getStaticField("TYPE_WIFI"); + return clazz->getStaticFieldValue(fieldTYPE_WIFI); + case BarcodeValueTypeName::TYPE_GEO: + static const auto fieldTYPE_GEO = clazz->getStaticField("TYPE_GEO"); + return clazz->getStaticFieldValue(fieldTYPE_GEO); + case BarcodeValueTypeName::TYPE_CALENDAR_EVENT: + static const auto fieldTYPE_CALENDAR_EVENT = clazz->getStaticField("TYPE_CALENDAR_EVENT"); + return clazz->getStaticFieldValue(fieldTYPE_CALENDAR_EVENT); + case BarcodeValueTypeName::TYPE_DRIVER_LICENSE: + static const auto fieldTYPE_DRIVER_LICENSE = clazz->getStaticField("TYPE_DRIVER_LICENSE"); + return clazz->getStaticFieldValue(fieldTYPE_DRIVER_LICENSE); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JBoundingBox.hpp b/nitrogen/generated/android/c++/JBoundingBox.hpp new file mode 100644 index 0000000..7905314 --- /dev/null +++ b/nitrogen/generated/android/c++/JBoundingBox.hpp @@ -0,0 +1,93 @@ +/// +/// JBoundingBox.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "BoundingBox.hpp" + + + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "BoundingBox" and the Kotlin data class "BoundingBox". + */ + struct JBoundingBox final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/BoundingBox;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct BoundingBox by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + BoundingBox toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldX = clazz->getField("x"); + double x = this->getFieldValue(fieldX); + static const auto fieldY = clazz->getField("y"); + double y = this->getFieldValue(fieldY); + static const auto fieldCenterX = clazz->getField("centerX"); + double centerX = this->getFieldValue(fieldCenterX); + static const auto fieldCenterY = clazz->getField("centerY"); + double centerY = this->getFieldValue(fieldCenterY); + static const auto fieldWidth = clazz->getField("width"); + double width = this->getFieldValue(fieldWidth); + static const auto fieldHeight = clazz->getField("height"); + double height = this->getFieldValue(fieldHeight); + static const auto fieldTop = clazz->getField("top"); + double top = this->getFieldValue(fieldTop); + static const auto fieldLeft = clazz->getField("left"); + double left = this->getFieldValue(fieldLeft); + static const auto fieldBottom = clazz->getField("bottom"); + double bottom = this->getFieldValue(fieldBottom); + static const auto fieldRight = clazz->getField("right"); + double right = this->getFieldValue(fieldRight); + return BoundingBox( + x, + y, + centerX, + centerY, + width, + height, + top, + left, + bottom, + right + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const BoundingBox& value) { + using JSignature = JBoundingBox(double, double, double, double, double, double, double, double, double, double); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.x, + value.y, + value.centerX, + value.centerY, + value.width, + value.height, + value.top, + value.left, + value.bottom, + value.right + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JCorner.hpp b/nitrogen/generated/android/c++/JCorner.hpp new file mode 100644 index 0000000..227cf63 --- /dev/null +++ b/nitrogen/generated/android/c++/JCorner.hpp @@ -0,0 +1,61 @@ +/// +/// JCorner.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "Corner.hpp" + + + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "Corner" and the Kotlin data class "Corner". + */ + struct JCorner final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/Corner;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct Corner by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + Corner toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldX = clazz->getField("x"); + double x = this->getFieldValue(fieldX); + static const auto fieldY = clazz->getField("y"); + double y = this->getFieldValue(fieldY); + return Corner( + x, + y + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const Corner& value) { + using JSignature = JCorner(double, double); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.x, + value.y + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JHybridBarcodeScannerSpec.cpp b/nitrogen/generated/android/c++/JHybridBarcodeScannerSpec.cpp new file mode 100644 index 0000000..12e2b59 --- /dev/null +++ b/nitrogen/generated/android/c++/JHybridBarcodeScannerSpec.cpp @@ -0,0 +1,111 @@ +/// +/// JHybridBarcodeScannerSpec.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "JHybridBarcodeScannerSpec.hpp" + +// Forward declaration of `BarcodeScannerResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerResult; } +// Forward declaration of `BarcodeScannerBarcode` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerBarcode; } +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `BarcodeFormat` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeFormat; } +// Forward declaration of `BarcodeValueTypeName` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeValueTypeName; } +// Forward declaration of `HybridFrameSpec` to properly resolve imports. +namespace margelo::nitro::camera { class HybridFrameSpec; } +// Forward declaration of `MLKitBaseArguments` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct MLKitBaseArguments; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } + +#include "BarcodeScannerResult.hpp" +#include "JBarcodeScannerResult.hpp" +#include "BarcodeScannerBarcode.hpp" +#include +#include "JBarcodeScannerBarcode.hpp" +#include "BoundingBox.hpp" +#include +#include "JBoundingBox.hpp" +#include "Corner.hpp" +#include "JCorner.hpp" +#include "BarcodeFormat.hpp" +#include "JBarcodeFormat.hpp" +#include "BarcodeValueTypeName.hpp" +#include "JBarcodeValueTypeName.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include "MLKitBaseArguments.hpp" +#include "JMLKitBaseArguments.hpp" +#include "Orientation.hpp" +#include "JOrientation.hpp" + +namespace margelo::nitro::visioncameramlkit { + + std::shared_ptr JHybridBarcodeScannerSpec::JavaPart::getJHybridBarcodeScannerSpec() { + auto hybridObject = JHybridObject::JavaPart::getJHybridObject(); + auto castHybridObject = std::dynamic_pointer_cast(hybridObject); + if (castHybridObject == nullptr) [[unlikely]] { + throw std::runtime_error("Failed to downcast JHybridObject to JHybridBarcodeScannerSpec!"); + } + return castHybridObject; + } + + jni::local_ref JHybridBarcodeScannerSpec::CxxPart::initHybrid(jni::alias_ref jThis) { + return makeCxxInstance(jThis); + } + + std::shared_ptr JHybridBarcodeScannerSpec::CxxPart::createHybridObject(const jni::local_ref& javaPart) { + auto castJavaPart = jni::dynamic_ref_cast(javaPart); + if (castJavaPart == nullptr) [[unlikely]] { + throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridBarcodeScannerSpec::JavaPart!"); + } + return std::make_shared(castJavaPart); + } + + void JHybridBarcodeScannerSpec::CxxPart::registerNatives() { + registerHybrid({ + makeNativeMethod("initHybrid", JHybridBarcodeScannerSpec::CxxPart::initHybrid), + }); + } + + // Properties + + + // Methods + BarcodeScannerResult JHybridBarcodeScannerSpec::recognize(const std::shared_ptr& frame, const std::optional& args) { + static const auto method = _javaPart->javaClassStatic()->getMethod(jni::alias_ref /* frame */, jni::alias_ref /* args */)>("recognize"); + auto __result = method(_javaPart, std::dynamic_pointer_cast(frame)->getJavaPart(), args.has_value() ? JMLKitBaseArguments::fromCpp(args.value()) : nullptr); + return __result->toCpp(); + } + std::shared_ptr> JHybridBarcodeScannerSpec::recognizeImage(const std::string& uri) { + static const auto method = _javaPart->javaClassStatic()->getMethod(jni::alias_ref /* uri */)>("recognizeImage"); + auto __result = method(_javaPart, jni::make_jstring(uri)); + return [&]() { + auto __promise = Promise::create(); + __result->cthis()->addOnResolvedListener([=](const jni::alias_ref& __boxedResult) { + auto __result = jni::static_ref_cast(__boxedResult); + __promise->resolve(__result->toCpp()); + }); + __result->cthis()->addOnRejectedListener([=](const jni::alias_ref& __throwable) { + jni::JniException __jniError(__throwable); + __promise->reject(std::make_exception_ptr(__jniError)); + }); + return __promise; + }(); + } + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JHybridBarcodeScannerSpec.hpp b/nitrogen/generated/android/c++/JHybridBarcodeScannerSpec.hpp new file mode 100644 index 0000000..9c21a2a --- /dev/null +++ b/nitrogen/generated/android/c++/JHybridBarcodeScannerSpec.hpp @@ -0,0 +1,64 @@ +/// +/// HybridBarcodeScannerSpec.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include "HybridBarcodeScannerSpec.hpp" + + + + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + class JHybridBarcodeScannerSpec: public virtual HybridBarcodeScannerSpec, public virtual JHybridObject { + public: + struct JavaPart: public jni::JavaClass { + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/HybridBarcodeScannerSpec;"; + std::shared_ptr getJHybridBarcodeScannerSpec(); + }; + struct CxxPart: public jni::HybridClass { + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/HybridBarcodeScannerSpec$CxxPart;"; + static jni::local_ref initHybrid(jni::alias_ref jThis); + static void registerNatives(); + using HybridBase::HybridBase; + protected: + std::shared_ptr createHybridObject(const jni::local_ref& javaPart) override; + }; + + public: + explicit JHybridBarcodeScannerSpec(const jni::local_ref& javaPart): + HybridObject(HybridBarcodeScannerSpec::TAG), + JHybridObject(javaPart), + _javaPart(jni::make_global(javaPart)) {} + ~JHybridBarcodeScannerSpec() override { + // Hermes GC can destroy JS objects on a non-JNI Thread. + jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); }); + } + + public: + inline const jni::global_ref& getJavaPart() const noexcept { + return _javaPart; + } + + public: + // Properties + + + public: + // Methods + BarcodeScannerResult recognize(const std::shared_ptr& frame, const std::optional& args) override; + std::shared_ptr> recognizeImage(const std::string& uri) override; + + private: + jni::global_ref _javaPart; + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JHybridTextRecognizerSpec.cpp b/nitrogen/generated/android/c++/JHybridTextRecognizerSpec.cpp new file mode 100644 index 0000000..551a930 --- /dev/null +++ b/nitrogen/generated/android/c++/JHybridTextRecognizerSpec.cpp @@ -0,0 +1,117 @@ +/// +/// JHybridTextRecognizerSpec.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "JHybridTextRecognizerSpec.hpp" + +// Forward declaration of `TextRecognitionResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextRecognitionResult; } +// Forward declaration of `TextBlock` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextBlock; } +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `TextLine` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextLine; } +// Forward declaration of `TextElement` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextElement; } +// Forward declaration of `TextSymbol` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextSymbol; } +// Forward declaration of `HybridFrameSpec` to properly resolve imports. +namespace margelo::nitro::camera { class HybridFrameSpec; } +// Forward declaration of `MLKitBaseArguments` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct MLKitBaseArguments; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } + +#include "TextRecognitionResult.hpp" +#include "JTextRecognitionResult.hpp" +#include +#include "TextBlock.hpp" +#include +#include "JTextBlock.hpp" +#include "BoundingBox.hpp" +#include "JBoundingBox.hpp" +#include "Corner.hpp" +#include "JCorner.hpp" +#include "TextLine.hpp" +#include "JTextLine.hpp" +#include +#include +#include +#include "JVariant_NullType_Double.hpp" +#include +#include "TextElement.hpp" +#include "JTextElement.hpp" +#include "TextSymbol.hpp" +#include "JTextSymbol.hpp" +#include +#include +#include +#include +#include +#include "MLKitBaseArguments.hpp" +#include "JMLKitBaseArguments.hpp" +#include "Orientation.hpp" +#include "JOrientation.hpp" + +namespace margelo::nitro::visioncameramlkit { + + std::shared_ptr JHybridTextRecognizerSpec::JavaPart::getJHybridTextRecognizerSpec() { + auto hybridObject = JHybridObject::JavaPart::getJHybridObject(); + auto castHybridObject = std::dynamic_pointer_cast(hybridObject); + if (castHybridObject == nullptr) [[unlikely]] { + throw std::runtime_error("Failed to downcast JHybridObject to JHybridTextRecognizerSpec!"); + } + return castHybridObject; + } + + jni::local_ref JHybridTextRecognizerSpec::CxxPart::initHybrid(jni::alias_ref jThis) { + return makeCxxInstance(jThis); + } + + std::shared_ptr JHybridTextRecognizerSpec::CxxPart::createHybridObject(const jni::local_ref& javaPart) { + auto castJavaPart = jni::dynamic_ref_cast(javaPart); + if (castJavaPart == nullptr) [[unlikely]] { + throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridTextRecognizerSpec::JavaPart!"); + } + return std::make_shared(castJavaPart); + } + + void JHybridTextRecognizerSpec::CxxPart::registerNatives() { + registerHybrid({ + makeNativeMethod("initHybrid", JHybridTextRecognizerSpec::CxxPart::initHybrid), + }); + } + + // Properties + + + // Methods + TextRecognitionResult JHybridTextRecognizerSpec::recognize(const std::shared_ptr& frame, const std::optional& args) { + static const auto method = _javaPart->javaClassStatic()->getMethod(jni::alias_ref /* frame */, jni::alias_ref /* args */)>("recognize"); + auto __result = method(_javaPart, std::dynamic_pointer_cast(frame)->getJavaPart(), args.has_value() ? JMLKitBaseArguments::fromCpp(args.value()) : nullptr); + return __result->toCpp(); + } + std::shared_ptr> JHybridTextRecognizerSpec::recognizeImage(const std::string& uri) { + static const auto method = _javaPart->javaClassStatic()->getMethod(jni::alias_ref /* uri */)>("recognizeImage"); + auto __result = method(_javaPart, jni::make_jstring(uri)); + return [&]() { + auto __promise = Promise::create(); + __result->cthis()->addOnResolvedListener([=](const jni::alias_ref& __boxedResult) { + auto __result = jni::static_ref_cast(__boxedResult); + __promise->resolve(__result->toCpp()); + }); + __result->cthis()->addOnRejectedListener([=](const jni::alias_ref& __throwable) { + jni::JniException __jniError(__throwable); + __promise->reject(std::make_exception_ptr(__jniError)); + }); + return __promise; + }(); + } + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JHybridTextRecognizerSpec.hpp b/nitrogen/generated/android/c++/JHybridTextRecognizerSpec.hpp new file mode 100644 index 0000000..69c4cfd --- /dev/null +++ b/nitrogen/generated/android/c++/JHybridTextRecognizerSpec.hpp @@ -0,0 +1,64 @@ +/// +/// HybridTextRecognizerSpec.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include "HybridTextRecognizerSpec.hpp" + + + + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + class JHybridTextRecognizerSpec: public virtual HybridTextRecognizerSpec, public virtual JHybridObject { + public: + struct JavaPart: public jni::JavaClass { + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/HybridTextRecognizerSpec;"; + std::shared_ptr getJHybridTextRecognizerSpec(); + }; + struct CxxPart: public jni::HybridClass { + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/HybridTextRecognizerSpec$CxxPart;"; + static jni::local_ref initHybrid(jni::alias_ref jThis); + static void registerNatives(); + using HybridBase::HybridBase; + protected: + std::shared_ptr createHybridObject(const jni::local_ref& javaPart) override; + }; + + public: + explicit JHybridTextRecognizerSpec(const jni::local_ref& javaPart): + HybridObject(HybridTextRecognizerSpec::TAG), + JHybridObject(javaPart), + _javaPart(jni::make_global(javaPart)) {} + ~JHybridTextRecognizerSpec() override { + // Hermes GC can destroy JS objects on a non-JNI Thread. + jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); }); + } + + public: + inline const jni::global_ref& getJavaPart() const noexcept { + return _javaPart; + } + + public: + // Properties + + + public: + // Methods + TextRecognitionResult recognize(const std::shared_ptr& frame, const std::optional& args) override; + std::shared_ptr> recognizeImage(const std::string& uri) override; + + private: + jni::global_ref _javaPart; + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JHybridVisionCameraMLKitSpec.cpp b/nitrogen/generated/android/c++/JHybridVisionCameraMLKitSpec.cpp new file mode 100644 index 0000000..5be7333 --- /dev/null +++ b/nitrogen/generated/android/c++/JHybridVisionCameraMLKitSpec.cpp @@ -0,0 +1,104 @@ +/// +/// JHybridVisionCameraMLKitSpec.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "JHybridVisionCameraMLKitSpec.hpp" + +// Forward declaration of `HybridTextRecognizerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridTextRecognizerSpec; } +// Forward declaration of `HybridBarcodeScannerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridBarcodeScannerSpec; } +// Forward declaration of `MLKitFeature` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class MLKitFeature; } +// Forward declaration of `TextRecognizerOptions` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextRecognizerOptions; } +// Forward declaration of `TextRecognitionLanguage` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class TextRecognitionLanguage; } +// Forward declaration of `RegionOfInterest` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct RegionOfInterest; } +// Forward declaration of `RegionOfInterestUnit` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class RegionOfInterestUnit; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } +// Forward declaration of `BarcodeScannerOptions` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerOptions; } +// Forward declaration of `BarcodeFormat` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeFormat; } + +#include +#include "HybridTextRecognizerSpec.hpp" +#include "JHybridTextRecognizerSpec.hpp" +#include "HybridBarcodeScannerSpec.hpp" +#include "JHybridBarcodeScannerSpec.hpp" +#include "MLKitFeature.hpp" +#include "JMLKitFeature.hpp" +#include "TextRecognizerOptions.hpp" +#include "JTextRecognizerOptions.hpp" +#include "TextRecognitionLanguage.hpp" +#include +#include "JTextRecognitionLanguage.hpp" +#include "RegionOfInterest.hpp" +#include "JRegionOfInterest.hpp" +#include "RegionOfInterestUnit.hpp" +#include "JRegionOfInterestUnit.hpp" +#include "Orientation.hpp" +#include "JOrientation.hpp" +#include "BarcodeScannerOptions.hpp" +#include "JBarcodeScannerOptions.hpp" +#include "BarcodeFormat.hpp" +#include +#include "JBarcodeFormat.hpp" + +namespace margelo::nitro::visioncameramlkit { + + std::shared_ptr JHybridVisionCameraMLKitSpec::JavaPart::getJHybridVisionCameraMLKitSpec() { + auto hybridObject = JHybridObject::JavaPart::getJHybridObject(); + auto castHybridObject = std::dynamic_pointer_cast(hybridObject); + if (castHybridObject == nullptr) [[unlikely]] { + throw std::runtime_error("Failed to downcast JHybridObject to JHybridVisionCameraMLKitSpec!"); + } + return castHybridObject; + } + + jni::local_ref JHybridVisionCameraMLKitSpec::CxxPart::initHybrid(jni::alias_ref jThis) { + return makeCxxInstance(jThis); + } + + std::shared_ptr JHybridVisionCameraMLKitSpec::CxxPart::createHybridObject(const jni::local_ref& javaPart) { + auto castJavaPart = jni::dynamic_ref_cast(javaPart); + if (castJavaPart == nullptr) [[unlikely]] { + throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridVisionCameraMLKitSpec::JavaPart!"); + } + return std::make_shared(castJavaPart); + } + + void JHybridVisionCameraMLKitSpec::CxxPart::registerNatives() { + registerHybrid({ + makeNativeMethod("initHybrid", JHybridVisionCameraMLKitSpec::CxxPart::initHybrid), + }); + } + + // Properties + + + // Methods + bool JHybridVisionCameraMLKitSpec::isFeatureAvailable(MLKitFeature feature) { + static const auto method = _javaPart->javaClassStatic()->getMethod /* feature */)>("isFeatureAvailable"); + auto __result = method(_javaPart, JMLKitFeature::fromCpp(feature)); + return static_cast(__result); + } + std::shared_ptr JHybridVisionCameraMLKitSpec::createTextRecognizer(const TextRecognizerOptions& options) { + static const auto method = _javaPart->javaClassStatic()->getMethod(jni::alias_ref /* options */)>("createTextRecognizer"); + auto __result = method(_javaPart, JTextRecognizerOptions::fromCpp(options)); + return __result->getJHybridTextRecognizerSpec(); + } + std::shared_ptr JHybridVisionCameraMLKitSpec::createBarcodeScanner(const BarcodeScannerOptions& options) { + static const auto method = _javaPart->javaClassStatic()->getMethod(jni::alias_ref /* options */)>("createBarcodeScanner"); + auto __result = method(_javaPart, JBarcodeScannerOptions::fromCpp(options)); + return __result->getJHybridBarcodeScannerSpec(); + } + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JHybridVisionCameraMLKitSpec.hpp b/nitrogen/generated/android/c++/JHybridVisionCameraMLKitSpec.hpp new file mode 100644 index 0000000..13df72b --- /dev/null +++ b/nitrogen/generated/android/c++/JHybridVisionCameraMLKitSpec.hpp @@ -0,0 +1,65 @@ +/// +/// HybridVisionCameraMLKitSpec.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include +#include "HybridVisionCameraMLKitSpec.hpp" + + + + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + class JHybridVisionCameraMLKitSpec: public virtual HybridVisionCameraMLKitSpec, public virtual JHybridObject { + public: + struct JavaPart: public jni::JavaClass { + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/HybridVisionCameraMLKitSpec;"; + std::shared_ptr getJHybridVisionCameraMLKitSpec(); + }; + struct CxxPart: public jni::HybridClass { + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/HybridVisionCameraMLKitSpec$CxxPart;"; + static jni::local_ref initHybrid(jni::alias_ref jThis); + static void registerNatives(); + using HybridBase::HybridBase; + protected: + std::shared_ptr createHybridObject(const jni::local_ref& javaPart) override; + }; + + public: + explicit JHybridVisionCameraMLKitSpec(const jni::local_ref& javaPart): + HybridObject(HybridVisionCameraMLKitSpec::TAG), + JHybridObject(javaPart), + _javaPart(jni::make_global(javaPart)) {} + ~JHybridVisionCameraMLKitSpec() override { + // Hermes GC can destroy JS objects on a non-JNI Thread. + jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); }); + } + + public: + inline const jni::global_ref& getJavaPart() const noexcept { + return _javaPart; + } + + public: + // Properties + + + public: + // Methods + bool isFeatureAvailable(MLKitFeature feature) override; + std::shared_ptr createTextRecognizer(const TextRecognizerOptions& options) override; + std::shared_ptr createBarcodeScanner(const BarcodeScannerOptions& options) override; + + private: + jni::global_ref _javaPart; + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JMLKitBaseArguments.hpp b/nitrogen/generated/android/c++/JMLKitBaseArguments.hpp new file mode 100644 index 0000000..9f998bf --- /dev/null +++ b/nitrogen/generated/android/c++/JMLKitBaseArguments.hpp @@ -0,0 +1,59 @@ +/// +/// JMLKitBaseArguments.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "MLKitBaseArguments.hpp" + +#include "JOrientation.hpp" +#include "Orientation.hpp" +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "MLKitBaseArguments" and the Kotlin data class "MLKitBaseArguments". + */ + struct JMLKitBaseArguments final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/MLKitBaseArguments;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct MLKitBaseArguments by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + MLKitBaseArguments toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOutputOrientation = clazz->getField("outputOrientation"); + jni::local_ref outputOrientation = this->getFieldValue(fieldOutputOrientation); + return MLKitBaseArguments( + outputOrientation != nullptr ? std::make_optional(outputOrientation->toCpp()) : std::nullopt + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const MLKitBaseArguments& value) { + using JSignature = JMLKitBaseArguments(jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.outputOrientation.has_value() ? JOrientation::fromCpp(value.outputOrientation.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JMLKitFeature.hpp b/nitrogen/generated/android/c++/JMLKitFeature.hpp new file mode 100644 index 0000000..b241ead --- /dev/null +++ b/nitrogen/generated/android/c++/JMLKitFeature.hpp @@ -0,0 +1,85 @@ +/// +/// JMLKitFeature.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "MLKitFeature.hpp" + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "MLKitFeature" and the Kotlin enum "MLKitFeature". + */ + struct JMLKitFeature final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/MLKitFeature;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum MLKitFeature. + */ + [[maybe_unused]] + [[nodiscard]] + MLKitFeature toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(MLKitFeature value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case MLKitFeature::TEXTRECOGNITION: + static const auto fieldTEXTRECOGNITION = clazz->getStaticField("TEXTRECOGNITION"); + return clazz->getStaticFieldValue(fieldTEXTRECOGNITION); + case MLKitFeature::FACEDETECTION: + static const auto fieldFACEDETECTION = clazz->getStaticField("FACEDETECTION"); + return clazz->getStaticFieldValue(fieldFACEDETECTION); + case MLKitFeature::FACEMESHDETECTION: + static const auto fieldFACEMESHDETECTION = clazz->getStaticField("FACEMESHDETECTION"); + return clazz->getStaticFieldValue(fieldFACEMESHDETECTION); + case MLKitFeature::POSEDETECTION: + static const auto fieldPOSEDETECTION = clazz->getStaticField("POSEDETECTION"); + return clazz->getStaticFieldValue(fieldPOSEDETECTION); + case MLKitFeature::SELFIESEGMENTATION: + static const auto fieldSELFIESEGMENTATION = clazz->getStaticField("SELFIESEGMENTATION"); + return clazz->getStaticFieldValue(fieldSELFIESEGMENTATION); + case MLKitFeature::SUBJECTSEGMENTATION: + static const auto fieldSUBJECTSEGMENTATION = clazz->getStaticField("SUBJECTSEGMENTATION"); + return clazz->getStaticFieldValue(fieldSUBJECTSEGMENTATION); + case MLKitFeature::DOCUMENTSCANNER: + static const auto fieldDOCUMENTSCANNER = clazz->getStaticField("DOCUMENTSCANNER"); + return clazz->getStaticFieldValue(fieldDOCUMENTSCANNER); + case MLKitFeature::BARCODESCANNING: + static const auto fieldBARCODESCANNING = clazz->getStaticField("BARCODESCANNING"); + return clazz->getStaticFieldValue(fieldBARCODESCANNING); + case MLKitFeature::IMAGELABELING: + static const auto fieldIMAGELABELING = clazz->getStaticField("IMAGELABELING"); + return clazz->getStaticFieldValue(fieldIMAGELABELING); + case MLKitFeature::OBJECTDETECTION: + static const auto fieldOBJECTDETECTION = clazz->getStaticField("OBJECTDETECTION"); + return clazz->getStaticFieldValue(fieldOBJECTDETECTION); + case MLKitFeature::DIGITALINKRECOGNITION: + static const auto fieldDIGITALINKRECOGNITION = clazz->getStaticField("DIGITALINKRECOGNITION"); + return clazz->getStaticFieldValue(fieldDIGITALINKRECOGNITION); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JOrientation.hpp b/nitrogen/generated/android/c++/JOrientation.hpp new file mode 100644 index 0000000..2c6f089 --- /dev/null +++ b/nitrogen/generated/android/c++/JOrientation.hpp @@ -0,0 +1,64 @@ +/// +/// JOrientation.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "Orientation.hpp" + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "Orientation" and the Kotlin enum "Orientation". + */ + struct JOrientation final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/Orientation;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum Orientation. + */ + [[maybe_unused]] + [[nodiscard]] + Orientation toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(Orientation value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case Orientation::PORTRAIT: + static const auto fieldPORTRAIT = clazz->getStaticField("PORTRAIT"); + return clazz->getStaticFieldValue(fieldPORTRAIT); + case Orientation::PORTRAIT_UPSIDE_DOWN: + static const auto fieldPORTRAIT_UPSIDE_DOWN = clazz->getStaticField("PORTRAIT_UPSIDE_DOWN"); + return clazz->getStaticFieldValue(fieldPORTRAIT_UPSIDE_DOWN); + case Orientation::LANDSCAPE_LEFT: + static const auto fieldLANDSCAPE_LEFT = clazz->getStaticField("LANDSCAPE_LEFT"); + return clazz->getStaticFieldValue(fieldLANDSCAPE_LEFT); + case Orientation::LANDSCAPE_RIGHT: + static const auto fieldLANDSCAPE_RIGHT = clazz->getStaticField("LANDSCAPE_RIGHT"); + return clazz->getStaticFieldValue(fieldLANDSCAPE_RIGHT); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JRegionOfInterest.hpp b/nitrogen/generated/android/c++/JRegionOfInterest.hpp new file mode 100644 index 0000000..0a5ce83 --- /dev/null +++ b/nitrogen/generated/android/c++/JRegionOfInterest.hpp @@ -0,0 +1,75 @@ +/// +/// JRegionOfInterest.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "RegionOfInterest.hpp" + +#include "JRegionOfInterestUnit.hpp" +#include "RegionOfInterestUnit.hpp" +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "RegionOfInterest" and the Kotlin data class "RegionOfInterest". + */ + struct JRegionOfInterest final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/RegionOfInterest;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct RegionOfInterest by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + RegionOfInterest toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldX = clazz->getField("x"); + double x = this->getFieldValue(fieldX); + static const auto fieldY = clazz->getField("y"); + double y = this->getFieldValue(fieldY); + static const auto fieldWidth = clazz->getField("width"); + double width = this->getFieldValue(fieldWidth); + static const auto fieldHeight = clazz->getField("height"); + double height = this->getFieldValue(fieldHeight); + static const auto fieldUnit = clazz->getField("unit"); + jni::local_ref unit = this->getFieldValue(fieldUnit); + return RegionOfInterest( + x, + y, + width, + height, + unit != nullptr ? std::make_optional(unit->toCpp()) : std::nullopt + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const RegionOfInterest& value) { + using JSignature = JRegionOfInterest(double, double, double, double, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.x, + value.y, + value.width, + value.height, + value.unit.has_value() ? JRegionOfInterestUnit::fromCpp(value.unit.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JRegionOfInterestUnit.hpp b/nitrogen/generated/android/c++/JRegionOfInterestUnit.hpp new file mode 100644 index 0000000..6166c88 --- /dev/null +++ b/nitrogen/generated/android/c++/JRegionOfInterestUnit.hpp @@ -0,0 +1,58 @@ +/// +/// JRegionOfInterestUnit.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "RegionOfInterestUnit.hpp" + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "RegionOfInterestUnit" and the Kotlin enum "RegionOfInterestUnit". + */ + struct JRegionOfInterestUnit final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/RegionOfInterestUnit;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum RegionOfInterestUnit. + */ + [[maybe_unused]] + [[nodiscard]] + RegionOfInterestUnit toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(RegionOfInterestUnit value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case RegionOfInterestUnit::NORMALIZED: + static const auto fieldNORMALIZED = clazz->getStaticField("NORMALIZED"); + return clazz->getStaticFieldValue(fieldNORMALIZED); + case RegionOfInterestUnit::PIXEL: + static const auto fieldPIXEL = clazz->getStaticField("PIXEL"); + return clazz->getStaticFieldValue(fieldPIXEL); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JTextBlock.hpp b/nitrogen/generated/android/c++/JTextBlock.hpp new file mode 100644 index 0000000..e2f8f1c --- /dev/null +++ b/nitrogen/generated/android/c++/JTextBlock.hpp @@ -0,0 +1,143 @@ +/// +/// JTextBlock.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "TextBlock.hpp" + +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "JBoundingBox.hpp" +#include "JCorner.hpp" +#include "JTextElement.hpp" +#include "JTextLine.hpp" +#include "JTextSymbol.hpp" +#include "JVariant_NullType_Double.hpp" +#include "TextElement.hpp" +#include "TextLine.hpp" +#include "TextSymbol.hpp" +#include +#include +#include +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "TextBlock" and the Kotlin data class "TextBlock". + */ + struct JTextBlock final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/TextBlock;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct TextBlock by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + TextBlock toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldBounds = clazz->getField("bounds"); + jni::local_ref bounds = this->getFieldValue(fieldBounds); + static const auto fieldCorners = clazz->getField>("corners"); + jni::local_ref> corners = this->getFieldValue(fieldCorners); + static const auto fieldLanguages = clazz->getField>("languages"); + jni::local_ref> languages = this->getFieldValue(fieldLanguages); + static const auto fieldText = clazz->getField("text"); + jni::local_ref text = this->getFieldValue(fieldText); + static const auto fieldLines = clazz->getField>("lines"); + jni::local_ref> lines = this->getFieldValue(fieldLines); + return TextBlock( + bounds->toCpp(), + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(corners), + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toStdString()); + } + return __vector; + }(languages), + text->toStdString(), + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(lines) + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const TextBlock& value) { + using JSignature = JTextBlock(jni::alias_ref, jni::alias_ref>, jni::alias_ref>, jni::alias_ref, jni::alias_ref>); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + JBoundingBox::fromCpp(value.bounds), + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JCorner::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.corners), + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = jni::make_jstring(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.languages), + jni::make_jstring(value.text), + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JTextLine::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.lines) + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JTextElement.hpp b/nitrogen/generated/android/c++/JTextElement.hpp new file mode 100644 index 0000000..ee39031 --- /dev/null +++ b/nitrogen/generated/android/c++/JTextElement.hpp @@ -0,0 +1,147 @@ +/// +/// JTextElement.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "TextElement.hpp" + +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "JBoundingBox.hpp" +#include "JCorner.hpp" +#include "JTextSymbol.hpp" +#include "JVariant_NullType_Double.hpp" +#include "TextSymbol.hpp" +#include +#include +#include +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "TextElement" and the Kotlin data class "TextElement". + */ + struct JTextElement final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/TextElement;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct TextElement by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + TextElement toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldBounds = clazz->getField("bounds"); + jni::local_ref bounds = this->getFieldValue(fieldBounds); + static const auto fieldCorners = clazz->getField>("corners"); + jni::local_ref> corners = this->getFieldValue(fieldCorners); + static const auto fieldConfidence = clazz->getField("confidence"); + jni::local_ref confidence = this->getFieldValue(fieldConfidence); + static const auto fieldAngle = clazz->getField("angle"); + jni::local_ref angle = this->getFieldValue(fieldAngle); + static const auto fieldLanguages = clazz->getField>("languages"); + jni::local_ref> languages = this->getFieldValue(fieldLanguages); + static const auto fieldText = clazz->getField("text"); + jni::local_ref text = this->getFieldValue(fieldText); + static const auto fieldSymbols = clazz->getField>("symbols"); + jni::local_ref> symbols = this->getFieldValue(fieldSymbols); + return TextElement( + bounds->toCpp(), + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(corners), + confidence != nullptr ? std::make_optional(confidence->toCpp()) : std::nullopt, + angle != nullptr ? std::make_optional(angle->toCpp()) : std::nullopt, + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toStdString()); + } + return __vector; + }(languages), + text->toStdString(), + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(symbols) + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const TextElement& value) { + using JSignature = JTextElement(jni::alias_ref, jni::alias_ref>, jni::alias_ref, jni::alias_ref, jni::alias_ref>, jni::alias_ref, jni::alias_ref>); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + JBoundingBox::fromCpp(value.bounds), + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JCorner::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.corners), + value.confidence.has_value() ? JVariant_NullType_Double::fromCpp(value.confidence.value()) : nullptr, + value.angle.has_value() ? JVariant_NullType_Double::fromCpp(value.angle.value()) : nullptr, + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = jni::make_jstring(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.languages), + jni::make_jstring(value.text), + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JTextSymbol::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.symbols) + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JTextLine.hpp b/nitrogen/generated/android/c++/JTextLine.hpp new file mode 100644 index 0000000..ea33db4 --- /dev/null +++ b/nitrogen/generated/android/c++/JTextLine.hpp @@ -0,0 +1,149 @@ +/// +/// JTextLine.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "TextLine.hpp" + +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "JBoundingBox.hpp" +#include "JCorner.hpp" +#include "JTextElement.hpp" +#include "JTextSymbol.hpp" +#include "JVariant_NullType_Double.hpp" +#include "TextElement.hpp" +#include "TextSymbol.hpp" +#include +#include +#include +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "TextLine" and the Kotlin data class "TextLine". + */ + struct JTextLine final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/TextLine;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct TextLine by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + TextLine toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldBounds = clazz->getField("bounds"); + jni::local_ref bounds = this->getFieldValue(fieldBounds); + static const auto fieldCorners = clazz->getField>("corners"); + jni::local_ref> corners = this->getFieldValue(fieldCorners); + static const auto fieldConfidence = clazz->getField("confidence"); + jni::local_ref confidence = this->getFieldValue(fieldConfidence); + static const auto fieldAngle = clazz->getField("angle"); + jni::local_ref angle = this->getFieldValue(fieldAngle); + static const auto fieldLanguages = clazz->getField>("languages"); + jni::local_ref> languages = this->getFieldValue(fieldLanguages); + static const auto fieldText = clazz->getField("text"); + jni::local_ref text = this->getFieldValue(fieldText); + static const auto fieldElements = clazz->getField>("elements"); + jni::local_ref> elements = this->getFieldValue(fieldElements); + return TextLine( + bounds->toCpp(), + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(corners), + confidence != nullptr ? std::make_optional(confidence->toCpp()) : std::nullopt, + angle != nullptr ? std::make_optional(angle->toCpp()) : std::nullopt, + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toStdString()); + } + return __vector; + }(languages), + text->toStdString(), + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(elements) + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const TextLine& value) { + using JSignature = JTextLine(jni::alias_ref, jni::alias_ref>, jni::alias_ref, jni::alias_ref, jni::alias_ref>, jni::alias_ref, jni::alias_ref>); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + JBoundingBox::fromCpp(value.bounds), + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JCorner::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.corners), + value.confidence.has_value() ? JVariant_NullType_Double::fromCpp(value.confidence.value()) : nullptr, + value.angle.has_value() ? JVariant_NullType_Double::fromCpp(value.angle.value()) : nullptr, + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = jni::make_jstring(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.languages), + jni::make_jstring(value.text), + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JTextElement::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.elements) + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JTextRecognitionLanguage.hpp b/nitrogen/generated/android/c++/JTextRecognitionLanguage.hpp new file mode 100644 index 0000000..0e3c461 --- /dev/null +++ b/nitrogen/generated/android/c++/JTextRecognitionLanguage.hpp @@ -0,0 +1,67 @@ +/// +/// JTextRecognitionLanguage.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "TextRecognitionLanguage.hpp" + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "TextRecognitionLanguage" and the Kotlin enum "TextRecognitionLanguage". + */ + struct JTextRecognitionLanguage final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/TextRecognitionLanguage;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum TextRecognitionLanguage. + */ + [[maybe_unused]] + [[nodiscard]] + TextRecognitionLanguage toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(TextRecognitionLanguage value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case TextRecognitionLanguage::LATIN: + static const auto fieldLATIN = clazz->getStaticField("LATIN"); + return clazz->getStaticFieldValue(fieldLATIN); + case TextRecognitionLanguage::CHINESE: + static const auto fieldCHINESE = clazz->getStaticField("CHINESE"); + return clazz->getStaticFieldValue(fieldCHINESE); + case TextRecognitionLanguage::DEVANAGARI: + static const auto fieldDEVANAGARI = clazz->getStaticField("DEVANAGARI"); + return clazz->getStaticFieldValue(fieldDEVANAGARI); + case TextRecognitionLanguage::JAPANESE: + static const auto fieldJAPANESE = clazz->getStaticField("JAPANESE"); + return clazz->getStaticFieldValue(fieldJAPANESE); + case TextRecognitionLanguage::KOREAN: + static const auto fieldKOREAN = clazz->getStaticField("KOREAN"); + return clazz->getStaticFieldValue(fieldKOREAN); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JTextRecognitionResult.hpp b/nitrogen/generated/android/c++/JTextRecognitionResult.hpp new file mode 100644 index 0000000..093ba58 --- /dev/null +++ b/nitrogen/generated/android/c++/JTextRecognitionResult.hpp @@ -0,0 +1,97 @@ +/// +/// JTextRecognitionResult.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "TextRecognitionResult.hpp" + +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "JBoundingBox.hpp" +#include "JCorner.hpp" +#include "JTextBlock.hpp" +#include "JTextElement.hpp" +#include "JTextLine.hpp" +#include "JTextSymbol.hpp" +#include "JVariant_NullType_Double.hpp" +#include "TextBlock.hpp" +#include "TextElement.hpp" +#include "TextLine.hpp" +#include "TextSymbol.hpp" +#include +#include +#include +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "TextRecognitionResult" and the Kotlin data class "TextRecognitionResult". + */ + struct JTextRecognitionResult final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/TextRecognitionResult;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct TextRecognitionResult by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + TextRecognitionResult toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldText = clazz->getField("text"); + jni::local_ref text = this->getFieldValue(fieldText); + static const auto fieldBlocks = clazz->getField>("blocks"); + jni::local_ref> blocks = this->getFieldValue(fieldBlocks); + return TextRecognitionResult( + text->toStdString(), + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(blocks) + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const TextRecognitionResult& value) { + using JSignature = JTextRecognitionResult(jni::alias_ref, jni::alias_ref>); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + jni::make_jstring(value.text), + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JTextBlock::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.blocks) + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JTextRecognizerOptions.hpp b/nitrogen/generated/android/c++/JTextRecognizerOptions.hpp new file mode 100644 index 0000000..d69be4f --- /dev/null +++ b/nitrogen/generated/android/c++/JTextRecognizerOptions.hpp @@ -0,0 +1,85 @@ +/// +/// JTextRecognizerOptions.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "TextRecognizerOptions.hpp" + +#include "JOrientation.hpp" +#include "JRegionOfInterest.hpp" +#include "JRegionOfInterestUnit.hpp" +#include "JTextRecognitionLanguage.hpp" +#include "Orientation.hpp" +#include "RegionOfInterest.hpp" +#include "RegionOfInterestUnit.hpp" +#include "TextRecognitionLanguage.hpp" +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "TextRecognizerOptions" and the Kotlin data class "TextRecognizerOptions". + */ + struct JTextRecognizerOptions final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/TextRecognizerOptions;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct TextRecognizerOptions by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + TextRecognizerOptions toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldLanguage = clazz->getField("language"); + jni::local_ref language = this->getFieldValue(fieldLanguage); + static const auto fieldScaleFactor = clazz->getField("scaleFactor"); + jni::local_ref scaleFactor = this->getFieldValue(fieldScaleFactor); + static const auto fieldInvertColors = clazz->getField("invertColors"); + jni::local_ref invertColors = this->getFieldValue(fieldInvertColors); + static const auto fieldFrameProcessInterval = clazz->getField("frameProcessInterval"); + jni::local_ref frameProcessInterval = this->getFieldValue(fieldFrameProcessInterval); + static const auto fieldRoi = clazz->getField("roi"); + jni::local_ref roi = this->getFieldValue(fieldRoi); + static const auto fieldOrientation = clazz->getField("orientation"); + jni::local_ref orientation = this->getFieldValue(fieldOrientation); + return TextRecognizerOptions( + language != nullptr ? std::make_optional(language->toCpp()) : std::nullopt, + scaleFactor != nullptr ? std::make_optional(scaleFactor->value()) : std::nullopt, + invertColors != nullptr ? std::make_optional(static_cast(invertColors->value())) : std::nullopt, + frameProcessInterval != nullptr ? std::make_optional(frameProcessInterval->value()) : std::nullopt, + roi != nullptr ? std::make_optional(roi->toCpp()) : std::nullopt, + orientation != nullptr ? std::make_optional(orientation->toCpp()) : std::nullopt + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const TextRecognizerOptions& value) { + using JSignature = JTextRecognizerOptions(jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.language.has_value() ? JTextRecognitionLanguage::fromCpp(value.language.value()) : nullptr, + value.scaleFactor.has_value() ? jni::JDouble::valueOf(value.scaleFactor.value()) : nullptr, + value.invertColors.has_value() ? jni::JBoolean::valueOf(value.invertColors.value()) : nullptr, + value.frameProcessInterval.has_value() ? jni::JDouble::valueOf(value.frameProcessInterval.value()) : nullptr, + value.roi.has_value() ? JRegionOfInterest::fromCpp(value.roi.value()) : nullptr, + value.orientation.has_value() ? JOrientation::fromCpp(value.orientation.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JTextSymbol.hpp b/nitrogen/generated/android/c++/JTextSymbol.hpp new file mode 100644 index 0000000..7349be5 --- /dev/null +++ b/nitrogen/generated/android/c++/JTextSymbol.hpp @@ -0,0 +1,118 @@ +/// +/// JTextSymbol.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "TextSymbol.hpp" + +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "JBoundingBox.hpp" +#include "JCorner.hpp" +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "TextSymbol" and the Kotlin data class "TextSymbol". + */ + struct JTextSymbol final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/TextSymbol;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct TextSymbol by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + TextSymbol toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldBounds = clazz->getField("bounds"); + jni::local_ref bounds = this->getFieldValue(fieldBounds); + static const auto fieldCorners = clazz->getField>("corners"); + jni::local_ref> corners = this->getFieldValue(fieldCorners); + static const auto fieldConfidence = clazz->getField("confidence"); + double confidence = this->getFieldValue(fieldConfidence); + static const auto fieldAngle = clazz->getField("angle"); + double angle = this->getFieldValue(fieldAngle); + static const auto fieldLanguages = clazz->getField>("languages"); + jni::local_ref> languages = this->getFieldValue(fieldLanguages); + static const auto fieldText = clazz->getField("text"); + jni::local_ref text = this->getFieldValue(fieldText); + return TextSymbol( + bounds->toCpp(), + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(corners), + confidence, + angle, + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toStdString()); + } + return __vector; + }(languages), + text->toStdString() + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const TextSymbol& value) { + using JSignature = JTextSymbol(jni::alias_ref, jni::alias_ref>, double, double, jni::alias_ref>, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + JBoundingBox::fromCpp(value.bounds), + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JCorner::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.corners), + value.confidence, + value.angle, + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = jni::make_jstring(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.languages), + jni::make_jstring(value.text) + ); + } + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JVariant_NullType_Double.cpp b/nitrogen/generated/android/c++/JVariant_NullType_Double.cpp new file mode 100644 index 0000000..855daf5 --- /dev/null +++ b/nitrogen/generated/android/c++/JVariant_NullType_Double.cpp @@ -0,0 +1,26 @@ +/// +/// JVariant_NullType_Double.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "JVariant_NullType_Double.hpp" + +namespace margelo::nitro::visioncameramlkit { + /** + * Converts JVariant_NullType_Double to std::variant + */ + std::variant JVariant_NullType_Double::toCpp() const { + if (isInstanceOf(JVariant_NullType_Double_impl::First::javaClassStatic())) { + // It's a `nitro::NullType` + auto jniValue = static_cast(this)->getValue(); + return nitro::null; + } else if (isInstanceOf(JVariant_NullType_Double_impl::Second::javaClassStatic())) { + // It's a `double` + auto jniValue = static_cast(this)->getValue(); + return jniValue; + } + throw std::invalid_argument("Variant is unknown Kotlin instance!"); + } +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/c++/JVariant_NullType_Double.hpp b/nitrogen/generated/android/c++/JVariant_NullType_Double.hpp new file mode 100644 index 0000000..4a5e380 --- /dev/null +++ b/nitrogen/generated/android/c++/JVariant_NullType_Double.hpp @@ -0,0 +1,69 @@ +/// +/// JVariant_NullType_Double.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include + +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ std::variant and the Java class "Variant_NullType_Double". + */ + class JVariant_NullType_Double: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/Variant_NullType_Double;"; + + static jni::local_ref create_0(jni::alias_ref value) { + static const auto method = javaClassStatic()->getStaticMethod)>("create"); + return method(javaClassStatic(), value); + } + static jni::local_ref create_1(double value) { + static const auto method = javaClassStatic()->getStaticMethod("create"); + return method(javaClassStatic(), value); + } + + static jni::local_ref fromCpp(const std::variant& variant) { + switch (variant.index()) { + case 0: return create_0(JNull::null()); + case 1: return create_1(std::get<1>(variant)); + default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")"); + } + } + + [[nodiscard]] std::variant toCpp() const; + }; + + namespace JVariant_NullType_Double_impl { + class First final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/Variant_NullType_Double$First;"; + + [[nodiscard]] jni::local_ref getValue() const { + static const auto field = javaClassStatic()->getField("value"); + return getFieldValue(field); + } + }; + + class Second final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visioncameramlkit/Variant_NullType_Double$Second;"; + + [[nodiscard]] double getValue() const { + static const auto field = javaClassStatic()->getField("value"); + return getFieldValue(field); + } + }; + } // namespace JVariant_NullType_Double_impl +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeFormat.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeFormat.kt new file mode 100644 index 0000000..48de5ae --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeFormat.kt @@ -0,0 +1,36 @@ +/// +/// BarcodeFormat.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip + +/** + * Represents the JavaScript enum/union "BarcodeFormat". + */ +@DoNotStrip +@Keep +enum class BarcodeFormat(@DoNotStrip @Keep val value: Int) { + UNKNOWN(0), + ALL_FORMATS(1), + CODE_128(2), + CODE_39(3), + CODE_93(4), + CODABAR(5), + DATA_MATRIX(6), + EAN_13(7), + EAN_8(8), + ITF(9), + QR_CODE(10), + UPC_A(11), + UPC_E(12), + PDF417(13), + AZTEC(14); + + companion object +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeScannerBarcode.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeScannerBarcode.kt new file mode 100644 index 0000000..5939fc7 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeScannerBarcode.kt @@ -0,0 +1,101 @@ +/// +/// BarcodeScannerBarcode.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects +import com.margelo.nitro.core.AnyMap + +/** + * Represents the JavaScript object/struct "BarcodeScannerBarcode". + */ +@DoNotStrip +@Keep +data class BarcodeScannerBarcode( + @DoNotStrip + @Keep + val bounds: BoundingBox?, + @DoNotStrip + @Keep + val corners: Array?, + @DoNotStrip + @Keep + val format: Double, + @DoNotStrip + @Keep + val formatName: BarcodeFormat, + @DoNotStrip + @Keep + val valueType: Double, + @DoNotStrip + @Keep + val valueTypeName: BarcodeValueTypeName, + @DoNotStrip + @Keep + val rawValue: String?, + @DoNotStrip + @Keep + val displayValue: String?, + @DoNotStrip + @Keep + val rawBytes: DoubleArray?, + @DoNotStrip + @Keep + val value: AnyMap?, + @DoNotStrip + @Keep + val isPotential: Boolean +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is BarcodeScannerBarcode) return false + return Objects.deepEquals(this.bounds, other.bounds) + && Objects.deepEquals(this.corners, other.corners) + && Objects.deepEquals(this.format, other.format) + && Objects.deepEquals(this.formatName, other.formatName) + && Objects.deepEquals(this.valueType, other.valueType) + && Objects.deepEquals(this.valueTypeName, other.valueTypeName) + && Objects.deepEquals(this.rawValue, other.rawValue) + && Objects.deepEquals(this.displayValue, other.displayValue) + && Objects.deepEquals(this.rawBytes, other.rawBytes) + && Objects.deepEquals(this.value, other.value) + && Objects.deepEquals(this.isPotential, other.isPotential) + } + + override fun hashCode(): Int { + return arrayOf( + bounds, + corners, + format, + formatName, + valueType, + valueTypeName, + rawValue, + displayValue, + rawBytes, + value, + isPotential + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(bounds: BoundingBox?, corners: Array?, format: Double, formatName: BarcodeFormat, valueType: Double, valueTypeName: BarcodeValueTypeName, rawValue: String?, displayValue: String?, rawBytes: DoubleArray?, value: AnyMap?, isPotential: Boolean): BarcodeScannerBarcode { + return BarcodeScannerBarcode(bounds, corners, format, formatName, valueType, valueTypeName, rawValue, displayValue, rawBytes, value, isPotential) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeScannerOptions.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeScannerOptions.kt new file mode 100644 index 0000000..da34102 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeScannerOptions.kt @@ -0,0 +1,81 @@ +/// +/// BarcodeScannerOptions.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "BarcodeScannerOptions". + */ +@DoNotStrip +@Keep +data class BarcodeScannerOptions( + @DoNotStrip + @Keep + val formats: Array?, + @DoNotStrip + @Keep + val enableAllPotentialBarcodes: Boolean?, + @DoNotStrip + @Keep + val scaleFactor: Double?, + @DoNotStrip + @Keep + val invertColors: Boolean?, + @DoNotStrip + @Keep + val frameProcessInterval: Double?, + @DoNotStrip + @Keep + val roi: RegionOfInterest?, + @DoNotStrip + @Keep + val orientation: Orientation? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is BarcodeScannerOptions) return false + return Objects.deepEquals(this.formats, other.formats) + && Objects.deepEquals(this.enableAllPotentialBarcodes, other.enableAllPotentialBarcodes) + && Objects.deepEquals(this.scaleFactor, other.scaleFactor) + && Objects.deepEquals(this.invertColors, other.invertColors) + && Objects.deepEquals(this.frameProcessInterval, other.frameProcessInterval) + && Objects.deepEquals(this.roi, other.roi) + && Objects.deepEquals(this.orientation, other.orientation) + } + + override fun hashCode(): Int { + return arrayOf( + formats, + enableAllPotentialBarcodes, + scaleFactor, + invertColors, + frameProcessInterval, + roi, + orientation + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(formats: Array?, enableAllPotentialBarcodes: Boolean?, scaleFactor: Double?, invertColors: Boolean?, frameProcessInterval: Double?, roi: RegionOfInterest?, orientation: Orientation?): BarcodeScannerOptions { + return BarcodeScannerOptions(formats, enableAllPotentialBarcodes, scaleFactor, invertColors, frameProcessInterval, roi, orientation) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeScannerResult.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeScannerResult.kt new file mode 100644 index 0000000..2fff1d5 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeScannerResult.kt @@ -0,0 +1,51 @@ +/// +/// BarcodeScannerResult.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "BarcodeScannerResult". + */ +@DoNotStrip +@Keep +data class BarcodeScannerResult( + @DoNotStrip + @Keep + val barcodes: Array +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is BarcodeScannerResult) return false + return Objects.deepEquals(this.barcodes, other.barcodes) + } + + override fun hashCode(): Int { + return arrayOf( + barcodes + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(barcodes: Array): BarcodeScannerResult { + return BarcodeScannerResult(barcodes) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeValueTypeName.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeValueTypeName.kt new file mode 100644 index 0000000..ef833da --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BarcodeValueTypeName.kt @@ -0,0 +1,34 @@ +/// +/// BarcodeValueTypeName.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip + +/** + * Represents the JavaScript enum/union "BarcodeValueTypeName". + */ +@DoNotStrip +@Keep +enum class BarcodeValueTypeName(@DoNotStrip @Keep val value: Int) { + TYPE_UNKNOWN(0), + TYPE_CONTACT_INFO(1), + TYPE_EMAIL(2), + TYPE_ISBN(3), + TYPE_PHONE(4), + TYPE_PRODUCT(5), + TYPE_SMS(6), + TYPE_TEXT(7), + TYPE_URL(8), + TYPE_WIFI(9), + TYPE_GEO(10), + TYPE_CALENDAR_EVENT(11), + TYPE_DRIVER_LICENSE(12); + + companion object +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BoundingBox.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BoundingBox.kt new file mode 100644 index 0000000..2ccfc45 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/BoundingBox.kt @@ -0,0 +1,96 @@ +/// +/// BoundingBox.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "BoundingBox". + */ +@DoNotStrip +@Keep +data class BoundingBox( + @DoNotStrip + @Keep + val x: Double, + @DoNotStrip + @Keep + val y: Double, + @DoNotStrip + @Keep + val centerX: Double, + @DoNotStrip + @Keep + val centerY: Double, + @DoNotStrip + @Keep + val width: Double, + @DoNotStrip + @Keep + val height: Double, + @DoNotStrip + @Keep + val top: Double, + @DoNotStrip + @Keep + val left: Double, + @DoNotStrip + @Keep + val bottom: Double, + @DoNotStrip + @Keep + val right: Double +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is BoundingBox) return false + return Objects.deepEquals(this.x, other.x) + && Objects.deepEquals(this.y, other.y) + && Objects.deepEquals(this.centerX, other.centerX) + && Objects.deepEquals(this.centerY, other.centerY) + && Objects.deepEquals(this.width, other.width) + && Objects.deepEquals(this.height, other.height) + && Objects.deepEquals(this.top, other.top) + && Objects.deepEquals(this.left, other.left) + && Objects.deepEquals(this.bottom, other.bottom) + && Objects.deepEquals(this.right, other.right) + } + + override fun hashCode(): Int { + return arrayOf( + x, + y, + centerX, + centerY, + width, + height, + top, + left, + bottom, + right + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(x: Double, y: Double, centerX: Double, centerY: Double, width: Double, height: Double, top: Double, left: Double, bottom: Double, right: Double): BoundingBox { + return BoundingBox(x, y, centerX, centerY, width, height, top, left, bottom, right) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/Corner.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/Corner.kt new file mode 100644 index 0000000..3dfc9bc --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/Corner.kt @@ -0,0 +1,56 @@ +/// +/// Corner.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "Corner". + */ +@DoNotStrip +@Keep +data class Corner( + @DoNotStrip + @Keep + val x: Double, + @DoNotStrip + @Keep + val y: Double +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Corner) return false + return Objects.deepEquals(this.x, other.x) + && Objects.deepEquals(this.y, other.y) + } + + override fun hashCode(): Int { + return arrayOf( + x, + y + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(x: Double, y: Double): Corner { + return Corner(x, y) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/HybridBarcodeScannerSpec.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/HybridBarcodeScannerSpec.kt new file mode 100644 index 0000000..8ffcd0d --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/HybridBarcodeScannerSpec.kt @@ -0,0 +1,60 @@ +/// +/// HybridBarcodeScannerSpec.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.jni.HybridData +import com.facebook.proguard.annotations.DoNotStrip +import com.margelo.nitro.camera.HybridFrameSpec +import com.margelo.nitro.core.Promise +import com.margelo.nitro.core.HybridObject + +/** + * A Kotlin class representing the BarcodeScanner HybridObject. + * Implement this abstract class to create Kotlin-based instances of BarcodeScanner. + */ +@DoNotStrip +@Keep +@Suppress( + "KotlinJniMissingFunction", "unused", + "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet", + "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName" +) +abstract class HybridBarcodeScannerSpec: HybridObject() { + // Properties + + + // Methods + @DoNotStrip + @Keep + abstract fun recognize(frame: com.margelo.nitro.camera.HybridFrameSpec, args: MLKitBaseArguments?): BarcodeScannerResult + + @DoNotStrip + @Keep + abstract fun recognizeImage(uri: String): Promise + + // Default implementation of `HybridObject.toString()` + override fun toString(): String { + return "[HybridObject BarcodeScanner]" + } + + // C++ backing class + @DoNotStrip + @Keep + protected open class CxxPart(javaPart: HybridBarcodeScannerSpec): HybridObject.CxxPart(javaPart) { + // C++ JHybridBarcodeScannerSpec::CxxPart::initHybrid(...) + external override fun initHybrid(): HybridData + } + override fun createCxxPart(): CxxPart { + return CxxPart(this) + } + + companion object { + protected const val TAG = "HybridBarcodeScannerSpec" + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/HybridTextRecognizerSpec.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/HybridTextRecognizerSpec.kt new file mode 100644 index 0000000..ab6499a --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/HybridTextRecognizerSpec.kt @@ -0,0 +1,60 @@ +/// +/// HybridTextRecognizerSpec.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.jni.HybridData +import com.facebook.proguard.annotations.DoNotStrip +import com.margelo.nitro.camera.HybridFrameSpec +import com.margelo.nitro.core.Promise +import com.margelo.nitro.core.HybridObject + +/** + * A Kotlin class representing the TextRecognizer HybridObject. + * Implement this abstract class to create Kotlin-based instances of TextRecognizer. + */ +@DoNotStrip +@Keep +@Suppress( + "KotlinJniMissingFunction", "unused", + "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet", + "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName" +) +abstract class HybridTextRecognizerSpec: HybridObject() { + // Properties + + + // Methods + @DoNotStrip + @Keep + abstract fun recognize(frame: com.margelo.nitro.camera.HybridFrameSpec, args: MLKitBaseArguments?): TextRecognitionResult + + @DoNotStrip + @Keep + abstract fun recognizeImage(uri: String): Promise + + // Default implementation of `HybridObject.toString()` + override fun toString(): String { + return "[HybridObject TextRecognizer]" + } + + // C++ backing class + @DoNotStrip + @Keep + protected open class CxxPart(javaPart: HybridTextRecognizerSpec): HybridObject.CxxPart(javaPart) { + // C++ JHybridTextRecognizerSpec::CxxPart::initHybrid(...) + external override fun initHybrid(): HybridData + } + override fun createCxxPart(): CxxPart { + return CxxPart(this) + } + + companion object { + protected const val TAG = "HybridTextRecognizerSpec" + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/HybridVisionCameraMLKitSpec.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/HybridVisionCameraMLKitSpec.kt new file mode 100644 index 0000000..1708610 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/HybridVisionCameraMLKitSpec.kt @@ -0,0 +1,62 @@ +/// +/// HybridVisionCameraMLKitSpec.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.jni.HybridData +import com.facebook.proguard.annotations.DoNotStrip +import com.margelo.nitro.core.HybridObject + +/** + * A Kotlin class representing the VisionCameraMLKit HybridObject. + * Implement this abstract class to create Kotlin-based instances of VisionCameraMLKit. + */ +@DoNotStrip +@Keep +@Suppress( + "KotlinJniMissingFunction", "unused", + "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet", + "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName" +) +abstract class HybridVisionCameraMLKitSpec: HybridObject() { + // Properties + + + // Methods + @DoNotStrip + @Keep + abstract fun isFeatureAvailable(feature: MLKitFeature): Boolean + + @DoNotStrip + @Keep + abstract fun createTextRecognizer(options: TextRecognizerOptions): HybridTextRecognizerSpec + + @DoNotStrip + @Keep + abstract fun createBarcodeScanner(options: BarcodeScannerOptions): HybridBarcodeScannerSpec + + // Default implementation of `HybridObject.toString()` + override fun toString(): String { + return "[HybridObject VisionCameraMLKit]" + } + + // C++ backing class + @DoNotStrip + @Keep + protected open class CxxPart(javaPart: HybridVisionCameraMLKitSpec): HybridObject.CxxPart(javaPart) { + // C++ JHybridVisionCameraMLKitSpec::CxxPart::initHybrid(...) + external override fun initHybrid(): HybridData + } + override fun createCxxPart(): CxxPart { + return CxxPart(this) + } + + companion object { + protected const val TAG = "HybridVisionCameraMLKitSpec" + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/MLKitBaseArguments.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/MLKitBaseArguments.kt new file mode 100644 index 0000000..ef94e51 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/MLKitBaseArguments.kt @@ -0,0 +1,51 @@ +/// +/// MLKitBaseArguments.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "MLKitBaseArguments". + */ +@DoNotStrip +@Keep +data class MLKitBaseArguments( + @DoNotStrip + @Keep + val outputOrientation: Orientation? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is MLKitBaseArguments) return false + return Objects.deepEquals(this.outputOrientation, other.outputOrientation) + } + + override fun hashCode(): Int { + return arrayOf( + outputOrientation + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(outputOrientation: Orientation?): MLKitBaseArguments { + return MLKitBaseArguments(outputOrientation) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/MLKitFeature.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/MLKitFeature.kt new file mode 100644 index 0000000..abd7e6b --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/MLKitFeature.kt @@ -0,0 +1,32 @@ +/// +/// MLKitFeature.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip + +/** + * Represents the JavaScript enum/union "MLKitFeature". + */ +@DoNotStrip +@Keep +enum class MLKitFeature(@DoNotStrip @Keep val value: Int) { + TEXTRECOGNITION(0), + FACEDETECTION(1), + FACEMESHDETECTION(2), + POSEDETECTION(3), + SELFIESEGMENTATION(4), + SUBJECTSEGMENTATION(5), + DOCUMENTSCANNER(6), + BARCODESCANNING(7), + IMAGELABELING(8), + OBJECTDETECTION(9), + DIGITALINKRECOGNITION(10); + + companion object +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/Orientation.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/Orientation.kt new file mode 100644 index 0000000..603ec61 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/Orientation.kt @@ -0,0 +1,25 @@ +/// +/// Orientation.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip + +/** + * Represents the JavaScript enum/union "Orientation". + */ +@DoNotStrip +@Keep +enum class Orientation(@DoNotStrip @Keep val value: Int) { + PORTRAIT(0), + PORTRAIT_UPSIDE_DOWN(1), + LANDSCAPE_LEFT(2), + LANDSCAPE_RIGHT(3); + + companion object +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/RegionOfInterest.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/RegionOfInterest.kt new file mode 100644 index 0000000..776b400 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/RegionOfInterest.kt @@ -0,0 +1,71 @@ +/// +/// RegionOfInterest.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "RegionOfInterest". + */ +@DoNotStrip +@Keep +data class RegionOfInterest( + @DoNotStrip + @Keep + val x: Double, + @DoNotStrip + @Keep + val y: Double, + @DoNotStrip + @Keep + val width: Double, + @DoNotStrip + @Keep + val height: Double, + @DoNotStrip + @Keep + val unit: RegionOfInterestUnit? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is RegionOfInterest) return false + return Objects.deepEquals(this.x, other.x) + && Objects.deepEquals(this.y, other.y) + && Objects.deepEquals(this.width, other.width) + && Objects.deepEquals(this.height, other.height) + && Objects.deepEquals(this.unit, other.unit) + } + + override fun hashCode(): Int { + return arrayOf( + x, + y, + width, + height, + unit + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(x: Double, y: Double, width: Double, height: Double, unit: RegionOfInterestUnit?): RegionOfInterest { + return RegionOfInterest(x, y, width, height, unit) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/RegionOfInterestUnit.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/RegionOfInterestUnit.kt new file mode 100644 index 0000000..3cf1a6f --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/RegionOfInterestUnit.kt @@ -0,0 +1,23 @@ +/// +/// RegionOfInterestUnit.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip + +/** + * Represents the JavaScript enum/union "RegionOfInterestUnit". + */ +@DoNotStrip +@Keep +enum class RegionOfInterestUnit(@DoNotStrip @Keep val value: Int) { + NORMALIZED(0), + PIXEL(1); + + companion object +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextBlock.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextBlock.kt new file mode 100644 index 0000000..11b406e --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextBlock.kt @@ -0,0 +1,71 @@ +/// +/// TextBlock.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "TextBlock". + */ +@DoNotStrip +@Keep +data class TextBlock( + @DoNotStrip + @Keep + val bounds: BoundingBox, + @DoNotStrip + @Keep + val corners: Array, + @DoNotStrip + @Keep + val languages: Array, + @DoNotStrip + @Keep + val text: String, + @DoNotStrip + @Keep + val lines: Array +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is TextBlock) return false + return Objects.deepEquals(this.bounds, other.bounds) + && Objects.deepEquals(this.corners, other.corners) + && Objects.deepEquals(this.languages, other.languages) + && Objects.deepEquals(this.text, other.text) + && Objects.deepEquals(this.lines, other.lines) + } + + override fun hashCode(): Int { + return arrayOf( + bounds, + corners, + languages, + text, + lines + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(bounds: BoundingBox, corners: Array, languages: Array, text: String, lines: Array): TextBlock { + return TextBlock(bounds, corners, languages, text, lines) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextElement.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextElement.kt new file mode 100644 index 0000000..9d11599 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextElement.kt @@ -0,0 +1,81 @@ +/// +/// TextElement.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects +import com.margelo.nitro.core.NullType + +/** + * Represents the JavaScript object/struct "TextElement". + */ +@DoNotStrip +@Keep +data class TextElement( + @DoNotStrip + @Keep + val bounds: BoundingBox, + @DoNotStrip + @Keep + val corners: Array, + @DoNotStrip + @Keep + val confidence: Variant_NullType_Double?, + @DoNotStrip + @Keep + val angle: Variant_NullType_Double?, + @DoNotStrip + @Keep + val languages: Array, + @DoNotStrip + @Keep + val text: String, + @DoNotStrip + @Keep + val symbols: Array +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is TextElement) return false + return Objects.deepEquals(this.bounds, other.bounds) + && Objects.deepEquals(this.corners, other.corners) + && Objects.deepEquals(this.confidence, other.confidence) + && Objects.deepEquals(this.angle, other.angle) + && Objects.deepEquals(this.languages, other.languages) + && Objects.deepEquals(this.text, other.text) + && Objects.deepEquals(this.symbols, other.symbols) + } + + override fun hashCode(): Int { + return arrayOf( + bounds, + corners, + confidence, + angle, + languages, + text, + symbols + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(bounds: BoundingBox, corners: Array, confidence: Variant_NullType_Double?, angle: Variant_NullType_Double?, languages: Array, text: String, symbols: Array): TextElement { + return TextElement(bounds, corners, confidence, angle, languages, text, symbols) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextLine.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextLine.kt new file mode 100644 index 0000000..3e85714 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextLine.kt @@ -0,0 +1,81 @@ +/// +/// TextLine.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects +import com.margelo.nitro.core.NullType + +/** + * Represents the JavaScript object/struct "TextLine". + */ +@DoNotStrip +@Keep +data class TextLine( + @DoNotStrip + @Keep + val bounds: BoundingBox, + @DoNotStrip + @Keep + val corners: Array, + @DoNotStrip + @Keep + val confidence: Variant_NullType_Double?, + @DoNotStrip + @Keep + val angle: Variant_NullType_Double?, + @DoNotStrip + @Keep + val languages: Array, + @DoNotStrip + @Keep + val text: String, + @DoNotStrip + @Keep + val elements: Array +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is TextLine) return false + return Objects.deepEquals(this.bounds, other.bounds) + && Objects.deepEquals(this.corners, other.corners) + && Objects.deepEquals(this.confidence, other.confidence) + && Objects.deepEquals(this.angle, other.angle) + && Objects.deepEquals(this.languages, other.languages) + && Objects.deepEquals(this.text, other.text) + && Objects.deepEquals(this.elements, other.elements) + } + + override fun hashCode(): Int { + return arrayOf( + bounds, + corners, + confidence, + angle, + languages, + text, + elements + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(bounds: BoundingBox, corners: Array, confidence: Variant_NullType_Double?, angle: Variant_NullType_Double?, languages: Array, text: String, elements: Array): TextLine { + return TextLine(bounds, corners, confidence, angle, languages, text, elements) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextRecognitionLanguage.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextRecognitionLanguage.kt new file mode 100644 index 0000000..40d14a2 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextRecognitionLanguage.kt @@ -0,0 +1,26 @@ +/// +/// TextRecognitionLanguage.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip + +/** + * Represents the JavaScript enum/union "TextRecognitionLanguage". + */ +@DoNotStrip +@Keep +enum class TextRecognitionLanguage(@DoNotStrip @Keep val value: Int) { + LATIN(0), + CHINESE(1), + DEVANAGARI(2), + JAPANESE(3), + KOREAN(4); + + companion object +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextRecognitionResult.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextRecognitionResult.kt new file mode 100644 index 0000000..cd7a232 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextRecognitionResult.kt @@ -0,0 +1,56 @@ +/// +/// TextRecognitionResult.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "TextRecognitionResult". + */ +@DoNotStrip +@Keep +data class TextRecognitionResult( + @DoNotStrip + @Keep + val text: String, + @DoNotStrip + @Keep + val blocks: Array +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is TextRecognitionResult) return false + return Objects.deepEquals(this.text, other.text) + && Objects.deepEquals(this.blocks, other.blocks) + } + + override fun hashCode(): Int { + return arrayOf( + text, + blocks + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(text: String, blocks: Array): TextRecognitionResult { + return TextRecognitionResult(text, blocks) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextRecognizerOptions.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextRecognizerOptions.kt new file mode 100644 index 0000000..7467558 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextRecognizerOptions.kt @@ -0,0 +1,76 @@ +/// +/// TextRecognizerOptions.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "TextRecognizerOptions". + */ +@DoNotStrip +@Keep +data class TextRecognizerOptions( + @DoNotStrip + @Keep + val language: TextRecognitionLanguage?, + @DoNotStrip + @Keep + val scaleFactor: Double?, + @DoNotStrip + @Keep + val invertColors: Boolean?, + @DoNotStrip + @Keep + val frameProcessInterval: Double?, + @DoNotStrip + @Keep + val roi: RegionOfInterest?, + @DoNotStrip + @Keep + val orientation: Orientation? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is TextRecognizerOptions) return false + return Objects.deepEquals(this.language, other.language) + && Objects.deepEquals(this.scaleFactor, other.scaleFactor) + && Objects.deepEquals(this.invertColors, other.invertColors) + && Objects.deepEquals(this.frameProcessInterval, other.frameProcessInterval) + && Objects.deepEquals(this.roi, other.roi) + && Objects.deepEquals(this.orientation, other.orientation) + } + + override fun hashCode(): Int { + return arrayOf( + language, + scaleFactor, + invertColors, + frameProcessInterval, + roi, + orientation + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(language: TextRecognitionLanguage?, scaleFactor: Double?, invertColors: Boolean?, frameProcessInterval: Double?, roi: RegionOfInterest?, orientation: Orientation?): TextRecognizerOptions { + return TextRecognizerOptions(language, scaleFactor, invertColors, frameProcessInterval, roi, orientation) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextSymbol.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextSymbol.kt new file mode 100644 index 0000000..a9c70e2 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/TextSymbol.kt @@ -0,0 +1,76 @@ +/// +/// TextSymbol.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "TextSymbol". + */ +@DoNotStrip +@Keep +data class TextSymbol( + @DoNotStrip + @Keep + val bounds: BoundingBox, + @DoNotStrip + @Keep + val corners: Array, + @DoNotStrip + @Keep + val confidence: Double, + @DoNotStrip + @Keep + val angle: Double, + @DoNotStrip + @Keep + val languages: Array, + @DoNotStrip + @Keep + val text: String +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is TextSymbol) return false + return Objects.deepEquals(this.bounds, other.bounds) + && Objects.deepEquals(this.corners, other.corners) + && Objects.deepEquals(this.confidence, other.confidence) + && Objects.deepEquals(this.angle, other.angle) + && Objects.deepEquals(this.languages, other.languages) + && Objects.deepEquals(this.text, other.text) + } + + override fun hashCode(): Int { + return arrayOf( + bounds, + corners, + confidence, + angle, + languages, + text + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(bounds: BoundingBox, corners: Array, confidence: Double, angle: Double, languages: Array, text: String): TextSymbol { + return TextSymbol(bounds, corners, confidence, angle, languages, text) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/Variant_NullType_Double.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/Variant_NullType_Double.kt new file mode 100644 index 0000000..1c1deef --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/Variant_NullType_Double.kt @@ -0,0 +1,62 @@ +/// +/// Variant_NullType_Double.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import com.facebook.proguard.annotations.DoNotStrip +import com.margelo.nitro.core.NullType + +/** + * Represents the TypeScript variant "NullType | Double". + */ +@Suppress("ClassName") +@DoNotStrip +sealed class Variant_NullType_Double { + @DoNotStrip + data class First(@DoNotStrip val value: NullType): Variant_NullType_Double() + @DoNotStrip + data class Second(@DoNotStrip val value: Double): Variant_NullType_Double() + + inline fun asType(): T? { + return when (this) { + is First -> (value) as? T + is Second -> (value) as? T + } + } + inline fun isType(): Boolean { + return asType() != null + } + inline fun match(first: (NullType) -> R, second: (Double) -> R): R { + return when (this) { + is First -> first(value) + is Second -> second(value) + } + } + + val isFirst: Boolean + get() = this is First + val isSecond: Boolean + get() = this is Second + + fun asFirstOrNull(): NullType? { + val value = (this as? First)?.value ?: return null + return value + } + fun asSecondOrNull(): Double? { + val value = (this as? Second)?.value ?: return null + return value + } + + companion object { + @JvmStatic + @DoNotStrip + fun create(value: NullType): Variant_NullType_Double = First(value) + @JvmStatic + @DoNotStrip + fun create(value: Double): Variant_NullType_Double = Second(value) + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/VisionCameraMLKitOnLoad.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/VisionCameraMLKitOnLoad.kt new file mode 100644 index 0000000..e63a5bf --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/visioncameramlkit/VisionCameraMLKitOnLoad.kt @@ -0,0 +1,35 @@ +/// +/// VisionCameraMLKitOnLoad.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.visioncameramlkit + +import android.util.Log + +internal class VisionCameraMLKitOnLoad { + companion object { + private const val TAG = "VisionCameraMLKitOnLoad" + private var didLoad = false + /** + * Initializes the native part of "VisionCameraMLKit". + * This method is idempotent and can be called more than once. + */ + @JvmStatic + fun initializeNative() { + if (didLoad) return + try { + Log.i(TAG, "Loading VisionCameraMLKit C++ library...") + System.loadLibrary("VisionCameraMLKit") + Log.i(TAG, "Successfully loaded VisionCameraMLKit C++ library!") + didLoad = true + } catch (e: Error) { + Log.e(TAG, "Failed to load VisionCameraMLKit C++ library! Is it properly installed and linked? " + + "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e) + throw e + } + } + } +} diff --git a/nitrogen/generated/ios/VisionCameraMLKit+autolinking.rb b/nitrogen/generated/ios/VisionCameraMLKit+autolinking.rb new file mode 100644 index 0000000..2d1a84f --- /dev/null +++ b/nitrogen/generated/ios/VisionCameraMLKit+autolinking.rb @@ -0,0 +1,62 @@ +# +# VisionCameraMLKit+autolinking.rb +# This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +# https://github.com/mrousavy/nitro +# Copyright © Marc Rousavy @ Margelo +# + +# This is a Ruby script that adds all files generated by Nitrogen +# to the given podspec. +# +# To use it, add this to your .podspec: +# ```ruby +# Pod::Spec.new do |spec| +# # ... +# +# # Add all files generated by Nitrogen +# load 'nitrogen/generated/ios/VisionCameraMLKit+autolinking.rb' +# add_nitrogen_files(spec) +# end +# ``` + +def add_nitrogen_files(spec) + Pod::UI.puts "[NitroModules] 🔥 VisionCameraMLKit is boosted by nitro!" + + spec.dependency "NitroModules" + + current_source_files = Array(spec.attributes_hash['source_files']) + spec.source_files = current_source_files + [ + # Generated cross-platform specs + "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}", + # Generated bridges for the cross-platform specs + "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}", + ] + + current_public_header_files = Array(spec.attributes_hash['public_header_files']) + spec.public_header_files = current_public_header_files + [ + # Generated specs + "nitrogen/generated/shared/**/*.{h,hpp}", + # Swift to C++ bridging helpers + "nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Bridge.hpp" + ] + + current_private_header_files = Array(spec.attributes_hash['private_header_files']) + spec.private_header_files = current_private_header_files + [ + # iOS specific specs + "nitrogen/generated/ios/c++/**/*.{h,hpp}", + # Views are framework-specific and should be private + "nitrogen/generated/shared/**/views/**/*" + ] + + current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {} + spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({ + # Use C++ 20 + "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", + # Enables C++ <-> Swift interop (by default it's only ObjC) + "SWIFT_OBJC_INTEROP_MODE" => "objcxx", + # Enables stricter modular headers + "DEFINES_MODULE" => "YES", + # Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here) + "SWIFT_INSTALL_OBJC_HEADER" => "NO", + }) +end diff --git a/nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Bridge.cpp b/nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Bridge.cpp new file mode 100644 index 0000000..627efef --- /dev/null +++ b/nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Bridge.cpp @@ -0,0 +1,102 @@ +/// +/// VisionCameraMLKit-Swift-Cxx-Bridge.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "VisionCameraMLKit-Swift-Cxx-Bridge.hpp" + +// Include C++ implementation defined types +#include "HybridBarcodeScannerSpecSwift.hpp" +#include "HybridTextRecognizerSpecSwift.hpp" +#include "HybridVisionCameraMLKitSpecSwift.hpp" +#include "VisionCameraMLKit-Swift-Cxx-Umbrella.hpp" +#include +#include + +namespace margelo::nitro::visioncameramlkit::bridge::swift { + + // pragma MARK: std::shared_ptr + std::shared_ptr create_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(void* NON_NULL swiftUnsafePointer) noexcept { + // Implemented in VisionCamera + return margelo::nitro::camera::bridge::swift::create_std__shared_ptr_HybridFrameSpec_(swiftUnsafePointer); + } + void* NON_NULL get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_ cppType) { + // Implemented in VisionCamera + return margelo::nitro::camera::bridge::swift::get_std__shared_ptr_HybridFrameSpec_(cppType); + } + + // pragma MARK: std::function + Func_void_BarcodeScannerResult create_Func_void_BarcodeScannerResult(void* NON_NULL swiftClosureWrapper) noexcept { + auto swiftClosure = VisionCameraMLKit::Func_void_BarcodeScannerResult::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)](const BarcodeScannerResult& result) mutable -> void { + swiftClosure.call(result); + }; + } + + // pragma MARK: std::function + Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept { + auto swiftClosure = VisionCameraMLKit::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void { + swiftClosure.call(error); + }; + } + + // pragma MARK: std::shared_ptr + std::shared_ptr create_std__shared_ptr_HybridBarcodeScannerSpec_(void* NON_NULL swiftUnsafePointer) noexcept { + VisionCameraMLKit::HybridBarcodeScannerSpec_cxx swiftPart = VisionCameraMLKit::HybridBarcodeScannerSpec_cxx::fromUnsafe(swiftUnsafePointer); + return std::make_shared(swiftPart); + } + void* NON_NULL get_std__shared_ptr_HybridBarcodeScannerSpec_(std__shared_ptr_HybridBarcodeScannerSpec_ cppType) { + std::shared_ptr swiftWrapper = std::dynamic_pointer_cast(cppType); + #ifdef NITRO_DEBUG + if (swiftWrapper == nullptr) [[unlikely]] { + throw std::runtime_error("Class \"HybridBarcodeScannerSpec\" is not implemented in Swift!"); + } + #endif + VisionCameraMLKit::HybridBarcodeScannerSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + return swiftPart.toUnsafe(); + } + + // pragma MARK: std::function + Func_void_TextRecognitionResult create_Func_void_TextRecognitionResult(void* NON_NULL swiftClosureWrapper) noexcept { + auto swiftClosure = VisionCameraMLKit::Func_void_TextRecognitionResult::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)](const TextRecognitionResult& result) mutable -> void { + swiftClosure.call(result); + }; + } + + // pragma MARK: std::shared_ptr + std::shared_ptr create_std__shared_ptr_HybridTextRecognizerSpec_(void* NON_NULL swiftUnsafePointer) noexcept { + VisionCameraMLKit::HybridTextRecognizerSpec_cxx swiftPart = VisionCameraMLKit::HybridTextRecognizerSpec_cxx::fromUnsafe(swiftUnsafePointer); + return std::make_shared(swiftPart); + } + void* NON_NULL get_std__shared_ptr_HybridTextRecognizerSpec_(std__shared_ptr_HybridTextRecognizerSpec_ cppType) { + std::shared_ptr swiftWrapper = std::dynamic_pointer_cast(cppType); + #ifdef NITRO_DEBUG + if (swiftWrapper == nullptr) [[unlikely]] { + throw std::runtime_error("Class \"HybridTextRecognizerSpec\" is not implemented in Swift!"); + } + #endif + VisionCameraMLKit::HybridTextRecognizerSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + return swiftPart.toUnsafe(); + } + + // pragma MARK: std::shared_ptr + std::shared_ptr create_std__shared_ptr_HybridVisionCameraMLKitSpec_(void* NON_NULL swiftUnsafePointer) noexcept { + VisionCameraMLKit::HybridVisionCameraMLKitSpec_cxx swiftPart = VisionCameraMLKit::HybridVisionCameraMLKitSpec_cxx::fromUnsafe(swiftUnsafePointer); + return std::make_shared(swiftPart); + } + void* NON_NULL get_std__shared_ptr_HybridVisionCameraMLKitSpec_(std__shared_ptr_HybridVisionCameraMLKitSpec_ cppType) { + std::shared_ptr swiftWrapper = std::dynamic_pointer_cast(cppType); + #ifdef NITRO_DEBUG + if (swiftWrapper == nullptr) [[unlikely]] { + throw std::runtime_error("Class \"HybridVisionCameraMLKitSpec\" is not implemented in Swift!"); + } + #endif + VisionCameraMLKit::HybridVisionCameraMLKitSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + return swiftPart.toUnsafe(); + } + +} // namespace margelo::nitro::visioncameramlkit::bridge::swift diff --git a/nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Bridge.hpp b/nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Bridge.hpp new file mode 100644 index 0000000..1b0992a --- /dev/null +++ b/nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Bridge.hpp @@ -0,0 +1,641 @@ +/// +/// VisionCameraMLKit-Swift-Cxx-Bridge.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +// Forward declarations of C++ defined types +// Forward declaration of `BarcodeFormat` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeFormat; } +// Forward declaration of `BarcodeScannerBarcode` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerBarcode; } +// Forward declaration of `BarcodeScannerResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerResult; } +// Forward declaration of `BarcodeValueTypeName` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeValueTypeName; } +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `HybridBarcodeScannerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridBarcodeScannerSpec; } +// Forward declaration of `HybridFrameSpec` to properly resolve imports. +namespace margelo::nitro::camera { class HybridFrameSpec; } +// Forward declaration of `HybridTextRecognizerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridTextRecognizerSpec; } +// Forward declaration of `HybridVisionCameraMLKitSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridVisionCameraMLKitSpec; } +// Forward declaration of `MLKitBaseArguments` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct MLKitBaseArguments; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } +// Forward declaration of `RegionOfInterestUnit` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class RegionOfInterestUnit; } +// Forward declaration of `RegionOfInterest` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct RegionOfInterest; } +// Forward declaration of `TextBlock` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextBlock; } +// Forward declaration of `TextElement` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextElement; } +// Forward declaration of `TextLine` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextLine; } +// Forward declaration of `TextRecognitionLanguage` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class TextRecognitionLanguage; } +// Forward declaration of `TextRecognitionResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextRecognitionResult; } +// Forward declaration of `TextSymbol` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextSymbol; } + +// Forward declarations of Swift defined types +// Forward declaration of `HybridBarcodeScannerSpec_cxx` to properly resolve imports. +namespace VisionCameraMLKit { class HybridBarcodeScannerSpec_cxx; } +// Forward declaration of `HybridFrameSpec_cxx` to properly resolve imports. +namespace VisionCamera { class HybridFrameSpec_cxx; } +// Forward declaration of `HybridTextRecognizerSpec_cxx` to properly resolve imports. +namespace VisionCameraMLKit { class HybridTextRecognizerSpec_cxx; } +// Forward declaration of `HybridVisionCameraMLKitSpec_cxx` to properly resolve imports. +namespace VisionCameraMLKit { class HybridVisionCameraMLKitSpec_cxx; } + +// Include C++ defined types +#include "BarcodeFormat.hpp" +#include "BarcodeScannerBarcode.hpp" +#include "BarcodeScannerResult.hpp" +#include "BarcodeValueTypeName.hpp" +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "HybridBarcodeScannerSpec.hpp" +#include "HybridTextRecognizerSpec.hpp" +#include "HybridVisionCameraMLKitSpec.hpp" +#include "MLKitBaseArguments.hpp" +#include "Orientation.hpp" +#include "RegionOfInterest.hpp" +#include "RegionOfInterestUnit.hpp" +#include "TextBlock.hpp" +#include "TextElement.hpp" +#include "TextLine.hpp" +#include "TextRecognitionLanguage.hpp" +#include "TextRecognitionResult.hpp" +#include "TextSymbol.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * Contains specialized versions of C++ templated types so they can be accessed from Swift, + * as well as helper functions to interact with those C++ types from Swift. + */ +namespace margelo::nitro::visioncameramlkit::bridge::swift { + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_BoundingBox_ = std::optional; + inline std::optional create_std__optional_BoundingBox_(const BoundingBox& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_BoundingBox_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline BoundingBox get_std__optional_BoundingBox_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_Corner_ = std::vector; + inline std::vector create_std__vector_Corner_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::optional> + /** + * Specialized version of `std::optional>`. + */ + using std__optional_std__vector_Corner__ = std::optional>; + inline std::optional> create_std__optional_std__vector_Corner__(const std::vector& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__vector_Corner__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::vector get_std__optional_std__vector_Corner__(const std::optional>& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_std__string_ = std::optional; + inline std::optional create_std__optional_std__string_(const std::string& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_std__string_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline std::string get_std__optional_std__string_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_double_ = std::vector; + inline std::vector create_std__vector_double_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::optional> + /** + * Specialized version of `std::optional>`. + */ + using std__optional_std__vector_double__ = std::optional>; + inline std::optional> create_std__optional_std__vector_double__(const std::vector& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__vector_double__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::vector get_std__optional_std__vector_double__(const std::optional>& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::optional> + /** + * Specialized version of `std::optional>`. + */ + using std__optional_std__shared_ptr_AnyMap__ = std::optional>; + inline std::optional> create_std__optional_std__shared_ptr_AnyMap__(const std::shared_ptr& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__shared_ptr_AnyMap__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::shared_ptr get_std__optional_std__shared_ptr_AnyMap__(const std::optional>& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_BarcodeScannerBarcode_ = std::vector; + inline std::vector create_std__vector_BarcodeScannerBarcode_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::shared_ptr + /** + * Specialized version of `std::shared_ptr`. + */ + using std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_ = std::shared_ptr; + std::shared_ptr create_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(void* NON_NULL swiftUnsafePointer) noexcept; + void* NON_NULL get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_ cppType); + + // pragma MARK: std::weak_ptr + using std__weak_ptr_margelo__nitro__camera__HybridFrameSpec_ = std::weak_ptr; + inline std__weak_ptr_margelo__nitro__camera__HybridFrameSpec_ weakify_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(const std::shared_ptr& strong) noexcept { return strong; } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_Orientation_ = std::optional; + inline std::optional create_std__optional_Orientation_(const Orientation& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_Orientation_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline Orientation get_std__optional_Orientation_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_MLKitBaseArguments_ = std::optional; + inline std::optional create_std__optional_MLKitBaseArguments_(const MLKitBaseArguments& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_MLKitBaseArguments_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline MLKitBaseArguments get_std__optional_MLKitBaseArguments_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::shared_ptr> + /** + * Specialized version of `std::shared_ptr>`. + */ + using std__shared_ptr_Promise_BarcodeScannerResult__ = std::shared_ptr>; + inline std::shared_ptr> create_std__shared_ptr_Promise_BarcodeScannerResult__() noexcept { + return Promise::create(); + } + inline PromiseHolder wrap_std__shared_ptr_Promise_BarcodeScannerResult__(std::shared_ptr> promise) noexcept { + return PromiseHolder(std::move(promise)); + } + + // pragma MARK: std::function + /** + * Specialized version of `std::function`. + */ + using Func_void_BarcodeScannerResult = std::function; + /** + * Wrapper class for a `std::function`, this can be used from Swift. + */ + class Func_void_BarcodeScannerResult_Wrapper final { + public: + explicit Func_void_BarcodeScannerResult_Wrapper(std::function&& func): _function(std::make_unique>(std::move(func))) {} + inline void call(BarcodeScannerResult result) const noexcept { + _function->operator()(result); + } + private: + std::unique_ptr> _function; + } SWIFT_NONCOPYABLE; + Func_void_BarcodeScannerResult create_Func_void_BarcodeScannerResult(void* NON_NULL swiftClosureWrapper) noexcept; + inline Func_void_BarcodeScannerResult_Wrapper wrap_Func_void_BarcodeScannerResult(Func_void_BarcodeScannerResult value) noexcept { + return Func_void_BarcodeScannerResult_Wrapper(std::move(value)); + } + + // pragma MARK: std::function + /** + * Specialized version of `std::function`. + */ + using Func_void_std__exception_ptr = std::function; + /** + * Wrapper class for a `std::function`, this can be used from Swift. + */ + class Func_void_std__exception_ptr_Wrapper final { + public: + explicit Func_void_std__exception_ptr_Wrapper(std::function&& func): _function(std::make_unique>(std::move(func))) {} + inline void call(std::exception_ptr error) const noexcept { + _function->operator()(error); + } + private: + std::unique_ptr> _function; + } SWIFT_NONCOPYABLE; + Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept; + inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept { + return Func_void_std__exception_ptr_Wrapper(std::move(value)); + } + + // pragma MARK: std::shared_ptr + /** + * Specialized version of `std::shared_ptr`. + */ + using std__shared_ptr_HybridBarcodeScannerSpec_ = std::shared_ptr; + std::shared_ptr create_std__shared_ptr_HybridBarcodeScannerSpec_(void* NON_NULL swiftUnsafePointer) noexcept; + void* NON_NULL get_std__shared_ptr_HybridBarcodeScannerSpec_(std__shared_ptr_HybridBarcodeScannerSpec_ cppType); + + // pragma MARK: std::weak_ptr + using std__weak_ptr_HybridBarcodeScannerSpec_ = std::weak_ptr; + inline std__weak_ptr_HybridBarcodeScannerSpec_ weakify_std__shared_ptr_HybridBarcodeScannerSpec_(const std::shared_ptr& strong) noexcept { return strong; } + + // pragma MARK: Result + using Result_BarcodeScannerResult_ = Result; + inline Result_BarcodeScannerResult_ create_Result_BarcodeScannerResult_(const BarcodeScannerResult& value) noexcept { + return Result::withValue(value); + } + inline Result_BarcodeScannerResult_ create_Result_BarcodeScannerResult_(const std::exception_ptr& error) noexcept { + return Result::withError(error); + } + + // pragma MARK: Result>> + using Result_std__shared_ptr_Promise_BarcodeScannerResult___ = Result>>; + inline Result_std__shared_ptr_Promise_BarcodeScannerResult___ create_Result_std__shared_ptr_Promise_BarcodeScannerResult___(const std::shared_ptr>& value) noexcept { + return Result>>::withValue(value); + } + inline Result_std__shared_ptr_Promise_BarcodeScannerResult___ create_Result_std__shared_ptr_Promise_BarcodeScannerResult___(const std::exception_ptr& error) noexcept { + return Result>>::withError(error); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_std__string_ = std::vector; + inline std::vector create_std__vector_std__string_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::variant + /** + * Wrapper struct for `std::variant`. + * std::variant cannot be used in Swift because of a Swift bug. + * Not even specializing it works. So we create a wrapper struct. + */ + struct std__variant_nitro__NullType__double_ final { + std::variant variant; + std__variant_nitro__NullType__double_(std::variant variant): variant(variant) { } + operator std::variant() const noexcept { + return variant; + } + inline size_t index() const noexcept { + return variant.index(); + } + inline nitro::NullType get_0() const noexcept { + return std::get<0>(variant); + } + inline double get_1() const noexcept { + return std::get<1>(variant); + } + }; + inline std__variant_nitro__NullType__double_ create_std__variant_nitro__NullType__double_(nitro::NullType value) noexcept { + return std__variant_nitro__NullType__double_(value); + } + inline std__variant_nitro__NullType__double_ create_std__variant_nitro__NullType__double_(double value) noexcept { + return std__variant_nitro__NullType__double_(value); + } + + // pragma MARK: std::optional> + /** + * Specialized version of `std::optional>`. + */ + using std__optional_std__variant_nitro__NullType__double__ = std::optional>; + inline std::optional> create_std__optional_std__variant_nitro__NullType__double__(const std::variant& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__variant_nitro__NullType__double__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::variant get_std__optional_std__variant_nitro__NullType__double__(const std::optional>& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_TextSymbol_ = std::vector; + inline std::vector create_std__vector_TextSymbol_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_TextElement_ = std::vector; + inline std::vector create_std__vector_TextElement_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_TextLine_ = std::vector; + inline std::vector create_std__vector_TextLine_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_TextBlock_ = std::vector; + inline std::vector create_std__vector_TextBlock_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::shared_ptr> + /** + * Specialized version of `std::shared_ptr>`. + */ + using std__shared_ptr_Promise_TextRecognitionResult__ = std::shared_ptr>; + inline std::shared_ptr> create_std__shared_ptr_Promise_TextRecognitionResult__() noexcept { + return Promise::create(); + } + inline PromiseHolder wrap_std__shared_ptr_Promise_TextRecognitionResult__(std::shared_ptr> promise) noexcept { + return PromiseHolder(std::move(promise)); + } + + // pragma MARK: std::function + /** + * Specialized version of `std::function`. + */ + using Func_void_TextRecognitionResult = std::function; + /** + * Wrapper class for a `std::function`, this can be used from Swift. + */ + class Func_void_TextRecognitionResult_Wrapper final { + public: + explicit Func_void_TextRecognitionResult_Wrapper(std::function&& func): _function(std::make_unique>(std::move(func))) {} + inline void call(TextRecognitionResult result) const noexcept { + _function->operator()(result); + } + private: + std::unique_ptr> _function; + } SWIFT_NONCOPYABLE; + Func_void_TextRecognitionResult create_Func_void_TextRecognitionResult(void* NON_NULL swiftClosureWrapper) noexcept; + inline Func_void_TextRecognitionResult_Wrapper wrap_Func_void_TextRecognitionResult(Func_void_TextRecognitionResult value) noexcept { + return Func_void_TextRecognitionResult_Wrapper(std::move(value)); + } + + // pragma MARK: std::shared_ptr + /** + * Specialized version of `std::shared_ptr`. + */ + using std__shared_ptr_HybridTextRecognizerSpec_ = std::shared_ptr; + std::shared_ptr create_std__shared_ptr_HybridTextRecognizerSpec_(void* NON_NULL swiftUnsafePointer) noexcept; + void* NON_NULL get_std__shared_ptr_HybridTextRecognizerSpec_(std__shared_ptr_HybridTextRecognizerSpec_ cppType); + + // pragma MARK: std::weak_ptr + using std__weak_ptr_HybridTextRecognizerSpec_ = std::weak_ptr; + inline std__weak_ptr_HybridTextRecognizerSpec_ weakify_std__shared_ptr_HybridTextRecognizerSpec_(const std::shared_ptr& strong) noexcept { return strong; } + + // pragma MARK: Result + using Result_TextRecognitionResult_ = Result; + inline Result_TextRecognitionResult_ create_Result_TextRecognitionResult_(const TextRecognitionResult& value) noexcept { + return Result::withValue(value); + } + inline Result_TextRecognitionResult_ create_Result_TextRecognitionResult_(const std::exception_ptr& error) noexcept { + return Result::withError(error); + } + + // pragma MARK: Result>> + using Result_std__shared_ptr_Promise_TextRecognitionResult___ = Result>>; + inline Result_std__shared_ptr_Promise_TextRecognitionResult___ create_Result_std__shared_ptr_Promise_TextRecognitionResult___(const std::shared_ptr>& value) noexcept { + return Result>>::withValue(value); + } + inline Result_std__shared_ptr_Promise_TextRecognitionResult___ create_Result_std__shared_ptr_Promise_TextRecognitionResult___(const std::exception_ptr& error) noexcept { + return Result>>::withError(error); + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_TextRecognitionLanguage_ = std::optional; + inline std::optional create_std__optional_TextRecognitionLanguage_(const TextRecognitionLanguage& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_TextRecognitionLanguage_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline TextRecognitionLanguage get_std__optional_TextRecognitionLanguage_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_double_ = std::optional; + inline std::optional create_std__optional_double_(const double& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_double_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline double get_std__optional_double_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_bool_ = std::optional; + inline std::optional create_std__optional_bool_(const bool& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_bool_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline bool get_std__optional_bool_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_RegionOfInterestUnit_ = std::optional; + inline std::optional create_std__optional_RegionOfInterestUnit_(const RegionOfInterestUnit& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_RegionOfInterestUnit_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline RegionOfInterestUnit get_std__optional_RegionOfInterestUnit_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_RegionOfInterest_ = std::optional; + inline std::optional create_std__optional_RegionOfInterest_(const RegionOfInterest& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_RegionOfInterest_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline RegionOfInterest get_std__optional_RegionOfInterest_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_BarcodeFormat_ = std::vector; + inline std::vector create_std__vector_BarcodeFormat_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::optional> + /** + * Specialized version of `std::optional>`. + */ + using std__optional_std__vector_BarcodeFormat__ = std::optional>; + inline std::optional> create_std__optional_std__vector_BarcodeFormat__(const std::vector& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__vector_BarcodeFormat__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::vector get_std__optional_std__vector_BarcodeFormat__(const std::optional>& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::shared_ptr + /** + * Specialized version of `std::shared_ptr`. + */ + using std__shared_ptr_HybridVisionCameraMLKitSpec_ = std::shared_ptr; + std::shared_ptr create_std__shared_ptr_HybridVisionCameraMLKitSpec_(void* NON_NULL swiftUnsafePointer) noexcept; + void* NON_NULL get_std__shared_ptr_HybridVisionCameraMLKitSpec_(std__shared_ptr_HybridVisionCameraMLKitSpec_ cppType); + + // pragma MARK: std::weak_ptr + using std__weak_ptr_HybridVisionCameraMLKitSpec_ = std::weak_ptr; + inline std__weak_ptr_HybridVisionCameraMLKitSpec_ weakify_std__shared_ptr_HybridVisionCameraMLKitSpec_(const std::shared_ptr& strong) noexcept { return strong; } + + // pragma MARK: Result + using Result_bool_ = Result; + inline Result_bool_ create_Result_bool_(bool value) noexcept { + return Result::withValue(std::move(value)); + } + inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept { + return Result::withError(error); + } + + // pragma MARK: Result> + using Result_std__shared_ptr_HybridTextRecognizerSpec__ = Result>; + inline Result_std__shared_ptr_HybridTextRecognizerSpec__ create_Result_std__shared_ptr_HybridTextRecognizerSpec__(const std::shared_ptr& value) noexcept { + return Result>::withValue(value); + } + inline Result_std__shared_ptr_HybridTextRecognizerSpec__ create_Result_std__shared_ptr_HybridTextRecognizerSpec__(const std::exception_ptr& error) noexcept { + return Result>::withError(error); + } + + // pragma MARK: Result> + using Result_std__shared_ptr_HybridBarcodeScannerSpec__ = Result>; + inline Result_std__shared_ptr_HybridBarcodeScannerSpec__ create_Result_std__shared_ptr_HybridBarcodeScannerSpec__(const std::shared_ptr& value) noexcept { + return Result>::withValue(value); + } + inline Result_std__shared_ptr_HybridBarcodeScannerSpec__ create_Result_std__shared_ptr_HybridBarcodeScannerSpec__(const std::exception_ptr& error) noexcept { + return Result>::withError(error); + } + +} // namespace margelo::nitro::visioncameramlkit::bridge::swift diff --git a/nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Umbrella.hpp b/nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Umbrella.hpp new file mode 100644 index 0000000..67dd681 --- /dev/null +++ b/nitrogen/generated/ios/VisionCameraMLKit-Swift-Cxx-Umbrella.hpp @@ -0,0 +1,122 @@ +/// +/// VisionCameraMLKit-Swift-Cxx-Umbrella.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +// Forward declarations of C++ defined types +// Forward declaration of `BarcodeFormat` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeFormat; } +// Forward declaration of `BarcodeScannerBarcode` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerBarcode; } +// Forward declaration of `BarcodeScannerOptions` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerOptions; } +// Forward declaration of `BarcodeScannerResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerResult; } +// Forward declaration of `BarcodeValueTypeName` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeValueTypeName; } +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `HybridBarcodeScannerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridBarcodeScannerSpec; } +// Forward declaration of `HybridFrameSpec` to properly resolve imports. +namespace margelo::nitro::camera { class HybridFrameSpec; } +// Forward declaration of `HybridTextRecognizerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridTextRecognizerSpec; } +// Forward declaration of `HybridVisionCameraMLKitSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridVisionCameraMLKitSpec; } +// Forward declaration of `MLKitBaseArguments` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct MLKitBaseArguments; } +// Forward declaration of `MLKitFeature` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class MLKitFeature; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } +// Forward declaration of `RegionOfInterestUnit` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class RegionOfInterestUnit; } +// Forward declaration of `RegionOfInterest` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct RegionOfInterest; } +// Forward declaration of `TextBlock` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextBlock; } +// Forward declaration of `TextElement` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextElement; } +// Forward declaration of `TextLine` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextLine; } +// Forward declaration of `TextRecognitionLanguage` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class TextRecognitionLanguage; } +// Forward declaration of `TextRecognitionResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextRecognitionResult; } +// Forward declaration of `TextRecognizerOptions` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextRecognizerOptions; } +// Forward declaration of `TextSymbol` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextSymbol; } + +// Include C++ defined types +#include "BarcodeFormat.hpp" +#include "BarcodeScannerBarcode.hpp" +#include "BarcodeScannerOptions.hpp" +#include "BarcodeScannerResult.hpp" +#include "BarcodeValueTypeName.hpp" +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "HybridBarcodeScannerSpec.hpp" +#include "HybridTextRecognizerSpec.hpp" +#include "HybridVisionCameraMLKitSpec.hpp" +#include "MLKitBaseArguments.hpp" +#include "MLKitFeature.hpp" +#include "Orientation.hpp" +#include "RegionOfInterest.hpp" +#include "RegionOfInterestUnit.hpp" +#include "TextBlock.hpp" +#include "TextElement.hpp" +#include "TextLine.hpp" +#include "TextRecognitionLanguage.hpp" +#include "TextRecognitionResult.hpp" +#include "TextRecognizerOptions.hpp" +#include "TextSymbol.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// C++ helpers for Swift +#include "VisionCameraMLKit-Swift-Cxx-Bridge.hpp" + +// Common C++ types used in Swift +#include +#include +#include +#include + +// Forward declarations of Swift defined types +// Forward declaration of `HybridBarcodeScannerSpec_cxx` to properly resolve imports. +namespace VisionCameraMLKit { class HybridBarcodeScannerSpec_cxx; } +// Forward declaration of `HybridFrameSpec_cxx` to properly resolve imports. +namespace VisionCamera { class HybridFrameSpec_cxx; } +// Forward declaration of `HybridTextRecognizerSpec_cxx` to properly resolve imports. +namespace VisionCameraMLKit { class HybridTextRecognizerSpec_cxx; } +// Forward declaration of `HybridVisionCameraMLKitSpec_cxx` to properly resolve imports. +namespace VisionCameraMLKit { class HybridVisionCameraMLKitSpec_cxx; } + +// Include Swift defined types +#if __has_include("VisionCameraMLKit-Swift.h") +// This header is generated by Xcode/Swift on every app build. +// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "VisionCameraMLKit". +#include "VisionCameraMLKit-Swift.h" +// Same as above, but used when building with frameworks (`use_frameworks`) +#elif __has_include() +#include +#else +#error VisionCameraMLKit's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "VisionCameraMLKit", and try building the app first. +#endif diff --git a/nitrogen/generated/ios/VisionCameraMLKitAutolinking.mm b/nitrogen/generated/ios/VisionCameraMLKitAutolinking.mm new file mode 100644 index 0000000..e0f195e --- /dev/null +++ b/nitrogen/generated/ios/VisionCameraMLKitAutolinking.mm @@ -0,0 +1,33 @@ +/// +/// VisionCameraMLKitAutolinking.mm +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#import +#import +#import "VisionCameraMLKit-Swift-Cxx-Umbrella.hpp" +#import + +#include "HybridVisionCameraMLKitSpecSwift.hpp" + +@interface VisionCameraMLKitAutolinking : NSObject +@end + +@implementation VisionCameraMLKitAutolinking + ++ (void) load { + using namespace margelo::nitro; + using namespace margelo::nitro::visioncameramlkit; + + HybridObjectRegistry::registerHybridObjectConstructor( + "VisionCameraMLKit", + []() -> std::shared_ptr { + std::shared_ptr hybridObject = VisionCameraMLKit::VisionCameraMLKitAutolinking::createVisionCameraMLKit(); + return hybridObject; + } + ); +} + +@end diff --git a/nitrogen/generated/ios/VisionCameraMLKitAutolinking.swift b/nitrogen/generated/ios/VisionCameraMLKitAutolinking.swift new file mode 100644 index 0000000..ea9ddd3 --- /dev/null +++ b/nitrogen/generated/ios/VisionCameraMLKitAutolinking.swift @@ -0,0 +1,26 @@ +/// +/// VisionCameraMLKitAutolinking.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +// TODO: Use empty enums once Swift supports exporting them as namespaces +// See: https://github.com/swiftlang/swift/pull/83616 +public final class VisionCameraMLKitAutolinking { + public typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + public static func createVisionCameraMLKit() -> bridge.std__shared_ptr_HybridVisionCameraMLKitSpec_ { + let hybridObject = HybridVisionCameraMLKit() + return { () -> bridge.std__shared_ptr_HybridVisionCameraMLKitSpec_ in + let __cxxWrapped = hybridObject.getCxxWrapper() + return __cxxWrapped.getCxxPart() + }() + } + + public static func isVisionCameraMLKitRecyclable() -> Bool { + return HybridVisionCameraMLKit.self is any RecyclableView.Type + } +} diff --git a/nitrogen/generated/ios/c++/HybridBarcodeScannerSpecSwift.cpp b/nitrogen/generated/ios/c++/HybridBarcodeScannerSpecSwift.cpp new file mode 100644 index 0000000..4f850da --- /dev/null +++ b/nitrogen/generated/ios/c++/HybridBarcodeScannerSpecSwift.cpp @@ -0,0 +1,11 @@ +/// +/// HybridBarcodeScannerSpecSwift.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "HybridBarcodeScannerSpecSwift.hpp" + +namespace margelo::nitro::visioncameramlkit { +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/ios/c++/HybridBarcodeScannerSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridBarcodeScannerSpecSwift.hpp new file mode 100644 index 0000000..48d857f --- /dev/null +++ b/nitrogen/generated/ios/c++/HybridBarcodeScannerSpecSwift.hpp @@ -0,0 +1,121 @@ +/// +/// HybridBarcodeScannerSpecSwift.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include "HybridBarcodeScannerSpec.hpp" + +// Forward declaration of `HybridBarcodeScannerSpec_cxx` to properly resolve imports. +namespace VisionCameraMLKit { class HybridBarcodeScannerSpec_cxx; } + +// Forward declaration of `BarcodeScannerResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerResult; } +// Forward declaration of `BarcodeScannerBarcode` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerBarcode; } +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `BarcodeFormat` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeFormat; } +// Forward declaration of `BarcodeValueTypeName` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeValueTypeName; } +// Forward declaration of `HybridFrameSpec` to properly resolve imports. +namespace margelo::nitro::camera { class HybridFrameSpec; } +// Forward declaration of `MLKitBaseArguments` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct MLKitBaseArguments; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } + +#include "BarcodeScannerResult.hpp" +#include "BarcodeScannerBarcode.hpp" +#include +#include "BoundingBox.hpp" +#include +#include "Corner.hpp" +#include "BarcodeFormat.hpp" +#include "BarcodeValueTypeName.hpp" +#include +#include +#include +#include +#include "MLKitBaseArguments.hpp" +#include "Orientation.hpp" +#include + +#include "VisionCameraMLKit-Swift-Cxx-Umbrella.hpp" + +namespace margelo::nitro::visioncameramlkit { + + /** + * The C++ part of HybridBarcodeScannerSpec_cxx.swift. + * + * HybridBarcodeScannerSpecSwift (C++) accesses HybridBarcodeScannerSpec_cxx (Swift), and might + * contain some additional bridging code for C++ <> Swift interop. + * + * Since this obviously introduces an overhead, I hope at some point in + * the future, HybridBarcodeScannerSpec_cxx can directly inherit from the C++ class HybridBarcodeScannerSpec + * to simplify the whole structure and memory management. + */ + class HybridBarcodeScannerSpecSwift: public virtual HybridBarcodeScannerSpec { + public: + // Constructor from a Swift instance + explicit HybridBarcodeScannerSpecSwift(const VisionCameraMLKit::HybridBarcodeScannerSpec_cxx& swiftPart): + HybridObject(HybridBarcodeScannerSpec::TAG), + _swiftPart(swiftPart) { } + + public: + // Get the Swift part + inline VisionCameraMLKit::HybridBarcodeScannerSpec_cxx& getSwiftPart() noexcept { + return _swiftPart; + } + + public: + inline size_t getExternalMemorySize() noexcept override { + return _swiftPart.getMemorySize(); + } + bool equals(const std::shared_ptr& other) override { + if (auto otherCast = std::dynamic_pointer_cast(other)) { + return _swiftPart.equals(otherCast->_swiftPart); + } + return false; + } + void dispose() noexcept override { + _swiftPart.dispose(); + } + std::string toString() override { + return _swiftPart.toString(); + } + + public: + // Properties + + + public: + // Methods + inline BarcodeScannerResult recognize(const std::shared_ptr& frame, const std::optional& args) override { + auto __result = _swiftPart.recognize(frame, args); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + auto __value = std::move(__result.value()); + return __value; + } + inline std::shared_ptr> recognizeImage(const std::string& uri) override { + auto __result = _swiftPart.recognizeImage(uri); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + auto __value = std::move(__result.value()); + return __value; + } + + private: + VisionCameraMLKit::HybridBarcodeScannerSpec_cxx _swiftPart; + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/ios/c++/HybridTextRecognizerSpecSwift.cpp b/nitrogen/generated/ios/c++/HybridTextRecognizerSpecSwift.cpp new file mode 100644 index 0000000..2b94b1d --- /dev/null +++ b/nitrogen/generated/ios/c++/HybridTextRecognizerSpecSwift.cpp @@ -0,0 +1,11 @@ +/// +/// HybridTextRecognizerSpecSwift.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "HybridTextRecognizerSpecSwift.hpp" + +namespace margelo::nitro::visioncameramlkit { +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/ios/c++/HybridTextRecognizerSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridTextRecognizerSpecSwift.hpp new file mode 100644 index 0000000..7dc3c66 --- /dev/null +++ b/nitrogen/generated/ios/c++/HybridTextRecognizerSpecSwift.hpp @@ -0,0 +1,125 @@ +/// +/// HybridTextRecognizerSpecSwift.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include "HybridTextRecognizerSpec.hpp" + +// Forward declaration of `HybridTextRecognizerSpec_cxx` to properly resolve imports. +namespace VisionCameraMLKit { class HybridTextRecognizerSpec_cxx; } + +// Forward declaration of `TextRecognitionResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextRecognitionResult; } +// Forward declaration of `TextBlock` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextBlock; } +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `TextLine` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextLine; } +// Forward declaration of `TextElement` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextElement; } +// Forward declaration of `TextSymbol` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextSymbol; } +// Forward declaration of `HybridFrameSpec` to properly resolve imports. +namespace margelo::nitro::camera { class HybridFrameSpec; } +// Forward declaration of `MLKitBaseArguments` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct MLKitBaseArguments; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } + +#include "TextRecognitionResult.hpp" +#include +#include "TextBlock.hpp" +#include +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include "TextLine.hpp" +#include +#include +#include +#include "TextElement.hpp" +#include "TextSymbol.hpp" +#include +#include +#include "MLKitBaseArguments.hpp" +#include "Orientation.hpp" +#include + +#include "VisionCameraMLKit-Swift-Cxx-Umbrella.hpp" + +namespace margelo::nitro::visioncameramlkit { + + /** + * The C++ part of HybridTextRecognizerSpec_cxx.swift. + * + * HybridTextRecognizerSpecSwift (C++) accesses HybridTextRecognizerSpec_cxx (Swift), and might + * contain some additional bridging code for C++ <> Swift interop. + * + * Since this obviously introduces an overhead, I hope at some point in + * the future, HybridTextRecognizerSpec_cxx can directly inherit from the C++ class HybridTextRecognizerSpec + * to simplify the whole structure and memory management. + */ + class HybridTextRecognizerSpecSwift: public virtual HybridTextRecognizerSpec { + public: + // Constructor from a Swift instance + explicit HybridTextRecognizerSpecSwift(const VisionCameraMLKit::HybridTextRecognizerSpec_cxx& swiftPart): + HybridObject(HybridTextRecognizerSpec::TAG), + _swiftPart(swiftPart) { } + + public: + // Get the Swift part + inline VisionCameraMLKit::HybridTextRecognizerSpec_cxx& getSwiftPart() noexcept { + return _swiftPart; + } + + public: + inline size_t getExternalMemorySize() noexcept override { + return _swiftPart.getMemorySize(); + } + bool equals(const std::shared_ptr& other) override { + if (auto otherCast = std::dynamic_pointer_cast(other)) { + return _swiftPart.equals(otherCast->_swiftPart); + } + return false; + } + void dispose() noexcept override { + _swiftPart.dispose(); + } + std::string toString() override { + return _swiftPart.toString(); + } + + public: + // Properties + + + public: + // Methods + inline TextRecognitionResult recognize(const std::shared_ptr& frame, const std::optional& args) override { + auto __result = _swiftPart.recognize(frame, args); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + auto __value = std::move(__result.value()); + return __value; + } + inline std::shared_ptr> recognizeImage(const std::string& uri) override { + auto __result = _swiftPart.recognizeImage(uri); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + auto __value = std::move(__result.value()); + return __value; + } + + private: + VisionCameraMLKit::HybridTextRecognizerSpec_cxx _swiftPart; + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/ios/c++/HybridVisionCameraMLKitSpecSwift.cpp b/nitrogen/generated/ios/c++/HybridVisionCameraMLKitSpecSwift.cpp new file mode 100644 index 0000000..ed5a009 --- /dev/null +++ b/nitrogen/generated/ios/c++/HybridVisionCameraMLKitSpecSwift.cpp @@ -0,0 +1,11 @@ +/// +/// HybridVisionCameraMLKitSpecSwift.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "HybridVisionCameraMLKitSpecSwift.hpp" + +namespace margelo::nitro::visioncameramlkit { +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/ios/c++/HybridVisionCameraMLKitSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridVisionCameraMLKitSpecSwift.hpp new file mode 100644 index 0000000..b73a252 --- /dev/null +++ b/nitrogen/generated/ios/c++/HybridVisionCameraMLKitSpecSwift.hpp @@ -0,0 +1,129 @@ +/// +/// HybridVisionCameraMLKitSpecSwift.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include "HybridVisionCameraMLKitSpec.hpp" + +// Forward declaration of `HybridVisionCameraMLKitSpec_cxx` to properly resolve imports. +namespace VisionCameraMLKit { class HybridVisionCameraMLKitSpec_cxx; } + +// Forward declaration of `MLKitFeature` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class MLKitFeature; } +// Forward declaration of `HybridTextRecognizerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridTextRecognizerSpec; } +// Forward declaration of `TextRecognizerOptions` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextRecognizerOptions; } +// Forward declaration of `TextRecognitionLanguage` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class TextRecognitionLanguage; } +// Forward declaration of `RegionOfInterest` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct RegionOfInterest; } +// Forward declaration of `RegionOfInterestUnit` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class RegionOfInterestUnit; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } +// Forward declaration of `HybridBarcodeScannerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridBarcodeScannerSpec; } +// Forward declaration of `BarcodeScannerOptions` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerOptions; } +// Forward declaration of `BarcodeFormat` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeFormat; } + +#include "MLKitFeature.hpp" +#include +#include "HybridTextRecognizerSpec.hpp" +#include "TextRecognizerOptions.hpp" +#include "TextRecognitionLanguage.hpp" +#include +#include "RegionOfInterest.hpp" +#include "RegionOfInterestUnit.hpp" +#include "Orientation.hpp" +#include "HybridBarcodeScannerSpec.hpp" +#include "BarcodeScannerOptions.hpp" +#include "BarcodeFormat.hpp" +#include + +#include "VisionCameraMLKit-Swift-Cxx-Umbrella.hpp" + +namespace margelo::nitro::visioncameramlkit { + + /** + * The C++ part of HybridVisionCameraMLKitSpec_cxx.swift. + * + * HybridVisionCameraMLKitSpecSwift (C++) accesses HybridVisionCameraMLKitSpec_cxx (Swift), and might + * contain some additional bridging code for C++ <> Swift interop. + * + * Since this obviously introduces an overhead, I hope at some point in + * the future, HybridVisionCameraMLKitSpec_cxx can directly inherit from the C++ class HybridVisionCameraMLKitSpec + * to simplify the whole structure and memory management. + */ + class HybridVisionCameraMLKitSpecSwift: public virtual HybridVisionCameraMLKitSpec { + public: + // Constructor from a Swift instance + explicit HybridVisionCameraMLKitSpecSwift(const VisionCameraMLKit::HybridVisionCameraMLKitSpec_cxx& swiftPart): + HybridObject(HybridVisionCameraMLKitSpec::TAG), + _swiftPart(swiftPart) { } + + public: + // Get the Swift part + inline VisionCameraMLKit::HybridVisionCameraMLKitSpec_cxx& getSwiftPart() noexcept { + return _swiftPart; + } + + public: + inline size_t getExternalMemorySize() noexcept override { + return _swiftPart.getMemorySize(); + } + bool equals(const std::shared_ptr& other) override { + if (auto otherCast = std::dynamic_pointer_cast(other)) { + return _swiftPart.equals(otherCast->_swiftPart); + } + return false; + } + void dispose() noexcept override { + _swiftPart.dispose(); + } + std::string toString() override { + return _swiftPart.toString(); + } + + public: + // Properties + + + public: + // Methods + inline bool isFeatureAvailable(MLKitFeature feature) override { + auto __result = _swiftPart.isFeatureAvailable(static_cast(feature)); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + auto __value = std::move(__result.value()); + return __value; + } + inline std::shared_ptr createTextRecognizer(const TextRecognizerOptions& options) override { + auto __result = _swiftPart.createTextRecognizer(std::forward(options)); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + auto __value = std::move(__result.value()); + return __value; + } + inline std::shared_ptr createBarcodeScanner(const BarcodeScannerOptions& options) override { + auto __result = _swiftPart.createBarcodeScanner(std::forward(options)); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + auto __value = std::move(__result.value()); + return __value; + } + + private: + VisionCameraMLKit::HybridVisionCameraMLKitSpec_cxx _swiftPart; + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/ios/swift/BarcodeFormat.swift b/nitrogen/generated/ios/swift/BarcodeFormat.swift new file mode 100644 index 0000000..65e565e --- /dev/null +++ b/nitrogen/generated/ios/swift/BarcodeFormat.swift @@ -0,0 +1,92 @@ +/// +/// BarcodeFormat.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS union `BarcodeFormat`, backed by a C++ enum. + */ +public typealias BarcodeFormat = margelo.nitro.visioncameramlkit.BarcodeFormat + +public extension BarcodeFormat { + /** + * Get a BarcodeFormat for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "UNKNOWN": + self = .unknown + case "ALL_FORMATS": + self = .allFormats + case "CODE_128": + self = .code128 + case "CODE_39": + self = .code39 + case "CODE_93": + self = .code93 + case "CODABAR": + self = .codabar + case "DATA_MATRIX": + self = .dataMatrix + case "EAN_13": + self = .ean13 + case "EAN_8": + self = .ean8 + case "ITF": + self = .itf + case "QR_CODE": + self = .qrCode + case "UPC_A": + self = .upcA + case "UPC_E": + self = .upcE + case "PDF417": + self = .pdf417 + case "AZTEC": + self = .aztec + default: + return nil + } + } + + /** + * Get the String value this BarcodeFormat represents. + */ + var stringValue: String { + switch self { + case .unknown: + return "UNKNOWN" + case .allFormats: + return "ALL_FORMATS" + case .code128: + return "CODE_128" + case .code39: + return "CODE_39" + case .code93: + return "CODE_93" + case .codabar: + return "CODABAR" + case .dataMatrix: + return "DATA_MATRIX" + case .ean13: + return "EAN_13" + case .ean8: + return "EAN_8" + case .itf: + return "ITF" + case .qrCode: + return "QR_CODE" + case .upcA: + return "UPC_A" + case .upcE: + return "UPC_E" + case .pdf417: + return "PDF417" + case .aztec: + return "AZTEC" + } + } +} diff --git a/nitrogen/generated/ios/swift/BarcodeScannerBarcode.swift b/nitrogen/generated/ios/swift/BarcodeScannerBarcode.swift new file mode 100644 index 0000000..a788533 --- /dev/null +++ b/nitrogen/generated/ios/swift/BarcodeScannerBarcode.swift @@ -0,0 +1,162 @@ +/// +/// BarcodeScannerBarcode.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `BarcodeScannerBarcode`, backed by a C++ struct. + */ +public typealias BarcodeScannerBarcode = margelo.nitro.visioncameramlkit.BarcodeScannerBarcode + +public extension BarcodeScannerBarcode { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `BarcodeScannerBarcode`. + */ + init(bounds: BoundingBox?, corners: [Corner]?, format: Double, formatName: BarcodeFormat, valueType: Double, valueTypeName: BarcodeValueTypeName, rawValue: String?, displayValue: String?, rawBytes: [Double]?, value: AnyMap?, isPotential: Bool) { + self.init({ () -> bridge.std__optional_BoundingBox_ in + if let __unwrappedValue = bounds { + return bridge.create_std__optional_BoundingBox_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__vector_Corner__ in + if let __unwrappedValue = corners { + return bridge.create_std__optional_std__vector_Corner__({ () -> bridge.std__vector_Corner_ in + var __vector = bridge.create_std__vector_Corner_(__unwrappedValue.count) + for __item in __unwrappedValue { + __vector.push_back(__item) + } + return __vector + }()) + } else { + return .init() + } + }(), format, formatName, valueType, valueTypeName, { () -> bridge.std__optional_std__string_ in + if let __unwrappedValue = rawValue { + return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__string_ in + if let __unwrappedValue = displayValue { + return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__vector_double__ in + if let __unwrappedValue = rawBytes { + return bridge.create_std__optional_std__vector_double__({ () -> bridge.std__vector_double_ in + var __vector = bridge.create_std__vector_double_(__unwrappedValue.count) + for __item in __unwrappedValue { + __vector.push_back(__item) + } + return __vector + }()) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__shared_ptr_AnyMap__ in + if let __unwrappedValue = value { + return bridge.create_std__optional_std__shared_ptr_AnyMap__(__unwrappedValue.cppPart) + } else { + return .init() + } + }(), isPotential) + } + + @inline(__always) + var bounds: BoundingBox? { + return self.__bounds.value + } + + @inline(__always) + var corners: [Corner]? { + return { () -> [Corner]? in + if bridge.has_value_std__optional_std__vector_Corner__(self.__corners) { + let __unwrapped = bridge.get_std__optional_std__vector_Corner__(self.__corners) + return __unwrapped.map({ __item in __item }) + } else { + return nil + } + }() + } + + @inline(__always) + var format: Double { + return self.__format + } + + @inline(__always) + var formatName: BarcodeFormat { + return self.__formatName + } + + @inline(__always) + var valueType: Double { + return self.__valueType + } + + @inline(__always) + var valueTypeName: BarcodeValueTypeName { + return self.__valueTypeName + } + + @inline(__always) + var rawValue: String? { + return { () -> String? in + if bridge.has_value_std__optional_std__string_(self.__rawValue) { + let __unwrapped = bridge.get_std__optional_std__string_(self.__rawValue) + return String(__unwrapped) + } else { + return nil + } + }() + } + + @inline(__always) + var displayValue: String? { + return { () -> String? in + if bridge.has_value_std__optional_std__string_(self.__displayValue) { + let __unwrapped = bridge.get_std__optional_std__string_(self.__displayValue) + return String(__unwrapped) + } else { + return nil + } + }() + } + + @inline(__always) + var rawBytes: [Double]? { + return { () -> [Double]? in + if bridge.has_value_std__optional_std__vector_double__(self.__rawBytes) { + let __unwrapped = bridge.get_std__optional_std__vector_double__(self.__rawBytes) + return __unwrapped.map({ __item in __item }) + } else { + return nil + } + }() + } + + @inline(__always) + var value: AnyMap? { + return { () -> AnyMap? in + if bridge.has_value_std__optional_std__shared_ptr_AnyMap__(self.__value) { + let __unwrapped = bridge.get_std__optional_std__shared_ptr_AnyMap__(self.__value) + return AnyMap(withCppPart: __unwrapped) + } else { + return nil + } + }() + } + + @inline(__always) + var isPotential: Bool { + return self.__isPotential + } +} diff --git a/nitrogen/generated/ios/swift/BarcodeScannerOptions.swift b/nitrogen/generated/ios/swift/BarcodeScannerOptions.swift new file mode 100644 index 0000000..44913a2 --- /dev/null +++ b/nitrogen/generated/ios/swift/BarcodeScannerOptions.swift @@ -0,0 +1,142 @@ +/// +/// BarcodeScannerOptions.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `BarcodeScannerOptions`, backed by a C++ struct. + */ +public typealias BarcodeScannerOptions = margelo.nitro.visioncameramlkit.BarcodeScannerOptions + +public extension BarcodeScannerOptions { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `BarcodeScannerOptions`. + */ + init(formats: [BarcodeFormat]?, enableAllPotentialBarcodes: Bool?, scaleFactor: Double?, invertColors: Bool?, frameProcessInterval: Double?, roi: RegionOfInterest?, orientation: Orientation?) { + self.init({ () -> bridge.std__optional_std__vector_BarcodeFormat__ in + if let __unwrappedValue = formats { + return bridge.create_std__optional_std__vector_BarcodeFormat__({ () -> bridge.std__vector_BarcodeFormat_ in + var __vector = bridge.create_std__vector_BarcodeFormat_(__unwrappedValue.count) + for __item in __unwrappedValue { + __vector.push_back(__item) + } + return __vector + }()) + } else { + return .init() + } + }(), { () -> bridge.std__optional_bool_ in + if let __unwrappedValue = enableAllPotentialBarcodes { + return bridge.create_std__optional_bool_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_double_ in + if let __unwrappedValue = scaleFactor { + return bridge.create_std__optional_double_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_bool_ in + if let __unwrappedValue = invertColors { + return bridge.create_std__optional_bool_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_double_ in + if let __unwrappedValue = frameProcessInterval { + return bridge.create_std__optional_double_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_RegionOfInterest_ in + if let __unwrappedValue = roi { + return bridge.create_std__optional_RegionOfInterest_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_Orientation_ in + if let __unwrappedValue = orientation { + return bridge.create_std__optional_Orientation_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var formats: [BarcodeFormat]? { + return { () -> [BarcodeFormat]? in + if bridge.has_value_std__optional_std__vector_BarcodeFormat__(self.__formats) { + let __unwrapped = bridge.get_std__optional_std__vector_BarcodeFormat__(self.__formats) + return __unwrapped.map({ __item in __item }) + } else { + return nil + } + }() + } + + @inline(__always) + var enableAllPotentialBarcodes: Bool? { + return { () -> Bool? in + if bridge.has_value_std__optional_bool_(self.__enableAllPotentialBarcodes) { + let __unwrapped = bridge.get_std__optional_bool_(self.__enableAllPotentialBarcodes) + return __unwrapped + } else { + return nil + } + }() + } + + @inline(__always) + var scaleFactor: Double? { + return { () -> Double? in + if bridge.has_value_std__optional_double_(self.__scaleFactor) { + let __unwrapped = bridge.get_std__optional_double_(self.__scaleFactor) + return __unwrapped + } else { + return nil + } + }() + } + + @inline(__always) + var invertColors: Bool? { + return { () -> Bool? in + if bridge.has_value_std__optional_bool_(self.__invertColors) { + let __unwrapped = bridge.get_std__optional_bool_(self.__invertColors) + return __unwrapped + } else { + return nil + } + }() + } + + @inline(__always) + var frameProcessInterval: Double? { + return { () -> Double? in + if bridge.has_value_std__optional_double_(self.__frameProcessInterval) { + let __unwrapped = bridge.get_std__optional_double_(self.__frameProcessInterval) + return __unwrapped + } else { + return nil + } + }() + } + + @inline(__always) + var roi: RegionOfInterest? { + return self.__roi.value + } + + @inline(__always) + var orientation: Orientation? { + return self.__orientation.value + } +} diff --git a/nitrogen/generated/ios/swift/BarcodeScannerResult.swift b/nitrogen/generated/ios/swift/BarcodeScannerResult.swift new file mode 100644 index 0000000..4d4d679 --- /dev/null +++ b/nitrogen/generated/ios/swift/BarcodeScannerResult.swift @@ -0,0 +1,35 @@ +/// +/// BarcodeScannerResult.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `BarcodeScannerResult`, backed by a C++ struct. + */ +public typealias BarcodeScannerResult = margelo.nitro.visioncameramlkit.BarcodeScannerResult + +public extension BarcodeScannerResult { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `BarcodeScannerResult`. + */ + init(barcodes: [BarcodeScannerBarcode]) { + self.init({ () -> bridge.std__vector_BarcodeScannerBarcode_ in + var __vector = bridge.create_std__vector_BarcodeScannerBarcode_(barcodes.count) + for __item in barcodes { + __vector.push_back(__item) + } + return __vector + }()) + } + + @inline(__always) + var barcodes: [BarcodeScannerBarcode] { + return self.__barcodes.map({ __item in __item }) + } +} diff --git a/nitrogen/generated/ios/swift/BarcodeValueTypeName.swift b/nitrogen/generated/ios/swift/BarcodeValueTypeName.swift new file mode 100644 index 0000000..8dfd6a9 --- /dev/null +++ b/nitrogen/generated/ios/swift/BarcodeValueTypeName.swift @@ -0,0 +1,84 @@ +/// +/// BarcodeValueTypeName.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS union `BarcodeValueTypeName`, backed by a C++ enum. + */ +public typealias BarcodeValueTypeName = margelo.nitro.visioncameramlkit.BarcodeValueTypeName + +public extension BarcodeValueTypeName { + /** + * Get a BarcodeValueTypeName for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "TYPE_UNKNOWN": + self = .typeUnknown + case "TYPE_CONTACT_INFO": + self = .typeContactInfo + case "TYPE_EMAIL": + self = .typeEmail + case "TYPE_ISBN": + self = .typeIsbn + case "TYPE_PHONE": + self = .typePhone + case "TYPE_PRODUCT": + self = .typeProduct + case "TYPE_SMS": + self = .typeSms + case "TYPE_TEXT": + self = .typeText + case "TYPE_URL": + self = .typeUrl + case "TYPE_WIFI": + self = .typeWifi + case "TYPE_GEO": + self = .typeGeo + case "TYPE_CALENDAR_EVENT": + self = .typeCalendarEvent + case "TYPE_DRIVER_LICENSE": + self = .typeDriverLicense + default: + return nil + } + } + + /** + * Get the String value this BarcodeValueTypeName represents. + */ + var stringValue: String { + switch self { + case .typeUnknown: + return "TYPE_UNKNOWN" + case .typeContactInfo: + return "TYPE_CONTACT_INFO" + case .typeEmail: + return "TYPE_EMAIL" + case .typeIsbn: + return "TYPE_ISBN" + case .typePhone: + return "TYPE_PHONE" + case .typeProduct: + return "TYPE_PRODUCT" + case .typeSms: + return "TYPE_SMS" + case .typeText: + return "TYPE_TEXT" + case .typeUrl: + return "TYPE_URL" + case .typeWifi: + return "TYPE_WIFI" + case .typeGeo: + return "TYPE_GEO" + case .typeCalendarEvent: + return "TYPE_CALENDAR_EVENT" + case .typeDriverLicense: + return "TYPE_DRIVER_LICENSE" + } + } +} diff --git a/nitrogen/generated/ios/swift/BoundingBox.swift b/nitrogen/generated/ios/swift/BoundingBox.swift new file mode 100644 index 0000000..d230897 --- /dev/null +++ b/nitrogen/generated/ios/swift/BoundingBox.swift @@ -0,0 +1,74 @@ +/// +/// BoundingBox.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `BoundingBox`, backed by a C++ struct. + */ +public typealias BoundingBox = margelo.nitro.visioncameramlkit.BoundingBox + +public extension BoundingBox { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `BoundingBox`. + */ + init(x: Double, y: Double, centerX: Double, centerY: Double, width: Double, height: Double, top: Double, left: Double, bottom: Double, right: Double) { + self.init(x, y, centerX, centerY, width, height, top, left, bottom, right) + } + + @inline(__always) + var x: Double { + return self.__x + } + + @inline(__always) + var y: Double { + return self.__y + } + + @inline(__always) + var centerX: Double { + return self.__centerX + } + + @inline(__always) + var centerY: Double { + return self.__centerY + } + + @inline(__always) + var width: Double { + return self.__width + } + + @inline(__always) + var height: Double { + return self.__height + } + + @inline(__always) + var top: Double { + return self.__top + } + + @inline(__always) + var left: Double { + return self.__left + } + + @inline(__always) + var bottom: Double { + return self.__bottom + } + + @inline(__always) + var right: Double { + return self.__right + } +} diff --git a/nitrogen/generated/ios/swift/Corner.swift b/nitrogen/generated/ios/swift/Corner.swift new file mode 100644 index 0000000..f62d6da --- /dev/null +++ b/nitrogen/generated/ios/swift/Corner.swift @@ -0,0 +1,34 @@ +/// +/// Corner.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `Corner`, backed by a C++ struct. + */ +public typealias Corner = margelo.nitro.visioncameramlkit.Corner + +public extension Corner { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `Corner`. + */ + init(x: Double, y: Double) { + self.init(x, y) + } + + @inline(__always) + var x: Double { + return self.__x + } + + @inline(__always) + var y: Double { + return self.__y + } +} diff --git a/nitrogen/generated/ios/swift/Func_void_BarcodeScannerResult.swift b/nitrogen/generated/ios/swift/Func_void_BarcodeScannerResult.swift new file mode 100644 index 0000000..1863916 --- /dev/null +++ b/nitrogen/generated/ios/swift/Func_void_BarcodeScannerResult.swift @@ -0,0 +1,46 @@ +/// +/// Func_void_BarcodeScannerResult.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Wraps a Swift `(_ value: BarcodeScannerResult) -> Void` as a class. + * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. + */ +public final class Func_void_BarcodeScannerResult { + public typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + private let closure: (_ value: BarcodeScannerResult) -> Void + + public init(_ closure: @escaping (_ value: BarcodeScannerResult) -> Void) { + self.closure = closure + } + + @inline(__always) + public func call(value: BarcodeScannerResult) -> Void { + self.closure(value) + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + @inline(__always) + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `Func_void_BarcodeScannerResult`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + @inline(__always) + public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_BarcodeScannerResult { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } +} diff --git a/nitrogen/generated/ios/swift/Func_void_TextRecognitionResult.swift b/nitrogen/generated/ios/swift/Func_void_TextRecognitionResult.swift new file mode 100644 index 0000000..6627cb1 --- /dev/null +++ b/nitrogen/generated/ios/swift/Func_void_TextRecognitionResult.swift @@ -0,0 +1,46 @@ +/// +/// Func_void_TextRecognitionResult.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Wraps a Swift `(_ value: TextRecognitionResult) -> Void` as a class. + * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. + */ +public final class Func_void_TextRecognitionResult { + public typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + private let closure: (_ value: TextRecognitionResult) -> Void + + public init(_ closure: @escaping (_ value: TextRecognitionResult) -> Void) { + self.closure = closure + } + + @inline(__always) + public func call(value: TextRecognitionResult) -> Void { + self.closure(value) + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + @inline(__always) + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `Func_void_TextRecognitionResult`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + @inline(__always) + public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_TextRecognitionResult { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } +} diff --git a/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift b/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift new file mode 100644 index 0000000..7c53657 --- /dev/null +++ b/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift @@ -0,0 +1,46 @@ +/// +/// Func_void_std__exception_ptr.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Wraps a Swift `(_ error: Error) -> Void` as a class. + * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. + */ +public final class Func_void_std__exception_ptr { + public typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + private let closure: (_ error: Error) -> Void + + public init(_ closure: @escaping (_ error: Error) -> Void) { + self.closure = closure + } + + @inline(__always) + public func call(error: std.exception_ptr) -> Void { + self.closure(RuntimeError.from(cppError: error)) + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + @inline(__always) + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `Func_void_std__exception_ptr`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + @inline(__always) + public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } +} diff --git a/nitrogen/generated/ios/swift/HybridBarcodeScannerSpec.swift b/nitrogen/generated/ios/swift/HybridBarcodeScannerSpec.swift new file mode 100644 index 0000000..6122920 --- /dev/null +++ b/nitrogen/generated/ios/swift/HybridBarcodeScannerSpec.swift @@ -0,0 +1,57 @@ +/// +/// HybridBarcodeScannerSpec.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import VisionCamera +import NitroModules + +/// See ``HybridBarcodeScannerSpec`` +public protocol HybridBarcodeScannerSpec_protocol: HybridObject { + // Properties + + + // Methods + func recognize(frame: (any HybridFrameSpec), args: MLKitBaseArguments?) throws -> BarcodeScannerResult + func recognizeImage(uri: String) throws -> Promise +} + +public extension HybridBarcodeScannerSpec_protocol { + /// Default implementation of ``HybridObject.toString`` + func toString() -> String { + return "[HybridObject BarcodeScanner]" + } +} + +/// See ``HybridBarcodeScannerSpec`` +open class HybridBarcodeScannerSpec_base { + private weak var cxxWrapper: HybridBarcodeScannerSpec_cxx? = nil + public init() { } + public func getCxxWrapper() -> HybridBarcodeScannerSpec_cxx { + #if DEBUG + guard self is any HybridBarcodeScannerSpec else { + fatalError("`self` is not a `HybridBarcodeScannerSpec`! Did you accidentally inherit from `HybridBarcodeScannerSpec_base` instead of `HybridBarcodeScannerSpec`?") + } + #endif + if let cxxWrapper = self.cxxWrapper { + return cxxWrapper + } else { + let cxxWrapper = HybridBarcodeScannerSpec_cxx(self as! any HybridBarcodeScannerSpec) + self.cxxWrapper = cxxWrapper + return cxxWrapper + } + } +} + +/** + * A Swift base-protocol representing the BarcodeScanner HybridObject. + * Implement this protocol to create Swift-based instances of BarcodeScanner. + * ```swift + * class HybridBarcodeScanner : HybridBarcodeScannerSpec { + * // ... + * } + * ``` + */ +public typealias HybridBarcodeScannerSpec = HybridBarcodeScannerSpec_protocol & HybridBarcodeScannerSpec_base diff --git a/nitrogen/generated/ios/swift/HybridBarcodeScannerSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridBarcodeScannerSpec_cxx.swift new file mode 100644 index 0000000..cfc0080 --- /dev/null +++ b/nitrogen/generated/ios/swift/HybridBarcodeScannerSpec_cxx.swift @@ -0,0 +1,162 @@ +/// +/// HybridBarcodeScannerSpec_cxx.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules +import VisionCamera + +/** + * A class implementation that bridges HybridBarcodeScannerSpec over to C++. + * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined. + * + * Also, some Swift types need to be bridged with special handling: + * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330) + * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper + * - Throwing methods need to be wrapped with a Result type, as exceptions cannot be propagated to C++ + */ +open class HybridBarcodeScannerSpec_cxx { + /** + * The Swift <> C++ bridge's namespace (`margelo::nitro::visioncameramlkit::bridge::swift`) + * from `VisionCameraMLKit-Swift-Cxx-Bridge.hpp`. + * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. + */ + public typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Holds an instance of the `HybridBarcodeScannerSpec` Swift protocol. + */ + private var __implementation: any HybridBarcodeScannerSpec + + /** + * Holds a weak pointer to the C++ class that wraps the Swift class. + */ + private var __cxxPart: bridge.std__weak_ptr_HybridBarcodeScannerSpec_ + + /** + * Create a new `HybridBarcodeScannerSpec_cxx` that wraps the given `HybridBarcodeScannerSpec`. + * All properties and methods bridge to C++ types. + */ + public init(_ implementation: any HybridBarcodeScannerSpec) { + self.__implementation = implementation + self.__cxxPart = .init() + /* no base class */ + } + + /** + * Get the actual `HybridBarcodeScannerSpec` instance this class wraps. + */ + @inline(__always) + public func getHybridBarcodeScannerSpec() -> any HybridBarcodeScannerSpec { + return __implementation + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `HybridBarcodeScannerSpec_cxx`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridBarcodeScannerSpec_cxx { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } + + /** + * Gets (or creates) the C++ part of this Hybrid Object. + * The C++ part is a `std::shared_ptr`. + */ + public func getCxxPart() -> bridge.std__shared_ptr_HybridBarcodeScannerSpec_ { + let cachedCxxPart = self.__cxxPart.lock() + if Bool(fromCxx: cachedCxxPart) { + return cachedCxxPart + } else { + let newCxxPart = bridge.create_std__shared_ptr_HybridBarcodeScannerSpec_(self.toUnsafe()) + __cxxPart = bridge.weakify_std__shared_ptr_HybridBarcodeScannerSpec_(newCxxPart) + return newCxxPart + } + } + + + + /** + * Get the memory size of the Swift class (plus size of any other allocations) + * so the JS VM can properly track it and garbage-collect the JS object if needed. + */ + @inline(__always) + public var memorySize: Int { + return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize + } + + /** + * Compares this object with the given [other] object for reference equality. + */ + @inline(__always) + public func equals(other: HybridBarcodeScannerSpec_cxx) -> Bool { + return self.__implementation === other.__implementation + } + + /** + * Call dispose() on the Swift class. + * This _may_ be called manually from JS. + */ + @inline(__always) + public func dispose() { + self.__implementation.dispose() + } + + /** + * Call toString() on the Swift class. + */ + @inline(__always) + public func toString() -> String { + return self.__implementation.toString() + } + + // Properties + + + // Methods + @inline(__always) + public final func recognize(frame: bridge.std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_, args: bridge.std__optional_MLKitBaseArguments_) -> bridge.Result_BarcodeScannerResult_ { + do { + let __result = try self.__implementation.recognize(frame: { () -> any HybridFrameSpec in + let __unsafePointer = bridge.get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(frame) + let __instance = HybridFrameSpec_cxx.fromUnsafe(__unsafePointer) + return __instance.getHybridFrameSpec() + }(), args: args.value) + let __resultCpp = __result + return bridge.create_Result_BarcodeScannerResult_(__resultCpp) + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_BarcodeScannerResult_(__exceptionPtr) + } + } + + @inline(__always) + public final func recognizeImage(uri: std.string) -> bridge.Result_std__shared_ptr_Promise_BarcodeScannerResult___ { + do { + let __result = try self.__implementation.recognizeImage(uri: String(uri)) + let __resultCpp = { () -> bridge.std__shared_ptr_Promise_BarcodeScannerResult__ in + let __promise = bridge.create_std__shared_ptr_Promise_BarcodeScannerResult__() + let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_BarcodeScannerResult__(__promise) + __result + .then({ __result in __promiseHolder.resolve(__result) }) + .catch({ __error in __promiseHolder.reject(__error.toCpp()) }) + return __promise + }() + return bridge.create_Result_std__shared_ptr_Promise_BarcodeScannerResult___(__resultCpp) + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_std__shared_ptr_Promise_BarcodeScannerResult___(__exceptionPtr) + } + } +} diff --git a/nitrogen/generated/ios/swift/HybridTextRecognizerSpec.swift b/nitrogen/generated/ios/swift/HybridTextRecognizerSpec.swift new file mode 100644 index 0000000..8dff317 --- /dev/null +++ b/nitrogen/generated/ios/swift/HybridTextRecognizerSpec.swift @@ -0,0 +1,57 @@ +/// +/// HybridTextRecognizerSpec.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import VisionCamera +import NitroModules + +/// See ``HybridTextRecognizerSpec`` +public protocol HybridTextRecognizerSpec_protocol: HybridObject { + // Properties + + + // Methods + func recognize(frame: (any HybridFrameSpec), args: MLKitBaseArguments?) throws -> TextRecognitionResult + func recognizeImage(uri: String) throws -> Promise +} + +public extension HybridTextRecognizerSpec_protocol { + /// Default implementation of ``HybridObject.toString`` + func toString() -> String { + return "[HybridObject TextRecognizer]" + } +} + +/// See ``HybridTextRecognizerSpec`` +open class HybridTextRecognizerSpec_base { + private weak var cxxWrapper: HybridTextRecognizerSpec_cxx? = nil + public init() { } + public func getCxxWrapper() -> HybridTextRecognizerSpec_cxx { + #if DEBUG + guard self is any HybridTextRecognizerSpec else { + fatalError("`self` is not a `HybridTextRecognizerSpec`! Did you accidentally inherit from `HybridTextRecognizerSpec_base` instead of `HybridTextRecognizerSpec`?") + } + #endif + if let cxxWrapper = self.cxxWrapper { + return cxxWrapper + } else { + let cxxWrapper = HybridTextRecognizerSpec_cxx(self as! any HybridTextRecognizerSpec) + self.cxxWrapper = cxxWrapper + return cxxWrapper + } + } +} + +/** + * A Swift base-protocol representing the TextRecognizer HybridObject. + * Implement this protocol to create Swift-based instances of TextRecognizer. + * ```swift + * class HybridTextRecognizer : HybridTextRecognizerSpec { + * // ... + * } + * ``` + */ +public typealias HybridTextRecognizerSpec = HybridTextRecognizerSpec_protocol & HybridTextRecognizerSpec_base diff --git a/nitrogen/generated/ios/swift/HybridTextRecognizerSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridTextRecognizerSpec_cxx.swift new file mode 100644 index 0000000..013329e --- /dev/null +++ b/nitrogen/generated/ios/swift/HybridTextRecognizerSpec_cxx.swift @@ -0,0 +1,162 @@ +/// +/// HybridTextRecognizerSpec_cxx.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules +import VisionCamera + +/** + * A class implementation that bridges HybridTextRecognizerSpec over to C++. + * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined. + * + * Also, some Swift types need to be bridged with special handling: + * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330) + * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper + * - Throwing methods need to be wrapped with a Result type, as exceptions cannot be propagated to C++ + */ +open class HybridTextRecognizerSpec_cxx { + /** + * The Swift <> C++ bridge's namespace (`margelo::nitro::visioncameramlkit::bridge::swift`) + * from `VisionCameraMLKit-Swift-Cxx-Bridge.hpp`. + * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. + */ + public typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Holds an instance of the `HybridTextRecognizerSpec` Swift protocol. + */ + private var __implementation: any HybridTextRecognizerSpec + + /** + * Holds a weak pointer to the C++ class that wraps the Swift class. + */ + private var __cxxPart: bridge.std__weak_ptr_HybridTextRecognizerSpec_ + + /** + * Create a new `HybridTextRecognizerSpec_cxx` that wraps the given `HybridTextRecognizerSpec`. + * All properties and methods bridge to C++ types. + */ + public init(_ implementation: any HybridTextRecognizerSpec) { + self.__implementation = implementation + self.__cxxPart = .init() + /* no base class */ + } + + /** + * Get the actual `HybridTextRecognizerSpec` instance this class wraps. + */ + @inline(__always) + public func getHybridTextRecognizerSpec() -> any HybridTextRecognizerSpec { + return __implementation + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `HybridTextRecognizerSpec_cxx`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridTextRecognizerSpec_cxx { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } + + /** + * Gets (or creates) the C++ part of this Hybrid Object. + * The C++ part is a `std::shared_ptr`. + */ + public func getCxxPart() -> bridge.std__shared_ptr_HybridTextRecognizerSpec_ { + let cachedCxxPart = self.__cxxPart.lock() + if Bool(fromCxx: cachedCxxPart) { + return cachedCxxPart + } else { + let newCxxPart = bridge.create_std__shared_ptr_HybridTextRecognizerSpec_(self.toUnsafe()) + __cxxPart = bridge.weakify_std__shared_ptr_HybridTextRecognizerSpec_(newCxxPart) + return newCxxPart + } + } + + + + /** + * Get the memory size of the Swift class (plus size of any other allocations) + * so the JS VM can properly track it and garbage-collect the JS object if needed. + */ + @inline(__always) + public var memorySize: Int { + return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize + } + + /** + * Compares this object with the given [other] object for reference equality. + */ + @inline(__always) + public func equals(other: HybridTextRecognizerSpec_cxx) -> Bool { + return self.__implementation === other.__implementation + } + + /** + * Call dispose() on the Swift class. + * This _may_ be called manually from JS. + */ + @inline(__always) + public func dispose() { + self.__implementation.dispose() + } + + /** + * Call toString() on the Swift class. + */ + @inline(__always) + public func toString() -> String { + return self.__implementation.toString() + } + + // Properties + + + // Methods + @inline(__always) + public final func recognize(frame: bridge.std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_, args: bridge.std__optional_MLKitBaseArguments_) -> bridge.Result_TextRecognitionResult_ { + do { + let __result = try self.__implementation.recognize(frame: { () -> any HybridFrameSpec in + let __unsafePointer = bridge.get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(frame) + let __instance = HybridFrameSpec_cxx.fromUnsafe(__unsafePointer) + return __instance.getHybridFrameSpec() + }(), args: args.value) + let __resultCpp = __result + return bridge.create_Result_TextRecognitionResult_(__resultCpp) + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_TextRecognitionResult_(__exceptionPtr) + } + } + + @inline(__always) + public final func recognizeImage(uri: std.string) -> bridge.Result_std__shared_ptr_Promise_TextRecognitionResult___ { + do { + let __result = try self.__implementation.recognizeImage(uri: String(uri)) + let __resultCpp = { () -> bridge.std__shared_ptr_Promise_TextRecognitionResult__ in + let __promise = bridge.create_std__shared_ptr_Promise_TextRecognitionResult__() + let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_TextRecognitionResult__(__promise) + __result + .then({ __result in __promiseHolder.resolve(__result) }) + .catch({ __error in __promiseHolder.reject(__error.toCpp()) }) + return __promise + }() + return bridge.create_Result_std__shared_ptr_Promise_TextRecognitionResult___(__resultCpp) + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_std__shared_ptr_Promise_TextRecognitionResult___(__exceptionPtr) + } + } +} diff --git a/nitrogen/generated/ios/swift/HybridVisionCameraMLKitSpec.swift b/nitrogen/generated/ios/swift/HybridVisionCameraMLKitSpec.swift new file mode 100644 index 0000000..0c0ed11 --- /dev/null +++ b/nitrogen/generated/ios/swift/HybridVisionCameraMLKitSpec.swift @@ -0,0 +1,57 @@ +/// +/// HybridVisionCameraMLKitSpec.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/// See ``HybridVisionCameraMLKitSpec`` +public protocol HybridVisionCameraMLKitSpec_protocol: HybridObject { + // Properties + + + // Methods + func isFeatureAvailable(feature: MLKitFeature) throws -> Bool + func createTextRecognizer(options: TextRecognizerOptions) throws -> (any HybridTextRecognizerSpec) + func createBarcodeScanner(options: BarcodeScannerOptions) throws -> (any HybridBarcodeScannerSpec) +} + +public extension HybridVisionCameraMLKitSpec_protocol { + /// Default implementation of ``HybridObject.toString`` + func toString() -> String { + return "[HybridObject VisionCameraMLKit]" + } +} + +/// See ``HybridVisionCameraMLKitSpec`` +open class HybridVisionCameraMLKitSpec_base { + private weak var cxxWrapper: HybridVisionCameraMLKitSpec_cxx? = nil + public init() { } + public func getCxxWrapper() -> HybridVisionCameraMLKitSpec_cxx { + #if DEBUG + guard self is any HybridVisionCameraMLKitSpec else { + fatalError("`self` is not a `HybridVisionCameraMLKitSpec`! Did you accidentally inherit from `HybridVisionCameraMLKitSpec_base` instead of `HybridVisionCameraMLKitSpec`?") + } + #endif + if let cxxWrapper = self.cxxWrapper { + return cxxWrapper + } else { + let cxxWrapper = HybridVisionCameraMLKitSpec_cxx(self as! any HybridVisionCameraMLKitSpec) + self.cxxWrapper = cxxWrapper + return cxxWrapper + } + } +} + +/** + * A Swift base-protocol representing the VisionCameraMLKit HybridObject. + * Implement this protocol to create Swift-based instances of VisionCameraMLKit. + * ```swift + * class HybridVisionCameraMLKit : HybridVisionCameraMLKitSpec { + * // ... + * } + * ``` + */ +public typealias HybridVisionCameraMLKitSpec = HybridVisionCameraMLKitSpec_protocol & HybridVisionCameraMLKitSpec_base diff --git a/nitrogen/generated/ios/swift/HybridVisionCameraMLKitSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridVisionCameraMLKitSpec_cxx.swift new file mode 100644 index 0000000..713de6d --- /dev/null +++ b/nitrogen/generated/ios/swift/HybridVisionCameraMLKitSpec_cxx.swift @@ -0,0 +1,168 @@ +/// +/// HybridVisionCameraMLKitSpec_cxx.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * A class implementation that bridges HybridVisionCameraMLKitSpec over to C++. + * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined. + * + * Also, some Swift types need to be bridged with special handling: + * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330) + * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper + * - Throwing methods need to be wrapped with a Result type, as exceptions cannot be propagated to C++ + */ +open class HybridVisionCameraMLKitSpec_cxx { + /** + * The Swift <> C++ bridge's namespace (`margelo::nitro::visioncameramlkit::bridge::swift`) + * from `VisionCameraMLKit-Swift-Cxx-Bridge.hpp`. + * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. + */ + public typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Holds an instance of the `HybridVisionCameraMLKitSpec` Swift protocol. + */ + private var __implementation: any HybridVisionCameraMLKitSpec + + /** + * Holds a weak pointer to the C++ class that wraps the Swift class. + */ + private var __cxxPart: bridge.std__weak_ptr_HybridVisionCameraMLKitSpec_ + + /** + * Create a new `HybridVisionCameraMLKitSpec_cxx` that wraps the given `HybridVisionCameraMLKitSpec`. + * All properties and methods bridge to C++ types. + */ + public init(_ implementation: any HybridVisionCameraMLKitSpec) { + self.__implementation = implementation + self.__cxxPart = .init() + /* no base class */ + } + + /** + * Get the actual `HybridVisionCameraMLKitSpec` instance this class wraps. + */ + @inline(__always) + public func getHybridVisionCameraMLKitSpec() -> any HybridVisionCameraMLKitSpec { + return __implementation + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `HybridVisionCameraMLKitSpec_cxx`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridVisionCameraMLKitSpec_cxx { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } + + /** + * Gets (or creates) the C++ part of this Hybrid Object. + * The C++ part is a `std::shared_ptr`. + */ + public func getCxxPart() -> bridge.std__shared_ptr_HybridVisionCameraMLKitSpec_ { + let cachedCxxPart = self.__cxxPart.lock() + if Bool(fromCxx: cachedCxxPart) { + return cachedCxxPart + } else { + let newCxxPart = bridge.create_std__shared_ptr_HybridVisionCameraMLKitSpec_(self.toUnsafe()) + __cxxPart = bridge.weakify_std__shared_ptr_HybridVisionCameraMLKitSpec_(newCxxPart) + return newCxxPart + } + } + + + + /** + * Get the memory size of the Swift class (plus size of any other allocations) + * so the JS VM can properly track it and garbage-collect the JS object if needed. + */ + @inline(__always) + public var memorySize: Int { + return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize + } + + /** + * Compares this object with the given [other] object for reference equality. + */ + @inline(__always) + public func equals(other: HybridVisionCameraMLKitSpec_cxx) -> Bool { + return self.__implementation === other.__implementation + } + + /** + * Call dispose() on the Swift class. + * This _may_ be called manually from JS. + */ + @inline(__always) + public func dispose() { + self.__implementation.dispose() + } + + /** + * Call toString() on the Swift class. + */ + @inline(__always) + public func toString() -> String { + return self.__implementation.toString() + } + + // Properties + + + // Methods + @inline(__always) + public final func isFeatureAvailable(feature: Int32) -> bridge.Result_bool_ { + do { + let __result = try self.__implementation.isFeatureAvailable(feature: margelo.nitro.visioncameramlkit.MLKitFeature(rawValue: feature)!) + let __resultCpp = __result + return bridge.create_Result_bool_(__resultCpp) + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_bool_(__exceptionPtr) + } + } + + @inline(__always) + public final func createTextRecognizer(options: TextRecognizerOptions) -> bridge.Result_std__shared_ptr_HybridTextRecognizerSpec__ { + do { + let __result = try self.__implementation.createTextRecognizer(options: options) + let __resultCpp = { () -> bridge.std__shared_ptr_HybridTextRecognizerSpec_ in + let __cxxWrapped = __result.getCxxWrapper() + return __cxxWrapped.getCxxPart() + }() + return bridge.create_Result_std__shared_ptr_HybridTextRecognizerSpec__(__resultCpp) + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_std__shared_ptr_HybridTextRecognizerSpec__(__exceptionPtr) + } + } + + @inline(__always) + public final func createBarcodeScanner(options: BarcodeScannerOptions) -> bridge.Result_std__shared_ptr_HybridBarcodeScannerSpec__ { + do { + let __result = try self.__implementation.createBarcodeScanner(options: options) + let __resultCpp = { () -> bridge.std__shared_ptr_HybridBarcodeScannerSpec_ in + let __cxxWrapped = __result.getCxxWrapper() + return __cxxWrapped.getCxxPart() + }() + return bridge.create_Result_std__shared_ptr_HybridBarcodeScannerSpec__(__resultCpp) + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_std__shared_ptr_HybridBarcodeScannerSpec__(__exceptionPtr) + } + } +} diff --git a/nitrogen/generated/ios/swift/MLKitBaseArguments.swift b/nitrogen/generated/ios/swift/MLKitBaseArguments.swift new file mode 100644 index 0000000..6012fd4 --- /dev/null +++ b/nitrogen/generated/ios/swift/MLKitBaseArguments.swift @@ -0,0 +1,35 @@ +/// +/// MLKitBaseArguments.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `MLKitBaseArguments`, backed by a C++ struct. + */ +public typealias MLKitBaseArguments = margelo.nitro.visioncameramlkit.MLKitBaseArguments + +public extension MLKitBaseArguments { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `MLKitBaseArguments`. + */ + init(outputOrientation: Orientation?) { + self.init({ () -> bridge.std__optional_Orientation_ in + if let __unwrappedValue = outputOrientation { + return bridge.create_std__optional_Orientation_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var outputOrientation: Orientation? { + return self.__outputOrientation.value + } +} diff --git a/nitrogen/generated/ios/swift/MLKitFeature.swift b/nitrogen/generated/ios/swift/MLKitFeature.swift new file mode 100644 index 0000000..8ce63b7 --- /dev/null +++ b/nitrogen/generated/ios/swift/MLKitFeature.swift @@ -0,0 +1,76 @@ +/// +/// MLKitFeature.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS union `MLKitFeature`, backed by a C++ enum. + */ +public typealias MLKitFeature = margelo.nitro.visioncameramlkit.MLKitFeature + +public extension MLKitFeature { + /** + * Get a MLKitFeature for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "TextRecognition": + self = .textrecognition + case "FaceDetection": + self = .facedetection + case "FaceMeshDetection": + self = .facemeshdetection + case "PoseDetection": + self = .posedetection + case "SelfieSegmentation": + self = .selfiesegmentation + case "SubjectSegmentation": + self = .subjectsegmentation + case "DocumentScanner": + self = .documentscanner + case "BarcodeScanning": + self = .barcodescanning + case "ImageLabeling": + self = .imagelabeling + case "ObjectDetection": + self = .objectdetection + case "DigitalInkRecognition": + self = .digitalinkrecognition + default: + return nil + } + } + + /** + * Get the String value this MLKitFeature represents. + */ + var stringValue: String { + switch self { + case .textrecognition: + return "TextRecognition" + case .facedetection: + return "FaceDetection" + case .facemeshdetection: + return "FaceMeshDetection" + case .posedetection: + return "PoseDetection" + case .selfiesegmentation: + return "SelfieSegmentation" + case .subjectsegmentation: + return "SubjectSegmentation" + case .documentscanner: + return "DocumentScanner" + case .barcodescanning: + return "BarcodeScanning" + case .imagelabeling: + return "ImageLabeling" + case .objectdetection: + return "ObjectDetection" + case .digitalinkrecognition: + return "DigitalInkRecognition" + } + } +} diff --git a/nitrogen/generated/ios/swift/Orientation.swift b/nitrogen/generated/ios/swift/Orientation.swift new file mode 100644 index 0000000..338dcb4 --- /dev/null +++ b/nitrogen/generated/ios/swift/Orientation.swift @@ -0,0 +1,48 @@ +/// +/// Orientation.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS union `Orientation`, backed by a C++ enum. + */ +public typealias Orientation = margelo.nitro.visioncameramlkit.Orientation + +public extension Orientation { + /** + * Get a Orientation for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "portrait": + self = .portrait + case "portrait-upside-down": + self = .portraitUpsideDown + case "landscape-left": + self = .landscapeLeft + case "landscape-right": + self = .landscapeRight + default: + return nil + } + } + + /** + * Get the String value this Orientation represents. + */ + var stringValue: String { + switch self { + case .portrait: + return "portrait" + case .portraitUpsideDown: + return "portrait-upside-down" + case .landscapeLeft: + return "landscape-left" + case .landscapeRight: + return "landscape-right" + } + } +} diff --git a/nitrogen/generated/ios/swift/RegionOfInterest.swift b/nitrogen/generated/ios/swift/RegionOfInterest.swift new file mode 100644 index 0000000..67af6d1 --- /dev/null +++ b/nitrogen/generated/ios/swift/RegionOfInterest.swift @@ -0,0 +1,55 @@ +/// +/// RegionOfInterest.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `RegionOfInterest`, backed by a C++ struct. + */ +public typealias RegionOfInterest = margelo.nitro.visioncameramlkit.RegionOfInterest + +public extension RegionOfInterest { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `RegionOfInterest`. + */ + init(x: Double, y: Double, width: Double, height: Double, unit: RegionOfInterestUnit?) { + self.init(x, y, width, height, { () -> bridge.std__optional_RegionOfInterestUnit_ in + if let __unwrappedValue = unit { + return bridge.create_std__optional_RegionOfInterestUnit_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var x: Double { + return self.__x + } + + @inline(__always) + var y: Double { + return self.__y + } + + @inline(__always) + var width: Double { + return self.__width + } + + @inline(__always) + var height: Double { + return self.__height + } + + @inline(__always) + var unit: RegionOfInterestUnit? { + return self.__unit.value + } +} diff --git a/nitrogen/generated/ios/swift/RegionOfInterestUnit.swift b/nitrogen/generated/ios/swift/RegionOfInterestUnit.swift new file mode 100644 index 0000000..1a4e5ac --- /dev/null +++ b/nitrogen/generated/ios/swift/RegionOfInterestUnit.swift @@ -0,0 +1,40 @@ +/// +/// RegionOfInterestUnit.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS union `RegionOfInterestUnit`, backed by a C++ enum. + */ +public typealias RegionOfInterestUnit = margelo.nitro.visioncameramlkit.RegionOfInterestUnit + +public extension RegionOfInterestUnit { + /** + * Get a RegionOfInterestUnit for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "normalized": + self = .normalized + case "pixel": + self = .pixel + default: + return nil + } + } + + /** + * Get the String value this RegionOfInterestUnit represents. + */ + var stringValue: String { + switch self { + case .normalized: + return "normalized" + case .pixel: + return "pixel" + } + } +} diff --git a/nitrogen/generated/ios/swift/TextBlock.swift b/nitrogen/generated/ios/swift/TextBlock.swift new file mode 100644 index 0000000..0c0cb43 --- /dev/null +++ b/nitrogen/generated/ios/swift/TextBlock.swift @@ -0,0 +1,67 @@ +/// +/// TextBlock.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `TextBlock`, backed by a C++ struct. + */ +public typealias TextBlock = margelo.nitro.visioncameramlkit.TextBlock + +public extension TextBlock { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `TextBlock`. + */ + init(bounds: BoundingBox, corners: [Corner], languages: [String], text: String, lines: [TextLine]) { + self.init(bounds, { () -> bridge.std__vector_Corner_ in + var __vector = bridge.create_std__vector_Corner_(corners.count) + for __item in corners { + __vector.push_back(__item) + } + return __vector + }(), { () -> bridge.std__vector_std__string_ in + var __vector = bridge.create_std__vector_std__string_(languages.count) + for __item in languages { + __vector.push_back(std.string(__item)) + } + return __vector + }(), std.string(text), { () -> bridge.std__vector_TextLine_ in + var __vector = bridge.create_std__vector_TextLine_(lines.count) + for __item in lines { + __vector.push_back(__item) + } + return __vector + }()) + } + + @inline(__always) + var bounds: BoundingBox { + return self.__bounds + } + + @inline(__always) + var corners: [Corner] { + return self.__corners.map({ __item in __item }) + } + + @inline(__always) + var languages: [String] { + return self.__languages.map({ __item in String(__item) }) + } + + @inline(__always) + var text: String { + return String(self.__text) + } + + @inline(__always) + var lines: [TextLine] { + return self.__lines.map({ __item in __item }) + } +} diff --git a/nitrogen/generated/ios/swift/TextElement.swift b/nitrogen/generated/ios/swift/TextElement.swift new file mode 100644 index 0000000..c91f560 --- /dev/null +++ b/nitrogen/generated/ios/swift/TextElement.swift @@ -0,0 +1,141 @@ +/// +/// TextElement.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `TextElement`, backed by a C++ struct. + */ +public typealias TextElement = margelo.nitro.visioncameramlkit.TextElement + +public extension TextElement { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `TextElement`. + */ + init(bounds: BoundingBox, corners: [Corner], confidence: Variant_NullType_Double?, angle: Variant_NullType_Double?, languages: [String], text: String, symbols: [TextSymbol]) { + self.init(bounds, { () -> bridge.std__vector_Corner_ in + var __vector = bridge.create_std__vector_Corner_(corners.count) + for __item in corners { + __vector.push_back(__item) + } + return __vector + }(), { () -> bridge.std__optional_std__variant_nitro__NullType__double__ in + if let __unwrappedValue = confidence { + return bridge.create_std__optional_std__variant_nitro__NullType__double__({ () -> bridge.std__variant_nitro__NullType__double_ in + switch __unwrappedValue { + case .first(let __value): + return bridge.create_std__variant_nitro__NullType__double_(margelo.nitro.NullType.null) + case .second(let __value): + return bridge.create_std__variant_nitro__NullType__double_(__value) + } + }().variant) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__variant_nitro__NullType__double__ in + if let __unwrappedValue = angle { + return bridge.create_std__optional_std__variant_nitro__NullType__double__({ () -> bridge.std__variant_nitro__NullType__double_ in + switch __unwrappedValue { + case .first(let __value): + return bridge.create_std__variant_nitro__NullType__double_(margelo.nitro.NullType.null) + case .second(let __value): + return bridge.create_std__variant_nitro__NullType__double_(__value) + } + }().variant) + } else { + return .init() + } + }(), { () -> bridge.std__vector_std__string_ in + var __vector = bridge.create_std__vector_std__string_(languages.count) + for __item in languages { + __vector.push_back(std.string(__item)) + } + return __vector + }(), std.string(text), { () -> bridge.std__vector_TextSymbol_ in + var __vector = bridge.create_std__vector_TextSymbol_(symbols.count) + for __item in symbols { + __vector.push_back(__item) + } + return __vector + }()) + } + + @inline(__always) + var bounds: BoundingBox { + return self.__bounds + } + + @inline(__always) + var corners: [Corner] { + return self.__corners.map({ __item in __item }) + } + + @inline(__always) + var confidence: Variant_NullType_Double? { + return { () -> Variant_NullType_Double? in + if bridge.has_value_std__optional_std__variant_nitro__NullType__double__(self.__confidence) { + let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__double__(self.__confidence) + return { () -> Variant_NullType_Double in + let __variant = bridge.std__variant_nitro__NullType__double_(__unwrapped) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(NullType.null) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() + } else { + return nil + } + }() + } + + @inline(__always) + var angle: Variant_NullType_Double? { + return { () -> Variant_NullType_Double? in + if bridge.has_value_std__optional_std__variant_nitro__NullType__double__(self.__angle) { + let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__double__(self.__angle) + return { () -> Variant_NullType_Double in + let __variant = bridge.std__variant_nitro__NullType__double_(__unwrapped) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(NullType.null) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() + } else { + return nil + } + }() + } + + @inline(__always) + var languages: [String] { + return self.__languages.map({ __item in String(__item) }) + } + + @inline(__always) + var text: String { + return String(self.__text) + } + + @inline(__always) + var symbols: [TextSymbol] { + return self.__symbols.map({ __item in __item }) + } +} diff --git a/nitrogen/generated/ios/swift/TextLine.swift b/nitrogen/generated/ios/swift/TextLine.swift new file mode 100644 index 0000000..3fd2d75 --- /dev/null +++ b/nitrogen/generated/ios/swift/TextLine.swift @@ -0,0 +1,141 @@ +/// +/// TextLine.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `TextLine`, backed by a C++ struct. + */ +public typealias TextLine = margelo.nitro.visioncameramlkit.TextLine + +public extension TextLine { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `TextLine`. + */ + init(bounds: BoundingBox, corners: [Corner], confidence: Variant_NullType_Double?, angle: Variant_NullType_Double?, languages: [String], text: String, elements: [TextElement]) { + self.init(bounds, { () -> bridge.std__vector_Corner_ in + var __vector = bridge.create_std__vector_Corner_(corners.count) + for __item in corners { + __vector.push_back(__item) + } + return __vector + }(), { () -> bridge.std__optional_std__variant_nitro__NullType__double__ in + if let __unwrappedValue = confidence { + return bridge.create_std__optional_std__variant_nitro__NullType__double__({ () -> bridge.std__variant_nitro__NullType__double_ in + switch __unwrappedValue { + case .first(let __value): + return bridge.create_std__variant_nitro__NullType__double_(margelo.nitro.NullType.null) + case .second(let __value): + return bridge.create_std__variant_nitro__NullType__double_(__value) + } + }().variant) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__variant_nitro__NullType__double__ in + if let __unwrappedValue = angle { + return bridge.create_std__optional_std__variant_nitro__NullType__double__({ () -> bridge.std__variant_nitro__NullType__double_ in + switch __unwrappedValue { + case .first(let __value): + return bridge.create_std__variant_nitro__NullType__double_(margelo.nitro.NullType.null) + case .second(let __value): + return bridge.create_std__variant_nitro__NullType__double_(__value) + } + }().variant) + } else { + return .init() + } + }(), { () -> bridge.std__vector_std__string_ in + var __vector = bridge.create_std__vector_std__string_(languages.count) + for __item in languages { + __vector.push_back(std.string(__item)) + } + return __vector + }(), std.string(text), { () -> bridge.std__vector_TextElement_ in + var __vector = bridge.create_std__vector_TextElement_(elements.count) + for __item in elements { + __vector.push_back(__item) + } + return __vector + }()) + } + + @inline(__always) + var bounds: BoundingBox { + return self.__bounds + } + + @inline(__always) + var corners: [Corner] { + return self.__corners.map({ __item in __item }) + } + + @inline(__always) + var confidence: Variant_NullType_Double? { + return { () -> Variant_NullType_Double? in + if bridge.has_value_std__optional_std__variant_nitro__NullType__double__(self.__confidence) { + let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__double__(self.__confidence) + return { () -> Variant_NullType_Double in + let __variant = bridge.std__variant_nitro__NullType__double_(__unwrapped) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(NullType.null) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() + } else { + return nil + } + }() + } + + @inline(__always) + var angle: Variant_NullType_Double? { + return { () -> Variant_NullType_Double? in + if bridge.has_value_std__optional_std__variant_nitro__NullType__double__(self.__angle) { + let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__double__(self.__angle) + return { () -> Variant_NullType_Double in + let __variant = bridge.std__variant_nitro__NullType__double_(__unwrapped) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(NullType.null) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() + } else { + return nil + } + }() + } + + @inline(__always) + var languages: [String] { + return self.__languages.map({ __item in String(__item) }) + } + + @inline(__always) + var text: String { + return String(self.__text) + } + + @inline(__always) + var elements: [TextElement] { + return self.__elements.map({ __item in __item }) + } +} diff --git a/nitrogen/generated/ios/swift/TextRecognitionLanguage.swift b/nitrogen/generated/ios/swift/TextRecognitionLanguage.swift new file mode 100644 index 0000000..1831fa7 --- /dev/null +++ b/nitrogen/generated/ios/swift/TextRecognitionLanguage.swift @@ -0,0 +1,52 @@ +/// +/// TextRecognitionLanguage.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS union `TextRecognitionLanguage`, backed by a C++ enum. + */ +public typealias TextRecognitionLanguage = margelo.nitro.visioncameramlkit.TextRecognitionLanguage + +public extension TextRecognitionLanguage { + /** + * Get a TextRecognitionLanguage for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "LATIN": + self = .latin + case "CHINESE": + self = .chinese + case "DEVANAGARI": + self = .devanagari + case "JAPANESE": + self = .japanese + case "KOREAN": + self = .korean + default: + return nil + } + } + + /** + * Get the String value this TextRecognitionLanguage represents. + */ + var stringValue: String { + switch self { + case .latin: + return "LATIN" + case .chinese: + return "CHINESE" + case .devanagari: + return "DEVANAGARI" + case .japanese: + return "JAPANESE" + case .korean: + return "KOREAN" + } + } +} diff --git a/nitrogen/generated/ios/swift/TextRecognitionResult.swift b/nitrogen/generated/ios/swift/TextRecognitionResult.swift new file mode 100644 index 0000000..40ff4a7 --- /dev/null +++ b/nitrogen/generated/ios/swift/TextRecognitionResult.swift @@ -0,0 +1,40 @@ +/// +/// TextRecognitionResult.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `TextRecognitionResult`, backed by a C++ struct. + */ +public typealias TextRecognitionResult = margelo.nitro.visioncameramlkit.TextRecognitionResult + +public extension TextRecognitionResult { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `TextRecognitionResult`. + */ + init(text: String, blocks: [TextBlock]) { + self.init(std.string(text), { () -> bridge.std__vector_TextBlock_ in + var __vector = bridge.create_std__vector_TextBlock_(blocks.count) + for __item in blocks { + __vector.push_back(__item) + } + return __vector + }()) + } + + @inline(__always) + var text: String { + return String(self.__text) + } + + @inline(__always) + var blocks: [TextBlock] { + return self.__blocks.map({ __item in __item }) + } +} diff --git a/nitrogen/generated/ios/swift/TextRecognizerOptions.swift b/nitrogen/generated/ios/swift/TextRecognizerOptions.swift new file mode 100644 index 0000000..ec3f15a --- /dev/null +++ b/nitrogen/generated/ios/swift/TextRecognizerOptions.swift @@ -0,0 +1,111 @@ +/// +/// TextRecognizerOptions.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `TextRecognizerOptions`, backed by a C++ struct. + */ +public typealias TextRecognizerOptions = margelo.nitro.visioncameramlkit.TextRecognizerOptions + +public extension TextRecognizerOptions { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `TextRecognizerOptions`. + */ + init(language: TextRecognitionLanguage?, scaleFactor: Double?, invertColors: Bool?, frameProcessInterval: Double?, roi: RegionOfInterest?, orientation: Orientation?) { + self.init({ () -> bridge.std__optional_TextRecognitionLanguage_ in + if let __unwrappedValue = language { + return bridge.create_std__optional_TextRecognitionLanguage_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_double_ in + if let __unwrappedValue = scaleFactor { + return bridge.create_std__optional_double_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_bool_ in + if let __unwrappedValue = invertColors { + return bridge.create_std__optional_bool_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_double_ in + if let __unwrappedValue = frameProcessInterval { + return bridge.create_std__optional_double_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_RegionOfInterest_ in + if let __unwrappedValue = roi { + return bridge.create_std__optional_RegionOfInterest_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_Orientation_ in + if let __unwrappedValue = orientation { + return bridge.create_std__optional_Orientation_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var language: TextRecognitionLanguage? { + return self.__language.value + } + + @inline(__always) + var scaleFactor: Double? { + return { () -> Double? in + if bridge.has_value_std__optional_double_(self.__scaleFactor) { + let __unwrapped = bridge.get_std__optional_double_(self.__scaleFactor) + return __unwrapped + } else { + return nil + } + }() + } + + @inline(__always) + var invertColors: Bool? { + return { () -> Bool? in + if bridge.has_value_std__optional_bool_(self.__invertColors) { + let __unwrapped = bridge.get_std__optional_bool_(self.__invertColors) + return __unwrapped + } else { + return nil + } + }() + } + + @inline(__always) + var frameProcessInterval: Double? { + return { () -> Double? in + if bridge.has_value_std__optional_double_(self.__frameProcessInterval) { + let __unwrapped = bridge.get_std__optional_double_(self.__frameProcessInterval) + return __unwrapped + } else { + return nil + } + }() + } + + @inline(__always) + var roi: RegionOfInterest? { + return self.__roi.value + } + + @inline(__always) + var orientation: Orientation? { + return self.__orientation.value + } +} diff --git a/nitrogen/generated/ios/swift/TextSymbol.swift b/nitrogen/generated/ios/swift/TextSymbol.swift new file mode 100644 index 0000000..d1e03f5 --- /dev/null +++ b/nitrogen/generated/ios/swift/TextSymbol.swift @@ -0,0 +1,66 @@ +/// +/// TextSymbol.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `TextSymbol`, backed by a C++ struct. + */ +public typealias TextSymbol = margelo.nitro.visioncameramlkit.TextSymbol + +public extension TextSymbol { + private typealias bridge = margelo.nitro.visioncameramlkit.bridge.swift + + /** + * Create a new instance of `TextSymbol`. + */ + init(bounds: BoundingBox, corners: [Corner], confidence: Double, angle: Double, languages: [String], text: String) { + self.init(bounds, { () -> bridge.std__vector_Corner_ in + var __vector = bridge.create_std__vector_Corner_(corners.count) + for __item in corners { + __vector.push_back(__item) + } + return __vector + }(), confidence, angle, { () -> bridge.std__vector_std__string_ in + var __vector = bridge.create_std__vector_std__string_(languages.count) + for __item in languages { + __vector.push_back(std.string(__item)) + } + return __vector + }(), std.string(text)) + } + + @inline(__always) + var bounds: BoundingBox { + return self.__bounds + } + + @inline(__always) + var corners: [Corner] { + return self.__corners.map({ __item in __item }) + } + + @inline(__always) + var confidence: Double { + return self.__confidence + } + + @inline(__always) + var angle: Double { + return self.__angle + } + + @inline(__always) + var languages: [String] { + return self.__languages.map({ __item in String(__item) }) + } + + @inline(__always) + var text: String { + return String(self.__text) + } +} diff --git a/nitrogen/generated/ios/swift/Variant_NullType_Double.swift b/nitrogen/generated/ios/swift/Variant_NullType_Double.swift new file mode 100644 index 0000000..8918a71 --- /dev/null +++ b/nitrogen/generated/ios/swift/Variant_NullType_Double.swift @@ -0,0 +1,30 @@ +/// +/// Variant_NullType_Double.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * An Swift enum with associated values representing a Variant/Union type. + * JS type: `null | number` + */ +@frozen +public enum Variant_NullType_Double { + case first(NullType) + case second(Double) +} + +public extension Variant_NullType_Double { + func asType(_ type: T.Type = T.self) -> T? { + switch self { + case .first(let value): return value as? T + case .second(let value): return value as? T + } + } + func isType(_ type: T.Type = T.self) -> Bool { + return self.asType(type) != nil + } +} diff --git a/nitrogen/generated/shared/c++/BarcodeFormat.hpp b/nitrogen/generated/shared/c++/BarcodeFormat.hpp new file mode 100644 index 0000000..8b621db --- /dev/null +++ b/nitrogen/generated/shared/c++/BarcodeFormat.hpp @@ -0,0 +1,128 @@ +/// +/// BarcodeFormat.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +namespace margelo::nitro::visioncameramlkit { + + /** + * An enum which can be represented as a JavaScript union (BarcodeFormat). + */ + enum class BarcodeFormat { + UNKNOWN SWIFT_NAME(unknown) = 0, + ALL_FORMATS SWIFT_NAME(allFormats) = 1, + CODE_128 SWIFT_NAME(code128) = 2, + CODE_39 SWIFT_NAME(code39) = 3, + CODE_93 SWIFT_NAME(code93) = 4, + CODABAR SWIFT_NAME(codabar) = 5, + DATA_MATRIX SWIFT_NAME(dataMatrix) = 6, + EAN_13 SWIFT_NAME(ean13) = 7, + EAN_8 SWIFT_NAME(ean8) = 8, + ITF SWIFT_NAME(itf) = 9, + QR_CODE SWIFT_NAME(qrCode) = 10, + UPC_A SWIFT_NAME(upcA) = 11, + UPC_E SWIFT_NAME(upcE) = 12, + PDF417 SWIFT_NAME(pdf417) = 13, + AZTEC SWIFT_NAME(aztec) = 14, + } CLOSED_ENUM; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ BarcodeFormat <> JS BarcodeFormat (union) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::BarcodeFormat fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + std::string unionValue = JSIConverter::fromJSI(runtime, arg); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("UNKNOWN"): return margelo::nitro::visioncameramlkit::BarcodeFormat::UNKNOWN; + case hashString("ALL_FORMATS"): return margelo::nitro::visioncameramlkit::BarcodeFormat::ALL_FORMATS; + case hashString("CODE_128"): return margelo::nitro::visioncameramlkit::BarcodeFormat::CODE_128; + case hashString("CODE_39"): return margelo::nitro::visioncameramlkit::BarcodeFormat::CODE_39; + case hashString("CODE_93"): return margelo::nitro::visioncameramlkit::BarcodeFormat::CODE_93; + case hashString("CODABAR"): return margelo::nitro::visioncameramlkit::BarcodeFormat::CODABAR; + case hashString("DATA_MATRIX"): return margelo::nitro::visioncameramlkit::BarcodeFormat::DATA_MATRIX; + case hashString("EAN_13"): return margelo::nitro::visioncameramlkit::BarcodeFormat::EAN_13; + case hashString("EAN_8"): return margelo::nitro::visioncameramlkit::BarcodeFormat::EAN_8; + case hashString("ITF"): return margelo::nitro::visioncameramlkit::BarcodeFormat::ITF; + case hashString("QR_CODE"): return margelo::nitro::visioncameramlkit::BarcodeFormat::QR_CODE; + case hashString("UPC_A"): return margelo::nitro::visioncameramlkit::BarcodeFormat::UPC_A; + case hashString("UPC_E"): return margelo::nitro::visioncameramlkit::BarcodeFormat::UPC_E; + case hashString("PDF417"): return margelo::nitro::visioncameramlkit::BarcodeFormat::PDF417; + case hashString("AZTEC"): return margelo::nitro::visioncameramlkit::BarcodeFormat::AZTEC; + default: [[unlikely]] + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum BarcodeFormat - invalid value!"); + } + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::visioncameramlkit::BarcodeFormat arg) { + switch (arg) { + case margelo::nitro::visioncameramlkit::BarcodeFormat::UNKNOWN: return JSIConverter::toJSI(runtime, "UNKNOWN"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::ALL_FORMATS: return JSIConverter::toJSI(runtime, "ALL_FORMATS"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::CODE_128: return JSIConverter::toJSI(runtime, "CODE_128"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::CODE_39: return JSIConverter::toJSI(runtime, "CODE_39"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::CODE_93: return JSIConverter::toJSI(runtime, "CODE_93"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::CODABAR: return JSIConverter::toJSI(runtime, "CODABAR"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::DATA_MATRIX: return JSIConverter::toJSI(runtime, "DATA_MATRIX"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::EAN_13: return JSIConverter::toJSI(runtime, "EAN_13"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::EAN_8: return JSIConverter::toJSI(runtime, "EAN_8"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::ITF: return JSIConverter::toJSI(runtime, "ITF"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::QR_CODE: return JSIConverter::toJSI(runtime, "QR_CODE"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::UPC_A: return JSIConverter::toJSI(runtime, "UPC_A"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::UPC_E: return JSIConverter::toJSI(runtime, "UPC_E"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::PDF417: return JSIConverter::toJSI(runtime, "PDF417"); + case margelo::nitro::visioncameramlkit::BarcodeFormat::AZTEC: return JSIConverter::toJSI(runtime, "AZTEC"); + default: [[unlikely]] + throw std::invalid_argument("Cannot convert BarcodeFormat to JS - invalid value: " + + std::to_string(static_cast(arg)) + "!"); + } + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isString()) { + return false; + } + std::string unionValue = JSIConverter::fromJSI(runtime, value); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("UNKNOWN"): + case hashString("ALL_FORMATS"): + case hashString("CODE_128"): + case hashString("CODE_39"): + case hashString("CODE_93"): + case hashString("CODABAR"): + case hashString("DATA_MATRIX"): + case hashString("EAN_13"): + case hashString("EAN_8"): + case hashString("ITF"): + case hashString("QR_CODE"): + case hashString("UPC_A"): + case hashString("UPC_E"): + case hashString("PDF417"): + case hashString("AZTEC"): + return true; + default: + return false; + } + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/BarcodeScannerBarcode.hpp b/nitrogen/generated/shared/c++/BarcodeScannerBarcode.hpp new file mode 100644 index 0000000..75e2d10 --- /dev/null +++ b/nitrogen/generated/shared/c++/BarcodeScannerBarcode.hpp @@ -0,0 +1,137 @@ +/// +/// BarcodeScannerBarcode.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `BarcodeFormat` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeFormat; } +// Forward declaration of `BarcodeValueTypeName` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeValueTypeName; } + +#include "BoundingBox.hpp" +#include +#include "Corner.hpp" +#include +#include "BarcodeFormat.hpp" +#include "BarcodeValueTypeName.hpp" +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (BarcodeScannerBarcode). + */ + struct BarcodeScannerBarcode final { + public: + std::optional bounds SWIFT_PRIVATE; + std::optional> corners SWIFT_PRIVATE; + double format SWIFT_PRIVATE; + BarcodeFormat formatName SWIFT_PRIVATE; + double valueType SWIFT_PRIVATE; + BarcodeValueTypeName valueTypeName SWIFT_PRIVATE; + std::optional rawValue SWIFT_PRIVATE; + std::optional displayValue SWIFT_PRIVATE; + std::optional> rawBytes SWIFT_PRIVATE; + std::optional> value SWIFT_PRIVATE; + bool isPotential SWIFT_PRIVATE; + + public: + BarcodeScannerBarcode() = default; + explicit BarcodeScannerBarcode(std::optional bounds, std::optional> corners, double format, BarcodeFormat formatName, double valueType, BarcodeValueTypeName valueTypeName, std::optional rawValue, std::optional displayValue, std::optional> rawBytes, std::optional> value, bool isPotential): bounds(bounds), corners(corners), format(format), formatName(formatName), valueType(valueType), valueTypeName(valueTypeName), rawValue(rawValue), displayValue(displayValue), rawBytes(rawBytes), value(value), isPotential(isPotential) {} + + public: + friend bool operator==(const BarcodeScannerBarcode& lhs, const BarcodeScannerBarcode& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ BarcodeScannerBarcode <> JS BarcodeScannerBarcode (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::BarcodeScannerBarcode fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::BarcodeScannerBarcode( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "format"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "formatName"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "valueType"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "valueTypeName"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawValue"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "displayValue"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawBytes"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPotential"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::BarcodeScannerBarcode& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "bounds"), JSIConverter>::toJSI(runtime, arg.bounds)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "corners"), JSIConverter>>::toJSI(runtime, arg.corners)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "format"), JSIConverter::toJSI(runtime, arg.format)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "formatName"), JSIConverter::toJSI(runtime, arg.formatName)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "valueType"), JSIConverter::toJSI(runtime, arg.valueType)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "valueTypeName"), JSIConverter::toJSI(runtime, arg.valueTypeName)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "rawValue"), JSIConverter>::toJSI(runtime, arg.rawValue)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "displayValue"), JSIConverter>::toJSI(runtime, arg.displayValue)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "rawBytes"), JSIConverter>>::toJSI(runtime, arg.rawBytes)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "value"), JSIConverter>>::toJSI(runtime, arg.value)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "isPotential"), JSIConverter::toJSI(runtime, arg.isPotential)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "format")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "formatName")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "valueType")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "valueTypeName")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawValue")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "displayValue")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawBytes")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPotential")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/BarcodeScannerOptions.hpp b/nitrogen/generated/shared/c++/BarcodeScannerOptions.hpp new file mode 100644 index 0000000..edec6fd --- /dev/null +++ b/nitrogen/generated/shared/c++/BarcodeScannerOptions.hpp @@ -0,0 +1,116 @@ +/// +/// BarcodeScannerOptions.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `BarcodeFormat` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class BarcodeFormat; } +// Forward declaration of `RegionOfInterest` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct RegionOfInterest; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } + +#include "BarcodeFormat.hpp" +#include +#include +#include "RegionOfInterest.hpp" +#include "Orientation.hpp" + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (BarcodeScannerOptions). + */ + struct BarcodeScannerOptions final { + public: + std::optional> formats SWIFT_PRIVATE; + std::optional enableAllPotentialBarcodes SWIFT_PRIVATE; + std::optional scaleFactor SWIFT_PRIVATE; + std::optional invertColors SWIFT_PRIVATE; + std::optional frameProcessInterval SWIFT_PRIVATE; + std::optional roi SWIFT_PRIVATE; + std::optional orientation SWIFT_PRIVATE; + + public: + BarcodeScannerOptions() = default; + explicit BarcodeScannerOptions(std::optional> formats, std::optional enableAllPotentialBarcodes, std::optional scaleFactor, std::optional invertColors, std::optional frameProcessInterval, std::optional roi, std::optional orientation): formats(formats), enableAllPotentialBarcodes(enableAllPotentialBarcodes), scaleFactor(scaleFactor), invertColors(invertColors), frameProcessInterval(frameProcessInterval), roi(roi), orientation(orientation) {} + + public: + friend bool operator==(const BarcodeScannerOptions& lhs, const BarcodeScannerOptions& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ BarcodeScannerOptions <> JS BarcodeScannerOptions (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::BarcodeScannerOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::BarcodeScannerOptions( + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "formats"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableAllPotentialBarcodes"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "scaleFactor"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invertColors"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frameProcessInterval"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roi"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "orientation"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::BarcodeScannerOptions& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "formats"), JSIConverter>>::toJSI(runtime, arg.formats)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableAllPotentialBarcodes"), JSIConverter>::toJSI(runtime, arg.enableAllPotentialBarcodes)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "scaleFactor"), JSIConverter>::toJSI(runtime, arg.scaleFactor)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "invertColors"), JSIConverter>::toJSI(runtime, arg.invertColors)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "frameProcessInterval"), JSIConverter>::toJSI(runtime, arg.frameProcessInterval)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "roi"), JSIConverter>::toJSI(runtime, arg.roi)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "orientation"), JSIConverter>::toJSI(runtime, arg.orientation)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "formats")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableAllPotentialBarcodes")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "scaleFactor")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invertColors")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frameProcessInterval")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roi")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "orientation")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/BarcodeScannerResult.hpp b/nitrogen/generated/shared/c++/BarcodeScannerResult.hpp new file mode 100644 index 0000000..42d50df --- /dev/null +++ b/nitrogen/generated/shared/c++/BarcodeScannerResult.hpp @@ -0,0 +1,85 @@ +/// +/// BarcodeScannerResult.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `BarcodeScannerBarcode` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerBarcode; } + +#include "BarcodeScannerBarcode.hpp" +#include + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (BarcodeScannerResult). + */ + struct BarcodeScannerResult final { + public: + std::vector barcodes SWIFT_PRIVATE; + + public: + BarcodeScannerResult() = default; + explicit BarcodeScannerResult(std::vector barcodes): barcodes(barcodes) {} + + public: + friend bool operator==(const BarcodeScannerResult& lhs, const BarcodeScannerResult& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ BarcodeScannerResult <> JS BarcodeScannerResult (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::BarcodeScannerResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::BarcodeScannerResult( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "barcodes"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::BarcodeScannerResult& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "barcodes"), JSIConverter>::toJSI(runtime, arg.barcodes)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "barcodes")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/BarcodeValueTypeName.hpp b/nitrogen/generated/shared/c++/BarcodeValueTypeName.hpp new file mode 100644 index 0000000..ba08c0d --- /dev/null +++ b/nitrogen/generated/shared/c++/BarcodeValueTypeName.hpp @@ -0,0 +1,120 @@ +/// +/// BarcodeValueTypeName.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +namespace margelo::nitro::visioncameramlkit { + + /** + * An enum which can be represented as a JavaScript union (BarcodeValueTypeName). + */ + enum class BarcodeValueTypeName { + TYPE_UNKNOWN SWIFT_NAME(typeUnknown) = 0, + TYPE_CONTACT_INFO SWIFT_NAME(typeContactInfo) = 1, + TYPE_EMAIL SWIFT_NAME(typeEmail) = 2, + TYPE_ISBN SWIFT_NAME(typeIsbn) = 3, + TYPE_PHONE SWIFT_NAME(typePhone) = 4, + TYPE_PRODUCT SWIFT_NAME(typeProduct) = 5, + TYPE_SMS SWIFT_NAME(typeSms) = 6, + TYPE_TEXT SWIFT_NAME(typeText) = 7, + TYPE_URL SWIFT_NAME(typeUrl) = 8, + TYPE_WIFI SWIFT_NAME(typeWifi) = 9, + TYPE_GEO SWIFT_NAME(typeGeo) = 10, + TYPE_CALENDAR_EVENT SWIFT_NAME(typeCalendarEvent) = 11, + TYPE_DRIVER_LICENSE SWIFT_NAME(typeDriverLicense) = 12, + } CLOSED_ENUM; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ BarcodeValueTypeName <> JS BarcodeValueTypeName (union) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::BarcodeValueTypeName fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + std::string unionValue = JSIConverter::fromJSI(runtime, arg); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("TYPE_UNKNOWN"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_UNKNOWN; + case hashString("TYPE_CONTACT_INFO"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_CONTACT_INFO; + case hashString("TYPE_EMAIL"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_EMAIL; + case hashString("TYPE_ISBN"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_ISBN; + case hashString("TYPE_PHONE"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_PHONE; + case hashString("TYPE_PRODUCT"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_PRODUCT; + case hashString("TYPE_SMS"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_SMS; + case hashString("TYPE_TEXT"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_TEXT; + case hashString("TYPE_URL"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_URL; + case hashString("TYPE_WIFI"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_WIFI; + case hashString("TYPE_GEO"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_GEO; + case hashString("TYPE_CALENDAR_EVENT"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_CALENDAR_EVENT; + case hashString("TYPE_DRIVER_LICENSE"): return margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_DRIVER_LICENSE; + default: [[unlikely]] + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum BarcodeValueTypeName - invalid value!"); + } + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::visioncameramlkit::BarcodeValueTypeName arg) { + switch (arg) { + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_UNKNOWN: return JSIConverter::toJSI(runtime, "TYPE_UNKNOWN"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_CONTACT_INFO: return JSIConverter::toJSI(runtime, "TYPE_CONTACT_INFO"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_EMAIL: return JSIConverter::toJSI(runtime, "TYPE_EMAIL"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_ISBN: return JSIConverter::toJSI(runtime, "TYPE_ISBN"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_PHONE: return JSIConverter::toJSI(runtime, "TYPE_PHONE"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_PRODUCT: return JSIConverter::toJSI(runtime, "TYPE_PRODUCT"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_SMS: return JSIConverter::toJSI(runtime, "TYPE_SMS"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_TEXT: return JSIConverter::toJSI(runtime, "TYPE_TEXT"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_URL: return JSIConverter::toJSI(runtime, "TYPE_URL"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_WIFI: return JSIConverter::toJSI(runtime, "TYPE_WIFI"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_GEO: return JSIConverter::toJSI(runtime, "TYPE_GEO"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_CALENDAR_EVENT: return JSIConverter::toJSI(runtime, "TYPE_CALENDAR_EVENT"); + case margelo::nitro::visioncameramlkit::BarcodeValueTypeName::TYPE_DRIVER_LICENSE: return JSIConverter::toJSI(runtime, "TYPE_DRIVER_LICENSE"); + default: [[unlikely]] + throw std::invalid_argument("Cannot convert BarcodeValueTypeName to JS - invalid value: " + + std::to_string(static_cast(arg)) + "!"); + } + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isString()) { + return false; + } + std::string unionValue = JSIConverter::fromJSI(runtime, value); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("TYPE_UNKNOWN"): + case hashString("TYPE_CONTACT_INFO"): + case hashString("TYPE_EMAIL"): + case hashString("TYPE_ISBN"): + case hashString("TYPE_PHONE"): + case hashString("TYPE_PRODUCT"): + case hashString("TYPE_SMS"): + case hashString("TYPE_TEXT"): + case hashString("TYPE_URL"): + case hashString("TYPE_WIFI"): + case hashString("TYPE_GEO"): + case hashString("TYPE_CALENDAR_EVENT"): + case hashString("TYPE_DRIVER_LICENSE"): + return true; + default: + return false; + } + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/BoundingBox.hpp b/nitrogen/generated/shared/c++/BoundingBox.hpp new file mode 100644 index 0000000..c614613 --- /dev/null +++ b/nitrogen/generated/shared/c++/BoundingBox.hpp @@ -0,0 +1,119 @@ +/// +/// BoundingBox.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + + + + + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (BoundingBox). + */ + struct BoundingBox final { + public: + double x SWIFT_PRIVATE; + double y SWIFT_PRIVATE; + double centerX SWIFT_PRIVATE; + double centerY SWIFT_PRIVATE; + double width SWIFT_PRIVATE; + double height SWIFT_PRIVATE; + double top SWIFT_PRIVATE; + double left SWIFT_PRIVATE; + double bottom SWIFT_PRIVATE; + double right SWIFT_PRIVATE; + + public: + BoundingBox() = default; + explicit BoundingBox(double x, double y, double centerX, double centerY, double width, double height, double top, double left, double bottom, double right): x(x), y(y), centerX(centerX), centerY(centerY), width(width), height(height), top(top), left(left), bottom(bottom), right(right) {} + + public: + friend bool operator==(const BoundingBox& lhs, const BoundingBox& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ BoundingBox <> JS BoundingBox (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::BoundingBox fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::BoundingBox( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "centerX"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "centerY"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "top"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "left"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottom"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "right"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::BoundingBox& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "x"), JSIConverter::toJSI(runtime, arg.x)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "y"), JSIConverter::toJSI(runtime, arg.y)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "centerX"), JSIConverter::toJSI(runtime, arg.centerX)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "centerY"), JSIConverter::toJSI(runtime, arg.centerY)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter::toJSI(runtime, arg.width)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter::toJSI(runtime, arg.height)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "top"), JSIConverter::toJSI(runtime, arg.top)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "left"), JSIConverter::toJSI(runtime, arg.left)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "bottom"), JSIConverter::toJSI(runtime, arg.bottom)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "right"), JSIConverter::toJSI(runtime, arg.right)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "centerX")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "centerY")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "top")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "left")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottom")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "right")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/Corner.hpp b/nitrogen/generated/shared/c++/Corner.hpp new file mode 100644 index 0000000..3665d97 --- /dev/null +++ b/nitrogen/generated/shared/c++/Corner.hpp @@ -0,0 +1,87 @@ +/// +/// Corner.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + + + + + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (Corner). + */ + struct Corner final { + public: + double x SWIFT_PRIVATE; + double y SWIFT_PRIVATE; + + public: + Corner() = default; + explicit Corner(double x, double y): x(x), y(y) {} + + public: + friend bool operator==(const Corner& lhs, const Corner& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ Corner <> JS Corner (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::Corner fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::Corner( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::Corner& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "x"), JSIConverter::toJSI(runtime, arg.x)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "y"), JSIConverter::toJSI(runtime, arg.y)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.cpp b/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.cpp new file mode 100644 index 0000000..da0f630 --- /dev/null +++ b/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.cpp @@ -0,0 +1,22 @@ +/// +/// HybridBarcodeScannerSpec.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "HybridBarcodeScannerSpec.hpp" + +namespace margelo::nitro::visioncameramlkit { + + void HybridBarcodeScannerSpec::loadHybridMethods() { + // load base methods/properties + HybridObject::loadHybridMethods(); + // load custom methods/properties + registerHybrids(this, [](Prototype& prototype) { + prototype.registerHybridMethod("recognize", &HybridBarcodeScannerSpec::recognize); + prototype.registerHybridMethod("recognizeImage", &HybridBarcodeScannerSpec::recognizeImage); + }); + } + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.hpp b/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.hpp new file mode 100644 index 0000000..be81b72 --- /dev/null +++ b/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.hpp @@ -0,0 +1,74 @@ +/// +/// HybridBarcodeScannerSpec.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `BarcodeScannerResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerResult; } +// Forward declaration of `HybridFrameSpec` to properly resolve imports. +namespace margelo::nitro::camera { class HybridFrameSpec; } +// Forward declaration of `MLKitBaseArguments` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct MLKitBaseArguments; } + +#include "BarcodeScannerResult.hpp" +#include +#include +#include "MLKitBaseArguments.hpp" +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace margelo::nitro; + + /** + * An abstract base class for `BarcodeScanner` + * Inherit this class to create instances of `HybridBarcodeScannerSpec` in C++. + * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. + * @example + * ```cpp + * class HybridBarcodeScanner: public HybridBarcodeScannerSpec { + * public: + * HybridBarcodeScanner(...): HybridObject(TAG) { ... } + * // ... + * }; + * ``` + */ + class HybridBarcodeScannerSpec: public virtual HybridObject { + public: + // Constructor + explicit HybridBarcodeScannerSpec(): HybridObject(TAG) { } + + // Destructor + ~HybridBarcodeScannerSpec() override = default; + + public: + // Properties + + + public: + // Methods + virtual BarcodeScannerResult recognize(const std::shared_ptr& frame, const std::optional& args) = 0; + virtual std::shared_ptr> recognizeImage(const std::string& uri) = 0; + + protected: + // Hybrid Setup + void loadHybridMethods() override; + + protected: + // Tag for logging + static constexpr auto TAG = "BarcodeScanner"; + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/shared/c++/HybridTextRecognizerSpec.cpp b/nitrogen/generated/shared/c++/HybridTextRecognizerSpec.cpp new file mode 100644 index 0000000..cabcd68 --- /dev/null +++ b/nitrogen/generated/shared/c++/HybridTextRecognizerSpec.cpp @@ -0,0 +1,22 @@ +/// +/// HybridTextRecognizerSpec.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "HybridTextRecognizerSpec.hpp" + +namespace margelo::nitro::visioncameramlkit { + + void HybridTextRecognizerSpec::loadHybridMethods() { + // load base methods/properties + HybridObject::loadHybridMethods(); + // load custom methods/properties + registerHybrids(this, [](Prototype& prototype) { + prototype.registerHybridMethod("recognize", &HybridTextRecognizerSpec::recognize); + prototype.registerHybridMethod("recognizeImage", &HybridTextRecognizerSpec::recognizeImage); + }); + } + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/shared/c++/HybridTextRecognizerSpec.hpp b/nitrogen/generated/shared/c++/HybridTextRecognizerSpec.hpp new file mode 100644 index 0000000..9e09106 --- /dev/null +++ b/nitrogen/generated/shared/c++/HybridTextRecognizerSpec.hpp @@ -0,0 +1,74 @@ +/// +/// HybridTextRecognizerSpec.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `TextRecognitionResult` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextRecognitionResult; } +// Forward declaration of `HybridFrameSpec` to properly resolve imports. +namespace margelo::nitro::camera { class HybridFrameSpec; } +// Forward declaration of `MLKitBaseArguments` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct MLKitBaseArguments; } + +#include "TextRecognitionResult.hpp" +#include +#include +#include "MLKitBaseArguments.hpp" +#include +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + using namespace margelo::nitro; + + /** + * An abstract base class for `TextRecognizer` + * Inherit this class to create instances of `HybridTextRecognizerSpec` in C++. + * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. + * @example + * ```cpp + * class HybridTextRecognizer: public HybridTextRecognizerSpec { + * public: + * HybridTextRecognizer(...): HybridObject(TAG) { ... } + * // ... + * }; + * ``` + */ + class HybridTextRecognizerSpec: public virtual HybridObject { + public: + // Constructor + explicit HybridTextRecognizerSpec(): HybridObject(TAG) { } + + // Destructor + ~HybridTextRecognizerSpec() override = default; + + public: + // Properties + + + public: + // Methods + virtual TextRecognitionResult recognize(const std::shared_ptr& frame, const std::optional& args) = 0; + virtual std::shared_ptr> recognizeImage(const std::string& uri) = 0; + + protected: + // Hybrid Setup + void loadHybridMethods() override; + + protected: + // Tag for logging + static constexpr auto TAG = "TextRecognizer"; + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/shared/c++/HybridVisionCameraMLKitSpec.cpp b/nitrogen/generated/shared/c++/HybridVisionCameraMLKitSpec.cpp new file mode 100644 index 0000000..f28b2bd --- /dev/null +++ b/nitrogen/generated/shared/c++/HybridVisionCameraMLKitSpec.cpp @@ -0,0 +1,23 @@ +/// +/// HybridVisionCameraMLKitSpec.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "HybridVisionCameraMLKitSpec.hpp" + +namespace margelo::nitro::visioncameramlkit { + + void HybridVisionCameraMLKitSpec::loadHybridMethods() { + // load base methods/properties + HybridObject::loadHybridMethods(); + // load custom methods/properties + registerHybrids(this, [](Prototype& prototype) { + prototype.registerHybridMethod("isFeatureAvailable", &HybridVisionCameraMLKitSpec::isFeatureAvailable); + prototype.registerHybridMethod("createTextRecognizer", &HybridVisionCameraMLKitSpec::createTextRecognizer); + prototype.registerHybridMethod("createBarcodeScanner", &HybridVisionCameraMLKitSpec::createBarcodeScanner); + }); + } + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/shared/c++/HybridVisionCameraMLKitSpec.hpp b/nitrogen/generated/shared/c++/HybridVisionCameraMLKitSpec.hpp new file mode 100644 index 0000000..dded17f --- /dev/null +++ b/nitrogen/generated/shared/c++/HybridVisionCameraMLKitSpec.hpp @@ -0,0 +1,78 @@ +/// +/// HybridVisionCameraMLKitSpec.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `MLKitFeature` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class MLKitFeature; } +// Forward declaration of `HybridTextRecognizerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridTextRecognizerSpec; } +// Forward declaration of `TextRecognizerOptions` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextRecognizerOptions; } +// Forward declaration of `HybridBarcodeScannerSpec` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { class HybridBarcodeScannerSpec; } +// Forward declaration of `BarcodeScannerOptions` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BarcodeScannerOptions; } + +#include "MLKitFeature.hpp" +#include +#include "HybridTextRecognizerSpec.hpp" +#include "TextRecognizerOptions.hpp" +#include "HybridBarcodeScannerSpec.hpp" +#include "BarcodeScannerOptions.hpp" + +namespace margelo::nitro::visioncameramlkit { + + using namespace margelo::nitro; + + /** + * An abstract base class for `VisionCameraMLKit` + * Inherit this class to create instances of `HybridVisionCameraMLKitSpec` in C++. + * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. + * @example + * ```cpp + * class HybridVisionCameraMLKit: public HybridVisionCameraMLKitSpec { + * public: + * HybridVisionCameraMLKit(...): HybridObject(TAG) { ... } + * // ... + * }; + * ``` + */ + class HybridVisionCameraMLKitSpec: public virtual HybridObject { + public: + // Constructor + explicit HybridVisionCameraMLKitSpec(): HybridObject(TAG) { } + + // Destructor + ~HybridVisionCameraMLKitSpec() override = default; + + public: + // Properties + + + public: + // Methods + virtual bool isFeatureAvailable(MLKitFeature feature) = 0; + virtual std::shared_ptr createTextRecognizer(const TextRecognizerOptions& options) = 0; + virtual std::shared_ptr createBarcodeScanner(const BarcodeScannerOptions& options) = 0; + + protected: + // Hybrid Setup + void loadHybridMethods() override; + + protected: + // Tag for logging + static constexpr auto TAG = "VisionCameraMLKit"; + }; + +} // namespace margelo::nitro::visioncameramlkit diff --git a/nitrogen/generated/shared/c++/MLKitBaseArguments.hpp b/nitrogen/generated/shared/c++/MLKitBaseArguments.hpp new file mode 100644 index 0000000..b225cd4 --- /dev/null +++ b/nitrogen/generated/shared/c++/MLKitBaseArguments.hpp @@ -0,0 +1,85 @@ +/// +/// MLKitBaseArguments.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } + +#include "Orientation.hpp" +#include + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (MLKitBaseArguments). + */ + struct MLKitBaseArguments final { + public: + std::optional outputOrientation SWIFT_PRIVATE; + + public: + MLKitBaseArguments() = default; + explicit MLKitBaseArguments(std::optional outputOrientation): outputOrientation(outputOrientation) {} + + public: + friend bool operator==(const MLKitBaseArguments& lhs, const MLKitBaseArguments& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ MLKitBaseArguments <> JS MLKitBaseArguments (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::MLKitBaseArguments fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::MLKitBaseArguments( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outputOrientation"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::MLKitBaseArguments& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "outputOrientation"), JSIConverter>::toJSI(runtime, arg.outputOrientation)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outputOrientation")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/MLKitFeature.hpp b/nitrogen/generated/shared/c++/MLKitFeature.hpp new file mode 100644 index 0000000..3ed1d2c --- /dev/null +++ b/nitrogen/generated/shared/c++/MLKitFeature.hpp @@ -0,0 +1,112 @@ +/// +/// MLKitFeature.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +namespace margelo::nitro::visioncameramlkit { + + /** + * An enum which can be represented as a JavaScript union (MLKitFeature). + */ + enum class MLKitFeature { + TEXTRECOGNITION SWIFT_NAME(textrecognition) = 0, + FACEDETECTION SWIFT_NAME(facedetection) = 1, + FACEMESHDETECTION SWIFT_NAME(facemeshdetection) = 2, + POSEDETECTION SWIFT_NAME(posedetection) = 3, + SELFIESEGMENTATION SWIFT_NAME(selfiesegmentation) = 4, + SUBJECTSEGMENTATION SWIFT_NAME(subjectsegmentation) = 5, + DOCUMENTSCANNER SWIFT_NAME(documentscanner) = 6, + BARCODESCANNING SWIFT_NAME(barcodescanning) = 7, + IMAGELABELING SWIFT_NAME(imagelabeling) = 8, + OBJECTDETECTION SWIFT_NAME(objectdetection) = 9, + DIGITALINKRECOGNITION SWIFT_NAME(digitalinkrecognition) = 10, + } CLOSED_ENUM; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ MLKitFeature <> JS MLKitFeature (union) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::MLKitFeature fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + std::string unionValue = JSIConverter::fromJSI(runtime, arg); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("TextRecognition"): return margelo::nitro::visioncameramlkit::MLKitFeature::TEXTRECOGNITION; + case hashString("FaceDetection"): return margelo::nitro::visioncameramlkit::MLKitFeature::FACEDETECTION; + case hashString("FaceMeshDetection"): return margelo::nitro::visioncameramlkit::MLKitFeature::FACEMESHDETECTION; + case hashString("PoseDetection"): return margelo::nitro::visioncameramlkit::MLKitFeature::POSEDETECTION; + case hashString("SelfieSegmentation"): return margelo::nitro::visioncameramlkit::MLKitFeature::SELFIESEGMENTATION; + case hashString("SubjectSegmentation"): return margelo::nitro::visioncameramlkit::MLKitFeature::SUBJECTSEGMENTATION; + case hashString("DocumentScanner"): return margelo::nitro::visioncameramlkit::MLKitFeature::DOCUMENTSCANNER; + case hashString("BarcodeScanning"): return margelo::nitro::visioncameramlkit::MLKitFeature::BARCODESCANNING; + case hashString("ImageLabeling"): return margelo::nitro::visioncameramlkit::MLKitFeature::IMAGELABELING; + case hashString("ObjectDetection"): return margelo::nitro::visioncameramlkit::MLKitFeature::OBJECTDETECTION; + case hashString("DigitalInkRecognition"): return margelo::nitro::visioncameramlkit::MLKitFeature::DIGITALINKRECOGNITION; + default: [[unlikely]] + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum MLKitFeature - invalid value!"); + } + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::visioncameramlkit::MLKitFeature arg) { + switch (arg) { + case margelo::nitro::visioncameramlkit::MLKitFeature::TEXTRECOGNITION: return JSIConverter::toJSI(runtime, "TextRecognition"); + case margelo::nitro::visioncameramlkit::MLKitFeature::FACEDETECTION: return JSIConverter::toJSI(runtime, "FaceDetection"); + case margelo::nitro::visioncameramlkit::MLKitFeature::FACEMESHDETECTION: return JSIConverter::toJSI(runtime, "FaceMeshDetection"); + case margelo::nitro::visioncameramlkit::MLKitFeature::POSEDETECTION: return JSIConverter::toJSI(runtime, "PoseDetection"); + case margelo::nitro::visioncameramlkit::MLKitFeature::SELFIESEGMENTATION: return JSIConverter::toJSI(runtime, "SelfieSegmentation"); + case margelo::nitro::visioncameramlkit::MLKitFeature::SUBJECTSEGMENTATION: return JSIConverter::toJSI(runtime, "SubjectSegmentation"); + case margelo::nitro::visioncameramlkit::MLKitFeature::DOCUMENTSCANNER: return JSIConverter::toJSI(runtime, "DocumentScanner"); + case margelo::nitro::visioncameramlkit::MLKitFeature::BARCODESCANNING: return JSIConverter::toJSI(runtime, "BarcodeScanning"); + case margelo::nitro::visioncameramlkit::MLKitFeature::IMAGELABELING: return JSIConverter::toJSI(runtime, "ImageLabeling"); + case margelo::nitro::visioncameramlkit::MLKitFeature::OBJECTDETECTION: return JSIConverter::toJSI(runtime, "ObjectDetection"); + case margelo::nitro::visioncameramlkit::MLKitFeature::DIGITALINKRECOGNITION: return JSIConverter::toJSI(runtime, "DigitalInkRecognition"); + default: [[unlikely]] + throw std::invalid_argument("Cannot convert MLKitFeature to JS - invalid value: " + + std::to_string(static_cast(arg)) + "!"); + } + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isString()) { + return false; + } + std::string unionValue = JSIConverter::fromJSI(runtime, value); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("TextRecognition"): + case hashString("FaceDetection"): + case hashString("FaceMeshDetection"): + case hashString("PoseDetection"): + case hashString("SelfieSegmentation"): + case hashString("SubjectSegmentation"): + case hashString("DocumentScanner"): + case hashString("BarcodeScanning"): + case hashString("ImageLabeling"): + case hashString("ObjectDetection"): + case hashString("DigitalInkRecognition"): + return true; + default: + return false; + } + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/Orientation.hpp b/nitrogen/generated/shared/c++/Orientation.hpp new file mode 100644 index 0000000..b0fb591 --- /dev/null +++ b/nitrogen/generated/shared/c++/Orientation.hpp @@ -0,0 +1,84 @@ +/// +/// Orientation.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +namespace margelo::nitro::visioncameramlkit { + + /** + * An enum which can be represented as a JavaScript union (Orientation). + */ + enum class Orientation { + PORTRAIT SWIFT_NAME(portrait) = 0, + PORTRAIT_UPSIDE_DOWN SWIFT_NAME(portraitUpsideDown) = 1, + LANDSCAPE_LEFT SWIFT_NAME(landscapeLeft) = 2, + LANDSCAPE_RIGHT SWIFT_NAME(landscapeRight) = 3, + } CLOSED_ENUM; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ Orientation <> JS Orientation (union) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::Orientation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + std::string unionValue = JSIConverter::fromJSI(runtime, arg); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("portrait"): return margelo::nitro::visioncameramlkit::Orientation::PORTRAIT; + case hashString("portrait-upside-down"): return margelo::nitro::visioncameramlkit::Orientation::PORTRAIT_UPSIDE_DOWN; + case hashString("landscape-left"): return margelo::nitro::visioncameramlkit::Orientation::LANDSCAPE_LEFT; + case hashString("landscape-right"): return margelo::nitro::visioncameramlkit::Orientation::LANDSCAPE_RIGHT; + default: [[unlikely]] + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum Orientation - invalid value!"); + } + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::visioncameramlkit::Orientation arg) { + switch (arg) { + case margelo::nitro::visioncameramlkit::Orientation::PORTRAIT: return JSIConverter::toJSI(runtime, "portrait"); + case margelo::nitro::visioncameramlkit::Orientation::PORTRAIT_UPSIDE_DOWN: return JSIConverter::toJSI(runtime, "portrait-upside-down"); + case margelo::nitro::visioncameramlkit::Orientation::LANDSCAPE_LEFT: return JSIConverter::toJSI(runtime, "landscape-left"); + case margelo::nitro::visioncameramlkit::Orientation::LANDSCAPE_RIGHT: return JSIConverter::toJSI(runtime, "landscape-right"); + default: [[unlikely]] + throw std::invalid_argument("Cannot convert Orientation to JS - invalid value: " + + std::to_string(static_cast(arg)) + "!"); + } + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isString()) { + return false; + } + std::string unionValue = JSIConverter::fromJSI(runtime, value); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("portrait"): + case hashString("portrait-upside-down"): + case hashString("landscape-left"): + case hashString("landscape-right"): + return true; + default: + return false; + } + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/RegionOfInterest.hpp b/nitrogen/generated/shared/c++/RegionOfInterest.hpp new file mode 100644 index 0000000..d32427b --- /dev/null +++ b/nitrogen/generated/shared/c++/RegionOfInterest.hpp @@ -0,0 +1,101 @@ +/// +/// RegionOfInterest.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `RegionOfInterestUnit` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class RegionOfInterestUnit; } + +#include "RegionOfInterestUnit.hpp" +#include + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (RegionOfInterest). + */ + struct RegionOfInterest final { + public: + double x SWIFT_PRIVATE; + double y SWIFT_PRIVATE; + double width SWIFT_PRIVATE; + double height SWIFT_PRIVATE; + std::optional unit SWIFT_PRIVATE; + + public: + RegionOfInterest() = default; + explicit RegionOfInterest(double x, double y, double width, double height, std::optional unit): x(x), y(y), width(width), height(height), unit(unit) {} + + public: + friend bool operator==(const RegionOfInterest& lhs, const RegionOfInterest& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ RegionOfInterest <> JS RegionOfInterest (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::RegionOfInterest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::RegionOfInterest( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::RegionOfInterest& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "x"), JSIConverter::toJSI(runtime, arg.x)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "y"), JSIConverter::toJSI(runtime, arg.y)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter::toJSI(runtime, arg.width)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter::toJSI(runtime, arg.height)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "unit"), JSIConverter>::toJSI(runtime, arg.unit)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/RegionOfInterestUnit.hpp b/nitrogen/generated/shared/c++/RegionOfInterestUnit.hpp new file mode 100644 index 0000000..01651f5 --- /dev/null +++ b/nitrogen/generated/shared/c++/RegionOfInterestUnit.hpp @@ -0,0 +1,76 @@ +/// +/// RegionOfInterestUnit.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +namespace margelo::nitro::visioncameramlkit { + + /** + * An enum which can be represented as a JavaScript union (RegionOfInterestUnit). + */ + enum class RegionOfInterestUnit { + NORMALIZED SWIFT_NAME(normalized) = 0, + PIXEL SWIFT_NAME(pixel) = 1, + } CLOSED_ENUM; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ RegionOfInterestUnit <> JS RegionOfInterestUnit (union) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::RegionOfInterestUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + std::string unionValue = JSIConverter::fromJSI(runtime, arg); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("normalized"): return margelo::nitro::visioncameramlkit::RegionOfInterestUnit::NORMALIZED; + case hashString("pixel"): return margelo::nitro::visioncameramlkit::RegionOfInterestUnit::PIXEL; + default: [[unlikely]] + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum RegionOfInterestUnit - invalid value!"); + } + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::visioncameramlkit::RegionOfInterestUnit arg) { + switch (arg) { + case margelo::nitro::visioncameramlkit::RegionOfInterestUnit::NORMALIZED: return JSIConverter::toJSI(runtime, "normalized"); + case margelo::nitro::visioncameramlkit::RegionOfInterestUnit::PIXEL: return JSIConverter::toJSI(runtime, "pixel"); + default: [[unlikely]] + throw std::invalid_argument("Cannot convert RegionOfInterestUnit to JS - invalid value: " + + std::to_string(static_cast(arg)) + "!"); + } + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isString()) { + return false; + } + std::string unionValue = JSIConverter::fromJSI(runtime, value); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("normalized"): + case hashString("pixel"): + return true; + default: + return false; + } + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/TextBlock.hpp b/nitrogen/generated/shared/c++/TextBlock.hpp new file mode 100644 index 0000000..11b7ac5 --- /dev/null +++ b/nitrogen/generated/shared/c++/TextBlock.hpp @@ -0,0 +1,108 @@ +/// +/// TextBlock.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `TextLine` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextLine; } + +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include +#include +#include "TextLine.hpp" + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (TextBlock). + */ + struct TextBlock final { + public: + BoundingBox bounds SWIFT_PRIVATE; + std::vector corners SWIFT_PRIVATE; + std::vector languages SWIFT_PRIVATE; + std::string text SWIFT_PRIVATE; + std::vector lines SWIFT_PRIVATE; + + public: + TextBlock() = default; + explicit TextBlock(BoundingBox bounds, std::vector corners, std::vector languages, std::string text, std::vector lines): bounds(bounds), corners(corners), languages(languages), text(text), lines(lines) {} + + public: + friend bool operator==(const TextBlock& lhs, const TextBlock& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ TextBlock <> JS TextBlock (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::TextBlock fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::TextBlock( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languages"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "lines"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::TextBlock& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "bounds"), JSIConverter::toJSI(runtime, arg.bounds)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "corners"), JSIConverter>::toJSI(runtime, arg.corners)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "languages"), JSIConverter>::toJSI(runtime, arg.languages)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter::toJSI(runtime, arg.text)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "lines"), JSIConverter>::toJSI(runtime, arg.lines)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languages")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "lines")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/TextElement.hpp b/nitrogen/generated/shared/c++/TextElement.hpp new file mode 100644 index 0000000..50b7531 --- /dev/null +++ b/nitrogen/generated/shared/c++/TextElement.hpp @@ -0,0 +1,119 @@ +/// +/// TextElement.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `TextSymbol` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextSymbol; } + +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include +#include +#include +#include +#include +#include "TextSymbol.hpp" + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (TextElement). + */ + struct TextElement final { + public: + BoundingBox bounds SWIFT_PRIVATE; + std::vector corners SWIFT_PRIVATE; + std::optional> confidence SWIFT_PRIVATE; + std::optional> angle SWIFT_PRIVATE; + std::vector languages SWIFT_PRIVATE; + std::string text SWIFT_PRIVATE; + std::vector symbols SWIFT_PRIVATE; + + public: + TextElement() = default; + explicit TextElement(BoundingBox bounds, std::vector corners, std::optional> confidence, std::optional> angle, std::vector languages, std::string text, std::vector symbols): bounds(bounds), corners(corners), confidence(confidence), angle(angle), languages(languages), text(text), symbols(symbols) {} + + public: + friend bool operator==(const TextElement& lhs, const TextElement& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ TextElement <> JS TextElement (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::TextElement fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::TextElement( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angle"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languages"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "symbols"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::TextElement& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "bounds"), JSIConverter::toJSI(runtime, arg.bounds)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "corners"), JSIConverter>::toJSI(runtime, arg.corners)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "confidence"), JSIConverter>>::toJSI(runtime, arg.confidence)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "angle"), JSIConverter>>::toJSI(runtime, arg.angle)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "languages"), JSIConverter>::toJSI(runtime, arg.languages)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter::toJSI(runtime, arg.text)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "symbols"), JSIConverter>::toJSI(runtime, arg.symbols)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angle")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languages")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "symbols")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/TextLine.hpp b/nitrogen/generated/shared/c++/TextLine.hpp new file mode 100644 index 0000000..e559e5c --- /dev/null +++ b/nitrogen/generated/shared/c++/TextLine.hpp @@ -0,0 +1,119 @@ +/// +/// TextLine.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } +// Forward declaration of `TextElement` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextElement; } + +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include +#include +#include +#include +#include +#include "TextElement.hpp" + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (TextLine). + */ + struct TextLine final { + public: + BoundingBox bounds SWIFT_PRIVATE; + std::vector corners SWIFT_PRIVATE; + std::optional> confidence SWIFT_PRIVATE; + std::optional> angle SWIFT_PRIVATE; + std::vector languages SWIFT_PRIVATE; + std::string text SWIFT_PRIVATE; + std::vector elements SWIFT_PRIVATE; + + public: + TextLine() = default; + explicit TextLine(BoundingBox bounds, std::vector corners, std::optional> confidence, std::optional> angle, std::vector languages, std::string text, std::vector elements): bounds(bounds), corners(corners), confidence(confidence), angle(angle), languages(languages), text(text), elements(elements) {} + + public: + friend bool operator==(const TextLine& lhs, const TextLine& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ TextLine <> JS TextLine (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::TextLine fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::TextLine( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angle"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languages"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "elements"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::TextLine& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "bounds"), JSIConverter::toJSI(runtime, arg.bounds)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "corners"), JSIConverter>::toJSI(runtime, arg.corners)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "confidence"), JSIConverter>>::toJSI(runtime, arg.confidence)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "angle"), JSIConverter>>::toJSI(runtime, arg.angle)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "languages"), JSIConverter>::toJSI(runtime, arg.languages)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter::toJSI(runtime, arg.text)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "elements"), JSIConverter>::toJSI(runtime, arg.elements)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angle")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languages")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "elements")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/TextRecognitionLanguage.hpp b/nitrogen/generated/shared/c++/TextRecognitionLanguage.hpp new file mode 100644 index 0000000..8aa38de --- /dev/null +++ b/nitrogen/generated/shared/c++/TextRecognitionLanguage.hpp @@ -0,0 +1,88 @@ +/// +/// TextRecognitionLanguage.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +namespace margelo::nitro::visioncameramlkit { + + /** + * An enum which can be represented as a JavaScript union (TextRecognitionLanguage). + */ + enum class TextRecognitionLanguage { + LATIN SWIFT_NAME(latin) = 0, + CHINESE SWIFT_NAME(chinese) = 1, + DEVANAGARI SWIFT_NAME(devanagari) = 2, + JAPANESE SWIFT_NAME(japanese) = 3, + KOREAN SWIFT_NAME(korean) = 4, + } CLOSED_ENUM; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ TextRecognitionLanguage <> JS TextRecognitionLanguage (union) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::TextRecognitionLanguage fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + std::string unionValue = JSIConverter::fromJSI(runtime, arg); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("LATIN"): return margelo::nitro::visioncameramlkit::TextRecognitionLanguage::LATIN; + case hashString("CHINESE"): return margelo::nitro::visioncameramlkit::TextRecognitionLanguage::CHINESE; + case hashString("DEVANAGARI"): return margelo::nitro::visioncameramlkit::TextRecognitionLanguage::DEVANAGARI; + case hashString("JAPANESE"): return margelo::nitro::visioncameramlkit::TextRecognitionLanguage::JAPANESE; + case hashString("KOREAN"): return margelo::nitro::visioncameramlkit::TextRecognitionLanguage::KOREAN; + default: [[unlikely]] + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum TextRecognitionLanguage - invalid value!"); + } + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::visioncameramlkit::TextRecognitionLanguage arg) { + switch (arg) { + case margelo::nitro::visioncameramlkit::TextRecognitionLanguage::LATIN: return JSIConverter::toJSI(runtime, "LATIN"); + case margelo::nitro::visioncameramlkit::TextRecognitionLanguage::CHINESE: return JSIConverter::toJSI(runtime, "CHINESE"); + case margelo::nitro::visioncameramlkit::TextRecognitionLanguage::DEVANAGARI: return JSIConverter::toJSI(runtime, "DEVANAGARI"); + case margelo::nitro::visioncameramlkit::TextRecognitionLanguage::JAPANESE: return JSIConverter::toJSI(runtime, "JAPANESE"); + case margelo::nitro::visioncameramlkit::TextRecognitionLanguage::KOREAN: return JSIConverter::toJSI(runtime, "KOREAN"); + default: [[unlikely]] + throw std::invalid_argument("Cannot convert TextRecognitionLanguage to JS - invalid value: " + + std::to_string(static_cast(arg)) + "!"); + } + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isString()) { + return false; + } + std::string unionValue = JSIConverter::fromJSI(runtime, value); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("LATIN"): + case hashString("CHINESE"): + case hashString("DEVANAGARI"): + case hashString("JAPANESE"): + case hashString("KOREAN"): + return true; + default: + return false; + } + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/TextRecognitionResult.hpp b/nitrogen/generated/shared/c++/TextRecognitionResult.hpp new file mode 100644 index 0000000..45a5d9d --- /dev/null +++ b/nitrogen/generated/shared/c++/TextRecognitionResult.hpp @@ -0,0 +1,90 @@ +/// +/// TextRecognitionResult.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `TextBlock` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct TextBlock; } + +#include +#include "TextBlock.hpp" +#include + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (TextRecognitionResult). + */ + struct TextRecognitionResult final { + public: + std::string text SWIFT_PRIVATE; + std::vector blocks SWIFT_PRIVATE; + + public: + TextRecognitionResult() = default; + explicit TextRecognitionResult(std::string text, std::vector blocks): text(text), blocks(blocks) {} + + public: + friend bool operator==(const TextRecognitionResult& lhs, const TextRecognitionResult& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ TextRecognitionResult <> JS TextRecognitionResult (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::TextRecognitionResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::TextRecognitionResult( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "blocks"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::TextRecognitionResult& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter::toJSI(runtime, arg.text)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "blocks"), JSIConverter>::toJSI(runtime, arg.blocks)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "blocks")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/TextRecognizerOptions.hpp b/nitrogen/generated/shared/c++/TextRecognizerOptions.hpp new file mode 100644 index 0000000..ad501f2 --- /dev/null +++ b/nitrogen/generated/shared/c++/TextRecognizerOptions.hpp @@ -0,0 +1,111 @@ +/// +/// TextRecognizerOptions.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `TextRecognitionLanguage` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class TextRecognitionLanguage; } +// Forward declaration of `RegionOfInterest` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct RegionOfInterest; } +// Forward declaration of `Orientation` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { enum class Orientation; } + +#include "TextRecognitionLanguage.hpp" +#include +#include "RegionOfInterest.hpp" +#include "Orientation.hpp" + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (TextRecognizerOptions). + */ + struct TextRecognizerOptions final { + public: + std::optional language SWIFT_PRIVATE; + std::optional scaleFactor SWIFT_PRIVATE; + std::optional invertColors SWIFT_PRIVATE; + std::optional frameProcessInterval SWIFT_PRIVATE; + std::optional roi SWIFT_PRIVATE; + std::optional orientation SWIFT_PRIVATE; + + public: + TextRecognizerOptions() = default; + explicit TextRecognizerOptions(std::optional language, std::optional scaleFactor, std::optional invertColors, std::optional frameProcessInterval, std::optional roi, std::optional orientation): language(language), scaleFactor(scaleFactor), invertColors(invertColors), frameProcessInterval(frameProcessInterval), roi(roi), orientation(orientation) {} + + public: + friend bool operator==(const TextRecognizerOptions& lhs, const TextRecognizerOptions& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ TextRecognizerOptions <> JS TextRecognizerOptions (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::TextRecognizerOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::TextRecognizerOptions( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "language"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "scaleFactor"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invertColors"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frameProcessInterval"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roi"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "orientation"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::TextRecognizerOptions& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "language"), JSIConverter>::toJSI(runtime, arg.language)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "scaleFactor"), JSIConverter>::toJSI(runtime, arg.scaleFactor)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "invertColors"), JSIConverter>::toJSI(runtime, arg.invertColors)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "frameProcessInterval"), JSIConverter>::toJSI(runtime, arg.frameProcessInterval)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "roi"), JSIConverter>::toJSI(runtime, arg.roi)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "orientation"), JSIConverter>::toJSI(runtime, arg.orientation)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "language")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "scaleFactor")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invertColors")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frameProcessInterval")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roi")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "orientation")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/TextSymbol.hpp b/nitrogen/generated/shared/c++/TextSymbol.hpp new file mode 100644 index 0000000..a5a8b15 --- /dev/null +++ b/nitrogen/generated/shared/c++/TextSymbol.hpp @@ -0,0 +1,109 @@ +/// +/// TextSymbol.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `BoundingBox` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct BoundingBox; } +// Forward declaration of `Corner` to properly resolve imports. +namespace margelo::nitro::visioncameramlkit { struct Corner; } + +#include "BoundingBox.hpp" +#include "Corner.hpp" +#include +#include + +namespace margelo::nitro::visioncameramlkit { + + /** + * A struct which can be represented as a JavaScript object (TextSymbol). + */ + struct TextSymbol final { + public: + BoundingBox bounds SWIFT_PRIVATE; + std::vector corners SWIFT_PRIVATE; + double confidence SWIFT_PRIVATE; + double angle SWIFT_PRIVATE; + std::vector languages SWIFT_PRIVATE; + std::string text SWIFT_PRIVATE; + + public: + TextSymbol() = default; + explicit TextSymbol(BoundingBox bounds, std::vector corners, double confidence, double angle, std::vector languages, std::string text): bounds(bounds), corners(corners), confidence(confidence), angle(angle), languages(languages), text(text) {} + + public: + friend bool operator==(const TextSymbol& lhs, const TextSymbol& rhs) = default; + }; + +} // namespace margelo::nitro::visioncameramlkit + +namespace margelo::nitro { + + // C++ TextSymbol <> JS TextSymbol (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::visioncameramlkit::TextSymbol fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::visioncameramlkit::TextSymbol( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angle"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languages"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::visioncameramlkit::TextSymbol& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "bounds"), JSIConverter::toJSI(runtime, arg.bounds)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "corners"), JSIConverter>::toJSI(runtime, arg.corners)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "confidence"), JSIConverter::toJSI(runtime, arg.confidence)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "angle"), JSIConverter::toJSI(runtime, arg.angle)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "languages"), JSIConverter>::toJSI(runtime, arg.languages)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter::toJSI(runtime, arg.text)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bounds")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "corners")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angle")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languages")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/package.json b/package.json index e0def84..454da80 100644 --- a/package.json +++ b/package.json @@ -27,10 +27,13 @@ "react-native.config.js", "!ios/build", "!android/build", + "!android/app/build", "!android/gradle", "!android/gradlew", "!android/gradlew.bat", "!android/local.properties", + "!**/*.test.*", + "!**/*.spec.*", "!**/__tests__", "!**/__fixtures__", "!**/__mocks__", @@ -128,6 +131,10 @@ "workspaces": [ "example" ], + "resolutions": { + "@babel/plugin-transform-modules-systemjs": "7.29.8", + "undici": "6.28.0" + }, "packageManager": "yarn@4.11.0", "react-native-builder-bob": { "source": "src", @@ -147,14 +154,6 @@ ] ] }, - "codegenConfig": { - "name": "VisionCameraMLKitSpec", - "type": "modules", - "jsSrcsDir": "src", - "android": { - "javaPackageName": "com.visioncameramlkit" - } - }, "prettier": { "quoteProps": "consistent", "singleQuote": true, @@ -191,7 +190,29 @@ "modulePathIgnorePatterns": [ "/example/node_modules", "/lib/" - ] + ], + "collectCoverageFrom": [ + "src/**/*.{ts,tsx}", + "plugin/**/*.js", + "!src/**/*.test.{ts,tsx}", + "!src/**/__tests__/**", + "!src/**/types.ts", + "!src/specs/**", + "!plugin/**/__tests__/**" + ], + "coverageThreshold": { + "global": { + "branches": 80, + "functions": 80, + "lines": 80, + "statements": 80 + } + } + }, + "codegenConfig": { + "name": "VisionCameraMLKitSpec", + "type": "modules", + "jsSrcsDir": "src/specs" }, "create-react-native-library": { "languages": "kotlin-objc", diff --git a/react-native.config.js b/react-native.config.js new file mode 100644 index 0000000..21645be --- /dev/null +++ b/react-native.config.js @@ -0,0 +1,16 @@ +// https://github.com/react-native-community/cli/blob/main/docs/dependencies.md + +module.exports = { + dependency: { + platforms: { + /** + * @type {import('@react-native-community/cli-types').IOSDependencyParams} + */ + ios: {}, + /** + * @type {import('@react-native-community/cli-types').AndroidDependencyParams} + */ + android: {}, + }, + }, +}; diff --git a/src/VisionCameraMLKitSpec.ts b/src/VisionCameraMLKitSpec.ts deleted file mode 100644 index a4ea67c..0000000 --- a/src/VisionCameraMLKitSpec.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { TurboModule } from 'react-native'; -import { TurboModuleRegistry } from 'react-native'; - -export interface Spec extends TurboModule { - processImage(feature: string, path: string, options: object): Promise; -} - -export default TurboModuleRegistry.getEnforcing( - 'VisionCameraMLKitModule' -); diff --git a/src/__tests__/NativeBridge.test.ts b/src/__tests__/NativeBridge.test.ts deleted file mode 100644 index dfeb783..0000000 --- a/src/__tests__/NativeBridge.test.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { MLKIT_FEATURE_KEYS } from '../core/constants'; -import type { MLKitFeature } from '../core/types'; -import { INVALID_URI_ERROR, MISSING_MODULE_ERROR } from '../shared/constants'; - -const feature: MLKitFeature = MLKIT_FEATURE_KEYS.TEXT_RECOGNITION; -const createBridge = ( - platform: 'ios' | 'android', - moduleMock: { processImage?: jest.Mock } | undefined -) => { - jest.resetModules(); - jest.doMock('react-native', () => ({ - Platform: { - OS: platform, - select: (options: Record) => - options[platform] ?? options.default, - }, - })); - jest.doMock('../VisionCameraMLKitSpec', () => ({ - __esModule: true, - default: moduleMock, - })); - - return require('../core/NativeBridge') - .NativeBridge as typeof import('../core/NativeBridge').NativeBridge; -}; - -describe('NativeBridge', () => { - afterEach(() => { - jest.clearAllMocks(); - jest.resetModules(); - }); - - it('throws when the native module is missing', async () => { - const NativeBridge = createBridge('ios', undefined); - - await expect( - NativeBridge.processImage(feature, 'file://image.jpg') - ).rejects.toThrow(MISSING_MODULE_ERROR); - }); - - it('rejects invalid image URIs', async () => { - const processImage = jest.fn().mockResolvedValue({}); - const NativeBridge = createBridge('android', { processImage }); - - await expect(NativeBridge.processImage(feature, ' ')).rejects.toThrow( - INVALID_URI_ERROR - ); - expect(processImage).not.toHaveBeenCalled(); - }); - - it('strips file prefixes on iOS', async () => { - const result = { ok: true }; - const processImage = jest.fn().mockResolvedValue(result); - const NativeBridge = createBridge('ios', { processImage }); - const response = await NativeBridge.processImage( - feature, - 'file://path/to/image.jpg', - { orientation: 'portrait' } - ); - - expect(processImage).toHaveBeenCalledWith(feature, 'path/to/image.jpg', { - orientation: 'portrait', - }); - expect(response).toBe(result); - }); - - it('adds file prefixes on Android for bare paths', async () => { - const processImage = jest.fn().mockResolvedValue({}); - const NativeBridge = createBridge('android', { processImage }); - - await NativeBridge.processImage(feature, '/tmp/image.jpg'); - - expect(processImage).toHaveBeenCalledWith( - feature, - 'file:///tmp/image.jpg', - {} - ); - }); -}); diff --git a/src/__tests__/PluginFactory.test.ts b/src/__tests__/PluginFactory.test.ts new file mode 100644 index 0000000..36ab917 --- /dev/null +++ b/src/__tests__/PluginFactory.test.ts @@ -0,0 +1,86 @@ +import { MLKIT_FEATURE_KEYS } from '../core/constants'; + +const loadPluginFactory = () => { + jest.resetModules(); + const isFeatureAvailable = jest.fn(() => true); + + jest.doMock('react-native', () => ({ + Platform: { + OS: 'ios', + select: (options: Record) => + options.ios ?? options.default, + }, + })); + jest.doMock('../core/VisionCameraMLKit', () => ({ + VisionCameraMLKit: { + isFeatureAvailable, + createTextRecognizer: jest.fn(), + createBarcodeScanner: jest.fn(), + }, + })); + + return { + PluginFactory: require('../core/PluginFactory') + .PluginFactory as typeof import('../core/PluginFactory').PluginFactory, + isFeatureAvailable, + }; +}; + +describe('PluginFactory.initPlugin', () => { + afterEach(() => { + jest.clearAllMocks(); + jest.resetModules(); + }); + + it.each([null, [], 'not-an-object', 42])( + 'rejects invalid options before reading roi: %p', + (options) => { + const { PluginFactory, isFeatureAvailable } = loadPluginFactory(); + + expect(() => + PluginFactory.initPlugin(MLKIT_FEATURE_KEYS.TEXT_RECOGNITION, options) + ).toThrow('Invalid MLKit plugin options: expected a plain object.'); + expect(isFeatureAvailable).toHaveBeenCalledWith( + MLKIT_FEATURE_KEYS.TEXT_RECOGNITION + ); + } + ); + + it.each([ + { scaleFactor: Number.NaN }, + { scaleFactor: Number.POSITIVE_INFINITY }, + { scaleFactor: '0.9' }, + { invertColors: 'true' }, + { frameProcessInterval: -1 }, + { frameProcessInterval: 1.5 }, + { orientation: 'sideways' }, + ])('rejects invalid base options: %p', (options) => { + const { PluginFactory } = loadPluginFactory(); + + expect(() => + PluginFactory.initPlugin(MLKIT_FEATURE_KEYS.TEXT_RECOGNITION, options) + ).toThrow('Invalid MLKit plugin option'); + }); + + it('rejects invalid text-recognition language values', () => { + const { PluginFactory } = loadPluginFactory(); + + expect(() => + PluginFactory.initPlugin(MLKIT_FEATURE_KEYS.TEXT_RECOGNITION, { + language: 'KLINGON', + }) + ).toThrow('Invalid MLKit plugin option "language".'); + }); + + it.each([ + { formats: 'QR_CODE' }, + { formats: ['NOT_A_FORMAT'] }, + { enableAllPotentialBarcodes: 1 }, + ])('rejects invalid barcode options: %p', (options) => { + const { PluginFactory } = loadPluginFactory(); + + expect(() => + PluginFactory.initPlugin(MLKIT_FEATURE_KEYS.BARCODE_SCANNING, options) + ).toThrow('Invalid MLKit plugin option'); + }); +}); diff --git a/src/__tests__/frameProcessingHooks.test.ts b/src/__tests__/frameProcessingHooks.test.ts new file mode 100644 index 0000000..4c0fe51 --- /dev/null +++ b/src/__tests__/frameProcessingHooks.test.ts @@ -0,0 +1,94 @@ +import type { Frame } from 'react-native-vision-camera'; +import { MLKIT_FEATURE_KEYS } from '../core/constants'; +import type { TextRecognitionResult } from '../features/text-recognition/types'; +import type { BarcodeScanningResult } from '../features/barcode-scanning/types'; + +const loadFrameProcessingHooks = () => { + jest.resetModules(); + + const textResult: TextRecognitionResult = { + text: 'Olá, 世界', + blocks: [], + }; + const barcodeResult: BarcodeScanningResult = { barcodes: [] }; + const recognizeText = jest.fn(() => textResult); + const recognizeBarcodes = jest.fn(() => barcodeResult); + const useMLKitPlugin = jest.fn((feature: string) => + feature === MLKIT_FEATURE_KEYS.TEXT_RECOGNITION + ? { recognize: recognizeText } + : { recognize: recognizeBarcodes } + ); + const useMemo = jest.fn((factory: () => unknown) => factory()); + + jest.doMock('react', () => ({ useMemo })); + jest.doMock('../hooks/useMLKitPlugin', () => ({ useMLKitPlugin })); + jest.doMock('../core/PluginFactory', () => ({ + PluginFactory: { initPlugin: jest.fn() }, + })); + + return { + useTextRecognition: require('../features/text-recognition') + .useTextRecognition as typeof import('../features/text-recognition').useTextRecognition, + useBarcodeScanning: require('../features/barcode-scanning') + .useBarcodeScanning as typeof import('../features/barcode-scanning').useBarcodeScanning, + recognizeText, + recognizeBarcodes, + textResult, + barcodeResult, + useMLKitPlugin, + useMemo, + }; +}; + +describe('frame processing hooks', () => { + afterEach(() => { + jest.clearAllMocks(); + jest.resetModules(); + }); + + it('creates a text recognizer and forwards frame-processing arguments', () => { + const { + useTextRecognition, + recognizeText, + textResult, + useMLKitPlugin, + useMemo, + } = loadFrameProcessingHooks(); + const options = { language: 'LATIN' as const }; + const frame = { width: 1920, height: 1080 } as Frame; + const args = { outputOrientation: 'landscape-right' as const }; + + const plugin = useTextRecognition(options); + const result = plugin.textRecognition(frame, args); + + expect(useMLKitPlugin).toHaveBeenCalledWith( + MLKIT_FEATURE_KEYS.TEXT_RECOGNITION, + options + ); + expect(useMemo).toHaveBeenCalledWith(expect.any(Function), [ + { recognize: recognizeText }, + ]); + expect(recognizeText).toHaveBeenCalledWith(frame, args); + expect(result).toBe(textResult); + }); + + it('creates a barcode scanner with defaults and supplies empty arguments', () => { + const { + useBarcodeScanning, + recognizeBarcodes, + barcodeResult, + useMLKitPlugin, + } = loadFrameProcessingHooks(); + const frame = { width: 640, height: 480 } as Frame; + + const plugin = useBarcodeScanning(); + const result = plugin.barcodeScanning(frame); + + expect(useMLKitPlugin).toHaveBeenCalledWith( + MLKIT_FEATURE_KEYS.BARCODE_SCANNING, + {} + ); + expect(recognizeBarcodes).toHaveBeenCalledWith(frame, {}); + expect(result).toBe(barcodeResult); + }); +}); diff --git a/src/__tests__/staticImageNitro.test.ts b/src/__tests__/staticImageNitro.test.ts new file mode 100644 index 0000000..1f22644 --- /dev/null +++ b/src/__tests__/staticImageNitro.test.ts @@ -0,0 +1,259 @@ +import type { + TextRecognitionImageOptions, + TextRecognitionResult, +} from '../features/text-recognition'; +import type { BarcodeScanningImageOptions } from '../features/barcode-scanning'; +import type { BarcodeScannerResult } from '../specs/BarcodeScannerTypes'; + +type StaticImageApis = Pick< + typeof import('../features/text-recognition') & + typeof import('../features/barcode-scanning'), + 'processImageTextRecognition' | 'processImageBarcodeScanning' +>; + +type StaticTextRecognizer = { + recognizeImage(uri: string): Promise; + dispose(): void; +}; + +type StaticBarcodeScanner = { + recognizeImage(uri: string): Promise; + dispose(): void; +}; + +type StaticNitroRoot = { + isFeatureAvailable(feature: string): boolean; + createTextRecognizer( + options: TextRecognitionImageOptions + ): StaticTextRecognizer; + createBarcodeScanner( + options: BarcodeScanningImageOptions + ): StaticBarcodeScanner; +}; + +const loadStaticImageApis = () => { + jest.resetModules(); + + const recognizeTextImage = jest.fn< + Promise, + [uri: string] + >(); + const recognizeBarcodeImage = jest.fn< + Promise, + [uri: string] + >(); + const disposeTextRecognizer = jest.fn(); + const disposeBarcodeScanner = jest.fn(); + const textRecognizer: StaticTextRecognizer = { + recognizeImage: recognizeTextImage, + dispose: disposeTextRecognizer, + }; + const barcodeScanner: StaticBarcodeScanner = { + recognizeImage: recognizeBarcodeImage, + dispose: disposeBarcodeScanner, + }; + const staticNitroRoot = { + isFeatureAvailable: jest.fn(() => true), + createTextRecognizer: jest.fn< + StaticTextRecognizer, + [options: TextRecognitionImageOptions] + >(() => textRecognizer), + createBarcodeScanner: jest.fn< + StaticBarcodeScanner, + [options: BarcodeScanningImageOptions] + >(() => barcodeScanner), + } satisfies StaticNitroRoot; + const { createTextRecognizer, createBarcodeScanner } = staticNitroRoot; + const legacyNativeModuleAccess = jest.fn(() => { + throw new Error( + 'Static image processing must not use a legacy native module' + ); + }); + + jest.doMock('../core/VisionCameraMLKit', () => ({ + __esModule: true, + VisionCameraMLKit: staticNitroRoot, + })); + jest.doMock('react-native', () => ({ + Platform: { + OS: 'ios', + select: (options: Record) => + options.ios ?? options.default, + }, + NativeModules: new Proxy( + {}, + { + get: legacyNativeModuleAccess, + } + ), + TurboModuleRegistry: { + getEnforcing: legacyNativeModuleAccess, + }, + })); + + const textRecognition = require('../features/text-recognition') as Pick< + StaticImageApis, + 'processImageTextRecognition' + >; + const barcodeScanning = require('../features/barcode-scanning') as Pick< + StaticImageApis, + 'processImageBarcodeScanning' + >; + + return { + ...textRecognition, + ...barcodeScanning, + createTextRecognizer, + createBarcodeScanner, + recognizeTextImage, + recognizeBarcodeImage, + disposeTextRecognizer, + disposeBarcodeScanner, + legacyNativeModuleAccess, + }; +}; + +describe('static image recognition through Nitro', () => { + afterEach(() => { + jest.clearAllMocks(); + jest.resetModules(); + }); + + it('creates a configured text recognizer and recognizes the image URI', async () => { + const { + processImageTextRecognition, + createTextRecognizer, + recognizeTextImage, + disposeTextRecognizer, + legacyNativeModuleAccess, + } = loadStaticImageApis(); + const result: TextRecognitionResult = { text: 'Olá, 世界', blocks: [] }; + const options: TextRecognitionImageOptions = { + language: 'JAPANESE', + orientation: 'landscape-right', + scaleFactor: 0.9, + invertColors: true, + roi: { + x: 0.1, + y: 0.2, + width: 0.5, + height: 0.4, + unit: 'normalized', + }, + }; + recognizeTextImage.mockResolvedValue(result); + + const response = await processImageTextRecognition( + 'file:///tmp/receipt-日本語.jpg', + options + ); + + expect(createTextRecognizer).toHaveBeenCalledWith(options); + expect(recognizeTextImage).toHaveBeenCalledWith( + 'file:///tmp/receipt-日本語.jpg' + ); + expect(legacyNativeModuleAccess).not.toHaveBeenCalled(); + expect(disposeTextRecognizer).toHaveBeenCalledTimes(1); + expect(response).toBe(result); + }); + + it('creates a configured barcode scanner and recognizes the image URI', async () => { + const { + processImageBarcodeScanning, + createBarcodeScanner, + recognizeBarcodeImage, + disposeBarcodeScanner, + legacyNativeModuleAccess, + } = loadStaticImageApis(); + const result: BarcodeScannerResult = { barcodes: [] }; + const options: BarcodeScanningImageOptions = { + formats: ['QR_CODE', 'EAN_13'], + enableAllPotentialBarcodes: true, + orientation: 'portrait', + scaleFactor: 0.95, + invertColors: true, + roi: { x: 20, y: 40, width: 200, height: 100, unit: 'pixel' }, + }; + recognizeBarcodeImage.mockResolvedValue(result); + + const response = await processImageBarcodeScanning( + 'file:///tmp/qr-code.png', + options + ); + + expect(createBarcodeScanner).toHaveBeenCalledWith(options); + expect(recognizeBarcodeImage).toHaveBeenCalledWith( + 'file:///tmp/qr-code.png' + ); + expect(legacyNativeModuleAccess).not.toHaveBeenCalled(); + expect(disposeBarcodeScanner).toHaveBeenCalledTimes(1); + expect(response).toEqual(result); + }); + + it('configures both recognizers with empty defaults when options are omitted', async () => { + const { + processImageTextRecognition, + processImageBarcodeScanning, + createTextRecognizer, + createBarcodeScanner, + recognizeTextImage, + recognizeBarcodeImage, + disposeTextRecognizer, + disposeBarcodeScanner, + legacyNativeModuleAccess, + } = loadStaticImageApis(); + recognizeTextImage.mockResolvedValue({ text: '', blocks: [] }); + recognizeBarcodeImage.mockResolvedValue({ barcodes: [] }); + + await processImageTextRecognition('file:///tmp/empty-text.png'); + await processImageBarcodeScanning('file:///tmp/empty-barcode.png'); + + expect(createTextRecognizer).toHaveBeenCalledWith({}); + expect(createBarcodeScanner).toHaveBeenCalledWith({}); + expect(recognizeTextImage).toHaveBeenCalledWith( + 'file:///tmp/empty-text.png' + ); + expect(recognizeBarcodeImage).toHaveBeenCalledWith( + 'file:///tmp/empty-barcode.png' + ); + expect(legacyNativeModuleAccess).not.toHaveBeenCalled(); + expect(disposeTextRecognizer).toHaveBeenCalledTimes(1); + expect(disposeBarcodeScanner).toHaveBeenCalledTimes(1); + }); + + it('propagates asynchronous recognizer errors without falling back to the legacy bridge', async () => { + const { + processImageTextRecognition, + recognizeTextImage, + disposeTextRecognizer, + legacyNativeModuleAccess, + } = loadStaticImageApis(); + const failure = new Error('The image could not be read'); + recognizeTextImage.mockRejectedValue(failure); + + await expect( + processImageTextRecognition('file:///tmp/unreadable.jpg') + ).rejects.toBe(failure); + + expect(legacyNativeModuleAccess).not.toHaveBeenCalled(); + expect(disposeTextRecognizer).toHaveBeenCalledTimes(1); + }); + + it('propagates asynchronous barcode scanner errors without falling back to the legacy bridge', async () => { + const { + processImageBarcodeScanning, + recognizeBarcodeImage, + disposeBarcodeScanner, + legacyNativeModuleAccess, + } = loadStaticImageApis(); + const failure = new Error('The barcode image could not be read'); + recognizeBarcodeImage.mockRejectedValue(failure); + + await expect( + processImageBarcodeScanning('file:///tmp/unreadable-barcode.jpg') + ).rejects.toBe(failure); + + expect(legacyNativeModuleAccess).not.toHaveBeenCalled(); + expect(disposeBarcodeScanner).toHaveBeenCalledTimes(1); + }); +}); diff --git a/src/__tests__/useMLKitPlugin.test.ts b/src/__tests__/useMLKitPlugin.test.ts new file mode 100644 index 0000000..b0e58e9 --- /dev/null +++ b/src/__tests__/useMLKitPlugin.test.ts @@ -0,0 +1,57 @@ +import { MLKIT_FEATURE_KEYS } from '../core/constants'; + +const loadUseMLKitPlugin = () => { + jest.resetModules(); + + const initPlugin = jest.fn(); + const useMemo = jest.fn((factory: () => unknown) => factory()); + + jest.doMock('react', () => ({ useMemo })); + jest.doMock('../core/PluginFactory', () => ({ + PluginFactory: { initPlugin }, + })); + + return { + useMLKitPlugin: require('../hooks/useMLKitPlugin') + .useMLKitPlugin as typeof import('../hooks/useMLKitPlugin').useMLKitPlugin, + initPlugin, + useMemo, + }; +}; + +describe('useMLKitPlugin', () => { + afterEach(() => { + jest.clearAllMocks(); + jest.resetModules(); + }); + + it('initializes the requested plugin with feature and options dependencies', () => { + const { useMLKitPlugin, initPlugin, useMemo } = loadUseMLKitPlugin(); + const plugin = { recognize: jest.fn() }; + const options = { scaleFactor: 0.9 }; + initPlugin.mockReturnValue(plugin); + + const result = useMLKitPlugin(MLKIT_FEATURE_KEYS.TEXT_RECOGNITION, options); + + expect(initPlugin).toHaveBeenCalledWith( + MLKIT_FEATURE_KEYS.TEXT_RECOGNITION, + options + ); + expect(useMemo).toHaveBeenCalledWith(expect.any(Function), [ + MLKIT_FEATURE_KEYS.TEXT_RECOGNITION, + options, + ]); + expect(result).toBe(plugin); + }); + + it('uses empty options when the caller omits them', () => { + const { useMLKitPlugin, initPlugin } = loadUseMLKitPlugin(); + + useMLKitPlugin(MLKIT_FEATURE_KEYS.BARCODE_SCANNING); + + expect(initPlugin).toHaveBeenCalledWith( + MLKIT_FEATURE_KEYS.BARCODE_SCANNING, + {} + ); + }); +}); diff --git a/src/__tests__/validateRegionOfInterest.test.ts b/src/__tests__/validateRegionOfInterest.test.ts index 4ce81f4..5ae5405 100644 --- a/src/__tests__/validateRegionOfInterest.test.ts +++ b/src/__tests__/validateRegionOfInterest.test.ts @@ -2,6 +2,60 @@ import { validateRegionOfInterest } from '../core/validateRegionOfInterest'; import type { RegionOfInterest } from '../core/types'; describe('validateRegionOfInterest', () => { + it.each([null, [], 'not-an-object', 42])( + 'rejects a non-object ROI: %p', + (roi) => { + expect(() => validateRegionOfInterest(roi)).toThrow( + 'Invalid RegionOfInterest: expected a plain object.' + ); + } + ); + + it.each(['x', 'y', 'width', 'height'] as const)( + 'rejects an ROI missing its own %s field', + (missingField) => { + const roi = { x: 0, y: 0, width: 1, height: 1 }; + delete roi[missingField]; + + expect(() => validateRegionOfInterest(roi)).toThrow( + 'Invalid RegionOfInterest: x, y, width, and height must be own finite numbers.' + ); + } + ); + + it.each([ + { x: Number.NaN, y: 0, width: 1, height: 1 }, + { x: 0, y: Number.POSITIVE_INFINITY, width: 1, height: 1 }, + { x: 0, y: 0, width: Number.NEGATIVE_INFINITY, height: 1 }, + { x: 0, y: 0, width: 1, height: Number.NaN }, + ])('rejects non-finite ROI dimensions: %p', (roi) => { + expect(() => validateRegionOfInterest(roi)).toThrow( + 'Invalid RegionOfInterest: x, y, width, and height must be own finite numbers.' + ); + }); + + it('rejects an unsupported ROI unit', () => { + expect(() => + validateRegionOfInterest({ + x: 0, + y: 0, + width: 1, + height: 1, + unit: 'view', + }) + ).toThrow( + 'Invalid RegionOfInterest: unit must be "normalized" or "pixel" when provided.' + ); + }); + + it('rejects fields inherited from another object', () => { + const inheritedRoi = Object.create({ x: 0, y: 0, width: 1, height: 1 }); + + expect(() => validateRegionOfInterest(inheritedRoi)).toThrow( + 'Invalid RegionOfInterest: expected a plain object.' + ); + }); + it('accepts a valid normalized region', () => { expect(() => validateRegionOfInterest({ x: 0.25, y: 0.25, width: 0.5, height: 0.5 }) diff --git a/src/core/NativeBridge.ts b/src/core/NativeBridge.ts deleted file mode 100644 index 26f8e58..0000000 --- a/src/core/NativeBridge.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Platform } from 'react-native'; -import VisionCameraMLKitModule from '../VisionCameraMLKitSpec'; -import { INVALID_URI_ERROR, MISSING_MODULE_ERROR } from '../shared/constants'; -import { validateRegionOfInterest } from './validateRegionOfInterest'; -import type { ImageProcessingBaseOptions, MLKitFeature } from './types'; - -/** - * Bridge class for native MLKit image processing - */ -export class NativeBridge { - /** - * Process a static image using the specified MLKit feature. - * @param {MLKitFeature} feature - The MLKit feature to use. - * @param {string} uri - The file path or URI of the image. - * @param {object} options - Additional options for processing. - * @returns {Promise} Promise resolving to the processing result. - */ - static async processImage( - feature: MLKitFeature, - uri: string, - options: ImageProcessingBaseOptions = {} - ): Promise { - if ( - !VisionCameraMLKitModule || - typeof VisionCameraMLKitModule.processImage !== 'function' - ) { - throw new Error(MISSING_MODULE_ERROR); - } - const normalizedUri = this.validateAndNormalizeUri(uri); - - if (options.roi) { - validateRegionOfInterest(options.roi); - } - - return await VisionCameraMLKitModule.processImage( - feature, - normalizedUri, - options - ); - } - - /** - * Validates and normalizes the image URI for different platforms. - * @param {string} uri - The input URI. - * @returns {string} The normalized URI. - * @throws {Error} If the URI is invalid. - */ - private static validateAndNormalizeUri(uri: string): string { - if (!uri || typeof uri !== 'string') { - throw new Error(INVALID_URI_ERROR); - } - - // Check for basic URI validity - if (uri.trim().length === 0) { - throw new Error(INVALID_URI_ERROR); - } - - // Normalize the URI for different platforms - let processUri = uri; - - if (Platform.OS === 'ios') { - // iOS: Remove file:// prefix if present - processUri = uri.replace('file://', ''); - } else { - // Android: Ensure proper file:// prefix for absolute file paths without any scheme - const hasScheme = /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(processUri); - if (!hasScheme) { - processUri = `file://${processUri}`; - } - } - - return processUri; - } -} diff --git a/src/core/PluginFactory.ts b/src/core/PluginFactory.ts index 27c5e5f..261a0fd 100644 --- a/src/core/PluginFactory.ts +++ b/src/core/PluginFactory.ts @@ -7,6 +7,117 @@ import { validateRegionOfInterest } from './validateRegionOfInterest'; import { VisionCameraMLKit } from './VisionCameraMLKit'; import type { MLKitBaseOptions, MLKitFeature } from './types'; +const isPlainObject = (value: unknown): value is Record => { + if (typeof value !== 'object' || value === null || Array.isArray(value)) { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +}; + +const ORIENTATIONS = new Set([ + 'portrait', + 'portrait-upside-down', + 'landscape-left', + 'landscape-right', +]); +const TEXT_LANGUAGES = new Set([ + 'LATIN', + 'CHINESE', + 'DEVANAGARI', + 'JAPANESE', + 'KOREAN', +]); +const BARCODE_FORMATS = new Set([ + 'UNKNOWN', + 'ALL_FORMATS', + 'CODE_128', + 'CODE_39', + 'CODE_93', + 'CODABAR', + 'DATA_MATRIX', + 'EAN_13', + 'EAN_8', + 'ITF', + 'QR_CODE', + 'UPC_A', + 'UPC_E', + 'PDF417', + 'AZTEC', +]); + +const hasDefinedOption = ( + options: Record, + key: string +): boolean => + Object.prototype.hasOwnProperty.call(options, key) && + options[key] !== undefined; + +const invalidOption = (key: string): never => { + throw new Error(`Invalid MLKit plugin option "${key}".`); +}; + +const validateBaseOptions = (options: Record): void => { + if ( + hasDefinedOption(options, 'scaleFactor') && + (typeof options.scaleFactor !== 'number' || + !Number.isFinite(options.scaleFactor)) + ) { + invalidOption('scaleFactor'); + } + if ( + hasDefinedOption(options, 'invertColors') && + typeof options.invertColors !== 'boolean' + ) { + invalidOption('invertColors'); + } + if ( + hasDefinedOption(options, 'frameProcessInterval') && + (typeof options.frameProcessInterval !== 'number' || + !Number.isSafeInteger(options.frameProcessInterval) || + options.frameProcessInterval < 0) + ) { + invalidOption('frameProcessInterval'); + } + if ( + hasDefinedOption(options, 'orientation') && + !ORIENTATIONS.has(options.orientation as string) + ) { + invalidOption('orientation'); + } +}; + +const validateFeatureOptions = ( + feature: MLKitFeature, + options: Record +): void => { + if ( + feature === MLKIT_FEATURE_KEYS.TEXT_RECOGNITION && + hasDefinedOption(options, 'language') && + !TEXT_LANGUAGES.has(options.language as string) + ) { + invalidOption('language'); + } + if (feature !== MLKIT_FEATURE_KEYS.BARCODE_SCANNING) return; + + if ( + hasDefinedOption(options, 'formats') && + (!Array.isArray(options.formats) || + !options.formats.every( + (format) => typeof format === 'string' && BARCODE_FORMATS.has(format) + )) + ) { + invalidOption('formats'); + } + if ( + hasDefinedOption(options, 'enableAllPotentialBarcodes') && + typeof options.enableAllPotentialBarcodes !== 'boolean' + ) { + invalidOption('enableAllPotentialBarcodes'); + } +}; + /** * Factory class for managing MLKit Vision Camera plugins */ @@ -69,24 +180,36 @@ buildscript { /** * Initializes the Vision Camera plugin for a given feature. * @param {MLKitFeature} feature - The MLKit feature to initialize. - * @param {MLKitBaseOptions} options - Options for the plugin. + * @param {unknown} options - Options for the plugin. * @returns The initialized plugin. */ - static initPlugin(feature: MLKitFeature, options: MLKitBaseOptions) { + static initPlugin(feature: MLKitFeature, options: unknown) { PluginFactory.assertFeatureAvailable(feature); - if (options.roi) { + if (!isPlainObject(options)) { + throw new Error('Invalid MLKit plugin options: expected a plain object.'); + } + + validateBaseOptions(options); + validateFeatureOptions(feature, options); + + if ( + Object.prototype.hasOwnProperty.call(options, 'roi') && + options.roi !== undefined + ) { validateRegionOfInterest(options.roi); } + const validatedOptions = options as MLKitBaseOptions; + switch (feature) { case MLKIT_FEATURE_KEYS.TEXT_RECOGNITION: return VisionCameraMLKit.createTextRecognizer( - options as TextRecognitionOptions + validatedOptions as TextRecognitionOptions ); case MLKIT_FEATURE_KEYS.BARCODE_SCANNING: return VisionCameraMLKit.createBarcodeScanner( - options as BarcodeScanningOptions + validatedOptions as BarcodeScanningOptions ); default: throw new Error(PluginFactory.getFeatureErrorMessage(feature)); diff --git a/src/core/normalizeImageUri.test.ts b/src/core/normalizeImageUri.test.ts new file mode 100644 index 0000000..9b02041 --- /dev/null +++ b/src/core/normalizeImageUri.test.ts @@ -0,0 +1,58 @@ +import { INVALID_URI_ERROR } from '../shared/constants'; + +const loadNormalizeImageUri = (platform: 'ios' | 'android') => { + jest.resetModules(); + jest.doMock('react-native', () => ({ + Platform: { + OS: platform, + select: (options: Record) => + options[platform] ?? options.default, + }, + })); + + return require('./normalizeImageUri') + .normalizeImageUri as typeof import('./normalizeImageUri').normalizeImageUri; +}; + +describe('normalizeImageUri', () => { + afterEach(() => { + jest.clearAllMocks(); + jest.resetModules(); + }); + + it.each([undefined, null, '', ' '])('rejects an invalid URI: %p', (uri) => { + const normalizeImageUri = loadNormalizeImageUri('ios'); + + expect(() => normalizeImageUri(uri)).toThrow(INVALID_URI_ERROR); + }); + + it('preserves file URLs on iOS so native URL parsing decodes them safely', () => { + const normalizeImageUri = loadNormalizeImageUri('ios'); + + expect(normalizeImageUri('file:///tmp/My%20Image.jpg')).toBe( + 'file:///tmp/My%20Image.jpg' + ); + }); + + it('does not strip a file prefix embedded later in an iOS URI', () => { + const normalizeImageUri = loadNormalizeImageUri('ios'); + const uri = 'https://example.com/redirect?target=file://image.jpg'; + + expect(normalizeImageUri(uri)).toBe(uri); + }); + + it('adds the file prefix to Android bare paths', () => { + const normalizeImageUri = loadNormalizeImageUri('android'); + + expect(normalizeImageUri('/tmp/image.jpg')).toBe('file:///tmp/image.jpg'); + }); + + it.each(['file:///tmp/image.jpg', 'content://media/image/1'])( + 'preserves an existing Android scheme: %s', + (uri) => { + const normalizeImageUri = loadNormalizeImageUri('android'); + + expect(normalizeImageUri(uri)).toBe(uri); + } + ); +}); diff --git a/src/core/normalizeImageUri.ts b/src/core/normalizeImageUri.ts new file mode 100644 index 0000000..b1c2a81 --- /dev/null +++ b/src/core/normalizeImageUri.ts @@ -0,0 +1,18 @@ +import { Platform } from 'react-native'; +import { INVALID_URI_ERROR } from '../shared/constants'; + +/** + * Validates and normalizes an image URI for the static Nitro APIs. + */ +export const normalizeImageUri = (uri: unknown): string => { + if (typeof uri !== 'string' || uri.trim().length === 0) { + throw new Error(INVALID_URI_ERROR); + } + + if (Platform.OS === 'ios') { + return uri; + } + + const hasScheme = /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(uri); + return hasScheme ? uri : `file://${uri}`; +}; diff --git a/src/core/types.ts b/src/core/types.ts index ff24836..6fe1717 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -110,6 +110,13 @@ export type MLKitBaseArguments = { }; export type ImageProcessingBaseOptions = { + /** + * Optional image downscaling for performance optimization. + * Clamped to the range [0.9, 1.0] to preserve ML accuracy. + * Example: 0.9 reduces width/height by ~10% (~19% fewer pixels). + * @default 1.0 + */ + scaleFactor?: number; /** * Override the image orientation for processing. * When omitted, the orientation is automatically detected from the image's diff --git a/src/core/validateRegionOfInterest.ts b/src/core/validateRegionOfInterest.ts index 2d4abba..22f2fe2 100644 --- a/src/core/validateRegionOfInterest.ts +++ b/src/core/validateRegionOfInterest.ts @@ -1,4 +1,31 @@ -import type { RegionOfInterest } from './types'; +const hasOwnProperty = (value: object, property: string): boolean => + Object.prototype.hasOwnProperty.call(value, property); + +const isPlainObject = (value: unknown): value is Record => { + if (typeof value !== 'object' || value === null || Array.isArray(value)) { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return prototype === Object.prototype || prototype === null; +}; + +type RegionOfInterestDimensions = Record & { + x: number; + y: number; + width: number; + height: number; +}; + +const hasOwnFiniteDimensions = ( + roi: Record +): roi is RegionOfInterestDimensions => + ['x', 'y', 'width', 'height'].every( + (property) => + hasOwnProperty(roi, property) && + typeof roi[property] === 'number' && + Number.isFinite(roi[property]) + ); /** * Validates a {@link RegionOfInterest} before it crosses into native code. @@ -6,8 +33,25 @@ import type { RegionOfInterest } from './types'; * fail deep inside the crop step. * @throws {Error} If the region is invalid for its unit. */ -export const validateRegionOfInterest = (roi: RegionOfInterest): void => { - const { x, y, width, height, unit = 'normalized' } = roi; +export const validateRegionOfInterest = (roi: unknown): void => { + if (!isPlainObject(roi)) { + throw new Error('Invalid RegionOfInterest: expected a plain object.'); + } + + if (!hasOwnFiniteDimensions(roi)) { + throw new Error( + 'Invalid RegionOfInterest: x, y, width, and height must be own finite numbers.' + ); + } + + const unit = hasOwnProperty(roi, 'unit') ? roi.unit : undefined; + if (unit !== undefined && unit !== 'normalized' && unit !== 'pixel') { + throw new Error( + 'Invalid RegionOfInterest: unit must be "normalized" or "pixel" when provided.' + ); + } + + const { x, y, width, height } = roi; if (x < 0 || y < 0) { throw new Error( @@ -21,7 +65,10 @@ export const validateRegionOfInterest = (roi: RegionOfInterest): void => { ); } - if (unit === 'normalized' && (x + width > 1 || y + height > 1)) { + if ( + (unit === undefined || unit === 'normalized') && + (x + width > 1 || y + height > 1) + ) { throw new Error( `Invalid RegionOfInterest: normalized x + width and y + height must be <= 1 (got x=${x}, width=${width}, y=${y}, height=${height}).` ); diff --git a/src/features/barcode-scanning/index.ts b/src/features/barcode-scanning/index.ts index 520e222..8a55074 100644 --- a/src/features/barcode-scanning/index.ts +++ b/src/features/barcode-scanning/index.ts @@ -1,9 +1,11 @@ import { useMemo } from 'react'; import type { Frame } from 'react-native-vision-camera'; -import { NativeBridge } from '../../core/NativeBridge'; import { MLKIT_FEATURE_KEYS } from '../../core/constants'; +import { normalizeImageUri } from '../../core/normalizeImageUri'; +import { PluginFactory } from '../../core/PluginFactory'; import { useMLKitPlugin } from '../../hooks/useMLKitPlugin'; import type { BarcodeScanner } from '../../specs/BarcodeScanner.nitro'; +import { mapStaticBarcodeResult } from './mapStaticBarcodeResult'; import type { BarcodeScanningArguments, BarcodeScanningImageOptions, @@ -18,11 +20,18 @@ export const processImageBarcodeScanning = async ( uri: string, options: BarcodeScanningImageOptions = {} ): Promise => { - return await NativeBridge.processImage( + const scanner = PluginFactory.initPlugin( MLKIT_FEATURE_KEYS.BARCODE_SCANNING, - uri, options - ); + ) as BarcodeScanner; + + try { + return mapStaticBarcodeResult( + await scanner.recognizeImage(normalizeImageUri(uri)) + ); + } finally { + scanner.dispose(); + } }; /** diff --git a/src/features/barcode-scanning/mapStaticBarcodeResult.test.ts b/src/features/barcode-scanning/mapStaticBarcodeResult.test.ts new file mode 100644 index 0000000..70e5470 --- /dev/null +++ b/src/features/barcode-scanning/mapStaticBarcodeResult.test.ts @@ -0,0 +1,149 @@ +import type { BarcodeParsedValue, BarcodeScanningResult } from './types'; +import type { BarcodeScannerResult } from '../../specs/BarcodeScannerTypes'; +import { mapStaticBarcodeResult } from './mapStaticBarcodeResult'; + +const barcode = { + format: 256, + formatName: 'QR_CODE' as const, + valueType: 9, + valueTypeName: 'TYPE_WIFI' as const, + isPotential: false, +}; + +const parsedValueError = 'Invalid barcode parsed value'; + +const resultWithValue = ( + value: BarcodeScannerResult['barcodes'][number]['value'] +): BarcodeScannerResult => ({ + barcodes: [{ ...barcode, value }], +}); + +const validParsedValues: readonly BarcodeParsedValue[] = [ + { type: 'TYPE_UNKNOWN', data: { rawValue: 'unknown' } }, + { + type: 'TYPE_CONTACT_INFO', + data: { + name: { first: 'Ada' }, + organization: 'Analytical Engines', + phones: [{ number: '+15551234567', type: 'WORK', typeName: 'WORK' }], + emails: [{ address: 'ada@example.com', type: 1, typeName: 'WORK' }], + addresses: [{ addressLines: ['1 Logic Lane'], type: 'HOME' }], + urls: ['https://example.com'], + }, + }, + { type: 'TYPE_EMAIL', data: { address: 'ada@example.com', type: 'WORK' } }, + { type: 'TYPE_ISBN', data: { isbn: '9780132350884' } }, + { type: 'TYPE_PHONE', data: { number: '+15551234567', type: 1 } }, + { type: 'TYPE_PRODUCT', data: { product: '012345678905' } }, + { type: 'TYPE_SMS', data: { message: 'Hello', phoneNumber: '+15551234567' } }, + { type: 'TYPE_TEXT', data: { text: 'Hello' } }, + { type: 'TYPE_URL', data: { title: 'Example', url: 'https://example.com' } }, + { + type: 'TYPE_WIFI', + data: { ssid: 'guest-network', password: null, encryptionType: 2 }, + }, + { type: 'TYPE_GEO', data: { lat: -23.55052, lng: -46.633308 } }, + { + type: 'TYPE_CALENDAR_EVENT', + data: { + summary: 'Launch', + start: { year: 2026, month: 8, day: 2, isUtc: true }, + end: null, + }, + }, + { + type: 'TYPE_DRIVER_LICENSE', + data: { documentType: 'DL', licenseNumber: 'D1234567', gender: 'F' }, + }, +]; + +describe('mapStaticBarcodeResult', () => { + it.each(validParsedValues)('maps the valid $type parsed value', (value) => { + expect(mapStaticBarcodeResult(resultWithValue(value))).toEqual({ + barcodes: [ + { + ...barcode, + rawValue: null, + displayValue: null, + rawBytes: null, + value, + }, + ], + } satisfies BarcodeScanningResult); + }); + + it.each([ + ['a Wi-Fi string field', { type: 'TYPE_WIFI', data: { ssid: 7 } }], + [ + 'a calendar date-time field', + { type: 'TYPE_CALENDAR_EVENT', data: { start: { year: '2026' } } }, + ], + [ + 'a contact name field', + { type: 'TYPE_CONTACT_INFO', data: { name: { first: 7 } } }, + ], + [ + 'a contact phone field', + { type: 'TYPE_CONTACT_INFO', data: { phones: [{ number: 7 }] } }, + ], + [ + 'a contact email field', + { type: 'TYPE_CONTACT_INFO', data: { emails: [{ address: 7 }] } }, + ], + [ + 'a contact address field', + { + type: 'TYPE_CONTACT_INFO', + data: { addresses: [{ addressLines: ['1 Logic Lane', 7] }] }, + }, + ], + ])('throws for %s with the wrong type', (_description, value) => { + expect(() => mapStaticBarcodeResult(resultWithValue(value))).toThrow( + parsedValueError + ); + }); + + it.each([ + [ + 'a type/data mismatch', + { type: 'TYPE_WIFI', data: { text: 'not Wi-Fi data' } }, + ], + ['an unknown discriminator', { type: 'TYPE_CUSTOM', data: {} }], + ['a non-record payload', { type: 'TYPE_WIFI', data: null }], + ['a non-string discriminator', { type: { name: 'TYPE_WIFI' }, data: {} }], + ])('throws for %s', (_description, value) => { + expect(() => mapStaticBarcodeResult(resultWithValue(value))).toThrow( + parsedValueError + ); + }); + + it('leaves an absent parsed value absent', () => { + expect(mapStaticBarcodeResult({ barcodes: [{ ...barcode }] })).toEqual({ + barcodes: [ + { + ...barcode, + rawValue: null, + displayValue: null, + rawBytes: null, + }, + ], + }); + }); + + it('normalizes explicitly undefined static fields to the public null shape', () => { + const result: BarcodeScannerResult = { + barcodes: [{ ...barcode, rawValue: undefined, displayValue: undefined }], + }; + + expect(mapStaticBarcodeResult(result)).toEqual({ + barcodes: [ + { + ...barcode, + rawValue: null, + displayValue: null, + rawBytes: null, + }, + ], + }); + }); +}); diff --git a/src/features/barcode-scanning/mapStaticBarcodeResult.ts b/src/features/barcode-scanning/mapStaticBarcodeResult.ts new file mode 100644 index 0000000..8cf176a --- /dev/null +++ b/src/features/barcode-scanning/mapStaticBarcodeResult.ts @@ -0,0 +1,294 @@ +import type { + BarcodeAddressData, + BarcodeCalendarDateTime, + BarcodeCalendarEventData, + BarcodeContactInfoData, + BarcodeData, + BarcodeDriverLicenseData, + BarcodeEmailData, + BarcodeGeoData, + BarcodeIsbnData, + BarcodeParsedValue, + BarcodePersonName, + BarcodePhoneData, + BarcodeProductData, + BarcodeScanningResult, + BarcodeSmsData, + BarcodeTextData, + BarcodeUnknownData, + BarcodeUrlData, + BarcodeWifiData, +} from './types'; +import type { + BarcodeScannerBarcode, + BarcodeScannerResult, +} from '../../specs/BarcodeScannerTypes'; + +const parsedValueError = 'Invalid barcode parsed value'; + +type ValueValidator = (value: unknown) => boolean; + +const isRecord = (value: unknown): value is Record => + typeof value === 'object' && value !== null && !Array.isArray(value); + +const isNullableString: ValueValidator = (value) => + value === null || typeof value === 'string'; + +const isNullableNumber: ValueValidator = (value) => + value === null || typeof value === 'number'; + +const isNullableBoolean: ValueValidator = (value) => + value === null || typeof value === 'boolean'; + +const isNullableStringOrNumber: ValueValidator = (value) => + value === null || typeof value === 'string' || typeof value === 'number'; + +const isOptional = + (validator: ValueValidator): ValueValidator => + (value) => + value === undefined || validator(value); + +const isNullableRecord = + (validator: ValueValidator): ValueValidator => + (value) => + value === null || validator(value); + +const isArrayOf = + (validator: ValueValidator): ValueValidator => + (value) => + Array.isArray(value) && value.every(validator); + +const hasValidProperties = ( + value: Record, + validators: Record +): boolean => + Object.keys(value).every((key) => { + const validator = validators[key]; + return validator !== undefined && validator(value[key]); + }); + +const hasSchema = ( + value: unknown, + validators: Record +): value is Record => + isRecord(value) && hasValidProperties(value, validators); + +const isStringArray = isArrayOf((value) => typeof value === 'string'); + +const isCalendarDateTime = (value: unknown): value is BarcodeCalendarDateTime => + hasSchema(value, { + year: isOptional(isNullableNumber), + month: isOptional(isNullableNumber), + day: isOptional(isNullableNumber), + hours: isOptional(isNullableNumber), + minutes: isOptional(isNullableNumber), + seconds: isOptional(isNullableNumber), + isUtc: isOptional(isNullableBoolean), + rawValue: isOptional(isNullableString), + }); + +const isPersonName = (value: unknown): value is BarcodePersonName => + hasSchema(value, { + formattedName: isOptional(isNullableString), + pronunciation: isOptional(isNullableString), + prefix: isOptional(isNullableString), + first: isOptional(isNullableString), + middle: isOptional(isNullableString), + last: isOptional(isNullableString), + suffix: isOptional(isNullableString), + }); + +const isPhoneData = (value: unknown): value is BarcodePhoneData => + hasSchema(value, { + number: isOptional(isNullableString), + type: isOptional(isNullableStringOrNumber), + typeName: isOptional(isNullableString), + }); + +const isEmailData = (value: unknown): value is BarcodeEmailData => + hasSchema(value, { + address: isOptional(isNullableString), + subject: isOptional(isNullableString), + body: isOptional(isNullableString), + type: isOptional(isNullableStringOrNumber), + typeName: isOptional(isNullableString), + }); + +const isAddressData = (value: unknown): value is BarcodeAddressData => + hasSchema(value, { + addressLines: isOptional(isNullableRecord(isStringArray)), + type: isOptional(isNullableStringOrNumber), + typeName: isOptional(isNullableString), + }); + +const isWifiData = (value: unknown): value is BarcodeWifiData => + hasSchema(value, { + ssid: isOptional(isNullableString), + password: isOptional(isNullableString), + encryptionType: isOptional(isNullableNumber), + encryptionTypeName: isOptional(isNullableString), + type: isOptional(isNullableStringOrNumber), + typeName: isOptional(isNullableString), + }); + +const isUrlData = (value: unknown): value is BarcodeUrlData => + hasSchema(value, { + title: isOptional(isNullableString), + url: isOptional(isNullableString), + }); + +const isSmsData = (value: unknown): value is BarcodeSmsData => + hasSchema(value, { + message: isOptional(isNullableString), + phoneNumber: isOptional(isNullableString), + }); + +const isGeoData = (value: unknown): value is BarcodeGeoData => + hasSchema(value, { + lat: isOptional(isNullableNumber), + lng: isOptional(isNullableNumber), + }); + +const isCalendarEventData = ( + value: unknown +): value is BarcodeCalendarEventData => + hasSchema(value, { + summary: isOptional(isNullableString), + description: isOptional(isNullableString), + location: isOptional(isNullableString), + organizer: isOptional(isNullableString), + status: isOptional(isNullableString), + start: isOptional(isNullableRecord(isCalendarDateTime)), + end: isOptional(isNullableRecord(isCalendarDateTime)), + }); + +const isContactInfoData = (value: unknown): value is BarcodeContactInfoData => + hasSchema(value, { + name: isOptional(isNullableRecord(isPersonName)), + organization: isOptional(isNullableString), + title: isOptional(isNullableString), + phones: isOptional(isNullableRecord(isArrayOf(isPhoneData))), + emails: isOptional(isNullableRecord(isArrayOf(isEmailData))), + addresses: isOptional(isNullableRecord(isArrayOf(isAddressData))), + urls: isOptional(isNullableRecord(isStringArray)), + }); + +const isDriverLicenseData = ( + value: unknown +): value is BarcodeDriverLicenseData => + hasSchema(value, { + documentType: isOptional(isNullableString), + licenseNumber: isOptional(isNullableString), + firstName: isOptional(isNullableString), + middleName: isOptional(isNullableString), + lastName: isOptional(isNullableString), + gender: isOptional(isNullableStringOrNumber), + addressStreet: isOptional(isNullableString), + addressCity: isOptional(isNullableString), + addressState: isOptional(isNullableString), + addressZip: isOptional(isNullableString), + birthDate: isOptional(isNullableString), + issueDate: isOptional(isNullableString), + expiryDate: isOptional(isNullableString), + issuingCountry: isOptional(isNullableString), + }); + +const isTextData = (value: unknown): value is BarcodeTextData => + hasSchema(value, { text: isOptional(isNullableString) }); + +const isProductData = (value: unknown): value is BarcodeProductData => + hasSchema(value, { product: isOptional(isNullableString) }); + +const isIsbnData = (value: unknown): value is BarcodeIsbnData => + hasSchema(value, { isbn: isOptional(isNullableString) }); + +const isUnknownData = (value: unknown): value is BarcodeUnknownData => + hasSchema(value, { rawValue: isOptional(isNullableString) }); + +const invalidParsedValue = (): never => { + throw new Error(parsedValueError); +}; + +const mapParsedValue = (value: unknown): BarcodeParsedValue => { + if (!isRecord(value) || !isRecord(value.data)) { + return invalidParsedValue(); + } + + switch (value.type) { + case 'TYPE_WIFI': + return isWifiData(value.data) + ? { type: 'TYPE_WIFI', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_URL': + return isUrlData(value.data) + ? { type: 'TYPE_URL', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_SMS': + return isSmsData(value.data) + ? { type: 'TYPE_SMS', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_EMAIL': + return isEmailData(value.data) + ? { type: 'TYPE_EMAIL', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_PHONE': + return isPhoneData(value.data) + ? { type: 'TYPE_PHONE', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_GEO': + return isGeoData(value.data) + ? { type: 'TYPE_GEO', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_CALENDAR_EVENT': + return isCalendarEventData(value.data) + ? { type: 'TYPE_CALENDAR_EVENT', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_CONTACT_INFO': + return isContactInfoData(value.data) + ? { type: 'TYPE_CONTACT_INFO', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_DRIVER_LICENSE': + return isDriverLicenseData(value.data) + ? { type: 'TYPE_DRIVER_LICENSE', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_TEXT': + return isTextData(value.data) + ? { type: 'TYPE_TEXT', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_PRODUCT': + return isProductData(value.data) + ? { type: 'TYPE_PRODUCT', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_ISBN': + return isIsbnData(value.data) + ? { type: 'TYPE_ISBN', data: { ...value.data } } + : invalidParsedValue(); + case 'TYPE_UNKNOWN': + return isUnknownData(value.data) + ? { type: 'TYPE_UNKNOWN', data: { ...value.data } } + : invalidParsedValue(); + default: + return invalidParsedValue(); + } +}; + +const mapStaticBarcode = (barcode: BarcodeScannerBarcode): BarcodeData => { + const { value, ...barcodeData } = barcode; + + return { + ...barcodeData, + rawValue: barcode.rawValue ?? null, + displayValue: barcode.displayValue ?? null, + rawBytes: barcode.rawBytes ?? null, + ...(value === undefined ? {} : { value: mapParsedValue(value) }), + }; +}; + +/** + * Converts the codegen-safe static Nitro result to the public barcode result. + */ +export const mapStaticBarcodeResult = ( + result: BarcodeScannerResult +): BarcodeScanningResult => ({ + barcodes: result.barcodes.map(mapStaticBarcode), +}); diff --git a/src/features/barcode-scanning/types.ts b/src/features/barcode-scanning/types.ts index b718ed1..c854489 100644 --- a/src/features/barcode-scanning/types.ts +++ b/src/features/barcode-scanning/types.ts @@ -41,8 +41,6 @@ export type BarcodeScanningImageOptions = ImageProcessingBaseOptions & { * For potential barcodes, `rawValue` and `rawBytes` may be null. */ enableAllPotentialBarcodes?: boolean; - /** Optional image downscaling for performance optimization. Clamped to [0.9, 1.0]. */ - scaleFactor?: number; }; export type BarcodeScanningArguments = MLKitBaseArguments & {}; diff --git a/src/features/text-recognition/index.ts b/src/features/text-recognition/index.ts index 8b72bf5..726efe6 100644 --- a/src/features/text-recognition/index.ts +++ b/src/features/text-recognition/index.ts @@ -1,7 +1,8 @@ import { useMemo } from 'react'; import type { Frame } from 'react-native-vision-camera'; -import { NativeBridge } from '../../core/NativeBridge'; import { MLKIT_FEATURE_KEYS } from '../../core/constants'; +import { normalizeImageUri } from '../../core/normalizeImageUri'; +import { PluginFactory } from '../../core/PluginFactory'; import { useMLKitPlugin } from '../../hooks/useMLKitPlugin'; import type { TextRecognizer } from '../../specs/TextRecognizer.nitro'; import type { @@ -21,11 +22,16 @@ export const processImageTextRecognition = async ( uri: string, options: TextRecognitionImageOptions = {} ): Promise => { - return await NativeBridge.processImage( + const recognizer = PluginFactory.initPlugin( MLKIT_FEATURE_KEYS.TEXT_RECOGNITION, - uri, options - ); + ) as TextRecognizer; + + try { + return await recognizer.recognizeImage(normalizeImageUri(uri)); + } finally { + recognizer.dispose(); + } }; /** diff --git a/src/shared/constants.ts b/src/shared/constants.ts index b94d1ff..1529311 100644 --- a/src/shared/constants.ts +++ b/src/shared/constants.ts @@ -1,13 +1,6 @@ -import { Platform } from 'react-native'; import { MLKIT_FEATURE_KEYS } from '../core/constants'; import type { MLKitFeature } from '../core/types'; -export const LINKING_ERROR = - `The package 'react-native-vision-camera-mlkit' doesn't seem to be linked. Make sure: \n\n` + - Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + - '- You rebuilt the app after installing the package\n' + - '- You are not using Expo Go\n'; - const TEXT_RECOGNITION_ERROR = 'Text Recognition feature is not enabled. Please enable it in your Podfile (iOS) or build.gradle (Android) and rebuild your app.'; @@ -65,6 +58,3 @@ export const IMAGE_PROCESSING_FAILED_ERROR = export const UNSUPPORTED_IMAGE_FORMAT_ERROR = 'Unsupported image format. Only JPEG, PNG, and WebP are supported.'; - -export const MISSING_MODULE_ERROR = - 'VisionCameraMLKit native module is not available. Ensure it is linked, pods are installed, and the app was rebuilt.'; diff --git a/src/specs/BarcodeScanner.nitro.ts b/src/specs/BarcodeScanner.nitro.ts index dfc9acf..558526c 100644 --- a/src/specs/BarcodeScanner.nitro.ts +++ b/src/specs/BarcodeScanner.nitro.ts @@ -17,4 +17,9 @@ export interface BarcodeScanner frame: Frame, args?: BarcodeScanningArguments ): BarcodeScannerResult; + + /** + * Runs ML Kit barcode scanning on a static image URI. + */ + recognizeImage(uri: string): Promise; } diff --git a/src/specs/BarcodeScannerTypes.ts b/src/specs/BarcodeScannerTypes.ts index 216f7c5..dc3ddf7 100644 --- a/src/specs/BarcodeScannerTypes.ts +++ b/src/specs/BarcodeScannerTypes.ts @@ -1,4 +1,5 @@ import type { BoundingBox, Corner } from '../core/types'; +import type { AnyMap } from 'react-native-nitro-modules'; import type { BarcodeFormat, BarcodeValueTypeName, @@ -53,6 +54,12 @@ export interface BarcodeScannerBarcode { */ rawBytes?: number[]; + /** + * Parsed ML Kit barcode payload. This stays untyped at the Nitro boundary + * because its public representation is a discriminated union. + */ + value?: AnyMap; + /** * Whether this is an undecoded potential barcode. */ diff --git a/src/specs/MLKitVisionTypes.ts b/src/specs/MLKitVisionTypes.ts index f0e7b65..4ac9d8d 100644 --- a/src/specs/MLKitVisionTypes.ts +++ b/src/specs/MLKitVisionTypes.ts @@ -1,6 +1,6 @@ import type { BarcodeFormat } from '../features/barcode-scanning/types'; import type { TextRecognitionLanguage } from '../features/text-recognition/types'; -import type { RegionOfInterest } from '../core/types'; +import type { Orientation, RegionOfInterest } from '../core/types'; /** * ML Kit features that can be compiled into this package. @@ -43,6 +43,11 @@ export interface MLKitRecognizerOptions { * full source frame coordinates. */ roi?: RegionOfInterest; + + /** + * Override the source image orientation when recognizing a static image. + */ + orientation?: Orientation; } /** diff --git a/src/specs/TextRecognizer.nitro.ts b/src/specs/TextRecognizer.nitro.ts index 4109dce..623d2d9 100644 --- a/src/specs/TextRecognizer.nitro.ts +++ b/src/specs/TextRecognizer.nitro.ts @@ -19,4 +19,9 @@ export interface TextRecognizer frame: Frame, args?: TextRecognitionArguments ): TextRecognitionResult; + + /** + * Runs ML Kit text recognition on a static image URI. + */ + recognizeImage(uri: string): Promise; } diff --git a/turbo.json b/turbo.json index c4d78c4..a52d06e 100644 --- a/turbo.json +++ b/turbo.json @@ -23,7 +23,8 @@ "env": [ "RCT_NEW_ARCH_ENABLED", "RCT_USE_RN_DEP", - "RCT_USE_PREBUILT_RNCORE" + "RCT_USE_PREBUILT_RNCORE", + "IOS_DESTINATION" ], "inputs": [ "package.json", diff --git a/yarn.lock b/yarn.lock index f898472..6db7427 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,19 +5,19 @@ __metadata: version: 8 cacheKey: 10c0 -"@ark/schema@npm:0.56.0": - version: 0.56.0 - resolution: "@ark/schema@npm:0.56.0" +"@ark/schema@npm:0.56.2": + version: 0.56.2 + resolution: "@ark/schema@npm:0.56.2" dependencies: - "@ark/util": "npm:0.56.0" - checksum: 10c0/89fb7e4e1304ea9b34c834a8cb34bc05201b4e3a1b26277f7d74b9505a2d7ed398bb55a77e491e7a14a7f0807424a5467e1d32ee725ee2f7b9d158ae30d8121a + "@ark/util": "npm:0.56.2" + checksum: 10c0/0825c34969dcf3ff199a50b663eb792469f1c78b45f7dea565b2101fda9ab4e91eb5e088e0a5b6a667a05ddd1cc8b1bcbd6369ab2337655c40e680022fa00892 languageName: node linkType: hard -"@ark/util@npm:0.56.0": - version: 0.56.0 - resolution: "@ark/util@npm:0.56.0" - checksum: 10c0/dfef779c90f9f814ba97069c63bf91fa67569b87c5cd925d0e2d96b91aa677c019ed1dd5ff95332d9bb0598f785057439074b8cbfcaa2578770616e260fc5761 +"@ark/util@npm:0.56.2": + version: 0.56.2 + resolution: "@ark/util@npm:0.56.2" + checksum: 10c0/dc5757fa7281ec2f202c7b6df8ff3bb154ee6a027eb5c69e7bbc30596fe7385109347c6124bee1e9c3a30c8def3dee7aaaa963103abd4c91dfb4bb1433a537ca languageName: node linkType: hard @@ -43,14 +43,14 @@ __metadata: languageName: node linkType: hard -"@babel/compat-data@npm:^7.27.2, @babel/compat-data@npm:^7.27.7, @babel/compat-data@npm:^7.28.5": +"@babel/compat-data@npm:^7.27.2, @babel/compat-data@npm:^7.28.5": version: 7.28.5 resolution: "@babel/compat-data@npm:7.28.5" checksum: 10c0/702a25de73087b0eba325c1d10979eed7c9b6662677386ba7b5aa6eace0fc0676f78343bae080a0176ae26f58bd5535d73b9d0fbb547fef377692e8b249353a7 languageName: node linkType: hard -"@babel/compat-data@npm:^7.29.7": +"@babel/compat-data@npm:^7.28.6, @babel/compat-data@npm:^7.29.7": version: 7.29.7 resolution: "@babel/compat-data@npm:7.29.7" checksum: 10c0/47913f05e08a45a1c9df38c02b4b49e391005085b489432647a1abe112e5d9c75e3be8ea5972b7f6da4ec5d1339922ceb9ea02b8a25d4ed1cb8636e5261f344e @@ -143,6 +143,19 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.29.8": + version: 7.29.8 + resolution: "@babel/generator@npm:7.29.8" + dependencies: + "@babel/parser": "npm:^7.29.8" + "@babel/types": "npm:^7.29.8" + "@jridgewell/gen-mapping": "npm:^0.3.12" + "@jridgewell/trace-mapping": "npm:^0.3.28" + jsesc: "npm:^3.0.2" + checksum: 10c0/7b896696314a659652393b76d78276e236acd0f7fae40a9a1af7f01c76aeafc630dd0966aad6f9386d35d7c674a8e6e2d8e217c44d25fb11460e68afa9ba8441 + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:^7.27.1, @babel/helper-annotate-as-pure@npm:^7.27.3": version: 7.27.3 resolution: "@babel/helper-annotate-as-pure@npm:7.27.3" @@ -174,7 +187,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-compilation-targets@npm:^7.29.7": +"@babel/helper-compilation-targets@npm:^7.28.6, @babel/helper-compilation-targets@npm:^7.29.7": version: 7.29.7 resolution: "@babel/helper-compilation-targets@npm:7.29.7" dependencies: @@ -249,6 +262,21 @@ __metadata: languageName: node linkType: hard +"@babel/helper-define-polyfill-provider@npm:^0.6.8": + version: 0.6.8 + resolution: "@babel/helper-define-polyfill-provider@npm:0.6.8" + dependencies: + "@babel/helper-compilation-targets": "npm:^7.28.6" + "@babel/helper-plugin-utils": "npm:^7.28.6" + debug: "npm:^4.4.3" + lodash.debounce: "npm:^4.0.8" + resolve: "npm:^1.22.11" + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 10c0/306a169f2cb285f368578219ef18ea9702860d3d02d64334f8d45ea38648be0b9e1edad8c8f732fa34bb4206ccbb9883c395570fd57ab7bbcf293bc5964c5b3a + languageName: node + linkType: hard + "@babel/helper-globals@npm:^7.28.0": version: 7.28.0 resolution: "@babel/helper-globals@npm:7.28.0" @@ -354,7 +382,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:^7.29.7": +"@babel/helper-plugin-utils@npm:^7.28.6, @babel/helper-plugin-utils@npm:^7.29.7": version: 7.29.7 resolution: "@babel/helper-plugin-utils@npm:7.29.7" checksum: 10c0/380477a06133274a2759f9355929cb60a95e8b8fee624a1ae1fa349e1d1645b89daca456f72833f6d1062bffa12ee4271c5bf0cc5a61c0166cdc24c7591e2408 @@ -515,6 +543,17 @@ __metadata: languageName: node linkType: hard +"@babel/parser@npm:^7.29.8": + version: 7.29.8 + resolution: "@babel/parser@npm:7.29.8" + dependencies: + "@babel/types": "npm:^7.29.8" + bin: + parser: ./bin/babel-parser.js + checksum: 10c0/acc890c5e6a6dd40863a47b50bac111d7185ee6fbbe163ebe11d5214854ca2adb901462ad4d718a65090ef84bd2230e9e8ab45a2e0caccc685f1f57ab0bb1e28 + languageName: node + linkType: hard + "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.28.5": version: 7.28.5 resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.28.5" @@ -1207,17 +1246,17 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-modules-systemjs@npm:^7.28.5": - version: 7.28.5 - resolution: "@babel/plugin-transform-modules-systemjs@npm:7.28.5" +"@babel/plugin-transform-modules-systemjs@npm:7.29.8": + version: 7.29.8 + resolution: "@babel/plugin-transform-modules-systemjs@npm:7.29.8" dependencies: - "@babel/helper-module-transforms": "npm:^7.28.3" - "@babel/helper-plugin-utils": "npm:^7.27.1" - "@babel/helper-validator-identifier": "npm:^7.28.5" - "@babel/traverse": "npm:^7.28.5" + "@babel/helper-module-transforms": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/helper-validator-identifier": "npm:^7.29.7" + "@babel/traverse": "npm:^7.29.8" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/7e8c0bcff79689702b974f6a0fedb5d0c6eeb5a5e3384deb7028e7cfe92a5242cc80e981e9c1817aad29f2ecc01841753365dd38d877aa0b91737ceec2acfd07 + checksum: 10c0/18167443bae93f485a43a1acdba9e53ac143043b93553d2ca1178030b68d4c1a7d5f5e717198aa8d73f39f33c023090af2270da774484105307e0fada5654687 languageName: node linkType: hard @@ -1861,6 +1900,21 @@ __metadata: languageName: node linkType: hard +"@babel/traverse@npm:^7.29.8": + version: 7.29.8 + resolution: "@babel/traverse@npm:7.29.8" + dependencies: + "@babel/code-frame": "npm:^7.29.7" + "@babel/generator": "npm:^7.29.8" + "@babel/helper-globals": "npm:^7.29.7" + "@babel/parser": "npm:^7.29.8" + "@babel/template": "npm:^7.29.7" + "@babel/types": "npm:^7.29.8" + debug: "npm:^4.3.1" + checksum: 10c0/87a28989c434add26d787776ac6d30f749b89cb030f2a605c89f671a516a6fa165ac0476f07e2b69feed70128b2734cae1cbbf41dfe95ccf22081bd8f8b91923 + languageName: node + linkType: hard + "@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.27.1, @babel/types@npm:^7.27.3, @babel/types@npm:^7.28.2, @babel/types@npm:^7.28.4, @babel/types@npm:^7.28.5, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4": version: 7.28.5 resolution: "@babel/types@npm:7.28.5" @@ -1881,6 +1935,16 @@ __metadata: languageName: node linkType: hard +"@babel/types@npm:^7.29.8": + version: 7.29.8 + resolution: "@babel/types@npm:7.29.8" + dependencies: + "@babel/helper-string-parser": "npm:^7.29.7" + "@babel/helper-validator-identifier": "npm:^7.29.7" + checksum: 10c0/be7c279f0abf2a086c633e21b49c7ca80275d05283cc5a268b67a708c9914bd0c944f1422b3eb3cb37682a2af5d560abf520ccf9b01b53ecbfe6b71fbc3fdde6 + languageName: node + linkType: hard + "@bcoe/v8-coverage@npm:^0.2.3": version: 0.2.3 resolution: "@bcoe/v8-coverage@npm:0.2.3" @@ -2098,6 +2162,25 @@ __metadata: languageName: node linkType: hard +"@conventional-changelog/git-client@npm:^2.7.0": + version: 2.7.0 + resolution: "@conventional-changelog/git-client@npm:2.7.0" + dependencies: + "@simple-libs/child-process-utils": "npm:^1.0.0" + "@simple-libs/stream-utils": "npm:^1.2.0" + semver: "npm:^7.5.2" + peerDependencies: + conventional-commits-filter: ^5.0.0 + conventional-commits-parser: ^6.4.0 + peerDependenciesMeta: + conventional-commits-filter: + optional: true + conventional-commits-parser: + optional: true + checksum: 10c0/798097baa08a13311989e803451b9a8e602f404fcde1ec9fef609512625674c2d2a2f4368fbe00754a36f255e5b93dd852e7d3f2a9814215f9887ffa55c93993 + languageName: node + linkType: hard + "@eslint-community/eslint-utils@npm:^4.8.0, @eslint-community/eslint-utils@npm:^4.9.1": version: 4.9.1 resolution: "@eslint-community/eslint-utils@npm:4.9.1" @@ -2130,14 +2213,14 @@ __metadata: languageName: node linkType: hard -"@eslint/config-array@npm:^0.21.1": - version: 0.21.1 - resolution: "@eslint/config-array@npm:0.21.1" +"@eslint/config-array@npm:^0.21.2": + version: 0.21.2 + resolution: "@eslint/config-array@npm:0.21.2" dependencies: "@eslint/object-schema": "npm:^2.1.7" debug: "npm:^4.3.1" - minimatch: "npm:^3.1.2" - checksum: 10c0/2f657d4edd6ddcb920579b72e7a5b127865d4c3fb4dda24f11d5c4f445a93ca481aebdbd6bf3291c536f5d034458dbcbb298ee3b698bc6c9dd02900fe87eec3c + minimatch: "npm:^3.1.5" + checksum: 10c0/89dfe815d18456177c0a1f238daf4593107fd20298b3598e0103054360d3b8d09d967defd8318f031185d68df1f95cfa68becf1390a9c5c6887665f1475142e3 languageName: node linkType: hard @@ -2176,7 +2259,31 @@ __metadata: languageName: node linkType: hard -"@eslint/js@npm:9.39.2, @eslint/js@npm:^9.35.0": +"@eslint/eslintrc@npm:^3.3.6": + version: 3.3.6 + resolution: "@eslint/eslintrc@npm:3.3.6" + dependencies: + ajv: "npm:^6.14.0" + debug: "npm:^4.3.2" + espree: "npm:^10.0.1" + globals: "npm:^14.0.0" + ignore: "npm:^5.2.0" + import-fresh: "npm:^3.2.1" + js-yaml: "npm:^4.3.0" + minimatch: "npm:^3.1.5" + strip-json-comments: "npm:^3.1.1" + checksum: 10c0/349697171ee116f501a2f483bf47cd38937a61880aeb1c23481a69afc95e95859430a0947acbe1f5507f223180bf57530ecf2989e73bcbea763a6dcffdf1d010 + languageName: node + linkType: hard + +"@eslint/js@npm:9.39.5": + version: 9.39.5 + resolution: "@eslint/js@npm:9.39.5" + checksum: 10c0/49894e98ba313a7d3bfb1b20d55c0f9826be45a7db876fd84e533ac7f101b1d95b51cd22c6a6db3a45066b9c0d068c31b4a22fa0db8a6cc8744a25540efdb824 + languageName: node + linkType: hard + +"@eslint/js@npm:^9.35.0": version: 9.39.2 resolution: "@eslint/js@npm:9.39.2" checksum: 10c0/00f51c52b04ac79faebfaa65a9652b2093b9c924e945479f1f3945473f78aee83cbc76c8d70bbffbf06f7024626575b16d97b66eab16182e1d0d39daff2f26f5 @@ -2566,22 +2673,6 @@ __metadata: languageName: node linkType: hard -"@isaacs/balanced-match@npm:^4.0.1": - version: 4.0.1 - resolution: "@isaacs/balanced-match@npm:4.0.1" - checksum: 10c0/7da011805b259ec5c955f01cee903da72ad97c5e6f01ca96197267d3f33103d5b2f8a1af192140f3aa64526c593c8d098ae366c2b11f7f17645d12387c2fd420 - languageName: node - linkType: hard - -"@isaacs/brace-expansion@npm:^5.0.0": - version: 5.0.0 - resolution: "@isaacs/brace-expansion@npm:5.0.0" - dependencies: - "@isaacs/balanced-match": "npm:^4.0.1" - checksum: 10c0/b4d4812f4be53afc2c5b6c545001ff7a4659af68d4484804e9d514e183d20269bb81def8682c01a22b17c4d6aed14292c8494f7d2ac664e547101c1a905aa977 - languageName: node - linkType: hard - "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -2970,28 +3061,6 @@ __metadata: languageName: node linkType: hard -"@npmcli/agent@npm:^4.0.0": - version: 4.0.0 - resolution: "@npmcli/agent@npm:4.0.0" - dependencies: - agent-base: "npm:^7.1.0" - http-proxy-agent: "npm:^7.0.0" - https-proxy-agent: "npm:^7.0.1" - lru-cache: "npm:^11.2.1" - socks-proxy-agent: "npm:^8.0.3" - checksum: 10c0/f7b5ce0f3dd42c3f8c6546e8433573d8049f67ef11ec22aa4704bc41483122f68bf97752e06302c455ead667af5cb753e6a09bff06632bc465c1cfd4c4b75a53 - languageName: node - linkType: hard - -"@npmcli/fs@npm:^5.0.0": - version: 5.0.0 - resolution: "@npmcli/fs@npm:5.0.0" - dependencies: - semver: "npm:^7.3.5" - checksum: 10c0/26e376d780f60ff16e874a0ac9bc3399186846baae0b6e1352286385ac134d900cc5dafaded77f38d77f86898fc923ae1cee9d7399f0275b1aa24878915d722b - languageName: node - linkType: hard - "@octokit/auth-token@npm:^6.0.0": version: 6.0.0 resolution: "@octokit/auth-token@npm:6.0.0" @@ -3130,10 +3199,10 @@ __metadata: languageName: node linkType: hard -"@pkgr/core@npm:^0.2.9": - version: 0.2.9 - resolution: "@pkgr/core@npm:0.2.9" - checksum: 10c0/ac8e4e8138b1a7a4ac6282873aef7389c352f1f8b577b4850778f5182e4a39a5241facbe48361fec817f56d02b51691b383010843fb08b34a8e8ea3614688fd5 +"@pkgr/core@npm:^0.3.6": + version: 0.3.6 + resolution: "@pkgr/core@npm:0.3.6" + checksum: 10c0/153f0f4563f505faeba13c733efa0e05e467ce1c6b941055a5fd3b4560da60fbf1dff4b11da0075f034ddda11f2842b90395f60895dde5825875b616edccc11c languageName: node linkType: hard @@ -3717,6 +3786,13 @@ __metadata: languageName: node linkType: hard +"@simple-libs/hosted-git-info@npm:^1.0.2": + version: 1.0.2 + resolution: "@simple-libs/hosted-git-info@npm:1.0.2" + checksum: 10c0/6f22b598b9d37f3e37e409eb588126d14a68f62d52f6e2bb1d99745eb86de8843a02a6fbf7e7f4d026a07fcb1f98d0036d9dcb47363275fa86e67c237fadac75 + languageName: node + linkType: hard + "@simple-libs/stream-utils@npm:^1.1.0": version: 1.1.0 resolution: "@simple-libs/stream-utils@npm:1.1.0" @@ -3726,6 +3802,13 @@ __metadata: languageName: node linkType: hard +"@simple-libs/stream-utils@npm:^1.2.0": + version: 1.2.0 + resolution: "@simple-libs/stream-utils@npm:1.2.0" + checksum: 10c0/2788ac7b167d1b6c81b8c6fae2f5d9688b1f02ab31e9e15b33c9dc2ae920cf7de87869de10679be8957f9adb645c91c8919e271f3e34b6b4ec56daf725522dc7 + languageName: node + linkType: hard + "@sinclair/typebox@npm:^0.27.8": version: 0.27.8 resolution: "@sinclair/typebox@npm:0.27.8" @@ -3786,6 +3869,48 @@ __metadata: languageName: node linkType: hard +"@turbo/darwin-64@npm:2.10.8": + version: 2.10.8 + resolution: "@turbo/darwin-64@npm:2.10.8" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@turbo/darwin-arm64@npm:2.10.8": + version: 2.10.8 + resolution: "@turbo/darwin-arm64@npm:2.10.8" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@turbo/linux-64@npm:2.10.8": + version: 2.10.8 + resolution: "@turbo/linux-64@npm:2.10.8" + conditions: (os=android | os=linux) & cpu=x64 + languageName: node + linkType: hard + +"@turbo/linux-arm64@npm:2.10.8": + version: 2.10.8 + resolution: "@turbo/linux-arm64@npm:2.10.8" + conditions: (os=android | os=linux) & cpu=arm64 + languageName: node + linkType: hard + +"@turbo/windows-64@npm:2.10.8": + version: 2.10.8 + resolution: "@turbo/windows-64@npm:2.10.8" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@turbo/windows-arm64@npm:2.10.8": + version: 2.10.8 + resolution: "@turbo/windows-arm64@npm:2.10.8" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@types/babel__core@npm:^7.1.14": version: 7.20.5 resolution: "@types/babel__core@npm:7.20.5" @@ -4135,10 +4260,10 @@ __metadata: languageName: node linkType: hard -"abbrev@npm:^4.0.0": - version: 4.0.0 - resolution: "abbrev@npm:4.0.0" - checksum: 10c0/b4cc16935235e80702fc90192e349e32f8ef0ed151ef506aa78c81a7c455ec18375c4125414b99f84b2e055199d66383e787675f0bcd87da7a4dbd59f9eac1d5 +"abbrev@npm:^5.0.0": + version: 5.0.0 + resolution: "abbrev@npm:5.0.0" + checksum: 10c0/8e88f5c798ea4562d28c5a3e9ad69e3879890bc5d695d8f2dffb8609be4c890aacc8f80ef4553fdd2c6a62d70c2ce8bc57b38074e383beb7487bdafa9ed42ea5 languageName: node linkType: hard @@ -4181,11 +4306,11 @@ __metadata: linkType: hard "acorn@npm:^8.15.0": - version: 8.15.0 - resolution: "acorn@npm:8.15.0" + version: 8.18.0 + resolution: "acorn@npm:8.18.0" bin: acorn: bin/acorn - checksum: 10c0/dec73ff59b7d6628a01eebaece7f2bdb8bb62b9b5926dcad0f8931f2b8b79c2be21f6c68ac095592adb5adb15831a3635d9343e6a91d028bbe85d564875ec3ec + checksum: 10c0/be771be2135cc07910cf76f444ad514d7dcfd6d4a8026e597e93155275abc8ef61eee12211d52146e9d962874269b634f397464942087be013c89d0c54c5f8e5 languageName: node linkType: hard @@ -4206,27 +4331,27 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^6.12.4": - version: 6.12.6 - resolution: "ajv@npm:6.12.6" +"ajv@npm:^6.12.4, ajv@npm:^6.14.0": + version: 6.15.0 + resolution: "ajv@npm:6.15.0" dependencies: fast-deep-equal: "npm:^3.1.1" fast-json-stable-stringify: "npm:^2.0.0" json-schema-traverse: "npm:^0.4.1" uri-js: "npm:^4.2.2" - checksum: 10c0/41e23642cbe545889245b9d2a45854ebba51cda6c778ebced9649420d9205f2efb39cb43dbc41e358409223b1ea43303ae4839db682c848b891e4811da1a5a71 + checksum: 10c0/67966499dd272ecde1c2e467084411132891523d057487587879d39ac04207f4351b7b2324c83198013967fbfa632c1612adc960114a30770fbe07a0773b32c2 languageName: node linkType: hard "ajv@npm:^8.11.0": - version: 8.17.1 - resolution: "ajv@npm:8.17.1" + version: 8.20.0 + resolution: "ajv@npm:8.20.0" dependencies: fast-deep-equal: "npm:^3.1.3" fast-uri: "npm:^3.0.1" json-schema-traverse: "npm:^1.0.0" require-from-string: "npm:^2.0.2" - checksum: 10c0/ec3ba10a573c6b60f94639ffc53526275917a2df6810e4ab5a6b959d87459f9ef3f00d5e7865b82677cb7d21590355b34da14d1d0b9c32d75f95a187e76fff35 + checksum: 10c0/5df9a1c8f83863cde1bd3a9ddb426f599718f88e3dc9153616c79fb28e0be455335830d7f21d745576519f057b371352daa31047b6a33d7036fe08777d60cf2a languageName: node linkType: hard @@ -4271,7 +4396,7 @@ __metadata: languageName: node linkType: hard -"ansi-regex@npm:^6.0.1": +"ansi-regex@npm:^6.2.2": version: 6.2.2 resolution: "ansi-regex@npm:6.2.2" checksum: 10c0/05d4acb1d2f59ab2cf4b794339c7b168890d44dda4bf0ce01152a8da0213aca207802f930442ce8cd22d7a92f44907664aac6508904e75e038fa944d2601b30f @@ -4321,9 +4446,9 @@ __metadata: linkType: hard "appdirsjs@npm:^1.2.4": - version: 1.2.7 - resolution: "appdirsjs@npm:1.2.7" - checksum: 10c0/79dd8d7a764cdde2b47efc4383e054814be917ba0cd661ee324bdf3fd11542834548316faea31344f96a7ebc898b5f89c11d1418f825a1d40c396bf1ecb0902b + version: 1.2.8 + resolution: "appdirsjs@npm:1.2.8" + checksum: 10c0/dc16a9aa5e9fd2fc8c7a0daaa7184b74c6e4e52afe9242ae73b683af16468d55eb9325b03926721c77307de668696a2e2e935253d107babe8daed96f822d849b languageName: node linkType: hard @@ -4343,23 +4468,23 @@ __metadata: languageName: node linkType: hard -"arkregex@npm:0.0.5": - version: 0.0.5 - resolution: "arkregex@npm:0.0.5" +"arkregex@npm:0.0.8": + version: 0.0.8 + resolution: "arkregex@npm:0.0.8" dependencies: - "@ark/util": "npm:0.56.0" - checksum: 10c0/1a39510e04d69b9287b9b53d3965afcc4ef27bdd9ff9c21a78092fcb841f35c11227d8476be66d2f76347deccfd10c202f395bd871383c328057ad004ffe7ebd + "@ark/util": "npm:0.56.2" + checksum: 10c0/ea1385599fded2e4153ce5cfb75f86e18f221b9c73ddd4071ffe3f63cfffcacd7a16748f1588de48658f7def2069e2a6b7235c3da7f1e11f12d1b05d2c892f9a languageName: node linkType: hard "arktype@npm:^2.1.15": - version: 2.1.29 - resolution: "arktype@npm:2.1.29" + version: 2.2.3 + resolution: "arktype@npm:2.2.3" dependencies: - "@ark/schema": "npm:0.56.0" - "@ark/util": "npm:0.56.0" - arkregex: "npm:0.0.5" - checksum: 10c0/c89cd5cc9eee7a5e14df0f32b228c06760b99440dabf2ed2d9272877a1607d7f27641d4105d1466b70fc620007fe864ddd826acee11c07102388c8dd301a20fe + "@ark/schema": "npm:0.56.2" + "@ark/util": "npm:0.56.2" + arkregex: "npm:0.0.8" + checksum: 10c0/01d6cd9f1c84807772623ad8df5825df9646de1aca4b17869604d523942c92c297b654c930f405338065e18ab52691e00da3e7e2b581039e4aded62d1a9c9e0f languageName: node linkType: hard @@ -4574,15 +4699,15 @@ __metadata: linkType: hard "babel-plugin-polyfill-corejs2@npm:^0.4.14": - version: 0.4.14 - resolution: "babel-plugin-polyfill-corejs2@npm:0.4.14" + version: 0.4.17 + resolution: "babel-plugin-polyfill-corejs2@npm:0.4.17" dependencies: - "@babel/compat-data": "npm:^7.27.7" - "@babel/helper-define-polyfill-provider": "npm:^0.6.5" + "@babel/compat-data": "npm:^7.28.6" + "@babel/helper-define-polyfill-provider": "npm:^0.6.8" semver: "npm:^6.3.1" peerDependencies: "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 - checksum: 10c0/d74cba0600a6508e86d220bde7164eb528755d91be58020e5ea92ea7fbb12c9d8d2c29246525485adfe7f68ae02618ec428f9a589cac6cbedf53cc3972ad7fbe + checksum: 10c0/1284960ea403c63b0dd598f338666c4b17d489aefee30b4da6a7313eff1d91edffb0ccf26341a6e5d94231684b74e016eade66b3921ea112f8b0e4980fa08a5c languageName: node linkType: hard @@ -4599,13 +4724,13 @@ __metadata: linkType: hard "babel-plugin-polyfill-regenerator@npm:^0.6.5": - version: 0.6.5 - resolution: "babel-plugin-polyfill-regenerator@npm:0.6.5" + version: 0.6.8 + resolution: "babel-plugin-polyfill-regenerator@npm:0.6.8" dependencies: - "@babel/helper-define-polyfill-provider": "npm:^0.6.5" + "@babel/helper-define-polyfill-provider": "npm:^0.6.8" peerDependencies: "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 - checksum: 10c0/63aa8ed716df6a9277c6ab42b887858fa9f57a70cc1d0ae2b91bdf081e45d4502848cba306fb60b02f59f99b32fd02ff4753b373cac48ccdac9b7d19dd56f06d + checksum: 10c0/7c8b2497c29fa880e0acdc8e7b93e29b81b154179b83beb0476eb2c4e7a78b6b42fc35c2554ca250c9bd6d39941eaf75416254b8592ce50979f9a12e1d51c049 languageName: node linkType: hard @@ -4694,19 +4819,19 @@ __metadata: languageName: node linkType: hard -"baseline-browser-mapping@npm:^2.9.0": - version: 2.9.11 - resolution: "baseline-browser-mapping@npm:2.9.11" +"baseline-browser-mapping@npm:^2.10.44": + version: 2.11.10 + resolution: "baseline-browser-mapping@npm:2.11.10" bin: - baseline-browser-mapping: dist/cli.js - checksum: 10c0/eba49fcc1b33ab994aeeb73a4848f2670e06a0886dd5b903689ae6f60d47e7f1bea9262dbb2548c48179e858f7eda2b82ddf941ae783b862f4dcc51085a246f2 + baseline-browser-mapping: dist/cli.cjs + checksum: 10c0/6e46bf9e1e46d96d909b4f754968603a291dea22fbb051cf86aa73b53f3a4c8ba922bdc1d6b617f5147403b289746e8549e344affcee7a1be87a09020cd73ce1 languageName: node linkType: hard "basic-ftp@npm:^5.0.2": - version: 5.1.0 - resolution: "basic-ftp@npm:5.1.0" - checksum: 10c0/397d5ed490f4d3b8b2dcd7afdf8e9fcf714a7d1c394a6c66b31704baf49c9fc250f1742f6189136a76b983675edf3d986b7ed93d253dc6477e65a567cf1e04c0 + version: 5.3.1 + resolution: "basic-ftp@npm:5.3.1" + checksum: 10c0/03511b488cd292abfa82a8c0ea3b9573b40d12d2f1518d6f41a9461b012b3376d3e6d50679b38d9b2b4f48fd6e8e0418ac196312ee7e2da13cb801169940d1c3 languageName: node linkType: hard @@ -4736,8 +4861,8 @@ __metadata: linkType: hard "body-parser@npm:^1.20.3": - version: 1.20.4 - resolution: "body-parser@npm:1.20.4" + version: 1.20.6 + resolution: "body-parser@npm:1.20.6" dependencies: bytes: "npm:~3.1.2" content-type: "npm:~1.0.5" @@ -4747,11 +4872,11 @@ __metadata: http-errors: "npm:~2.0.1" iconv-lite: "npm:~0.4.24" on-finished: "npm:~2.4.1" - qs: "npm:~6.14.0" + qs: "npm:~6.15.1" raw-body: "npm:~2.5.3" type-is: "npm:~1.6.18" unpipe: "npm:~1.0.0" - checksum: 10c0/569c1e896297d1fcd8f34026c8d0ab70b90d45343c15c5d8dff5de2bad08125fc1e2f8c2f3f4c1ac6c0caaad115218202594d37dcb8d89d9b5dcae1c2b736aa9 + checksum: 10c0/ad477209f1e714c41fa892a7d2fe22e10b23262103cc25cc6492dd3e6f7869cd2d8b00928b543a1a14d3c3663432452a192efd00422fad6f3687b0e38f7e3b07 languageName: node linkType: hard @@ -4781,30 +4906,30 @@ __metadata: linkType: hard "brace-expansion@npm:^1.1.7": - version: 1.1.12 - resolution: "brace-expansion@npm:1.1.12" + version: 1.1.18 + resolution: "brace-expansion@npm:1.1.18" dependencies: balanced-match: "npm:^1.0.0" concat-map: "npm:0.0.1" - checksum: 10c0/975fecac2bb7758c062c20d0b3b6288c7cc895219ee25f0a64a9de662dbac981ff0b6e89909c3897c1f84fa353113a721923afdec5f8b2350255b097f12b1f73 + checksum: 10c0/3432c18a9e2ebf94162d4effb62198bd0adea06a9f332b2c0188df5d5e30b1e51ea3c848b6608e47d0b857ebe1ea5b3888ed3326dd3c4f6f9645c94153cf9c14 languageName: node linkType: hard -"brace-expansion@npm:^2.0.1": - version: 2.0.2 - resolution: "brace-expansion@npm:2.0.2" +"brace-expansion@npm:^2.0.2": + version: 2.1.4 + resolution: "brace-expansion@npm:2.1.4" dependencies: balanced-match: "npm:^1.0.0" - checksum: 10c0/6d117a4c793488af86b83172deb6af143e94c17bc53b0b3cec259733923b4ca84679d506ac261f4ba3c7ed37c46018e2ff442f9ce453af8643ecd64f4a54e6cf + checksum: 10c0/6c0a0e2573eac1dc565b52b1e1bfbeba39bf1830d106ebbc61ff1eaefcf610e9111cd3baa091addd18e33292135c99e019d3184d966389d85dc958fdcdc1449f languageName: node linkType: hard -"brace-expansion@npm:^5.0.5": - version: 5.0.7 - resolution: "brace-expansion@npm:5.0.7" +"brace-expansion@npm:^5.0.8": + version: 5.0.9 + resolution: "brace-expansion@npm:5.0.9" dependencies: balanced-match: "npm:^4.0.2" - checksum: 10c0/4769109c3c082de178e449a371bcad50d51ab468f644bce2dd9188efe0cf0a080ed102105d7fc8577382cedc45bad7e6443a91bf3d8102264ee8cf927dbaf205 + checksum: 10c0/3dea38884a1c3c8b1c9c44a7402a0c76fca460f70cffb3127242b0b4cbf4472019e022ade021eec44838ff19f1dac2625dfd11dd459d7e1e055b0698a8d52fec languageName: node linkType: hard @@ -4817,18 +4942,18 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:^4.20.4, browserslist@npm:^4.24.0, browserslist@npm:^4.28.0": - version: 4.28.1 - resolution: "browserslist@npm:4.28.1" +"browserslist@npm:^4.20.4, browserslist@npm:^4.24.0, browserslist@npm:^4.28.1": + version: 4.28.7 + resolution: "browserslist@npm:4.28.7" dependencies: - baseline-browser-mapping: "npm:^2.9.0" - caniuse-lite: "npm:^1.0.30001759" - electron-to-chromium: "npm:^1.5.263" - node-releases: "npm:^2.0.27" - update-browserslist-db: "npm:^1.2.0" + baseline-browser-mapping: "npm:^2.10.44" + caniuse-lite: "npm:^1.0.30001806" + electron-to-chromium: "npm:^1.5.393" + node-releases: "npm:^2.0.51" + update-browserslist-db: "npm:^1.2.3" bin: browserslist: cli.js - checksum: 10c0/545a5fa9d7234e3777a7177ec1e9134bb2ba60a69e6b95683f6982b1473aad347c77c1264ccf2ac5dea609a9731fbfbda6b85782bdca70f80f86e28a402504bd + checksum: 10c0/dc41922a9ff0d81e5492498bdab2d932e3a3222f4277814ba38ee64f4e51f26e5244a7cce0777b4cac3ceff6eb196f5cadbb2a832620973a7f9c39611f6bc78e languageName: node linkType: hard @@ -4899,26 +5024,7 @@ __metadata: languageName: node linkType: hard -"cacache@npm:^20.0.1": - version: 20.0.3 - resolution: "cacache@npm:20.0.3" - dependencies: - "@npmcli/fs": "npm:^5.0.0" - fs-minipass: "npm:^3.0.0" - glob: "npm:^13.0.0" - lru-cache: "npm:^11.1.0" - minipass: "npm:^7.0.3" - minipass-collect: "npm:^2.0.1" - minipass-flush: "npm:^1.0.5" - minipass-pipeline: "npm:^1.2.4" - p-map: "npm:^7.0.2" - ssri: "npm:^13.0.0" - unique-filename: "npm:^5.0.0" - checksum: 10c0/c7da1ca694d20e8f8aedabd21dc11518f809a7d2b59aa76a1fc655db5a9e62379e465c157ddd2afe34b19230808882288effa6911b2de26a088a6d5645123462 - languageName: node - linkType: hard - -"call-bind-apply-helpers@npm:^1.0.0, call-bind-apply-helpers@npm:^1.0.1, call-bind-apply-helpers@npm:^1.0.2": +"call-bind-apply-helpers@npm:^1.0.1, call-bind-apply-helpers@npm:^1.0.2": version: 1.0.2 resolution: "call-bind-apply-helpers@npm:1.0.2" dependencies: @@ -4928,15 +5034,15 @@ __metadata: languageName: node linkType: hard -"call-bind@npm:^1.0.7, call-bind@npm:^1.0.8": - version: 1.0.8 - resolution: "call-bind@npm:1.0.8" +"call-bind@npm:^1.0.7, call-bind@npm:^1.0.8, call-bind@npm:^1.0.9": + version: 1.0.9 + resolution: "call-bind@npm:1.0.9" dependencies: - call-bind-apply-helpers: "npm:^1.0.0" - es-define-property: "npm:^1.0.0" - get-intrinsic: "npm:^1.2.4" + call-bind-apply-helpers: "npm:^1.0.2" + es-define-property: "npm:^1.0.1" + get-intrinsic: "npm:^1.3.0" set-function-length: "npm:^1.2.2" - checksum: 10c0/a13819be0681d915144467741b69875ae5f4eba8961eb0bf322aab63ec87f8250eb6d6b0dcbb2e1349876412a56129ca338592b3829ef4343527f5f18a0752d4 + checksum: 10c0/a6621f6da1444481919ce3b4983dff725691e0754d3507ae483ce56e54985f2da7d6f1df512c56dbf28660745cf1ca52553f1fc9aef5557f3ce353ef14fab714 languageName: node linkType: hard @@ -4971,10 +5077,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001759": - version: 1.0.30001762 - resolution: "caniuse-lite@npm:1.0.30001762" - checksum: 10c0/93707eac5b0240af3f2ce6e2d7ab504a6fefcf9c2f9cd8fb9d488e496a333c61e557dab0472c1b00c17bc386a5dbb792aa4c778cda2d768e17f986617d7aec53 +"caniuse-lite@npm:^1.0.30001806": + version: 1.0.30001806 + resolution: "caniuse-lite@npm:1.0.30001806" + checksum: 10c0/9442c8afff0968e9b2ce0104a7340c1ce4a5c09f469ccb9eef10d25712ea0afe542486e5318c697c70dd502f988cfc04eaa1c9438c92ac3bcf4d708a2a17bee1 languageName: node linkType: hard @@ -5003,9 +5109,9 @@ __metadata: linkType: hard "chardet@npm:^2.1.1": - version: 2.1.1 - resolution: "chardet@npm:2.1.1" - checksum: 10c0/d8391dd412338442b3de0d3a488aa9327f8bcf74b62b8723d6bd0b85c4084d50b731320e0a7c710edb1d44de75969995d2784b80e4c13b004a6c7a0db4c6e793 + version: 2.2.0 + resolution: "chardet@npm:2.2.0" + checksum: 10c0/8d43a1dd3ce535aa070d04139fae62f879b4388394eb1d857364ce416675a1f0f63974fba8208e9cd11b49e1a6da3e65ea6393d0fc654a8c4217c0d74c16b1b4 languageName: node linkType: hard @@ -5067,9 +5173,9 @@ __metadata: linkType: hard "ci-info@npm:^4.3.1": - version: 4.3.1 - resolution: "ci-info@npm:4.3.1" - checksum: 10c0/7dd82000f514d76ddfe7775e4cb0d66e5c638f5fa0e2a3be29557e898da0d32ac04f231217d414d07fb968b1fbc6d980ee17ddde0d2c516f23da9cfff608f6c1 + version: 4.4.0 + resolution: "ci-info@npm:4.4.0" + checksum: 10c0/44156201545b8dde01aa8a09ee2fe9fc7a73b1bef9adbd4606c9f61c8caeeb73fb7a575c88b0443f7b4edb5ee45debaa59ed54ba5f99698339393ca01349eb3a languageName: node linkType: hard @@ -5082,6 +5188,13 @@ __metadata: languageName: node linkType: hard +"citty@npm:^0.2.2": + version: 0.2.2 + resolution: "citty@npm:0.2.2" + checksum: 10c0/c896c9dcd187d2a16685706d11428dcdec9eb59aa13fe50aff7b12e1d3521f1bf434d6a5316fe75a341f8ba5ce1d2beceb84f7f261d018985a73d3f6f2a793e3 + languageName: node + linkType: hard + "cjs-module-lexer@npm:^1.0.0": version: 1.4.3 resolution: "cjs-module-lexer@npm:1.4.3" @@ -5122,9 +5235,9 @@ __metadata: linkType: hard "cli-spinners@npm:^3.2.0": - version: 3.3.0 - resolution: "cli-spinners@npm:3.3.0" - checksum: 10c0/ce7278be322655e564df4383a2d79ad2c357b43e5771428f33ca69334fde6881d050652ee19854e9ab177867850c9365c2090fdb9fae145b23ceee21bdc77b7e + version: 3.4.0 + resolution: "cli-spinners@npm:3.4.0" + checksum: 10c0/91296c32e147d5b973c9d439d1512306499215437b92f0c0d8be44ec850b555acb8795c19c606b2f6747f31d50c4e41fdde7dcef653f18f0ae7cdd58e99a4764 languageName: node linkType: hard @@ -5348,10 +5461,10 @@ __metadata: languageName: node linkType: hard -"confbox@npm:^0.2.2": - version: 0.2.2 - resolution: "confbox@npm:0.2.2" - checksum: 10c0/7c246588d533d31e8cdf66cb4701dff6de60f9be77ab54c0d0338e7988750ac56863cc0aca1b3f2046f45ff223a765d3e5d4977a7674485afcd37b6edf3fd129 +"confbox@npm:^0.2.2, confbox@npm:^0.2.4": + version: 0.2.4 + resolution: "confbox@npm:0.2.4" + checksum: 10c0/4c36af33d9df7034300c452f7b289179264493bd0671fa81b995a0d70dc897b1d37f1af10d3ffb187f178d17ba1ed2ba167ed0f599ba3a139c271205dd553f73 languageName: node linkType: hard @@ -5367,7 +5480,7 @@ __metadata: languageName: node linkType: hard -"consola@npm:^3.2.3, consola@npm:^3.4.0, consola@npm:^3.4.2": +"consola@npm:^3.2.3, consola@npm:^3.4.0": version: 3.4.2 resolution: "consola@npm:3.4.2" checksum: 10c0/7cebe57ecf646ba74b300bcce23bff43034ed6fbec9f7e39c27cee1dc00df8a21cd336b466ad32e304ea70fba04ec9e890c200270de9a526ce021ba8a7e4c11a @@ -5391,11 +5504,11 @@ __metadata: linkType: hard "conventional-changelog-angular@npm:^8.1.0": - version: 8.1.0 - resolution: "conventional-changelog-angular@npm:8.1.0" + version: 8.3.1 + resolution: "conventional-changelog-angular@npm:8.3.1" dependencies: compare-func: "npm:^2.0.0" - checksum: 10c0/b82aab869117fd9bd6ccfa960521e7638d3c2a3599c95fd5ba30d3b3fe972b5f819af4d57229f2973a7129ea18546cdf5822004565cab1ee35355cc90ac4588f + checksum: 10c0/a3776ff7066004040d7d25d2b72fe8f9fee4f1fc5dc6c929ab281899b8c7a6dd6408130064344515b37a4f91d2a9fb90b69cce0bab55415c72a8ba3ee801c2b6 languageName: node linkType: hard @@ -5409,11 +5522,11 @@ __metadata: linkType: hard "conventional-changelog-conventionalcommits@npm:^9.1.0": - version: 9.1.0 - resolution: "conventional-changelog-conventionalcommits@npm:9.1.0" + version: 9.3.1 + resolution: "conventional-changelog-conventionalcommits@npm:9.3.1" dependencies: compare-func: "npm:^2.0.0" - checksum: 10c0/b1dfbb8ce5983bb80837c35f089fb0f9603a1b067f34be680f88fde20871792e461e29d119d468bc293f38a1ca916c1c40a841f8c049a0a1efaa40582f4fecc9 + checksum: 10c0/e3d0dfe5680899da3660a7fbc859de1a92dd9358dc497624c3582596173713a80dcc8236d844116a3ba8403350e244c007c0c7fa5796631aea19e464cc6c2f44 languageName: node linkType: hard @@ -5424,35 +5537,37 @@ __metadata: languageName: node linkType: hard -"conventional-changelog-writer@npm:^8.2.0": - version: 8.2.0 - resolution: "conventional-changelog-writer@npm:8.2.0" +"conventional-changelog-writer@npm:^8.4.0": + version: 8.4.0 + resolution: "conventional-changelog-writer@npm:8.4.0" dependencies: + "@simple-libs/stream-utils": "npm:^1.2.0" conventional-commits-filter: "npm:^5.0.0" handlebars: "npm:^4.7.7" meow: "npm:^13.0.0" semver: "npm:^7.5.2" bin: conventional-changelog-writer: dist/cli/index.js - checksum: 10c0/e25052bb366ecee6389326fd5b7d3ecbd6f6a65439f45b5a2b1d4096baeb1bbfa93cd6bea686f419423265db5bbb02870a014cb92f43f972c00191c60711e9b6 + checksum: 10c0/d657bf74c470e5d515d3a07814d266e6e2aea018e6867bfefa4bc486bb3f948b47b01936d65e46b3090111823364c21c201f9fbe875b1fc805cdf884bb032bc1 languageName: node linkType: hard "conventional-changelog@npm:^7.1.1": - version: 7.1.1 - resolution: "conventional-changelog@npm:7.1.1" + version: 7.2.1 + resolution: "conventional-changelog@npm:7.2.1" dependencies: - "@conventional-changelog/git-client": "npm:^2.5.1" + "@conventional-changelog/git-client": "npm:^2.7.0" + "@simple-libs/hosted-git-info": "npm:^1.0.2" "@types/normalize-package-data": "npm:^2.4.4" conventional-changelog-preset-loader: "npm:^5.0.0" - conventional-changelog-writer: "npm:^8.2.0" - conventional-commits-parser: "npm:^6.2.0" + conventional-changelog-writer: "npm:^8.4.0" + conventional-commits-parser: "npm:^6.4.0" fd-package-json: "npm:^2.0.0" meow: "npm:^13.0.0" normalize-package-data: "npm:^7.0.0" bin: conventional-changelog: dist/cli/index.js - checksum: 10c0/8f2c36b7a463bdedc9f919a50458a061b8017d003452b5bc648a6c43a0affe2e76ed9cb5933aa55ad4d6c99061c0b9a567ec5c528333593ec0f210151e1e11b7 + checksum: 10c0/10e0c7b1904c8f557099485b21fdf2cd3359b67a9e917be4cae0636b9f111520c76208949823082747486b4ab4db6602f724f57878c28257bbd0012590fb9fe9 languageName: node linkType: hard @@ -5477,14 +5592,15 @@ __metadata: languageName: node linkType: hard -"conventional-commits-parser@npm:^6.1.0, conventional-commits-parser@npm:^6.2.0": - version: 6.2.1 - resolution: "conventional-commits-parser@npm:6.2.1" +"conventional-commits-parser@npm:^6.1.0, conventional-commits-parser@npm:^6.4.0": + version: 6.4.0 + resolution: "conventional-commits-parser@npm:6.4.0" dependencies: + "@simple-libs/stream-utils": "npm:^1.2.0" meow: "npm:^13.0.0" bin: conventional-commits-parser: dist/cli/index.js - checksum: 10c0/217b3fff627802f7fd7cb09bdfe897aa76986865543dfaa99b7957e4717d039e1e12c4a9b72706f098a5716bbbbdae540ef0b2429f7219d5fc5be0f190f1bc1e + checksum: 10c0/3595b85b420a3f431dbad65f7c367e803ee8bca500ec24482e8669d4ed5ff6febbb5e9a17c52f07ebe882abdee3418e759245bcb06e4d1e2cce09d638f31d5ce languageName: node linkType: hard @@ -5511,30 +5627,30 @@ __metadata: linkType: hard "core-js-compat@npm:^3.43.0": - version: 3.47.0 - resolution: "core-js-compat@npm:3.47.0" + version: 3.49.0 + resolution: "core-js-compat@npm:3.49.0" dependencies: - browserslist: "npm:^4.28.0" - checksum: 10c0/71da415899633120db7638dd7b250eee56031f63c4560dcba8eeeafd1168fae171d59b223e3fd2e0aa543a490d64bac7d946764721e2c05897056fdfb22cce33 + browserslist: "npm:^4.28.1" + checksum: 10c0/546e64b7ce45f724825bc13c1347f35c0459a6e71c0dcccff3ec21fbff463f5b0b97fc1220e6d90302153863489301793276fe2bf96f46001ff555ead4140308 languageName: node linkType: hard "cosmiconfig-typescript-loader@npm:^6.1.0": - version: 6.2.0 - resolution: "cosmiconfig-typescript-loader@npm:6.2.0" + version: 6.3.0 + resolution: "cosmiconfig-typescript-loader@npm:6.3.0" dependencies: - jiti: "npm:^2.6.1" + jiti: "npm:2.6.1" peerDependencies: "@types/node": "*" cosmiconfig: ">=9" typescript: ">=5" - checksum: 10c0/0fd8fd9b9b6a04eec75617b965ce0a1f63310fe29a361c1f95cb971e05dbbb935291899c2b15abfd69e09db58dbe97077f24a7c61414bbc6c3e78349b4314ad7 + checksum: 10c0/dd53519bf59b31c32a831f1140eaa44f4f0bf49229b7e3ba27bb6f26097c3ecff955a490e70b31349049463066b5047bd129ab82ed078be9b1f1f22ccb776c6a languageName: node linkType: hard "cosmiconfig@npm:^9.0.0": - version: 9.0.0 - resolution: "cosmiconfig@npm:9.0.0" + version: 9.0.2 + resolution: "cosmiconfig@npm:9.0.2" dependencies: env-paths: "npm:^2.2.1" import-fresh: "npm:^3.3.0" @@ -5545,7 +5661,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/1c1703be4f02a250b1d6ca3267e408ce16abfe8364193891afc94c2d5c060b69611fdc8d97af74b7e6d5d1aac0ab2fb94d6b079573146bc2d756c2484ce5f0ee + checksum: 10c0/132d32863c0b3d9ace7010a10011e09089532b36e3b11e02004d671dcbd8b8f2f16293b82d510d9c15890f30358baf8722127c7b1c011449c90b6a178f9c6594 languageName: node linkType: hard @@ -5662,9 +5778,9 @@ __metadata: linkType: hard "dayjs@npm:^1.8.15": - version: 1.11.19 - resolution: "dayjs@npm:1.11.19" - checksum: 10c0/7d8a6074a343f821f81ea284d700bd34ea6c7abbe8d93bce7aba818948957c1b7f56131702e5e890a5622cdfc05dcebe8aed0b8313bdc6838a594d7846b0b000 + version: 1.11.21 + resolution: "dayjs@npm:1.11.21" + checksum: 10c0/bd97dfdc4bfea3c66268635690313828b386faa040fbc1f829ff42a2bd748b72c9d9b3c8f9616ce9e61fcb78923f1461a462c969c54b1084458ae1b715898fb0 languageName: node linkType: hard @@ -5711,14 +5827,14 @@ __metadata: linkType: hard "dedent@npm:^1.0.0": - version: 1.7.1 - resolution: "dedent@npm:1.7.1" + version: 1.7.2 + resolution: "dedent@npm:1.7.2" peerDependencies: babel-plugin-macros: ^3.1.0 peerDependenciesMeta: babel-plugin-macros: optional: true - checksum: 10c0/ae29ec1c5bd5216c698c9f23acaa5b720260fd4cef3c8b5af887eb5f8c9e6fdd5fed8668767437b4efea35e2991bd798987717633411a1734807c28255769b78 + checksum: 10c0/acaff07cac355b93f17b1b17ebbb84d3cc55af6ab4b7814c3f505e061903e168bc6bf9ddce331552d64dee1525f0b4c549c9ade46aebfac6f69caaed74e90751 languageName: node linkType: hard @@ -5744,12 +5860,12 @@ __metadata: linkType: hard "default-browser@npm:^5.2.1": - version: 5.4.0 - resolution: "default-browser@npm:5.4.0" + version: 5.5.0 + resolution: "default-browser@npm:5.5.0" dependencies: bundle-name: "npm:^4.1.0" default-browser-id: "npm:^5.0.0" - checksum: 10c0/a49ddd0c7b1a319163f64a5fc68ebb45a98548ea23a3155e04518f026173d85cfa2f451b646366c36c8f70b01e4cb773e23d1d22d2c61d8b84e5fbf151b4b609 + checksum: 10c0/576593b617b17a7223014b4571bfe1c06a2581a4eb8b130985d90d253afa3f40999caec70eb0e5776e80d4af6a41cce91018cd3f86e57ad578bf59e46fb19abe languageName: node linkType: hard @@ -5792,9 +5908,9 @@ __metadata: linkType: hard "defu@npm:^6.1.4": - version: 6.1.4 - resolution: "defu@npm:6.1.4" - checksum: 10c0/2d6cc366262dc0cb8096e429368e44052fdf43ed48e53ad84cc7c9407f890301aa5fcb80d0995abaaf842b3949f154d060be4160f7a46cb2bc2f7726c81526f5 + version: 6.1.7 + resolution: "defu@npm:6.1.7" + checksum: 10c0/e6635388103c8be3c574ac31302f6930e5e6eeedba32cb1b30cf993c7d9fb571aec2485446dfa23bfa63e55e66156fe109027a9695db82a50f931e91e8d4bedb languageName: node linkType: hard @@ -5954,9 +6070,9 @@ __metadata: linkType: hard "dotenv@npm:^17.2.3": - version: 17.2.3 - resolution: "dotenv@npm:17.2.3" - checksum: 10c0/c884403209f713214a1b64d4d1defa4934c2aa5b0002f5a670ae298a51e3c3ad3ba79dfee2f8df49f01ae74290fcd9acdb1ab1d09c7bfb42b539036108bb2ba0 + version: 17.4.2 + resolution: "dotenv@npm:17.4.2" + checksum: 10c0/164f8e77a646c8446867d5b588d26ea6005c8ea7c5eb41cf926f6113d23f2191355f6e0cfd95ea9bab98394a5b0a3f1e51a8399711b666fe55cc7b0bd745f942 languageName: node linkType: hard @@ -5985,10 +6101,10 @@ __metadata: languageName: node linkType: hard -"electron-to-chromium@npm:^1.5.263": - version: 1.5.267 - resolution: "electron-to-chromium@npm:1.5.267" - checksum: 10c0/0732bdb891b657f2e43266a3db8cf86fff6cecdcc8d693a92beff214e136cb5c2ee7dc5945ed75fa1db16e16bad0c38695527a020d15f39e79084e0b2e447621 +"electron-to-chromium@npm:^1.5.393": + version: 1.5.399 + resolution: "electron-to-chromium@npm:1.5.399" + checksum: 10c0/5b2ab966e0748d00a2bc2dfd7eee203fe872ce2ca4478eea94f1ceda629172770378128cd6d20be4af8c21874ef250163cd47735e01f38f1182f4312d8c7e78b languageName: node linkType: hard @@ -6034,15 +6150,6 @@ __metadata: languageName: node linkType: hard -"encoding@npm:^0.1.13": - version: 0.1.13 - resolution: "encoding@npm:0.1.13" - dependencies: - iconv-lite: "npm:^0.6.2" - checksum: 10c0/36d938712ff00fe1f4bac88b43bcffb5930c1efa57bbcdca9d67e1d9d6c57cfb1200fb01efe0f3109b2ce99b231f90779532814a81370a1bd3274a0f58585039 - languageName: node - linkType: hard - "end-of-stream@npm:^1.1.0": version: 1.4.5 resolution: "end-of-stream@npm:1.4.5" @@ -6075,13 +6182,6 @@ __metadata: languageName: node linkType: hard -"err-code@npm:^2.0.2": - version: 2.0.3 - resolution: "err-code@npm:2.0.3" - checksum: 10c0/b642f7b4dd4a376e954947550a3065a9ece6733ab8e51ad80db727aaae0817c2e99b02a97a3d6cecc648a97848305e728289cf312d09af395403a90c9d4d8a66 - languageName: node - linkType: hard - "error-ex@npm:^1.3.1": version: 1.3.4 resolution: "error-ex@npm:1.3.4" @@ -6110,9 +6210,21 @@ __metadata: languageName: node linkType: hard -"es-abstract@npm:^1.17.5, es-abstract@npm:^1.23.2, es-abstract@npm:^1.23.3, es-abstract@npm:^1.23.5, es-abstract@npm:^1.23.6, es-abstract@npm:^1.23.9, es-abstract@npm:^1.24.0, es-abstract@npm:^1.24.1": - version: 1.24.1 - resolution: "es-abstract@npm:1.24.1" +"es-abstract-get@npm:^1.0.0": + version: 1.0.0 + resolution: "es-abstract-get@npm:1.0.0" + dependencies: + es-errors: "npm:^1.3.0" + es-object-atoms: "npm:^1.1.2" + is-callable: "npm:^1.2.7" + object-inspect: "npm:^1.13.4" + checksum: 10c0/f9b4838ae719752207383a6d95a74590f891122bf26b92f5e72eeedbe53771029e4561f1cf75ea19330b71bcf3d4f536fb0c8f7e2b601fe24d284f46e488c7e3 + languageName: node + linkType: hard + +"es-abstract@npm:^1.17.5, es-abstract@npm:^1.23.2, es-abstract@npm:^1.23.3, es-abstract@npm:^1.23.5, es-abstract@npm:^1.23.6, es-abstract@npm:^1.23.9, es-abstract@npm:^1.24.0, es-abstract@npm:^1.24.2": + version: 1.24.2 + resolution: "es-abstract@npm:1.24.2" dependencies: array-buffer-byte-length: "npm:^1.0.2" arraybuffer.prototype.slice: "npm:^1.0.4" @@ -6168,7 +6280,7 @@ __metadata: typed-array-length: "npm:^1.0.7" unbox-primitive: "npm:^1.1.0" which-typed-array: "npm:^1.1.19" - checksum: 10c0/fca062ef8b5daacf743732167d319a212d45cb655b0bb540821d38d715416ae15b04b84fc86da9e2c89135aa7b337337b6c867f84dcde698d75d55688d5d765c + checksum: 10c0/67a5bf21ef5c7d775e6f6131a836323900b4d87194cf544394ac68fe31c57fa53828b978af4a4f551ef307f83a2f910a16b6b982760ad3ddc3dc471f98d5fd1b languageName: node linkType: hard @@ -6187,13 +6299,13 @@ __metadata: linkType: hard "es-iterator-helpers@npm:^1.2.1": - version: 1.2.2 - resolution: "es-iterator-helpers@npm:1.2.2" + version: 1.4.0 + resolution: "es-iterator-helpers@npm:1.4.0" dependencies: - call-bind: "npm:^1.0.8" + call-bind: "npm:^1.0.9" call-bound: "npm:^1.0.4" define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.24.1" + es-abstract: "npm:^1.24.2" es-errors: "npm:^1.3.0" es-set-tostringtag: "npm:^2.1.0" function-bind: "npm:^1.1.2" @@ -6205,17 +6317,17 @@ __metadata: has-symbols: "npm:^1.1.0" internal-slot: "npm:^1.1.0" iterator.prototype: "npm:^1.1.5" - safe-array-concat: "npm:^1.1.3" - checksum: 10c0/1ced8abf845a45e660dd77b5f3a64358421df70e4a0bd1897d5ddfefffed8409a6a2ca21241b9367e639df9eca74abc1c678b3020bffe6bee1f1826393658ddb + math-intrinsics: "npm:^1.1.0" + checksum: 10c0/839a5e881446e1b4ab270a9ad5d01a23b83a38fadb9e526674df171357e90ad3111dc8c0b15e7d30db1958f2c3332dd963fab7d55f406a660d098b2b7eefb218 languageName: node linkType: hard -"es-object-atoms@npm:^1.0.0, es-object-atoms@npm:^1.1.1": - version: 1.1.1 - resolution: "es-object-atoms@npm:1.1.1" +"es-object-atoms@npm:^1.0.0, es-object-atoms@npm:^1.1.1, es-object-atoms@npm:^1.1.2": + version: 1.1.2 + resolution: "es-object-atoms@npm:1.1.2" dependencies: es-errors: "npm:^1.3.0" - checksum: 10c0/65364812ca4daf48eb76e2a3b7a89b3f6a2e62a1c420766ce9f692665a29d94fe41fe88b65f24106f449859549711e4b40d9fb8002d862dfd7eb1c512d10be0c + checksum: 10c0/1772861f094f739d6f41b579cfb9a18579daffeb434552a370a5fbef50a32d22227e27b63fdbb757b7ddd429d1b42fe52ccae7966d9302a2ec221b6f1b41bbc4 languageName: node linkType: hard @@ -6241,13 +6353,16 @@ __metadata: linkType: hard "es-to-primitive@npm:^1.3.0": - version: 1.3.0 - resolution: "es-to-primitive@npm:1.3.0" + version: 1.3.4 + resolution: "es-to-primitive@npm:1.3.4" dependencies: + es-abstract-get: "npm:^1.0.0" + es-define-property: "npm:^1.0.1" + es-errors: "npm:^1.3.0" is-callable: "npm:^1.2.7" - is-date-object: "npm:^1.0.5" - is-symbol: "npm:^1.0.4" - checksum: 10c0/c7e87467abb0b438639baa8139f701a06537d2b9bc758f23e8622c3b42fd0fdb5bde0f535686119e446dd9d5e4c0f238af4e14960f4771877cf818d023f6730b + is-date-object: "npm:^1.1.0" + is-symbol: "npm:^1.1.1" + checksum: 10c0/b10029f8b0b13841bade224ff39005a13d76d9cb803cd1efb18cc96a24414e83e2e7ed15d7ad9d0d0bda66884afd211b7b579b8fa31940e05b060934aa7077d8 languageName: node linkType: hard @@ -6359,15 +6474,15 @@ __metadata: linkType: hard "eslint-plugin-jest@npm:^29.0.1": - version: 29.15.4 - resolution: "eslint-plugin-jest@npm:29.15.4" + version: 29.16.0 + resolution: "eslint-plugin-jest@npm:29.16.0" dependencies: "@typescript-eslint/utils": "npm:^8.0.0" peerDependencies: "@typescript-eslint/eslint-plugin": ^8.0.0 eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 jest: "*" - typescript: ">=4.8.4 <7.0.0" + typescript: ">=4.8.4 <8.0.0" peerDependenciesMeta: "@typescript-eslint/eslint-plugin": optional: true @@ -6375,16 +6490,16 @@ __metadata: optional: true typescript: optional: true - checksum: 10c0/4a32cd29cb67b54e5fb5f4acbc749e79c024f50099825e91c93d1d9674caf5b4bfe4810c7931e01d6b30e77cbf72d7619db785a12f459f2b23f5885d39cb1033 + checksum: 10c0/ac3b0b0502c48285063a968219852979b0526f814bee90c65ef417e495b270a5aee437961ab51941caa1d0ae4ae5387a55374946165c17cf5e4f001972e0de44 languageName: node linkType: hard "eslint-plugin-prettier@npm:^5.5.4": - version: 5.5.4 - resolution: "eslint-plugin-prettier@npm:5.5.4" + version: 5.5.6 + resolution: "eslint-plugin-prettier@npm:5.5.6" dependencies: - prettier-linter-helpers: "npm:^1.0.0" - synckit: "npm:^0.11.7" + prettier-linter-helpers: "npm:^1.0.1" + synckit: "npm:^0.11.13" peerDependencies: "@types/eslint": ">=8.0.0" eslint: ">=8.0.0" @@ -6395,7 +6510,7 @@ __metadata: optional: true eslint-config-prettier: optional: true - checksum: 10c0/5cc780e0ab002f838ad8057409e86de4ff8281aa2704a50fa8511abff87028060c2e45741bc9cbcbd498712e8d189de8026e70aed9e20e50fe5ba534ee5a8442 + checksum: 10c0/af37126c947ff3e87ff1ea76408db8cb1c7da966ebdaba68c6dd5924da7eb1b43b1abc4796d753a97b1bc26ea94c5497093e6ab9f8588fffe558d5a554e19bbf languageName: node linkType: hard @@ -6509,22 +6624,22 @@ __metadata: linkType: hard "eslint@npm:^9.35.0": - version: 9.39.2 - resolution: "eslint@npm:9.39.2" + version: 9.39.5 + resolution: "eslint@npm:9.39.5" dependencies: "@eslint-community/eslint-utils": "npm:^4.8.0" "@eslint-community/regexpp": "npm:^4.12.1" - "@eslint/config-array": "npm:^0.21.1" + "@eslint/config-array": "npm:^0.21.2" "@eslint/config-helpers": "npm:^0.4.2" "@eslint/core": "npm:^0.17.0" - "@eslint/eslintrc": "npm:^3.3.1" - "@eslint/js": "npm:9.39.2" + "@eslint/eslintrc": "npm:^3.3.6" + "@eslint/js": "npm:9.39.5" "@eslint/plugin-kit": "npm:^0.4.1" "@humanfs/node": "npm:^0.16.6" "@humanwhocodes/module-importer": "npm:^1.0.1" "@humanwhocodes/retry": "npm:^0.4.2" "@types/estree": "npm:^1.0.6" - ajv: "npm:^6.12.4" + ajv: "npm:^6.14.0" chalk: "npm:^4.0.0" cross-spawn: "npm:^7.0.6" debug: "npm:^4.3.2" @@ -6543,7 +6658,7 @@ __metadata: is-glob: "npm:^4.0.0" json-stable-stringify-without-jsonify: "npm:^1.0.1" lodash.merge: "npm:^4.6.2" - minimatch: "npm:^3.1.2" + minimatch: "npm:^3.1.5" natural-compare: "npm:^1.4.0" optionator: "npm:^0.9.3" peerDependencies: @@ -6553,7 +6668,7 @@ __metadata: optional: true bin: eslint: bin/eslint.js - checksum: 10c0/bb88ca8fd16bb7e1ac3e13804c54d41c583214460c0faa7b3e7c574e69c5600c7122295500fb4b0c06067831111db740931e98da1340329527658e1cf80073d3 + checksum: 10c0/46335bfcf180ffea9955b38122b578ac9e075b6220e5695be1c988354ea429b04f5db05edc132aa9019ce9847736e9ca0c9ea6d6cedda3c06209c9b52dbd0fd5 languageName: node linkType: hard @@ -6716,10 +6831,10 @@ __metadata: languageName: node linkType: hard -"exsolve@npm:^1.0.7, exsolve@npm:^1.0.8": - version: 1.0.8 - resolution: "exsolve@npm:1.0.8" - checksum: 10c0/65e44ae05bd4a4a5d87cfdbbd6b8f24389282cf9f85fa5feb17ca87ad3f354877e6af4cd99e02fc29044174891f82d1d68c77f69234410eb8f163530e6278c67 +"exsolve@npm:^1.0.8": + version: 1.1.1 + resolution: "exsolve@npm:1.1.1" + checksum: 10c0/0b157a7600408bd356ff78cff5ad9c8c0dd7ca5e7f246216c3c9b66196e76277d3130021122b9c5078a3462751fd7aa988fe3dc1e3b80c79cb873c1623f628e1 languageName: node linkType: hard @@ -6772,20 +6887,20 @@ __metadata: linkType: hard "fast-uri@npm:^3.0.1": - version: 3.1.0 - resolution: "fast-uri@npm:3.1.0" - checksum: 10c0/44364adca566f70f40d1e9b772c923138d47efeac2ae9732a872baafd77061f26b097ba2f68f0892885ad177becd065520412b8ffeec34b16c99433c5b9e2de7 + version: 3.1.5 + resolution: "fast-uri@npm:3.1.5" + checksum: 10c0/2bf60eb800dd610c65e17be436425dcb21c92aff3a87d442a8bccab0b7b071e88cf1a5d7d1ea946370b937e6fc0375c405c0296c10587e57de4f78be4646d1d0 languageName: node linkType: hard "fast-xml-parser@npm:^4.4.1": - version: 4.5.3 - resolution: "fast-xml-parser@npm:4.5.3" + version: 4.5.7 + resolution: "fast-xml-parser@npm:4.5.7" dependencies: - strnum: "npm:^1.1.1" + strnum: "npm:^1.0.5" bin: fxparser: src/cli/cli.js - checksum: 10c0/bf9ccadacfadc95f6e3f0e7882a380a7f219cf0a6f96575149f02cb62bf44c3b7f0daee75b8ff3847bcfd7fbcb201e402c71045936c265cf6d94b141ec4e9327 + checksum: 10c0/5fccf3f53d6b2b83143d73089f04ef5db5343422891193cf10d92d3eb856007b7337818494109e46f6fa47b31b9716be15c4b275ff87a0aeb6f7315aa2edc181 languageName: node linkType: hard @@ -6919,9 +7034,9 @@ __metadata: linkType: hard "flatted@npm:^3.2.9": - version: 3.3.3 - resolution: "flatted@npm:3.3.3" - checksum: 10c0/e957a1c6b0254aa15b8cce8533e24165abd98fadc98575db082b786b5da1b7d72062b81bfdcd1da2f4d46b6ed93bec2434e62333e9b4261d79ef2e75a10dd538 + version: 3.4.4 + resolution: "flatted@npm:3.4.4" + checksum: 10c0/a3a52a88ea5a4c333e5a1f097dcd87a037fa31c236a77cf46222c2aa4036ef895ab9bc76138a66d9dc22bdb3652128f9598cd26e7439561bf19f67276e2bc37e languageName: node linkType: hard @@ -6980,15 +7095,6 @@ __metadata: languageName: node linkType: hard -"fs-minipass@npm:^3.0.0": - version: 3.0.3 - resolution: "fs-minipass@npm:3.0.3" - dependencies: - minipass: "npm:^7.0.3" - checksum: 10c0/63e80da2ff9b621e2cb1596abcb9207f1cf82b968b116ccd7b959e3323144cce7fb141462200971c38bbf2ecca51695069db45265705bed09a7cd93ae5b89f94 - languageName: node - linkType: hard - "fs.realpath@npm:^1.0.0": version: 1.0.0 resolution: "fs.realpath@npm:1.0.0" @@ -7023,16 +7129,19 @@ __metadata: linkType: hard "function.prototype.name@npm:^1.1.6, function.prototype.name@npm:^1.1.8": - version: 1.1.8 - resolution: "function.prototype.name@npm:1.1.8" + version: 1.2.0 + resolution: "function.prototype.name@npm:1.2.0" dependencies: - call-bind: "npm:^1.0.8" - call-bound: "npm:^1.0.3" - define-properties: "npm:^1.2.1" + call-bind: "npm:^1.0.9" + call-bound: "npm:^1.0.4" + es-define-property: "npm:^1.0.1" + es-errors: "npm:^1.3.0" functions-have-names: "npm:^1.2.3" - hasown: "npm:^2.0.2" + has-property-descriptors: "npm:^1.0.2" + hasown: "npm:^2.0.4" is-callable: "npm:^1.2.7" - checksum: 10c0/e920a2ab52663005f3cbe7ee3373e3c71c1fb5558b0b0548648cdf3e51961085032458e26c71ff1a8c8c20e7ee7caeb03d43a5d1fa8610c459333323a2e71253 + is-document.all: "npm:^1.0.0" + checksum: 10c0/b20e6370ef4f7d56d0bedf5719f6684a517a8dd3334209b4d9f51e8834859302a584187156bf024cda9f50ba2479e4d6764ac34af9532ea47d2f4d9fa6bcf90d languageName: node linkType: hard @@ -7064,20 +7173,13 @@ __metadata: languageName: node linkType: hard -"get-east-asian-width@npm:^1.0.0": +"get-east-asian-width@npm:^1.0.0, get-east-asian-width@npm:^1.5.0": version: 1.6.0 resolution: "get-east-asian-width@npm:1.6.0" checksum: 10c0/7e72e9550fd49ca5b246f9af6bb2afc129c96412845ff6556b3274fd44817a381702ca17028efe9866b261a3d44254cbf21e6c90cf05b4b61675630af776d431 languageName: node linkType: hard -"get-east-asian-width@npm:^1.3.0": - version: 1.4.0 - resolution: "get-east-asian-width@npm:1.4.0" - checksum: 10c0/4e481d418e5a32061c36fbb90d1b225a254cc5b2df5f0b25da215dcd335a3c111f0c2023ffda43140727a9cafb62dac41d022da82c08f31083ee89f714ee3b83 - languageName: node - linkType: hard - "get-intrinsic@npm:^1.2.4, get-intrinsic@npm:^1.2.5, get-intrinsic@npm:^1.2.6, get-intrinsic@npm:^1.2.7, get-intrinsic@npm:^1.3.0": version: 1.3.1 resolution: "get-intrinsic@npm:1.3.1" @@ -7251,13 +7353,13 @@ __metadata: linkType: hard "glob@npm:^13.0.0": - version: 13.0.0 - resolution: "glob@npm:13.0.0" + version: 13.0.6 + resolution: "glob@npm:13.0.6" dependencies: - minimatch: "npm:^10.1.1" - minipass: "npm:^7.1.2" - path-scurry: "npm:^2.0.0" - checksum: 10c0/8e2f5821f3f7c312dd102e23a15b80c79e0837a9872784293ba2e15ec73b3f3749a49a42a31bfcb4e52c84820a474e92331c2eebf18819d20308f5c33876630a + minimatch: "npm:^10.2.2" + minipass: "npm:^7.1.3" + path-scurry: "npm:^2.0.2" + checksum: 10c0/269c236f11a9b50357fe7a8c6aadac667e01deb5242b19c84975628f05f4438d8ee1354bb62c5d6c10f37fd59911b54d7799730633a2786660d8c69f1d18120a languageName: node linkType: hard @@ -7344,8 +7446,8 @@ __metadata: linkType: hard "handlebars@npm:^4.7.7": - version: 4.7.8 - resolution: "handlebars@npm:4.7.8" + version: 4.7.9 + resolution: "handlebars@npm:4.7.9" dependencies: minimist: "npm:^1.2.5" neo-async: "npm:^2.6.2" @@ -7357,7 +7459,7 @@ __metadata: optional: true bin: handlebars: bin/handlebars - checksum: 10c0/7aff423ea38a14bb379316f3857fe0df3c5d66119270944247f155ba1f08e07a92b340c58edaa00cfe985c21508870ee5183e0634dcb53dd405f35c93ef7f10d + checksum: 10c0/22f8105a7e68e81aff2662bb434edf05f757d21d850731d71cec886d69c10cd33d3c43e34b2892968ec62de8241611851d3d0674c8ef324ea3e01dc66262faa9 languageName: node linkType: hard @@ -7409,12 +7511,12 @@ __metadata: languageName: node linkType: hard -"hasown@npm:^2.0.2": - version: 2.0.2 - resolution: "hasown@npm:2.0.2" +"hasown@npm:^2.0.2, hasown@npm:^2.0.3, hasown@npm:^2.0.4": + version: 2.0.4 + resolution: "hasown@npm:2.0.4" dependencies: function-bind: "npm:^1.1.2" - checksum: 10c0/3769d434703b8ac66b209a4cca0737519925bbdb61dd887f93a16372b14694c63ff4e797686d87c90f08168e81082248b9b028bad60d4da9e0d1148766f56eb9 + checksum: 10c0/2d8de939e270b70618f8cebb69746620db10617dbb495bc66ddad326955ea24d3ca4af133aff3eb7c1853e0218f867bc2b050ec26fe02e3aea58f880ffc5e506 languageName: node linkType: hard @@ -7505,13 +7607,6 @@ __metadata: languageName: node linkType: hard -"http-cache-semantics@npm:^4.1.1": - version: 4.2.0 - resolution: "http-cache-semantics@npm:4.2.0" - checksum: 10c0/45b66a945cf13ec2d1f29432277201313babf4a01d9e52f44b31ca923434083afeca03f18417f599c9ab3d0e7b618ceb21257542338b57c54b710463b4a53e37 - languageName: node - linkType: hard - "http-errors@npm:~2.0.1": version: 2.0.1 resolution: "http-errors@npm:2.0.1" @@ -7535,7 +7630,7 @@ __metadata: languageName: node linkType: hard -"https-proxy-agent@npm:^7.0.1, https-proxy-agent@npm:^7.0.5, https-proxy-agent@npm:^7.0.6": +"https-proxy-agent@npm:^7.0.5, https-proxy-agent@npm:^7.0.6": version: 7.0.6 resolution: "https-proxy-agent@npm:7.0.6" dependencies: @@ -7566,21 +7661,12 @@ __metadata: languageName: node linkType: hard -"iconv-lite@npm:^0.6.2": - version: 0.6.3 - resolution: "iconv-lite@npm:0.6.3" - dependencies: - safer-buffer: "npm:>= 2.1.2 < 3.0.0" - checksum: 10c0/98102bc66b33fcf5ac044099d1257ba0b7ad5e3ccd3221f34dd508ab4070edff183276221684e1e0555b145fce0850c9f7d2b60a9fcac50fbb4ea0d6e845a3b1 - languageName: node - linkType: hard - "iconv-lite@npm:^0.7.0": - version: 0.7.1 - resolution: "iconv-lite@npm:0.7.1" + version: 0.7.3 + resolution: "iconv-lite@npm:0.7.3" dependencies: safer-buffer: "npm:>= 2.1.2 < 3.0.0" - checksum: 10c0/f5c9e2bddd7101a71b07a381ace44ebdc65ca76a10be0e9e64d372b511132acc4ee41b830962f438840d492cd6f9e08c237289f760d6a7fed754e61cffcb6757 + checksum: 10c0/be2fd2414f7e94be3a63063fa0ad5919c16bc7b6e00c77eea0765ced6db405739f38dd51016583058fba25cc1d0106ba30b83fbb7a7e32f824d4db76f23d8d33 languageName: node linkType: hard @@ -7607,14 +7693,7 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^7.0.3": - version: 7.0.5 - resolution: "ignore@npm:7.0.5" - checksum: 10c0/ae00db89fe873064a093b8999fe4cc284b13ef2a178636211842cceb650b9c3e390d3339191acb145d81ed5379d2074840cf0c33a20bdbd6f32821f79eb4ad5d - languageName: node - linkType: hard - -"ignore@npm:^7.0.5": +"ignore@npm:^7.0.3, ignore@npm:^7.0.5": version: 7.0.6 resolution: "ignore@npm:7.0.6" checksum: 10c0/fc01ef1d14efbe003439b60538726351e81483d1b6f55bdbb3a4465c6346d9481afad5b350dfbd604ddd7049618ef9093ff26dc147984aabc303c56ba53ea3b5 @@ -7739,10 +7818,10 @@ __metadata: languageName: node linkType: hard -"ip-address@npm:^10.0.1": - version: 10.1.0 - resolution: "ip-address@npm:10.1.0" - checksum: 10c0/0103516cfa93f6433b3bd7333fa876eb21263912329bfa47010af5e16934eeeff86f3d2ae700a3744a137839ddfad62b900c7a445607884a49b5d1e32a3d7566 +"ip-address@npm:^10.1.1": + version: 10.4.0 + resolution: "ip-address@npm:10.4.0" + checksum: 10c0/d7b0bd2624fd861afbae6e49036a9b56f9506eaff7ff38592b7b4492dd5c272b53f5356dc8cc019e318acf29a96c90a3d1af1df761960267d23efa96858270fa languageName: node linkType: hard @@ -7820,12 +7899,12 @@ __metadata: languageName: node linkType: hard -"is-core-module@npm:^2.13.0, is-core-module@npm:^2.16.1": - version: 2.16.1 - resolution: "is-core-module@npm:2.16.1" +"is-core-module@npm:^2.16.1, is-core-module@npm:^2.16.2": + version: 2.16.2 + resolution: "is-core-module@npm:2.16.2" dependencies: - hasown: "npm:^2.0.2" - checksum: 10c0/898443c14780a577e807618aaae2b6f745c8538eca5c7bc11388a3f2dc6de82b9902bcc7eb74f07be672b11bbe82dd6a6edded44a00cb3d8f933d0459905eedd + hasown: "npm:^2.0.3" + checksum: 10c0/14b4258390283709c15476d023ec173e27458d5d014ccdb8ed39d576e551c3fa45498b7c9fe178f1529c4cb2648ddd58852a6a62107a019f6e349529f277518a languageName: node linkType: hard @@ -7840,7 +7919,7 @@ __metadata: languageName: node linkType: hard -"is-date-object@npm:^1.0.5, is-date-object@npm:^1.1.0": +"is-date-object@npm:^1.1.0": version: 1.1.0 resolution: "is-date-object@npm:1.1.0" dependencies: @@ -7868,6 +7947,15 @@ __metadata: languageName: node linkType: hard +"is-document.all@npm:^1.0.0": + version: 1.0.0 + resolution: "is-document.all@npm:1.0.0" + dependencies: + call-bound: "npm:^1.0.4" + checksum: 10c0/955c20ed5bf01d49da8243b4c714947a6ff64b6d9ba0e12bdbfa654a3e7c47f72cc01c6cd2905e85512d02bc3a1290edd73857bca8842566ff9dcfb7c3f92dae + languageName: node + linkType: hard + "is-extglob@npm:^2.1.1": version: 2.1.1 resolution: "is-extglob@npm:2.1.1" @@ -8108,7 +8196,7 @@ __metadata: languageName: node linkType: hard -"is-symbol@npm:^1.0.4, is-symbol@npm:^1.1.1": +"is-symbol@npm:^1.1.1": version: 1.1.1 resolution: "is-symbol@npm:1.1.1" dependencies: @@ -8210,11 +8298,11 @@ __metadata: linkType: hard "is-wsl@npm:^3.1.0": - version: 3.1.0 - resolution: "is-wsl@npm:3.1.0" + version: 3.1.1 + resolution: "is-wsl@npm:3.1.1" dependencies: is-inside-container: "npm:^1.0.0" - checksum: 10c0/d3317c11995690a32c362100225e22ba793678fe8732660c6de511ae71a0ff05b06980cf21f98a6bf40d7be0e9e9506f859abe00a1118287d63e53d0a3d06947 + checksum: 10c0/7e5023522bfb8f27de4de960b0d82c4a8146c0bddb186529a3616d78b5bbbfc19ef0c5fc60d0b3a3cc0bf95a415fbdedc18454310ea3049587c879b07ace5107 languageName: node linkType: hard @@ -8232,10 +8320,10 @@ __metadata: languageName: node linkType: hard -"isexe@npm:^3.1.1": - version: 3.1.1 - resolution: "isexe@npm:3.1.1" - checksum: 10c0/9ec257654093443eb0a528a9c8cbba9c0ca7616ccb40abd6dde7202734d96bb86e4ac0d764f0f8cd965856aacbff2f4ce23e730dc19dfb41e3b0d865ca6fdcc7 +"isexe@npm:^4.0.0": + version: 4.0.0 + resolution: "isexe@npm:4.0.0" + checksum: 10c0/5884815115bceac452877659a9c7726382531592f43dc29e5d48b7c4100661aed54018cb90bd36cb2eaeba521092570769167acbb95c18d39afdccbcca06c5ce languageName: node linkType: hard @@ -8783,7 +8871,7 @@ __metadata: languageName: node linkType: hard -"jiti@npm:^2.6.1": +"jiti@npm:2.6.1": version: 2.6.1 resolution: "jiti@npm:2.6.1" bin: @@ -8792,16 +8880,25 @@ __metadata: languageName: node linkType: hard +"jiti@npm:^2.6.1": + version: 2.7.0 + resolution: "jiti@npm:2.7.0" + bin: + jiti: lib/jiti-cli.mjs + checksum: 10c0/1b1e2310a490dce1aeea3da5f5dfe18273516c20ce48be2e98eb8ea452d5f3dcc8fd0cfd6d28b4052a24c5dbab6e3089b2d7e79f0bce7915b10d750929563c42 + languageName: node + linkType: hard + "joi@npm:^17.2.1": - version: 17.13.3 - resolution: "joi@npm:17.13.3" + version: 17.13.4 + resolution: "joi@npm:17.13.4" dependencies: "@hapi/hoek": "npm:^9.3.0" "@hapi/topo": "npm:^5.1.0" "@sideway/address": "npm:^4.1.5" "@sideway/formula": "npm:^3.0.1" "@sideway/pinpoint": "npm:^2.0.0" - checksum: 10c0/9262aef1da3f1bec5b03caf50c46368899fe03b8ff26cbe3d53af4584dd1049079fc97230bbf1500b6149db7cc765b9ee45f0deb24bb6fc3fa06229d7148c17f + checksum: 10c0/5addfef638e90eb6a45a72e3884128d8d9a80c487cb8bfcb949be179b875ad1095af347fa1bd05c4ebec2b2ccbc3f3db5f34501c8672ecd16100de2b77087122 languageName: node linkType: hard @@ -8813,25 +8910,25 @@ __metadata: linkType: hard "js-yaml@npm:^3.13.1": - version: 3.14.2 - resolution: "js-yaml@npm:3.14.2" + version: 3.15.1 + resolution: "js-yaml@npm:3.15.1" dependencies: argparse: "npm:^1.0.7" esprima: "npm:^4.0.0" bin: js-yaml: bin/js-yaml.js - checksum: 10c0/3261f25912f5dd76605e5993d0a126c2b6c346311885d3c483706cd722efe34f697ea0331f654ce27c00a42b426e524518ec89d65ed02ea47df8ad26dcc8ce69 + checksum: 10c0/6c693b8c59ffe12021df3b36994b090df19d920826dd810baab81652b40861e1974509dd11fe92225ab4c00cc14de053300c94db015c2c0e211edea39b118737 languageName: node linkType: hard -"js-yaml@npm:^4.1.0, js-yaml@npm:^4.1.1": - version: 4.1.1 - resolution: "js-yaml@npm:4.1.1" +"js-yaml@npm:^4.1.0, js-yaml@npm:^4.1.1, js-yaml@npm:^4.3.0": + version: 4.3.1 + resolution: "js-yaml@npm:4.3.1" dependencies: argparse: "npm:^2.0.1" bin: js-yaml: bin/js-yaml.js - checksum: 10c0/561c7d7088c40a9bb53cc75becbfb1df6ae49b34b5e6e5a81744b14ae8667ec564ad2527709d1a6e7d5e5fa6d483aa0f373a50ad98d42fde368ec4a190d4fae7 + checksum: 10c0/13c500ca322e0c3f8c81686e6ecda96d2ea37b45247a420c17c7db36932d6965cc27391abc2d1a104501600e7f0d947a5f8b7be6db619c4fefa87901b3512807 languageName: node linkType: hard @@ -8908,15 +9005,15 @@ __metadata: linkType: hard "jsonfile@npm:^6.0.1": - version: 6.2.0 - resolution: "jsonfile@npm:6.2.0" + version: 6.2.1 + resolution: "jsonfile@npm:6.2.1" dependencies: graceful-fs: "npm:^4.1.6" universalify: "npm:^2.0.0" dependenciesMeta: graceful-fs: optional: true - checksum: 10c0/7f4f43b08d1869ded8a6822213d13ae3b99d651151d77efd1557ced0889c466296a7d9684e397bd126acf5eb2cfcb605808c3e681d0fdccd2fe5a04b47e76c0d + checksum: 10c0/e1abf000ecee9942d4d028a8e02dc752617face227d72afd1cfb2187e2433079e625bf82b807a313689db71b6472c6b2b389a2340d2798737b1199a39631c28a languageName: node linkType: hard @@ -8963,99 +9060,99 @@ __metadata: linkType: hard "launch-editor@npm:^2.9.1": - version: 2.12.0 - resolution: "launch-editor@npm:2.12.0" + version: 2.14.1 + resolution: "launch-editor@npm:2.14.1" dependencies: picocolors: "npm:^1.1.1" - shell-quote: "npm:^1.8.3" - checksum: 10c0/fac5e7ad90bf185594cad4c831a52419eef50e667c4eddb5b0a58eb5f944e16d947636ee767b9896ffd46a51db34925edd3b854c48efb47f6d767ffd7d904e71 + shell-quote: "npm:^1.8.4" + checksum: 10c0/bb0ab182086afaf1c391abd38d6fc9d5391cb43d0c2da1d96176f79e9995635cdf34dcfd8df3f756bb82d7bbbb7d37014d5eb312f337350889c0cff92db53dab languageName: node linkType: hard -"lefthook-darwin-arm64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-darwin-arm64@npm:2.0.13" +"lefthook-darwin-arm64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-darwin-arm64@npm:2.1.10" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"lefthook-darwin-x64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-darwin-x64@npm:2.0.13" +"lefthook-darwin-x64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-darwin-x64@npm:2.1.10" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"lefthook-freebsd-arm64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-freebsd-arm64@npm:2.0.13" +"lefthook-freebsd-arm64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-freebsd-arm64@npm:2.1.10" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"lefthook-freebsd-x64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-freebsd-x64@npm:2.0.13" +"lefthook-freebsd-x64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-freebsd-x64@npm:2.1.10" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"lefthook-linux-arm64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-linux-arm64@npm:2.0.13" +"lefthook-linux-arm64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-linux-arm64@npm:2.1.10" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"lefthook-linux-x64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-linux-x64@npm:2.0.13" +"lefthook-linux-x64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-linux-x64@npm:2.1.10" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"lefthook-openbsd-arm64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-openbsd-arm64@npm:2.0.13" +"lefthook-openbsd-arm64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-openbsd-arm64@npm:2.1.10" conditions: os=openbsd & cpu=arm64 languageName: node linkType: hard -"lefthook-openbsd-x64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-openbsd-x64@npm:2.0.13" +"lefthook-openbsd-x64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-openbsd-x64@npm:2.1.10" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"lefthook-windows-arm64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-windows-arm64@npm:2.0.13" +"lefthook-windows-arm64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-windows-arm64@npm:2.1.10" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"lefthook-windows-x64@npm:2.0.13": - version: 2.0.13 - resolution: "lefthook-windows-x64@npm:2.0.13" +"lefthook-windows-x64@npm:2.1.10": + version: 2.1.10 + resolution: "lefthook-windows-x64@npm:2.1.10" conditions: os=win32 & cpu=x64 languageName: node linkType: hard "lefthook@npm:^2.0.3": - version: 2.0.13 - resolution: "lefthook@npm:2.0.13" - dependencies: - lefthook-darwin-arm64: "npm:2.0.13" - lefthook-darwin-x64: "npm:2.0.13" - lefthook-freebsd-arm64: "npm:2.0.13" - lefthook-freebsd-x64: "npm:2.0.13" - lefthook-linux-arm64: "npm:2.0.13" - lefthook-linux-x64: "npm:2.0.13" - lefthook-openbsd-arm64: "npm:2.0.13" - lefthook-openbsd-x64: "npm:2.0.13" - lefthook-windows-arm64: "npm:2.0.13" - lefthook-windows-x64: "npm:2.0.13" + version: 2.1.10 + resolution: "lefthook@npm:2.1.10" + dependencies: + lefthook-darwin-arm64: "npm:2.1.10" + lefthook-darwin-x64: "npm:2.1.10" + lefthook-freebsd-arm64: "npm:2.1.10" + lefthook-freebsd-x64: "npm:2.1.10" + lefthook-linux-arm64: "npm:2.1.10" + lefthook-linux-x64: "npm:2.1.10" + lefthook-openbsd-arm64: "npm:2.1.10" + lefthook-openbsd-x64: "npm:2.1.10" + lefthook-windows-arm64: "npm:2.1.10" + lefthook-windows-x64: "npm:2.1.10" dependenciesMeta: lefthook-darwin-arm64: optional: true @@ -9079,7 +9176,7 @@ __metadata: optional: true bin: lefthook: bin/index.js - checksum: 10c0/11dc5a952c24325b19803c261331f1e12ea8eaf31c0ab131815955a6e7210323828995c2b9cc73b79c23de960beda27ab71de88afdf00e40f367c6b13cee1ce3 + checksum: 10c0/be812e1517a967977750a41f15a2070cea63e1774137737426f636e1bd379f4dfc73482fa7f07df6b9a1413ee50c6e2d790936d7986bdcafd46255d871c17b76 languageName: node linkType: hard @@ -9250,9 +9347,9 @@ __metadata: linkType: hard "lodash@npm:^4.15.0, lodash@npm:^4.17.21": - version: 4.17.21 - resolution: "lodash@npm:4.17.21" - checksum: 10c0/d8cbea072bb08655bb4c989da418994b073a608dffa608b09ac04b43a791b12aeae7cd7ad919aa4c925f33b48490b5cfe6c1f71d827956071dae2e7bb3a6b74c + version: 4.18.1 + resolution: "lodash@npm:4.18.1" + checksum: 10c0/757228fc68805c59789e82185135cf85f05d0b2d3d54631d680ca79ec21944ec8314d4533639a14b8bcfbd97a517e78960933041a5af17ecb693ec6eecb99a27 languageName: node linkType: hard @@ -9307,10 +9404,10 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^11.0.0, lru-cache@npm:^11.1.0, lru-cache@npm:^11.2.1": - version: 11.2.4 - resolution: "lru-cache@npm:11.2.4" - checksum: 10c0/4a24f9b17537619f9144d7b8e42cd5a225efdfd7076ebe7b5e7dc02b860a818455201e67fbf000765233fe7e339d3c8229fc815e9b58ee6ede511e07608c19b2 +"lru-cache@npm:^11.0.0": + version: 11.5.2 + resolution: "lru-cache@npm:11.5.2" + checksum: 10c0/ece1ad731f5b655e85d67047d04bfc13823dc77aa61c5454924a9869ba600a0104e39cc33d726021feef812bc347ca34a5608a5eb1972a5dd0870b7ecd42c3f2 languageName: node linkType: hard @@ -9342,9 +9439,9 @@ __metadata: linkType: hard "macos-release@npm:^3.3.0": - version: 3.4.0 - resolution: "macos-release@npm:3.4.0" - checksum: 10c0/cb6ea203cc2a2b2cc2214db4658d0da0e52f8298c5c43c94cf9cb9e871daac59e4e56a2559859727a4b43b0afec1123f998ef62c58d1ac6c6c8a5c8a808330cb + version: 3.5.1 + resolution: "macos-release@npm:3.5.1" + checksum: 10c0/a940167179ba1eeb0b514c447f0c2cc40e7301289ba0941e3c98b80262e34d4790bba73e4e99b215f44909e38f841fac72f93c89a94851d58431d275981979f8 languageName: node linkType: hard @@ -9357,25 +9454,6 @@ __metadata: languageName: node linkType: hard -"make-fetch-happen@npm:^15.0.0": - version: 15.0.3 - resolution: "make-fetch-happen@npm:15.0.3" - dependencies: - "@npmcli/agent": "npm:^4.0.0" - cacache: "npm:^20.0.1" - http-cache-semantics: "npm:^4.1.1" - minipass: "npm:^7.0.2" - minipass-fetch: "npm:^5.0.0" - minipass-flush: "npm:^1.0.5" - minipass-pipeline: "npm:^1.2.4" - negotiator: "npm:^1.0.0" - proc-log: "npm:^6.0.0" - promise-retry: "npm:^2.0.1" - ssri: "npm:^13.0.0" - checksum: 10c0/525f74915660be60b616bcbd267c4a5b59481b073ba125e45c9c3a041bb1a47a2bd0ae79d028eb6f5f95bf9851a4158423f5068539c3093621abb64027e8e461 - languageName: node - linkType: hard - "makeerror@npm:1.0.12": version: 1.0.12 resolution: "makeerror@npm:1.0.12" @@ -9754,38 +9832,29 @@ __metadata: linkType: hard "minimatch@npm:^10.0.1, minimatch@npm:^10.2.2": - version: 10.2.5 - resolution: "minimatch@npm:10.2.5" - dependencies: - brace-expansion: "npm:^5.0.5" - checksum: 10c0/6bb058bd6324104b9ec2f763476a35386d05079c1f5fe4fbf1f324a25237cd4534d6813ecd71f48208f4e635c1221899bef94c3c89f7df55698fe373aaae20fd - languageName: node - linkType: hard - -"minimatch@npm:^10.1.1": - version: 10.1.1 - resolution: "minimatch@npm:10.1.1" + version: 10.2.6 + resolution: "minimatch@npm:10.2.6" dependencies: - "@isaacs/brace-expansion": "npm:^5.0.0" - checksum: 10c0/c85d44821c71973d636091fddbfbffe62370f5ee3caf0241c5b60c18cd289e916200acb2361b7e987558cd06896d153e25d505db9fc1e43e6b4b6752e2702902 + brace-expansion: "npm:^5.0.8" + checksum: 10c0/4559a836243b98bd4d17ea9f7edae698717c76399eea7be374f3737f33164e4907f19e9726891ddeb122f750a5a7fa80d2ac43e851d6e5984dc4ff42ec127d3a languageName: node linkType: hard -"minimatch@npm:^3.0.4, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": - version: 3.1.2 - resolution: "minimatch@npm:3.1.2" +"minimatch@npm:^3.0.4, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2, minimatch@npm:^3.1.5": + version: 3.1.5 + resolution: "minimatch@npm:3.1.5" dependencies: brace-expansion: "npm:^1.1.7" - checksum: 10c0/0262810a8fc2e72cca45d6fd86bd349eee435eb95ac6aa45c9ea2180e7ee875ef44c32b55b5973ceabe95ea12682f6e3725cbb63d7a2d1da3ae1163c8b210311 + checksum: 10c0/2ecbdc0d33f07bddb0315a8b5afbcb761307a8778b48f0b312418ccbced99f104a2d17d8aca7573433c70e8ccd1c56823a441897a45e384ea76ef401a26ace70 languageName: node linkType: hard "minimatch@npm:^9.0.4": - version: 9.0.5 - resolution: "minimatch@npm:9.0.5" + version: 9.0.9 + resolution: "minimatch@npm:9.0.9" dependencies: - brace-expansion: "npm:^2.0.1" - checksum: 10c0/de96cf5e35bdf0eab3e2c853522f98ffbe9a36c37797778d2665231ec1f20a9447a7e567cb640901f89e4daaa95ae5d70c65a9e8aa2bb0019b6facbc3c0575ed + brace-expansion: "npm:^2.0.2" + checksum: 10c0/0b6a58530dbb00361745aa6c8cffaba4c90f551afe7c734830bd95fd88ebf469dd7355a027824ea1d09e37181cfeb0a797fb17df60c15ac174303ac110eb7e86 languageName: node linkType: hard @@ -9796,74 +9865,14 @@ __metadata: languageName: node linkType: hard -"minipass-collect@npm:^2.0.1": - version: 2.0.1 - resolution: "minipass-collect@npm:2.0.1" - dependencies: - minipass: "npm:^7.0.3" - checksum: 10c0/5167e73f62bb74cc5019594709c77e6a742051a647fe9499abf03c71dca75515b7959d67a764bdc4f8b361cf897fbf25e2d9869ee039203ed45240f48b9aa06e - languageName: node - linkType: hard - -"minipass-fetch@npm:^5.0.0": - version: 5.0.0 - resolution: "minipass-fetch@npm:5.0.0" - dependencies: - encoding: "npm:^0.1.13" - minipass: "npm:^7.0.3" - minipass-sized: "npm:^1.0.3" - minizlib: "npm:^3.0.1" - dependenciesMeta: - encoding: - optional: true - checksum: 10c0/9443aab5feab190972f84b64116e54e58dd87a58e62399cae0a4a7461b80568281039b7c3a38ba96453431ebc799d1e26999e548540156216729a4967cd5ef06 - languageName: node - linkType: hard - -"minipass-flush@npm:^1.0.5": - version: 1.0.5 - resolution: "minipass-flush@npm:1.0.5" - dependencies: - minipass: "npm:^3.0.0" - checksum: 10c0/2a51b63feb799d2bb34669205eee7c0eaf9dce01883261a5b77410c9408aa447e478efd191b4de6fc1101e796ff5892f8443ef20d9544385819093dbb32d36bd - languageName: node - linkType: hard - -"minipass-pipeline@npm:^1.2.4": - version: 1.2.4 - resolution: "minipass-pipeline@npm:1.2.4" - dependencies: - minipass: "npm:^3.0.0" - checksum: 10c0/cbda57cea20b140b797505dc2cac71581a70b3247b84480c1fed5ca5ba46c25ecc25f68bfc9e6dcb1a6e9017dab5c7ada5eab73ad4f0a49d84e35093e0c643f2 - languageName: node - linkType: hard - -"minipass-sized@npm:^1.0.3": - version: 1.0.3 - resolution: "minipass-sized@npm:1.0.3" - dependencies: - minipass: "npm:^3.0.0" - checksum: 10c0/298f124753efdc745cfe0f2bdfdd81ba25b9f4e753ca4a2066eb17c821f25d48acea607dfc997633ee5bf7b6dfffb4eee4f2051eb168663f0b99fad2fa4829cb - languageName: node - linkType: hard - -"minipass@npm:^3.0.0": - version: 3.3.6 - resolution: "minipass@npm:3.3.6" - dependencies: - yallist: "npm:^4.0.0" - checksum: 10c0/a114746943afa1dbbca8249e706d1d38b85ed1298b530f5808ce51f8e9e941962e2a5ad2e00eae7dd21d8a4aae6586a66d4216d1a259385e9d0358f0c1eba16c - languageName: node - linkType: hard - -"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.0.4, minipass@npm:^7.1.2": - version: 7.1.2 - resolution: "minipass@npm:7.1.2" - checksum: 10c0/b0fd20bb9fb56e5fa9a8bfac539e8915ae07430a619e4b86ff71f5fc757ef3924b23b2c4230393af1eda647ed3d75739e4e0acb250a6b1eb277cf7f8fe449557 +"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.4, minipass@npm:^7.1.2, minipass@npm:^7.1.3": + version: 7.1.3 + resolution: "minipass@npm:7.1.3" + checksum: 10c0/539da88daca16533211ea5a9ee98dc62ff5742f531f54640dd34429e621955e91cc280a91a776026264b7f9f6735947629f920944e9c1558369e8bf22eb33fbb languageName: node linkType: hard -"minizlib@npm:^3.0.1, minizlib@npm:^3.1.0": +"minizlib@npm:^3.1.0": version: 3.1.0 resolution: "minizlib@npm:3.1.0" dependencies: @@ -9903,11 +9912,11 @@ __metadata: linkType: hard "nanoid@npm:^3.3.11": - version: 3.3.11 - resolution: "nanoid@npm:3.3.11" + version: 3.3.16 + resolution: "nanoid@npm:3.3.16" bin: nanoid: bin/nanoid.cjs - checksum: 10c0/40e7f70b3d15f725ca072dfc4f74e81fcf1fbb02e491cf58ac0c79093adc9b0a73b152bcde57df4b79cd097e13023d7504acb38404a4da7bc1cd8e887b82fe0b + checksum: 10c0/bbf2dcffe22d2b62d16de2711752070b539c0f644c7916f823ad6521986b2078cbe524f2d6240f58c46e9141ea0c7b87a029e100c0f7f175228cacaf30e41bba languageName: node linkType: hard @@ -9947,9 +9956,9 @@ __metadata: linkType: hard "netmask@npm:^2.0.2": - version: 2.0.2 - resolution: "netmask@npm:2.0.2" - checksum: 10c0/cafd28388e698e1138ace947929f842944d0f1c0b87d3fa2601a61b38dc89397d33c0ce2c8e7b99e968584b91d15f6810b91bef3f3826adf71b1833b61d4bf4f + version: 2.1.1 + resolution: "netmask@npm:2.1.1" + checksum: 10c0/c78e31869b0578fb0a9874a0c0fdf0e1f8b3492392d1043355fb11d9ea42ef94e0216c6aee7d8e15db39d1a8caf331f9b144ae3ee43fd951b73a66837711fb09 languageName: node linkType: hard @@ -9984,6 +9993,18 @@ __metadata: languageName: node linkType: hard +"node-exports-info@npm:^1.6.0": + version: 1.6.2 + resolution: "node-exports-info@npm:1.6.2" + dependencies: + array.prototype.flatmap: "npm:^1.3.3" + es-errors: "npm:^1.3.0" + object.entries: "npm:^1.1.9" + semver: "npm:^6.3.1" + checksum: 10c0/5278fab18e8c97f45275c51819c3078ca9488361e875bc01b680776a339d2fee1ca9c6fcfb972df14945a1b184cc9924a1d9ba87e90f6cb3422c7f5b6900f4bc + languageName: node + linkType: hard + "node-fetch-native@npm:^1.6.6": version: 1.6.7 resolution: "node-fetch-native@npm:1.6.7" @@ -9992,22 +10013,22 @@ __metadata: linkType: hard "node-gyp@npm:latest": - version: 12.1.0 - resolution: "node-gyp@npm:12.1.0" + version: 13.0.1 + resolution: "node-gyp@npm:13.0.1" dependencies: env-paths: "npm:^2.2.0" exponential-backoff: "npm:^3.1.1" graceful-fs: "npm:^4.2.6" - make-fetch-happen: "npm:^15.0.0" - nopt: "npm:^9.0.0" - proc-log: "npm:^6.0.0" + nopt: "npm:^10.0.0" + proc-log: "npm:^7.0.0" semver: "npm:^7.3.5" - tar: "npm:^7.5.2" + tar: "npm:^7.5.4" tinyglobby: "npm:^0.2.12" - which: "npm:^6.0.0" + undici: "npm:^8.4.1" + which: "npm:^7.0.0" bin: node-gyp: bin/node-gyp.js - checksum: 10c0/f43efea8aaf0beb6b2f6184e533edad779b2ae38062953e21951f46221dd104006cc574154f2ad4a135467a5aae92c49e84ef289311a82e08481c5df0e8dc495 + checksum: 10c0/424077bc9e9bbe953a8e86db473ba818cbc6a121714008c977fd589e21e5f0c811fbf22faac730dc7182450b5e52df301811d01ae3373898658d999b7710f4e6 languageName: node linkType: hard @@ -10018,28 +10039,28 @@ __metadata: languageName: node linkType: hard -"node-releases@npm:^2.0.27": - version: 2.0.27 - resolution: "node-releases@npm:2.0.27" - checksum: 10c0/f1e6583b7833ea81880627748d28a3a7ff5703d5409328c216ae57befbced10ce2c991bea86434e8ec39003bd017f70481e2e5f8c1f7e0a7663241f81d6e00e2 +"node-releases@npm:^2.0.51": + version: 2.0.51 + resolution: "node-releases@npm:2.0.51" + checksum: 10c0/6cf3fe1f9eabe02ce6de67e9db77b73edc9f5625003791e1f8f239f8e2a851450a5aeb1eff2cc43cfb26312e19b26bfe07626bf428479e6a76f56553fc6148da languageName: node linkType: hard "node-stream-zip@npm:^1.9.1": - version: 1.15.0 - resolution: "node-stream-zip@npm:1.15.0" - checksum: 10c0/429fce95d7e90e846adbe096c61d2ea8d18defc155c0345d25d0f98dd6fc72aeb95039318484a4e0a01dc3814b6d0d1ae0fe91847a29669dff8676ec064078c9 + version: 1.16.0 + resolution: "node-stream-zip@npm:1.16.0" + checksum: 10c0/3e201e39b42b46c2e543bd11c71821aa675a98d6cb4901840bd952281696599c9c29c630cd00e8da9bee4b02879fee2d0194a225b359d48a3bf966bdd63d8648 languageName: node linkType: hard -"nopt@npm:^9.0.0": - version: 9.0.0 - resolution: "nopt@npm:9.0.0" +"nopt@npm:^10.0.0": + version: 10.0.1 + resolution: "nopt@npm:10.0.1" dependencies: - abbrev: "npm:^4.0.0" + abbrev: "npm:^5.0.0" bin: nopt: bin/nopt.js - checksum: 10c0/1822eb6f9b020ef6f7a7516d7b64a8036e09666ea55ac40416c36e4b2b343122c3cff0e2f085675f53de1d2db99a2a89a60ccea1d120bcd6a5347bf6ceb4a7fd + checksum: 10c0/980d89257f9587f3e1f77877ddbf905d6aa3b738ec33e49a4fa1a059a0dd82eb28063982b150654a7ae9de386f2ead60e56172db7d37cf56de545f7392a2a26a languageName: node linkType: hard @@ -10096,17 +10117,15 @@ __metadata: linkType: hard "nypm@npm:^0.6.0": - version: 0.6.2 - resolution: "nypm@npm:0.6.2" + version: 0.6.9 + resolution: "nypm@npm:0.6.9" dependencies: - citty: "npm:^0.1.6" - consola: "npm:^3.4.2" + citty: "npm:^0.2.2" pathe: "npm:^2.0.3" - pkg-types: "npm:^2.3.0" - tinyexec: "npm:^1.0.1" + tinyexec: "npm:^1.2.4" bin: - nypm: dist/cli.mjs - checksum: 10c0/b1aca658e29ed616ad6e487f9c3fd76773485ad75c1f99efe130ccb304de60b639a3dda43c3ce6c060113a3eebaee7ccbea554f5fbd1f244474181dc9bf3f17c + nypm: ./dist/cli.mjs + checksum: 10c0/8014c1842e554531a5092bae9f483d22413fe5f68fd2e15e74a2b7dc5b94e36cac836b9ebe9a70fd7ccba65a663c517c98663368f5b5e48d6bc65d74f0752d72 languageName: node linkType: hard @@ -10348,13 +10367,14 @@ __metadata: linkType: hard "own-keys@npm:^1.0.1": - version: 1.0.1 - resolution: "own-keys@npm:1.0.1" + version: 1.0.2 + resolution: "own-keys@npm:1.0.2" dependencies: - get-intrinsic: "npm:^1.2.6" + call-bound: "npm:^1.0.4" + get-intrinsic: "npm:^1.3.0" object-keys: "npm:^1.1.1" safe-push-apply: "npm:^1.0.0" - checksum: 10c0/6dfeb3455bff92ec3f16a982d4e3e65676345f6902d9f5ded1d8265a6318d0200ce461956d6d1c70053c7fe9f9fe65e552faac03f8140d37ef0fdd108e67013a + checksum: 10c0/84b0d9959475231166c3d4b9abd1b8af8042911e2e5625761eed980d1a1e4381cf52b34d907cae21ee8766c79de943f3cd85eba636149dee5e64cceff3ccdb78 languageName: node linkType: hard @@ -10422,9 +10442,9 @@ __metadata: linkType: hard "p-map@npm:^7.0.2": - version: 7.0.4 - resolution: "p-map@npm:7.0.4" - checksum: 10c0/a5030935d3cb2919d7e89454d1ce82141e6f9955413658b8c9403cfe379283770ed3048146b44cde168aa9e8c716505f196d5689db0ae3ce9a71521a2fef3abd + version: 7.0.6 + resolution: "p-map@npm:7.0.6" + checksum: 10c0/46e3b3c79b6179613161aa1a28c72cfe7155f27f1928afee1b2406858728f9dd4c29637bba25cef9b50517caacdcb71549f5ff228292524b0069b2310922b22e languageName: node linkType: hard @@ -10574,13 +10594,13 @@ __metadata: languageName: node linkType: hard -"path-scurry@npm:^2.0.0": - version: 2.0.1 - resolution: "path-scurry@npm:2.0.1" +"path-scurry@npm:^2.0.2": + version: 2.0.2 + resolution: "path-scurry@npm:2.0.2" dependencies: lru-cache: "npm:^11.0.0" minipass: "npm:^7.1.2" - checksum: 10c0/2a16ed0e81fbc43513e245aa5763354e25e787dab0d539581a6c3f0f967461a159ed6236b2559de23aa5b88e7dc32b469b6c47568833dd142a4b24b4f5cd2620 + checksum: 10c0/b35ad37cf6557a87fd057121ce2be7695380c9138d93e87ae928609da259ea0a170fac6f3ef1eb3ece8a068e8b7f2f3adf5bb2374cf4d4a57fe484954fcc9482 languageName: node linkType: hard @@ -10606,9 +10626,9 @@ __metadata: linkType: hard "perfect-debounce@npm:^2.0.0": - version: 2.0.0 - resolution: "perfect-debounce@npm:2.0.0" - checksum: 10c0/c08d7bf9c43f262206eceb9b3dfd332e2470b5488bb93f87721c498045e61e4f3f1d21abfe3236a8eab547c7cc031d3efb64cd3b38a85a820d5cafb4c897a8d4 + version: 2.1.0 + resolution: "perfect-debounce@npm:2.1.0" + checksum: 10c0/c4f833816f249129cea996d60b1351b640cf06954ab4eecaca440234ef70f4aefe6483637049750f5b00e15a5036307ea77f831c9779d6ad878457680af49b6d languageName: node linkType: hard @@ -10620,20 +10640,13 @@ __metadata: linkType: hard "picomatch@npm:^2.0.4, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": - version: 2.3.1 - resolution: "picomatch@npm:2.3.1" - checksum: 10c0/26c02b8d06f03206fc2ab8d16f19960f2ff9e81a658f831ecb656d8f17d9edc799e8364b1f4a7873e89d9702dff96204be0fa26fe4181f6843f040f819dac4be + version: 2.3.2 + resolution: "picomatch@npm:2.3.2" + checksum: 10c0/a554d1709e59be97d1acb9eaedbbc700a5c03dbd4579807baed95100b00420bc729335440ef15004ae2378984e2487a7c1cebd743cfdb72b6fa9ab69223c0d61 languageName: node linkType: hard -"picomatch@npm:^4.0.3": - version: 4.0.3 - resolution: "picomatch@npm:4.0.3" - checksum: 10c0/9582c951e95eebee5434f59e426cddd228a7b97a0161a375aed4be244bd3fe8e3a31b846808ea14ef2c8a2527a6eeab7b3946a67d5979e81694654f939473ae2 - languageName: node - linkType: hard - -"picomatch@npm:^4.0.4": +"picomatch@npm:^4.0.3, picomatch@npm:^4.0.4": version: 4.0.5 resolution: "picomatch@npm:4.0.5" checksum: 10c0/947bc6b6e1ff1e6c5aaf95b107a0839d12802f4f7b867663f67d47accba939ca1cb582cf99dfc30438efa1c4648ac5990967e783e8929c36b03e8440704ef1bd @@ -10657,13 +10670,13 @@ __metadata: linkType: hard "pkg-types@npm:^2.3.0": - version: 2.3.0 - resolution: "pkg-types@npm:2.3.0" + version: 2.3.1 + resolution: "pkg-types@npm:2.3.1" dependencies: - confbox: "npm:^0.2.2" - exsolve: "npm:^1.0.7" + confbox: "npm:^0.2.4" + exsolve: "npm:^1.0.8" pathe: "npm:^2.0.3" - checksum: 10c0/d2bbddc5b81bd4741e1529c08ef4c5f1542bbdcf63498b73b8e1d84cff71806d1b8b1577800549bb569cb7aa20056257677b979bff48c97967cba7e64f72ae12 + checksum: 10c0/dd9b20682426abaddcac9dc786aa22542e12df15a03dea2afa7bf54da0933358c6c7f545c0c3c1c7b24a2904ab4a451bf4e34a50c6837e458359eea30c257ed4 languageName: node linkType: hard @@ -10678,7 +10691,7 @@ __metadata: languageName: node linkType: hard -"possible-typed-array-names@npm:^1.0.0": +"possible-typed-array-names@npm:^1.0.0, possible-typed-array-names@npm:^1.1.0": version: 1.1.0 resolution: "possible-typed-array-names@npm:1.1.0" checksum: 10c0/c810983414142071da1d644662ce4caebce890203eb2bc7bf119f37f3fe5796226e117e6cca146b521921fa6531072674174a3325066ac66fce089a53e1e5196 @@ -10699,7 +10712,7 @@ __metadata: languageName: node linkType: hard -"prettier-linter-helpers@npm:^1.0.0": +"prettier-linter-helpers@npm:^1.0.1": version: 1.0.1 resolution: "prettier-linter-helpers@npm:1.0.1" dependencies: @@ -10728,20 +10741,10 @@ __metadata: languageName: node linkType: hard -"proc-log@npm:^6.0.0": - version: 6.1.0 - resolution: "proc-log@npm:6.1.0" - checksum: 10c0/4f178d4062733ead9d71a9b1ab24ebcecdfe2250916a5b1555f04fe2eda972a0ec76fbaa8df1ad9c02707add6749219d118a4fc46dc56bdfe4dde4b47d80bb82 - languageName: node - linkType: hard - -"promise-retry@npm:^2.0.1": - version: 2.0.1 - resolution: "promise-retry@npm:2.0.1" - dependencies: - err-code: "npm:^2.0.2" - retry: "npm:^0.12.0" - checksum: 10c0/9c7045a1a2928094b5b9b15336dcd2a7b1c052f674550df63cc3f36cd44028e5080448175b6f6ca32b642de81150f5e7b1a98b728f15cb069f2dd60ac2616b96 +"proc-log@npm:^7.0.0": + version: 7.0.0 + resolution: "proc-log@npm:7.0.0" + checksum: 10c0/b89c2d862604f35fec795477b0c7e376feab3ba0d4f4d291c4e959567442697cf451ac557d0623c1cc38af45a78128b983410f397a10c5d3a67f76c33de4754b languageName: node linkType: hard @@ -10806,12 +10809,12 @@ __metadata: linkType: hard "pump@npm:^3.0.0": - version: 3.0.3 - resolution: "pump@npm:3.0.3" + version: 3.0.4 + resolution: "pump@npm:3.0.4" dependencies: end-of-stream: "npm:^1.1.0" once: "npm:^1.3.1" - checksum: 10c0/ada5cdf1d813065bbc99aa2c393b8f6beee73b5de2890a8754c9f488d7323ffd2ca5f5a0943b48934e3fcbd97637d0337369c3c631aeb9614915db629f1c75c9 + checksum: 10c0/2780e66b5471c19e3e3e1063b84f3f6a3a08367f24c5ed552f98cd5901e6ada27c7ad6495d4244f553fd03b01884a4561933064f053f47c8994d84fd352768ea languageName: node linkType: hard @@ -10829,12 +10832,13 @@ __metadata: languageName: node linkType: hard -"qs@npm:~6.14.0": - version: 6.14.1 - resolution: "qs@npm:6.14.1" +"qs@npm:~6.15.1": + version: 6.15.3 + resolution: "qs@npm:6.15.3" dependencies: - side-channel: "npm:^1.1.0" - checksum: 10c0/0e3b22dc451f48ce5940cbbc7c7d9068d895074f8c969c0801ac15c1313d1859c4d738e46dc4da2f498f41a9ffd8c201bd9fb12df67799b827db94cc373d2613 + es-define-property: "npm:^1.0.1" + side-channel: "npm:^1.1.1" + checksum: 10c0/8f3f6e45ece255347d57696628401cde29e9ec649fff698b53bd3150dea7cefdf33036e1bc1826b9f110bfa7cb0ec4ab9f5297eca628ce216c55af82c304e08e languageName: node linkType: hard @@ -10929,15 +10933,15 @@ __metadata: linkType: hard "react-is@npm:^19.1.0": - version: 19.2.3 - resolution: "react-is@npm:19.2.3" - checksum: 10c0/2b54c422c21b8dbd68a435a1cce21ecd5b6f06f48659531f7d53dd7368365da5a67e946f352fb2010d11ca40658aa67bec90995f0f1ec5556c0f71dbffe54994 + version: 19.2.8 + resolution: "react-is@npm:19.2.8" + checksum: 10c0/ed5322c84efe035c8fc814b1614ff5ca7fb8c2872a7c045197daf99f9b1bd68f32a2c79ffcbcfcff2fc5d93924ff9f9447400898f5b1534e6302bb0736a257f0 languageName: node linkType: hard "react-native-builder-bob@npm:^0.40.13": - version: 0.40.17 - resolution: "react-native-builder-bob@npm:0.40.17" + version: 0.40.18 + resolution: "react-native-builder-bob@npm:0.40.18" dependencies: "@babel/core": "npm:^7.25.2" "@babel/plugin-transform-flow-strip-types": "npm:^7.26.5" @@ -10958,25 +10962,25 @@ __metadata: json5: "npm:^2.2.1" kleur: "npm:^4.1.4" prompts: "npm:^2.4.2" - react-native-monorepo-config: "npm:^0.3.1" + react-native-monorepo-config: "npm:^0.3.3" which: "npm:^2.0.2" yargs: "npm:^17.5.1" bin: bob: bin/bob - checksum: 10c0/b3bb6f907a181ea0473cbf68cbc9f594eb5f2adc885011f4d29c961258d5f123494c28565881c0190f9f1a297b11aad7a1238742dd88345b0390e4343d9c2c11 + checksum: 10c0/5f1c969d339ece33208faebbf7022c1db3ec127ab91a0f21a29e0d7cbd18dfa702586fa1169f9dd642fbceeb2733af4651143d50010effb8bb150a9bfd4cc4ff languageName: node linkType: hard "react-native-gesture-handler@npm:^3.0.2": - version: 3.0.2 - resolution: "react-native-gesture-handler@npm:3.0.2" + version: 3.1.0 + resolution: "react-native-gesture-handler@npm:3.1.0" dependencies: "@types/react-test-renderer": "npm:^19.1.0" invariant: "npm:^2.2.4" peerDependencies: react: "*" react-native: "*" - checksum: 10c0/06d2b1a621f73c148c4000692e55d5f2a44d44229cabc79829de0b0b3dbf3bcf4bc00e8635f82bd1062d7eac87f39ca5213eb1041e23a5543947e64773eaddfb + checksum: 10c0/3d5e93b7f490abb6eecfa7b292c15f14fcb89103f6adfb9a9f7a2216924ee3e860d9e68ee9973df5b42a53229174043a50b679443ff13a7bbd2bf1077c44258d languageName: node linkType: hard @@ -11010,13 +11014,13 @@ __metadata: languageName: node linkType: hard -"react-native-monorepo-config@npm:^0.3.1": - version: 0.3.2 - resolution: "react-native-monorepo-config@npm:0.3.2" +"react-native-monorepo-config@npm:^0.3.3": + version: 0.3.5 + resolution: "react-native-monorepo-config@npm:0.3.5" dependencies: escape-string-regexp: "npm:^5.0.0" fast-glob: "npm:^3.3.3" - checksum: 10c0/c711f6a898ae263b68aef3bf8bd9c3806cd489676da8c5480dd155859b47bcd49a7700f3c056896c19b3ce2c2c3ea42a5482def93b0ff03febbe023ceb128c96 + checksum: 10c0/e0343807046c16d5fb5999b966e0a70fd8a757d658f58f10bee830485fa600ffb8de9100dea1cdead36a639c3e18a0f697b35e22a5564cb74e437d8aeca30d87 languageName: node linkType: hard @@ -11031,7 +11035,7 @@ __metadata: languageName: node linkType: hard -"react-native-nitro-modules@npm:0.36.1, react-native-nitro-modules@npm:^0.36.1": +"react-native-nitro-modules@npm:0.36.1": version: 0.36.1 resolution: "react-native-nitro-modules@npm:0.36.1" peerDependencies: @@ -11041,54 +11045,64 @@ __metadata: languageName: node linkType: hard +"react-native-nitro-modules@npm:^0.36.1": + version: 0.36.5 + resolution: "react-native-nitro-modules@npm:0.36.5" + peerDependencies: + react: "*" + react-native: "*" + checksum: 10c0/c7b2133f924967b68c0f0f678b5a5dce1a784a7e22f57ebf203ef5803a5c9c745b6d4dda8c9bcedd13f7c5ca53a8707784e98572a2ca8a864fe0b905163a34b5 + languageName: node + linkType: hard + "react-native-permissions@npm:^5.4.4": - version: 5.4.4 - resolution: "react-native-permissions@npm:5.4.4" + version: 5.6.1 + resolution: "react-native-permissions@npm:5.6.1" peerDependencies: - react: ">=18.1.0" - react-native: ">=0.70.0" - react-native-windows: ">=0.70.0" + react: "*" + react-native: "*" + react-native-windows: "*" peerDependenciesMeta: react-native-windows: optional: true - checksum: 10c0/9a4fa223053db242a66c18303a525e7552e849876e927427485b0e799f46131ccbbd1ad85e6dfac146d12af942a77a95caa8649b9f4ebcfbb7f2ff6dd8fece04 + checksum: 10c0/8c64576c12df4abcdbd156ad26b9e1c272873b16de350618854225df504052b556ef7a2610e15952894072e6ae447a513773dffcca87c42395e1ad0f26d0c6c6 languageName: node linkType: hard "react-native-reanimated@npm:^4.5.1": - version: 4.5.1 - resolution: "react-native-reanimated@npm:4.5.1" + version: 4.5.3 + resolution: "react-native-reanimated@npm:4.5.3" dependencies: react-native-is-edge-to-edge: "npm:^1.3.1" semver: "npm:^7.7.3" peerDependencies: react: "*" react-native: 0.83 - 0.86 - react-native-worklets: 0.10.x - checksum: 10c0/86c64529fc5d59fb1a9083e0934c957c95c7319149efe02f92252237aa1fb208958da1c42705447c12b1d6bff3c23a354e10a05787995082eda1c284703ec0bc + react-native-worklets: 0.10.x - 0.11.x + checksum: 10c0/8297fab7ac5b4f26448f6d83f5a795045ad1dde798e7b73256728e2363b957a27f2db3c2a3c0a4c3ff96cff28da9392263a1ced64e3187d7080c647641b935d1 languageName: node linkType: hard "react-native-safe-area-context@npm:^5.6.2": - version: 5.6.2 - resolution: "react-native-safe-area-context@npm:5.6.2" + version: 5.8.0 + resolution: "react-native-safe-area-context@npm:5.8.0" peerDependencies: react: "*" react-native: "*" - checksum: 10c0/3c8df21a1dbac83116b9c9bd5d20b7c1bb7649ecef44a111af6fb6b237241f5f4d692189eec30a69f5701b857249257da3621b9e17165460a2bb71faac7b92ae + checksum: 10c0/86d1375ce17d549b541d157148d9d093f9e918de47d3b0a5cbc4cb6afe619aa52e99f07dc62ee0878eaa70e8da3411193b24cfee1b7b271ffd295d0fce83d128 languageName: node linkType: hard "react-native-screens@npm:^4.26.0": - version: 4.26.0 - resolution: "react-native-screens@npm:4.26.0" + version: 4.26.2 + resolution: "react-native-screens@npm:4.26.2" dependencies: react-freeze: "npm:^1.0.0" warn-once: "npm:^0.1.0" peerDependencies: react: "*" - react-native: ">=0.84.0" - checksum: 10c0/6abb462d71c06e91ee0237ae5281bb2e1a36411c69b1931a0d3aaac8adbf6662089eb3b5013878d69961493aac4b41b388c738e69624a5d6fe0d75f492d43a31 + react-native: "*" + checksum: 10c0/3cdc702d8e21c63331e306a2b971307d5d9e13df52d94f435c5bb8d5dcf09fed00f4ef788e85ba87fae1ba5b155f4cdc2ee177a70f1f512adff73f94eef844d1 languageName: node linkType: hard @@ -11193,27 +11207,27 @@ __metadata: linkType: soft "react-native-vision-camera-worklets@npm:^5.1.0": - version: 5.1.0 - resolution: "react-native-vision-camera-worklets@npm:5.1.0" + version: 5.2.1 + resolution: "react-native-vision-camera-worklets@npm:5.2.1" peerDependencies: react: "*" react-native: "*" react-native-nitro-modules: "*" react-native-vision-camera: "*" react-native-worklets: "*" - checksum: 10c0/fe58b63dc2ed5442c0196286e3343bf17f0698d98dc746315156086e65bc203cb467d07e91eb9ac9ae18ab2b54cf65582a00ec598d43307473b76154556d76f6 + checksum: 10c0/c1c5d70220722d468b8b4bde4e11aa42414810618c8e969b2edf475fbc835bc51c83095f040c51d556916b3b586146272fb4a7d7592ee9e2084e0a5d2870a7aa languageName: node linkType: hard "react-native-vision-camera@npm:^5.1.0": - version: 5.1.0 - resolution: "react-native-vision-camera@npm:5.1.0" + version: 5.2.1 + resolution: "react-native-vision-camera@npm:5.2.1" peerDependencies: react: "*" react-native: "*" react-native-nitro-image: "*" react-native-nitro-modules: "*" - checksum: 10c0/6fbac55b041048fbc5ffd96f3df87bd9b07a4b8dc79a16d0bfb55aa08f790d8cd322b754b84f8714787cd910c9b9e4920d9cbe24ab7674fdb0ed9e1bc42e6285 + checksum: 10c0/58e6d11ef9456f54f4b3efb770aaecec966f15798c12b5ca01863b65190df71f734d89f81b78450dad14767432a5769555c6a8bb2f3a923e1dba296319bf4a9a languageName: node linkType: hard @@ -11325,7 +11339,7 @@ __metadata: languageName: node linkType: hard -"reflect.getprototypeof@npm:^1.0.6, reflect.getprototypeof@npm:^1.0.9": +"reflect.getprototypeof@npm:^1.0.10, reflect.getprototypeof@npm:^1.0.9": version: 1.0.10 resolution: "reflect.getprototypeof@npm:1.0.10" dependencies: @@ -11400,19 +11414,19 @@ __metadata: linkType: hard "regjsparser@npm:^0.13.0": - version: 0.13.0 - resolution: "regjsparser@npm:0.13.0" + version: 0.13.2 + resolution: "regjsparser@npm:0.13.2" dependencies: jsesc: "npm:~3.1.0" bin: regjsparser: bin/parser - checksum: 10c0/4702f85cda09f67747c1b2fb673a0f0e5d1ba39d55f177632265a0be471ba59e3f320623f411649141f752b126b8126eac3ff4c62d317921e430b0472bfc6071 + checksum: 10c0/261667a3da2552619adbf331eb32b139fef6af59a88343213df2fd5635ec02eb4e7d62a5fcb3b6aecec0df84d5746d36eabfff2502fd34b8ef01b1f983779274 languageName: node linkType: hard "release-it@npm:^19.0.4": - version: 19.2.2 - resolution: "release-it@npm:19.2.2" + version: 19.2.4 + resolution: "release-it@npm:19.2.4" dependencies: "@nodeutils/defaults-deep": "npm:1.1.0" "@octokit/rest": "npm:22.0.1" @@ -11433,13 +11447,13 @@ __metadata: proxy-agent: "npm:6.5.0" semver: "npm:7.7.3" tinyglobby: "npm:0.2.15" - undici: "npm:6.22.0" + undici: "npm:6.23.0" url-join: "npm:5.0.0" wildcard-match: "npm:5.1.4" yargs-parser: "npm:21.1.1" bin: release-it: bin/release-it.js - checksum: 10c0/922a84d79631178da8badb7ae35eb831af09220f368a3b2d8dbb97f884e8942603aa082e166da40c342710afdb479cbdee4ff5b813730cace019e871ee7d0df2 + checksum: 10c0/54888f271b665a4efc57b635664438ab256193d24a10928e19997c38b854056ad1bb2d653ede85c7552d45ecdcb1f1aa8861b8c0c27f9aaaf00ba916d3ae1781 languageName: node linkType: hard @@ -11494,55 +11508,63 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.20.0, resolve@npm:^1.22.10": - version: 1.22.11 - resolution: "resolve@npm:1.22.11" +"resolve@npm:^1.20.0, resolve@npm:^1.22.10, resolve@npm:^1.22.11": + version: 1.22.12 + resolution: "resolve@npm:1.22.12" dependencies: + es-errors: "npm:^1.3.0" is-core-module: "npm:^2.16.1" path-parse: "npm:^1.0.7" supports-preserve-symlinks-flag: "npm:^1.0.0" bin: resolve: bin/resolve - checksum: 10c0/f657191507530f2cbecb5815b1ee99b20741ea6ee02a59c57028e9ec4c2c8d7681afcc35febbd554ac0ded459db6f2d8153382c53a2f266cee2575e512674409 + checksum: 10c0/b16dc9b537c02e8c3388f7d3dcff9741d3071625f9a97ac1c885f2b0ca51e78df22328fb6d6ef214dd9101fb7cfc19aa2836fe3410402a94f3f7b8639c7149bf languageName: node linkType: hard "resolve@npm:^2.0.0-next.5": - version: 2.0.0-next.5 - resolution: "resolve@npm:2.0.0-next.5" + version: 2.0.0-next.7 + resolution: "resolve@npm:2.0.0-next.7" dependencies: - is-core-module: "npm:^2.13.0" + es-errors: "npm:^1.3.0" + is-core-module: "npm:^2.16.2" + node-exports-info: "npm:^1.6.0" + object-keys: "npm:^1.1.1" path-parse: "npm:^1.0.7" supports-preserve-symlinks-flag: "npm:^1.0.0" bin: resolve: bin/resolve - checksum: 10c0/a6c33555e3482ea2ec4c6e3d3bf0d78128abf69dca99ae468e64f1e30acaa318fd267fb66c8836b04d558d3e2d6ed875fe388067e7d8e0de647d3c21af21c43a + checksum: 10c0/8c6fa17ccdb826a3a52387ed8c42bf705dbc19d5494da52a86661b124b5b88fad5d8edbbb4434a1b563ecf7768368b7da9fb9489e20f36e02f7551a4ea87d707 languageName: node linkType: hard -"resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.10#optional!builtin": - version: 1.22.11 - resolution: "resolve@patch:resolve@npm%3A1.22.11#optional!builtin::version=1.22.11&hash=c3c19d" +"resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.10#optional!builtin, resolve@patch:resolve@npm%3A^1.22.11#optional!builtin": + version: 1.22.12 + resolution: "resolve@patch:resolve@npm%3A1.22.12#optional!builtin::version=1.22.12&hash=c3c19d" dependencies: + es-errors: "npm:^1.3.0" is-core-module: "npm:^2.16.1" path-parse: "npm:^1.0.7" supports-preserve-symlinks-flag: "npm:^1.0.0" bin: resolve: bin/resolve - checksum: 10c0/ee5b182f2e37cb1165465e58c6abc797fec0a80b5ba3231607beb4677db0c9291ac010c47cf092b6daa2b7f518d69a0e21888e7e2b633f68d501a874212a8c63 + checksum: 10c0/fc6519984ae1f894d877c0060ba8b1f5ba3bc0e85a02f74e141929c118c23d74d9735619a9cc2965397387e514884245c65d72a40731dcb6cfc84c7bcdc8321e languageName: node linkType: hard "resolve@patch:resolve@npm%3A^2.0.0-next.5#optional!builtin": - version: 2.0.0-next.5 - resolution: "resolve@patch:resolve@npm%3A2.0.0-next.5#optional!builtin::version=2.0.0-next.5&hash=c3c19d" + version: 2.0.0-next.7 + resolution: "resolve@patch:resolve@npm%3A2.0.0-next.7#optional!builtin::version=2.0.0-next.7&hash=c3c19d" dependencies: - is-core-module: "npm:^2.13.0" + es-errors: "npm:^1.3.0" + is-core-module: "npm:^2.16.2" + node-exports-info: "npm:^1.6.0" + object-keys: "npm:^1.1.1" path-parse: "npm:^1.0.7" supports-preserve-symlinks-flag: "npm:^1.0.0" bin: resolve: bin/resolve - checksum: 10c0/78ad6edb8309a2bfb720c2c1898f7907a37f858866ce11a5974643af1203a6a6e05b2fa9c53d8064a673a447b83d42569260c306d43628bff5bb101969708355 + checksum: 10c0/6bb6f1d8a1789f7a5b4e35d950e76bc0ba632ff7d51fe86b6f34fb5f41e1ce0f7b884ec166828cfc0728ddffeaee49527711d752d12398297f90c51acd22195e languageName: node linkType: hard @@ -11573,13 +11595,6 @@ __metadata: languageName: node linkType: hard -"retry@npm:^0.12.0": - version: 0.12.0 - resolution: "retry@npm:0.12.0" - checksum: 10c0/59933e8501727ba13ad73ef4a04d5280b3717fd650408460c987392efe9d7be2040778ed8ebe933c5cbd63da3dcc37919c141ef8af0a54a6e4fca5a2af177bfe - languageName: node - linkType: hard - "reusify@npm:^1.0.4": version: 1.1.0 resolution: "reusify@npm:1.1.0" @@ -11631,15 +11646,15 @@ __metadata: linkType: hard "safe-array-concat@npm:^1.1.3": - version: 1.1.3 - resolution: "safe-array-concat@npm:1.1.3" + version: 1.1.4 + resolution: "safe-array-concat@npm:1.1.4" dependencies: - call-bind: "npm:^1.0.8" - call-bound: "npm:^1.0.2" - get-intrinsic: "npm:^1.2.6" + call-bind: "npm:^1.0.9" + call-bound: "npm:^1.0.4" + get-intrinsic: "npm:^1.3.0" has-symbols: "npm:^1.1.0" isarray: "npm:^2.0.5" - checksum: 10c0/43c86ffdddc461fb17ff8a17c5324f392f4868f3c7dd2c6a5d9f5971713bc5fd755667212c80eab9567595f9a7509cc2f83e590ddaebd1bd19b780f9c79f9a8d + checksum: 10c0/95fb4904ab1d9360a666fe5ba6d88f1c4a3a39682739e4512cff809fc6b5722a94bd95189211015bfb45859a7ffbc3340ea303ae22721c91c59e8946d310975a languageName: node linkType: hard @@ -11692,7 +11707,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:7.7.3, semver@npm:^7.1.3, semver@npm:^7.3.5, semver@npm:^7.5.2, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.7.3": +"semver@npm:7.7.3": version: 7.7.3 resolution: "semver@npm:7.7.3" bin: @@ -11710,7 +11725,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.7.4": +"semver@npm:^7.1.3, semver@npm:^7.3.5, semver@npm:^7.5.2, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.7.3, semver@npm:^7.7.4": version: 7.8.5 resolution: "semver@npm:7.8.5" bin: @@ -11833,20 +11848,20 @@ __metadata: languageName: node linkType: hard -"shell-quote@npm:^1.6.1, shell-quote@npm:^1.8.3": - version: 1.8.3 - resolution: "shell-quote@npm:1.8.3" - checksum: 10c0/bee87c34e1e986cfb4c30846b8e6327d18874f10b535699866f368ade11ea4ee45433d97bf5eada22c4320c27df79c3a6a7eb1bf3ecfc47f2c997d9e5e2672fd +"shell-quote@npm:^1.6.1, shell-quote@npm:^1.8.4": + version: 1.10.0 + resolution: "shell-quote@npm:1.10.0" + checksum: 10c0/46ee59bfd972ce6a45500c44ed130dff2d0a7d6fbac9841e59d548518cad8060a06393c9a5dcbc0cede294ad80b2a2cd8c904679e09265f53efc0a0879f30961 languageName: node linkType: hard -"side-channel-list@npm:^1.0.0": - version: 1.0.0 - resolution: "side-channel-list@npm:1.0.0" +"side-channel-list@npm:^1.0.1": + version: 1.0.1 + resolution: "side-channel-list@npm:1.0.1" dependencies: es-errors: "npm:^1.3.0" - object-inspect: "npm:^1.13.3" - checksum: 10c0/644f4ac893456c9490ff388bf78aea9d333d5e5bfc64cfb84be8f04bf31ddc111a8d4b83b85d7e7e8a7b845bc185a9ad02c052d20e086983cf59f0be517d9b3d + object-inspect: "npm:^1.13.4" + checksum: 10c0/d346c787fd2f9f1c2fdea14f00e8250118db0e7596d85a6cb9faa75f105d31a73a8f7a341c93d7df2a2429098c3d37a77bd3be9e88c37094b8c01807bc77c7a2 languageName: node linkType: hard @@ -11875,16 +11890,16 @@ __metadata: languageName: node linkType: hard -"side-channel@npm:^1.1.0": - version: 1.1.0 - resolution: "side-channel@npm:1.1.0" +"side-channel@npm:^1.1.0, side-channel@npm:^1.1.1": + version: 1.1.1 + resolution: "side-channel@npm:1.1.1" dependencies: es-errors: "npm:^1.3.0" - object-inspect: "npm:^1.13.3" - side-channel-list: "npm:^1.0.0" + object-inspect: "npm:^1.13.4" + side-channel-list: "npm:^1.0.1" side-channel-map: "npm:^1.0.1" side-channel-weakmap: "npm:^1.0.2" - checksum: 10c0/cb20dad41eb032e6c24c0982e1e5a24963a28aa6122b4f05b3f3d6bf8ae7fd5474ef382c8f54a6a3ab86e0cac4d41a23bd64ede3970e5bfb50326ba02a7996e6 + checksum: 10c0/dc0ab81d67f61bda9247d053ce93f41c3fd8ad2bdcb9cf9d8d2f8540d488f26d87a5e99ebfc07eea49ec025867b2452b705442d974b1478f0395e69f6bfb3270 languageName: node linkType: hard @@ -11968,7 +11983,7 @@ __metadata: languageName: node linkType: hard -"socks-proxy-agent@npm:^8.0.3, socks-proxy-agent@npm:^8.0.5": +"socks-proxy-agent@npm:^8.0.5": version: 8.0.5 resolution: "socks-proxy-agent@npm:8.0.5" dependencies: @@ -11980,12 +11995,12 @@ __metadata: linkType: hard "socks@npm:^2.8.3": - version: 2.8.7 - resolution: "socks@npm:2.8.7" + version: 2.8.9 + resolution: "socks@npm:2.8.9" dependencies: - ip-address: "npm:^10.0.1" + ip-address: "npm:^10.1.1" smart-buffer: "npm:^4.2.0" - checksum: 10c0/2805a43a1c4bcf9ebf6e018268d87b32b32b06fbbc1f9282573583acc155860dc361500f89c73bfbb157caa1b4ac78059eac0ef15d1811eb0ca75e0bdadbc9d2 + checksum: 10c0/2d4350c31142b0931eb1758825b426bcbf4bfb5eed682ca48bc46dc9e7d1930ec366ea574ad49fc6c1fd9e9e17ce243be0ef13e31fc4b0319d9093f1fb19743c languageName: node linkType: hard @@ -12051,9 +12066,9 @@ __metadata: linkType: hard "spdx-license-ids@npm:^3.0.0": - version: 3.0.22 - resolution: "spdx-license-ids@npm:3.0.22" - checksum: 10c0/4a85e44c2ccfc06eebe63239193f526508ebec1abc7cf7bca8ee43923755636234395447c2c87f40fb672cf580a9c8e684513a676bfb2da3d38a4983684bbb38 + version: 3.0.23 + resolution: "spdx-license-ids@npm:3.0.23" + checksum: 10c0/8495620f6f2a237749cce922ea2d593a66f7885c301b1a0f5542183e7041182f27f616a8f13345cefdea0c9b3e0899328e0aa8cec100cf4f3fac4bb3bd975515 languageName: node linkType: hard @@ -12078,15 +12093,6 @@ __metadata: languageName: node linkType: hard -"ssri@npm:^13.0.0": - version: 13.0.0 - resolution: "ssri@npm:13.0.0" - dependencies: - minipass: "npm:^7.0.3" - checksum: 10c0/405f3a531cd98b013cecb355d63555dca42fd12c7bc6671738aaa9a82882ff41cdf0ef9a2b734ca4f9a760338f114c29d01d9238a65db3ccac27929bd6e6d4b2 - languageName: node - linkType: hard - "stack-utils@npm:^2.0.3": version: 2.0.6 resolution: "stack-utils@npm:2.0.6" @@ -12207,13 +12213,13 @@ __metadata: languageName: node linkType: hard -"string-width@npm:^8.1.0": - version: 8.1.0 - resolution: "string-width@npm:8.1.0" +"string-width@npm:^8.1.0, string-width@npm:^8.2.1": + version: 8.2.2 + resolution: "string-width@npm:8.2.2" dependencies: - get-east-asian-width: "npm:^1.3.0" - strip-ansi: "npm:^7.1.0" - checksum: 10c0/749b5d0dab2532b4b6b801064230f4da850f57b3891287023117ab63a464ad79dd208f42f793458f48f3ad121fe2e1f01dd525ff27ead957ed9f205e27406593 + get-east-asian-width: "npm:^1.5.0" + strip-ansi: "npm:^7.1.2" + checksum: 10c0/895624534e4e2f229e880bbc30aa77bdeb758e1a0edce203e0a17b8b4f08b8d3c1156516efc50a35e3efd0052d938a73797692111250ac9f52ee384710a01714 languageName: node linkType: hard @@ -12249,29 +12255,30 @@ __metadata: linkType: hard "string.prototype.trim@npm:^1.2.10": - version: 1.2.10 - resolution: "string.prototype.trim@npm:1.2.10" + version: 1.2.11 + resolution: "string.prototype.trim@npm:1.2.11" dependencies: - call-bind: "npm:^1.0.8" - call-bound: "npm:^1.0.2" + call-bind: "npm:^1.0.9" + call-bound: "npm:^1.0.4" define-data-property: "npm:^1.1.4" define-properties: "npm:^1.2.1" - es-abstract: "npm:^1.23.5" - es-object-atoms: "npm:^1.0.0" + es-abstract: "npm:^1.24.2" + es-object-atoms: "npm:^1.1.2" has-property-descriptors: "npm:^1.0.2" - checksum: 10c0/8a8854241c4b54a948e992eb7dd6b8b3a97185112deb0037a134f5ba57541d8248dd610c966311887b6c2fd1181a3877bffb14d873ce937a344535dabcc648f8 + safe-regex-test: "npm:^1.1.0" + checksum: 10c0/b153cf8ed06db82ff40e27829e88e5c13f45eff9799f1d5707626e25989b488b059d6f5d57011e07f77745e28451e16735f295bc59c8ae146a4fd73a442366b0 languageName: node linkType: hard "string.prototype.trimend@npm:^1.0.9": - version: 1.0.9 - resolution: "string.prototype.trimend@npm:1.0.9" + version: 1.0.10 + resolution: "string.prototype.trimend@npm:1.0.10" dependencies: - call-bind: "npm:^1.0.8" - call-bound: "npm:^1.0.2" + call-bind: "npm:^1.0.9" + call-bound: "npm:^1.0.4" define-properties: "npm:^1.2.1" - es-object-atoms: "npm:^1.0.0" - checksum: 10c0/59e1a70bf9414cb4c536a6e31bef5553c8ceb0cf44d8b4d0ed65c9653358d1c64dd0ec203b100df83d0413bbcde38b8c5d49e14bc4b86737d74adc593a0d35b6 + es-object-atoms: "npm:^1.1.2" + checksum: 10c0/cc09233181769047a5330becfd5740fec5f0c8137886e7b553626788b00f75df9f34db1159bc52dbb7fc389b8ebb6e1dab44c8c9e31eb600039729a542013286 languageName: node linkType: hard @@ -12314,11 +12321,11 @@ __metadata: linkType: hard "strip-ansi@npm:^7.0.1, strip-ansi@npm:^7.1.0, strip-ansi@npm:^7.1.2": - version: 7.1.2 - resolution: "strip-ansi@npm:7.1.2" + version: 7.2.0 + resolution: "strip-ansi@npm:7.2.0" dependencies: - ansi-regex: "npm:^6.0.1" - checksum: 10c0/0d6d7a023de33368fd042aab0bf48f4f4077abdfd60e5393e73c7c411e85e1b3a83507c11af2e656188511475776215df9ca589b4da2295c9455cc399ce1858b + ansi-regex: "npm:^6.2.2" + checksum: 10c0/544d13b7582f8254811ea97db202f519e189e59d35740c46095897e254e4f1aa9fe1524a83ad6bc5ad67d4dd6c0281d2e0219ed62b880a6238a16a17d375f221 languageName: node linkType: hard @@ -12350,7 +12357,7 @@ __metadata: languageName: node linkType: hard -"strnum@npm:^1.1.1": +"strnum@npm:^1.0.5": version: 1.1.2 resolution: "strnum@npm:1.1.2" checksum: 10c0/a0fce2498fa3c64ce64a40dada41beb91cabe3caefa910e467dc0518ef2ebd7e4d10f8c2202a6104f1410254cae245066c0e94e2521fb4061a5cb41831952392 @@ -12382,31 +12389,31 @@ __metadata: languageName: node linkType: hard -"synckit@npm:^0.11.7": - version: 0.11.11 - resolution: "synckit@npm:0.11.11" +"synckit@npm:^0.11.13": + version: 0.11.13 + resolution: "synckit@npm:0.11.13" dependencies: - "@pkgr/core": "npm:^0.2.9" - checksum: 10c0/f0761495953d12d94a86edf6326b3a565496c72f9b94c02549b6961fb4d999f4ca316ce6b3eb8ed2e4bfc5056a8de65cda0bd03a233333a35221cd2fdc0e196b + "@pkgr/core": "npm:^0.3.6" + checksum: 10c0/5a6c19f4f79045aaa7994106401bff6dbe7cca23a6d0a0723ff14eb8b1bebeb4a71729118f6914905598e304ea2fa13509885e11ba07d92e7cb68a06740cb328 languageName: node linkType: hard -"tar@npm:^7.5.2": - version: 7.5.2 - resolution: "tar@npm:7.5.2" +"tar@npm:^7.5.4": + version: 7.5.22 + resolution: "tar@npm:7.5.22" dependencies: "@isaacs/fs-minipass": "npm:^4.0.0" chownr: "npm:^3.0.0" minipass: "npm:^7.1.2" minizlib: "npm:^3.1.0" yallist: "npm:^5.0.0" - checksum: 10c0/a7d8b801139b52f93a7e34830db0de54c5aa45487c7cb551f6f3d44a112c67f1cb8ffdae856b05fd4f17b1749911f1c26f1e3a23bbe0279e17fd96077f13f467 + checksum: 10c0/1311f6be85a8157ac4c9147bae43e13923d2a1aae15e4aa1bd5239e4e03d2cf53cfe103dde7f35832fbb4c938b042856bc8e9a0afd29abd05e2d1608788c4fea languageName: node linkType: hard "terser@npm:^5.15.0": - version: 5.44.1 - resolution: "terser@npm:5.44.1" + version: 5.49.0 + resolution: "terser@npm:5.49.0" dependencies: "@jridgewell/source-map": "npm:^0.3.3" acorn: "npm:^8.15.0" @@ -12414,7 +12421,7 @@ __metadata: source-map-support: "npm:~0.5.20" bin: terser: bin/terser - checksum: 10c0/ee7a76692cb39b1ed22c30ff366c33ff3c977d9bb769575338ff5664676168fcba59192fb5168ef80c7cd901ef5411a1b0351261f5eaa50decf0fc71f63bde75 + checksum: 10c0/c1f628a7a6226f7283db92ce43247306d612b80a60a075d97e1f5539a032beee05c87f889eacff2ffabd2fa9ac6bd1c147e5eb49c6546c9b174ed241d5f056a7 languageName: node linkType: hard @@ -12450,14 +12457,14 @@ __metadata: languageName: node linkType: hard -"tinyexec@npm:^1.0.0, tinyexec@npm:^1.0.1": - version: 1.0.2 - resolution: "tinyexec@npm:1.0.2" - checksum: 10c0/1261a8e34c9b539a9aae3b7f0bb5372045ff28ee1eba035a2a059e532198fe1a182ec61ac60fa0b4a4129f0c4c4b1d2d57355b5cb9aa2d17ac9454ecace502ee +"tinyexec@npm:^1.0.0, tinyexec@npm:^1.2.4": + version: 1.3.0 + resolution: "tinyexec@npm:1.3.0" + checksum: 10c0/e9b89f97489d2aab2cef408da279e6b32547e738d1275032ccb8fd0028a006d93eb70fc51c6cffd9fc2f5aca6c2a273d8b6f73b52d46ee5116da6b94969ef958 languageName: node linkType: hard -"tinyglobby@npm:0.2.15, tinyglobby@npm:^0.2.12": +"tinyglobby@npm:0.2.15": version: 0.2.15 resolution: "tinyglobby@npm:0.2.15" dependencies: @@ -12467,7 +12474,7 @@ __metadata: languageName: node linkType: hard -"tinyglobby@npm:^0.2.14, tinyglobby@npm:^0.2.15": +"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.14, tinyglobby@npm:^0.2.15": version: 0.2.17 resolution: "tinyglobby@npm:0.2.17" dependencies: @@ -12526,74 +12533,32 @@ __metadata: languageName: node linkType: hard -"turbo-darwin-64@npm:2.7.2": - version: 2.7.2 - resolution: "turbo-darwin-64@npm:2.7.2" - conditions: os=darwin & cpu=x64 - languageName: node - linkType: hard - -"turbo-darwin-arm64@npm:2.7.2": - version: 2.7.2 - resolution: "turbo-darwin-arm64@npm:2.7.2" - conditions: os=darwin & cpu=arm64 - languageName: node - linkType: hard - -"turbo-linux-64@npm:2.7.2": - version: 2.7.2 - resolution: "turbo-linux-64@npm:2.7.2" - conditions: os=linux & cpu=x64 - languageName: node - linkType: hard - -"turbo-linux-arm64@npm:2.7.2": - version: 2.7.2 - resolution: "turbo-linux-arm64@npm:2.7.2" - conditions: os=linux & cpu=arm64 - languageName: node - linkType: hard - -"turbo-windows-64@npm:2.7.2": - version: 2.7.2 - resolution: "turbo-windows-64@npm:2.7.2" - conditions: os=win32 & cpu=x64 - languageName: node - linkType: hard - -"turbo-windows-arm64@npm:2.7.2": - version: 2.7.2 - resolution: "turbo-windows-arm64@npm:2.7.2" - conditions: os=win32 & cpu=arm64 - languageName: node - linkType: hard - "turbo@npm:^2.5.6": - version: 2.7.2 - resolution: "turbo@npm:2.7.2" - dependencies: - turbo-darwin-64: "npm:2.7.2" - turbo-darwin-arm64: "npm:2.7.2" - turbo-linux-64: "npm:2.7.2" - turbo-linux-arm64: "npm:2.7.2" - turbo-windows-64: "npm:2.7.2" - turbo-windows-arm64: "npm:2.7.2" + version: 2.10.8 + resolution: "turbo@npm:2.10.8" + dependencies: + "@turbo/darwin-64": "npm:2.10.8" + "@turbo/darwin-arm64": "npm:2.10.8" + "@turbo/linux-64": "npm:2.10.8" + "@turbo/linux-arm64": "npm:2.10.8" + "@turbo/windows-64": "npm:2.10.8" + "@turbo/windows-arm64": "npm:2.10.8" dependenciesMeta: - turbo-darwin-64: + "@turbo/darwin-64": optional: true - turbo-darwin-arm64: + "@turbo/darwin-arm64": optional: true - turbo-linux-64: + "@turbo/linux-64": optional: true - turbo-linux-arm64: + "@turbo/linux-arm64": optional: true - turbo-windows-64: + "@turbo/windows-64": optional: true - turbo-windows-arm64: + "@turbo/windows-arm64": optional: true bin: turbo: bin/turbo - checksum: 10c0/390937a32070ac52120af56705006e831de2edf8e22a2b0146006d07740cd413b3a36335339e7617b57cf74b008f4b15931cf56e1c7c0c03808f028ed937c4de + checksum: 10c0/892459ca52bdcc0ecd50d0bd5e092bc97052ff726fd727af7df997e6b8ff20b1aea6040caac14c2ceb661f18b08e7abd2027d188f8a67bc74dcab0c043060026 languageName: node linkType: hard @@ -12684,16 +12649,16 @@ __metadata: linkType: hard "typed-array-length@npm:^1.0.7": - version: 1.0.7 - resolution: "typed-array-length@npm:1.0.7" + version: 1.0.8 + resolution: "typed-array-length@npm:1.0.8" dependencies: - call-bind: "npm:^1.0.7" - for-each: "npm:^0.3.3" - gopd: "npm:^1.0.1" - is-typed-array: "npm:^1.1.13" - possible-typed-array-names: "npm:^1.0.0" - reflect.getprototypeof: "npm:^1.0.6" - checksum: 10c0/e38f2ae3779584c138a2d8adfa8ecf749f494af3cd3cdafe4e688ce51418c7d2c5c88df1bd6be2bbea099c3f7cea58c02ca02ed438119e91f162a9de23f61295 + call-bind: "npm:^1.0.9" + for-each: "npm:^0.3.5" + gopd: "npm:^1.2.0" + is-typed-array: "npm:^1.1.15" + possible-typed-array-names: "npm:^1.1.0" + reflect.getprototypeof: "npm:^1.0.10" + checksum: 10c0/5319f740fc426a3217182c2f7c87656acb0903e046de5a938e30167337d26abf1bb3ad4b32833a72521a4cc58223aec80627b38b357d0a3d5fd64881427e77ab languageName: node linkType: hard @@ -12766,10 +12731,10 @@ __metadata: languageName: node linkType: hard -"undici@npm:6.22.0": - version: 6.22.0 - resolution: "undici@npm:6.22.0" - checksum: 10c0/47903c489d73e26bd47960cf2f04d63282ed050818b672cb05f8dfb6403381b850cf1b1751832654fd3af22aacd9d780e5e61aff563cd97943f5c4f10d5b3e23 +"undici@npm:6.28.0": + version: 6.28.0 + resolution: "undici@npm:6.28.0" + checksum: 10c0/3029a70df06b38b5b2f30732932a1e92544c753cd82c8abdf0d35afad48e0ba91612e79fe3a442dbbb9434d6a9eba2b714d5ea28984c903dda2b5d5444f38354 languageName: node linkType: hard @@ -12818,24 +12783,6 @@ __metadata: languageName: node linkType: hard -"unique-filename@npm:^5.0.0": - version: 5.0.0 - resolution: "unique-filename@npm:5.0.0" - dependencies: - unique-slug: "npm:^6.0.0" - checksum: 10c0/afb897e9cf4c2fb622ea716f7c2bb462001928fc5f437972213afdf1cc32101a230c0f1e9d96fc91ee5185eca0f2feb34127145874975f347be52eb91d6ccc2c - languageName: node - linkType: hard - -"unique-slug@npm:^6.0.0": - version: 6.0.0 - resolution: "unique-slug@npm:6.0.0" - dependencies: - imurmurhash: "npm:^0.1.4" - checksum: 10c0/da7ade4cb04eb33ad0499861f82fe95ce9c7c878b7139dc54d140ecfb6a6541c18a5c8dac16188b8b379fe62c0c1f1b710814baac910cde5f4fec06212126c6a - languageName: node - linkType: hard - "universal-user-agent@npm:^7.0.0, universal-user-agent@npm:^7.0.2": version: 7.0.3 resolution: "universal-user-agent@npm:7.0.3" @@ -12864,7 +12811,7 @@ __metadata: languageName: node linkType: hard -"update-browserslist-db@npm:^1.2.0": +"update-browserslist-db@npm:^1.2.3": version: 1.2.3 resolution: "update-browserslist-db@npm:1.2.3" dependencies: @@ -13063,17 +13010,17 @@ __metadata: linkType: hard "which-typed-array@npm:^1.1.16, which-typed-array@npm:^1.1.19": - version: 1.1.19 - resolution: "which-typed-array@npm:1.1.19" + version: 1.1.22 + resolution: "which-typed-array@npm:1.1.22" dependencies: available-typed-arrays: "npm:^1.0.7" - call-bind: "npm:^1.0.8" + call-bind: "npm:^1.0.9" call-bound: "npm:^1.0.4" for-each: "npm:^0.3.5" get-proto: "npm:^1.0.1" gopd: "npm:^1.2.0" has-tostringtag: "npm:^1.0.2" - checksum: 10c0/702b5dc878addafe6c6300c3d0af5983b175c75fcb4f2a72dfc3dd38d93cf9e89581e4b29c854b16ea37e50a7d7fca5ae42ece5c273d8060dcd603b2404bbb3f + checksum: 10c0/e59db184a4e78b461fac3b05fafc1e7badbbedafbf04a967ee1de73717f1f9723a79699e7b5de71d449541cb5da8353efc01a4f8a72a152479850e54fa196c40 languageName: node linkType: hard @@ -13088,14 +13035,14 @@ __metadata: languageName: node linkType: hard -"which@npm:^6.0.0": - version: 6.0.0 - resolution: "which@npm:6.0.0" +"which@npm:^7.0.0": + version: 7.0.0 + resolution: "which@npm:7.0.0" dependencies: - isexe: "npm:^3.1.1" + isexe: "npm:^4.0.0" bin: node-which: bin/which.js - checksum: 10c0/fe9d6463fe44a76232bb6e3b3181922c87510a5b250a98f1e43a69c99c079b3f42ddeca7e03d3e5f2241bf2d334f5a7657cfa868b97c109f3870625842f4cc15 + checksum: 10c0/ca0b54f198f78bbc4b7c02e34bda8d335cb352e0adb4cbca1c37b1a957af3a879a82c4c27ca6525bc942f548d8b64f816ef6528360af9f3de55ffb9b979b620d languageName: node linkType: hard @@ -13191,17 +13138,17 @@ __metadata: linkType: hard "ws@npm:^6.2.3": - version: 6.2.3 - resolution: "ws@npm:6.2.3" + version: 6.2.6 + resolution: "ws@npm:6.2.6" dependencies: async-limiter: "npm:~1.0.0" - checksum: 10c0/56a35b9799993cea7ce2260197e7879f21bbbb194a967f31acbbda6f7f46ecda4365951966fb062044c95197e19fb2f053be6f65c172435455186835f494de41 + checksum: 10c0/24245efc3c09b6175df32ddb4a06f85432c4c88abb0e75f43f2551c1d5de456218b1b6c7685c414b8e03a68a167488e4aadf04a895681c8e01502025ce505742 languageName: node linkType: hard "ws@npm:^7, ws@npm:^7.5.10": - version: 7.5.10 - resolution: "ws@npm:7.5.10" + version: 7.5.13 + resolution: "ws@npm:7.5.13" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ^5.0.2 @@ -13210,7 +13157,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: 10c0/bd7d5f4aaf04fae7960c23dcb6c6375d525e00f795dd20b9385902bd008c40a94d3db3ce97d878acc7573df852056ca546328b27b39f47609f80fb22a0a9b61d + checksum: 10c0/e223726bbda5768ed58ec9252d04eda7018ef380ea122bb94e595a4d7a02b5baeb423933936576fddb8fa51b642375f7ae814bf0f6f5d9a3ce290566578a8c5a languageName: node linkType: hard @@ -13278,13 +13225,6 @@ __metadata: languageName: node linkType: hard -"yallist@npm:^4.0.0": - version: 4.0.0 - resolution: "yallist@npm:4.0.0" - checksum: 10c0/2286b5e8dbfe22204ab66e2ef5cc9bbb1e55dfc873bbe0d568aa943eb255d131890dfd5bf243637273d31119b870f49c18fcde2c6ffbb7a7a092b870dc90625a - languageName: node - linkType: hard - "yallist@npm:^5.0.0": version: 5.0.0 resolution: "yallist@npm:5.0.0" @@ -13293,11 +13233,11 @@ __metadata: linkType: hard "yaml@npm:^2.2.1, yaml@npm:^2.6.1": - version: 2.8.2 - resolution: "yaml@npm:2.8.2" + version: 2.9.0 + resolution: "yaml@npm:2.9.0" bin: yaml: bin.mjs - checksum: 10c0/703e4dc1e34b324aa66876d63618dcacb9ed49f7e7fe9b70f1e703645be8d640f68ab84f12b86df8ac960bac37acf5513e115de7c970940617ce0343c8c9cd96 + checksum: 10c0/f340718df45e97a9551b9bf9dac61c80050bc464513b710debfb5067c380c8472e3b67809cffacb4ab5ffb5e66ef9310816c88b05f371cec60abfedd8c88e0a2 languageName: node linkType: hard @@ -13345,8 +13285,8 @@ __metadata: linkType: hard "yargs@npm:^17.0.0, yargs@npm:^17.3.1, yargs@npm:^17.5.1, yargs@npm:^17.6.2": - version: 17.7.2 - resolution: "yargs@npm:17.7.2" + version: 17.7.3 + resolution: "yargs@npm:17.7.3" dependencies: cliui: "npm:^8.0.1" escalade: "npm:^3.1.1" @@ -13355,21 +13295,21 @@ __metadata: string-width: "npm:^4.2.3" y18n: "npm:^5.0.5" yargs-parser: "npm:^21.1.1" - checksum: 10c0/ccd7e723e61ad5965fffbb791366db689572b80cca80e0f96aad968dfff4156cd7cd1ad18607afe1046d8241e6fb2d6c08bf7fa7bfb5eaec818735d8feac8f05 + checksum: 10c0/7a28572f7e785a57886e34fdbddb9b28756dec552e1453d5f6e7cdd00ad8721a4e8c4321d33683f5e61cacb36ad43258adbb48396b71ec4ed14abee0fc0d0c1f languageName: node linkType: hard "yargs@npm:^18.0.0": - version: 18.0.0 - resolution: "yargs@npm:18.0.0" + version: 18.1.0 + resolution: "yargs@npm:18.1.0" dependencies: cliui: "npm:^9.0.1" escalade: "npm:^3.1.1" get-caller-file: "npm:^2.0.5" - string-width: "npm:^7.2.0" + string-width: "npm:^8.2.1" y18n: "npm:^5.0.5" yargs-parser: "npm:^22.0.0" - checksum: 10c0/bf290e4723876ea9c638c786a5c42ac28e03c9ca2325e1424bf43b94e5876456292d3ed905b853ebbba6daf43ed29e772ac2a6b3c5fb1b16533245d6211778f3 + checksum: 10c0/86052bbed90a9aaaaf1eabe004f47c7420e1b7f8d314170cfb0ad4721f518ec2fb7ba5a6daa20708b1595aba257f1554b2d5b3f5606356f86aa9dae18de0bec5 languageName: node linkType: hard @@ -13395,9 +13335,9 @@ __metadata: linkType: hard "yoctocolors@npm:^2.1.1": - version: 2.1.2 - resolution: "yoctocolors@npm:2.1.2" - checksum: 10c0/b220f30f53ebc2167330c3adc86a3c7f158bcba0236f6c67e25644c3188e2571a6014ffc1321943bb619460259d3d27eb4c9cc58c2d884c1b195805883ec7066 + version: 2.2.0 + resolution: "yoctocolors@npm:2.2.0" + checksum: 10c0/ca179aa83401aa0711f268fda38145a44c828e612a5f5265439efb5796cd63c46ca6b786bae3b74c75440a48518c36b5b23cba7fbb76ea8af5a9f85f830a5754 languageName: node linkType: hard @@ -13418,8 +13358,8 @@ __metadata: linkType: hard "zustand@npm:^5.0.9": - version: 5.0.9 - resolution: "zustand@npm:5.0.9" + version: 5.0.14 + resolution: "zustand@npm:5.0.14" peerDependencies: "@types/react": ">=18.0.0" immer: ">=9.0.6" @@ -13434,6 +13374,6 @@ __metadata: optional: true use-sync-external-store: optional: true - checksum: 10c0/552849e4546c7760704d6509a5c412d57c62a1fa9e53169c939ba5e3d75f8cb3df50a64c3a22e6c3f1c8cc00de7543e4edd61ab5ae0c9169ba9a98e28303aba6 + checksum: 10c0/89de0c8119f1e0861b2f896a0b4df0d67994a373ecee02628d4e7b97cee1885207f646917d3ede395c3a5083316d48846855cfbc84aced7cd23a6db3238930a8 languageName: node linkType: hard